Package org.opencms.widgets.dataview
Class CmsDataViewFilter
- java.lang.Object
-
- org.opencms.widgets.dataview.CmsDataViewFilter
-
public class CmsDataViewFilter extends java.lang.Object
Represents a filter to narrow down the list of displayed results.A filter has a unique id, a set of options (consisting of a map whose keys are internal identifiers of the options and whose values are the texts to display to the user), a current value and a 'nice name' to display as caption for the filter. Filter options don't by default have a "null" (=neutral, i.e. filter is not applied) option; if you need this, add a corresponding option in your implementation of I_CmsDataView.
-
-
Constructor Summary
Constructors Constructor Description CmsDataViewFilter(java.lang.String id, java.lang.String niceName, java.lang.String helpText, java.util.LinkedHashMap<java.lang.String,java.lang.String> options, java.lang.String value)
Creates a new filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsDataViewFilter
copy()
Creates a copy of the filter.CmsDataViewFilter
copyWithValue(java.lang.String value)
Creates a copy of the filter, but uses a different filter value for the copy.boolean
equals(java.lang.Object other)
java.lang.String
getHelpText()
Gets the help text for the filter.java.lang.String
getId()
Gets the id of the filter.java.lang.String
getNiceName()
Gets the user-readable name of the filter.java.util.Map<java.lang.String,java.lang.String>
getOptions()
The map of filter options.java.lang.String
getValue()
Gets the current value.int
hashCode()
-
-
-
Constructor Detail
-
CmsDataViewFilter
public CmsDataViewFilter(java.lang.String id, java.lang.String niceName, java.lang.String helpText, java.util.LinkedHashMap<java.lang.String,java.lang.String> options, java.lang.String value)
Creates a new filter.- Parameters:
id
- the filter idniceName
- the nice namehelpText
- the help text for the filteroptions
- the ordered map of optionsvalue
- the current value
-
-
Method Detail
-
copy
public CmsDataViewFilter copy()
Creates a copy of the filter.- Returns:
- the copied filter
-
copyWithValue
public CmsDataViewFilter copyWithValue(java.lang.String value)
Creates a copy of the filter, but uses a different filter value for the copy.- Parameters:
value
- the filter value for the copy- Returns:
- the copied filter
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getHelpText
public java.lang.String getHelpText()
Gets the help text for the filter.- Returns:
- the help text for the filter
-
getId
public java.lang.String getId()
Gets the id of the filter.- Returns:
- the id of the filter
-
getNiceName
public java.lang.String getNiceName()
Gets the user-readable name of the filter.- Returns:
- the user-readable name
-
getOptions
public java.util.Map<java.lang.String,java.lang.String> getOptions()
The map of filter options.Internally, this is stored as a LinkedHashMap, so the order of options is preserved. The keys of the map are internal identifiers for the options, while the values are the texts displayed in the GUI for the options.
- Returns:
- the map of filter options
-
getValue
public java.lang.String getValue()
Gets the current value.- Returns:
- the filter value
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-