jmri.jmrit.display
Class PositionableJPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by jmri.jmrit.display.PositionableJPanel
All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, Cloneable, EventListener, Accessible, Positionable
Direct Known Subclasses:
MemoryInputIcon, MemorySpinnerIcon, SecurityElementIcon

public class PositionableJPanel
extends JPanel
implements Positionable, MouseListener, MouseMotionListener

Author:
Bob Jacobsen copyright (C) 2009
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
protected  Editor _editor
           
protected  boolean debug
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PositionableJPanel(Editor editor)
           
 
Method Summary
 Positionable deepClone()
          Make a deep copy of Positional object.
 void doMouseClicked(MouseEvent event)
           
 void doMouseDragged(MouseEvent event)
           
 void doMouseEntered(MouseEvent event)
           
 void doMouseExited(MouseEvent event)
           
 void doMouseMoved(MouseEvent event)
           
 void doMousePressed(MouseEvent event)
           
 void doMouseReleased(MouseEvent event)
           
 boolean doViemMenu()
          Use the 'Standard' presentation of the popup menu items.
 Positionable finishClone(Positionable pos)
          Finsh the deep Copy of a Positional object.
 int getDegrees()
           
 int getDisplayLevel()
           
 Editor getEditor()
           
 String getNameString()
          Methods to add popup menu items return true if a popup item is set
 PositionablePopupUtil getPopupUtility()
           
 double getScale()
           
 ToolTip getTooltip()
           
 boolean getViewCoordinates()
           
 boolean isActive()
          "active" means that the object is still displayed, and should be stored.
 boolean isControlling()
           
 boolean isEditable()
           
 boolean isHidden()
           
 boolean isPositionable()
           
protected  void makeIconEditorFrame(Container pos, String name, boolean table, IconAdder editor)
          Utility
 int maxHeight()
           
 int maxWidth()
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void remove()
          Removes this object from display and persistance
 void rotate(int deg)
           
 void setControlling(boolean enabled)
           
 boolean setDisableControlMenu(JPopupMenu popup)
           
 void setDisplayLevel(int l)
           
 void setEditable(boolean enabled)
           
 boolean setEditIconMenu(JPopupMenu popup)
           
 boolean setEditItemMenu(JPopupMenu popup)
           
 void setEditor(Editor ed)
           
 void setHidden(boolean hide)
           
 void setLevel(int l)
          Delayed setDisplayLevel for DnD
 void setPopupUtility(PositionablePopupUtil tu)
           
 void setPositionable(boolean enabled)
           
 boolean setRotateMenu(JPopupMenu popup)
           
 boolean setRotateOrthogonalMenu(JPopupMenu popup)
          For over-riding in the using classes: add item specific menu choices
 void setScale(double s)
           
 boolean setScaleMenu(JPopupMenu popup)
           
 void setShowTooltip(boolean set)
           
 boolean setTextEditMenu(JPopupMenu popup)
           
 void setTooltip(ToolTip tip)
           
 void setViewCoordinates(boolean enabled)
           
 void showHidden()
           
 boolean showPopUp(JPopupMenu popup)
           
 boolean showTooltip()
           
 boolean storeItem()
          Store a permanent copy of this Positionable The editorXml will call this method to find out whether it should store this Positionable item.
 void updateSize()
          Update the AWT and Swing size information due to change in internal state, e.g. if one or more of the icons that might be displayed is changed
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, 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 jmri.jmrit.display.Positionable
contains, getBackground, getBounds, getFont, getForeground, getHeight, getLocation, getParent, getPreferredSize, getWidth, getX, getY, invalidate, isOpaque, repaint, setBackground, setBorder, setForeground, setLocation, setLocation, setOpaque, setSize, setVisible
 

Field Detail

_editor

protected Editor _editor

debug

protected boolean debug
Constructor Detail

PositionableJPanel

public PositionableJPanel(Editor editor)
Method Detail

deepClone

public Positionable deepClone()
Description copied from interface: Positionable
Make a deep copy of Positional object. Implementation should create a new object and immediately pass the object to finishClone() returning the result of finishClone(). i.e. implementation must be: public Positionable deepClone() { Subtype t = new Subtype(); return finishClone(t); }

Specified by:
deepClone in interface Positionable

finishClone

public Positionable finishClone(Positionable pos)
Description copied from interface: Positionable
Finsh the deep Copy of a Positional object. Implementation should make deep copies of the additional members of this sub class and then pass Positionable p to super.finishClone(). i.e. implementation must terminate with statement return super.finishClone(p); See IndicatorTurnoutIcon extends TurnoutIcon extends PositionableLabel for an example of how to continue deep cloning a chain of subclasses.

Specified by:
finishClone in interface Positionable

setPositionable

public void setPositionable(boolean enabled)
Specified by:
setPositionable in interface Positionable

isPositionable

public boolean isPositionable()
Specified by:
isPositionable in interface Positionable

setEditable

public void setEditable(boolean enabled)
Specified by:
setEditable in interface Positionable

isEditable

public boolean isEditable()
Specified by:
isEditable in interface Positionable

setViewCoordinates

public void setViewCoordinates(boolean enabled)
Specified by:
setViewCoordinates in interface Positionable

getViewCoordinates

public boolean getViewCoordinates()
Specified by:
getViewCoordinates in interface Positionable

