jmri.jmrit.display.layoutEditor
Class LayoutEditor

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
                              extended by jmri.jmrit.display.panelEditor.PanelEditor
                                  extended by jmri.jmrit.display.layoutEditor.LayoutEditor
All Implemented Interfaces:
ActionListener, ComponentListener, ItemListener, KeyListener, MouseListener, MouseMotionListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, ModifiedFlag

public class LayoutEditor
extends PanelEditor

Provides a scrollable Layout Panel and editor toolbars (that can be hidden)

This module serves as a manager for the LayoutTurnout, Layout Block, PositionablePoint, Track Segment, and LevelXing objects which are integral subparts of the LayoutEditor class.

All created objects are put on specific levels depending on their type (higher levels are in front): Note that higher numbers appear behind lower numbers.

The "contents" List keeps track of all text and icon label objects added to the targetframe for later manipulation. Other Lists keep track of drawn items.

Based in part on PanelEditor.java (Bob Jacobsen (c) 2002, 2003). In particular, text and icon label items are copied from Panel editor, as well as some of the control design.

Author:
Dave Duchamp Copyright: (c) 2004-2007
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrit.display.Editor
Editor.JFrameItem, Editor.TargetPane
 
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
 LayoutEditorAuxTools auxTools
           
 ArrayList<PositionableLabel> backgroundImage
           
 ArrayList<AnalogClock2Display> clocks
           
 ArrayList<PositionableLabel> labelImage
           
static int LAYOUT_POS_JCOMP
           
static int LAYOUT_POS_LABEL
           
static int LEVEL_XING_A
           
static int LEVEL_XING_B
           
static int LEVEL_XING_C
           
static int LEVEL_XING_CENTER
           
static int LEVEL_XING_D
           
static int MARKER
           
 ArrayList<LocoIcon> markerImage
           
 ArrayList<MemoryIcon> memoryLabelList
           
static int MULTI_SENSOR
           
 ArrayList<MultiSensorIcon> multiSensors
           
static int NONE
           
 ArrayList<PositionablePoint> pointList
           
static int POS_POINT
           
 JFrame sensorFrame
           
 MultiIconEditor sensorIconEditor
           
 ArrayList<SensorIcon> sensorImage
           
 ArrayList<SensorIcon> sensorList
           
 JFrame signalFrame
           
 ArrayList<SignalHeadIcon> signalHeadImage
           
 MultiIconEditor signalIconEditor
           
 ArrayList<SignalHeadIcon> signalList
           
 ArrayList<SignalMastIcon> signalMastImage
           
 ArrayList<SignalMastIcon> signalMastList
           
protected  boolean skipIncludedTurnout
           
static int TRACK
           
static int TRACK_CIRCLE_CENTRE
           
 ArrayList<TrackSegment> trackList
           
static int TURNOUT_A
           
static int TURNOUT_B
           
static int TURNOUT_C
           
static int TURNOUT_CENTER
           
static int TURNOUT_D
           
 ArrayList<LayoutTurnout> turnoutList
           
static int TURNTABLE_CENTER
           
static int TURNTABLE_RAY_OFFSET
           
 ArrayList<LayoutTurntable> turntableList
           
 ArrayList<LevelXing> xingList
           
 
Fields inherited from class jmri.jmrit.display.panelEditor.PanelEditor
_debug, _multiItemCopyGroup, addItemViaMouseClick, pasteItemFlag
 
Fields inherited from class jmri.jmrit.display.Editor
_anchorX, _anchorY, _contents, _currentSelection, _dragging, _editable, _highlightcomponent, _lastX, _lastY, _paintScale, _pastePending, _scrollState, _selectionGroup, _selectRect, _targetPanel, BKG, CLOCK, frameLocationX, frameLocationY, ICON_EDITORS, ICONS, LABELS, LIGHTS, MARKERS, MEMORIES, NUM_LEVELS, OPTION_CONTROLS, OPTION_HIDDEN, OPTION_POSITION, OPTION_TOOLTIP, POSITIONABLE_FLAVOR, REPORTERS, SCROLL_BOTH, SCROLL_HORIZONTAL, SCROLL_NONE, SCROLL_VERTICAL, SECURITY, SENSORS, SIGNALS, TEMP, TURNOUTS, xLoc, 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
LayoutEditor()
           
