Drag[en]gine Script Module DragonScript Script API  1.0
DefaultListModel Class Reference

Default implementation of ListModel. More...

Inheritance diagram for DefaultListModel:
ListModel

Public Member Functions

void add (Object element)
 Add element. More...
 
void addAll (Array content)
 Add elements from array. More...
 
void addNotifier (ListModelNotifier notifier)
 Add modifier. More...
 
Object getAt (int index)
 Element at index. More...
 
Array getContent ()
 Get content as array. More...
 
int getCount ()
 Number of elements. More...
 
bool has (Object element)
 Element is present. More...
 
int indexOf (Object element)
 Index of element or -1 if absent. More...
 
void insert (int index, Object element)
 Insert element at index. More...
 
void insertAll (int index, Array content)
 Insert elements from array at index. More...
 
DefaultListModel new ()
 Create default list model. More...
 
DefaultListModel new (Array content)
 Create default list model with initial content. More...
 
void notifyContentChanged (int fromIndex, int toIndex)
 Notify all that the content of the model in the given range changed. More...
 
void notifyElementsAdded (int fromIndex, int toIndex)
 Notify all elements have been added. More...
 
void notifyElementsRemoved (int fromIndex, int toIndex)
 Notify all elements have been removed. More...
 
void remove (Object element)
 Remove element. More...
 
void removeAll ()
 Remove all elements. More...
 
void removeArray (Array content)
 Remove elements from array. More...
 
void removeFrom (int index)
 Remove element. More...
 
void removeNotifier (ListModelNotifier notifier)
 Remove notifier. More...
 
void removeRange (int firstIndex, int lastIndex)
 Remove elements from range. More...
 
void setAll (Array elements)
 Replaces all elements. More...
 
void setAt (int index, Object element)
 Set element at index. More...
 
void setContent (Array content)
 Set content from array. More...
 
void setRange (int firstIndex, int lastIndex, Array elements)
 Replaces elements in range. More...
 

Detailed Description

Default implementation of ListModel.

Member Function Documentation

§ add()

void add ( Object  element)

Add element.

After adding a content changed event is send to listeners. If you have to set many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.

§ addAll()

void addAll ( Array  content)

Add elements from array.

After adding a content changed event is send to listeners. If you have to add many elements addAll() instead of add() for performance reasons.

§ addNotifier()

void addNotifier ( ListModelNotifier  notifier)

Add modifier.

Implements ListModel.

§ getAt()

Object getAt ( int  index)

Element at index.

Exceptions
EOutOfBoundsindex is less than 0 or larger than or equal to getCount().

Implements ListModel.

§ getContent()

Array getContent ( )

Get content as array.

§ getCount()

int getCount ( )

Number of elements.

Implements ListModel.

§ has()

bool has ( Object  element)

Element is present.

§ indexOf()

int indexOf ( Object  element)

Index of element or -1 if absent.

§ insert()

void insert ( int  index,
Object  element 
)

Insert element at index.

After inserting a content changed event is send to listeners. If you have to insert many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.

Exceptions
EOutOfBoundsindex is less than 0 or larger than getCount().

§ insertAll()

void insertAll ( int  index,
Array  content 
)

Insert elements from array at index.

After inserting a content changed event is send to listeners. If you have to insert many elements insertAll() instead of insert() for performance reasons.

Exceptions
EOutOfBoundsindex is less than 0 or larger than getCount().

§ new() [1/2]

Create default list model.

§ new() [2/2]

DefaultListModel new ( Array  content)

Create default list model with initial content.

§ notifyContentChanged()

void notifyContentChanged ( int  fromIndex,
int  toIndex 
)

Notify all that the content of the model in the given range changed.

Parameters
fromIndexIndex of first element that changed
toIndexIndex of last element that changed

Implements ListModel.

§ notifyElementsAdded()

void notifyElementsAdded ( int  fromIndex,
int  toIndex 
)

Notify all elements have been added.

Parameters
fromIndexIndex of first added element.
toIndexIndex of last added element.

§ notifyElementsRemoved()

void notifyElementsRemoved ( int  fromIndex,
int  toIndex 
)

Notify all elements have been removed.

Parameters
fromIndexIndex of first removed element.
toIndexIndex of last removed element.

§ remove()

void remove ( Object  element)

Remove element.

After removing a content changed event is send to listeners. If you have to remove many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.

Exceptions
EOutOfBoundsElement is absent.

§ removeAll()

void removeAll ( )

Remove all elements.

If elements are present a content changed event is send to listeners after removing all elements.

§ removeArray()

void removeArray ( Array  content)

Remove elements from array.

After removing a content changed event is send to listeners.

Exceptions
EOutOfBoundsElement is absent.

§ removeFrom()

void removeFrom ( int  index)

Remove element.

After removing a content changed event is send to listeners. If you have to remove many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.

Exceptions
EOutOfBoundsindex is less than 0 or larger than or equal getCount().

§ removeNotifier()

void removeNotifier ( ListModelNotifier  notifier)

Remove notifier.

Implements ListModel.

§ removeRange()

void removeRange ( int  firstIndex,
int  lastIndex 
)

Remove elements from range.

After removing a content changed event is send to listeners.

Exceptions
EOutOfBoundsfirstIndex is less than 0 or larger than or equal getCount().
EOutOfBoundslastIndex is less than 0 or larger than or equal getCount().
EInvalidParamlastIndex is less than firstIndex.

§ setAll()

void setAll ( Array  elements)

Replaces all elements.

If range is not empty a content changed event is send to listeners. Use this method if you need to change all elements at once to cause only one change notification resulting in widgets to relayout once instead of multiple times.

Exceptions
EInvalidParamNumber of elements in elements does not equal number of elements in the model.

§ setAt()

void setAt ( int  index,
Object  element 
)

Set element at index.

If element at index changed a content changed event is send to listeners. Changing many elements at once can cause performance problems due to each change causing widgets to relayout. If this is a problem use one of the mass editing methods.

Exceptions
EOutOfBoundsindex is less than 0 or larger than or equal to getCount().

§ setContent()

void setContent ( Array  content)

Set content from array.

Same effect as calling first removeAll() then addAll(content). Sends at most two notifications. If model contains elements sends first a elements removed notification. Then if any content is added sends an elements added notification. If you just want to replace all elements without changing the number of elements use setAll() which sends only a content changed notification.

§ setRange()

void setRange ( int  firstIndex,
int  lastIndex,
Array  elements 
)

Replaces elements in range.

If range is not empty a content changed event is send to listeners. Use this method if you need to change multiple elements at once to cause only one change notification resulting in widgets to relayout once instead of multiple times.

Exceptions
EOutOfBoundsfirstIndex is less than 0 or larger than or equal getCount().
EOutOfBoundslastIndex is less than 0 or larger than or equal getCount().
EInvalidParamlastIndex is less than firstIndex.
EInvalidParamNumber of elements in elements does not equal number of elements in range.

The documentation for this class was generated from the following file: