it.amattioli.applicate.browsing
Interface ListBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>

Show UML class diagram
Type Parameters:
I - the identifier class of the entities that can be browsed
T - the class of the entities that can be browsed
All Superinterfaces:
Browser<I,T>, CommandListener, EventListener, Selector<T>
All Known Subinterfaces:
PagedListBrowser<I,T>
All Known Implementing Classes:
ListBrowserImpl, MultiBrowser, PagedListBrowserImpl

public interface ListBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
extends Browser<I,T>, CommandListener

A ListBrowser object allows the navigation throw the entities contained in a repository in a sequential way. The browser allows objects filtering and sorting, the selection of an object and forward/backward selection navigation. You can obtain and ObjectBrowser on the selected object whose content change when a new object is selected in this browser.

Author:
a.mattioli

Method Summary
 void addOrder(String property)
          Add a property that will be used to sort the browsing objects.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a listener for PropertyChangeEvent events.
 void deselect()
          Removes the current selection.
 void fillCollection(Collection<? super T> toBeFilled)
          Fill a collection with the browsing objects.
 it.amattioli.dominate.Filter getFilter()
          Deprecated. 
 boolean getHasNext()
          Indicate if there is an object next to the currently selected object.
 boolean getHasPrevious()
          Indicate if there is an object previous to the currently selected object.
 List<T> getList()
          Retrieves the list of the browsing objects.
 String getOrderProperty()
          Retrieves the name of the property of the browsing objects that will be used to sort the list of browsing objects.
 boolean getReverseOrder()
          Indicates if the order is direct or reverse.
 Integer getSelectedIndex()
          Retrieves the index of the object currently selected.
 ObjectBrowser<I,T> getSelectedObjectBrowser()
          Retrieves a ObjectBrowser for the selected object.
 it.amattioli.dominate.Specification<T> getSpecification()
          Retrieves the specification object set by setSpecification(Specification)
 ObjectBrowser<I,T> newObjectBrowser()
          Create a new ObjectBrowser for the currently selected object.
 void next()
          Move the selection to the object next to the currently selected object.
 void previous()
          Move the selection to the object previous to the currently selected object.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a listener for PropertyChangeEvent events.
 void select(int index)
          Select an object using its index inside the list retrieved using getList().
 void select(T object)
          Select an object.
 void setFilter(it.amattioli.dominate.Filter filter)
          Deprecated. 
 void setOrder(String property)
          Set the property that will be used to sort the browsing objects.
 void setOrder(String property, boolean reverse)
          Set the property that will be used to sort the browsing objects.
 void setSpecification(it.amattioli.dominate.Specification<T> spec)
          Set the specification to be used to filter the browsing objects.
 void useObjectBrowserClass(Class<? extends ObjectBrowserImpl<I,T>> objectBrowserClass)
          Set the class that will be used by newObjectBrowser().
 
Methods inherited from interface it.amattioli.applicate.browsing.Browser
addContentChangeListener, release, removeContentChangeListener
 
Methods inherited from interface it.amattioli.applicate.selection.Selector
addSelectionListener, getSelectedObject, removeSelectionListener
 
Methods inherited from interface it.amattioli.applicate.commands.CommandListener
commandDone
 

Method Detail

getList

List<T> getList()
Retrieves the list of the browsing objects. This list will be the content of the repository on which this browser is based, filtered using the criteria specified by setCriteria. The list will be sorted using the property specified by setOrder. If something causes the changing of the list of browsing objects a PropertyChange event will be fired.

Returns:
the list of the browsing objects

fillCollection

void fillCollection(Collection<? super T> toBeFilled)
Fill a collection with the browsing objects. The parameter collection will be filled with the same objects that will be returned by getList().

Parameters:
toBeFilled - the collection to be filled

setFilter

@Deprecated
void setFilter(it.amattioli.dominate.Filter filter)
Deprecated. 

Set the criteria to be used to filter the browsing objects. The getList() method will return only the objects that satisfy the specified criteria. The browser will listen on property changes of the filter bean so to refresh the browsing objects accordingly.

Parameters:
filter - the criteria that will be used to filter the browsing objects

getFilter

@Deprecated
it.amattioli.dominate.Filter getFilter()
Deprecated. 

