Interface Positionable
-
- All Superinterfaces:
java.lang.Cloneable
,InlineLogixNG
- All Known Subinterfaces:
IndicatorTrack
- All Known Implementing Classes:
AnalogClock2Display
,AudioIcon
,BlockContentsIcon
,BlockContentsIcon
,GlobalVariableComboIcon
,GlobalVariableIcon
,GlobalVariableIcon
,GlobalVariableInputIcon
,GlobalVariableSpinnerIcon
,IndicatorTrackIcon
,IndicatorTurnoutIcon
,LightIcon
,LinkingLabel
,LocoIcon
,LocoLabel
,LogixNGIcon
,MemoryComboIcon
,MemoryIcon
,MemoryIcon
,MemoryInputIcon
,MemoryOrGVComboIcon
,MemoryOrGVIcon
,MemorySpinnerIcon
,MultiSensorIcon
,PortalIcon
,PositionableCircle
,PositionableEllipse
,PositionableIcon
,PositionableJComponent
,PositionableJPanel
,PositionableLabel
,PositionablePolygon
,PositionableRectangle
,PositionableRoundRect
,PositionableShape
,ReporterIcon
,RpsPositionIcon
,SensorIcon
,SignalHeadIcon
,SignalMastIcon
,SlipTurnoutIcon
,TrainIcon
,TurnoutIcon
public interface Positionable extends java.lang.Cloneable, InlineLogixNG
Defines display objects.These are capable of:
- Being positioned by being dragged around on the screen. (See
setPositionable(boolean)
) - Being hidden. (See
setHidden(boolean)
) - Controlling the layout. (See
setControlling(boolean)
)
These are manipulated externally, for example by a subclass of
Editor
. They are generally not stored directly as part of the state of the object, though they could be, but as part of the state of the external control.Instead of the usual MouseEvent handling methods, e.g mouseClicked(...), Positionables have similar methods called doMouseClicked invoked by the
Editor
subclass that contains them, so the Editor can handle e.g. box selection, etc.- See Also:
PositionableJComponent
,PositionableLabel
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Positionable.DuplicateIdException
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addClass(java.lang.String className)
Add a class name to this Positionableboolean
contains(int x, int y)
Positionable
deepClone()
Make a deep copy of Positional object.void
doMouseClicked(JmriMouseEvent event)
void
doMouseDragged(JmriMouseEvent event)
void
doMouseEntered(JmriMouseEvent event)
void
doMouseExited(JmriMouseEvent event)
void
doMouseMoved(JmriMouseEvent event)
void
doMousePressed(JmriMouseEvent event)
void
doMouseReleased(JmriMouseEvent event)
boolean
doViemMenu()
Use the 'Standard' presentation of the popup menu items.java.awt.Color
getBackground()
java.awt.Rectangle
getBounds(java.awt.Rectangle r)
java.util.Set<java.lang.String>
getClasses()
Gets the class names of this Positionableint
getDegrees()
int
getDisplayLevel()
Editor
getEditor()
default java.lang.String
getEditorName()
Get the LogixNG of this InlineLogixNG.java.awt.Font
getFont()
java.awt.Color
getForeground()
int
getHeight()
java.lang.String
getId()
Gets the Id of this Positionablejava.awt.Point
getLocation()
NamedBean
getNamedBean()
java.lang.String
getNameString()
Get the name of the positional as a String.java.awt.Container
getParent()
PositionablePopupUtil
getPopupUtility()
Utility to handle Margins, Borders and other common popup itemsjava.awt.Dimension
getPreferredSize()
double
getScale()
javax.swing.JComponent
getTextComponent()
ToolTip
getToolTip()
default java.lang.String
getTypeName()
Get the type of item of this InlineLogixNG.java.lang.String
getTypeString()
Get the type of the positional as a String.boolean
getViewCoordinates()
int
getWidth()
int
getX()
Get the X position of this InlineLogixNG.int
getY()
Get the Y position of this InlineLogixNG.void
invalidate()
boolean
isControlling()
boolean
isEditable()
boolean
isEmptyHidden()
boolean
isHidden()
boolean
isOpaque()
boolean
isPositionable()
boolean
isValueEditDisabled()
int
maxHeight()
int
maxWidth()
void
remove()
void
removeAllClasses()
Remove a class name to this Positionablevoid
removeClass(java.lang.String className)
Remove a class name to this Positionablevoid
repaint()
boolean
requestFocusInWindow()
void
rotate(int deg)
void
setBackground(java.awt.Color bg)
void
setBorder(javax.swing.border.Border border)
void
setControlling(boolean enabled)
boolean
setDisableControlMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.void
setDisplayLevel(int l)
void
setEditable(boolean enabled)
boolean
setEditIconMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.boolean
setEditItemMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.void
setEditor(Editor ed)
void
setEmptyHidden(boolean enabled)
void
setForeground(java.awt.Color bg)
void
setHidden(boolean enabled)
void
setId(java.lang.String id)
Sets the Id of this Positionablevoid
setLocation(int x, int y)
void
setLocation(java.awt.Point p)
void
setOpaque(boolean isOpaque)
void
setPopupUtility(PositionablePopupUtil tu)
void
setPositionable(boolean enabled)
boolean
setRotateMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.boolean
setRotateOrthogonalMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.void
setScale(double s)
boolean
setScaleMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.void
setShowToolTip(boolean set)
void
setSize(int width, int height)
boolean
setTextEditMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.void
setToolTip(ToolTip tip)
void
setValueEditDisabled(boolean disabled)
void
setViewCoordinates(boolean enabled)
void
setVisible(boolean b)
void
showHidden()
boolean
showPopUp(javax.swing.JPopupMenu popup)
boolean
showToolTip()
boolean
storeItem()
Check if a permanent copy of this Positionable should be stored.void
updateSize()
-
Methods inherited from interface jmri.jmrit.logixng.InlineLogixNG
getLogixNG, setLogixNG, setLogixNG_SystemName, setupLogixNG
-
-
-
-
Method Detail
-
setId
void setId(java.lang.String id) throws Positionable.DuplicateIdException
Sets the Id of this Positionable- Parameters:
id
- the id or null if no id- Throws:
Positionable.DuplicateIdException
- if another Positionable in the editor already has this id
-
getId
java.lang.String getId()
Gets the Id of this Positionable- Returns:
- the id or null if no id
-
addClass
void addClass(java.lang.String className)
Add a class name to this Positionable- Parameters:
className
- the class name- Throws:
java.lang.IllegalArgumentException
- className is null or has a comma
-
removeClass
void removeClass(java.lang.String className)
Remove a class name to this Positionable- Parameters:
className
- the class name
-
removeAllClasses
void removeAllClasses()
Remove a class name to this Positionable
-
getClasses
java.util.Set<java.lang.String> getClasses()
Gets the class names of this Positionable- Returns:
- the classes
-
setPositionable
void setPositionable(boolean enabled)
-
isPositionable
boolean isPositionable()
-
setEditable
void setEditable(boolean enabled)
-
isEditable
boolean isEditable()
-
setShowToolTip
void setShowToolTip(boolean set)
-
showToolTip
boolean showToolTip()
-
setToolTip
void setToolTip(ToolTip tip)
-
getToolTip
ToolTip getToolTip()
-
setViewCoordinates
void setViewCoordinates(boolean enabled)
-
getViewCoordinates
boolean getViewCoordinates()
-
setControlling
void setControlling(boolean enabled)
-
isControlling
boolean isControlling()
-
setHidden
void setHidden(boolean enabled)
-
isHidden
boolean isHidden()
-
showHidden
void showHidden()
-
setEmptyHidden
void setEmptyHidden(boolean enabled)
-
isEmptyHidden
boolean isEmptyHidden()
-
setValueEditDisabled
void setValueEditDisabled(boolean disabled)
-
isValueEditDisabled
boolean isValueEditDisabled()
-
getDisplayLevel
int getDisplayLevel()
-
setDisplayLevel
void setDisplayLevel(int l)
-
updateSize
void updateSize()
-
maxWidth
int maxWidth()
-
maxHeight
int maxHeight()
-
deepClone
Positionable deepClone()
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); }
Then finishClone() finishes 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.
- Returns:
- the copy
-
getTypeString
java.lang.String getTypeString()
Get the type of the positional as a String.- Returns:
- the type to display
-
getNameString
java.lang.String getNameString()
Get the name of the positional as a String. This is often the display name of the NamedBean being positioned.- Specified by:
getNameString
in interfaceInlineLogixNG
- Returns:
- the name to display
-
getTypeName
default java.lang.String getTypeName()
Get the type of item of this InlineLogixNG.- Specified by:
getTypeName
in interfaceInlineLogixNG
- Returns:
- the type
-
setRotateOrthogonalMenu
boolean setRotateOrthogonalMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
setRotateMenu
boolean setRotateMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
setScaleMenu
boolean setScaleMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
setEditIconMenu
boolean setEditIconMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
setEditItemMenu
boolean setEditItemMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
setDisableControlMenu
boolean setDisableControlMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
setTextEditMenu
boolean setTextEditMenu(javax.swing.JPopupMenu popup)
Add additional menu items to the menu.- Parameters:
popup
- the menu to add the menu items to- Returns:
- true if adding items; false otherwise
-
showPopUp
boolean showPopUp(javax.swing.JPopupMenu popup)
-
setScale
void setScale(double s)
-
getScale
double getScale()
-
rotate
void rotate(int deg)
-
getDegrees
int getDegrees()
-
getTextComponent
javax.swing.JComponent getTextComponent()
-
remove
void remove()
-
storeItem
boolean storeItem()
Check if a permanent copy of this Positionable should be stored.- Returns:
- true if this Positionable should be stored; false otherwise
-
doViemMenu
boolean doViemMenu()
Use the 'Standard' presentation of the popup menu items. The editor will call this method to find out whether it should create any popup viewing menu items.- Returns:
- true if Editor may add the standardpopup menu items
-
getPopupUtility
PositionablePopupUtil getPopupUtility()
Utility to handle Margins, Borders and other common popup items- Returns:
- null if these item do not apply
-
setPopupUtility
void setPopupUtility(PositionablePopupUtil tu)
-
getNamedBean
NamedBean getNamedBean()
-
doMousePressed
void doMousePressed(JmriMouseEvent event)
-
doMouseReleased
void doMouseReleased(JmriMouseEvent event)
-
doMouseClicked
void doMouseClicked(JmriMouseEvent event)
-
doMouseDragged
void doMouseDragged(JmriMouseEvent event)
-
doMouseMoved
void doMouseMoved(JmriMouseEvent event)
-
doMouseEntered
void doMouseEntered(JmriMouseEvent event)
-
doMouseExited
void doMouseExited(JmriMouseEvent event)
-
getBounds
java.awt.Rectangle getBounds(java.awt.Rectangle r)
-
contains
boolean contains(int x, int y)
-
getX
int getX()
Description copied from interface:InlineLogixNG
Get the X position of this InlineLogixNG.- Specified by:
getX
in interfaceInlineLogixNG
- Returns:
- the X position
-
getY
int getY()
Description copied from interface:InlineLogixNG
Get the Y position of this InlineLogixNG.- Specified by:
getY
in interfaceInlineLogixNG
- Returns:
- the Y position
-
getLocation
java.awt.Point getLocation()
-
setLocation
void setLocation(int x, int y)
-
setLocation
void setLocation(java.awt.Point p)
-
setSize
void setSize(int width, int height)
-
setVisible
void setVisible(boolean b)
-
getWidth
int getWidth()
-
getHeight
int getHeight()
-
getParent
java.awt.Container getParent()
-
setOpaque
void setOpaque(boolean isOpaque)
-
isOpaque
boolean isOpaque()
-
setBackground
void setBackground(java.awt.Color bg)
-
getBackground
java.awt.Color getBackground()
-
setForeground
void setForeground(java.awt.Color bg)
-
getForeground
java.awt.Color getForeground()
-
getFont
java.awt.Font getFont()
-
setBorder
void setBorder(javax.swing.border.Border border)
-
getPreferredSize
java.awt.Dimension getPreferredSize()
-
invalidate
void invalidate()
-
repaint
void repaint()
-
requestFocusInWindow
boolean requestFocusInWindow()
-
getEditorName
default java.lang.String getEditorName()
Description copied from interface:InlineLogixNG
Get the LogixNG of this InlineLogixNG.- Specified by:
getEditorName
in interfaceInlineLogixNG
- Returns:
- the LogixNG or null if it has no LogixNG
-
-