jmri.jmrit.display.controlPanelEditor
Class CircuitBuilder

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

public class CircuitBuilder
extends ControlPanelEditor
implements DropTargetListener

Author:
Pete Cressman Copyright: Copyright (c) 2011
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrit.display.controlPanelEditor.ControlPanelEditor
ControlPanelEditor.PositionableListDnD
 
Nested classes/interfaces inherited from class jmri.jmrit.display.Editor
Editor.JFrameItem, Editor.TargetPane
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static Color _editGroupColor
           
static Color _highlightColor
           
static Color _pathColor
           
static ResourceBundle rbcp
           
 
Fields inherited from class jmri.jmrit.display.controlPanelEditor.ControlPanelEditor
_debug, _editMenu, _fileMenu, _iconMenu, _menuBar, _optionMenu, _zoomMenu, POSITIONABLE_LIST_FLAVOR
 
Fields inherited from class jmri.jmrit.display.Editor
_anchorX, _anchorY, _contents, _currentSelection, _dragging, _editable, _highlightcomponent, _lastX, _lastY, _paintScale, _pastePending, _scrollState, _selectionGroup, _selectRect, _targetPanel, BKG, CLOCK, defaultBackgroundColor, frameLocationX, frameLocationY, ICON_EDITORS, ICONS, LABELS, LIGHTS, MARKERS, MEMORIES, NUM_LEVELS, OPTION_CONTROLS, OPTION_HIDDEN, OPTION_POSITION, OPTION_TOOLTIP, POSITIONABLE_FLAVOR, rb, rbean, REPORTERS, SCROLL_BOTH, SCROLL_HORIZONTAL, SCROLL_NONE, SCROLL_VERTICAL, SECURITY, SENSORS, SIGNALS, TEMP, TURNOUTS, xLoc, yLoc
 
Fields inherited from class jmri.util.JmriJFrame
reuseFrameSavedPosition, reuseFrameSavedSized
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CircuitBuilder()
           
CircuitBuilder(String name)
           
 
Method Summary
protected  void closeCircuitFrame(OBlock block)
          Update block data in menus
protected  void closePathFrame(OBlock block)
           
protected  void closePortalFrame(OBlock block)
           
protected  void convertIcon(Positionable pos)
           
protected  void convertIcons()
           
protected static void doSize(JComponent comp, int max, int min)
          static methods
protected  void editCircuit(String title)
           
protected  void editCircuitPaths(String title)
           
protected  void editPortals(String title)
           
protected  OBlock getBlock(Positionable pos)
          Used by Portal Frame
protected  List<Positionable> getCircuitGroup()
          Used by Path Frame
protected  List<Positionable> getCircuitIcons(OBlock block)
          Used by Portal Frame
protected  Hashtable<String,PortalIcon> getPortalIconMap()
          Used by Portal Frame and Path Frame
protected  List<Positionable> getSelectedItems(MouseEvent event)
          Return a List of all items whose bounding rectangle contain the mouse position.
protected  List<Positionable> getSelectionGroup()
          Used by Path Frame
protected  void highlight(Positionable pos)
           
protected  boolean iconsConverted()
          Check if the block being edited has all its icons converted to indicator icons
protected  void init()
          Second init needed because changeView() must call init(String name) before contents are transferred to this editor.
protected  void init(String name)
           
protected  boolean isTrack(Positionable pos)
           
protected static JPanel makeBoxPanel(boolean vertical, JComponent textField, String label, String tooltip)
           
protected static JPanel makeTextBoxPanel(boolean vertical, JTextField textField, String label, boolean editable, String tooltip)
           
protected  void modifySelectionGroup(Positionable selection, MouseEvent event)
           
 void mouseDragged(MouseEvent event)
          No dragging when editing
 void mousePressed(MouseEvent event)
          Keep selections when editing.
 void mouseReleased(MouseEvent event)
           
protected  void newCircuit()
          Set up editing Frames
 void paintTargetPanel(Graphics g)
          Overriden methods of Editor
protected  void removeBlock(OBlock block)
          Remove block, but keep the track icons.
 void setAllEditable(boolean state)
          Control whether target panel items are editable.
protected  void setEditColors(boolean highlight)
           
 
Methods inherited from class jmri.jmrit.display.controlPanelEditor.ControlPanelEditor
copyItem, dragEnter, dragExit, dragOver, drop, dropActionChanged, getClipGroup, getCopySelection, getCurrentSelection, initView, loadComplete, lostOwnership, makeDataFlavors, makeEditMenu, makeIconMenu, makeOptionMenu, makePalette, makeZoomMenu, mouseClicked, mouseEntered, mouseExited, mouseMoved, setCopyMenu, setNextLocation, setTitle, setUseGlobalFlag, showPopUp, targetWindowClosingEvent
 
