jmri.jmrit.display.panelEditor
Class PanelEditor

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

public class PanelEditor
extends Editor
implements ItemListener

Provides a simple editor for adding jmri.jmrit.display items to a captive JFrame.

GUI is structured as a band of common parameters across the top, then a series of things you can add.

All created objects are put specific levels depending on their type (higher levels are in front):

The "contents" List keeps track of all the objects added to the target frame for later manipulation.

If you close the Editor window, the target is left alone and the editor window is just hidden, not disposed. If you close the target, the editor and target are removed, and dispose is run. To make this logic work, the PanelEditor is descended from a JFrame, not a JPanel. That way it can control its own visibility.

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

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

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrit.display.Editor
Editor.JFrameItem, Editor.TargetPane
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 boolean _debug
           
protected  ArrayList<Positionable> _multiItemCopyGroup
           
protected  boolean addItemViaMouseClick
           
protected  boolean pasteItemFlag
           
 
Fields inherited from class jmri.jmrit.display.Editor
_anchorX, _anchorY, _contents, _currentSelection, _dragging, _editable, _highlightcomponent, _lastX, _lastY, _paintScale, _pastePending, _scrollState, _selectionGroup, _selectRect, _targetPanel, BKG, CLOCK, 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
PanelEditor()
           
PanelEditor(String name)
           
 
Method Summary
protected  void addColorMenuEntry(JMenu menu, ButtonGroup colorButtonGroup, String name, Color color)
           
protected  void addItemPopUp(jmri.jmrit.display.panelEditor.PanelEditor.ComboBoxItem item, JMenu menu)
           
protected  void backgroundPopUp(MouseEvent event)
           
protected  void copyItem(Positionable p)
          set up item(s) to be copied by paste
protected  void init(String name)
           
 void initView()
          After construction, initialize all the widgets to their saved config settings.
 void itemStateChanged(ItemEvent e)
           
protected  void makeColorMenu(JMenu colorMenu)
           
 JmriJFrame makeFrame(String name)
          Create sequence of panels, etc, for layout: JFrame contains its ContentPane which contains a JPanel with BoxLayout (p1) which contains a JScollPane (js) which contains the targetPane
 void mouseClicked(MouseEvent event)
           
 void mouseDragged(MouseEvent event)
           
 void mouseEntered(MouseEvent event)
           
 void mouseExited(MouseEvent event)
           
 void mouseMoved(MouseEvent event)
           
 void mousePressed(MouseEvent event)
          Abstract Methods
 void mouseReleased(MouseEvent event)
           
protected  void paintTargetPanel(Graphics g)
          Called from TargetPanel's paint method for additional drawing by editor view
protected  void pasteItem(MouseEvent e)
           
protected  void pasteItemPopUp(MouseEvent event)
           
 void putItem(Positionable l)
           
 void setBackgroundMenu(JPopupMenu popup)
           
protected  void setColorButton(Color color, Color buttonColor, JRadioButtonMenuItem r)
           
protected  void setNextLocation(Positionable obj)
          Set an object's location when it is created.
 void setRemoveMenu(Positionable p, JPopupMenu popup)
          Add an action to remove the Positionable item.
protected  void showAddItemPopUp(MouseEvent event, JPopupMenu popup)
           
protected  void showMultiSelectPopUp(MouseEvent event, Positionable p)
           
protected  void showPopUp(Positionable p, MouseEvent event)
          Create popup for a Positionable object Popup items common to all positionable objects are done before and after the items that pertain only to specific Positionable types.
