com.threerings.stage.tools.editor
Class EditorModel

java.lang.Object
  extended by com.threerings.stage.tools.editor.EditorModel

public class EditorModel
extends Object

The EditorModel class provides a holding place for storing, modifying and retrieving data that is shared across the Editor application and its myriad UI components.


Field Summary
protected  int _fqTileId
          The fully qualified tile id of the currently selected tile.
protected  List<EditorModelListener> _listeners
          The model listeners.
protected  int _lnum
          The currently selected layer number.
protected  int _mode
          The currently selected action mode.
protected  int _objectGrip
          Direction (which corner) we grip an object by.
protected  com.threerings.media.tile.Tile _tile
          The currently selected tile for placement in the scene.
protected  int _tileIndex
          The currently selected tile id.
protected  com.threerings.media.tile.TileManager _tilemgr
          The tile manager.
protected  com.threerings.media.tile.TileSet _tileSet
          The currently selected tileset.
protected  int _tileSetId
          The currently selected tileset id.
static int ACTION_EDIT_TILE
           
static int ACTION_PLACE_PORTAL
           
static int ACTION_PLACE_TILE
          Action mode constants.
static int BASE_LAYER
          Miso layer constants.
static String[] CMD_ACTIONS
          String translations for action identifiers.
static String[] LAYER_NAMES
           
static int NUM_ACTIONS
          The number of actions.
static int OBJECT_LAYER
           
static String[] TIP_ACTIONS
          Prose descriptions of actions suitable for tool tip display.
 
Constructor Summary
EditorModel(com.threerings.media.tile.TileManager tilemgr)
           
 
Method Summary
 void addListener(EditorModelListener l)
          Add an editor model listener.
 void clearTile()
          Marks the currently selected tile as invalid such that editing when no tiles are available can be properly effected.
 int getActionMode()
          Returns the current editor action mode.
 int getFQTileId()
          Returns the fully qualified tile id of the currently selected tile.
 int getLayerIndex()
          Returns the current scene layer index undergoing edit.
 int getObjectGripDirection()
          Gets the direction in which we should grip objects.
 com.threerings.media.tile.Tile getTile()
          Returns the currently selected tile for placement within the scene.
 int getTileId()
          Returns the currently selected tile id within the selected tile set.
 com.threerings.media.tile.TileSet getTileSet()
          Returns the currently selected tile set.
 int getTileSetId()
          Returns the currently selected tile set id.
 boolean isTileValid()
          Returns whether the currently selected tile is valid.
protected  void notifyListeners(int event)
          Notify all model listeners that the editor model has changed.
 void setActionMode(String cmd)
          Sets the editor action mode.
 void setLayerIndex(int lnum)
          Sets the scene layer index undergoing edit.
 void setObjectGripDirection(int direction)
          Sets the direction in which we should grip objects.
 void setTile(com.threerings.media.tile.TileSet set, int tileSetId, int tileIndex)
          Sets the selected tile for placement within the scene.
 void setTileId(int tileIndex)
          Sets the tile id of the tile selected for placement within the scene.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_PLACE_TILE

public static final int ACTION_PLACE_TILE
Action mode constants.

See Also:
Constant Field Values

ACTION_EDIT_TILE

public static final int ACTION_EDIT_TILE
See Also:
Constant Field Values

ACTION_PLACE_PORTAL

public static final int ACTION_PLACE_PORTAL
See Also:
Constant Field Values

NUM_ACTIONS

public static final int NUM_ACTIONS
The number of actions.

See Also:
Constant Field Values

BASE_LAYER

public static final int BASE_LAYER
Miso layer constants.

See Also:
Constant Field Values

OBJECT_LAYER

public static final int OBJECT_LAYER
See Also:
Constant Field Values

LAYER_NAMES

public static final String[] LAYER_NAMES

TIP_ACTIONS

public static final String[] TIP_ACTIONS
Prose descriptions of actions suitable for tool tip display.


CMD_ACTIONS

public static final String[] CMD_ACTIONS
String translations for action identifiers.


_mode

protected int _mode
The currently selected action mode.


_tileSet

protected com.threerings.media.tile.TileSet _tileSet
The currently selected tileset.


_tileSetId

protected int _tileSetId
The currently selected tileset id.


_tileIndex

protected int _tileIndex
The currently selected tile id.


_fqTileId

protected int _fqTileId
The fully qualified tile id of the currently selected tile.


_lnum

protected int _lnum
The currently selected layer number.


_tile

protected com.threerings.media.tile.Tile _tile
The currently selected tile for placement in the scene.


_listeners

protected List<EditorModelListener> _listeners
The model listeners.


_tilemgr

protected com.threerings.media.tile.TileManager _tilemgr
The tile manager.


_objectGrip

protected int _objectGrip
Direction (which corner) we grip an object by.

Constructor Detail

EditorModel

public EditorModel(com.threerings.media.tile.TileManager tilemgr)
Method Detail

addListener

public void addListener(EditorModelListener l)
Add an editor model listener.

Parameters:
l - the listener.

notifyListeners

protected void notifyListeners(int event)
Notify all model listeners that the editor model has changed.


isTileValid

public boolean isTileValid()
Returns whether the currently selected tile is valid.


getActionMode

public int getActionMode()
Returns the current editor action mode.


getLayerIndex

public int getLayerIndex()
Returns the current scene layer index undergoing edit.


getTileSet

public com.threerings.media.tile.TileSet getTileSet()
Returns the currently selected tile set.


getTileSetId

public int getTileSetId()
Returns the currently selected tile set id.


getTileId

public int getTileId()
Returns the currently selected tile id within the selected tile set.


getTile

public com.threerings.media.tile.Tile getTile()
Returns the currently selected tile for placement within the scene.


getFQTileId

public int getFQTileId()
Returns the fully qualified tile id of the currently selected tile.


clearTile

public void clearTile()
Marks the currently selected tile as invalid such that editing when no tiles are available can be properly effected.


setActionMode

public void setActionMode(String cmd)
Sets the editor action mode. The specified mode should be one of CMD_ACTIONS.


setLayerIndex

public void setLayerIndex(int lnum)
Sets the scene layer index undergoing edit.


setTile

public void setTile(com.threerings.media.tile.TileSet set,
                    int tileSetId,
                    int tileIndex)
Sets the selected tile for placement within the scene.


setTileId

public void setTileId(int tileIndex)
Sets the tile id of the tile selected for placement within the scene.


setObjectGripDirection

public void setObjectGripDirection(int direction)
Sets the direction in which we should grip objects.


getObjectGripDirection

public int getObjectGripDirection()
Gets the direction in which we should grip objects.


toString

public String toString()
Overrides:
toString in class Object