LayoutEditor(String name)
           
 
Method Summary
 void addAnchor()
          Add an Anchor point.
 void addBackground()
          Add a background image
 void addEndBumper()
          Add an End Bumper point.
 void addLayoutTurnout(int type)
          Add a Layout Turnout
 void addLevelXing()
          Add a Level Crossing
 LocoIcon addLocoIcon(String name)
          Add a loco marker to the target
 void addMultiSensor(MultiSensorIcon l)
           
 void addTrackSegment()
          Add a Track Segment
 void addTurntable(Point2D pt)
          Add a layout turntable at location specified
 void alignSelection(boolean alignX)
           
static String colorToString(Color color)
           
 boolean deletePanel()
          Invoked by DeletePanel menu item Validate user intent before deleting
protected  void drawTurnouts(Graphics2D g2)
           
protected  void enterReporter(int defaultX, int defaultY)
           
protected  void enterTrackWidth()
           
 LayoutTurnout findLayoutTurnoutByName(String name)
           
 LayoutTurnout findLayoutTurnoutBySensor(String sensorName)
           
 LayoutTurnout findLayoutTurnoutBySignalMast(String signalMastName)
           
 LayoutTurntable findLayoutTurntableByName(String name)
           
 LevelXing findLevelXingByName(String name)
           
 LevelXing findLevelXingBySensor(String sensorName)
           
 LevelXing findLevelXingBySignalMast(String signalMastName)
           
 Object findObjectByTypeAndName(int type, String name)
           
 PositionablePoint findPositionablePointAtTrackSegments(TrackSegment tr1, TrackSegment tr2)
           
 PositionablePoint findPositionablePointByEastBoundSensor(String sensorName)
           
 PositionablePoint findPositionablePointByEastBoundSignal(String signalName)
           
 PositionablePoint findPositionablePointByEastBoundSignalMast(String signalMastName)
           
 PositionablePoint findPositionablePointByName(String name)
           
 PositionablePoint findPositionablePointByWestBoundSensor(String sensorName)
           
 PositionablePoint findPositionablePointByWestBoundSignal(String signalName)
           
 PositionablePoint findPositionablePointByWestBoundSignalMast(String signalMastName)
           
 ArrayList<TrackSegment> findTrackSegmentByBlock(String name)
          Returns an array list of track segments matching the block name.
 TrackSegment findTrackSegmentByName(String name)
           
 LayoutBlock getAffectedBlock(Object o, int type)
           
 boolean getAntialiasingOn()
           
 ConnectivityUtil getConnectivityUtil()
           
protected  Point2D getCoords(Object o, int type)
           
 String getDefaultTextColor()
           
 String getDefaultTrackColor()
           
 boolean getDrawGrid()
           
 Point2D getEndCoords(Object o, int type)
           
 LayoutBlock getLayoutBlock(String blockID)
          Return a layout block with the given name if one exists.
 int getLayoutHeight()
           
 String getLayoutName()
           
 int getLayoutWidth()
           
 LayoutEditorTools getLETools()
           
 int getMainlineTrackWidth()
           
 boolean getScroll()
           
 boolean getShowHelpBar()
           
 int getSideTrackWidth()
           
 boolean getSnapOnAdd()
           
 boolean getSnapOnMove()
           
 boolean getTooltipsInEdit()
           
 boolean getTooltipsNotEdit()
           
 double getTurnoutBX()
           
 boolean getTurnoutCircles()
           
 double getTurnoutCX()
           
 double getTurnoutWid()
           
 int getUpperLeftX()
           
 int getUpperLeftY()
           
 int getWindowHeight()
           
 int getWindowWidth()
           
 double getXOverHWid()
           
 double getXOverLong()
           
 double getXOverShort()
           
 double getXScale()
           
 double getYScale()
           