protected  void targetWindowClosingEvent(WindowEvent e)
          The target window has been requested to close, don't delete it at this time.
 void windowClosing(WindowEvent e)
          Handle close of editor window.
 
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, getSelectedItems, getSignalHeadEditor, getTargetFrame, getTargetPanel, getTargetPanelSize, isEditable, keyPressed, keyReleased, keyTyped, loadFailed, loadFailed, loadOK, locoMarkerFromInput, locoMarkerFromRoster, makeAddIconFrame, makePalette, makeSelectionGroup, modifySelectionGroup, moveItem, putIcon, putLocoIcon, putMemory, putSensor, putSignalHead, putSignalMast, removeFromContents, removeFromTarget, removeMarkers, removeSelections, selectLoco, setAllControlling, setAllEditable, setAllPositionable, setAllShowTooltip, setAttributes, setBackgroundColor, setDefaultToolTip, setDisplayLevelMenu, setGlobalSetsLocalFlag, setHiddenMenu, setPaintScale, setPanelMenu, setPositionableMenu, setScroll, setScroll, setSelectionsAttributes, setSelectionsHidden, setSelectionsPositionable, setSelectionsRotation, setSelectionsScale, setShowAlignmentMenu, setShowCoordinatesMenu, setShowHidden, setShowTooltipMenu, setTargetPanel, setTargetPanelSize, setTextAttributes, setTitle, setToolTip, setUpBackground, setUseGlobalFlag, 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, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

_debug

public boolean _debug

_multiItemCopyGroup

protected ArrayList<Positionable> _multiItemCopyGroup

addItemViaMouseClick

protected boolean addItemViaMouseClick

pasteItemFlag

protected boolean pasteItemFlag
Constructor Detail

PanelEditor

public PanelEditor()

PanelEditor

public PanelEditor(String name)
Method Detail

init

protected void init(String name)
Specified by:
init in class Editor

initView

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

Specified by:
initView in class Editor

itemStateChanged

public void itemStateChanged(ItemEvent e)
Specified by:
itemStateChanged in interface ItemListener

windowClosing

public void windowClosing(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 interface WindowListener
Overrides:
windowClosing in class JmriJFrame

makeFrame

public JmriJFrame makeFrame(String name)
Create sequence of panels, etc, for layout: JFrame contains its ContentPane which contains a JPanel with BoxLayout (p1) which contains a JScollPane (js) which contains the targetPane


targetWindowClosingEvent

protected void targetWindowClosingEvent(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 class Editor

paintTargetPanel

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

Specified by:
paintTargetPanel in class Editor

setNextLocation

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

Specified by:
setNextLocation in class Editor

showPopUp

protected void showPopUp(Positionable p,
                         MouseEvent event)
Create popup for a Positionable object Popup items common to all positionable objects are done before and after the items that pertain only to specific Positionable types.

Specified by:
showPopUp in class Editor

mousePressed

public void mousePressed(MouseEvent event)
Description copied from class: Editor
Abstract Methods

Specified by:
mousePressed in interface MouseListener
Specified by:
mousePressed in class Editor

mouseReleased

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

mouseDragged

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

mouseMoved

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

mouseClicked

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

mouseEntered

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

mouseExited

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

copyItem

protected void copyItem(Positionable p)
Description copied from class: Editor
set up item(s) to be copied by paste

Specified by:
copyItem in class Editor

pasteItemPopUp

protected void pasteItemPopUp(MouseEvent event)

backgroundPopUp

protected void backgroundPopUp(MouseEvent event)

showMultiSelectPopUp

protected void showMultiSelectPopUp(MouseEvent event,
                                    Positionable p)

showAddItemPopUp

protected void showAddItemPopUp(MouseEvent event,
                                JPopupMenu popup)

addItemPopUp

protected void addItemPopUp(jmri.jmrit.display.panelEditor.PanelEditor.ComboBoxItem item,
                            JMenu menu)

putItem

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

pasteItem

protected void pasteItem(MouseEvent e)

setRemoveMenu

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

Overrides:
setRemoveMenu in class Editor

setBackgroundMenu

public void setBackgroundMenu(JPopupMenu popup)

makeColorMenu

protected void makeColorMenu(JMenu colorMenu)

addColorMenuEntry

protected void addColorMenuEntry(JMenu menu,
                                 ButtonGroup colorButtonGroup,
                                 String name,
                                 Color color)

setColorButton

protected void setColorButton(Color color,
                              Color buttonColor,
                              JRadioButtonMenuItem r)


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