jmri.jmrit.display
Class Editor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by jmri.util.JmriJFrame
                          extended by jmri.jmrit.display.Editor
All Implemented Interfaces:
ActionListener, ComponentListener, KeyListener, MouseListener, MouseMotionListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, ModifiedFlag
Direct Known Subclasses:
ControlPanelEditor, PanelEditor

public abstract class Editor
extends JmriJFrame
implements MouseListener, MouseMotionListener, ActionListener, KeyListener

This is the Model and a Controller for panel editor Views. (Panel Editor, Layout Editor or any subsequent editors) The Model is simply a list of Positionable objects added to a "target panel". Control of the display attributes of the Positionable objects is done here. However, control of mouse events is passed to the editor views, so control is also done by the editor views.

The "contents" List keeps track of all the objects added to the target frame for later manipulation. This class only locates and moves "target panel" items, and does not control their appearance - that is left for the editor views.

The Editor has tri-state "flags" to control the display of Positionable object attributes globally - i.e. "on" or "off" for all - or as a third state, permits the display control "locally" by corresponding flags in each Positionable object

The title of the target and the editor panel are kept consistent via the {#setTitle} method.

Mouse events are initially handled here, rather than in the individual displayed objects, so that selection boxes for moving multiple objects can be provided.

This class also implements an effective ToolTipManager replacement, because the standard Swing one can't deal with the coordinate changes used to zoom a panel. It works by controlling the contents of the _tooltip instance variable, and triggering repaint of the target window when the tooltip changes. The window painting then explicitly draws the tooltip for the underlying object.

Author:
Bob Jacobsen Copyright: Copyright (c) 2002, 2003, 2007, Dennis Miller 2004, Howard G. Penny Copyright: Copyright (c) 2005, Matthew Harris Copyright: Copyright (c) 2009, Pete Cressman Copyright: Copyright (c) 2009, 2010, 2011
See Also:
Serialized Form

Nested Class Summary
static class Editor.JFrameItem
           
 class Editor.TargetPane
          Special internal class to allow drawing of layout to a JLayeredPane This is the 'target' pane where the layout is displayed
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  int _anchorX
           
protected  int _anchorY
           
protected  ArrayList<Positionable> _contents
           
protected  Positionable _currentSelection
           
protected  boolean _dragging
           
protected  boolean _editable
           
protected  Rectangle _highlightcomponent
           
protected  int _lastX
           
protected  int _lastY
           
protected  double _paintScale
           
protected  boolean _pastePending
           
protected  int _scrollState
           
protected  ArrayList<Positionable> _selectionGroup
           
protected  Rectangle _selectRect
           
protected  JLayeredPane _targetPanel
           
static int BKG
           
static int CLOCK
           
protected  Color defaultBackgroundColor
           
 int frameLocationX
           
 int frameLocationY
           
static String[] ICON_EDITORS
          Icon editors for adding content
static int ICONS
           
static int LABELS
           
static int LIGHTS
           
static int MARKERS
           
static int MEMORIES
           
static int NUM_LEVELS
           
static int OPTION_CONTROLS
           
static int OPTION_HIDDEN
           
static int OPTION_POSITION
           
static int OPTION_TOOLTIP
           
static String POSITIONABLE_FLAVOR
           
static ResourceBundle rb
           
static ResourceBundle rbean
           
static int REPORTERS
           
static int SCROLL_BOTH
           
static int SCROLL_HORIZONTAL
           
static int SCROLL_NONE
           
static int SCROLL_VERTICAL
           
static int SECURITY
           
static int SENSORS
           
static int SIGNALS
           
static int TEMP
           
static int TURNOUTS
           
protected  int xLoc
           
protected  int yLoc
           
 
Fields inherited from class jmri.util.JmriJFrame
reuseFrameSavedPosition, reuseFrameSavedSized
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Editor()
           
Editor(String name)
           
 
Method Summary
 void actionPerformed(ActionEvent event)
          Wait TOOLTIPSHOWDELAY then show tooltip.
protected  void addBackgroundEditor()
           
protected  void addClock()
           
protected  void addIconEditor()
           
protected  PositionableLabel addLabel(String text)
           
protected  void addLeftTOEditor()
           
protected  LightIcon addLight()
          Add a Light indicator to the target
protected  void addLightEditor()
           
 LocoIcon addLocoIcon(String name)
           
protected  void addMemoryEditor()
           
protected  MemoryInputIcon addMemoryInputBox()
           
protected  MemorySpinnerIcon addMemorySpinner()
           
 MultiSensorIcon addMultiSensor()
           
protected  Editor.JFrameItem addMultiSensorEditor()
           
protected  ReporterIcon addReporter()
           
protected  void addReporterEditor()
           
protected  void addRightTOEditor()
           
protected  void addRpsReporter()
           
protected  void addSensorEditor()
           
protected  void addSignalHeadEditor()
           
protected  void addSignalMastEditor()
           
protected  void addSlipTOEditor()
           
protected  void addTextEditor()
          Add a label to the target
protected  void addToTarget(Positionable l)
           
 TrainIcon addTrainIcon(String name)
           
 void addTreeToEditors(CatalogTree tree)
          Called by ImageIndexEditor after it has stored new image files and new default icons.
protected  TurnoutIcon addTurnout(IconAdder editor)
           
protected  void alignGroup(boolean alignX)
           
 boolean allControlling()
           
 boolean allPositionable()
           
protected  Editor changeView(String className)
           
 void clearBackgroundColor()
           
protected abstract  void copyItem(Positionable p)
          set up item(s) to be copied by paste
 boolean deletePanel()
          On return of 'true', caller should call dispose()
 void displayLevelChange(Positionable l)
           
 void dispose(boolean clear)
           
 void disposeLoadData()
           
protected  void drawSelectRect(int x, int y)
           
 int getAnchorX()
           
 int getAnchorY()
           
 Color getBackgroundColor()
           
 List<Positionable> getContents()
           
 boolean getFlag(int whichOption, boolean localFlag)
           
 IconAdder getIconEditor(String name)
           
 List<IconAdder> getIconEditors()
          Icon Editors utils
 Editor.JFrameItem getIconFrame(String name)
           
protected  int getItemX(Positionable p, int deltaX)
           
protected  int getItemY(Positionable p, int deltaY)
           
 double getPaintScale()
          Get/Set scale for TargetPane drawing
protected  JScrollPane getPanelScrollPane()
           
 String getScrollable()
           
protected  List<Positionable> getSelectedItems(MouseEvent event)
          Return a List of all items whose bounding rectangle contain the mouse position.
protected  IconAdder getSignalHeadEditor()
           
 JFrame getTargetFrame()
           
 JComponent getTargetPanel()
           
protected  Dimension getTargetPanelSize()
           
protected abstract  void init(String name)
           
abstract  void initView()
          After construction, initialize all the widgets to their saved config settings.
 boolean isEditable()
           
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void loadFailed()
           
 NamedIcon loadFailed(String msg, String url)
           
 boolean loadOK()
           
protected  void locoMarkerFromInput()
           
protected  void locoMarkerFromRoster()
          Marker Menu
protected  Editor.JFrameItem makeAddIconFrame(String name, boolean add, boolean table, IconAdder editor)
           
 void makePalette()
           
protected  void makeSelectionGroup(MouseEvent event)
           
protected  void modifySelectionGroup(Positionable selection, MouseEvent event)
           
abstract  void mouseClicked(MouseEvent event)
           
abstract  void mouseDragged(MouseEvent event)
           
abstract  void mouseEntered(MouseEvent event)
           
abstract  void mouseExited(MouseEvent event)
           
abstract  void mouseMoved(MouseEvent event)
           
abstract  void mousePressed(MouseEvent event)
          Abstract Methods
abstract  void mouseReleased(MouseEvent event)
           
protected  void moveItem(Positionable p, int deltaX, int deltaY)
          Relocate item
protected abstract  void paintTargetPanel(Graphics g)
          Called from TargetPanel's paint method for additional drawing by editor view
protected  Positionable putIcon()
          Add an icon to the target
 void putItem(Positionable l)
           
 void putLocoIcon(LocoIcon l, String name)
           
protected  MemoryIcon putMemory()
           
protected  SensorIcon putSensor()
          Add a sensor indicator to the target
protected  SignalHeadIcon putSignalHead()
          Add a signal head to the target
protected  SignalMastIcon putSignalMast()
          Add a signal mast to the target
 boolean removeFromContents(Positionable l)
           
protected  void removeFromTarget(Positionable l)
          cleanup
protected  void removeMarkers()
          Remove marker icons from panel
protected  void removeSelections(Positionable p)
           
protected  LocoIcon selectLoco(String rosterEntryTitle)
           
 void setAllControlling(boolean state)
          Control whether target panel items are controlling layout items.
 void setAllEditable(boolean state)
          Control whether target panel items are editable.
 void setAllPositionable(boolean state)
          Control whether panel items are positionable.
 void setAllShowTooltip(boolean state)
           
protected  void setAttributes(PositionablePopupUtil newUtil, Positionable pos)
           
 void setBackgroundColor(Color col)
           
 void setDefaultToolTip(ToolTip dtt)
           
 void setDisplayLevelMenu(Positionable p, JPopupMenu popup)
          Display display 'z' level of the Positionable item and provide a dialog memu item to edit it.
 void setGlobalSetsLocalFlag(boolean set)
          Does global flag sets Positionable and Control for individual items
 void setHiddenMenu(Positionable p, JPopupMenu popup)
          Add a checkbox to set visibility of the Positionable item
protected abstract  void setNextLocation(Positionable obj)
          Set an object's location when it is created.
protected  void setPaintScale(double newScale)
           
 void setPanelMenu(boolean state)
          Control whether target panel shows a menu
 void setPositionableMenu(Positionable p, JPopupMenu popup)
          Add a checkbox to lock the position of the Positionable item
 void setRemoveMenu(Positionable p, JPopupMenu popup)
          Add an action to remove the Positionable item.
protected  void setScroll(int state)
           
 void setScroll(String strState)
           
protected  void setSelectionsAttributes(PositionablePopupUtil util, Positionable p)
           
protected  void setSelectionsHidden(boolean enabled, Positionable p)
           
protected  boolean setSelectionsPositionable(boolean enabled, Positionable p)
           
protected  void setSelectionsRotation(int k, Positionable p)
           
protected  void setSelectionsScale(double s, Positionable p)
           
 boolean setShowAlignmentMenu(Positionable p, JPopupMenu popup)
          Offer actions to align the selected Positionable items either Horizontally (at avearage y coord) or Vertically (at avearage x coord).
 boolean setShowCoordinatesMenu(Positionable p, JPopupMenu popup)
          Display the X & Y coordinates of the Positionable item and provide a dialog memu item to edit them.
 void setShowHidden(boolean state)
          Control whether target panel hidden items are visible or not.
 void setShowTooltipMenu(Positionable p, JPopupMenu popup)
          Add a checkbox to display a tooltip for the Positionable item and if showable, provide a dialog menu to edit it.
protected  void setTargetPanel(JLayeredPane targetPanel, JmriJFrame frame)
          An Editor may or may not choose to use 'this' as its frame or the interior class 'TargetPane' for its targetPanel
protected  void setTargetPanelSize(int w, int h)
           
protected  boolean setTextAttributes(Positionable p, JPopupMenu popup)
           
 void setTitle()
           
protected  void setToolTip(ToolTip tt)
           
 PositionableLabel setUpBackground(String name)
          Adding content to the panel
 void setUseGlobalFlag(boolean set)
          Set which flag should be used, global or local for Positioning and Control of individual items.
protected  boolean showAlignPopup(Positionable p)
           
 boolean showHidden()
           
protected abstract  void showPopUp(Positionable p, MouseEvent event)
          Editor Views should make calls to this class (Editor) to set popup menu items.
 boolean showTooltip()
           
 void showToolTip(Positionable selection, MouseEvent event)
          Mouse Methods
protected  void targetWindowClosing(boolean save)
          The target window has been requested to close, don't delete it at this time.
protected abstract  void targetWindowClosingEvent(WindowEvent e)
           
 boolean useGlobalFlag()
           
 
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, addNotify, componentHidden, componentMoved, componentResized, componentShown, dispose, generateWindowRef, getFrame, getFrameList, getMaximumSize, getModifiedFlag, getPreferredSize, getSavePosition, getSaveSize, getWindowFrameRef, handleModified, initComponents, markWindowModified, pack, setModifiedFlag, setSavePosition, setSaveSize, setShutDownTask, storeValues, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

BKG

public static final int BKG
See Also:
Constant Field Values

TEMP

public static final int TEMP
See Also:
Constant Field Values

ICONS

public static final int ICONS
See Also:
Constant Field Values

LABELS

public static final int LABELS
See Also:
Constant Field Values

MEMORIES

public static final int MEMORIES
See Also:
Constant Field Values

REPORTERS

public static final int REPORTERS
See Also:
Constant Field Values

SECURITY

public static final int SECURITY
See Also:
Constant Field Values

TURNOUTS

public static final int TURNOUTS
See Also:
Constant Field Values

LIGHTS

public static final int LIGHTS
See Also:
Constant Field Values

SIGNALS

public static final int SIGNALS
See Also:
Constant Field Values

SENSORS

public static final int SENSORS
See Also:
Constant Field Values

CLOCK

public static final int CLOCK
See Also:
Constant Field Values

MARKERS

public static final int MARKERS
See Also:
Constant Field Values

NUM_LEVELS

public static final int NUM_LEVELS
See Also:
Constant Field Values

SCROLL_NONE

public static final int SCROLL_NONE
See Also:
Constant Field Values

SCROLL_BOTH

public static final int SCROLL_BOTH
See Also:
Constant Field Values

SCROLL_HORIZONTAL

public static final int SCROLL_HORIZONTAL
See Also:
Constant Field Values

SCROLL_VERTICAL

public static final int SCROLL_VERTICAL
See Also:
Constant Field Values

rb

public static final ResourceBundle rb

rbean

public static final ResourceBundle rbean

POSITIONABLE_FLAVOR

public static final String POSITIONABLE_FLAVOR
See Also:
Constant Field Values

_contents

protected ArrayList<Positionable> _contents

_targetPanel

protected JLayeredPane _targetPanel

_scrollState

protected int _scrollState

_editable

protected boolean _editable

OPTION_POSITION

public static final int OPTION_POSITION
See Also:
Constant Field Values

OPTION_CONTROLS

public static final int OPTION_CONTROLS
See Also:
Constant Field Values

OPTION_HIDDEN

public static final int OPTION_HIDDEN
See Also:
Constant Field Values

OPTION_TOOLTIP

public static final int OPTION_TOOLTIP
See Also:
Constant Field Values

_lastX

protected int _lastX

_lastY

protected int _lastY

_selectRect

protected Rectangle _selectRect

_highlightcomponent

protected Rectangle _highlightcomponent

_dragging

protected boolean _dragging

_selectionGroup

protected ArrayList<Positionable> _selectionGroup

_currentSelection

protected Positionable _currentSelection

xLoc

protected int xLoc

yLoc

protected int yLoc

_anchorX

protected int _anchorX

_anchorY

protected int _anchorY

_paintScale

protected double _paintScale

defaultBackgroundColor

protected Color defaultBackgroundColor

_pastePending

protected boolean _pastePending

ICON_EDITORS

public static final String[] ICON_EDITORS
Icon editors for adding content


frameLocationX

public int frameLocationX

frameLocationY

public int frameLocationY
Constructor Detail

Editor

public Editor()

Editor

public Editor(String name)
Method Detail

loadFailed

public void loadFailed()

loadFailed

public NamedIcon loadFailed(String msg,
                            String url)

disposeLoadData

public void disposeLoadData()

loadOK

public boolean loadOK()

getContents

public List<Positionable> getContents()

setDefaultToolTip

public void setDefaultToolTip(ToolTip dtt)

setTargetPanel

protected void setTargetPanel(JLayeredPane targetPanel,
                              JmriJFrame frame)
An Editor may or may not choose to use 'this' as its frame or the interior class 'TargetPane' for its targetPanel


setTargetPanelSize

protected void setTargetPanelSize(int w,
                                  int h)

getTargetPanelSize

protected Dimension getTargetPanelSize()

getTargetPanel

public final JComponent getTargetPanel()

getPanelScrollPane

protected final JScrollPane getPanelScrollPane()

getTargetFrame

public final JFrame getTargetFrame()

getBackgroundColor

public Color getBackgroundColor()

setBackgroundColor

public void setBackgroundColor(Color col)

clearBackgroundColor

public void clearBackgroundColor()

getPaintScale

public final double getPaintScale()
Get/Set scale for TargetPane drawing


setPaintScale

protected final void setPaintScale(double newScale)

setToolTip

protected void setToolTip(ToolTip tt)

actionPerformed

public void actionPerformed(ActionEvent event)
Wait TOOLTIPSHOWDELAY then show tooltip. Wait TOOLTIPDISMISSDELAY and disaappear

Specified by:
actionPerformed in interface ActionListener

setAllEditable

public void setAllEditable(boolean state)
Control whether target panel items are editable. Does this by invoke the Positionable.setEditable(boolean) function of each item on the target panel. This also controls the relevant pop-up menu items (which are the primary way that items are edited).

Parameters:
state - true for editable.

isEditable

public boolean isEditable()

setUseGlobalFlag

public void setUseGlobalFlag(boolean set)
Set which flag should be used, global or local for Positioning and Control of individual items. Items call getFlag() to return the appropriate flag it should use.


useGlobalFlag

public boolean useGlobalFlag()

getFlag

public boolean getFlag(int whichOption,
                       boolean localFlag)
Parameters:
localFlag - is the current setting of the item

setGlobalSetsLocalFlag

public void setGlobalSetsLocalFlag(boolean set)
Does global flag sets Positionable and Control for individual items


setAllPositionable

public void setAllPositionable(boolean state)
Control whether panel items are positionable. Markers are always positionable.

Parameters:
state - true for all items positionable.

allPositionable

public boolean allPositionable()

setAllControlling

public void setAllControlling(boolean state)
Control whether target panel items are controlling layout items. Does this by invoke the Positionable.setControlling(boolean) function of each item on the target panel. This also controls the relevant pop-up menu items.

Parameters:
state - true for controlling.

allControlling

public boolean allControlling()

setShowHidden

public void setShowHidden(boolean state)
Control whether target panel hidden items are visible or not. Does this by invoke the Positionable.setHidden(boolean) function of each item on the target panel.

Parameters:
state - true for Visible.

showHidden

public boolean showHidden()

setAllShowTooltip

public void setAllShowTooltip(boolean state)

showTooltip

public boolean showTooltip()

setPanelMenu

public void setPanelMenu(boolean state)
Control whether target panel shows a menu

Parameters:
state - true for controlling.

setScroll

protected void setScroll(int state)

setScroll

public void setScroll(String strState)

getScrollable

public String getScrollable()

targetWindowClosing

protected void targetWindowClosing(boolean save)
The target window has been requested to close, don't delete it at this time. Deletion must be accomplished via the Delete this panel menu item.


changeView

protected Editor changeView(String className)

setPositionableMenu

public void setPositionableMenu(Positionable p,
                                JPopupMenu popup)
Add a checkbox to lock the position of the Positionable item


setShowCoordinatesMenu

public boolean setShowCoordinatesMenu(Positionable p,
                                      JPopupMenu popup)
Display the X & Y coordinates of the Positionable item and provide a dialog memu item to edit them.


setShowAlignmentMenu

public boolean setShowAlignmentMenu(Positionable p,
                                    JPopupMenu popup)
Offer actions to align the selected Positionable items either Horizontally (at avearage y coord) or Vertically (at avearage x coord).


setDisplayLevelMenu

public void setDisplayLevelMenu(Positionable p,
                                JPopupMenu popup)
Display display 'z' level of the Positionable item and provide a dialog memu item to edit it.


setHiddenMenu

public void setHiddenMenu(Positionable p,
                          JPopupMenu popup)
Add a checkbox to set visibility of the Positionable item


setShowTooltipMenu

public void setShowTooltipMenu(Positionable p,
                               JPopupMenu popup)
Add a checkbox to display a tooltip for the Positionable item and if showable, provide a dialog menu to edit it.


setRemoveMenu

public void setRemoveMenu(Positionable p,
                          JPopupMenu popup)
Add an action to remove the Positionable item.


locoMarkerFromRoster

protected void locoMarkerFromRoster()
Marker Menu


selectLoco

protected LocoIcon selectLoco(String rosterEntryTitle)

locoMarkerFromInput

protected void locoMarkerFromInput()

removeMarkers

protected void removeMarkers()
Remove marker icons from panel


setUpBackground

public PositionableLabel setUpBackground(String name)
Adding content to the panel


addLabel

protected PositionableLabel addLabel(String text)

displayLevelChange

public void displayLevelChange(Positionable l)

addTrainIcon

public TrainIcon addTrainIcon(String name)

addLocoIcon

public LocoIcon addLocoIcon(String name)

putLocoIcon

public void putLocoIcon(LocoIcon l,
                        String name)

putItem

public void putItem(Positionable l)

addToTarget

protected void addToTarget(Positionable l)

getIconFrame

public Editor.JFrameItem getIconFrame(String name)
Parameters:
name - Icon editor's name

getIconEditor

public IconAdder getIconEditor(String name)

addTextEditor

protected void addTextEditor()
Add a label to the target


addRightTOEditor

protected void addRightTOEditor()

addLeftTOEditor

protected void addLeftTOEditor()

addSlipTOEditor

protected void addSlipTOEditor()

addSensorEditor

protected void addSensorEditor()

getSignalHeadEditor

protected IconAdder getSignalHeadEditor()

addSignalHeadEditor

protected void addSignalHeadEditor()

addSignalMastEditor

protected void addSignalMastEditor()

addMemoryEditor

protected void addMemoryEditor()

addReporterEditor

protected void addReporterEditor()

addLightEditor

protected void addLightEditor()

addBackgroundEditor

protected void addBackgroundEditor()

addMultiSensorEditor

protected Editor.JFrameItem addMultiSensorEditor()

addIconEditor

protected void addIconEditor()

putSensor

protected SensorIcon putSensor()
Add a sensor indicator to the target


addTurnout

protected TurnoutIcon addTurnout(IconAdder editor)

putSignalHead

protected SignalHeadIcon putSignalHead()
Add a signal head to the target


putSignalMast

protected SignalMastIcon putSignalMast()
Add a signal mast to the target


putMemory

protected MemoryIcon putMemory()

addMemorySpinner

protected MemorySpinnerIcon addMemorySpinner()

addMemoryInputBox

protected MemoryInputIcon addMemoryInputBox()

addLight

protected LightIcon addLight()
Add a Light indicator to the target


addReporter

protected ReporterIcon addReporter()

putIcon

protected Positionable putIcon()
Add an icon to the target


addMultiSensor

public MultiSensorIcon addMultiSensor()

addClock

protected void addClock()

addRpsReporter

protected void addRpsReporter()

getIconEditors

public List<IconAdder> getIconEditors()
Icon Editors utils


addTreeToEditors

public void addTreeToEditors(CatalogTree tree)
Called by ImageIndexEditor after it has stored new image files and new default icons.


setTitle

public void setTitle()

makeAddIconFrame

protected Editor.JFrameItem makeAddIconFrame(String name,
                                             boolean add,
                                             boolean table,
                                             IconAdder editor)

makePalette

public void makePalette()

removeFromTarget

protected void removeFromTarget(Positionable l)
cleanup


removeFromContents

public boolean removeFromContents(Positionable l)

deletePanel

public boolean deletePanel()
On return of 'true', caller should call dispose()


dispose

public void dispose(boolean clear)

showToolTip

public void showToolTip(Positionable selection,
                        MouseEvent event)
Mouse Methods


getItemX

protected int getItemX(Positionable p,
                       int deltaX)

getItemY

protected int getItemY(Positionable p,
                       int deltaY)

moveItem

protected void moveItem(Positionable p,
                        int deltaX,
                        int deltaY)
Relocate item


getSelectedItems

protected List<Positionable> getSelectedItems(MouseEvent event)
Return a List of all items whose bounding rectangle contain the mouse position. ordered from top level to bottom


makeSelectionGroup

protected void makeSelectionGroup(MouseEvent event)

modifySelectionGroup

protected void modifySelectionGroup(Positionable selection,
                                    MouseEvent event)

setTextAttributes

protected boolean setTextAttributes(Positionable p,
                                    JPopupMenu popup)

setAttributes

protected void setAttributes(PositionablePopupUtil newUtil,
                             Positionable pos)

setSelectionsAttributes

protected void setSelectionsAttributes(PositionablePopupUtil util,
                                       Positionable p)

setSelectionsHidden

protected void setSelectionsHidden(boolean enabled,
                                   Positionable p)

setSelectionsPositionable

protected boolean setSelectionsPositionable(boolean enabled,
                                            Positionable p)

removeSelections

protected void removeSelections(Positionable p)

setSelectionsScale

protected void setSelectionsScale(double s,
                                  Positionable p)

setSelectionsRotation

protected void setSelectionsRotation(int k,
                                     Positionable p)

showAlignPopup

protected boolean showAlignPopup(Positionable p)

alignGroup

protected void alignGroup(boolean alignX)

drawSelectRect

protected void drawSelectRect(int x,
                              int y)

getAnchorX

public final int getAnchorX()

getAnchorY

public final int getAnchorY()

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

keyPressed

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

keyReleased

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

mousePressed

public abstract void mousePressed(MouseEvent event)
Abstract Methods

Specified by:
mousePressed in interface MouseListener

mouseReleased

public abstract void mouseReleased(MouseEvent event)
Specified by:
mouseReleased in interface MouseListener

mouseClicked

public abstract void mouseClicked(MouseEvent event)
Specified by:
mouseClicked in interface MouseListener

mouseDragged

public abstract void mouseDragged(MouseEvent event)
Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public abstract void mouseMoved(MouseEvent event)
Specified by:
mouseMoved in interface MouseMotionListener

mouseEntered

public abstract void mouseEntered(MouseEvent event)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public abstract void mouseExited(MouseEvent event)
Specified by:
mouseExited in interface MouseListener

init

protected abstract void init(String name)

targetWindowClosingEvent

protected abstract void targetWindowClosingEvent(WindowEvent e)

paintTargetPanel

protected abstract void paintTargetPanel(Graphics g)
Called from TargetPanel's paint method for additional drawing by editor view


setNextLocation

protected abstract void setNextLocation(Positionable obj)
Set an object's location when it is created.


showPopUp

protected abstract void showPopUp(Positionable p,
                                  MouseEvent event)
Editor Views should make calls to this class (Editor) to set popup menu items. See 'Popup Item Methods' above for the calls.


initView

public abstract void initView()
After construction, initialize all the widgets to their saved config settings.


copyItem

protected abstract void copyItem(Positionable p)
set up item(s) to be copied by paste



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads