com.threerings.stage.tools.editor

## Class EditorModel

- java.lang.Object
- - 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

Fields
`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

Constructors
Constructor and Description
`EditorModel(com.threerings.media.tile.TileManager tilemgr)`

### Method Summary

All Methods Instance Methods Concrete Methods
`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.
`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

`equals, 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.

### 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.

#### 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`