Package com.anylogic.engine.presentation
- Nested Class Summary
- Nested classes/interfaces inherited from class com.anylogic.engine.presentation.ShapeControl
- Field Summary
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.presentation.ShapeInputControl
- Methods inherited from class com.anylogic.engine.presentation.ShapeControl
- 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 Details
- Constructor Details
- Method Details
- java.lang.Object
- com.anylogic.engine.presentation.Shape
- com.anylogic.engine.presentation.ShapeControl
- com.anylogic.engine.presentation.ShapeInputControl
- com.anylogic.engine.presentation.ShapeFileChooser
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
public class ShapeFileChooser extends ShapeInputControl
File chooser control. Embeds a JPanel with JTextField and JButton.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Class | Description |
---|---|---|
static enum | ShapeFileChooser.Type |
File chooser type constants
|
Modifier and Type | Field | Description |
---|---|---|
static final ShapeFileChooser.Type | TYPE_DOWNLOAD | |
static final ShapeFileChooser.Type | TYPE_UPLOAD | |
String | value |
Returns the currently selected file name (or empty string if no file
selected) that can be accessed in the overridden action() method.
Use getValue() to obtain the currently selected file name
from other places |
Constructor | Description |
---|---|
ShapeFileChooser |
Creates a file chooser control.
|
Modifier and Type | Method | Description |
---|---|---|
void | destroy() | |
void | executeUserAction |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
String | getTitle() |
Returns the title of the file chooser - the string always displayed in Download case
and displayed before the file has been uploaded in Upload case.
|
String | getValue() |
Returns the currently selected file name or empty string if no file
selected
|
void | resetSVGState() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | setTitle |
Sets the new title of the file chooser - the string always displayed in Download case
and displayed before the file has been uploaded in Upload case.
|
void | setValue |
Sets the selected filename to given
fileName Doesn't execute user action code |
void | setValue |
Sets the selected filename to given
fileName Executes user action code (if any exists) if callAction
parameter is true |
SVGElement | updateSVGProperties |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Updates SVG properties of the element that are then sent to the rendering client. |
action, clone, contains, executeAction, getHeight, getPresentable, getWidth, isEnabled, randomPointInside, restoreOwner, setEnabled, setHeight, setValueToDefault, setWidth
canHandleClick, findSVGElement, getDrawMode, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, setLevel, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural
public static final ShapeFileChooser.Type TYPE_UPLOAD
public static final ShapeFileChooser.Type TYPE_DOWNLOAD
@AnyLogicInternalAPI public volatile String value
Returns the currently selected file name (or empty string if no file
selected) that can be accessed in the overridden action() method.
Use
Use
getValue()
to obtain the currently selected file name
from other placespublic ShapeFileChooser(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, Color textColor, boolean enabled, Font font, String title, ShapeFileChooser.Type type, String fileTypes, String value)
Creates a file chooser control. You should override the action()
method, in which you can access the current selection as
"values".
- Parameters:
p
- the presentable object owning this controlispublic
- iftrue
, the control is visible on container's presentationx
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the heightbackgroundColor
- the background colortextColor
- the text colorenabled
- the initial enabled statefont
- the text fonttitle
- the title of the file chooser dialogtype
- one of#TYPE_OPEN
#TYPE_SAVE
fileTypes
- file types acceptable by file chooser in theTYPE_UPLOAD
mode. Examples: ".xls, .xlsx", ".png, .jpg", "image/png", "image/*".value
-
public String getTitle()
Returns the title of the file chooser - the string always displayed in Download case
and displayed before the file has been uploaded in Upload case.
- Returns:
- the title of the file chooser
public void setTitle(String title)
Sets the new title of the file chooser - the string always displayed in Download case
and displayed before the file has been uploaded in Upload case.
- Parameters:
title
- the new title
public void setValue(String fileName)
Sets the selected filename to given
Doesn't execute user action code
fileName
Doesn't execute user action code
- Parameters:
fileName
- the file name
public void setValue(String fileName, boolean callAction)
Sets the selected filename to given
Executes user action code (if any exists) if
fileName
Executes user action code (if any exists) if
callAction
parameter is true
- Parameters:
fileName
- the file namecallAction
- iftrue
user action code (if any exists) will be executed
public String getValue()
Returns the currently selected file name or empty string if no file
selected
- Returns:
- the currently selected file name or empty string if no file selected
public void destroy()
public void resetSVGState()
Description copied from interface:
SVGElement
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.
- Specified by:
resetSVGState
in interfaceSVGElement
- Overrides:
resetSVGState
in classShape
public SVGElement updateSVGProperties(List<SVGCommand> output, ShapeDrawMode drawMode, boolean publicOnly, SVGElement owner, SVGElement elbehind)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client. If the element is not yet in the SVG scene, generates "C" command, if it is there, but some properties are out of date, generates "U" command. If SVG drawing of this element is not needed because of public only settings, or permanently not needed, or not supported yet, returns false and does nothing.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client. If the element is not yet in the SVG scene, generates "C" command, if it is there, but some properties are out of date, generates "U" command. If SVG drawing of this element is not needed because of public only settings, or permanently not needed, or not supported yet, returns false and does nothing.
- Specified by:
updateSVGProperties
in interfaceSVGElement
- Overrides:
updateSVGProperties
in classShape
- Parameters:
output
- the list of commands to add todrawMode
- TODOpublicOnly
- drawing context: if true, only shapes that are marked as public only are updatedowner
- the SVG element that serves as a container for this elementelbehind
- the SVG element behind this one, or null if none or if order is irrelevant- Returns:
- the actual owner this element has been added to or
null
if element is not drawn (e.g. drawing of this element is not needed because of public only settings, permanently not needed or not supported - hence SVG id is not set). The actual owner may differ from the givenowner
when the svg element is added to a different place (e.g. GIS map).
@AnyLogicInternalAPI public void executeUserAction(String value)
Description copied from interface:
SVGElement
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.
- Specified by:
executeUserAction
in interfaceSVGElement
- Overrides:
executeUserAction
in classShape