|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.ui.component.pane.PaneManagerModel
public class PaneManagerModel
PaneManagerModel stores the data for each tabbed pane an associated PaneManagerView can present.
The Pane Manager classes conform to the Model-View-Controller design pattern. PaneManagerModel
implements the Model. It maintains the Pane objects that represent the data and tracks the current position within the model.
PaneManagerView implements the View. It lays out and renders the panes.PaneManagerController implements the Controller.
It handles all user input received by the Pane Manager. If the Controller
cannot handle a user event, PaneManagerView forwards the event to the contained Field objects.
The pane data is stored in a list can be accessed bi-directionally. You can make the list cyclical
by using PaneManagerModel.enableLooping(boolean). The data for an individual pane can be accessed by index by using
PaneManagerModel.getPane(int). You can navigate the list by using PaneManagerModel.getLeftIndexOf(int), PaneManagerModel.getRightIndexOf(int),
PaneManagerModel.nextIndex(), and PaneManagerModel.previousIndex().
| Constructor Summary | ||
|---|---|---|
PaneManagerModel()
Class constructor that initializes an empty list and sets the current index to -1. |
||
| Method Summary | ||
|---|---|---|
void |
addPane(Pane pane)
Adds a Pane object to the end of the data list. |
|
int |
currentlySelectedIndex()
Returns the index of the Pane object that represents the currently-selected pane. |
|
void |
deletePane(Pane pane)
Deletes a Pane object from the data list. |
|
void |
enableLooping(boolean enable)
Configures the data list to be either cyclical or non-cyclical. |
|
PaneManagerController |
getController()
Returns the PaneManagerController for this model. |
|
int |
getLeftIndexOf(int index)
Returns the Pane that preceeds the one at the provided index. |
|
Pane |
getPane(int index)
Provides access to the Pane located at
the provided index. |
|
int |
getRightIndexOf(int index)
Returns the Pane that follows the one at the provided index. |
|
PaneManagerView |
getView()
Provides access to the PaneManagerView associated to this model. |
|
void |
insertPane(Pane pane,
int index)
Inserts a new Pane object to the current set. |
|
boolean |
isLoopingEnabled()
Indicates if the data list is configured as a cyclical list. |
|
int |
nextIndex()
Returns the index of the Pane that is after
the currently-selected index. |
|
int |
numberOfPanes()
Returns the number of elements in the data list. |
|
int |
previousIndex()
Provides the index of the Pane that preceeds
that of the currently selected index. |
|
void |
replacePane(Pane newPane,
Pane oldPane)
Replaced a Pane that exists in this model with a new Pane object. |
|
void |
setController(PaneManagerController controller)
Allows for a PaneManagerController to be associated with this model. |
|
void |
setCurrentlySelectedIndex(int index)
Allows for the index of the currently selected Pane to be updated. |
|
void |
setCurrentlySelectedIndex(int index,
boolean update)
Allows for the index of the currently selected Pane to be updated. |
|
void |
setView(PaneManagerView view)
Allows for a PaneManagerView to be associated with this model. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PaneManagerModel()
Class constructor that initializes an empty list and sets the current index to -1.
| Method Detail |
|---|
public void addPane(Pane pane)
Adds a Pane object to the end of the data list.
If the list has been made cyclical by using PaneManagerModel.isLoopingEnabled(), then addPane()
inserts the new Pane after the Pane at index PaneManagerModel.numberOfPanes() - 1 and
before the Pane at index 0.
The title and content of the pane are added to the TitleView
and PaneView of the associated PaneManagerView.
pane - Pane to add to the data list.public int currentlySelectedIndex()
Returns the index of the Pane object that represents the currently-selected pane.
Pane (between 0 and PaneManagerModel.numberOfPanes() - 1).
public void deletePane(Pane pane)
Deletes a Pane object from the data list.
Does nothing if the Pane is not in the data list.
The title and content of the pane are removed from the TitleView
and PaneView of the associated PaneManagerView.
pane - Pane to delete from the data list.
IllegalArgumentException - if the pane provided to delete is invalid (null or not found).public void enableLooping(boolean enable)
Configures the data list to be either cyclical or non-cyclical.
enable - true to make the data list cyclical, false to make the data list non-cyclical.public PaneManagerController getController()
PaneManagerController for this model.
PaneManagerController associated with this model
or null if none has been set.public int getLeftIndexOf(int index)
Returns the Pane that preceeds the one at the provided index. This method takes
into account whether the data list is cyclical or non-cyclical PaneManagerModel.isLoopingEnabled(). If the list is cyclical, then the index
left of 0 is the last index. If the list is non-cyclical, then the index left of 0 is the invalid index (-1).
The index parameter must be between 0 and PaneManagerModel.numberOfPanes() - 1.
index - Index of the reference Pane.
Pane preceding the reference Pane or -1 if the data list is non-cyclical
and the index parameter is 0.
IllegalArgumentException - if index is negative or out-of-bounds.public int getRightIndexOf(int index)
Returns the Pane that follows the one at the provided index. This accounts for if the data set
is cyclical PaneManagerModel.isLoopingEnabled(). If enabled then the index will loop
from the last possible index to 0. If not enabled then this will return
and invalid index.
The provided index must be between 0 and PaneManagerModel.numberOfPanes() - 1.
index - The index for the Pane for which the one following it is desired.
Pane
or -1 if looping is not enabled and there is no following index.
IllegalArgumentException - if the index is invalid.public Pane getPane(int index)
Provides access to the Pane located at
the provided index.
index - the index of the Pane to retrieve.
Pane located at the index provided.
IllegalArgumentException - when the index is invalid.public PaneManagerView getView()
Provides access to the PaneManagerView associated to this model.
PaneManagerView that is associated to this model
or null if none is set.
public void insertPane(Pane pane,
int index)
Inserts a new Pane object to the current set.
The title and content of the pane are inserted in the TitleView
and PaneView contained within the associated PaneManagerView
respectively.
pane - the new Pane to insert in the current data set.index - the index to insert the Pane at.
IllegalArgumentException - if the pane is null or if an invalid index is provided.public boolean isLoopingEnabled()
Indicates if the data list is configured as a cyclical list.
true if the data list is configured as a cyclical list and false if it is not.public int nextIndex()
Returns the index of the Pane that is after
the currently-selected index.
PaneManagerModel.getRightIndexOf(int).
Pane that follows the currently
selected one, or an invalid index if there is none.public int numberOfPanes()
Returns the number of elements in the data list.
Panes in the data list of this model.
public int previousIndex()
Provides the index of the Pane that preceeds
that of the currently selected index.
PaneManagerModel.getLeftIndexOf(int).
Pane that preceeds the currently
selected one, or an invalid index if there is none.
public void replacePane(Pane newPane,
Pane oldPane)
Replaced a Pane that exists in this model with a new Pane object.
The title and content of the new pane replace those of the old one
in the TitleView and PaneView contained within
the associated PaneManagerView respectively.
newPane - the new Pane to add to the data set.oldPane - the Pane in the current data set to be replaced.
IllegalArgumentException - if either the newPane or the oldPane is null.
IllegalStateException - if the oldPane is not in the current data set.public void setController(PaneManagerController controller)
Allows for a PaneManagerController to be associated with this model.
controller - the PaneManagerController to associate to this model.public void setCurrentlySelectedIndex(int index)
Allows for the index of the currently selected Pane to be updated.
This will tell the associated view to update itself with no specified animation
direction. If you wish to animate changes call PaneManagerModel.setCurrentlySelectedIndex(int, boolean)
followed by an animation control within the view PaneManagerView.drag(int, int)
or PaneManagerView.jumpTo(int, int).
index - the new index
IllegalArgumentException - if the index is invalid.
public void setCurrentlySelectedIndex(int index,
boolean update)
Allows for the index of the currently selected Pane to be updated.
To have this cause the associated view to update itself provide true.
There will be no specified direction for this update to happen. PaneManagerModel.setCurrentlySelectedIndex(int).
This will not tell the associated view to update itself if false.
The view will not reflect the new index unless you have it animate.
To animate changes call an animation control within the view PaneManagerView.drag(int, int)
or PaneManagerView.jumpTo(int, int).
index - the new indexupdate - true to have this model tell the view to update the positions, see PaneManagerModel.setCurrentlySelectedIndex(int)
false to not have this model tell the view to update the positions. If false then the calling code
is responsible for calling methods to perform the transitions.
IllegalArgumentException - if the index is invalid.public void setView(PaneManagerView view)
Allows for a PaneManagerView to be associated with this model.
view - the PaneManagerView to associate to this model.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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