Package jaxx.runtime.swing.editor.bean
Class BeanDoubleListModel<O>
java.lang.Object
org.jdesktop.beans.AbstractBean
org.jdesktop.beans.AbstractSerializableBean
jaxx.runtime.swing.editor.bean.BeanDoubleListModel<O>
- Type Parameters:
O- the type of the object in the list
- All Implemented Interfaces:
java.io.Serializable
public class BeanDoubleListModel<O>
extends org.jdesktop.beans.AbstractSerializableBean
The model of the
BeanDoubleList widget- 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 java.util.Collection<com.google.common.base.Predicate<java.util.List<O>>>canRemoveItemsPredicatesstatic java.lang.StringPROPERTY_ADD_ENABLEDstatic java.lang.StringPROPERTY_REMOVE_ENABLEDstatic java.lang.StringPROPERTY_SELECTED_DOWN_ENABLEDstatic java.lang.StringPROPERTY_SELECTED_UP_ENABLEDstatic java.lang.StringPROPERTY_USE_MULTI_SELECTprotected booleanremoveEnabledprotected java.util.List<O>selectedList of the selected itemsprotected booleanselectedDownEnabledprotected JaxxDefaultListModel<O>selectedModelModel containing the selected itemsprotected booleanselectedUpEnabledprotected java.util.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
Modifier and Type Method Description voidaddCanRemoveItemsPredicate(com.google.common.base.Predicate<java.util.List<O>> canRemoveItemsPredicate)voidaddToSelected(java.util.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(java.util.List<O> toRemoveItems)java.util.List<O>getSelected()To get the selected items.intgetSelectedListSize()javax.swing.ListModelgetSelectedModel()java.util.List<O>getUniverse()To get all the available items.javax.swing.ListModelgetUniverseModel()booleanisAddEnabled()booleanisRemoveEnabled()booleanisSelectedDownEnabled()booleanisSelectedUpEnabled()booleanisUseMultiSelect()voidmoveDownSelected(O item)Move down a selected item.voidmoveUpSelected(O item)Move up a selected item.voidremoveCanRemoveItemsPredicate(com.google.common.base.Predicate<java.util.List<O>> canRemoveItemsPredicate)voidremoveFromSelected(java.util.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(java.util.List<O> selected)Sets the list of selected items.voidsetSelectedDownEnabled(boolean selectedDownEnabled)voidsetSelectedUpEnabled(boolean selectedUpEnabled)voidsetUniverse(java.util.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, removeVetoableChangeListenerMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
PROPERTY_ADD_ENABLED
public static final java.lang.String PROPERTY_ADD_ENABLED- See Also:
- Constant Field Values
-
PROPERTY_REMOVE_ENABLED
public static final java.lang.String PROPERTY_REMOVE_ENABLED- See Also:
- Constant Field Values
-
PROPERTY_SELECTED_UP_ENABLED
public static final java.lang.String PROPERTY_SELECTED_UP_ENABLED- See Also:
- Constant Field Values
-
PROPERTY_SELECTED_DOWN_ENABLED
public static final java.lang.String PROPERTY_SELECTED_DOWN_ENABLED- See Also:
- Constant Field Values
-
PROPERTY_USE_MULTI_SELECT
public static final java.lang.String PROPERTY_USE_MULTI_SELECT- See Also:
- Constant Field Values
-
universe
List of all the available items -
universeModel
Model containing the remaining available items -
selected
List of the selected items -
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 java.util.Collection<com.google.common.base.Predicate<java.util.List<O>>> canRemoveItemsPredicates
-
-
Constructor Details
-
BeanDoubleListModel
public BeanDoubleListModel()
-
-
Method Details
-
getSelected
To get the selected items.- Returns:
- a list of O
-
setSelected
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
-
getUniverse
To get all the available items.- Returns:
- a list of O
-
setUniverse
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() -
getSelectedModel
public javax.swing.ListModel getSelectedModel() -
getUniverseModel
public javax.swing.ListModel getUniverseModel() -
addToSelected
Adds an item to the selected items.- Parameters:
item- the item to select
-
addToSelected
Adds a list of items to the selected items.- Parameters:
items- the list of the items to select
-
removeFromSelected
Removes an item from the selected items.- Parameters:
item- the item to unselect
-
removeFromSelected
Removes a list of items from the list of selected items.- Parameters:
items- the list of the items to unselect
-
moveUpSelected
Move up a selected item.- Parameters:
item- the selected item- Since:
- 2.5.26
-
moveDownSelected
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
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(com.google.common.base.Predicate<java.util.List<O>> canRemoveItemsPredicate) -
removeCanRemoveItemsPredicate
public void removeCanRemoveItemsPredicate(com.google.common.base.Predicate<java.util.List<O>> canRemoveItemsPredicate) -
computeRemoveEnabled
-