Class FileProperty

java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.FileProperty
All Implemented Interfaces:
PropertyVisitorAcceptor, Cloneable

@OpenApiAll public class FileProperty extends Property
The property for storing and editing some java.io.File value.
See Also:
  • Field Details

    • FILES_ONLY

      public static final int FILES_ONLY
      Instruction to choose only files.
      See Also:
    • DIRECTORIES_ONLY

      public static final int DIRECTORIES_ONLY
      Instruction to choose only directories.
      See Also:
    • FILES_AND_DIRECTORIES

      public static final int FILES_AND_DIRECTORIES
      Instruction to choose both files and directories.
      See Also:
    • FILE_TYPE_ANY

      @Deprecated public static final String FILE_TYPE_ANY
      Deprecated.
      File type constant for any file.
      See Also:
    • FILE_TYPE_IMAGE

      @Deprecated public static final String 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

      public FileProperty(String id, 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(String id, 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 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

      public String getValueStringRepresentation()
      Description copied from class: Property
      Returns value's string representation.
      Overrides:
      getValueStringRepresentation in class Property
      Returns:
      string "null" if property does not have value; value. toString() if property has value.
      See Also:
    • accept

      public void accept(PropertyVisitor v) throws Exception
      Accepts the given visitor.
      Specified by:
      accept in interface PropertyVisitorAcceptor
      Overrides:
      accept in class Property
      Parameters:
      v - the PropertyVisitor.
      Throws:
      Exception
    • getFile

      public File getFile(@CheckForNull 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 String getClassType()
      Returns property class type.
      Specified by:
      getClassType in interface PropertyVisitorAcceptor
      Overrides:
      getClassType in class Property
      Returns:
      PropertyID.FILE_PROPERTY
      See Also:
    • setValue

      public void setValue(@CheckForNull Object value)
      Description copied from class: Property
      Sets new property value. Will fire a PropertyChangeEvent with propertyName - property ID, newValue and oldValue.
      Overrides:
      setValue in class Property
      Parameters:
      value - a new property value.
      See Also:
    • setPathAndCollapse

      public void setPathAndCollapse(String path)
      Set Path and Collapse it by using path variables.
      Parameters:
      path - Path string.
    • getPathAndExpand

      public String getPathAndExpand(@CheckForNull 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 String getFileType()
      Deprecated.
      Gets supported file type.
      Returns:
      file type
    • setFileType

      @Deprecated public void setFileType(@CheckForNull String fileType)
      Sets supported file type.
      Parameters:
      fileType - - type of the file.
    • getFileExtensions

      @CheckForNull public List<String> getFileExtensions()
      Get supported file extensions.
      Returns:
      file extensions.
    • setFileExtensions

      public void setFileExtensions(List<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.
      Overrides:
      clone in class Property
      Returns:
      the cloned property.