com.threerings.stage.tools.editor
Class EditorScenePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.threerings.media.MediaPanel
                  extended by com.threerings.media.VirtualMediaPanel
                      extended by com.threerings.miso.client.MisoScenePanel
                          extended by com.threerings.stage.client.StageScenePanel
                              extended by com.threerings.stage.tools.editor.EditorScenePanel
All Implemented Interfaces:
ControllerProvider, RadialMenu.Host, com.threerings.crowd.client.PlaceView, com.threerings.media.FrameParticipant, com.threerings.media.MediaConstants, com.threerings.media.MediaHost, com.threerings.media.util.AStarPathUtil.TraversalPred, EditorModelListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, ChangeListener

public class EditorScenePanel
extends StageScenePanel
implements EditorModelListener, ChangeListener

Displays the scene view and handles UI events on the scene. Various actions may be performed on the scene depending on the selected action mode, including placing and deleting tiles or locations and creating portals.

See Also:
Serialized Form

Nested Class Summary
static interface EditorScenePanel.SceneModelListener
           
 
Nested classes/interfaces inherited from class com.threerings.media.MediaPanel
com.threerings.media.MediaPanel.Obscurer
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class com.threerings.stage.client.StageScenePanel
CLUSTER_CLICKED, LOCATION_CLICKED, SHOW_CLUSTERS, SHOW_PLOTS
 
Fields inherited from class com.threerings.miso.client.MisoScenePanel
SHOW_TIPS
 
Fields inherited from class com.threerings.media.VirtualMediaPanel
CENTER_ON_PATHABLE, ENCLOSE_PATHABLE, TRACK_PATHABLE
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.threerings.stage.tools.editor.EditorModelListener
ACTION_MODE_CHANGED, LAYER_INDEX_CHANGED, TILE_CHANGED
 
Fields inherited from interface com.threerings.media.MediaConstants
ALL, BACK, FRONT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EditorScenePanel(EditorContext ctx, JFrame frame, EditorModel model, EditorScenePanel.SceneModelListener sceneListener)
          Constructs the editor scene view panel.
 
Method Summary
 com.threerings.miso.data.ObjectInfo addObject(com.threerings.miso.data.ObjectInfo oinfo)
          Adds the given object to the scene.
 com.threerings.miso.data.ObjectInfo addObject(com.threerings.media.tile.ObjectTile tile, int fqTileId, int x, int y)
          Sets an object tile at the specified position in the scene (in tile coordinates).
 Rectangle clearTileSelectRegion(int x, int y)
          Clear and return the drag rectangle for selecting a rectangular region.
 boolean deleteObject(com.threerings.miso.data.ObjectInfo info)
          Delete the given object from the scene.
 boolean deleteObject(com.threerings.miso.client.SceneObject scobj)
          Deletes the object tile at the specified tile coordinates.
 void deletePortal(int x, int y)
          Deletes the portal at the specified full coordinates.
 void enableCoordHighlighting(boolean enabled)
          Enables or disables highlighting of the tile over which the mouse is currently positioned.
 Portal getEntrance()
          Returns the portal that serves as the default entrance to this scene or null if no default is set.
 BoundedRangeModel getHorizModel()
          Returns a range model that controls the scrollability of the scene in the horizontal direction.
 BoundedRangeModel getVertModel()
          Returns a range model that controls the scrollability of the scene in the vertical direction.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void modelChanged(int event)
          Called by the EditorModel when the model is changed.
 void mouseDragged(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent event)
           
 void mouseReleased(MouseEvent e)
           
 void redo()
           
 boolean setBaseTile(int fqTileId, int x, int y)
          Sets a base tile at the specified position in the scene (in tile coordinates).
 void setBaseTiles(Rectangle r, int setId, int tileCount)
          Set a region of tiles to a random selection from the supplied tileset.
 void setBounds(int x, int y, int width, int height)
           
 void setEditorScrollBox(EditorScrollBox box)
          Set the scroll box that tracks our view.
 void setEntrance(Portal port)
          Makes the specified portal the default entrance to this scene.
 void setPlacingTile(com.threerings.media.tile.Tile tile)
          Sets the tile that is currently being placed.
 void setSceneModel(com.threerings.miso.data.MisoSceneModel model)
           
 void setTileSelectRegion(Point drag)
          Sets the start (in tile coords) of a mouse drag when placing a rectangular area of base tiles.
 void stateChanged(ChangeEvent e)
           
 void undo()
           
 boolean updateCoordPos(int x, int y, Point cpos)
          Updates the coordinate position and returns true if it has changed.
 void updateDefaultTileSet(int tileSetId)
          Updates the default tileset in the currently edited scene.
 
Methods inherited from class com.threerings.stage.client.StageScenePanel
didLeavePlace, getColorizer, getController, getPortal, getScene, keyTyped, removeCluster, sceneUpdated, setScene, updateCluster, willEnterPlace
 
