Class SelectObjectsFromTableToolItemProperties<V,X>
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.toolitems.ToolItemProperties<SelectObjectsFromTableToolItemProperties<V,X>>
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.toolitems.SelectObjectsFromTableToolItemProperties<V,X>
- Type Parameters:
V- the type of elements managed by the tableX- the type of objects that can be selected in the dialog
public class SelectObjectsFromTableToolItemProperties<V,X>
extends ToolItemProperties<SelectObjectsFromTableToolItemProperties<V,X>>
A builder class for configuring properties of a select objects from table tool item in table toolbars.
The tool item opens a dialog with a table of objects whose type can differ from the type of the table rows,
and passes the checked objects to the handler.
- Author:
- Ionov Ivan
-
Field Summary
Fields inherited from class com.amalgamasimulation.desktop.ui.editor.sections.descriptors.toolitems.ToolItemProperties
icon, style, text, toolTip -
Method Summary
Modifier and TypeMethodDescriptionallObjects(Supplier<List<? extends X>> allObjects) Sets a dynamic supplier of all objects available for selection.allObjects(List<? extends X> allObjects) Sets a static list of all objects available for selection.Sets the column configuration for the selection dialog table.Returns the supplier of all objects available for selection.Returns the column configuration consumer for the selection dialog table.BiConsumer<Table<V>, List<X>> Returns the handler that receives the objects checked in the dialog.Returns the function that gives the objects checked when the dialog opens.Returns the title for the selection dialog.Sets the handler that receives the objects checked in the dialog.static <V,X> SelectObjectsFromTableToolItemProperties <V, X> Creates a new SelectObjectsFromTableToolItemProperties instance.Sets which objects are checked when the dialog opens.Sets the title for the selection dialog.Methods inherited from class com.amalgamasimulation.desktop.ui.editor.sections.descriptors.toolitems.ToolItemProperties
enabled, getIcon, getStyle, getText, getThis, getToolTip, icon, isEnabled, isShowTextAndIcon, showTextAndIcon, style, text, toolTip
-
Method Details
-
newInstance
Creates a new SelectObjectsFromTableToolItemProperties instance.- Type Parameters:
V- the type of elements in the tableX- the type of objects to select- Returns:
- a new SelectObjectsFromTableToolItemProperties instance
-
getAllObjects
Returns the supplier of all objects available for selection.- Returns:
- a Supplier providing a List of all selectable objects
-
allObjects
Sets a static list of all objects available for selection.- Parameters:
allObjects- a List of all selectable objects- Returns:
- this SelectObjectsFromTableToolItemProperties instance for method chaining
-
allObjects
public SelectObjectsFromTableToolItemProperties<V,X> allObjects(Supplier<List<? extends X>> allObjects) Sets a dynamic supplier of all objects available for selection.- Parameters:
allObjects- a Supplier providing a List of all selectable objects- Returns:
- this SelectObjectsFromTableToolItemProperties instance for method chaining
-
getColumnsForDialog
Returns the column configuration consumer for the selection dialog table.- Returns:
- a Consumer that configures columns for the selection dialog table
-
columns
Sets the column configuration for the selection dialog table.- Parameters:
columnsForDialog- a Consumer that configures columns for the selection dialog table- Returns:
- this SelectObjectsFromTableToolItemProperties instance for method chaining
-
getTitleDialog
Returns the title for the selection dialog.- Returns:
- the dialog title, or null if not set
-
title
Sets the title for the selection dialog.- Parameters:
titleDialog- the title to display in the selection dialog- Returns:
- this SelectObjectsFromTableToolItemProperties instance for method chaining
-
getSelectedObjects
Returns the function that gives the objects checked when the dialog opens.- Returns:
- a Function from the current table rows to the checked objects
-
selectedObjects
public SelectObjectsFromTableToolItemProperties<V,X> selectedObjects(Function<List<V>, List<? extends X>> selectedObjects) Sets which objects are checked when the dialog opens. The function receives the current table rows. By default nothing is checked.- Parameters:
selectedObjects- a Function from the current table rows to the checked objects- Returns:
- this SelectObjectsFromTableToolItemProperties instance for method chaining
-
getHandler
Returns the handler that receives the objects checked in the dialog.- Returns:
- a BiConsumer that receives the table and the checked objects
-
handler
Sets the handler that receives the objects checked in the dialog. It is called only when the dialog is closed with OK, and the table is refreshed afterwards. In EMF tables, make changes through the CommandsManager command stack so they can be undone.- Parameters:
handler- a BiConsumer that receives the table and the checked objects- Returns:
- this SelectObjectsFromTableToolItemProperties instance for method chaining
-