API Reference 0.7.1rikulo_modelListModel<T>

ListModel<T> abstract class

A data model representing a list of data.

Instead of implementing this interface, you can use DefaultListModel. It is a concrete class that implements ListModel, SelectionModel and DisablesModel.

Instead of implementing this interface from scratch, it is suggested to extend from AbstractListModel.

abstract class ListModel<T> extends DataModel {
 /** Returns the value at the specified index.
  */
 T operator [](int index);
 /** Returns the length of the list.
  */
 int get length;
}

Extends

DataModel > ListModel<T>

Subclasses

AbstractListModel<T>, Foo

Properties

final int length #

Returns the length of the list.

int get length;

final DataEvents on #

inherited from DataModel

Returns DataEvents for adding or removing event listeners.

DataEvents get on => _on;

Operators

abstract T operator [](int index) #

Returns the value at the specified index.

Methods

void addEventListener(String type, DataEventListener listener) #

inherited from DataModel

Adds an event listener. addEventListener("select", listener) is the same as on.select.add(listener).

void addEventListener(String type, DataEventListener listener) {
 if (listener == null)
   throw new ArgumentError("listener");

 bool first = false;
 _listeners.putIfAbsent(type, () {
   first = true;
   return [];
 }).add(listener);
}

void removeEventListener(String type, DataEventListener listener) #

inherited from DataModel

Removes an event listener. removeEventListener("select", listener) is the same as on.select.remove(listener).

void removeEventListener(String type, DataEventListener listener) {
 final list = _listeners[type];
 if (list != null)
   list.remove(listener);
}

bool sendEvent(DataEvent event) #

inherited from DataModel

Sends an event to this model.

Example: `model.sendEvent(new ListDataEvent(model, "select"))</code>.

bool sendEvent(DataEvent event) {
 final bool
   b1 = _sendEvent(event, _listeners[event.type]),
   b2 = _sendEvent(event, _listeners['all']);
 return b1 || b2;
}