|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectt3.hrd.state.StateManager
public class StateManager
A StateManager allows you to create, destroy and reorder Links, Tiles and Cursors.
Each Link, Tile and Cursor has an id. You can create them with specific ids, or allow the system to auto-generate ids for you. This class has methods to get a Link, Tile or Cursor object given its id, if it exists. You can reorder Links and Tiles by specifying the new ordering either by id or by the actual Link and Tile objects themselves.
Threading notes: this class is not thread-safe. You must use some kind of locking scheme if you use it in a multithreaded environment.
Field Summary | |
---|---|
boolean |
backTiles
|
java.util.Set<Cursor> |
cursorsReadOnly
|
static int |
MAX_CURSOR_ID
|
static int |
MAX_ORDEREDELEMENT_ID
|
int |
maxDimensionForTileImages
|
int |
splitDimensionForTileImages
|
protected StateListener |
stateListener
|
java.util.List<OrderedElement> |
tilesAndLinksInOrderReadOnly
|
boolean |
usePowersOfTwoForTileImages
|
Constructor Summary | |
---|---|
StateManager(StateListener stateListener,
boolean usePowersOfTwo,
boolean backTiles,
int maxDimensionForTileImages,
int splitDimensionForTileImages)
Creates a StateManager. |
Method Summary | |
---|---|
protected Cursor |
factoryreturnNewCursorObject(int id)
|
protected Link |
factoryReturnNewLinkObject(StateListener tilesListener,
int linkId,
int displayType,
java.awt.Color c,
ScaRotTraTransformImmutable tStandardRectToDESKrectA,
ScaRotTraTransformImmutable tStandardRectToDESKrectB)
|
protected Tile |
factoryReturnNewTileObject(StateListener tilesListener,
int tileId,
int w,
int h,
int flags,
boolean usePowersOfTwo)
|
void |
fatalError(java.lang.Throwable e)
Prints a stack trace and calls System.exit(1); |
Cursor |
getCursorByIdForOp(int id)
|
Link |
getLinkByIdForOp(int id)
|
Tile |
getTileByIdForOp(int id)
|
OrderedElement |
getTileOrLinkByIdForOp(int id)
|
Cursor |
opCreateCursor(int id)
CURSORS |
Cursor |
opCreateCursorAutogenerateId()
|
Link |
opCreateLink(int elId,
int displayType,
java.awt.Color c,
ScaRotTraTransformImmutable tStandardRectToDESKrectA,
ScaRotTraTransformImmutable tStandardRectToDESKrectB)
Creates and returns a link with the specified parameters. |
Link |
opCreateLinkAutogenerateId(int displayType,
java.awt.Color c,
ScaRotTraTransformImmutable tStandardRectToDESKrectA,
ScaRotTraTransformImmutable tStandardRectToDESKrectB)
|
Tile |
opCreateTile(int elId,
int w,
int h,
int flags)
Creates a new Tile. |
Tile |
opCreateTileAutogenerateId(int w,
int h,
int flags)
|
void |
opDestroyCursor(Cursor c)
|
void |
opDestroyLink(Link l)
|
void |
opDestroyTile(Tile t)
|
void |
opLogMessage(java.lang.String message)
|
void |
opReorderTilesAndLinks(java.util.List<OrderedElement> order)
Reorder the tiles and links by specifying an array of OrderedElements. |
void |
opReorderTilesAndLinksById(int[] orderById)
Reorder the tiles and links by specifying an array of elementIds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_ORDEREDELEMENT_ID
public static final int MAX_CURSOR_ID
public java.util.List<OrderedElement> tilesAndLinksInOrderReadOnly
public final boolean usePowersOfTwoForTileImages
public final boolean backTiles
public final int maxDimensionForTileImages
public final int splitDimensionForTileImages
protected final StateListener stateListener
public final java.util.Set<Cursor> cursorsReadOnly
Constructor Detail |
---|
public StateManager(StateListener stateListener, boolean usePowersOfTwo, boolean backTiles, int maxDimensionForTileImages, int splitDimensionForTileImages)
stateListener
- Callbacks that allow customisation/usePowersOfTwo
- Iff this is true then tile image dimensions will be changed to be powers of two.backTiles
- Iff this is true then tiles will be backed.maxDimensionForTileImages
- Maximum width or height of a tile before it will be split, or 0 for no splitting.splitDimensionForTileImages
- Width or height of component tiles into which tiles are split, or 0 for no splitting.Method Detail |
---|
public OrderedElement getTileOrLinkByIdForOp(int id)
public Tile getTileByIdForOp(int id)
public Link getLinkByIdForOp(int id)
public void opLogMessage(java.lang.String message)
public Tile opCreateTile(int elId, int w, int h, int flags)
elId
- w
- h
- flags
-
public Tile opCreateTileAutogenerateId(int w, int h, int flags)
public Link opCreateLink(int elId, int displayType, java.awt.Color c, ScaRotTraTransformImmutable tStandardRectToDESKrectA, ScaRotTraTransformImmutable tStandardRectToDESKrectB)
elId
- displayType
- c
- tStandardRectToDESKrectA
- tStandardRectToDESKrectB
-
public Link opCreateLinkAutogenerateId(int displayType, java.awt.Color c, ScaRotTraTransformImmutable tStandardRectToDESKrectA, ScaRotTraTransformImmutable tStandardRectToDESKrectB)
public void opDestroyTile(Tile t)
public void opDestroyLink(Link l)
public void opReorderTilesAndLinksById(int[] orderById)
orderById
- public void opReorderTilesAndLinks(java.util.List<OrderedElement> order)
order
- public void fatalError(java.lang.Throwable e)
e
- protected Tile factoryReturnNewTileObject(StateListener tilesListener, int tileId, int w, int h, int flags, boolean usePowersOfTwo)
protected Link factoryReturnNewLinkObject(StateListener tilesListener, int linkId, int displayType, java.awt.Color c, ScaRotTraTransformImmutable tStandardRectToDESKrectA, ScaRotTraTransformImmutable tStandardRectToDESKrectB)
public Cursor opCreateCursor(int id)
public Cursor opCreateCursorAutogenerateId()
public void opDestroyCursor(Cursor c)
public Cursor getCursorByIdForOp(int id)
protected Cursor factoryreturnNewCursorObject(int id)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |