Package com.nomagic.magicdraw.properties
Class FileProperty
- java.lang.Object
-
- com.nomagic.magicdraw.properties.Property
-
- com.nomagic.magicdraw.properties.FileProperty
-
- All Implemented Interfaces:
PropertyVisitorAcceptor
,java.lang.Cloneable
@OpenApiAll public class FileProperty extends Property
The property for storing and editing somejava.io.File
value.- See Also:
File
-
-
Field Summary
Fields Modifier and Type Field Description static int
DIRECTORIES_ONLY
Instruction to choose only directories.static java.lang.String
FILE_TYPE_ANY
Deprecated.static java.lang.String
FILE_TYPE_IMAGE
Deprecated.static int
FILES_AND_DIRECTORIES
Instruction to choose both files and directories.static int
FILES_ONLY
Instruction to choose only files.-
Fields inherited from class com.nomagic.magicdraw.properties.Property
DEFAULT_PROPERTY_RESOURCE_PROVIDER, EDITABLE, NULL, NULL_ID_PROPERTY_RESOURCE_PROVIDER, UNDEFINED, VALUE
-
-
Constructor Summary
Constructors Constructor Description FileProperty()
Default constructor.FileProperty(java.lang.String id, java.lang.String path)
The property constructor.FileProperty(java.lang.String id, java.lang.String path, int selectionMode)
The property constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
accept(PropertyVisitor v)
Accepts the given visitor.FileProperty
clone()
Clones the property.java.lang.String
getClassType()
Returns property class type.java.io.File
getFile(java.lang.String requestFrom)
Returns value as file.java.util.List<java.lang.String>
getFileExtensions()
Get supported file extensions.java.lang.String
getFileType()
Deprecated.java.lang.String
getPathAndExpand(java.lang.String purpose)
Get expanded (using path variables) path.int
getSelectionMode()
Returns file selection mode.java.lang.String
getValueStringRepresentation()
Returns value's string representation.boolean
isDisplayAllFiles()
Returns display all files flag.boolean
isDisplayFullPath()
Returns display full path flag.boolean
isUseFilePreviewer()
Returns use file preview flag.void
setDisplayAllFiles(boolean displayAllFiles)
Sets display all files flag.void
setDisplayFullPath(boolean displayFullPath)
Sets display full path flag.void
setFileExtensions(java.util.List<java.lang.String> fileExtensions)
Set supported file extensions.void
setFileType(java.lang.String fileType)
Deprecated.void
setPathAndCollapse(java.lang.String path)
Set Path and Collapse it by using path variables.void
setSelectionMode(int selectionMode)
Sets the file selection mode for this property.void
setUseFilePreviewer(boolean useFilePreviewer)
Sets use file previewer flag.void
setValue(java.lang.Object value)
Sets new property value.-
Methods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addPropertyChangeListener, addSource, addSources, areValuesEqual, checkFrozen, checkFrozen, createCellEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getDescription, getDescriptionID, getFirstElementFromSources, getGroup, getID, getIntroductoryVersion, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSourceAsElement, getSources, getSourcesAsStream, getUndefinedString, getUndefinedString, getValue, hashCode, isEditable, isUndefinedState, isValueCompatible, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
-
-
-
-
Field Detail
-
FILES_ONLY
public static final int FILES_ONLY
Instruction to choose only files.- See Also:
- Constant Field Values
-
DIRECTORIES_ONLY
public static final int DIRECTORIES_ONLY
Instruction to choose only directories.- See Also:
- Constant Field Values
-
FILES_AND_DIRECTORIES
public static final int FILES_AND_DIRECTORIES
Instruction to choose both files and directories.- See Also:
- Constant Field Values
-
FILE_TYPE_ANY
@Deprecated public static final java.lang.String FILE_TYPE_ANY
Deprecated.File type constant for any file.- See Also:
- Constant Field Values
-
FILE_TYPE_IMAGE
@Deprecated public static final java.lang.String FILE_TYPE_IMAGE
Deprecated.File type constant for image file.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileProperty
public FileProperty()
Default constructor. Value of the property will be null. ID will be empty string.
-
FileProperty
public FileProperty(java.lang.String id, java.lang.String path)
The property constructor. The selection model will be FILES_ONLY.- Parameters:
id
- the ID of property.path
- the file path.
-
FileProperty
public FileProperty(java.lang.String id, java.lang.String path, int selectionMode)
The property constructor.- Parameters:
id
- the ID of property.path
- the file path.selectionMode
- the file selection mode - FILES_ONLY, DIRECTORIES_ONLY or FILES_AND_DIRECTORIES.
-
-
Method Detail
-
setSelectionMode
public void setSelectionMode(int selectionMode)
Sets the file selection mode for this property.- Parameters:
selectionMode
- the file selection mode. Possible values are FILES_ONLY, DIRECTORIES_ONLY and FILES_AND_DIRECTORIES.
-
getSelectionMode
public int getSelectionMode()
Returns file selection mode.- Returns:
- file selection mode.
-
getValueStringRepresentation
public java.lang.String getValueStringRepresentation()
Description copied from class:Property
Returns value's string representation.- Overrides:
getValueStringRepresentation
in classProperty
- Returns:
- string "null" if property does not have value;
value. toString()
if property has value. - See Also:
Property.getValueStringRepresentation()
-
accept
public void accept(PropertyVisitor v) throws java.lang.Exception
Accepts the given visitor.- Specified by:
accept
in interfacePropertyVisitorAcceptor
- Overrides:
accept
in classProperty
- Parameters:
v
- the PropertyVisitor.- Throws:
java.lang.Exception
-
getFile
public java.io.File getFile(@CheckForNull java.lang.String requestFrom) throws RecursivePathVariableException
Returns value as file.- Parameters:
requestFrom
- request string- Returns:
- property value(some file object).
- Throws:
RecursivePathVariableException
- in case of error
-
getClassType
public java.lang.String getClassType()
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in classProperty
- Returns:
- PropertyID.FILE_PROPERTY
- See Also:
PropertyID.FILE_PROPERTY
-
setValue
public void setValue(@CheckForNull java.lang.Object value)
Description copied from class:Property
Sets new property value. Will fire aPropertyChangeEvent
with propertyName - property ID, newValue and oldValue.- Overrides:
setValue
in classProperty
- Parameters:
value
- a new property value.- See Also:
Property.setValue(java.lang.Object)
-
setPathAndCollapse
public void setPathAndCollapse(java.lang.String path)
Set Path and Collapse it by using path variables.- Parameters:
path
- Path string.
-
getPathAndExpand
public java.lang.String getPathAndExpand(@CheckForNull java.lang.String purpose) throws RecursivePathVariableException
Get expanded (using path variables) path.- Parameters:
purpose
- used in an undefined-path-variable prompt for a user, e.g. 'The path variable <variable> used for <purpose> is not set.- Returns:
- Path String.
- Throws:
RecursivePathVariableException
- in case of error
-
setDisplayFullPath
public void setDisplayFullPath(boolean displayFullPath)
Sets display full path flag.- Parameters:
displayFullPath
- - display full path flag.
-
isDisplayFullPath
public boolean isDisplayFullPath()
Returns display full path flag.- Returns:
- display full path flag.
-
isUseFilePreviewer
public boolean isUseFilePreviewer()
Returns use file preview flag.- Returns:
- use file preview flag.
-
setUseFilePreviewer
public void setUseFilePreviewer(boolean useFilePreviewer)
Sets use file previewer flag.- Parameters:
useFilePreviewer
- - use file previewer flag.
-
isDisplayAllFiles
public boolean isDisplayAllFiles()
Returns display all files flag.- Returns:
- display all files flag.
-
setDisplayAllFiles
public void setDisplayAllFiles(boolean displayAllFiles)
Sets display all files flag.- Parameters:
displayAllFiles
- - display all files flag.
-
getFileType
@Deprecated public java.lang.String getFileType()
Deprecated.Gets supported file type.- Returns:
- file type
-
setFileType
@Deprecated public void setFileType(@CheckForNull java.lang.String fileType)
Deprecated.Sets supported file type.- Parameters:
fileType
- - type of the file.
-
getFileExtensions
@CheckForNull public java.util.List<java.lang.String> getFileExtensions()
Get supported file extensions.- Returns:
- file extensions.
-
setFileExtensions
public void setFileExtensions(java.util.List<java.lang.String> fileExtensions)
Set supported file extensions.- Parameters:
fileExtensions
- file extensions.
-
clone
public FileProperty clone()
Description copied from class:Property
Clones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.
-
-