Package com.anylogic.engine.presentation
- Nested Class Summary
- Field Summary
- Fields inherited from class com.anylogic.engine.presentation.Shape
- Method Summary
- Methods inherited from class com.anylogic.engine.presentation.Shape
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Field Detail
- Method Detail
- 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
,java.io.Serializable
,java.lang.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
static class |
ShapeControl.ValueType |
|
Modifier and Type | Class | Description |
---|
static ShapeControl.ValueType |
TYPE_DOUBLE |
Control value-type constant for
double number editing mode,
applicable for ShapeSlider , ShapeTextField , ShapeComboBox .See constructors of these controls |
static ShapeControl.ValueType |
TYPE_INT |
Control value-type constant for
int number editing mode,
applicable for ShapeSlider , ShapeTextField , ShapeComboBox .See constructors of these controls |
static ShapeControl.ValueType |
TYPE_STRING |
Control value-type constant for
String editing mode,
applicable for ShapeTextField , ShapeComboBox .See constructors of these controls |
Modifier and Type | Field | Description |
---|
UNKNOWN_NAME
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(double px,
double py) |
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(java.util.List<java.lang.String> att,
java.util.List<java.lang.String> val,
boolean publicOnly) |
Posts general properties specific to a particular shape class.
|
Point |
randomPointInside(java.util.Random rng) |
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(java.lang.Object owner) |
Deprecated.
|
void |
setEnabled(boolean yes) |
Sets the control enabled or disabled
|
void |
setHeight(double height) |
Sets the height of the control.
|
void |
setValueToDefault() |
Sets the value of the control to what was provided as the default one.
|
void |
setWidth(double width) |
Sets the width of the control.
|
Modifier and Type | Method | Description |
---|
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeInternal, postInitialize
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(java.util.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
Test if the shape contains the point with the given coordinates
(relative to this shape's container, i.e. in the same system
with the coordinates of this shape, x and y)
- Specified by:
contains
in classShape
- Parameters:
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's container- Returns:
true
if the shape contains the point with the given coordinates
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(java.lang.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(java.util.List<java.lang.String> att, java.util.List<java.lang.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
-
How can we improve this article?
-