Class ViewSettings

  • All Implemented Interfaces:
    Serializable

    public class ViewSettings
    extends Object
    implements Serializable

    A data class for storing a view definition.

    The tutorial application allows creating a view definition for each directory. A view definition stores several properties which define how a specific directory is displayed, e.g. colors, sort order, filter conditions, etc. This class stores all the data of a view definition. An instance is used by the view settings dialog as model bean.

    Version:
    $Id: ViewSettings.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    See Also:
    Serialized Form
    • Field Detail

      • VIEW_SETTINGS_FILE

        public static final String VIEW_SETTINGS_FILE
        Constant for the name of the file with the view settings.
        See Also:
        Constant Field Values
      • CTX_NAME

        public static final String CTX_NAME
        Constant for the name under which this instance is stored in the context.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ViewSettings

        public ViewSettings()
        Creates a new instance of ViewSettings and initializes it with default values.
    • Method Detail

      • save

        public void save​(File directory)
                  throws IOException
        Stores this object in the specified directory. Using this method the view settings for this directory can be made persistent.
        Parameters:
        directory - the target directory
        Throws:
        IOException - if an error occurs
      • forDirectory

        public static ViewSettings forDirectory​(File directory)
        Returns the ViewSettings object for the specified directory. If in this directory a file with the reserved name for the ViewSettings object exists, it is loaded. If this file does not exist or if loading this file causes an error, a default instance is returned.
        Parameters:
        directory - the directory in question
        Returns:
        the ViewSettings object for this directory
      • getBackgroundColor

        public Color getBackgroundColor()
      • setBackgroundColor

        public void setBackgroundColor​(Color backgroundColor)
      • getForegroundColor

        public Color getForegroundColor()
      • setForegroundColor

        public void setForegroundColor​(Color foregroundColor)
      • getSelectionBackground

        public Color getSelectionBackground()
      • setSelectionBackground

        public void setSelectionBackground​(Color selectionBackground)
      • getSelectionForeground

        public Color getSelectionForeground()
      • setSelectionForeground

        public void setSelectionForeground​(Color selectionForeground)
      • getSortColumn

        public Integer getSortColumn()
      • setSortColumn

        public void setSortColumn​(Integer sortColumn)
      • getSortDirectories

        public Integer getSortDirectories()
      • setSortDirectories

        public void setSortDirectories​(Integer sortDirectories)
      • isSortDescending

        public boolean isSortDescending()
      • setSortDescending

        public void setSortDescending​(boolean sortDescending)
      • isFilterTypes

        public boolean isFilterTypes()
      • setFilterTypes

        public void setFilterTypes​(boolean filterTypes)
      • getFileTypes

        public String[] getFileTypes()
      • setFileTypes

        public void setFileTypes​(String[] fileTypes)
      • isFilterSize

        public boolean isFilterSize()
      • setFilterSize

        public void setFilterSize​(boolean filterSize)
      • getMinFileSize

        public Integer getMinFileSize()
      • setMinFileSize

        public void setMinFileSize​(Integer minFileSize)
      • isFilterDate

        public boolean isFilterDate()
      • setFilterDate

        public void setFilterDate​(boolean filterDate)
      • getFileDateFrom

        public Date getFileDateFrom()
      • setFileDateFrom

        public void setFileDateFrom​(Date fileDateFrom)
      • getFileDateTo

        public Date getFileDateTo()
      • setFileDateTo

        public void setFileDateTo​(Date fileDateTo)
      • createComparator

        public Comparator<FileData> createComparator()
        Creates a Comparator object that implements the sort order specified in this object.
        Returns:
        the Comparator
      • createFileFilter

        public FileFilter createFileFilter()
        Creates a FileFilter object that implements the filter criteria defined for this object. This filter can be used directly when listing the directory this ViewSettings object is associated with.
        Returns:
        a FileFilter for filtering a directory listing