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
public class ListAddChange<T extends Serializable> extends AbstractListChange<T>
Change describing an add operation in alistnode feature.For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ListAddChange(NodeList<T> list, boolean nodeValues, int index, List<? extends T> newItems)Creates a new list add change.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListAddChange<T>copy(int indx)Gets a copy of the change with the same data exceptindex.ListAddChange<T>copy(List<? extends T> items)Gets a copy of the change with the same data except a list of newitems.List<? extends T>getNewItems()Gets the added items.booleanisEmpty()Returns whether this add operation still contains any new items.protected voidpopulateJson(elemental.json.JsonObject 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, 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 Detail
-
ListAddChange
public ListAddChange(NodeList<T> list, boolean nodeValues, int index, List<? extends T> newItems)
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 Detail
-
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
public ListAddChange<T> copy(List<? extends T> items)
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
public ListAddChange<T> copy(int indx)
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(elemental.json.JsonObject 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
public void removeItem(T item)
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.
-
-