protected  void init(String name)
           
 void initView()
          After construction, initialize all the widgets to their saved config settings.
 boolean isAnimating()
           
 boolean isDirty()
          Check the dirty state
 void keyPressed(KeyEvent e)
           
 void mouseClicked(MouseEvent event)
           
 void mouseDragged(MouseEvent event)
           
 void mouseMoved(MouseEvent event)
           
 void mousePressed(MouseEvent event)
          Handle a mouse pressed event
 void mouseReleased(MouseEvent event)
           
protected  void moveSelection()
           
protected  void paintTargetPanel(Graphics g)
          Special internal class to allow drawing of layout to a JLayeredPane This is the 'target' pane where the layout is displayed
 LayoutBlock provideLayoutBlock(String s)
          Return a layout block with the entered name, creating a new one if needed.
 void putItem(Positionable l)
           
 void putLocoIcon(LocoIcon l, String name)
           
 void putSensor(SensorIcon l)
           
 void putSignal(SignalHeadIcon l)
           
 void putSignalMast(SignalMastIcon l)
           
 void redrawPanel()
          Allow external trigger of re-draw
protected  boolean remove(Object s)
          Remove object from all Layout Editor temmporary lists of items not part of track schematic
protected  void removeBackground(PositionableLabel b)
          Remove a background image from the list of background images
 boolean removeFromContents(Positionable l)
           
protected  boolean removeLayoutTurnout(LayoutTurnout o)
          Remove a LayoutTurnout
protected  boolean removeLevelXing(LevelXing o)
          Remove a Level Crossing
protected  void removeMarkers()
          Remove marker icons from panel
protected  boolean removePositionablePoint(PositionablePoint o)
          Remove a PositionablePoint -- an Anchor or an End Bumper.
protected  void removeTrackSegment(TrackSegment o)
          Remove a Track Segment
protected  boolean removeTurntable(LayoutTurntable o)
          Remove a Layout Turntable
 void resetAwaitingIconChange()
           
 void resetDirty()
          Allow external reset of dirty bit
protected  void scaleTrackDiagram()
           
 void setAllEditable(boolean editable)
          Control whether target panel items are editable.
 void setAllPositionable(boolean state)
          Control whether panel items are positionable.
 void setAntialiasingOn(boolean state)
           
 void setAwaitingIconChange()
          Allow external set/reset of awaitingIconChange
 void setConnections()
           
 void setCurrentPositionAndSize()
           
 void setDefaultTextColor(String color)
           
 void setDefaultTrackColor(String color)
           
 void setDirty()
           
 void setDirty(boolean val)
          Allow external set of dirty bit
 void setDrawGrid(boolean state)
           
 void setLayoutDimensions(int windowW, int windowH, int x, int y, int panelW, int panelH)
           
 void setLayoutName(String name)
           
 void setLoc(int x, int y)
           
 void setMainlineTrackWidth(int w)
           
protected  void setNextLocation(Positionable obj)
          Set object location and size for icon and label object as it is created.
protected  void setOptionMenuTextColor()
           
protected  void setOptionMenuTrackColor()
           
 void setScroll(int state)
           
 boolean setShowAlignmentMenu(JPopupMenu popup)
          Offer actions to align the selected Positionable items either Horizontally (at avearage y coord) or Vertically (at avearage x coord).
 void setShowHelpBar(boolean state)
           
 void setSideTrackWidth(int w)
           
 void setSize(int w, int h)
           
 void setSnapOnAdd(boolean state)
           
 void setSnapOnMove(boolean state)
           
 void setTooltipsInEdit(boolean state)
           
 void setTooltipsNotEdit(boolean state)
           
protected  void setTrackStrokeWidth(Graphics2D g2, boolean need)
           
 void setTurnoutAnimation(boolean state)
          Control whether target panel items are controlling layout items.
 void setTurnoutBX(double bx)
           
 void setTurnoutCircles(boolean state)
           
 void setTurnoutCX(double cx)
           
 void setTurnoutWid(double wid)
           
