it.amattioli.applicate.browsing
Class DefaultGroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>

Show UML class diagram
java.lang.Object
  extended by it.amattioli.applicate.browsing.DefaultGroupBrowser<I,T>
All Implemented Interfaces:
Browser<I,T>, GroupBrowser<I,T>, CommandListener, Selector<T>, EventListener

public class DefaultGroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
extends Object
implements GroupBrowser<I,T>


Nested Class Summary
 
Nested classes/interfaces inherited from interface it.amattioli.applicate.browsing.GroupBrowser
GroupBrowser.Selection
 
Constructor Summary
DefaultGroupBrowser()
           
DefaultGroupBrowser(it.amattioli.dominate.groups.EntityGroupFactory<I,T> groupFactory)
           
 
Method Summary
 void addContentChangeListener(ContentChangeListener listener)
          Add a listener for events fired when the browser content changes.
 void addSelectionListener(SelectionListener listener)
          Register a listener for the object selection.
 void commandDone(CommandEvent e)
          This method will be called every time a CommandEvent is fired by the command to which this listener has been added.
 void deselect()
          Removes all the selections
protected  void fireContentChange()
           
 it.amattioli.dominate.groups.EntityGroup<I,T> getGroup(int index)
          Retrieves the group with a given index inside the GroupBrowser.getGroups() list.
 it.amattioli.dominate.groups.EntityGroupFactory<I,T> getGroupFactory()
           
 List<it.amattioli.dominate.groups.EntityGroup<I,T>> getGroups()
          Retrieves all the available groups
 int getGroupSize(int index)
          Retrieves the size of the group with a given index.
 T getMember(int groupIndex, int memberIndex)
          Retrieves a member of a given group.
 List<Integer> getSelectedGroupsIndex()
          Return the indexes of all the groups that are selected as of GroupBrowser.isGroupSelected(int)
 T getSelectedObject()
          Retrieves the object currently selected.
 List<T> getSelectedObjects()
          Returns a list containing all the selected objects.
 GroupBrowser.Selection getSelection()
          Returns a GroupBrowser.Selection object containing the group and member indexes of the last selected entity.
 List<GroupBrowser.Selection> getSelections()
          Returns a list of GroupBrowser.Selection containing the indexes of all the selected objects.
 boolean isGroupSelected(int index)
          Check if a group is selected.
 boolean isMultiple()
          Check if this browser is in multiple mode
 boolean isSelected(int index, int i)
          Check if an entity is selected.
 void release()
          Releases eventually acquired resources.
 void removeContentChangeListener(ContentChangeListener listener)
          Remove a listener for events fired when the browser content changes.
 void removeSelectionListener(SelectionListener listener)
          Remove a listener from the collection of the listeners that will be notified when an object is slected in this browser.
 void select(int groupIndex, int memberIndex)
          Select a member of a group using the group and member index.
 void select(T toBeSelected)
          Select a member of a group.
 void selectGroup(it.amattioli.dominate.groups.EntityGroup<I,T> toBeSelected)
          Select all the members of a group.
 void selectGroup(int index)
          Select all the members of a group.
 void setGroupFactory(it.amattioli.dominate.groups.EntityGroupFactory<I,T> groupFactory)
           
 void setMultiple(boolean multiple)
          Set the selection mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGroupBrowser

public DefaultGroupBrowser()

DefaultGroupBrowser

public DefaultGroupBrowser(it.amattioli.dominate.groups.EntityGroupFactory<I,T> groupFactory)
Method Detail

setGroupFactory

public void setGroupFactory(it.amattioli.dominate.groups.EntityGroupFactory<I,T> groupFactory)

getGroupFactory

public it.amattioli.dominate.groups.EntityGroupFactory<I,T> getGroupFactory()

getGroups

public List<it.amattioli.dominate.groups.EntityGroup<I,T>> getGroups()
Description copied from interface: GroupBrowser
Retrieves all the available groups

Specified by:
getGroups in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:
all the available groups

getGroup

public it.amattioli.dominate.groups.EntityGroup<I,T> getGroup(int index)
Description copied from interface: GroupBrowser
Retrieves the group with a given index inside the GroupBrowser.getGroups() list.

Specified by:
getGroup in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
index - the group index
Returns:
the group with a given index

getGroupSize

public int getGroupSize(int index)
Description copied from interface: GroupBrowser
Retrieves the size of the group with a given index.

Specified by:
getGroupSize in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
index - the group index
Returns:
the size of the group with the given index

getMember

public T getMember(int groupIndex,
                   int memberIndex)
Description copied from interface: GroupBrowser
Retrieves a member of a given group.

Specified by:
getMember in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
groupIndex - the index of the group inside the GroupBrowser.getGroups() list
memberIndex - the index of the member inside the group
Returns:
a member of a given group

addContentChangeListener