setControlling

public void setControlling(boolean enabled)
Specified by:
setControlling in interface Positionable

isControlling

public boolean isControlling()
Specified by:
isControlling in interface Positionable

setHidden

public void setHidden(boolean hide)
Specified by:
setHidden in interface Positionable

isHidden

public boolean isHidden()
Specified by:
isHidden in interface Positionable

showHidden

public void showHidden()
Specified by:
showHidden in interface Positionable

setLevel

public void setLevel(int l)
Delayed setDisplayLevel for DnD


setDisplayLevel

public void setDisplayLevel(int l)
Specified by:
setDisplayLevel in interface Positionable

getDisplayLevel

public int getDisplayLevel()
Specified by:
getDisplayLevel in interface Positionable

setShowTooltip

public void setShowTooltip(boolean set)
Specified by:
setShowTooltip in interface Positionable

showTooltip

public boolean showTooltip()
Specified by:
showTooltip in interface Positionable

setTooltip

public void setTooltip(ToolTip tip)
Specified by:
setTooltip in interface Positionable

getTooltip

public ToolTip getTooltip()
Specified by:
getTooltip in interface Positionable

setScale

public void setScale(double s)
Specified by:
setScale in interface Positionable

getScale

public double getScale()
Specified by:
getScale in interface Positionable

rotate

public void rotate(int deg)
Specified by:
rotate in interface Positionable

getDegrees

public int getDegrees()
Specified by:
getDegrees in interface Positionable

getNameString

public String getNameString()
Description copied from interface: Positionable
Methods to add popup menu items return true if a popup item is set

Specified by:
getNameString in interface Positionable

getEditor

public Editor getEditor()
Specified by:
getEditor in interface Positionable

setEditor

public void setEditor(Editor ed)
Specified by:
setEditor in interface Positionable

doMousePressed

public void doMousePressed(MouseEvent event)
Specified by:
doMousePressed in interface Positionable

doMouseReleased

public void doMouseReleased(MouseEvent event)
Specified by:
doMouseReleased in interface Positionable

doMouseClicked

public void doMouseClicked(MouseEvent event)
Specified by:
doMouseClicked in interface Positionable

doMouseDragged

public void doMouseDragged(MouseEvent event)
Specified by:
doMouseDragged in interface Positionable

doMouseMoved

public void doMouseMoved(MouseEvent event)
Specified by:
doMouseMoved in interface Positionable

doMouseEntered

public void doMouseEntered(MouseEvent event)
Specified by:
doMouseEntered in interface Positionable

doMouseExited

public void doMouseExited(MouseEvent event)
Specified by:
doMouseExited in interface Positionable

storeItem

public boolean storeItem()
Description copied from interface: Positionable
Store a permanent copy of this Positionable The editorXml will call this method to find out whether it should store this Positionable item.

Specified by:
storeItem in interface Positionable
Returns:
true if the Editor should store this in the configuration file

doViemMenu

public boolean doViemMenu()
Description copied from interface: Positionable
Use the 'Standard' presentation of the popup menu items. The editor will call this method to find out whether it should creates any popup viewing menu items.

Specified by:
doViemMenu in interface Positionable
Returns:
true if Editor may add the standardpopup menu items

setRotateOrthogonalMenu

public boolean setRotateOrthogonalMenu(JPopupMenu popup)
For over-riding in the using classes: add item specific menu choices

Specified by:
setRotateOrthogonalMenu in interface Positionable

setRotateMenu

public boolean setRotateMenu(JPopupMenu popup)
Specified by:
setRotateMenu in interface Positionable

setScaleMenu

public boolean setScaleMenu(JPopupMenu popup)
Specified by:
setScaleMenu in interface Positionable

setDisableControlMenu

public boolean setDisableControlMenu(JPopupMenu popup)
Specified by:
setDisableControlMenu in interface Positionable

setTextEditMenu

public boolean setTextEditMenu(JPopupMenu popup)
Specified by:
setTextEditMenu in interface Positionable

showPopUp

public boolean showPopUp(JPopupMenu popup)
Specified by:
showPopUp in interface Positionable

setEditIconMenu

public boolean setEditIconMenu(JPopupMenu popup)
Specified by:
setEditIconMenu in interface Positionable

setEditItemMenu

public boolean setEditItemMenu(JPopupMenu popup)
Specified by:
setEditItemMenu in interface Positionable

makeIconEditorFrame

protected void makeIconEditorFrame(Container pos,
                                   String name,
                                   boolean table,
                                   IconAdder editor)
Utility


remove

public void remove()
Removes this object from display and persistance

Specified by:
remove in interface Positionable

isActive

public boolean isActive()
"active" means that the object is still displayed, and should be stored.


mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

setPopupUtility

public void setPopupUtility(PositionablePopupUtil tu)
Specified by:
setPopupUtility in interface Positionable

getPopupUtility

public PositionablePopupUtil getPopupUtility()
Specified by:
getPopupUtility in interface Positionable

updateSize

public void updateSize()
Update the AWT and Swing size information due to change in internal state, e.g. if one or more of the icons that might be displayed is changed

Specified by:
updateSize in interface Positionable

maxWidth

public int maxWidth()
Specified by:
maxWidth in interface Positionable

maxHeight

public int maxHeight()
Specified by:
maxHeight in interface Positionable


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