protected  JMenu setupOptionMenu(JMenuBar menuBar)
           
 void setXOverHWid(double hwid)
           
 void setXOverLong(double lg)
           
 void setXOverShort(double sh)
           
 void setXScale(double xSc)
           
 void setYScale(double ySc)
           
protected  boolean showAlignPopup()
           
protected  boolean showAlignPopup(Positionable l)
           
protected  void showPopUp(Positionable p, MouseEvent event)
          Select the menu items to display for the Positionable's popup
 void showToolTip(Positionable selection, MouseEvent event)
          Mouse Methods
static Color stringToColor(String string)
           
protected  void targetWindowClosingEvent(WindowEvent e)
          The target window has been requested to close, don't delete it at this time.
 boolean validatePhysicalTurnout(String turnoutName, Component openPane)
          Validates that a physical turnout exists and is unique among Layout Turnouts Returns true if valid turnout was entered, false otherwise
 boolean validateSensor(String sensorName, LayoutBlock blk, Component openFrame)
          Validates that the supplied occupancy sensor name corresponds to an existing sensor and is unique among all blocks.
 
Methods inherited from class jmri.jmrit.display.panelEditor.PanelEditor
addColorMenuEntry, addItemPopUp, backgroundPopUp, copyItem, itemStateChanged, makeColorMenu, makeFrame, mouseEntered, mouseExited, pasteItem, pasteItemPopUp, setBackgroundMenu, setColorButton, setRemoveMenu, showAddItemPopUp, showMultiSelectPopUp, windowClosing
 
Methods inherited from class jmri.jmrit.display.Editor
actionPerformed, addBackgroundEditor, addClock, addIconEditor, addLabel, addLeftTOEditor, addLight, addLightEditor, addMemoryEditor, addMemoryInputBox, addMemorySpinner, addMultiSensor, addMultiSensorEditor, addReporter, addReporterEditor, addRightTOEditor, addRpsReporter, addSensorEditor, addSignalHeadEditor, addSignalMastEditor, addSlipTOEditor, addTextEditor, addToTarget, addTrainIcon, addTreeToEditors, addTurnout, alignGroup, allControlling, allPositionable, changeView, clearBackgroundColor, displayLevelChange, dispose, disposeLoadData, drawSelectRect, getAnchorX, getAnchorY, getBackgroundColor, getContents, getFlag, getIconEditor, getIconEditors, getIconFrame, getItemX, getItemY, getPaintScale, getPanelScrollPane, getScrollable, getSelectedItems, getSignalHeadEditor, getTargetFrame, getTargetPanel, getTargetPanelSize, isEditable, keyReleased, keyTyped, loadFailed, loadFailed, loadOK, locoMarkerFromInput, locoMarkerFromRoster, makeAddIconFrame, makePalette, makeSelectionGroup, modifySelectionGroup, moveItem, putIcon, putMemory, putSensor, putSignalHead, putSignalMast, removeFromTarget, removeSelections, selectLoco, setAllControlling, setAllShowTooltip, setAttributes, setBackgroundColor, setDefaultToolTip, setDisplayLevelMenu, setGlobalSetsLocalFlag, setHiddenMenu, setPaintScale, setPanelMenu, setPositionableMenu, setScroll, setSelectionsAttributes, setSelectionsHidden, setSelectionsPositionable, setSelectionsRotation, setSelectionsScale, setShowAlignmentMenu, setShowCoordinatesMenu, setShowHidden, setShowTooltipMenu, setTargetPanel, setTargetPanelSize, setTextAttributes, setTitle, setToolTip, setUpBackground, setUseGlobalFlag, showHidden, showTooltip, targetWindowClosing, 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, 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, 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

NONE

public static final int NONE
See Also:
Constant Field Values

POS_POINT

public static final int POS_POINT
See Also:
Constant Field Values

TURNOUT_A

public static final int TURNOUT_A
See Also:
Constant Field Values

TURNOUT_B

public static final int TURNOUT_B
See Also:
Constant Field Values

