Package com.anylogic.engine.presentation
- java.lang.Object
- com.anylogic.engine.presentation.Shape
- com.anylogic.engine.presentation.ShapeControl
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
- Direct Known Subclasses:
Chart
,ShapeInputControl
,ShapeWindow3D
public abstract class ShapeControl extends Shape implements com.anylogic.engine.internal.Child
The base class for all controls, i.e. presentation shapes that have JComponents,
(like buttons, sliders, text fields, and also charts).
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Class | Description |
---|---|---|
static enum | ShapeControl.ValueType |
Modifier and Type | Field | Description |
---|---|---|
static final ShapeControl.ValueType | TYPE_DOUBLE |
Control value-type constant for
double number editing mode,
applicable for ShapeSlider , ShapeTextField , ShapeComboBox .See constructors of these controls |
static final ShapeControl.ValueType | TYPE_INT |
Control value-type constant for
int number editing mode,
applicable for ShapeSlider , ShapeTextField , ShapeComboBox .See constructors of these controls |
static final ShapeControl.ValueType | TYPE_STRING |
Control value-type constant for
String editing mode,
applicable for ShapeTextField , ShapeComboBox .See constructors of these controls |
Modifier and Type | Method | Description |
---|---|---|
void | action() |
Executes the action associated with the control.
|
Shape | clone() |
Cloning of controls is not supported
(Other shapes except GIS and charts allow cloning) This method throws UnsupportedOperationException if called |
boolean | contains |
Test if the shape contains the point with the given coordinates
(relative to this shape's container, i.e.
|
void | executeAction() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
double | getHeight() |
Returns the height of the control.
|
Presentable | getPresentable() |
Returns the presentable object owning the control
|
double | getWidth() |
Returns the width of the control.
|
boolean | isEnabled() |
Tests if the control is enabled or disabled.
|
void | postSVGShapeSpecificAttributes |
Posts general properties specific to a particular shape class.
|
Point | randomPointInside |
Returns the randomly chosen point inside the shape area.
This method utilises the given Random Number Generator. Throws error if this shape type doesn't support returning random point inside. |
void | restoreOwner |
Deprecated.
|
void | setEnabled |
Sets the control enabled or disabled
|
void | setHeight |
Sets the height of the control.
|
void | setValueToDefault() |
Sets the value of the control to what was provided as the default one.
|
void | setWidth |
Sets the width of the control.
|
canHandleClick, executeUserAction, findSVGElement, getDrawMode, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, setLevel, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public static final ShapeControl.ValueType TYPE_DOUBLE
Control value-type constant for
See constructors of these controls
double
number editing mode,
applicable for ShapeSlider
, ShapeTextField
, ShapeComboBox
.See constructors of these controls
public static final ShapeControl.ValueType TYPE_INT
Control value-type constant for
See constructors of these controls
int
number editing mode,
applicable for ShapeSlider
, ShapeTextField
, ShapeComboBox
.See constructors of these controls
public static final ShapeControl.ValueType TYPE_STRING
Control value-type constant for
See constructors of these controls
String
editing mode,
applicable for ShapeTextField
, ShapeComboBox
.See constructors of these controls
@AnyLogicInternalCodegenAPI public void action()
Executes the action associated with the control. This method does
nothing by default and may be overridden.
public void setValueToDefault()
Sets the value of the control to what was provided as the default one.
public void setEnabled(boolean yes)
Sets the control enabled or disabled
- Parameters:
yes
- the new enabled state
public boolean isEnabled()
Tests if the control is enabled or disabled.
- Returns:
true
if enabled, otherwisefalse
public void setWidth(double width)
Sets the width of the control.
- Parameters:
width
- the new width
public double getWidth()
Returns the width of the control.
- Returns:
- the width of the control
public void setHeight(double height)
Sets the height of the control.
- Parameters:
height
- the new height
public double getHeight()
Returns the height of the control.
- Returns:
- the height of the control
public Point randomPointInside(Random rng)
Description copied from class:
Shape
Returns the randomly chosen point inside the shape area.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
- Overrides:
randomPointInside
in classShape
- Parameters:
rng
- the random number generator.- Returns:
- the randomly chosen point inside the shape area.
@AnyLogicInternalAPI public void executeAction()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
public boolean contains(double px, double py)
Description copied from class:
Shape
public Presentable getPresentable()
Returns the presentable object owning the control
- Overrides:
getPresentable
in classShape
- Returns:
- the presentable object owning the control
@AnyLogicInternalCodegenAPI @Deprecated public void restoreOwner(Object owner)
Deprecated.
Description copied from class:
Shape
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
This method restores owner of this object
The method is used in snapshot saving/loading
- Specified by:
restoreOwner
in interfacecom.anylogic.engine.internal.Child
- Overrides:
restoreOwner
in classShape
- Parameters:
owner
- owner of this object, usuallyAgent
,Experiment
orShapeGroup
public Shape clone()
Cloning of controls is not supported
(Other shapes except GIS and charts allow cloning)
This method throws
(Other shapes except GIS and charts allow cloning)
This method throws
UnsupportedOperationException
if calledpublic void postSVGShapeSpecificAttributes(List<String> att, List<String> val, boolean publicOnly)
Description copied from class:
Shape
Posts general properties specific to a particular shape class.
Is triggered by SVG_DIRTY_SHAPE flag.
Made public for occasional posting of additional SVG properties from outside engine
(e.g. from libraries)
- Overrides:
postSVGShapeSpecificAttributes
in classShape
- Parameters:
att
- attribute namesval
- attribute valuespublicOnly
- TODO