Class AddRemoveItemSupport<T>
java.lang.Object
com.inductiveautomation.ignition.designer.mvvm.binders.swing.util.AddRemoveItemSupport<T>
- All Implemented Interfaces:
Disposable
Algorithm for adding and removing items from lists and tables.
Bind the
add()
and removeSelected()
methods to click properties of the Add and Click buttons.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAddRemoveItemSupport
(PropertyPublisher<List<T>> data, PropertyPublisher<T> selection, Supplier<T> creator) Variant with the defaultminimumItemCount
set at 0, that is all items can be removed from a list.AddRemoveItemSupport
(PropertyPublisher<List<T>> data, PropertyPublisher<T> selection, Supplier<T> creator, int minimumItemCount) Upon initialization,removeEnabled
state will be evaluated. -
Method Summary
-
Constructor Details
-
AddRemoveItemSupport
public AddRemoveItemSupport(PropertyPublisher<List<T>> data, PropertyPublisher<T> selection, Supplier<T> creator) Variant with the defaultminimumItemCount
set at 0, that is all items can be removed from a list. -
AddRemoveItemSupport
public AddRemoveItemSupport(PropertyPublisher<List<T>> data, PropertyPublisher<T> selection, Supplier<T> creator, int minimumItemCount) Upon initialization,removeEnabled
state will be evaluated.- Parameters:
data
- List to which items will be added or removed.selection
- The item selected for removal, or null (if there are no selection).creator
- Whenadd()
is called, this method will supply new items for adding to the list.minimumItemCount
- Threshold for which remove will not be enabled.
-
-
Method Details
-
reinitialize
public void reinitialize() -
add
public void add() -
removeSelected
If an item was successfully removed, this will return the now current selected item.- Returns:
- The item that's currently selected after the remove, or null, if the remove results in no new selection.
-
removeEnabled
-
createBindingSource
-
dispose
public void dispose()- Specified by:
dispose
in interfaceDisposable
-