Class LayoutEditor
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- jmri.util.JmriJFrame
-
- jmri.jmrit.display.JmriJFrameWithPermissions
-
- jmri.jmrit.display.Editor
-
- jmri.jmrit.display.panelEditor.PanelEditor
-
- jmri.jmrit.display.layoutEditor.LayoutEditor
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.ComponentListener
,java.awt.event.ItemListener
,java.awt.event.KeyListener
,java.awt.event.MouseWheelListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.beans.VetoableChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
,BeanInterface
,LayoutModels
,ModifiedFlag
,JmriMouseListener
,JmriMouseMotionListener
,WindowInterface
public final class LayoutEditor extends PanelEditor implements java.awt.event.MouseWheelListener, LayoutModels
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, LayoutSlip 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 target frame 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.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
LayoutEditor.TurnoutComboBoxPopupMenuListener
-
Nested classes/interfaces inherited from class jmri.jmrit.display.Editor
Editor.JFrameItem, Editor.TargetPane, Editor.UrlErrorDialog
-
Nested classes/interfaces inherited from class jmri.util.JmriJFrame
JmriJFrame.ScreenDimensions
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from interface jmri.util.swing.WindowInterface
WindowInterface.Hint
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<LayoutShape>
_layoutShapeSelection
java.util.List<LayoutTrack>
_layoutTrackSelection
java.util.List<Positionable>
_positionableSelection
(package private) int
_prevNumSel
java.awt.geom.Point2D
beginLocation
LayoutTrack
beginTrack
double
circleDiameter
double
circleRadius
java.awt.geom.Point2D
currentLocation
java.awt.Color
defaultTrackColor
HitPointType
foundHitPointType
LayoutTrack
foundTrack
LayoutTrackView
foundTrackView
LayoutEditorViewContext
gContext
(package private) boolean
openDispatcherOnLoad
java.lang.Object
prevSelectedObject
java.lang.Object
selectedObject
boolean
selectionActive
double
selectionHeight
double
selectionWidth
static double
SIZE
static double
SIZE2
java.awt.Color
turnoutCircleColor
java.awt.Color
turnoutCircleThrownColor
(package private) java.util.List<NamedBeanUsageReport>
usageReport
-
Fields inherited from class jmri.jmrit.display.panelEditor.PanelEditor
_multiItemCopyGroup, addItemViaMouseClick, pasteItemFlag
-
Fields inherited from class jmri.jmrit.display.Editor
_anchorX, _anchorY, _currentSelection, _dragging, _editable, _highlightcomponent, _iconEditorFrame, _lastX, _lastY, _paintScale, _pastePending, _scrollState, _selectionGroup, _selectRect, _targetPanel, BKG, BOTHPOPUPS, CLOCK, defaultBackgroundColor, EDITPOPUPONLY, frameLocationX, frameLocationY, HIGHLIGHT_COLOR, 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, VIEWPOPUPONLY, xLoc, yLoc
-
Fields inherited from class jmri.util.JmriJFrame
allowInFrameServlet, properties, reuseFrameSavedPosition, reuseFrameSavedSized, windowInterface
-
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
-
-
Constructor Summary
Constructors Constructor Description LayoutEditor()
LayoutEditor(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnchor()
Add an Anchor point.PositionablePoint
addAnchor(java.awt.geom.Point2D p)
(package private) void
addAudioIcon()
Add a LogixNG icon to the targetvoid
addBackground()
Add a background image(package private) void
addBlockContents()
void
addEdgeConnector()
Add an Edge Connector point.void
addEndBumper()
Add an End Bumper point.(package private) void
addGlobalVariable()
(package private) void
addIcon()
Add an icon to the target(package private) void
addLabel()
Add a label to the Draw Panelvoid
addLayoutSlip(LayoutTurnout.TurnoutType type)
Add a LayoutSlipvoid
addLayoutTrack(LayoutTrack trk, LayoutTrackView v)
Add a LayoutTrack and LayoutTrackView to the list of LayoutTrack family objects.void
addLayoutTurnout(LayoutTurnout.TurnoutType type)
Add a Layout Turnoutvoid
addLevelXing()
Add a Level CrossingLocoIcon
addLocoIcon(java.lang.String name)
Add a loco marker to the target(package private) void
addLogixNGIcon()
Add a LogixNG icon to the target(package private) void
addMemory()
Add a memory label to the Draw Panelvoid
addMultiSensor(MultiSensorIcon l)
void
addPopupItems(javax.swing.JPopupMenu popup, JmriMouseEvent event)
void
addReporter(Reporter reporter, int xx, int yy)
Add a Reporter Icon to the panel.(package private) void
addSensor()
Add a sensor indicator to the Draw Panel(package private) void
addSignalHead()
Add a signal head to the Panel(package private) void
addSignalMast()
void
addToPopUpMenu(NamedBean nb, javax.swing.JMenuItem item, int menu)
Provide a method for external code to add items to context menus.void
addTrackSegment()
Add a Track Segmentvoid
addTurntable(java.awt.geom.Point2D pt)
Add a layout turntable at location specifiedvoid
alignLayoutToGrid()
align the layout to gridvoid
alignSelection(boolean alignX)
void
alignSelectionToGrid()
align selection to gridvoid
amendSelectionGroup(LayoutShape ls)
void
amendSelectionGroup(LayoutTrack p)
boolean
canDeletePanel()
Check for conditions that prevent a delete.void
clearSelectionGroups()
int
computeDirection(LayoutTrack trk1, HitPointType h1, LayoutTrack trk2, HitPointType h2)
Compute octagonal direction of vector from p1 to p2.int
computeDirectionFromCenter(PositionablePoint p, LayoutTrack trk1, HitPointType h1)
int
computeDirectionToCenter(LayoutTrack trk1, HitPointType h1, PositionablePoint p)
boolean
containsSignalHead(SignalHead head)
boolean
containsSignalMast(SignalMast mast)
boolean
deletePanel()
Invoked by DeletePanel menu item Validate user intent before deletingvoid
dispose()
Dispose of the editor.(package private) void
findPositionalUsage(NamedBean bean)
(package private) void
findSegmentWhereUsed(NamedBean bean)
(package private) void
findTurnoutUsage(NamedBean bean)
(package private) void
findXingWhereUsed(NamedBean bean)
LayoutBlock
getAffectedBlock(LayoutTrack track, HitPointType type)
Depending on the given type, and the real class of the given LayoutTrack, determine the connected LayoutTrack.boolean
getAntialiasingOn()
boolean
getAutoBlockAssignment()
java.util.List<BlockContentsIcon>
getBlockContentsLabelList()
ConnectivityUtil
getConnectivityUtil()
java.awt.geom.Point2D
getCoords(LayoutTrack trk, HitPointType connectionType)
Get the coordinates for the connection type of the specified LayoutTrack or subtype.java.awt.geom.Point2D
getCoords(LayoutTrackView trkv, HitPointType connectionType)
Get the coordinates for the connection type of the specified LayoutTrackView or subtype.java.lang.String
getDefaultAlternativeTrackColor()
java.awt.Color
getDefaultAlternativeTrackColorColor()
Getter defaultAlternativeTrackColor.java.lang.String
getDefaultOccupiedTrackColor()
java.awt.Color
getDefaultOccupiedTrackColorColor()
Getter defaultOccupiedTrackColor.java.lang.String
getDefaultTextColor()
java.lang.String
getDefaultTrackColor()
java.awt.Color
getDefaultTrackColorColor()
Getter defaultTrackColor.boolean
getDirectTurnoutControl()
boolean
getDrawGrid()
LayoutEditorFindItems
getFinder()
java.util.List<GlobalVariableIcon>
getGlobalVariableLabelList()
boolean
getHighlightSelectedBlock()
java.util.List<PositionableLabel>
getLabelImageList()
LayoutBlock
getLayoutBlock(java.lang.String blockID)
Return a layout block with the given name if one exists.LayoutEditorToolBarPanel
getLayoutEditorToolBarPanel()
java.lang.String
getLayoutName()
java.util.List<LayoutShape>
getLayoutShapes()
java.util.List<LayoutShape>
getLayoutShapeSelection()
java.util.List<LayoutSlip>
getLayoutSlips()
LayoutSlipView
getLayoutSlipView(LayoutSlip to)
java.util.List<LayoutSlipView>
getLayoutSlipViews()
LayoutTrackDrawingOptions
getLayoutTrackDrawingOptions()
Getter Layout Track Drawing Options. since 4.15.6 split variable defaultTrackColor and mainlineTrackColor/sidelineTrackColor
blockDefaultColor, blockOccupiedColor and blockAlternativeColor added to LayoutTrackDrawingOptionsjava.util.List<LayoutTrack>
getLayoutTracks()
Read-only access to the list of LayoutTrack family objects.java.util.List<LayoutTrack>
getLayoutTrackSelection()
java.util.stream.Stream<LayoutTrack>
getLayoutTracksOfClass(java.lang.Class<? extends LayoutTrack> layoutTrackClass)
LayoutTrackView
getLayoutTrackView(LayoutTrack trk)
java.util.List<LayoutTrackView>
getLayoutTrackViews()
Read-only access to the list of LayoutTrackView family objects.java.util.stream.Stream<LayoutTrackView>
getLayoutTrackViewsOfClass(java.lang.Class<? extends LayoutTrackView> layoutTrackViewClass)
java.util.List<LayoutTurnoutView>
getLayoutTurnoutAndSlipViews()
java.util.List<LayoutTurnout>
getLayoutTurnouts()
java.util.List<LayoutTurnout>
getLayoutTurnoutsAndSlips()
LayoutTurnoutView
getLayoutTurnoutView(LayoutTurnout to)
java.util.List<LayoutTurnoutView>
getLayoutTurnoutViews()
java.util.List<LayoutTurntable>
getLayoutTurntables()
LayoutTurntableView
getLayoutTurntableView(LayoutTurntable to)
java.util.List<LayoutTurntableView>
getLayoutTurntableViews()
LayoutEditorAuxTools
getLEAuxTools()
LayoutEditorChecks
getLEChecks()
LayoutEditorTools
getLETools()
java.util.List<LevelXing>
getLevelXings()
LevelXingView
getLevelXingView(LevelXing xing)
java.util.List<LevelXingView>
getLevelXingViews()
double
getMaxZoom()
getMaxZoomjava.util.List<MemoryIcon>
getMemoryLabelList()
double
getMinZoom()
getMinZoomboolean
getOpenDispatcherOnLoad()
java.awt.geom.Rectangle2D
getPanelBounds()
java.util.List<PositionablePoint>
getPositionablePoints()
PositionablePointView
getPositionablePointView(PositionablePoint to)
java.util.List<PositionablePointView>
getPositionablePointViews()
java.util.List<Positionable>
getPositionalSelection()
boolean
getScroll()
java.awt.geom.Rectangle2D
getSelectionRect()
java.util.List<SensorIcon>
getSensorList()
boolean
getShowHelpBar()
(package private) SignalHead
getSignalHead(java.lang.String name)
java.util.List<SignalHeadIcon>
getSignalList()
(package private) SignalMast
getSignalMast(java.lang.String name)
java.util.List<SignalMastIcon>
getSignalMastList()
boolean
getSnapOnAdd()
boolean
getSnapOnMove()
jmri.jmrit.display.layoutEditor.LayoutEditor.ToolBarSide
getToolBarSide()
get the toolbar sideboolean
getTooltipsInEdit()
boolean
getTooltipsNotEdit()
java.util.List<TrackSegment>
getTrackSegments()
TrackSegmentView
getTrackSegmentView(TrackSegment to)
java.util.List<TrackSegmentView>
getTrackSegmentViews()
double
getTurnoutBX()
java.lang.String
getTurnoutCircleColor()
boolean
getTurnoutCircles()
int
getTurnoutCircleSize()
java.lang.String
getTurnoutCircleThrownColor()
double
getTurnoutCX()
double
getTurnoutWid()
(package private) java.lang.String
getUsageData(LayoutTrack track)
java.util.List<NamedBeanUsageReport>
getUsageReport(NamedBean bean)
double
getXOverHWid()
double
getXOverLong()
double
getXOverShort()
double
getZoom()
getZoomboolean
highlightBlock(Block inBlock)
highlight the specified blockboolean
highlightBlockInComboBox(NamedBeanComboBox<Block> inComboBox)
boolean
highlightLayoutBlock(LayoutBlock inLayoutBlock)
highlight the specified layout blockvoid
init(java.lang.String name)
void
initView()
After construction, initialize all the widgets to their saved config settings.boolean
isAnimating()
boolean
isDirty()
Check the dirty state.boolean
isDrawLayoutTracksLabel()
boolean
isIncludedTurnoutSkipped()
(package private) boolean
isLBLockUsed(NamedBean bean, LayoutBlock lblock)
boolean
isTurnoutDrawUnselectedLeg()
boolean
isTurnoutFillControlCircles()
(package private) boolean
isUsedInXing(NamedBean bean, LevelXing xing, LevelXing.Geometry point)
void
keyPressed(java.awt.event.KeyEvent event)
java.awt.geom.Rectangle2D
layoutEditorControlCircleRectAt(java.awt.geom.Point2D inPoint)
java.awt.geom.Rectangle2D
layoutEditorControlRectAt(java.awt.geom.Point2D inPoint)
void
mouseClicked(JmriMouseEvent event)
Invoked when the mouse button has been clicked (pressed and released) on a component.void
mouseDragged(JmriMouseEvent event)
Invoked when a mouse button is pressed on a component and then dragged.void
mouseEntered(JmriMouseEvent event)
Invoked when the mouse enters a component.void
mouseMoved(JmriMouseEvent event)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.void
mousePressed(JmriMouseEvent event)
Handle a mouse pressed eventvoid
mouseReleased(JmriMouseEvent event)
Invoked when a mouse button has been released on a component.void
mouseWheelMoved(java.awt.event.MouseWheelEvent event)
void
newPanelDefaults()
Set white as the default background color for panels created using the New Panel menu item.LayoutEditor.TurnoutComboBoxPopupMenuListener
newTurnoutComboBoxPopupMenuListener(NamedBeanComboBox<Turnout> comboBox)
Create a listener that will exclude turnouts that are present in the current panel.LayoutEditor.TurnoutComboBoxPopupMenuListener
newTurnoutComboBoxPopupMenuListener(NamedBeanComboBox<Turnout> comboBox, java.util.List<Turnout> currentTurnouts)
Create a listener that will exclude turnouts that are present in the current panel.void
paintTargetPanel(java.awt.Graphics g)
Special internal class to allow drawing of layout to a JLayeredPane This is the 'target' pane where the layout is displayedLayoutBlock
provideLayoutBlock(java.lang.String inBlockName)
Return a layout block with the entered name, creating a new one if needed.void
putItem(Positionable l)
void
putLocoIcon(LocoIcon l, java.lang.String name)
void
putSensor(SensorIcon l)
void
putSignal(SignalHeadIcon l)
void
putSignalMast(SignalMastIcon l)
void
redrawPanel()
Allow external trigger of re-drawHiddenboolean
removeFromContents(Positionable l)
boolean
removeLayoutShape(LayoutShape s)
Remove a layout shape from the list of layout shapesboolean
removeLayoutSlip(LayoutTurnout o)
Remove a slipvoid
removeLayoutTrack(LayoutTrack trk)
If item present, delete from the list of LayoutTracks and force a dirty redraw.boolean
removeLayoutTrackAndRedraw(LayoutTrack trk)
If item present, delete from the list of LayoutTracks and force a dirty redraw.boolean
removeLayoutTurnout(LayoutTurnout o)
Remove a LayoutTurnoutboolean
removeLevelXing(LevelXing o)
Remove a Level Crossingvoid
removeMarkers()
Remove marker icons from panelboolean
removePositionablePoint(PositionablePoint o)
Remove a PositionablePoint -- an Anchor or an End Bumper.void
removeSignalHead(SignalHead head)
void
removeTrackSegment(TrackSegment o)
Remove a Track Segmentboolean
removeTurntable(LayoutTurntable o)
Remove a Layout Turntablevoid
resetAwaitingIconChange()
void
resetDirty()
Allow external reset of dirty bitvoid
rotateLayout90()
Rotate the entire layout by 90 degrees clockwise.void
rotateSelection90()
Rotate selection by 90 degrees clockwise.boolean
scaleTrack(float xFactor, float yFactor)
scale all LayoutTracks coordinates by the x and y factors.void
scrollBarAdjusted(java.awt.event.AdjustmentEvent event)
void
setAllEditable(boolean editable)
Control whether target panel items are editable.void
setAllPositionable(boolean state)
Control whether panel items are positionable.void
setAllShowLayoutTurnoutToolTip(boolean state)
int
setAllTracksToDefaultColors()
loop through all LayoutBlocks and set colors to the default colors from this LayoutEditorvoid
setAntialiasingOn(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setAutoBlockAssignment(boolean boo)
void
setAwaitingIconChange()
Allow external set/reset of awaitingIconChangevoid
setConnections()
void
setCurrentPositionAndSize()
void
setDefaultAlternativeTrackColor(java.awt.Color color)
void
setDefaultBackgroundColor(java.awt.Color color)
void
setDefaultOccupiedTrackColor(java.awt.Color color)
void
setDefaultTextColor(java.awt.Color color)
void
setDefaultTrackColor(java.awt.Color color)
void
setDirectTurnoutControl(boolean boo)
void
setDirty()
void
setDirty(boolean val)
Allow external set of dirty bitvoid
setDrawGrid(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setDrawLayoutTracksLabel(boolean state)
void
setHighlightSelectedBlock(boolean state)
void
setIncludedTurnoutSkipped(java.lang.Boolean boo)
void
setLayoutDimensions(int windowWidth, int windowHeight, int windowX, int windowY, int panelWidth, int panelHeight)
void
setLayoutDimensions(int windowWidth, int windowHeight, int windowX, int windowY, int panelWidth, int panelHeight, boolean merge)
void
setLayoutName(java.lang.String name)
void
setLayoutTrackDrawingOptions(LayoutTrackDrawingOptions ltdo)
since 4.15.6 split variable defaultTrackColor and mainlineTrackColor/sidelineTrackColorvoid
setLink(LayoutTrack fromObject, HitPointType fromPointType, LayoutTrack toObject, HitPointType toPointType)
link the 'from' object and type to the 'to' object and typevoid
setNextLocation(Positionable obj)
Set object location and size for icon and label object as it is created.void
setOpenDispatcherOnLoad(java.lang.Boolean boo)
void
setPanelBounds(java.awt.geom.Rectangle2D newBounds)
void
setScroll(int state)
void
setScroll(java.lang.String value)
The LE xml load uses the string version of setScroll which went directly to Editor.void
setSelectionRect(java.awt.geom.Rectangle2D selectionRect)
void
setSelectRect(java.awt.Rectangle rectangle)
boolean
setShowAlignmentMenu(javax.swing.JPopupMenu popup)
Offer actions to align the selected Positionable items either Horizontally (at average y coord) or Vertically (at average x coord).void
setShowHelpBar(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setSize(int w, int h)
void
setSnapOnAdd(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setSnapOnMove(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setToolBarSide(jmri.jmrit.display.layoutEditor.LayoutEditor.ToolBarSide newToolBarSide)
set the tool bar sidevoid
setTooltipsInEdit(boolean state)
void
setTooltipsNotEdit(boolean state)
void
setTurnoutAnimation(boolean state)
Control whether target panel items are controlling layout items.void
setTurnoutBX(double bx)
void
setTurnoutCircleColor(java.awt.Color color)
void
setTurnoutCircles(boolean state)
void
setTurnoutCircleSize(int size)
void
setTurnoutCircleThrownColor(java.awt.Color color)
void
setTurnoutCX(double cx)
void
setTurnoutDrawUnselectedLeg(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setTurnoutFillControlCircles(boolean state)
Should only be invoked on the GUI (Swing) thread.void
setTurnoutWid(double wid)
static void
setupComboBox(NamedBeanComboBox<?> inComboBox, boolean inValidateMode, boolean inEnable, boolean inEditable)
Set up NamedBeanComboBoxvoid
setXOverHWid(double hwid)
void
setXOverLong(double lg)
void
setXOverShort(double sh)
double
setZoom(double zoomFactor)
Set panel Zoom factor.boolean
showAlignPopup(Positionable l)
void
showPopUp(Positionable p, JmriMouseEvent event)
Select the menu items to display for the Positionable's popup.void
showToolTip(Positionable selection, JmriMouseEvent event)
void
sortLayoutShapesByLevel()
(package private) void
startMultiSensor()
void
targetWindowClosingEvent(java.awt.event.WindowEvent e)
The target window has been requested to close, don't delete it at this time.java.lang.String
toString()
void
translate(float xTranslation, float yTranslation)
Translate entire layout by x and y amounts.boolean
translateTrack(float xDel, float yDel)
(package private) void
undoMoveSelection()
undo the move selectionjava.awt.geom.Rectangle2D
unionToPanelBounds(java.awt.geom.Rectangle2D bounds)
boolean
validatePhysicalTurnout(java.lang.String inTurnoutName, java.awt.Component inOpenPane)
Validates that a physical turnout exists and is unique among Layout Turnouts Returns true if valid turnout was entered, false otherwiseboolean
validateSensor(java.lang.String sensorName, LayoutBlock blk, java.awt.Component openFrame)
Validates that the supplied occupancy sensor name corresponds to an existing sensor and is unique among all blocks.void
vetoableChange(java.beans.PropertyChangeEvent evt)
-
Methods inherited from class jmri.jmrit.display.panelEditor.PanelEditor
addItemPopUp, backgroundPopUp, copyItem, itemStateChanged, makeFrame, mouseExited, pasteItem, pasteItemPopUp, setBackgroundMenu, setRemoveMenu, showAddItemPopUp, showMultiSelectPopUp, showPopUp, windowClosing
-
Methods inherited from class jmri.jmrit.display.Editor
actionPerformed, addAudioEditor, addBackgroundEditor, addBlockContentsEditor, addClock, addGlobalVariableEditor, addGlobalVariableInputBox, addGlobalVariableSpinner, addIconEditor, addLabel, addLeftTOEditor, addLight, addLightEditor, addLogixNGEditor, addMemoryEditor, addMemoryInputBox, addMemorySpinner, addMultiSensor, addMultiSensorEditor, addReporter, addReporterEditor, addRightTOEditor, addRpsReporter, addSensorEditor, addSignalHeadEditor, addSignalMastEditor, addSlipTOEditor, addTextEditor, addToTarget, addTrainIcon, addTurnout, allControlling, allPositionable, changeView, clearBackgroundColor, deselectSelectionGroup, displayLevelChange, disposeLoadData, dockSelections, drawSelectRect, getAnchorX, getAnchorY, getBackgroundColor, getClassNames, getContents, getFlag, getIconEditor, getIconFrame, getIdContents, getItemX, getItemY, getLastX, getLastY, getPaintScale, getPanelScrollPane, getPositionablesByClassName, getScrollable, getSelectedItems, getSelectRect, getSignalHeadEditor, getTargetFrame, getTargetPanel, getTargetPanelSize, isEditable, isPanelMenuVisible, keyReleased, keyTyped, loadFailed, loadFailed, loadOK, locoMarkerFromInput, locoMarkerFromRoster, makeAddIconFrame, makeSelectionGroup, modifySelectionGroup, moveItem, positionalAddClass, positionalIdChange, positionalRemoveClass, putAudio, putBlockContents, putGlobalVariable, putIcon, putLogixNG, putMemory, putSensor, putSignalHead, putSignalMast, removeFromTarget, removeSelections, selectLoco, selectLoco, setAllControlling, setAllShowToolTip, setAttributes, setBackgroundColor, setDefaultToolTip, setDisplayLevelMenu, setEditClassesMenu, setEditIdMenu, setEmptyHiddenMenu, setGlobalSetsLocalFlag, setHiddenMenu, setLogixNGPositionableMenu, setPaintScale, setPanelMenuVisible, setPositionableMenu, setSelectionsAttributes, setSelectionsDisplayLevel, setSelectionsDockingLocation, setSelectionsHidden, setSelectionsPositionable, setSelectionsRotation, setSelectionsScale, setShowAlignmentMenu, setShowCoordinatesMenu, setShowHidden, setShowToolTipMenu, setTargetPanel, setTargetPanelSize, setTitle, setToolTip, setUpBackground, setUseGlobalFlag, setValueEditDisabledMenu, showHidden, showToolTip, targetWindowClosing, useGlobalFlag
-
Methods inherited from class jmri.jmrit.display.JmriJFrameWithPermissions
getContentPane, getJMenuBar, revalidate, setContentPane, setJMenuBar, setKeepSize, setVisible
-
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, componentHidden, componentMoved, componentResized, componentShown, generateWindowRef, getAllowInFrameServlet, getEscapeKeyAction, getEscapeKeyClosesWindow, getFrame, getFrame, getFrameList, getFrameList, getIndexedProperty, getMaximumSize, getModifiedFlag, getPreferredSize, getProperty, getPropertyNames, getSavePosition, getSaveSize, getScreenDimensions, getWindowFrameRef, getWindowInterface, handleModified, hasIndexedProperty, hasProperty, initComponents, makePrivateWindow, markWindowModified, multipleInstances, pack, setAllowInFrameServlet, setEscapeKeyAction, setEscapeKeyClosesWindow, setFrameLocation, setIndexedProperty, setModifiedFlag, setProperty, setSavePosition, setSaveSize, setShutDownTask, setWindowInterface, show, show, storeValues, undecorate, windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.jmrit.display.layoutEditor.LayoutModels
computeDirectionAB, computeDirectionAC, computeDirectionAD, computeDirectionBC, computeDirectionBD, computeDirectionCD, displayRemoveWarning
-
-
-
-
Field Detail
-
SIZE
public static final double SIZE
- See Also:
- Constant Field Values
-
SIZE2
public static final double SIZE2
- See Also:
- Constant Field Values
-
turnoutCircleColor
public java.awt.Color turnoutCircleColor
-
turnoutCircleThrownColor
public java.awt.Color turnoutCircleThrownColor
-
circleRadius
public double circleRadius
-
circleDiameter
public double circleDiameter
-
selectionActive
public boolean selectionActive
-
selectionWidth
public double selectionWidth
-
selectionHeight
public double selectionHeight
-
selectedObject
public java.lang.Object selectedObject
-
prevSelectedObject
public java.lang.Object prevSelectedObject
-
foundTrack
public LayoutTrack foundTrack
-
foundTrackView
public LayoutTrackView foundTrackView
-
foundHitPointType
public HitPointType foundHitPointType
-
beginTrack
public LayoutTrack beginTrack
-
beginLocation
public java.awt.geom.Point2D beginLocation
-
currentLocation
public java.awt.geom.Point2D currentLocation
-
gContext
public final LayoutEditorViewContext gContext
-
defaultTrackColor
public java.awt.Color defaultTrackColor
-
openDispatcherOnLoad
boolean openDispatcherOnLoad
-
_positionableSelection
public java.util.List<Positionable> _positionableSelection
-
_layoutTrackSelection
public java.util.List<LayoutTrack> _layoutTrackSelection
-
_layoutShapeSelection
public java.util.List<LayoutShape> _layoutShapeSelection
-
_prevNumSel
int _prevNumSel
-
usageReport
java.util.List<NamedBeanUsageReport> usageReport
-
-
Constructor Detail
-
LayoutEditor
public LayoutEditor()
-
LayoutEditor
public LayoutEditor(@Nonnull java.lang.String name)
-
-
Method Detail
-
getLayoutEditorToolBarPanel
@Nonnull public LayoutEditorToolBarPanel getLayoutEditorToolBarPanel()
-
getSensorList
@Nonnull public java.util.List<SensorIcon> getSensorList()
-
getLabelImageList
@Nonnull public java.util.List<PositionableLabel> getLabelImageList()
-
getBlockContentsLabelList
@Nonnull public java.util.List<BlockContentsIcon> getBlockContentsLabelList()
-
getMemoryLabelList
@Nonnull public java.util.List<MemoryIcon> getMemoryLabelList()
-
getGlobalVariableLabelList
@Nonnull public java.util.List<GlobalVariableIcon> getGlobalVariableLabelList()
-
getSignalList
@Nonnull public java.util.List<SignalHeadIcon> getSignalList()
-
getSignalMastList
@Nonnull public java.util.List<SignalMastIcon> getSignalMastList()
-
getFinder
@Nonnull public LayoutEditorFindItems getFinder()
-
newPanelDefaults
public void newPanelDefaults()
Description copied from class:Editor
Set white as the default background color for panels created using the New Panel menu item. Overriden by LE to use a different default background color and set other initial defaults.- Overrides:
newPanelDefaults
in classEditor
-
init
public void init(java.lang.String name)
- Overrides:
init
in classPanelEditor
-
initView
public void initView()
Description copied from class:PanelEditor
After construction, initialize all the widgets to their saved config settings.- Overrides:
initView
in classPanelEditor
-
setSize
public void setSize(int w, int h)
- Overrides:
setSize
in classjava.awt.Window
-
targetWindowClosingEvent
public void targetWindowClosingEvent(java.awt.event.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 classPanelEditor
-
setupComboBox
public static void setupComboBox(@Nonnull NamedBeanComboBox<?> inComboBox, boolean inValidateMode, boolean inEnable, boolean inEditable)
Set up NamedBeanComboBox- Parameters:
inComboBox
- the NamedBeanComboBox to set upinValidateMode
- true to validate typed inputs; false otherwiseinEnable
- boolean to enable / disable the NamedBeanComboBoxinEditable
- boolean to make the NamedBeanComboBox editable
-
getLayoutTrackDrawingOptions
@Nonnull public LayoutTrackDrawingOptions getLayoutTrackDrawingOptions()
Getter Layout Track Drawing Options. since 4.15.6 split variable defaultTrackColor and mainlineTrackColor/sidelineTrackColor
blockDefaultColor, blockOccupiedColor and blockAlternativeColor added to LayoutTrackDrawingOptions- Returns:
- LayoutTrackDrawingOptions object
-
setLayoutTrackDrawingOptions
public void setLayoutTrackDrawingOptions(LayoutTrackDrawingOptions ltdo)
since 4.15.6 split variable defaultTrackColor and mainlineTrackColor/sidelineTrackColor- Parameters:
ltdo
- LayoutTrackDrawingOptions object
-
getToolBarSide
public jmri.jmrit.display.layoutEditor.LayoutEditor.ToolBarSide getToolBarSide()
get the toolbar side- Returns:
- the side where to put the tool bar
-
setToolBarSide
public void setToolBarSide(jmri.jmrit.display.layoutEditor.LayoutEditor.ToolBarSide newToolBarSide)
set the tool bar side- Parameters:
newToolBarSide
- on which side to put the toolbar
-
scrollBarAdjusted
public void scrollBarAdjusted(java.awt.event.AdjustmentEvent event)
-
mouseWheelMoved
public void mouseWheelMoved(@Nonnull java.awt.event.MouseWheelEvent event)
- Specified by:
mouseWheelMoved
in interfacejava.awt.event.MouseWheelListener
-
setZoom
public double setZoom(double zoomFactor)
Set panel Zoom factor.- Parameters:
zoomFactor
- the amount to scale, eg. 2.0 for 2x zoom.- Returns:
- the new scale amount (not necessarily the same as zoomFactor)
-
getZoom
public double getZoom()
getZoom- Returns:
- the zooming scale
-
getMinZoom
public double getMinZoom()
getMinZoom- Returns:
- the minimum zoom scale
-
getMaxZoom
public double getMaxZoom()
getMaxZoom- Returns:
- the maximum zoom scale
-
isIncludedTurnoutSkipped
public boolean isIncludedTurnoutSkipped()
-
setIncludedTurnoutSkipped
public void setIncludedTurnoutSkipped(java.lang.Boolean boo)
-
getOpenDispatcherOnLoad
public boolean getOpenDispatcherOnLoad()
-
setOpenDispatcherOnLoad
public void setOpenDispatcherOnLoad(java.lang.Boolean boo)
-
removeMarkers
public void removeMarkers()
Remove marker icons from panel- Overrides:
removeMarkers
in classEditor
-
translateTrack
public boolean translateTrack(float xDel, float yDel)
-
scaleTrack
public boolean scaleTrack(float xFactor, float yFactor)
scale all LayoutTracks coordinates by the x and y factors.- Parameters:
xFactor
- the amount to scale X coordinates.yFactor
- the amount to scale Y coordinates.- Returns:
- true when complete.
-
setAllTracksToDefaultColors
public int setAllTracksToDefaultColors()
loop through all LayoutBlocks and set colors to the default colors from this LayoutEditor- Returns:
- count of changed blocks
-
translate
public void translate(float xTranslation, float yTranslation)
Translate entire layout by x and y amounts.- Parameters:
xTranslation
- horizontal (X) translation valueyTranslation
- vertical (Y) translation value
-
undoMoveSelection
void undoMoveSelection()
undo the move selection
-
rotateSelection90
public void rotateSelection90()
Rotate selection by 90 degrees clockwise.
-
rotateLayout90
public void rotateLayout90()
Rotate the entire layout by 90 degrees clockwise.
-
alignLayoutToGrid
public void alignLayoutToGrid()
align the layout to grid
-
alignSelectionToGrid
public void alignSelectionToGrid()
align selection to grid
-
setCurrentPositionAndSize
public void setCurrentPositionAndSize()
-
setScroll
public void setScroll(java.lang.String value)
The LE xml load uses the string version of setScroll which went directly to Editor. The string version has been added here so that LE can set the scroll selection.
-
addTurntable
public void addTurntable(@Nonnull java.awt.geom.Point2D pt)
Add a layout turntable at location specified- Parameters:
pt
- x,y placement for turntable
-
redrawPanel
public void redrawPanel()
Allow external trigger of re-drawHidden- Specified by:
redrawPanel
in interfaceLayoutModels
-
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- Parameters:
val
- true/false for panelChanged
-
setDirty
public void setDirty()
- Specified by:
setDirty
in interfaceLayoutModels
-
isDirty
public boolean isDirty()
Check the dirty state.- Specified by:
isDirty
in interfaceLayoutModels
- Returns:
- true if panel has changed
-
mousePressed
public void mousePressed(JmriMouseEvent event)
Handle a mouse pressed eventSide-effects on _anchorX, _anchorY,_lastX, _lastY, xLoc, yLoc, dLoc, selectionActive, xLabel, yLabel
- Specified by:
mousePressed
in interfaceJmriMouseListener
- Overrides:
mousePressed
in classPanelEditor
- Parameters:
event
- the JmriMouseEvent
-
getCoords
@Nonnull public java.awt.geom.Point2D getCoords(@Nonnull LayoutTrack trk, HitPointType connectionType)
Get the coordinates for the connection type of the specified LayoutTrack or subtype.This uses the current LayoutEditor object to map a LayoutTrack (no coordinates) object to _a_ specific LayoutTrackView object in the current LayoutEditor i.e. window. This allows the same model object in two windows, but not twice in a single window.
This is temporary, and needs to go away as the LayoutTrack doesn't logically have position; just the LayoutTrackView does, and multiple LayoutTrackViews can refer to one specific LayoutTrack.
- Parameters:
trk
- the object (LayoutTrack subclass)connectionType
- the type of connection- Returns:
- the coordinates for the connection type of the specified object
-
getCoords
@Nonnull public java.awt.geom.Point2D getCoords(@Nonnull LayoutTrackView trkv, HitPointType connectionType)
Get the coordinates for the connection type of the specified LayoutTrackView or subtype.- Parameters:
trkv
- the object (LayoutTrackView subclass)connectionType
- the type of connection- Returns:
- the coordinates for the connection type of the specified object
-
mouseReleased
public void mouseReleased(JmriMouseEvent event)
Description copied from interface:JmriMouseListener
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleased
in interfaceJmriMouseListener
- Overrides:
mouseReleased
in classPanelEditor
- Parameters:
event
- the event to be processed
-
addPopupItems
public void addPopupItems(@Nonnull javax.swing.JPopupMenu popup, @Nonnull JmriMouseEvent event)
-
showPopUp
public void showPopUp(@Nonnull Positionable p, @Nonnull JmriMouseEvent event)
Select the menu items to display for the Positionable's popup.- Parameters:
p
- the item containing or requiring the context menuevent
- the event triggering the menu
-
mouseClicked
public void mouseClicked(@Nonnull JmriMouseEvent event)
Description copied from interface:JmriMouseListener
Invoked when the mouse button has been clicked (pressed and released) on a component.- Specified by:
mouseClicked
in interfaceJmriMouseListener
- Overrides:
mouseClicked
in classPanelEditor
- Parameters:
event
- the event to be processed
-
getPositionalSelection
@Nonnull public java.util.List<Positionable> getPositionalSelection()
-
getLayoutTrackSelection
@Nonnull public java.util.List<LayoutTrack> getLayoutTrackSelection()
-
getLayoutShapeSelection
@Nonnull public java.util.List<LayoutShape> getLayoutShapeSelection()
-
clearSelectionGroups
public void clearSelectionGroups()
-
amendSelectionGroup
public void amendSelectionGroup(@Nonnull LayoutTrack p)
-
amendSelectionGroup
public void amendSelectionGroup(@Nonnull LayoutShape ls)
-
alignSelection
public void alignSelection(boolean alignX)
-
setShowAlignmentMenu
public boolean setShowAlignmentMenu(@Nonnull javax.swing.JPopupMenu popup)
Offer actions to align the selected Positionable items either Horizontally (at average y coord) or Vertically (at average x coord).- Parameters:
popup
- the JPopupMenu to add alignment menu to- Returns:
- true if alignment menu added
-
keyPressed
public void keyPressed(@Nonnull java.awt.event.KeyEvent event)
- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
- Overrides:
keyPressed
in classEditor
-
mouseMoved
public void mouseMoved(@Nonnull JmriMouseEvent event)
Description copied from interface:JmriMouseMotionListener
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.- Specified by:
mouseMoved
in interfaceJmriMouseMotionListener
- Overrides:
mouseMoved
in classPanelEditor
- Parameters:
event
- the event to be processed
-
setAllShowLayoutTurnoutToolTip
public void setAllShowLayoutTurnoutToolTip(boolean state)
-
mouseDragged
public void mouseDragged(@Nonnull JmriMouseEvent event)
Description copied from interface:JmriMouseMotionListener
Invoked when a mouse button is pressed on a component and then dragged.MOUSE_DRAGGED
events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).Due to platform-dependent Drag&Drop implementations,
MOUSE_DRAGGED
events may not be delivered during a native Drag&Drop operation.- Specified by:
mouseDragged
in interfaceJmriMouseMotionListener
- Overrides:
mouseDragged
in classPanelEditor
- Parameters:
event
- the event to be processed
-
mouseEntered
public void mouseEntered(@Nonnull JmriMouseEvent event)
Description copied from interface:JmriMouseListener
Invoked when the mouse enters a component.- Specified by:
mouseEntered
in interfaceJmriMouseListener
- Overrides:
mouseEntered
in classPanelEditor
- Parameters:
event
- the event to be processed
-
addAnchor
public void addAnchor()
Add an Anchor point.
-
addAnchor
@Nonnull public PositionablePoint addAnchor(@Nonnull java.awt.geom.Point2D p)
-
addEndBumper
public void addEndBumper()
Add an End Bumper point.
-
addEdgeConnector
public void addEdgeConnector()
Add an Edge Connector point.
-
addTrackSegment
public void addTrackSegment()
Add a Track Segment
-
addLevelXing
public void addLevelXing()
Add a Level Crossing
-
addLayoutSlip
public void addLayoutSlip(LayoutTurnout.TurnoutType type)
Add a LayoutSlip- Parameters:
type
- the slip type
-
addLayoutTurnout
public void addLayoutTurnout(LayoutTurnout.TurnoutType type)
Add a Layout Turnout- Parameters:
type
- the turnout type
-
validatePhysicalTurnout
public boolean validatePhysicalTurnout(@Nonnull java.lang.String inTurnoutName, @CheckForNull java.awt.Component inOpenPane)
Validates that a physical turnout exists and is unique among Layout Turnouts Returns true if valid turnout was entered, false otherwise- Parameters:
inTurnoutName
- the (system or user) name of the turnoutinOpenPane
- the pane over which to show dialogs (null to suppress dialogs)- Returns:
- true if valid
-
setLink
public void setLink(@Nonnull LayoutTrack fromObject, HitPointType fromPointType, @Nonnull LayoutTrack toObject, HitPointType toPointType)
link the 'from' object and type to the 'to' object and type- Parameters:
fromObject
- the object to link fromfromPointType
- the object type to link fromtoObject
- the object to link totoPointType
- the object type to link to
-
provideLayoutBlock
public LayoutBlock provideLayoutBlock(@Nonnull java.lang.String inBlockName)
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.If the block name is a system name, then the user will have to supply a user name for the block.
Some, but not all, errors pop a Swing error dialog in addition to logging.
- Parameters:
inBlockName
- the entered name- Returns:
- the provided LayoutBlock
-
validateSensor
public boolean validateSensor(@Nonnull java.lang.String sensorName, @Nonnull LayoutBlock blk, @Nonnull java.awt.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.- Parameters:
sensorName
- the sensor name to validateblk
- the LayoutBlock in which to set itopenFrame
- the frame (Component) it is in- Returns:
- true if sensor is valid
-
getLayoutBlock
public LayoutBlock getLayoutBlock(@Nonnull java.lang.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.- Parameters:
blockID
- the given name- Returns:
- null if blockID does not already exist
-
removeFromContents
public boolean removeFromContents(@Nonnull Positionable l)
- Overrides:
removeFromContents
in classEditor
-
removePositionablePoint
public boolean removePositionablePoint(@Nonnull PositionablePoint o)
Remove a PositionablePoint -- an Anchor or an End Bumper.- Parameters:
o
- the PositionablePoint to remove- Returns:
- true if removed
-
removeLayoutTurnout
public boolean removeLayoutTurnout(@Nonnull LayoutTurnout o)
Remove a LayoutTurnout- Parameters:
o
- the LayoutTurnout to remove- Returns:
- true if removed
-
removeLevelXing
public boolean removeLevelXing(@Nonnull LevelXing o)
Remove a Level Crossing- Parameters:
o
- the LevelXing to remove- Returns:
- true if removed
-
removeLayoutSlip
public boolean removeLayoutSlip(@Nonnull LayoutTurnout o)
Remove a slip- Parameters:
o
- the LayoutSlip to remove- Returns:
- true if removed
-
removeTurntable
public boolean removeTurntable(@Nonnull LayoutTurntable o)
Remove a Layout Turntable- Parameters:
o
- the LayoutTurntable to remove- Returns:
- true if removed
-
removeTrackSegment
public void removeTrackSegment(@Nonnull TrackSegment o)
Remove a Track Segment- Parameters:
o
- the TrackSegment to remove
-
getAffectedBlock
public LayoutBlock getAffectedBlock(@Nonnull LayoutTrack track, HitPointType type)
Depending on the given type, and the real class of the given LayoutTrack, determine the connected LayoutTrack. This provides a variable-indirect form of e.g. trk.getLayoutBlockC() for example. Perhaps "Connected Block" captures the idea better, but that method name is being used for something else.- Parameters:
track
- The track who's connected blocks are being examinedtype
- This point to check for connected blocks, i.e. TURNOUT_B- Returns:
- The block at a particular point on the track object, or null if none.
-
addSensor
void addSensor()
Add a sensor indicator to the Draw Panel
-
putSensor
public void putSensor(@Nonnull SensorIcon l)
-
addSignalHead
void addSignalHead()
Add a signal head to the Panel
-
putSignal
public void putSignal(@Nonnull SignalHeadIcon l)
-
getSignalHead
@CheckForNull SignalHead getSignalHead(@Nonnull java.lang.String name)
-
containsSignalHead
public boolean containsSignalHead(@CheckForNull SignalHead head)
-
removeSignalHead
public void removeSignalHead(@CheckForNull SignalHead head)
-
addSignalMast
void addSignalMast()
-
putSignalMast
public void putSignalMast(@Nonnull SignalMastIcon l)
-
getSignalMast
SignalMast getSignalMast(@Nonnull java.lang.String name)
-
containsSignalMast
public boolean containsSignalMast(@Nonnull SignalMast mast)
-
addLabel
void addLabel()
Add a label to the Draw Panel
-
putItem
public void putItem(@Nonnull Positionable l) throws Positionable.DuplicateIdException
- Overrides:
putItem
in classPanelEditor
- Throws:
Positionable.DuplicateIdException
-
addMemory
void addMemory()
Add a memory label to the Draw Panel
-
addGlobalVariable
void addGlobalVariable()
-
addBlockContents
void addBlockContents()
-
addReporter
public void addReporter(@Nonnull Reporter reporter, int xx, int yy)
Add a Reporter Icon to the panel.- Parameters:
reporter
- the reporter icon to add.xx
- the horizontal location.yy
- the vertical location.
-
addIcon
void addIcon()
Add an icon to the target
-
addLogixNGIcon
void addLogixNGIcon()
Add a LogixNG icon to the target
-
addAudioIcon
void addAudioIcon()
Add a LogixNG icon to the target
-
addLocoIcon
public LocoIcon addLocoIcon(@Nonnull java.lang.String name)
Add a loco marker to the target- Overrides:
addLocoIcon
in classEditor
-
putLocoIcon
public void putLocoIcon(@Nonnull LocoIcon l, @Nonnull java.lang.String name)
- Overrides:
putLocoIcon
in classEditor
-
addBackground
public void addBackground()
Add a background image
-
removeLayoutShape
public boolean removeLayoutShape(@Nonnull LayoutShape s)
Remove a layout shape from the list of layout shapes- Parameters:
s
- the LayoutShape to add- Returns:
- true if added
-
startMultiSensor
void startMultiSensor()
-
addMultiSensor
public void addMultiSensor(@Nonnull MultiSensorIcon l)
-
setNextLocation
public void setNextLocation(@Nonnull 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 classPanelEditor
- Parameters:
obj
- the positionable object.
-
getConnectivityUtil
@Nonnull public ConnectivityUtil getConnectivityUtil()
-
getLETools
@Nonnull public LayoutEditorTools getLETools()
-
getLEAuxTools
@Nonnull public LayoutEditorAuxTools getLEAuxTools()
- Specified by:
getLEAuxTools
in interfaceLayoutModels
-
getLEChecks
@Nonnull public LayoutEditorChecks getLEChecks()
-
deletePanel
public boolean deletePanel()
Invoked by DeletePanel menu item Validate user intent before deleting- Overrides:
deletePanel
in classEditor
- Returns:
- true if panel should be deleted.
-
canDeletePanel
public boolean canDeletePanel()
Check for conditions that prevent a delete.- The panel has active edge connector links
- The panel is used by EntryExit
- Returns:
- true if ok to delete
-
setAllEditable
public void setAllEditable(boolean editable)
Control whether target panel items are editable. Does this by invoking theEditor.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 classEditor
- Parameters:
editable
- true for editable.
-
setAllPositionable
public void setAllPositionable(boolean state)
Control whether panel items are positionable. Markers are always positionable.- Overrides:
setAllPositionable
in classEditor
- Parameters:
state
- true for positionable.
-
setTurnoutAnimation
public void setTurnoutAnimation(boolean state)
Control whether target panel items are controlling layout items. Does this by invoke thePositionable.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()
-
getScroll
public boolean getScroll()
-
getDefaultTrackColor
public java.lang.String getDefaultTrackColor()
-
getDefaultTrackColorColor
@Nonnull public java.awt.Color getDefaultTrackColorColor()
Getter defaultTrackColor.- Returns:
- block default color as Color
-
getDefaultOccupiedTrackColor
@Nonnull public java.lang.String getDefaultOccupiedTrackColor()
-
getDefaultOccupiedTrackColorColor
@Nonnull public java.awt.Color getDefaultOccupiedTrackColorColor()
Getter defaultOccupiedTrackColor.- Returns:
- block default occupied color as Color
-
getDefaultAlternativeTrackColor
@Nonnull public java.lang.String getDefaultAlternativeTrackColor()
-
getDefaultAlternativeTrackColorColor
@Nonnull public java.awt.Color getDefaultAlternativeTrackColorColor()
Getter defaultAlternativeTrackColor.- Returns:
- block default alternative color as Color
-
getDefaultTextColor
@Nonnull public java.lang.String getDefaultTextColor()
-
getTurnoutCircleColor
@Nonnull public java.lang.String getTurnoutCircleColor()
-
getTurnoutCircleThrownColor
@Nonnull public java.lang.String getTurnoutCircleThrownColor()
-
isTurnoutFillControlCircles
public boolean isTurnoutFillControlCircles()
-
getTurnoutCircleSize
public int getTurnoutCircleSize()
-
isTurnoutDrawUnselectedLeg
public boolean isTurnoutDrawUnselectedLeg()
-
getLayoutName
public java.lang.String getLayoutName()
-
getShowHelpBar
public boolean getShowHelpBar()
-
getDrawGrid
public boolean getDrawGrid()
-
getSnapOnAdd
public boolean getSnapOnAdd()
-
getSnapOnMove
public boolean getSnapOnMove()
-
getAntialiasingOn
public boolean getAntialiasingOn()
-
isDrawLayoutTracksLabel
public boolean isDrawLayoutTracksLabel()
-
getHighlightSelectedBlock
public boolean getHighlightSelectedBlock()
-
getTurnoutCircles
public boolean getTurnoutCircles()
-
getTooltipsNotEdit
public boolean getTooltipsNotEdit()
-
getTooltipsInEdit
public boolean getTooltipsInEdit()
-
getAutoBlockAssignment
public boolean getAutoBlockAssignment()
-
setLayoutDimensions
public void setLayoutDimensions(int windowWidth, int windowHeight, int windowX, int windowY, int panelWidth, int panelHeight)
-
setLayoutDimensions
public void setLayoutDimensions(int windowWidth, int windowHeight, int windowX, int windowY, int panelWidth, int panelHeight, boolean merge)
-
getPanelBounds
@Nonnull public java.awt.geom.Rectangle2D getPanelBounds()
-
setPanelBounds
public void setPanelBounds(@Nonnull java.awt.geom.Rectangle2D newBounds)
-
unionToPanelBounds
@Nonnull public java.awt.geom.Rectangle2D unionToPanelBounds(@Nonnull java.awt.geom.Rectangle2D bounds)
-
setDefaultTrackColor
public void setDefaultTrackColor(@Nonnull java.awt.Color color)
- Parameters:
color
- value to set the default track color to.
-
setDefaultOccupiedTrackColor
public void setDefaultOccupiedTrackColor(@Nonnull java.awt.Color color)
- Parameters:
color
- value to set the default occupied track color to.
-
setDefaultAlternativeTrackColor
public void setDefaultAlternativeTrackColor(@Nonnull java.awt.Color color)
- Parameters:
color
- value to set the default alternate track color to.
-
setTurnoutCircleColor
public void setTurnoutCircleColor(@CheckForNull java.awt.Color color)
- Parameters:
color
- new color for turnout circle.
-
setTurnoutCircleThrownColor
public void setTurnoutCircleThrownColor(@CheckForNull java.awt.Color color)
- Parameters:
color
- new color for turnout circle.
-
setTurnoutFillControlCircles
@InvokeOnGuiThread public void setTurnoutFillControlCircles(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to fill in turnout control circles, else false.
-
setTurnoutCircleSize
public void setTurnoutCircleSize(int size)
-
setTurnoutDrawUnselectedLeg
@InvokeOnGuiThread public void setTurnoutDrawUnselectedLeg(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to draw unselected legs, else false.
-
setDefaultTextColor
public void setDefaultTextColor(@Nonnull java.awt.Color color)
- Parameters:
color
- value to set the default text color to.
-
setDefaultBackgroundColor
public void setDefaultBackgroundColor(@Nonnull java.awt.Color color)
- Parameters:
color
- value to set the panel background to.
-
setLayoutName
public void setLayoutName(@Nonnull java.lang.String name)
-
setShowHelpBar
@InvokeOnGuiThread public void setShowHelpBar(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to show the help bar, else false.
-
setDrawGrid
@InvokeOnGuiThread public void setDrawGrid(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to show the draw grid, else false.
-
setSnapOnAdd
@InvokeOnGuiThread public void setSnapOnAdd(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to set snap to grid on add, else false.
-
setSnapOnMove
@InvokeOnGuiThread public void setSnapOnMove(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to set snap on move, else false.
-
setAntialiasingOn
@InvokeOnGuiThread public void setAntialiasingOn(boolean state)
Should only be invoked on the GUI (Swing) thread.- Parameters:
state
- true to set anti-aliasing flag on, else false.
-
setDrawLayoutTracksLabel
public void setDrawLayoutTracksLabel(boolean state)
- Parameters:
state
- true to set anti-aliasing flag on, else false.
-
setHighlightSelectedBlock
public void setHighlightSelectedBlock(boolean state)
-
highlightBlockInComboBox
public boolean highlightBlockInComboBox(@Nonnull NamedBeanComboBox<Block> inComboBox)
-
highlightBlock
public boolean highlightBlock(@CheckForNull Block inBlock)
highlight the specified block- Parameters:
inBlock
- the block- Returns:
- true if block was highlighted
-
highlightLayoutBlock
public boolean highlightLayoutBlock(@Nonnull LayoutBlock inLayoutBlock)
highlight the specified layout block- Parameters:
inLayoutBlock
- the layout block- Returns:
- true if layout block was highlighted
-
setTurnoutCircles
public void setTurnoutCircles(boolean state)
-
setAutoBlockAssignment
public void setAutoBlockAssignment(boolean boo)
-
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()
-
setDirectTurnoutControl
public void setDirectTurnoutControl(boolean boo)
-
getDirectTurnoutControl
public boolean getDirectTurnoutControl()
-
setConnections
public void setConnections()
-
layoutEditorControlRectAt
@Nonnull public java.awt.geom.Rectangle2D layoutEditorControlRectAt(@Nonnull java.awt.geom.Point2D inPoint)
-
layoutEditorControlCircleRectAt
@Nonnull public java.awt.geom.Rectangle2D layoutEditorControlCircleRectAt(@Nonnull java.awt.geom.Point2D inPoint)
-
paintTargetPanel
public void paintTargetPanel(@Nonnull java.awt.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 classPanelEditor
- Parameters:
g
- the context to paint within
-
getSelectionRect
@Nonnull public java.awt.geom.Rectangle2D getSelectionRect()
-
setSelectionRect
public void setSelectionRect(@Nonnull java.awt.geom.Rectangle2D selectionRect)
-
setSelectRect
public void setSelectRect(java.awt.Rectangle rectangle)
-
getLayoutTracksOfClass
@Nonnull public java.util.stream.Stream<LayoutTrack> getLayoutTracksOfClass(java.lang.Class<? extends LayoutTrack> layoutTrackClass)
- Specified by:
getLayoutTracksOfClass
in interfaceLayoutModels
-
getLayoutTrackViewsOfClass
@Nonnull public java.util.stream.Stream<LayoutTrackView> getLayoutTrackViewsOfClass(java.lang.Class<? extends LayoutTrackView> layoutTrackViewClass)
- Specified by:
getLayoutTrackViewsOfClass
in interfaceLayoutModels
-
getPositionablePointViews
@Nonnull public java.util.List<PositionablePointView> getPositionablePointViews()
- Specified by:
getPositionablePointViews
in interfaceLayoutModels
-
getPositionablePoints
@Nonnull public java.util.List<PositionablePoint> getPositionablePoints()
- Specified by:
getPositionablePoints
in interfaceLayoutModels
-
getLayoutSlipViews
@Nonnull public java.util.List<LayoutSlipView> getLayoutSlipViews()
-
getLayoutSlips
@Nonnull public java.util.List<LayoutSlip> getLayoutSlips()
- Specified by:
getLayoutSlips
in interfaceLayoutModels
-
getTrackSegmentViews
@Nonnull public java.util.List<TrackSegmentView> getTrackSegmentViews()
- Specified by:
getTrackSegmentViews
in interfaceLayoutModels
-
getTrackSegments
@Nonnull public java.util.List<TrackSegment> getTrackSegments()
- Specified by:
getTrackSegments
in interfaceLayoutModels
-
getLayoutTurnoutViews
@Nonnull public java.util.List<LayoutTurnoutView> getLayoutTurnoutViews()
-
getLayoutTurnouts
@Nonnull public java.util.List<LayoutTurnout> getLayoutTurnouts()
- Specified by:
getLayoutTurnouts
in interfaceLayoutModels
-
getLayoutTurntables
@Nonnull public java.util.List<LayoutTurntable> getLayoutTurntables()
- Specified by:
getLayoutTurntables
in interfaceLayoutModels
-
getLayoutTurntableViews
@Nonnull public java.util.List<LayoutTurntableView> getLayoutTurntableViews()
-
getLevelXings
@Nonnull public java.util.List<LevelXing> getLevelXings()
- Specified by:
getLevelXings
in interfaceLayoutModels
-
getLevelXingViews
@Nonnull public java.util.List<LevelXingView> getLevelXingViews()
- Specified by:
getLevelXingViews
in interfaceLayoutModels
-
getLayoutTracks
@Nonnull public final java.util.List<LayoutTrack> getLayoutTracks()
Read-only access to the list of LayoutTrack family objects. The returned list will throw UnsupportedOperationException if you attempt to modify it.- Specified by:
getLayoutTracks
in interfaceLayoutModels
- Returns:
- unmodifiable copy of layout track list.
-
getLayoutTurnoutAndSlipViews
@Nonnull public java.util.List<LayoutTurnoutView> getLayoutTurnoutAndSlipViews()
-
getLayoutTurnoutsAndSlips
@Nonnull public java.util.List<LayoutTurnout> getLayoutTurnoutsAndSlips()
- Specified by:
getLayoutTurnoutsAndSlips
in interfaceLayoutModels
-
getLayoutTrackViews
@Nonnull public final java.util.List<LayoutTrackView> getLayoutTrackViews()
Read-only access to the list of LayoutTrackView family objects. The returned list will throw UnsupportedOperationException if you attempt to modify it.- Specified by:
getLayoutTrackViews
in interfaceLayoutModels
- Returns:
- unmodifiable copy of track views.
-
getLayoutTrackView
public final LayoutTrackView getLayoutTrackView(LayoutTrack trk)
- Specified by:
getLayoutTrackView
in interfaceLayoutModels
-
getLevelXingView
public final LevelXingView getLevelXingView(LevelXing xing)
- Specified by:
getLevelXingView
in interfaceLayoutModels
-
getLayoutTurnoutView
public final LayoutTurnoutView getLayoutTurnoutView(LayoutTurnout to)
- Specified by:
getLayoutTurnoutView
in interfaceLayoutModels
-
getLayoutTurntableView
public final LayoutTurntableView getLayoutTurntableView(LayoutTurntable to)
- Specified by:
getLayoutTurntableView
in interfaceLayoutModels
-
getLayoutSlipView
public final LayoutSlipView getLayoutSlipView(LayoutSlip to)
-
getTrackSegmentView
public final TrackSegmentView getTrackSegmentView(TrackSegment to)
- Specified by:
getTrackSegmentView
in interfaceLayoutModels
-
getPositionablePointView
public final PositionablePointView getPositionablePointView(PositionablePoint to)
- Specified by:
getPositionablePointView
in interfaceLayoutModels
-
addLayoutTrack
public final void addLayoutTrack(@Nonnull LayoutTrack trk, @Nonnull LayoutTrackView v)
Add a LayoutTrack and LayoutTrackView to the list of LayoutTrack family objects.- Specified by:
addLayoutTrack
in interfaceLayoutModels
- Parameters:
trk
- the layout track to add.v
- corresponding view
-
removeLayoutTrackAndRedraw
public final boolean removeLayoutTrackAndRedraw(@Nonnull LayoutTrack trk)
If item present, delete from the list of LayoutTracks and force a dirty redraw.- Parameters:
trk
- the layout track to remove and redraw.- Returns:
- true is item was deleted and a redraw done.
-
removeLayoutTrack
public final void removeLayoutTrack(@Nonnull LayoutTrack trk)
If item present, delete from the list of LayoutTracks and force a dirty redraw.- Specified by:
removeLayoutTrack
in interfaceLayoutModels
- Parameters:
trk
- the layout track to remove.
-
getLayoutShapes
@Nonnull public java.util.List<LayoutShape> getLayoutShapes()
- Specified by:
getLayoutShapes
in interfaceLayoutModels
-
sortLayoutShapesByLevel
public void sortLayoutShapesByLevel()
-
computeDirection
public int computeDirection(LayoutTrack trk1, HitPointType h1, LayoutTrack trk2, HitPointType h2)
Compute octagonal direction of vector from p1 to p2.The octagonal (8) directions are: North, North-East, East, South-East, South, South-West, West and North-West; see
Path
for more on this.This method must eventually be in terms _other_ than the screen geometry of the associated LayoutTrackView objects, as it's meant to be the track connectivity direction not the on the screen implementation.
This implementation is temporary, using the on-screen points from the LayoutTrackViews via @{link LayoutEditor#getCoords}.
- Specified by:
computeDirection
in interfaceLayoutModels
- Parameters:
trk1
- track at "from" endh1
- the hit point for "from" endtrk2
- the track at the "to" endh2
- the hit at the "to" end- Returns:
- the octagonal direction from p1 to p2
-
computeDirectionToCenter
public int computeDirectionToCenter(@Nonnull LayoutTrack trk1, @Nonnull HitPointType h1, @Nonnull PositionablePoint p)
- Specified by:
computeDirectionToCenter
in interfaceLayoutModels
-
computeDirectionFromCenter
public int computeDirectionFromCenter(@Nonnull PositionablePoint p, @Nonnull LayoutTrack trk1, @Nonnull HitPointType h1)
- Specified by:
computeDirectionFromCenter
in interfaceLayoutModels
-
showAlignPopup
public boolean showAlignPopup(@Nonnull Positionable l)
- Overrides:
showAlignPopup
in classEditor
-
showToolTip
public void showToolTip(@Nonnull Positionable selection, @Nonnull JmriMouseEvent event)
- Overrides:
showToolTip
in classEditor
-
addToPopUpMenu
public void addToPopUpMenu(@Nonnull NamedBean nb, @Nonnull javax.swing.JMenuItem item, int menu)
Description copied from class:Editor
Provide a method for external code to add items to context menus.- Overrides:
addToPopUpMenu
in classEditor
- Parameters:
nb
- The namedBean associated with the postionable item.item
- The entry to add to the menu.menu
- The menu to add the entry to.
-
toString
@Nonnull public java.lang.String toString()
- Overrides:
toString
in classjava.awt.Component
-
vetoableChange
public void vetoableChange(@Nonnull java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException
- Specified by:
vetoableChange
in interfacejava.beans.VetoableChangeListener
- Overrides:
vetoableChange
in classEditor
- Throws:
java.beans.PropertyVetoException
-
dispose
public void dispose()
Description copied from class:Editor
Dispose of the editor.- Specified by:
dispose
in interfaceWindowInterface
- Overrides:
dispose
in classEditor
-
newTurnoutComboBoxPopupMenuListener
public LayoutEditor.TurnoutComboBoxPopupMenuListener newTurnoutComboBoxPopupMenuListener(NamedBeanComboBox<Turnout> comboBox)
Create a listener that will exclude turnouts that are present in the current panel.- Parameters:
comboBox
- The NamedBeanComboBox that contains the turnout list.- Returns:
- A PopupMenuListener
-
newTurnoutComboBoxPopupMenuListener
public LayoutEditor.TurnoutComboBoxPopupMenuListener newTurnoutComboBoxPopupMenuListener(NamedBeanComboBox<Turnout> comboBox, java.util.List<Turnout> currentTurnouts)
Create a listener that will exclude turnouts that are present in the current panel. The list of current turnouts are not excluded.- Parameters:
comboBox
- The NamedBeanComboBox that contains the turnout list.currentTurnouts
- The turnouts to be left in the turnout list.- Returns:
- A PopupMenuListener
-
getUsageReport
public java.util.List<NamedBeanUsageReport> getUsageReport(NamedBean bean)
- Overrides:
getUsageReport
in classEditor
-
findTurnoutUsage
void findTurnoutUsage(NamedBean bean)
-
findPositionalUsage
void findPositionalUsage(NamedBean bean)
-
findSegmentWhereUsed
void findSegmentWhereUsed(NamedBean bean)
-
findXingWhereUsed
void findXingWhereUsed(NamedBean bean)
-
getUsageData
java.lang.String getUsageData(LayoutTrack track)
-
isLBLockUsed
boolean isLBLockUsed(NamedBean bean, LayoutBlock lblock)
-
isUsedInXing
boolean isUsedInXing(NamedBean bean, LevelXing xing, LevelXing.Geometry point)
-
-