Interface Positionable
- All Superinterfaces:
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
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:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a class name to this Positionablebooleancontains(int x, int y) 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) booleanUse the 'Standard' presentation of the popup menu items.Gets the class names of this Positionableintintdefault StringGet the LogixNG of this InlineLogixNG.getFont()intgetId()Gets the Id of this PositionableGet the name of the positional as a String.Utility to handle Margins, Borders and other common popup itemsdoublegetScale()default StringGet the type of item of this InlineLogixNG.Get the type of the positional as a String.booleanintgetWidth()intgetX()Get the X position of this InlineLogixNG.intgetY()Get the Y position of this InlineLogixNG.voidbooleanbooleanbooleanbooleanisHidden()booleanisOpaque()booleanbooleanintintmaxWidth()voidremove()voidRemove a class name to this PositionablevoidremoveClass(String className) Remove a class name to this Positionablevoidrepaint()booleanvoidrotate(int deg) voidsetBackground(Color bg) voidvoidsetControlling(boolean enabled) booleansetDisableControlMenu(JPopupMenu popup) Add additional menu items to the menu.voidsetDisplayLevel(int l) voidsetEditable(boolean enabled) booleansetEditIconMenu(JPopupMenu popup) Add additional menu items to the menu.booleansetEditItemMenu(JPopupMenu popup) Add additional menu items to the menu.voidvoidsetEmptyHidden(boolean enabled) voidsetForeground(Color bg) voidsetHidden(boolean enabled) voidSets the Id of this PositionablevoidsetLocation(int x, int y) voidsetLocation(Point p) voidsetOpaque(boolean isOpaque) voidvoidsetPositionable(boolean enabled) booleansetRotateMenu(JPopupMenu popup) Add additional menu items to the menu.booleanAdd additional menu items to the menu.voidsetScale(double s) booleansetScaleMenu(JPopupMenu popup) Add additional menu items to the menu.voidsetShowToolTip(boolean set) voidsetSize(int width, int height) booleansetTextEditMenu(JPopupMenu popup) Add additional menu items to the menu.voidsetToolTip(ToolTip tip) voidsetValueEditDisabled(boolean disabled) voidsetViewCoordinates(boolean enabled) voidsetVisible(boolean b) voidbooleanshowPopUp(JPopupMenu popup) booleanbooleanCheck if a permanent copy of this Positionable should be stored.voidMethods inherited from interface jmri.jmrit.logixng.InlineLogixNG
getLogixNG, setLogixNG, setLogixNG_SystemName, setupLogixNG
-
Method Details
-
setId
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
Gets the Id of this Positionable- Returns:
- the id or null if no id
-
addClass
Add a class name to this Positionable- Parameters:
className- the class name- Throws:
IllegalArgumentException- className is null or has a comma
-
removeClass
Remove a class name to this Positionable- Parameters:
className- the class name
-
removeAllClasses
void removeAllClasses()Remove a class name to this Positionable -
getClasses
Set<String> getClasses()Gets the class names of this Positionable- Returns:
- the classes
-
setPositionable
-
isPositionable
boolean isPositionable() -
setEditable
-
isEditable
boolean isEditable() -
setShowToolTip
-
showToolTip
boolean showToolTip() -
setToolTip
-
getToolTip
-
setViewCoordinates
-
getViewCoordinates
boolean getViewCoordinates() -
setControlling
-
isControlling
boolean isControlling() -
setHidden
-
isHidden
boolean isHidden() -
showHidden
void showHidden() -
setEmptyHidden
-
isEmptyHidden
boolean isEmptyHidden() -
setValueEditDisabled
-
isValueEditDisabled
boolean isValueEditDisabled() -
getDisplayLevel
int getDisplayLevel() -
setDisplayLevel
-
getEditor
-
setEditor
-
updateSize
void updateSize() -
maxWidth
int maxWidth() -
maxHeight
int maxHeight() -
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
Get the type of the positional as a String.- Returns:
- the type to display
-
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
Get the type of item of this InlineLogixNG.- Specified by:
getTypeNamein interfaceInlineLogixNG- Returns:
- the type
-
setRotateOrthogonalMenu
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
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
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
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
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
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
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
-
setScale
-
getScale
double getScale() -
rotate
-
getDegrees
int getDegrees() -
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
Utility to handle Margins, Borders and other common popup items- Returns:
- null if these item do not apply
-
setPopupUtility
-
getNamedBean
-
doMousePressed
-
doMouseReleased
-
doMouseClicked
-
doMouseDragged
-
doMouseMoved
-
doMouseEntered
-
doMouseExited
-
getBounds
-
contains
-
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
-
setLocation
-
setLocation
-
setSize
-
setVisible
-
getWidth
int getWidth() -
getHeight
int getHeight() -
getParent
-
setOpaque
-
isOpaque
boolean isOpaque() -
setBackground
-
getBackground
-
setForeground
-
getForeground
-
getFont
-
setBorder
-
getPreferredSize
-
invalidate
void invalidate() -
repaint
void repaint() -
requestFocusInWindow
boolean requestFocusInWindow() -
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
-