Methods inherited from class jmri.jmrit.display.Editor
actionPerformed, addBackgroundEditor, addClock, addIconEditor, addLabel, addLeftTOEditor, addLight, addLightEditor, addLocoIcon, addMemoryEditor, addMemoryInputBox, addMemorySpinner, addMultiSensor, addMultiSensorEditor, addReporter, addReporterEditor, addRightTOEditor, addRpsReporter, addSensorEditor, addSignalHeadEditor, addSignalMastEditor, addSlipTOEditor, addTextEditor, addToTarget, addTrainIcon, addTreeToEditors, addTurnout, alignGroup, allControlling, allPositionable, changeView, clearBackgroundColor, deletePanel, displayLevelChange, dispose, disposeLoadData, drawSelectRect, getAnchorX, getAnchorY, getBackgroundColor, getContents, getFlag, getIconEditor, getIconEditors, getIconFrame, getItemX, getItemY, getPaintScale, getPanelScrollPane, getScrollable, getSignalHeadEditor, getTargetFrame, getTargetPanel, getTargetPanelSize, isEditable, keyPressed, keyReleased, keyTyped, loadFailed, loadFailed, loadOK, locoMarkerFromInput, locoMarkerFromRoster, makeAddIconFrame, makeSelectionGroup, moveItem, putIcon, putItem, putLocoIcon, putMemory, putSensor, putSignalHead, putSignalMast, removeFromContents, removeFromTarget, removeMarkers, removeSelections, selectLoco, setAllControlling, setAllPositionable, setAllShowTooltip, setAttributes, setBackgroundColor, setDefaultToolTip, setDisplayLevelMenu, setGlobalSetsLocalFlag, setHiddenMenu, setPaintScale, setPanelMenu, setPositionableMenu, setRemoveMenu, setScroll, setScroll, setSelectionsAttributes, setSelectionsHidden, setSelectionsPositionable, setSelectionsRotation, setSelectionsScale, setShowAlignmentMenu, setShowCoordinatesMenu, setShowHidden, setShowTooltipMenu, setTargetPanel, setTargetPanelSize, setTextAttributes, setToolTip, setUpBackground, showAlignPopup, showHidden, showTooltip, showToolTip, targetWindowClosing, useGlobalFlag
 
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, addNotify, componentHidden, componentMoved, componentResized, componentShown, dispose, generateWindowRef, getFrame, getFrameList, getMaximumSize, getModifiedFlag, getPreferredSize, getSavePosition, getSaveSize, getWindowFrameRef, handleModified, initComponents, markWindowModified, pack, setModifiedFlag, setSavePosition, setSaveSize, setShutDownTask, storeValues, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.dnd.DropTargetListener
dragEnter, dragExit, dragOver, drop, dropActionChanged
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

rbcp

public static final ResourceBundle rbcp

_editGroupColor

public static final Color _editGroupColor

_pathColor

public static final Color _pathColor

_highlightColor

public static final Color _highlightColor
Constructor Detail

CircuitBuilder

public CircuitBuilder()

CircuitBuilder

public CircuitBuilder(String name)
Method Detail

init

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

init

protected void init()
Second init needed because changeView() must call init(String name) before contents are transferred to this editor.


newCircuit

protected void newCircuit()
Set up editing Frames


editCircuit

protected void editCircuit(String title)

editPortals

protected void editPortals(String title)

editCircuitPaths

protected void editCircuitPaths(String title)

closeCircuitFrame

protected void closeCircuitFrame(OBlock block)
Update block data in menus


closePathFrame

protected void closePathFrame(OBlock block)

closePortalFrame

protected void closePortalFrame(OBlock block)

getSelectionGroup

protected List<Positionable> getSelectionGroup()
Used by Path Frame


getCircuitIcons

protected List<Positionable> getCircuitIcons(OBlock block)
Used by Portal Frame


getBlock

protected OBlock getBlock(Positionable pos)
Used by Portal Frame


getCircuitGroup

protected List<Positionable> getCircuitGroup()
Used by Path Frame


getPortalIconMap

protected Hashtable<String,PortalIcon> getPortalIconMap()
Used by Portal Frame and Path Frame


highlight

protected void highlight(Positionable pos)

removeBlock

protected void removeBlock(OBlock block)
Remove block, but keep the track icons. Set block reference in icon null


setEditColors

protected void setEditColors(boolean highlight)

paintTargetPanel

public void paintTargetPanel(Graphics g)
Overriden methods of Editor

Overrides:
paintTargetPanel in class ControlPanelEditor

setAllEditable

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

Overrides:
setAllEditable in class ControlPanelEditor
Parameters:
state - true for editable.

iconsConverted

protected boolean iconsConverted()
Check if the block being edited has all its icons converted to indicator icons


convertIcons

protected void convertIcons()

convertIcon

protected void convertIcon(Positionable pos)

isTrack

protected boolean isTrack(Positionable pos)

mousePressed

public void mousePressed(MouseEvent event)
Keep selections when editing. Restore what super nulls

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

mouseReleased

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

mouseDragged

public void mouseDragged(MouseEvent event)
No dragging when editing

Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class ControlPanelEditor

getSelectedItems

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

Overrides:
getSelectedItems in class Editor

modifySelectionGroup

protected void modifySelectionGroup(Positionable selection,
                                    MouseEvent event)
Overrides:
modifySelectionGroup in class Editor

doSize

protected static void doSize(JComponent comp,
                             int max,
                             int min)
static methods


makeTextBoxPanel

protected static JPanel makeTextBoxPanel(boolean vertical,
                                         JTextField textField,
                                         String label,
                                         boolean editable,
                                         String tooltip)

makeBoxPanel

protected static JPanel makeBoxPanel(boolean vertical,
                                     JComponent textField,
                                     String label,
                                     String tooltip)


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

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