public class MutableSortDefinition extends java.lang.Object implements SortDefinition, java.io.Serializable
SortDefinition
interface.
Supports toggling the ascending value on setting the same property again.setToggleAscendingOnProperty(boolean)
,
Serialized FormType | Property and Description |
---|---|
boolean |
isToggleAscendingOn
Return whether to toggle the ascending flag if the same property gets set again
(that is,
setProperty(java.lang.String) gets called with already set property name again). |
Modifier and Type | Field and Description |
---|---|
private boolean |
ascending |
private boolean |
ignoreCase |
private java.lang.String |
property |
private boolean |
toggleAscendingOnProperty |
Constructor and Description |
---|
MutableSortDefinition()
Create an empty MutableSortDefinition,
to be populated via its bean properties.
|
MutableSortDefinition(boolean toggleAscendingOnSameProperty)
Create a new MutableSortDefinition.
|
MutableSortDefinition(SortDefinition source)
Copy constructor: create a new MutableSortDefinition
that mirrors the given sort definition.
|
MutableSortDefinition(java.lang.String property,
boolean ignoreCase,
boolean ascending)
Create a MutableSortDefinition for the given settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
java.lang.String |
getProperty()
Return the name of the bean property to compare.
|
int |
hashCode() |
boolean |
isAscending()
Return whether to sort ascending (true) or descending (false).
|
boolean |
isIgnoreCase()
Return whether upper and lower case in String values should be ignored.
|
boolean |
isToggleAscendingOnProperty()
Return whether to toggle the ascending flag if the same property gets set again
(that is,
setProperty(java.lang.String) gets called with already set property name again). |
void |
setAscending(boolean ascending)
Set whether to sort ascending (true) or descending (false).
|
void |
setIgnoreCase(boolean ignoreCase)
Set whether upper and lower case in String values should be ignored.
|
void |
setProperty(java.lang.String property)
Set the property to compare.
|
void |
setToggleAscendingOnProperty(boolean toggleAscendingOnProperty)
Set whether to toggle the ascending flag if the same property gets set again
(that is,
setProperty(java.lang.String) gets called with already set property name again). |
setProperty(java.lang.String)
gets called with already set property name again).private java.lang.String property
private boolean ignoreCase
private boolean ascending
private boolean toggleAscendingOnProperty
public MutableSortDefinition()
public MutableSortDefinition(SortDefinition source)
source
- the original sort definitionpublic MutableSortDefinition(java.lang.String property, boolean ignoreCase, boolean ascending)
property
- the property to compareignoreCase
- whether upper and lower case in String values should be ignoredascending
- whether to sort ascending (true) or descending (false)public MutableSortDefinition(boolean toggleAscendingOnSameProperty)
toggleAscendingOnSameProperty
- whether to toggle the ascending flag
if the same property gets set again (that is, setProperty
gets
called with already set property name again).public void setProperty(java.lang.String property)
If the property was the same as the current, the sort is reversed if "toggleAscendingOnProperty" is activated, else simply ignored.
public java.lang.String getProperty()
SortDefinition
getProperty
in interface SortDefinition
public void setIgnoreCase(boolean ignoreCase)
public boolean isIgnoreCase()
SortDefinition
isIgnoreCase
in interface SortDefinition
public void setAscending(boolean ascending)
public boolean isAscending()
SortDefinition
isAscending
in interface SortDefinition
public void setToggleAscendingOnProperty(boolean toggleAscendingOnProperty)
setProperty(java.lang.String)
gets called with already set property name again).
This is particularly useful for parameter binding through a web request, where clicking on the field header again might be supposed to trigger a resort for the same field but opposite order.
public boolean isToggleAscendingOnProperty()
setProperty(java.lang.String)
gets called with already set property name again).public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object