TURNOUT_C

public static final int TURNOUT_C
See Also:
Constant Field Values

TURNOUT_D

public static final int TURNOUT_D
See Also:
Constant Field Values

LEVEL_XING_A

public static final int LEVEL_XING_A
See Also:
Constant Field Values

LEVEL_XING_B

public static final int LEVEL_XING_B
See Also:
Constant Field Values

LEVEL_XING_C

public static final int LEVEL_XING_C
See Also:
Constant Field Values

LEVEL_XING_D

public static final int LEVEL_XING_D
See Also:
Constant Field Values

TRACK

public static final int TRACK
See Also:
Constant Field Values

TURNOUT_CENTER

public static final int TURNOUT_CENTER
See Also:
Constant Field Values

LEVEL_XING_CENTER

public static final int LEVEL_XING_CENTER
See Also:
Constant Field Values

TURNTABLE_CENTER

public static final int TURNTABLE_CENTER
See Also:
Constant Field Values

LAYOUT_POS_LABEL

public static final int LAYOUT_POS_LABEL
See Also:
Constant Field Values

LAYOUT_POS_JCOMP

public static final int LAYOUT_POS_JCOMP
See Also:
Constant Field Values

MULTI_SENSOR

public static final int MULTI_SENSOR
See Also:
Constant Field Values

MARKER

public static final int MARKER
See Also:
Constant Field Values

TRACK_CIRCLE_CENTRE

public static final int TRACK_CIRCLE_CENTRE
See Also:
Constant Field Values

TURNTABLE_RAY_OFFSET

public static final int TURNTABLE_RAY_OFFSET
See Also:
Constant Field Values

skipIncludedTurnout

protected boolean skipIncludedTurnout

backgroundImage

public ArrayList<PositionableLabel> backgroundImage

sensorImage

public ArrayList<SensorIcon> sensorImage

signalHeadImage

public ArrayList<SignalHeadIcon> signalHeadImage

signalMastImage

public ArrayList<SignalMastIcon> signalMastImage

markerImage

public ArrayList<LocoIcon> markerImage

labelImage

public ArrayList<PositionableLabel> labelImage

clocks

public ArrayList<AnalogClock2Display> clocks

multiSensors

public ArrayList<MultiSensorIcon> multiSensors

auxTools

public LayoutEditorAuxTools auxTools

sensorIconEditor

public MultiIconEditor sensorIconEditor

sensorFrame

public JFrame sensorFrame

signalIconEditor

public MultiIconEditor signalIconEditor

signalFrame

public JFrame signalFrame

turnoutList

public ArrayList<LayoutTurnout> turnoutList

trackList

public ArrayList<TrackSegment> trackList

pointList

public ArrayList<PositionablePoint> pointList

xingList

public ArrayList<LevelXing> xingList

turntableList

public ArrayList<LayoutTurntable> turntableList

signalList

public ArrayList<SignalHeadIcon> signalList

memoryLabelList

public ArrayList<MemoryIcon> memoryLabelList

sensorList

public ArrayList<SensorIcon> sensorList

signalMastList

public ArrayList<SignalMastIcon> signalMastList
Constructor Detail

LayoutEditor

public LayoutEditor()

LayoutEditor

public LayoutEditor(String name)
Method Detail

init

protected void init(String name)
Overrides:
init in class PanelEditor

initView

public void initView()
Description copied from class: PanelEditor
After construction, initialize all the widgets to their saved config settings.

Overrides:
initView in class PanelEditor

setSize

public void setSize(int w,
                    int h)
Overrides:
setSize in class Window

targetWindowClosingEvent

protected void targetWindowClosingEvent(WindowEvent e)
Description copied from class: PanelEditor
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.

Overrides:
targetWindowClosingEvent in class PanelEditor

setupOptionMenu

protected JMenu setupOptionMenu(JMenuBar menuBar)

removeMarkers

protected void removeMarkers()
Remove marker icons from panel

Overrides:
removeMarkers in class Editor

enterTrackWidth

protected void enterTrackWidth()

