Package org.nuiton.jaxx.widgets.select
Class BeanDoubleListModel<O>
- java.lang.Object
-
- org.jdesktop.beans.AbstractBean
-
- org.jdesktop.beans.AbstractSerializableBean
-
- org.nuiton.jaxx.widgets.select.BeanDoubleListModel<O>
-
- Type Parameters:
O- the type of the object in the list
- All Implemented Interfaces:
Serializable
public class BeanDoubleListModel<O> extends org.jdesktop.beans.AbstractSerializableBeanThe model of theBeanDoubleListwidget- Since:
- 2.5.8
- Author:
- Kevin Morin - kmorin@codelutin.com
- See Also:
BeanDoubleList, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaddEnabledprotected Collection<Predicate<List<O>>>canRemoveItemsPredicatesstatic StringPROPERTY_ADD_ENABLEDstatic StringPROPERTY_REMOVE_ENABLEDstatic StringPROPERTY_SELECTED_DOWN_ENABLEDstatic StringPROPERTY_SELECTED_UP_ENABLEDstatic StringPROPERTY_USE_MULTI_SELECTprotected booleanremoveEnabledprotected List<O>selectedList of the selected itemsprotected booleanselectedDownEnabledprotected JaxxDefaultListModel<O>selectedModelModel containing the selected itemsprotected booleanselectedUpEnabledprotected List<O>universeList of all the available itemsprotected JaxxFilterableListModel<O>universeModelModel containing the remaining available itemsprotected booleanuseMultiSelect
-
Constructor Summary
Constructors Constructor Description BeanDoubleListModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCanRemoveItemsPredicate(Predicate<List<O>> canRemoveItemsPredicate)voidaddToSelected(List<O> items)Adds a list of items to the selected items.voidaddToSelected(O item)Adds an item to the selected items.protected voidaddToUniverseList(O item)Adds an item to the available items list at the right index to keep always the same order.booleancomputeRemoveEnabled(List<O> toRemoveItems)List<O>getSelected()To get the selected items.intgetSelectedListSize()ListModel<O>getSelectedModel()List<O>getUniverse()To get all the available items.JaxxFilterableListModel<O>getUniverseModel()booleanisAddEnabled()booleanisRemoveEnabled()booleanisSelectedDownEnabled()booleanisSelectedUpEnabled()booleanisUseMultiSelect()voidmoveDownSelected(O item)Move down a selected item.voidmoveUpSelected(O item)Move up a selected item.voidremoveCanRemoveItemsPredicate(Predicate<List<O>> canRemoveItemsPredicate)voidremoveFromSelected(List<O> items)Removes a list of items from the list of selected items.voidremoveFromSelected(O item)Removes an item from the selected items.protected voidresetUniverse()voidsetAddEnabled(boolean addEnabled)voidsetRemoveEnabled(boolean removeEnabled)voidsetSelected(List<O> selected)Sets the list of selected items.voidsetSelectedDownEnabled(boolean selectedDownEnabled)voidsetSelectedUpEnabled(boolean selectedUpEnabled)voidsetUniverse(List<O> universe)Sets the list of the available items.voidsetUseMultiSelect(boolean useMultiSelect)-
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Field Detail
-
PROPERTY_ADD_ENABLED
public static final String PROPERTY_ADD_ENABLED
- See Also:
- Constant Field Values
-
PROPERTY_REMOVE_ENABLED
public static final String PROPERTY_REMOVE_ENABLED
- See Also:
- Constant Field Values
-
PROPERTY_SELECTED_UP_ENABLED
public static final String PROPERTY_SELECTED_UP_ENABLED
- See Also:
- Constant Field Values
-
PROPERTY_SELECTED_DOWN_ENABLED
public static final String PROPERTY_SELECTED_DOWN_ENABLED
- See Also:
- Constant Field Values
-
PROPERTY_USE_MULTI_SELECT
public static final String PROPERTY_USE_MULTI_SELECT
- See Also:
- Constant Field Values
-
universeModel
protected final JaxxFilterableListModel<O> universeModel
Model containing the remaining available items
-
selectedModel
protected final JaxxDefaultListModel<O> selectedModel
Model containing the selected items
-
addEnabled
protected boolean addEnabled
-
removeEnabled
protected boolean removeEnabled
-
selectedUpEnabled
protected boolean selectedUpEnabled
-
selectedDownEnabled
protected boolean selectedDownEnabled
-
useMultiSelect
protected boolean useMultiSelect
-
canRemoveItemsPredicates
protected final Collection<Predicate<List<O>>> canRemoveItemsPredicates
-
-
Method Detail
-
setSelected
public void setSelected(List<O> selected)
Sets the list of selected items. It fills the model of the list of the selected items with these items and removes them from the model of list of the universe.- Parameters:
selected- a list of O
-
setUniverse
public void setUniverse(List<O> universe)
Sets the list of the available items. It fills the model of the universe list with these items.- Parameters:
universe- a list of O
-
resetUniverse
protected void resetUniverse()
-
getUniverseModel
public JaxxFilterableListModel<O> getUniverseModel()
-
addToSelected
public void addToSelected(O item)
Adds an item to the selected items.- Parameters:
item- the item to select
-
addToSelected
public void addToSelected(List<O> items)
Adds a list of items to the selected items.- Parameters:
items- the list of the items to select
-
removeFromSelected
public void removeFromSelected(O item)
Removes an item from the selected items.- Parameters:
item- the item to unselect
-
removeFromSelected
public void removeFromSelected(List<O> items)
Removes a list of items from the list of selected items.- Parameters:
items- the list of the items to unselect
-
moveUpSelected
public void moveUpSelected(O item)
Move up a selected item.- Parameters:
item- the selected item- Since:
- 2.5.26
-
moveDownSelected
public void moveDownSelected(O item)
Move down a selected item.- Parameters:
item- the selected item- Since:
- 2.5.26
-
isAddEnabled
public boolean isAddEnabled()
-
setAddEnabled
public void setAddEnabled(boolean addEnabled)
-
isRemoveEnabled
public boolean isRemoveEnabled()
-
setRemoveEnabled
public void setRemoveEnabled(boolean removeEnabled)
-
isSelectedUpEnabled
public boolean isSelectedUpEnabled()
-
setSelectedUpEnabled
public void setSelectedUpEnabled(boolean selectedUpEnabled)
-
isSelectedDownEnabled
public boolean isSelectedDownEnabled()
-
setSelectedDownEnabled
public void setSelectedDownEnabled(boolean selectedDownEnabled)
-
isUseMultiSelect
public boolean isUseMultiSelect()
-
setUseMultiSelect
public void setUseMultiSelect(boolean useMultiSelect)
-
addToUniverseList
protected void addToUniverseList(O item)
Adds an item to the available items list at the right index to keep always the same order.- Parameters:
item- the item to add to the universe list
-
getSelectedListSize
public int getSelectedListSize()
-
addCanRemoveItemsPredicate
public void addCanRemoveItemsPredicate(Predicate<List<O>> canRemoveItemsPredicate)
-
removeCanRemoveItemsPredicate
public void removeCanRemoveItemsPredicate(Predicate<List<O>> canRemoveItemsPredicate)
-
-