Class SwitchboardEditor
- 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.switchboardEditor.SwitchboardEditor
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.ComponentListener
,java.awt.event.KeyListener
,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
,ModifiedFlag
,JmriMouseListener
,JmriMouseMotionListener
,WindowInterface
public class SwitchboardEditor extends Editor
Provides a simple editor for adding jmri.jmrit.display.switchBoard items to a JLayeredPane inside a captive JFrame. Primary use is for new users.GUI is structured as a separate setup panel to set the visible range and type plus menus.
All created objects are placed in a GridLayout grid. No special use of the LayeredPane layers. Inspired by Oracle JLayeredPane demo.
The "switchesOnBoard" LinkedHashMap keeps track of all the objects added to the target frame for later manipulation. May be used in an update to store mixed switchboards with more than 1 connection and more than 1 bean type/range.
The 'ready' flag protects the map during regeneration.No DnD as panels will be automatically populated in order of the DCC address. New beans may be created from the Switchboard by right clicking an unconnected switch. TODO allow user entry of connection specific starting name, validated in manager using hardwareAddressValidator
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 protected javax.swing.JMenu
_fileMenu
protected javax.swing.JMenuBar
_menuBar
protected javax.swing.JMenu
_optionMenu
(package private) javax.swing.JTextField
addressTextField
(package private) static int
BUTTON
protected static java.awt.Color
darkActiveColor
protected static java.awt.Color
darkInactiveColor
(package private) javax.swing.ImageIcon
iconNext
(package private) javax.swing.ImageIcon
iconPrev
(package private) static int
KEY
(package private) static java.lang.String
LIGHT
protected LightManager
lightManager
(package private) static java.lang.String
SENSOR
protected SensorManager
sensorManager
(package private) static int
SIZE_INIT
(package private) static int
SIZE_MAX
(package private) static int
SIZE_MIN
(package private) static int
SLIDER
(package private) static int
SYMBOL
(package private) static java.lang.String
TURNOUT
protected TurnoutManager
turnoutManager
-
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 SwitchboardEditor()
CtorSwitchboardEditor(java.lang.String name)
Ctor by a given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
autoItemRange()
protected Editor
changeView(java.lang.String className)
changeView is not supported by SwitchBoards.protected void
configureManagerComboBoxes()
Configure the combo box listing managers.protected void
copyItem(Positionable p)
Set up item(s) to be copied by paste.protected void
displayManagerComboBoxes(java.lang.String type)
Show only one of the manuf (manager) combo boxes.java.awt.Color
getActiveColorAsColor()
java.lang.String
getActiveSwitchColor()
java.awt.Color
getDefaultBackgroundColor()
Get current default background color.java.lang.String
getDefaultTextColor()
java.awt.Color
getDefaultTextColorAsColor()
int
getIconScale()
java.awt.Color
getInactiveColorAsColor()
java.lang.String
getInactiveSwitchColor()
protected Manager<?>
getManager()
Get the currently active manager.protected Manager<?>
getManager(char typeChar)
int
getPanelMenuRangeMax()
Store Range maximum.int
getPanelMenuRangeMin()
Store Range minimum.int
getRows()
Store Switchboard rowsNum JSpinner or turn on autoRows option.protected java.util.ArrayList<Positionable>
getSelectionGroup()
protected BeanSwitch
getSwitch(java.lang.String sName)
Get a beanSwitch object from this SwitchBoard panel by a given name.java.util.List<BeanSwitch>
getSwitches()
Get a list with copies of BeanSwitch objects currently displayed to transfer to Web Server for display.java.lang.String
getSwitchManu()
Store connection type.java.lang.String
getSwitchShape()
Store switch shape.java.lang.String
getSwitchType()
Store bean type.java.lang.String
getSwitchTypeName()
Get bean type name.int
getTileSize()
int
getTotal()
Store total number of switches displayed (unconnected/hidden excluded).java.util.List<NamedBeanUsageReport>
getUsageReport(NamedBean bean)
boolean
hideUnconnected()
protected void
init(java.lang.String name)
Initialize the newly created Switchboard.void
initView()
After construction, initialize all the widgets to their saved config settings.boolean
isDirty()
Check the dirty state.void
keyPressed(java.awt.event.KeyEvent e)
KeyListener of Editor.void
loadComplete()
JmriJFrame
makeFrame(java.lang.String name)
Create sequence of panels, etc. for switches: JFrame contains its ContentPane which contains a JPanel with BoxLayout (p1) which contains a JScrollPane (js) which contains the targetPane.protected void
makeOptionMenu()
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
mouseExited(JmriMouseEvent event)
Invoked when the mouse exits 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)
Invoked when a mouse button has been pressed on a component.void
mouseReleased(JmriMouseEvent event)
Invoked when a mouse button has been released on a component.SwitchBoardLabelDisplays
nameDisplay()
Get the label type.protected void
paintTargetPanel(java.awt.Graphics g)
Called from TargetPanel's paint method for additional drawing by editor view.void
resetDirty()
Allow external reset of dirty bit.void
setAllEditable(boolean edit)
Control whether target panel items are editable.void
setAutoItemRange(boolean state)
Control whether range of items is automatically preserved.void
setDefaultActiveColor(java.awt.Color color)
void
setDefaultBackgroundColor(java.awt.Color color)
Load from xml and set bg color of _targetpanel as well as variable.void
setDefaultInactiveColor(java.awt.Color color)
void
setDefaultTextColor(java.awt.Color color)
void
setDirty()
void
setDirty(boolean val)
Allow external set of dirty bit.void
setHideUnconnected(boolean state)
Control whether target panel items without a connection to the layout are displayed.void
setIconScale(int size)
void
setLabel(SwitchBoardLabelDisplays label)
protected void
setMaxSpinner(int value)
protected void
setMinSpinner(int value)
void
setNextLocation(Positionable obj)
Set an object's location when it is created.void
setPanelMenuRangeMax(int rangemax)
Load Range maximum.void
setPanelMenuRangeMin(int rangemin)
Load Range minimum.void
setRows(int rws)
Load Switchboard rowsNum JSpinner.void
setShowUserName(java.lang.Boolean on)
Deprecated.void
setShowUserName(SwitchBoardLabelDisplays label)
void
setSwitchManu(java.lang.String manuPrefix)
Load connection type.void
setSwitchShape(java.lang.String switchShape)
Load switch shape.void
setSwitchType(java.lang.String prefix)
Load bean type from xml.void
setTitle()
void
setUseGlobalFlag(boolean set)
Set which flag should be used, global or local for Positioning and Control of individual items.java.lang.String
showUserName()
void
switchAllLights(int on)
Set connected Lights (only).protected void
targetWindowClosingEvent(java.awt.event.WindowEvent e)
The target window has been requested to close.void
updatePressed()
Create a new set of switches after removing the current array.void
windowClosing(java.awt.event.WindowEvent e)
Handle close of Editor window.void
windowOpened(java.awt.event.WindowEvent e)
Handle opening of Editor window.-
Methods inherited from class jmri.jmrit.display.Editor
actionPerformed, addAudioEditor, addBackgroundEditor, addBlockContentsEditor, addClock, addGlobalVariableEditor, addGlobalVariableInputBox, addGlobalVariableSpinner, addIconEditor, addLabel, addLeftTOEditor, addLight, addLightEditor, addLocoIcon, addLogixNGEditor, addMemoryEditor, addMemoryInputBox, addMemorySpinner, addMultiSensor, addMultiSensorEditor, addReporter, addReporterEditor, addRightTOEditor, addRpsReporter, addSensorEditor, addSignalHeadEditor, addSignalMastEditor, addSlipTOEditor, addTextEditor, addToPopUpMenu, addToTarget, addTrainIcon, addTurnout, allControlling, allPositionable, clearBackgroundColor, deletePanel, deselectSelectionGroup, displayLevelChange, dispose, 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, newPanelDefaults, positionalAddClass, positionalIdChange, positionalRemoveClass, putAudio, putBlockContents, putGlobalVariable, putIcon, putItem, putLocoIcon, putLogixNG, putMemory, putSensor, putSignalHead, putSignalMast, removeFromContents, removeFromTarget, removeMarkers, removeSelections, selectLoco, selectLoco, setAllControlling, setAllPositionable, setAllShowToolTip, setAttributes, setBackgroundColor, setDefaultToolTip, setDisplayLevelMenu, setEditClassesMenu, setEditIdMenu, setEmptyHiddenMenu, setGlobalSetsLocalFlag, setHiddenMenu, setLogixNGPositionableMenu, setPaintScale, setPanelMenuVisible, setPositionableMenu, setRemoveMenu, setScroll, setScroll, setSelectionsAttributes, setSelectionsDisplayLevel, setSelectionsDockingLocation, setSelectionsHidden, setSelectionsPositionable, setSelectionsRotation, setSelectionsScale, setShowAlignmentMenu, setShowCoordinatesMenu, setShowHidden, setShowToolTipMenu, setTargetPanel, setTargetPanelSize, setToolTip, setUpBackground, setValueEditDisabledMenu, showAlignPopup, showHidden, showToolTip, showToolTip, targetWindowClosing, useGlobalFlag, vetoableChange
-
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
-
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, 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, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
_menuBar
protected javax.swing.JMenuBar _menuBar
-
_fileMenu
protected javax.swing.JMenu _fileMenu
-
_optionMenu
protected javax.swing.JMenu _optionMenu
-
iconPrev
javax.swing.ImageIcon iconPrev
-
iconNext
javax.swing.ImageIcon iconNext
-
TURNOUT
static final java.lang.String TURNOUT
-
SENSOR
static final java.lang.String SENSOR
-
LIGHT
static final java.lang.String LIGHT
-
BUTTON
static final int BUTTON
- See Also:
- Constant Field Values
-
SLIDER
static final int SLIDER
- See Also:
- Constant Field Values
-
KEY
static final int KEY
- See Also:
- Constant Field Values
-
SYMBOL
static final int SYMBOL
- See Also:
- Constant Field Values
-
turnoutManager
protected TurnoutManager turnoutManager
-
sensorManager
protected SensorManager sensorManager
-
lightManager
protected LightManager lightManager
-
addressTextField
javax.swing.JTextField addressTextField
-
darkActiveColor
protected static final java.awt.Color darkActiveColor
-
darkInactiveColor
protected static final java.awt.Color darkInactiveColor
-
SIZE_MIN
static final int SIZE_MIN
- See Also:
- Constant Field Values
-
SIZE_INIT
static final int SIZE_INIT
- See Also:
- Constant Field Values
-
SIZE_MAX
static final int SIZE_MAX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SwitchboardEditor
public SwitchboardEditor()
Ctor
-
SwitchboardEditor
public SwitchboardEditor(java.lang.String name)
Ctor by a given name.- Parameters:
name
- title to assign to the new SwitchBoard
-
-
Method Detail
-
init
protected final void init(java.lang.String name)
Initialize the newly created Switchboard.
-
updatePressed
public void updatePressed()
Create a new set of switches after removing the current array.Called by Update button click, and automatically after loading a panel from XML (with all saved options set). Switchboard JPanel WindowResize() event is handled by resizeInFrame()
-
setMinSpinner
protected void setMinSpinner(int value)
-
setMaxSpinner
protected void setMaxSpinner(int value)
-
makeOptionMenu
protected void makeOptionMenu()
-
setDefaultTextColor
public void setDefaultTextColor(java.awt.Color color)
-
getDefaultTextColor
public java.lang.String getDefaultTextColor()
-
getDefaultTextColorAsColor
public java.awt.Color getDefaultTextColorAsColor()
-
getActiveSwitchColor
public java.lang.String getActiveSwitchColor()
-
getActiveColorAsColor
public java.awt.Color getActiveColorAsColor()
-
setDefaultActiveColor
public void setDefaultActiveColor(java.awt.Color color)
-
getInactiveSwitchColor
public java.lang.String getInactiveSwitchColor()
-
getInactiveColorAsColor
public java.awt.Color getInactiveColorAsColor()
-
setDefaultInactiveColor
public void setDefaultInactiveColor(java.awt.Color color)
-
setDefaultBackgroundColor
public void setDefaultBackgroundColor(java.awt.Color color)
Load from xml and set bg color of _targetpanel as well as variable.- Parameters:
color
- RGB Color for switchboard background and beanSwitches
-
getDefaultBackgroundColor
public java.awt.Color getDefaultBackgroundColor()
Get current default background color.- Returns:
- background color of this Switchboard
-
setLabel
public void setLabel(SwitchBoardLabelDisplays label)
-
setAllEditable
public void setAllEditable(boolean edit)
Description copied from class:Editor
Control whether target panel items are editable. Does this by invoke thePositionable.setEditable(boolean)
function of each item on the target panel. This also controls the relevant pop-up menu items (which are the primary way that items are edited).- Overrides:
setAllEditable
in classEditor
- Parameters:
edit
- true for editable.
-
setUseGlobalFlag
public void setUseGlobalFlag(boolean set)
Description copied from class:Editor
Set which flag should be used, global or local for Positioning and Control of individual items. Items call getFlag() to return the appropriate flag it should use.- Overrides:
setUseGlobalFlag
in classEditor
- Parameters:
set
- True if global flags should be used for positioning.
-
setHideUnconnected
public void setHideUnconnected(boolean state)
Control whether target panel items without a connection to the layout are displayed.- Parameters:
state
- true to hide all in range
-
hideUnconnected
public boolean hideUnconnected()
-
setAutoItemRange
public void setAutoItemRange(boolean state)
Control whether range of items is automatically preserved.- Parameters:
state
- true to calculate upper limit from lowest value range value set (default)
-
autoItemRange
public boolean autoItemRange()
-
resetDirty
public void resetDirty()
Allow external reset of dirty bit.
-
setDirty
public void setDirty(boolean val)
Allow external set of dirty bit.- Parameters:
val
- new dirty flag value, true dirty, false clean.
-
setDirty
public void setDirty()
-
isDirty
public boolean isDirty()
Check the dirty state.- Returns:
- true if panel changed, else false.
-
setPanelMenuRangeMin
public void setPanelMenuRangeMin(int rangemin)
Load Range minimum.- Parameters:
rangemin
- lowest address to show
-
setPanelMenuRangeMax
public void setPanelMenuRangeMax(int rangemax)
Load Range maximum.- Parameters:
rangemax
- highest address to show
-
getPanelMenuRangeMin
public int getPanelMenuRangeMin()
Store Range minimum.- Returns:
- lowest address shown
-
getPanelMenuRangeMax
public int getPanelMenuRangeMax()
Store Range maximum.- Returns:
- highest address shown
-
getSwitchType
public java.lang.String getSwitchType()
Store bean type.- Returns:
- bean type prefix as set for Switchboard
-
getSwitchTypeName
public java.lang.String getSwitchTypeName()
Get bean type name.- Returns:
- bean type name
-
setSwitchType
public void setSwitchType(java.lang.String prefix)
Load bean type from xml.- Parameters:
prefix
- the bean type prefix
-
getSwitchManu
public java.lang.String getSwitchManu()
Store connection type.- Returns:
- active bean connection prefix
-
setSwitchManu
public void setSwitchManu(java.lang.String manuPrefix)
Load connection type.- Parameters:
manuPrefix
- connection prefix
-
getSwitchShape
public java.lang.String getSwitchShape()
Store switch shape.- Returns:
- bean shape prefix
-
setSwitchShape
public void setSwitchShape(java.lang.String switchShape)
Load switch shape.- Parameters:
switchShape
- name of switch shape
-
getRows
public int getRows()
Store Switchboard rowsNum JSpinner or turn on autoRows option.- Returns:
- the number of switches to display per row or 0 if autoRowsBox (menu-setting) is selected
-
setRows
public void setRows(int rws)
Load Switchboard rowsNum JSpinner.- Parameters:
rws
- the number of switches displayed per row (as text) or 0 te activate autoRowsBox setting
-
getTotal
public int getTotal()
Store total number of switches displayed (unconnected/hidden excluded).- Returns:
- the total number of switches displayed
-
loadComplete
public void loadComplete()
-
showUserName
public java.lang.String showUserName()
-
nameDisplay
public SwitchBoardLabelDisplays nameDisplay()
Get the label type.- Returns:
- current setting of display type (e.g. system name, both, user name)
-
setShowUserName
@Deprecated public void setShowUserName(java.lang.Boolean on)
Deprecated.Initial, simple boolean label option- Parameters:
on
- true to show both system and user name on the switch label
-
setShowUserName
public void setShowUserName(SwitchBoardLabelDisplays label)
-
initView
public void initView()
After construction, initialize all the widgets to their saved config settings.
-
getManager
protected Manager<?> getManager(char typeChar)
-
getManager
protected Manager<?> getManager()
Get the currently active manager.- Returns:
- manager in use for the currently selected bean type and connection
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
KeyListener of Editor.- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
- Overrides:
keyPressed
in classEditor
- Parameters:
e
- the key event heard
-
mousePressed
public void mousePressed(JmriMouseEvent event)
Description copied from interface:JmriMouseListener
Invoked when a mouse button has been pressed on a component.- Specified by:
mousePressed
in interfaceJmriMouseListener
- Specified by:
mousePressed
in classEditor
- Parameters:
event
- the event to be processed
-
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
- Specified by:
mouseReleased
in classEditor
- Parameters:
event
- the event to be processed
-
mouseClicked
public void mouseClicked(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
- Specified by:
mouseClicked
in classEditor
- Parameters:
event
- the event to be processed
-
mouseDragged
public void mouseDragged(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
- Specified by:
mouseDragged
in classEditor
- Parameters:
event
- the event to be processed
-
mouseMoved
public void mouseMoved(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
- Specified by:
mouseMoved
in classEditor
- Parameters:
event
- the event to be processed
-
mouseEntered
public void mouseEntered(JmriMouseEvent event)
Description copied from interface:JmriMouseListener
Invoked when the mouse enters a component.- Specified by:
mouseEntered
in interfaceJmriMouseListener
- Specified by:
mouseEntered
in classEditor
- Parameters:
event
- the event to be processed
-
mouseExited
public void mouseExited(JmriMouseEvent event)
Description copied from interface:JmriMouseListener
Invoked when the mouse exits a component.- Specified by:
mouseExited
in interfaceJmriMouseListener
- Specified by:
mouseExited
in classEditor
- Parameters:
event
- the event to be processed
-
windowClosing
public void windowClosing(java.awt.event.WindowEvent e)
Handle close of Editor window.Overload/override method in JmriJFrame parent, which by default is permanently closing the window. Here, we just want to make it invisible, so we don't dispose it (yet).
- Specified by:
windowClosing
in interfacejava.awt.event.WindowListener
- Overrides:
windowClosing
in classJmriJFrame
-
windowOpened
public void windowOpened(java.awt.event.WindowEvent e)
Handle opening of Editor window.Overload/override method in JmriJFrame parent to reset _menuBar.
- Specified by:
windowOpened
in interfacejava.awt.event.WindowListener
- Overrides:
windowOpened
in classJmriJFrame
-
targetWindowClosingEvent
protected void targetWindowClosingEvent(java.awt.event.WindowEvent e)
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.- Specified by:
targetWindowClosingEvent
in classEditor
-
changeView
protected Editor changeView(java.lang.String className)
changeView is not supported by SwitchBoards.- Overrides:
changeView
in classEditor
-
makeFrame
public JmriJFrame makeFrame(java.lang.String name)
Create sequence of panels, etc. for switches: JFrame contains its ContentPane which contains a JPanel with BoxLayout (p1) which contains a JScrollPane (js) which contains the targetPane. Note this is a private menuBar, looking identical to the Editor's _menuBar- Parameters:
name
- title for the Switchboard.- Returns:
- frame containing the switchboard editor.
-
paintTargetPanel
protected void paintTargetPanel(java.awt.Graphics g)
Description copied from class:Editor
Called from TargetPanel's paint method for additional drawing by editor view.- Specified by:
paintTargetPanel
in classEditor
- Parameters:
g
- the context to paint within
-
getSwitch
protected BeanSwitch getSwitch(java.lang.String sName)
Get a beanSwitch object from this SwitchBoard panel by a given name.- Parameters:
sName
- name of switch label/connected bean- Returns:
- BeanSwitch switch object with the given name
-
getSwitches
public java.util.List<BeanSwitch> getSwitches()
Get a list with copies of BeanSwitch objects currently displayed to transfer to Web Server for display.- Returns:
- list of all BeanSwitch switch object
-
copyItem
protected void copyItem(Positionable p)
Set up item(s) to be copied by paste.Not used on switchboards but has to override Editor.
-
setNextLocation
public void setNextLocation(Positionable obj)
Set an object's location when it is created.Not used on switchboards but has to override Editor.
- Specified by:
setNextLocation
in classEditor
- Parameters:
obj
- object to position
-
getSelectionGroup
protected java.util.ArrayList<Positionable> getSelectionGroup()
-
getUsageReport
public java.util.List<NamedBeanUsageReport> getUsageReport(NamedBean bean)
- Overrides:
getUsageReport
in classEditor
-
getTileSize
public int getTileSize()
-
switchAllLights
public void switchAllLights(int on)
Set connected Lights (only).- Parameters:
on
- state to set Light.ON or Light.OFF
-
configureManagerComboBoxes
protected void configureManagerComboBoxes()
Configure the combo box listing managers. Adapted from AbstractTableAction.
-
displayManagerComboBoxes
protected void displayManagerComboBoxes(java.lang.String type)
Show only one of the manuf (manager) combo boxes.- Parameters:
type
- one of the three NamedBean types as String
-
setIconScale
public void setIconScale(int size)
-
getIconScale
public int getIconScale()
-
-