enterReporter

protected void enterReporter(int defaultX,
                             int defaultY)

scaleTrackDiagram

protected void scaleTrackDiagram()

moveSelection

protected void moveSelection()

setCurrentPositionAndSize

public void setCurrentPositionAndSize()

setOptionMenuTrackColor

protected void setOptionMenuTrackColor()

setOptionMenuTextColor

protected void setOptionMenuTextColor()

setScroll

public void setScroll(int state)
Overrides:
setScroll in class Editor

addTurntable

public void addTurntable(Point2D pt)
Add a layout turntable at location specified


redrawPanel

public void redrawPanel()
Allow external trigger of re-draw


setAwaitingIconChange

public void setAwaitingIconChange()
Allow external set/reset of awaitingIconChange


resetAwaitingIconChange

public void resetAwaitingIconChange()

resetDirty

public void resetDirty()
Allow external reset of dirty bit


setDirty

public void setDirty(boolean val)
Allow external set of dirty bit


setDirty

public void setDirty()

isDirty

public boolean isDirty()
Check the dirty state


mousePressed

public void mousePressed(MouseEvent event)
Handle a mouse pressed event

Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class PanelEditor

getEndCoords

public Point2D getEndCoords(Object o,
                            int type)

mouseReleased

public void mouseReleased(MouseEvent event)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class PanelEditor

showPopUp

protected void showPopUp(Positionable p,
                         MouseEvent event)
Select the menu items to display for the Positionable's popup

Overrides:
showPopUp in class PanelEditor

mouseClicked

public void mouseClicked(MouseEvent event)
Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class PanelEditor

alignSelection

public void alignSelection(boolean alignX)

showAlignPopup

protected boolean showAlignPopup()

setShowAlignmentMenu

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


keyPressed

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

mouseMoved

public void mouseMoved(MouseEvent event)
Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class PanelEditor

mouseDragged

public void mouseDragged(MouseEvent event)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class PanelEditor

setLoc

public void setLoc(int x,
                   int y)

addAnchor

public void addAnchor()
Add an Anchor point.


addEndBumper

public void addEndBumper()
Add an End Bumper point.


addTrackSegment

public void addTrackSegment()
Add a Track Segment


addLevelXing

public void addLevelXing()
Add a Level Crossing


addLayoutTurnout

public void addLayoutTurnout(int type)
Add a Layout Turnout


validatePhysicalTurnout

public boolean validatePhysicalTurnout(String turnoutName,
                                       Component openPane)
Validates that a physical turnout exists and is unique among Layout Turnouts Returns true if valid turnout was entered, false otherwise


provideLayoutBlock

public LayoutBlock provideLayoutBlock(String s)
Return a layout block with the entered name, creating a new one if needed. Note that the entered name becomes the user name of the LayoutBlock, and a system name is automatically created by LayoutBlockManager if needed.


validateSensor

public boolean validateSensor(String sensorName,
                              LayoutBlock blk,
                              Component openFrame)
Validates that the supplied occupancy sensor name corresponds to an existing sensor and is unique among all blocks. If valid, returns true and sets the block sensor name in the block. Else returns false, and does nothing to the block.


getLayoutBlock

public LayoutBlock getLayoutBlock(String blockID)
Return a layout block with the given name if one exists. Registers this LayoutEditor with the layout block. This method is designed to be used when a panel is loaded. The calling method must handle whether the use count should be incremented.


remove

protected boolean remove(Object s)
Remove object from all Layout Editor temmporary lists of items not part of track schematic


removeFromContents

public boolean removeFromContents(Positionable l)
Overrides:
removeFromContents in class Editor

removePositionablePoint

protected boolean removePositionablePoint(PositionablePoint o)
Remove a PositionablePoint -- an Anchor or an End Bumper.


removeLayoutTurnout

protected boolean removeLayoutTurnout(LayoutTurnout o)
Remove a LayoutTurnout


removeLevelXing

protected boolean removeLevelXing(LevelXing o)
Remove a Level Crossing


removeTurntable

