net.rim.device.api.ui.component.table
Class DataModel

java.lang.Object
  extended by net.rim.device.api.ui.component.table.DataModel
Direct Known Subclasses:
AbstractTableModel

public abstract class DataModel
extends Object

A data model for list or table components. Implementations of DataModel provide a representation of the data to be displayed in the view, e.g. concrete data structures, or data access logic to databases. It should handle requests from the controller or other sources and subsequently notify the any additional listeners of the model. Views are automatically registered as listeners. This interface provides functionality to register and unregister listeners, and notify all listeners of a reset.

Since:
BlackBerry API 6.0.0

Constructor Summary
DataModel()
          Creates a DataModel instance.
 
Method Summary
 void modelReset()
          Send a notification to all the listeners that the contents of the model have changed considerably A DataModelChangeEvent.MODEL_RESET event will be sent to all listeners.
protected  void notifyListeners(DataModelChangeEvent event)
          Send a notification to all the listeners that an event has occurred.
 void registerListener(DataModelListener listener)
          Register a listener to listen for changes to the data model.
 boolean unregisterListener(DataModelListener listener)
          Unregister a listener from this data model.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

DataModel

public DataModel()
Creates a DataModel instance.

Since:
BlackBerry API 6.0.0


Method Detail

notifyListeners

protected void notifyListeners(DataModelChangeEvent event)
Send a notification to all the listeners that an event has occurred.

Parameters:
event - An object containing all the information about the event that has occured.
See Also:
DataModelListener.modelChanged(net.rim.device.api.ui.component.table.DataModelChangeEvent)
Since:
BlackBerry API 6.0.0

registerListener

public void registerListener(DataModelListener listener)
Register a listener to listen for changes to the data model.

Parameters:
listener - DataModelListener to register to this data model.
Throws:
NullPointerException - If listener is null.
Since:
BlackBerry API 6.0.0

unregisterListener

public boolean unregisterListener(DataModelListener listener)
Unregister a listener from this data model.

Parameters:
listener - DataModelListener to unregister from this data model.
Returns:
true if listener was a registered listener (and successfully removed); otherwise false.
Throws:
NullPointerException - If listener is null .
Since:
BlackBerry API 6.0.0

modelReset

public void modelReset()
Send a notification to all the listeners that the contents of the model have changed considerably A DataModelChangeEvent.MODEL_RESET event will be sent to all listeners.

See Also:
DataModelListener.modelChanged(net.rim.device.api.ui.component.table.DataModelChangeEvent)
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal