Class OperableManagerController<I,E extends DetailModel<I>>
java.lang.Object
cz.masci.springfx.mvci.controller.impl.OperableManagerController<I,E>
- Type Parameters:
I- the type of the id of the elementsE- the type of the elements that can be managed
The OperableManagerController class is a generic class that provides operations for managing objects in a list.
It supports adding and removing elements, selecting and focusing elements, updating dirty elements, and discarding changes.
-
Constructor Summary
ConstructorsConstructorDescriptionOperableManagerController(T model, javafx.collections.ObservableList<E> elements) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an element to the list of elements managed by the OperableManagerController.voidAdds all elements from the given list to the elements managed by the OperableManagerController.voiddiscard()Discards changes made to the dirty elements in the list of elements managed by the OperableManagerController.voidupdate(BiConsumer<E, Consumer<E>> updateAction) Updates the elements in the list of elements managed by the OperableManagerController.
-
Constructor Details
-
OperableManagerController
-
-
Method Details
-
add
Adds an element to the list of elements managed by the OperableManagerController. Does the following: 1. Adds the element to the elements list. 2. Selects the element using the Selectable interface. 3. Focuses on the element using the Focusable interface.- Parameters:
element- the element to be added
-
addAll
Adds all elements from the given list to the elements managed by the OperableManagerController. This method performs the following operations: 1. Unselects the currently selected element by calling the select() method of the Selectable interface with a null argument. 2. Clears the elements list. 3. Adds all elements from the given list to the elements list.- Parameters:
newElements- the list of new elements to be added
-
update
Updates the elements in the list of elements managed by the OperableManagerController. 1. Filters the dirty elements that are valid. 2. For each valid dirty element, the updateAction is executed by accepting the element and the updatedElement consumer. 3. If the element is transient, the id of the element is set to the id of the updatedElement. 4. The element is rebaselined.- Parameters:
updateAction- the action to update the element Accepts the element to be updated and the consumer to accept the updated element The consumer is responsible for updating the element and can provide the updated element
-
discard
public void discard()Discards changes made to the dirty elements in the list of elements managed by the OperableManagerController. If an element is transient, it is removed from the list. If an element is not transient, it is reset to its original state. -
getDirtyElements
-