com.miginfocom.calendar.category
Class CategorySorter

java.lang.Object
  extended by com.miginfocom.calendar.category.CategorySorter
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator

public class CategorySorter
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

A sorter that is configurable to sort child categories for a category in many different ways.

Since:
6.0
See Also:
Serialized Form

Constructor Summary
CategorySorter()
          Defaults to new CategorySorter(Category.PROP_NAME, Boolean.TRUE, true)
CategorySorter(PropertyKey sortProperty, java.lang.Boolean foldersBeforeLeafs, boolean ascending)
          Constructor.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 boolean getAscending()
          Property: If categories should be sorted Ascending.
 java.lang.Boolean getFoldersBeforeLeafs()
          Property: If folders should be sorted before leafs.
 PropertyKey getSortProperty()
          Property: The porperty of the Category that should be used for sorting.
 void setAscending(boolean b)
          Property: If categories should be sorted Ascending.
 void setFoldersBeforeLeafs(java.lang.Boolean b)
          Property: If folders should be sorted before leafs.
 void setSortProperty(PropertyKey key)
          Property: The porperty of the Category that should be used for sorting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

CategorySorter

public CategorySorter()
Defaults to new CategorySorter(Category.PROP_NAME, Boolean.TRUE, true)

Since:
6.0

CategorySorter

public CategorySorter(PropertyKey sortProperty,
                      java.lang.Boolean foldersBeforeLeafs,
                      boolean ascending)
Constructor. See

Parameters:
sortProperty - The porperty of the Category that should be used for sorting. Defaults is Category.PROP_NAME.
foldersBeforeLeafs - If folders should be sorted before leafs. null means no reordering. Boolean.TRUE means folders before leafs. Boolean.FALSE means leafs before folders.
ascending - If categories should be sorted Ascending. Does not affect the foldersBeforeLeafs property.
Since:
6.0
Method Detail

getSortProperty

public PropertyKey getSortProperty()
Property: The porperty of the Category that should be used for sorting. Defaults to Category.PROP_NAME.

Returns:
The property key. Never null.

setSortProperty

public void setSortProperty(PropertyKey key)
Property: The porperty of the Category that should be used for sorting. Defaults to Category.PROP_NAME.

Parameters:
key - The new property key. Not null.

getFoldersBeforeLeafs

public java.lang.Boolean getFoldersBeforeLeafs()
Property: If folders should be sorted before leafs.

Returns:
If folders should be sorted before leafs. null means no reordering. Boolean.TRUE means folders before leafs. Boolean.FALSE means leafs before folders.

setFoldersBeforeLeafs

public void setFoldersBeforeLeafs(java.lang.Boolean b)
Property: If folders should be sorted before leafs.

Parameters:
b - If folders should be sorted before leafs. null means no reordering. Boolean.TRUE means folders before leafs. Boolean.FALSE means leafs before folders.

getAscending

public boolean getAscending()
Property: If categories should be sorted Ascending. Does not affect the foldersBeforeLeafs property.

Returns:
If categories should be sorted Ascending. Does not affect the foldersBeforeLeafs property.

setAscending

public void setAscending(boolean b)
Property: If categories should be sorted Ascending. Does not affect the foldersBeforeLeafs property.

Parameters:
b - If categories should be sorted Ascending. Does not affect the foldersBeforeLeafs property.

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.