Package com.nomagic.magicdraw.properties
Class FileProperty
java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.FileProperty
- All Implemented Interfaces:
PropertyVisitorAcceptor
,Cloneable
The property for storing and editing some
java.io.File
value.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Instruction to choose only directories.static final String
Deprecated.static final String
Deprecated.static final int
Instruction to choose both files and directories.static final int
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, TO, UNDEFINED, VALUE, VALUE_ANNOTATIONS
-
Constructor Summary
ConstructorDescriptionDefault constructor.FileProperty
(String id, String path) The property constructor.FileProperty
(String id, String path, int selectionMode) The property constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts the given visitor.clone()
Clones the property.Returns property class type.Returns value as file.Get supported file extensions.Deprecated.getPathAndExpand
(String purpose) Get expanded (using path variables) path.int
Returns file selection mode.Returns value's string representation.boolean
Returns display all files flag.boolean
Returns display full path flag.boolean
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
(List<String> fileExtensions) Set supported file extensions.void
setFileType
(String fileType) Deprecated.void
setPathAndCollapse
(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
Sets new property value.Methods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addAnnotation, addPropertyChangeListener, addSource, addSources, areEqualByValue, areValuesEqual, checkFrozen, checkFrozen, createCellEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getAnnotation, getAnnotations, getDescription, getDescriptionID, getFirstElementFromSources, getGroup, getID, getIntroductoryVersion, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSortableValueStringRepresentation, getSourceAsElement, getSources, getSourcesAsStream, getUndefinedString, getUndefinedString, getValue, hashCode, isEditable, isUndefinedState, isValueCompatible, removeAnnotation, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setAnnotations, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
-
Field Details
-
FILES_ONLY
public static final int FILES_ONLYInstruction to choose only files.- See Also:
-
DIRECTORIES_ONLY
public static final int DIRECTORIES_ONLYInstruction to choose only directories.- See Also:
-
FILES_AND_DIRECTORIES
public static final int FILES_AND_DIRECTORIESInstruction to choose both files and directories.- See Also:
-
FILE_TYPE_ANY
Deprecated.File type constant for any file.- See Also:
-
FILE_TYPE_IMAGE
Deprecated.File type constant for image file.- See Also:
-
-
Constructor Details
-
FileProperty
public FileProperty()Default constructor. Value of the property will be null. ID will be empty string. -
FileProperty
The property constructor. The selection model will be FILES_ONLY.- Parameters:
id
- the ID of property.path
- the file path.
-
FileProperty
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 Details
-
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
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:
-
accept
Accepts the given visitor.- Specified by:
accept
in interfacePropertyVisitorAcceptor
- Overrides:
accept
in classProperty
- Parameters:
v
- the PropertyVisitor.- Throws:
Exception
-
getFile
Returns value as file.- Parameters:
requestFrom
- request string- Returns:
- property value(some file object).
- Throws:
RecursivePathVariableException
- in case of error
-
getClassType
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in classProperty
- Returns:
- PropertyID.FILE_PROPERTY
- See Also:
-
setValue
Description copied from class:Property
Sets new property value. Will fire aPropertyChangeEvent
with propertyName - property ID, newValue and oldValue. -
setPathAndCollapse
Set Path and Collapse it by using path variables.- Parameters:
path
- Path string.
-
getPathAndExpand
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.Gets supported file type.- Returns:
- file type
-
setFileType
Deprecated.Sets supported file type.- Parameters:
fileType
- - type of the file.
-
getFileExtensions
Get supported file extensions.- Returns:
- file extensions.
-
setFileExtensions
Set supported file extensions.- Parameters:
fileExtensions
- file extensions.
-
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.
-
getFileExtensions()