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.
Modifier and Type | Field and Description |
---|---|
static String |
CTX_NAME
Constant for the name under which this instance is stored in the context.
|
static String |
VIEW_SETTINGS_FILE
Constant for the name of the file with the view settings.
|
Constructor and Description |
---|
ViewSettings()
Creates a new instance of
ViewSettings and initializes it with
default values. |
Modifier and Type | Method and Description |
---|---|
Comparator<FileData> |
createComparator()
Creates a
Comparator object that implements the sort order
specified in this object. |
FileFilter |
createFileFilter()
Creates a
FileFilter object that implements the filter criteria
defined for this object. |
static ViewSettings |
forDirectory(File directory)
Returns the
ViewSettings object for the specified directory. |
Color |
getBackgroundColor() |
Date |
getFileDateFrom() |
Date |
getFileDateTo() |
String[] |
getFileTypes() |
Color |
getForegroundColor() |
Integer |
getMinFileSize() |
Color |
getSelectionBackground() |
Color |
getSelectionForeground() |
Integer |
getSortColumn() |
Integer |
getSortDirectories() |
boolean |
isFilterDate() |
boolean |
isFilterSize() |
boolean |
isFilterTypes() |
boolean |
isSortDescending() |
void |
save(File directory)
Stores this object in the specified directory.
|
void |
setBackgroundColor(Color backgroundColor) |
void |
setFileDateFrom(Date fileDateFrom) |
void |
setFileDateTo(Date fileDateTo) |
void |
setFileTypes(String[] fileTypes) |
void |
setFilterDate(boolean filterDate) |
void |
setFilterSize(boolean filterSize) |
void |
setFilterTypes(boolean filterTypes) |
void |
setForegroundColor(Color foregroundColor) |
void |
setMinFileSize(Integer minFileSize) |
void |
setSelectionBackground(Color selectionBackground) |
void |
setSelectionForeground(Color selectionForeground) |
void |
setSortColumn(Integer sortColumn) |
void |
setSortDescending(boolean sortDescending) |
void |
setSortDirectories(Integer sortDirectories) |
public static final String VIEW_SETTINGS_FILE
public static final String CTX_NAME
public ViewSettings()
ViewSettings
and initializes it with
default values.public void save(File directory) throws IOException
directory
- the target directoryIOException
- if an error occurspublic static ViewSettings forDirectory(File directory)
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.directory
- the directory in questionViewSettings
object for this directorypublic Color getBackgroundColor()
public void setBackgroundColor(Color backgroundColor)
public Color getForegroundColor()
public void setForegroundColor(Color foregroundColor)
public Color getSelectionBackground()
public void setSelectionBackground(Color selectionBackground)
public Color getSelectionForeground()
public void setSelectionForeground(Color selectionForeground)
public Integer getSortColumn()
public void setSortColumn(Integer sortColumn)
public Integer getSortDirectories()
public void setSortDirectories(Integer sortDirectories)
public boolean isSortDescending()
public void setSortDescending(boolean sortDescending)
public boolean isFilterTypes()
public void setFilterTypes(boolean filterTypes)
public String[] getFileTypes()
public void setFileTypes(String[] fileTypes)
public boolean isFilterSize()
public void setFilterSize(boolean filterSize)
public Integer getMinFileSize()
public void setMinFileSize(Integer minFileSize)
public boolean isFilterDate()
public void setFilterDate(boolean filterDate)
public Date getFileDateFrom()
public void setFileDateFrom(Date fileDateFrom)
public Date getFileDateTo()
public void setFileDateTo(Date fileDateTo)
public Comparator<FileData> createComparator()
Comparator
object that implements the sort order
specified in this object.Comparator
public FileFilter createFileFilter()
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.FileFilter
for filtering a directory listingCopyright © 2016 The JGUIraffe Team. All rights reserved.