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
ConstructorDescriptionListAddChange
(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.boolean
isEmpty()
Returns whether this add operation still contains any new items.protected void
populateJson
(elemental.json.JsonObject json, ConstantPool constantPool) Overridden by subclasses to populate a JSON object when serializing.void
removeItem
(T item) Removes item from the change list.Methods inherited from class com.vaadin.flow.internal.change.AbstractListChange
getIndex, getNodeList, setIndex
Methods inherited from class com.vaadin.flow.internal.change.NodeFeatureChange
getFeature
Methods 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 areStateNode
s, 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:
true
if no new items,false
if 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:AbstractListChange
Gets a copy of the change with the same data exceptindex
.- Specified by:
copy
in classAbstractListChange<T extends Serializable>
- Parameters:
indx
- the new index of the change- Returns:
- a copy of the change based on new index
-
populateJson
Description copied from class:NodeChange
Overridden by subclasses to populate a JSON object when serializing.- Overrides:
populateJson
in 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.
-