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
Editorsubclass 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 classPositionable.DuplicateIdException
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddClass(java.lang.String className)Add a class name to this Positionablebooleancontains(int x, int y)PositionabledeepClone()Make a deep copy of Positional object.voiddoMouseClicked(JmriMouseEvent event)voiddoMouseDragged(JmriMouseEvent event)voiddoMouseEntered(JmriMouseEvent event)voiddoMouseExited(JmriMouseEvent event)voiddoMouseMoved(JmriMouseEvent event)voiddoMousePressed(JmriMouseEvent event)voiddoMouseReleased(JmriMouseEvent event)booleandoViemMenu()Use the 'Standard' presentation of the popup menu items.java.awt.ColorgetBackground()java.awt.RectanglegetBounds(java.awt.Rectangle r)java.util.Set<java.lang.String>getClasses()Gets the class names of this PositionableintgetDegrees()intgetDisplayLevel()EditorgetEditor()default java.lang.StringgetEditorName()Get the LogixNG of this InlineLogixNG.java.awt.FontgetFont()java.awt.ColorgetForeground()intgetHeight()java.lang.StringgetId()Gets the Id of this Positionablejava.awt.PointgetLocation()NamedBeangetNamedBean()java.lang.StringgetNameString()Get the name of the positional as a String.java.awt.ContainergetParent()PositionablePopupUtilgetPopupUtility()Utility to handle Margins, Borders and other common popup itemsjava.awt.DimensiongetPreferredSize()doublegetScale()javax.swing.JComponentgetTextComponent()ToolTipgetToolTip()default java.lang.StringgetTypeName()Get the type of item of this InlineLogixNG.java.lang.StringgetTypeString()Get the type of the positional as a String.booleangetViewCoordinates()intgetWidth()intgetX()Get the X position of this InlineLogixNG.intgetY()Get the Y position of this InlineLogixNG.voidinvalidate()booleanisControlling()booleanisEditable()booleanisEmptyHidden()booleanisHidden()booleanisOpaque()booleanisPositionable()booleanisValueEditDisabled()intmaxHeight()intmaxWidth()voidremove()voidremoveAllClasses()Remove a class name to this PositionablevoidremoveClass(java.lang.String className)Remove a class name to this Positionablevoidrepaint()booleanrequestFocusInWindow()voidrotate(int deg)voidsetBackground(java.awt.Color bg)voidsetBorder(javax.swing.border.Border border)voidsetControlling(boolean enabled)booleansetDisableControlMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.voidsetDisplayLevel(int l)voidsetEditable(boolean enabled)booleansetEditIconMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.booleansetEditItemMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.voidsetEditor(Editor ed)voidsetEmptyHidden(boolean enabled)voidsetForeground(java.awt.Color bg)voidsetHidden(boolean enabled)voidsetId(java.lang.String id)Sets the Id of this PositionablevoidsetLocation(int x, int y)voidsetLocation(java.awt.Point p)voidsetOpaque(boolean isOpaque)voidsetPopupUtility(PositionablePopupUtil tu)voidsetPositionable(boolean enabled)booleansetRotateMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.booleansetRotateOrthogonalMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.voidsetScale(double s)booleansetScaleMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.voidsetShowToolTip(boolean set)voidsetSize(int width, int height)booleansetTextEditMenu(javax.swing.JPopupMenu popup)Add additional menu items to the menu.voidsetToolTip(ToolTip tip)voidsetValueEditDisabled(boolean disabled)voidsetViewCoordinates(boolean enabled)voidsetVisible(boolean b)voidshowHidden()booleanshowPopUp(javax.swing.JPopupMenu popup)booleanshowToolTip()booleanstoreItem()Check if a permanent copy of this Positionable should be stored.voidupdateSize()-
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:
getNameStringin interfaceInlineLogixNG- Returns:
- the name to display
-
getTypeName
default java.lang.String getTypeName()
Get the type of item of this InlineLogixNG.- Specified by:
getTypeNamein 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:InlineLogixNGGet the X position of this InlineLogixNG.- Specified by:
getXin interfaceInlineLogixNG- Returns:
- the X position
-
getY
int getY()
Description copied from interface:InlineLogixNGGet the Y position of this InlineLogixNG.- Specified by:
getYin 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:InlineLogixNGGet the LogixNG of this InlineLogixNG.- Specified by:
getEditorNamein interfaceInlineLogixNG- Returns:
- the LogixNG or null if it has no LogixNG
-
-