protected boolean removeTurntable(LayoutTurntable o)
Remove a Layout Turntable


removeTrackSegment

protected void removeTrackSegment(TrackSegment o)
Remove a Track Segment


getAffectedBlock

public LayoutBlock getAffectedBlock(Object o,
                                    int type)

putSensor

public void putSensor(SensorIcon l)

putSignal

public void putSignal(SignalHeadIcon l)

putSignalMast

public void putSignalMast(SignalMastIcon l)

putItem

public void putItem(Positionable l)
Overrides:
putItem in class PanelEditor

addLocoIcon

public LocoIcon addLocoIcon(String name)
Add a loco marker to the target

Overrides:
addLocoIcon in class Editor

putLocoIcon

public void putLocoIcon(LocoIcon l,
                        String name)
Overrides:
putLocoIcon in class Editor

addBackground

public void addBackground()
Add a background image


removeBackground

protected void removeBackground(PositionableLabel b)
Remove a background image from the list of background images


addMultiSensor

public void addMultiSensor(MultiSensorIcon l)

setNextLocation

protected void setNextLocation(Positionable obj)
Set object location and size for icon and label object as it is created. Size comes from the preferredSize; location comes from the fields where the user can spec it.

Overrides:
setNextLocation in class PanelEditor

getConnectivityUtil

public ConnectivityUtil getConnectivityUtil()

getLETools

public LayoutEditorTools getLETools()

deletePanel

public boolean deletePanel()
Invoked by DeletePanel menu item Validate user intent before deleting

Overrides:
deletePanel in class Editor

setAllEditable

public void setAllEditable(boolean editable)
Control whether target panel items are editable. Does this by invoke the Editor.setAllEditable(boolean) function of the parent class. This also controls the relevant pop-up menu items (which are the primary way that items are edited).

Overrides:
setAllEditable in class Editor
Parameters:
editable - true for editable.

setAllPositionable

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

Overrides:
setAllPositionable in class Editor
Parameters:
state - true for positionable.

setTurnoutAnimation