Retrieves the filter object set by setFilter(Filter).

Returns:
the filter object set by setFilter(Filter)

setSpecification

void setSpecification(it.amattioli.dominate.Specification<T> spec)
Set the specification to be used to filter the browsing objects. The getList() method will return only the objects that satisfy the specification. The browser will listen on property changes of the specification bean so to refresh the browsing objects accordingly.

Parameters:
spec - the specification that will be used to filter the browsing objects

getSpecification

it.amattioli.dominate.Specification<T> getSpecification()
Retrieves the specification object set by setSpecification(Specification)

Returns:
the specification object set by setSpecification(Specification)

setOrder

void setOrder(String property,
              boolean reverse)
Set the property that will be used to sort the browsing objects.

Parameters:
property - the name of a property of the browsing objects that will be used to sort the list of browsing objects
reverse - if true the objects will be sort in reverse order

setOrder

void setOrder(String property)
Set the property that will be used to sort the browsing objects. If this method is called more than one time with the same parameter the order will be reversed.

Parameters:
property - the name of a property of the browsing objects that will be used to sort the list of browsing objects

addOrder

void addOrder(String property)
Add a property that will be used to sort the browsing objects. If a previous order property was set it will remain in place and the new property will be added to the list.

Parameters:
property -

getOrderProperty

String getOrderProperty()
Retrieves the name of the property of the browsing objects that will be used to sort the list of browsing objects.

Returns:
the name of the property of the browsing objects that will be used to sort the list of browsing objects or null if no sorting property was set

getReverseOrder

boolean getReverseOrder()
Indicates if the order is direct or reverse.

Returns:
true if the order is reversed

select

void select(int index)
Select an object using its index inside the list retrieved using getList(). After the selection a SelectionEvent will be notified to all the objects that has been registered using #addContentChangeListener(BrowserSelectionListener).

Parameters:
index - the index inside the list retrieved using getList() of the object to be selected

select

void select(T object)
Select an object. After the selection a SelectionEvent will be notified to all the objects that has been registered using #addContentChangeListener(BrowserSelectionListener).

Parameters:
object - the object to be selected

deselect

void deselect()
Removes the current selection. After this every call to Selector.getSelectedObject() and getSelectedIndex() will return null.


getSelectedIndex

Integer getSelectedIndex()
Retrieves the index of the object currently selected. It is the same number that must be used to select it using select(int).

Returns:
the index of the object currently selected or null if no object is selected

next

void next()
Move the selection to the object next to the currently selected object. If the currently selected object is the last of the list, nothing will happen.


getHasNext

boolean getHasNext()
Indicate if there is an object next to the currently selected object.

Returns:
true if there is an object next to the currently selected object, false if the currently selected object is the last in the list

previous

void previous()
Move the selection to the object previous to the currently selected object. If the currently selected object is the first of the list, nothing will happen.


getHasPrevious

boolean getHasPrevious()
Indicate if there is an object previous to the currently selected object.

Returns:
true if there is an object previous to the currently selected object, false if the currently selected object is the first in the list

useObjectBrowserClass

void useObjectBrowserClass(Class<? extends ObjectBrowserImpl<I,T>> objectBrowserClass)
Set the class that will be used by newObjectBrowser().

Parameters:
objectBrowserClass - the class that will be used by newObjectBrowser()

newObjectBrowser

ObjectBrowser<I,T> newObjectBrowser()
Create a new ObjectBrowser for the currently selected object. The object created will be an instance of the class set using useObjectBrowserClass(Class). If no object browser class was specified ObjectBrowserImpl will be used.

Returns:
the new ObjectBrowser

getSelectedObjectBrowser

ObjectBrowser<I,T> getSelectedObjectBrowser()
Retrieves a ObjectBrowser for the selected object. This ObjectBrowser will be created the first time this method is called and will be linked to the currently selected object. Every time a new object is elected in the browser the ObjectBrowser will be notified so it can refresh itself to contain the currently slected object.

Returns:
a ObjectBrowser for the selected object

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Add a listener for PropertyChangeEvent events.

Parameters:
listener - a listener for PropertyChangeEvent events

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Remove a listener for PropertyChangeEvent events.

Parameters:
listener - a listener for PropertyChangeEvent events


Copyright © 2011. All Rights Reserved.