Class DefaultListModel<T>
java.lang.Object
de.hybris.platform.cockpit.model.listview.AbstractListModel<T>
de.hybris.platform.cockpit.model.general.impl.DefaultListModel<T>
- All Implemented Interfaces:
ListModel<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ListSelectionModelprotected ListSelectionModelFields inherited from class de.hybris.platform.cockpit.model.listview.AbstractListModel
listEditorDataListeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidAddselementto the list and marks it as not removable and not movable.voidAddselementto the list.voidaddAll(Collection<T> elements) Same as callingaddAll(elements, false, false).voidaddAll(Collection<T> elements, boolean removable, boolean movable) Appends all of the elements inelementsto the end of this list.voidclear()voidclearAndAddAll(Collection<? extends T> elements, boolean removable, boolean movable) Clears all the elements of the current list, then adds the elements ofelementsand finally fires aListDataEvent.CONTENTS_CHANGEDevent i.e.voidclearAndAddAll(Collection<? extends T> elements, boolean removable, boolean movable, boolean fireEvent) Clears all the elements of the current list, then adds the elements ofelementsand, if fireEvent is true, finally fires aListDataEvent.CONTENTS_CHANGEDevent i.e.voidclearAndAddAll(Collection<T> elements) elementAt(int index) Returns the element at positionindex.Returns all elements.booleanReturns whether this list is marked as _editable_ or not.booleanisEmpty()booleanisMovable(int index) Returns whether the element at positionindexis movable or not.booleanisRemovable(int index) Returns whether the element at positionindexis removable or not.voidmoveElement(int fromIndex, int toIndex) Moves an element from positionfromIndexto positiontoIndex.remove(int index) booleanvoidremoveAll(Collection<T> elements) voidremoveRange(int fromIndex, int toIndex) Removes elements in the range [fromIndextoIndex].voidvoidsetEditable(boolean editable) voidsetMovable(int index, boolean movable) voidvoidsetRemovable(int index, boolean removable) voidintsize()Returns the size of this list i.e.toString()Methods inherited from class de.hybris.platform.cockpit.model.listview.AbstractListModel
addListModelDataListener, fireEvent, getListDataListeners, removeListModelDataListener
-
Field Details
-
elements
-
movableElements
-
removableElements
-
editable
protected boolean editable
-
-
Constructor Details
-
DefaultListModel
public DefaultListModel()
-
-
Method Details
-
add
Addselementto the list and marks it as not removable and not movable. Same as callingadd(element, false, false).- Parameters:
element- the element to be added- See Also:
-
add
Addselementto the list.- Parameters:
element- the element to be addedremovable- whetherelementshould be marked as removable or notmovable- whetherelementshould be marked as movable or not
-
add
- Throws:
IndexOutOfBoundsException
-
add
public void add(int index, T element, boolean removable, boolean movable) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
addAll
Same as callingaddAll(elements, false, false).- Parameters:
elements-- See Also:
-
addAll
Appends all of the elements inelementsto the end of this list. Any registeredListDataListeners will be notified that an interval has been added.- Parameters:
elements- elements to be appendedremovable- whether the elements are removable or notmovable- whether the elements are movable or not
-
clearAndAddAll
Clears all the elements of the current list, then adds the elements ofelementsand finally fires aListDataEvent.CONTENTS_CHANGEDevent i.e. no add and/or remove events are sent.
Same asclearAndAddAll(elements, false, false, true).- Parameters:
elements- the elements to addremovable- whether the elements are removable or notmovable- whether the elements are movable or not- See Also:
-
clearAndAddAll
public void clearAndAddAll(Collection<? extends T> elements, boolean removable, boolean movable, boolean fireEvent) Clears all the elements of the current list, then adds the elements ofelementsand, if fireEvent is true, finally fires aListDataEvent.CONTENTS_CHANGEDevent i.e. no add and/or remove events are sent.- Parameters:
elements- the elements to addremovable- whether the elements are removable or notmovable- whether the elements are movable or notfireEvent- whether an event should be fired or not- See Also:
-
clearAndAddAll
- Parameters:
elements- the elements to add- See Also:
-
set
- Throws:
IndexOutOfBoundsException
-
set
-
removeRange
public void removeRange(int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException, IllegalArgumentException Removes elements in the range [fromIndextoIndex].- Parameters:
fromIndex- (inclusive) index of the first element in the rangetoIndex- (inclusive) index of the last element in the range- Throws:
ArrayIndexOutOfBoundsException- if eitherfromIndexortoIndexis invalidIllegalArgumentException- iffromIndexis greater thantoIndex
-
remove
- Throws:
IndexOutOfBoundsException
-
remove
-
removeAll
-
clear
public void clear()- See Also:
-
elementAt
Description copied from interface:ListModelReturns the element at positionindex.- Parameters:
index- position of the element to get- Returns:
- the element at position
index - Throws:
IndexOutOfBoundsException- if there is no element at positionindex
-
getElements
Description copied from interface:ListModelReturns all elements.- Returns:
- list containing all elements
-
size
public int size()Description copied from interface:ListModelReturns the size of this list i.e. the number of elements stored.- Returns:
- this list's size
-
setEditable
public void setEditable(boolean editable) -
isEditable
public boolean isEditable()Description copied from interface:ListModelReturns whether this list is marked as _editable_ or not.- Returns:
trueif this list is marked as editable,falseotherwise
-
setMovable
public void setMovable(int index, boolean movable) -
isMovable
Description copied from interface:ListModelReturns whether the element at positionindexis movable or not.- Parameters:
index- position of the element- Returns:
trueif the element is movable,falseotherwise- Throws:
IndexOutOfBoundsException- if there is no element at positionindex
-
setRemovable
public void setRemovable(int index, boolean removable) -
isRemovable
Description copied from interface:ListModelReturns whether the element at positionindexis removable or not.- Parameters:
index- position of the element- Returns:
trueif the element is removable,falseotherwise- Throws:
IndexOutOfBoundsException- if there is no element at positionindex
-
setMovableElementsModel
-
setRemovableElementsModel
-
moveElement
public void moveElement(int fromIndex, int toIndex) Moves an element from positionfromIndexto positiontoIndex. Implicitly fires event since it callsadd(int, Object, boolean, boolean)andremove(int)- Parameters:
fromIndex- the current position index of the item to movetoIndex- the new position index of the item- See Also:
-
toString
-
isEmpty
public boolean isEmpty()
-