Class ViewSettings
- java.lang.Object
-
- net.sf.jguiraffe.examples.tutorial.viewset.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 Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ViewSettings()
Creates a new instance ofViewSettings
and initializes it with default values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Comparator<FileData>
createComparator()
Creates aComparator
object that implements the sort order specified in this object.FileFilter
createFileFilter()
Creates aFileFilter
object that implements the filter criteria defined for this object.static ViewSettings
forDirectory(File directory)
Returns theViewSettings
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)
-
-
-
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
-
-
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 theViewSettings
object for the specified directory. If in this directory a file with the reserved name for theViewSettings
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 aComparator
object that implements the sort order specified in this object.- Returns:
- the
Comparator
-
createFileFilter
public FileFilter createFileFilter()
Creates aFileFilter
object that implements the filter criteria defined for this object. This filter can be used directly when listing the directory thisViewSettings
object is associated with.- Returns:
- a
FileFilter
for filtering a directory listing
-
-