Package com.vaadin.flow.internal.change
Class ListAddChange<T extends Serializable>
java.lang.Object
com.vaadin.flow.internal.change.NodeChange
com.vaadin.flow.internal.change.NodeFeatureChange
com.vaadin.flow.internal.change.AbstractListChange<T>
com.vaadin.flow.internal.change.ListAddChange<T>
- Type Parameters:
T- the type of the items in the node list
- All Implemented Interfaces:
Serializable
Change describing an add operation in a
list node feature.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionListAddChange(NodeList<T> list, boolean nodeValues, int index, List<? extends T> newItems) Creates a new list add change. -
Method Summary
Modifier and TypeMethodDescriptioncopy(int indx) Gets a copy of the change with the same data exceptindex.Gets a copy of the change with the same data except a list of newitems.Gets the added items.booleanisEmpty()Returns whether this add operation still contains any new items.protected voidpopulateJson(com.fasterxml.jackson.databind.node.ObjectNode json, ConstantPool constantPool) Overridden by subclasses to populate a JSON object when serializing.voidremoveItem(T item) Removes item from the change list.Methods inherited from class com.vaadin.flow.internal.change.AbstractListChange
getIndex, getNodeList, setIndexMethods inherited from class com.vaadin.flow.internal.change.NodeFeatureChange
getFeatureMethods inherited from class com.vaadin.flow.internal.change.NodeChange
getNode, toJson
-
Constructor Details
-
ListAddChange
Creates a new list add change.- Parameters:
list- the changed listnodeValues- true if the values areStateNodes, false otherwiseindex- the index of the add operationsnewItems- a list of new items
-
-
Method Details
-
getNewItems
Gets the added items.- Returns:
- the added items
-
isEmpty
public boolean isEmpty()Returns whether this add operation still contains any new items.- Returns:
trueif no new items,falseif still has new items
-
copy
Gets a copy of the change with the same data except a list of newitems.- Parameters:
items- new list of items- Returns:
- a copy of the change based on new items
-
copy
Description copied from class:AbstractListChangeGets a copy of the change with the same data exceptindex.- Specified by:
copyin classAbstractListChange<T extends Serializable>- Parameters:
indx- the new index of the change- Returns:
- a copy of the change based on new index
-
populateJson
protected void populateJson(com.fasterxml.jackson.databind.node.ObjectNode json, ConstantPool constantPool) Description copied from class:NodeChangeOverridden by subclasses to populate a JSON object when serializing.- Overrides:
populateJsonin classNodeFeatureChange- Parameters:
json- the json object to populateconstantPool- the constant pool to use for serializing constant pool references
-
removeItem
Removes item from the change list.Note: This should be used only when list of changes is being re-indexed after adding a new change.
- Parameters:
item- Item to be removed.
-