Methods inherited from class com.threerings.miso.client.MisoScenePanel
addNotify, canTraverse, centerOnTile, checkShowFlag, clearRadialMenu, computeIndicators, computeInfluentialBounds, enumerateResolvedBlocks, getBlock, getComponent, getFullCoords, getHoverCoords, getHoverObject, getPath, getSceneMetrics, getSceneModel, getScreenCoords, getTileCoords, getViewBounds, menuDeactivated, mouseClicked, mouseEntered, paint, pressObject, refreshScene, removeNotify, repaintRect, reportMemoryUsage, setShowFlags
 
Methods inherited from class com.threerings.media.VirtualMediaPanel
addViewTracker, clearPathable, doLayout, removeViewTracker, setBackground, setFollowsPathable, setViewLocation
 
Methods inherited from class com.threerings.media.MediaPanel
abortAnimation, addAnimation, addObscurer, addSprite, clearAnimations, clearSprites, createGraphics, getAnimationManager, getRegionManager, getSpriteManager, getTimeStamp, isManaged, isManaged, needsPaint, removeObscurer, removeSprite, repaint, setOpaque, setPaused, tick
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EditorScenePanel

public EditorScenePanel(EditorContext ctx,
                        JFrame frame,
                        EditorModel model,
                        EditorScenePanel.SceneModelListener sceneListener)
Constructs the editor scene view panel.

Method Detail

getHorizModel

public BoundedRangeModel getHorizModel()
Returns a range model that controls the scrollability of the scene in the horizontal direction.


getVertModel

public BoundedRangeModel getVertModel()
Returns a range model that controls the scrollability of the scene in the vertical direction.


stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener

setSceneModel

public void setSceneModel(com.threerings.miso.data.MisoSceneModel model)
Overrides:
setSceneModel in class com.threerings.miso.client.MisoScenePanel

updateDefaultTileSet

public void updateDefaultTileSet(int tileSetId)
Updates the default tileset in the currently edited scene.


setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Overrides:
setBounds in class com.threerings.miso.client.MisoScenePanel

modelChanged

public void modelChanged(int event)
Description copied from interface: EditorModelListener
Called by the EditorModel when the model is changed.

Specified by:
modelChanged in interface EditorModelListener

mousePressed

public void mousePressed(MouseEvent event)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class com.threerings.miso.client.MisoScenePanel

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class com.threerings.miso.client.MisoScenePanel

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class com.threerings.miso.client.MisoScenePanel

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class com.threerings.miso.client.MisoScenePanel

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class com.threerings.miso.client.MisoScenePanel

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener
Overrides:
keyPressed in class StageScenePanel

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class StageScenePanel

setBaseTile

public boolean setBaseTile(int fqTileId,
                           int x,
                           int y)
Sets a base tile at the specified position in the scene (in tile coordinates).

Returns:
- if the tile was successfully set

setBaseTiles

public void setBaseTiles(Rectangle r,
                         int setId,
                         int tileCount)
Set a region of tiles to a random selection from the supplied tileset.


addObject

public com.threerings.miso.data.ObjectInfo addObject(com.threerings.media.tile.ObjectTile tile,
                                                     int fqTileId,
                                                     int x,
                                                     int y)
Sets an object tile at the specified position in the scene (in tile coordinates).

Returns:
- the created object or null if an identical object was already in that spot.

addObject

public com.threerings.miso.data.ObjectInfo addObject(com.threerings.miso.data.ObjectInfo oinfo)
Adds the given object to the scene.

Returns:
the added object or null if an identical object was already in that spot.

deleteObject

public boolean deleteObject(com.threerings.miso.client.SceneObject scobj)
Deletes the object tile at the specified tile coordinates.

Returns:
true - if a matching object was found and deleted.

deleteObject

public boolean deleteObject(com.threerings.miso.data.ObjectInfo info)
Delete the given object from the scene.

Returns:
true - if a matching object was found and deleted.

setPlacingTile

public void setPlacingTile(com.threerings.media.tile.Tile tile)
Sets the tile that is currently being placed. It will not be rendered until after a call to MisoScenePanel.updateTileCoords(int, int, java.awt.Point) on the placing tile (which happens automatically when the mouse moves).


setTileSelectRegion

public void setTileSelectRegion(Point drag)
Sets the start (in tile coords) of a mouse drag when placing a rectangular area of base tiles.


clearTileSelectRegion

public Rectangle clearTileSelectRegion(int x,
                                       int y)
Clear and return the drag rectangle for selecting a rectangular region.

Returns:
null if the drag is the same as the supplied tile coordinates, a rectangle containing the selected region if it was different.

enableCoordHighlighting

public void enableCoordHighlighting(boolean enabled)
Enables or disables highlighting of the tile over which the mouse is currently positioned.


deletePortal

public void deletePortal(int x,
                         int y)
Deletes the portal at the specified full coordinates.


getEntrance

public Portal getEntrance()
Returns the portal that serves as the default entrance to this scene or null if no default is set.


setEntrance

public void setEntrance(Portal port)
Makes the specified portal the default entrance to this scene.


updateCoordPos

public boolean updateCoordPos(int x,
                              int y,
                              Point cpos)
Updates the coordinate position and returns true if it has changed.


setEditorScrollBox

public void setEditorScrollBox(EditorScrollBox box)
Set the scroll box that tracks our view.


undo

public void undo()

redo

public void redo()


Copyright © 2011. All Rights Reserved.