public void setTurnoutAnimation(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.

isAnimating

public boolean isAnimating()

getLayoutWidth

public int getLayoutWidth()

getLayoutHeight

public int getLayoutHeight()

getWindowWidth

public int getWindowWidth()

getWindowHeight

public int getWindowHeight()

getUpperLeftX

public int getUpperLeftX()

getUpperLeftY

public int getUpperLeftY()

getScroll

public boolean getScroll()

getMainlineTrackWidth

public int getMainlineTrackWidth()

getSideTrackWidth

public int getSideTrackWidth()

getXScale

public double getXScale()

getYScale

public double getYScale()

getDefaultTrackColor

public String getDefaultTrackColor()

getDefaultTextColor

public String getDefaultTextColor()

getLayoutName

public String getLayoutName()

getShowHelpBar

public boolean getShowHelpBar()

getDrawGrid

public boolean getDrawGrid()

getSnapOnAdd

public boolean getSnapOnAdd()

getSnapOnMove

public boolean getSnapOnMove()

getAntialiasingOn

public boolean getAntialiasingOn()

getTurnoutCircles

public boolean getTurnoutCircles()

getTooltipsNotEdit

public boolean getTooltipsNotEdit()

getTooltipsInEdit

public boolean getTooltipsInEdit()

setLayoutDimensions

public void setLayoutDimensions(int windowW,
                                int windowH,
                                int x,
                                int y,
                                int panelW,
                                int panelH)

setMainlineTrackWidth

public void setMainlineTrackWidth(int w)

setSideTrackWidth

public void setSideTrackWidth(int w)

setDefaultTrackColor

public void setDefaultTrackColor(String color)

setDefaultTextColor

public void setDefaultTextColor(String color)

setXScale

public void setXScale(double xSc)

setYScale

public void setYScale(double ySc)

setLayoutName

public void setLayoutName(String name)

setShowHelpBar

public void setShowHelpBar(boolean state)

setDrawGrid

public void setDrawGrid(boolean state)

setSnapOnAdd

public void setSnapOnAdd(boolean state)

setSnapOnMove

public void setSnapOnMove(boolean state)

setAntialiasingOn

public void setAntialiasingOn(boolean state)

setTurnoutCircles

public void setTurnoutCircles(boolean state)

setTooltipsNotEdit

public void setTooltipsNotEdit(boolean state)

setTooltipsInEdit

public void setTooltipsInEdit(boolean state)

setTurnoutBX

public void setTurnoutBX(double bx)

getTurnoutBX

public double getTurnoutBX()

setTurnoutCX

public void setTurnoutCX(double cx)

getTurnoutCX

public double getTurnoutCX()

setTurnoutWid

public void setTurnoutWid(double wid)

getTurnoutWid

public double getTurnoutWid()

setXOverLong

public void setXOverLong(double lg)

getXOverLong

public double getXOverLong()

setXOverHWid

public void setXOverHWid(double hwid)

getXOverHWid

public double getXOverHWid()

setXOverShort

public void setXOverShort(double sh)

getXOverShort

public double getXOverShort()

setConnections

public void setConnections()

colorToString

public static String colorToString(Color color)

stringToColor

public static Color stringToColor(String string)

findTrackSegmentByName

public TrackSegment findTrackSegmentByName(String name)

findPositionablePointByName

public PositionablePoint findPositionablePointByName(String name)

findPositionablePointAtTrackSegments

public PositionablePoint findPositionablePointAtTrackSegments(TrackSegment tr1,
                                                              TrackSegment tr2)

findTrackSegmentByBlock

public ArrayList<TrackSegment> findTrackSegmentByBlock(String name)
Returns an array list of track segments matching the block name.


findPositionablePointByEastBoundSignal

public PositionablePoint findPositionablePointByEastBoundSignal(String signalName)

findPositionablePointByWestBoundSignal

public PositionablePoint findPositionablePointByWestBoundSignal(String signalName)

findPositionablePointByEastBoundSignalMast

public PositionablePoint findPositionablePointByEastBoundSignalMast(String signalMastName)

findPositionablePointByWestBoundSignalMast

public PositionablePoint findPositionablePointByWestBoundSignalMast(String signalMastName)

findLayoutTurnoutBySignalMast

public LayoutTurnout findLayoutTurnoutBySignalMast(String signalMastName)

findLayoutTurnoutBySensor

public LayoutTurnout findLayoutTurnoutBySensor(String sensorName)

findLevelXingBySignalMast

public LevelXing findLevelXingBySignalMast(String signalMastName)

findLevelXingBySensor

public LevelXing findLevelXingBySensor(String sensorName)

findPositionablePointByEastBoundSensor

public PositionablePoint findPositionablePointByEastBoundSensor(String sensorName)

findPositionablePointByWestBoundSensor

public PositionablePoint findPositionablePointByWestBoundSensor(String sensorName)

findLayoutTurnoutByName

public LayoutTurnout findLayoutTurnoutByName(String name)

findLevelXingByName

public LevelXing findLevelXingByName(String name)

findLayoutTurntableByName

public LayoutTurntable findLayoutTurntableByName(String name)

findObjectByTypeAndName

public Object findObjectByTypeAndName(int type,
                                      String name)

paintTargetPanel

protected void paintTargetPanel(Graphics g)
Special internal class to allow drawing of layout to a JLayeredPane This is the 'target' pane where the layout is displayed

Overrides:
paintTargetPanel in class PanelEditor

setTrackStrokeWidth

protected void setTrackStrokeWidth(Graphics2D g2,
                                   boolean need)

drawTurnouts

protected void drawTurnouts(Graphics2D g2)

getCoords

protected Point2D getCoords(Object o,
                            int type)

showAlignPopup

protected boolean showAlignPopup(Positionable l)
Overrides:
showAlignPopup in class Editor

showToolTip

public void showToolTip(Positionable selection,
                        MouseEvent event)
Description copied from class: Editor
Mouse Methods

Overrides:
showToolTip in class Editor


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