public void addContentChangeListener(ContentChangeListener listener)
Description copied from interface: Browser
Add a listener for events fired when the browser content changes.

Specified by:
addContentChangeListener in interface Browser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be added

removeContentChangeListener

public void removeContentChangeListener(ContentChangeListener listener)
Description copied from interface: Browser
Remove a listener for events fired when the browser content changes.

Specified by:
removeContentChangeListener in interface Browser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be removed

release

public void release()
Description copied from interface: Browser
Releases eventually acquired resources. After calling this method the browser can no longer be used.

Specified by:
release in interface Browser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>

commandDone

public void commandDone(CommandEvent e)
Description copied from interface: CommandListener
This method will be called every time a CommandEvent is fired by the command to which this listener has been added.

Specified by:
commandDone in interface CommandListener
Parameters:
e - the fired event

fireContentChange

protected void fireContentChange()

addSelectionListener

public void addSelectionListener(SelectionListener listener)
Description copied from interface: Selector
Register a listener for the object selection. Every time an object is selected in this browser all the registered objects will be notified.

Specified by:
addSelectionListener in interface Selector<T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be registered

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Description copied from interface: Selector
Remove a listener from the collection of the listeners that will be notified when an object is slected in this browser.

Specified by:
removeSelectionListener in interface Selector<T extends it.amattioli.dominate.Entity<I>>
Parameters:
listener - the listener to be removed

isMultiple

public boolean isMultiple()
Description copied from interface: GroupBrowser
Check if this browser is in multiple mode

Specified by:
isMultiple in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:
true if this browser is in multiple mode, false if it is in single mode

setMultiple

public void setMultiple(boolean multiple)
Description copied from interface: GroupBrowser
Set the selection mode. Passing true will set the multiple mode, while passing false will select the single mode.

Specified by:
setMultiple in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
multiple - true to set the multiple mode, false to set the single mode

getSelectedObject

public T getSelectedObject()
Description copied from interface: Selector
Retrieves the object currently selected.

Specified by:
getSelectedObject in interface Selector<T extends it.amattioli.dominate.Entity<I>>
Returns:
the object currently selected or null if no object is selected

getSelectedObjects

public List<T> getSelectedObjects()
Description copied from interface: GroupBrowser
Returns a list containing all the selected objects.

In single mode the list will contain only the last selected object.

Specified by:
getSelectedObjects in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:

getSelection

public GroupBrowser.Selection getSelection()
Description copied from interface: GroupBrowser
Returns a GroupBrowser.Selection object containing the group and member indexes of the last selected entity.

Specified by:
getSelection in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:

getSelections

public List<GroupBrowser.Selection> getSelections()
Description copied from interface: GroupBrowser
Returns a list of GroupBrowser.Selection containing the indexes of all the selected objects.

In single mode the list will contain only the last selected object.

Specified by:
getSelections in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:

select

public void select(int groupIndex,
                   int memberIndex)
Description copied from interface: GroupBrowser
Select a member of a group using the group and member index.

Specified by:
select in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
groupIndex - the index of the group inside the GroupBrowser.getGroups() list
memberIndex - the index of the member inside the group

select

public void select(T toBeSelected)
Description copied from interface: GroupBrowser
Select a member of a group.

Specified by:
select in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
toBeSelected - the member to be selected

isSelected

public boolean isSelected(int index,
                          int i)
Description copied from interface: GroupBrowser
Check if an entity is selected.

Specified by:
isSelected in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
index - the group index
i - the index of the member inside the group
Returns:
true if the entity with the given indexes is selected

selectGroup

public void selectGroup(int index)
Description copied from interface: GroupBrowser
Select all the members of a group.

Specified by:
selectGroup in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
index - the index of the group inside the GroupBrowser.getGroups() list

selectGroup

public void selectGroup(it.amattioli.dominate.groups.EntityGroup<I,T> toBeSelected)
Description copied from interface: GroupBrowser
Select all the members of a group.

Specified by:
selectGroup in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
toBeSelected - the group to be selected

getSelectedGroupsIndex

public List<Integer> getSelectedGroupsIndex()
Description copied from interface: GroupBrowser
Return the indexes of all the groups that are selected as of GroupBrowser.isGroupSelected(int)

Specified by:
getSelectedGroupsIndex in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Returns:
the indexes of all the groups that are selected

isGroupSelected

public boolean isGroupSelected(int index)
Description copied from interface: GroupBrowser
Check if a group is selected. A group is considered selected if all its members are selected.

Specified by:
isGroupSelected in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>
Parameters:
index - the group index
Returns:
true if the group is selected

deselect

public void deselect()
Description copied from interface: GroupBrowser
Removes all the selections

Specified by:
deselect in interface GroupBrowser<I extends Serializable,T extends it.amattioli.dominate.Entity<I>>


Copyright © 2011. All Rights Reserved.