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.Filevalue.- See Also:
File
-
-
Field Summary
Fields Modifier and Type Field Description static intDIRECTORIES_ONLYInstruction to choose only directories.static java.lang.StringFILE_TYPE_ANYDeprecated.static java.lang.StringFILE_TYPE_IMAGEDeprecated.static intFILES_AND_DIRECTORIESInstruction to choose both files and directories.static intFILES_ONLYInstruction 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, VALUE_ANNOTATIONS
-
-
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 voidaccept(PropertyVisitor v)Accepts the given visitor.FilePropertyclone()Clones the property.java.lang.StringgetClassType()Returns property class type.java.io.FilegetFile(java.lang.String requestFrom)Returns value as file.java.util.List<java.lang.String>getFileExtensions()Get supported file extensions.java.lang.StringgetFileType()Deprecated.java.lang.StringgetPathAndExpand(java.lang.String purpose)Get expanded (using path variables) path.intgetSelectionMode()Returns file selection mode.java.lang.StringgetValueStringRepresentation()Returns value's string representation.booleanisDisplayAllFiles()Returns display all files flag.booleanisDisplayFullPath()Returns display full path flag.booleanisUseFilePreviewer()Returns use file preview flag.voidsetDisplayAllFiles(boolean displayAllFiles)Sets display all files flag.voidsetDisplayFullPath(boolean displayFullPath)Sets display full path flag.voidsetFileExtensions(java.util.List<java.lang.String> fileExtensions)Set supported file extensions.voidsetFileType(java.lang.String fileType)Deprecated.voidsetPathAndCollapse(java.lang.String path)Set Path and Collapse it by using path variables.voidsetSelectionMode(int selectionMode)Sets the file selection mode for this property.voidsetUseFilePreviewer(boolean useFilePreviewer)Sets use file previewer flag.voidsetValue(java.lang.Object value)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 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:PropertyReturns value's string representation.- Overrides:
getValueStringRepresentationin 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:
acceptin interfacePropertyVisitorAcceptor- Overrides:
acceptin classProperty- Parameters:
v- the PropertyVisitor.- Throws:
java.lang.Exception
-
getFile
public java.io.File getFile(@CheckForNull java.lang.String requestFrom) throws RecursivePathVariableExceptionReturns 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:
getClassTypein interfacePropertyVisitorAcceptor- Overrides:
getClassTypein classProperty- Returns:
- PropertyID.FILE_PROPERTY
- See Also:
PropertyID.FILE_PROPERTY
-
setValue
public void setValue(@CheckForNull java.lang.Object value)Description copied from class:PropertySets new property value. Will fire aPropertyChangeEventwith propertyName - property ID, newValue and oldValue.- Overrides:
setValuein 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 RecursivePathVariableExceptionGet 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:PropertyClones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.
-
-