org.olat.modules.fo
Class ForumHelper

java.lang.Object
  extended by org.olat.modules.fo.ForumHelper

public class ForumHelper
extends java.lang.Object

Description:
Provides utilities methods and classes.

Initial Date: 14.08.2007

Author:
Lavinia Dumitrescu

Field Summary
static java.lang.String CSS_ICON_CLASS_FORUM
           
static java.lang.String CSS_ICON_CLASS_MESSAGE
           
static int NOT_MY_JOB
           
 
Constructor Summary
ForumHelper()
           
 
Method Summary
static int compare(org.olat.modules.fo.ForumHelper.MessageWrapper a, org.olat.modules.fo.ForumHelper.MessageWrapper b, boolean sortAscending)
          Compares two MessageWrappers.
static java.util.Comparator getMessageNodeComparator()
          Comparators can be passed to a sort method (such as Collections.sort) to allow precise control over the sort order.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSS_ICON_CLASS_FORUM

public static final java.lang.String CSS_ICON_CLASS_FORUM
See Also:
Constant Field Values

CSS_ICON_CLASS_MESSAGE

public static final java.lang.String CSS_ICON_CLASS_MESSAGE
See Also:
Constant Field Values

NOT_MY_JOB

public static int NOT_MY_JOB
Constructor Detail

ForumHelper

public ForumHelper()
Method Detail

getMessageNodeComparator

public static java.util.Comparator getMessageNodeComparator()
Comparators can be passed to a sort method (such as Collections.sort) to allow precise control over the sort order.

Sticky threads first, last modified first.

Returns:
a MessageNode comparator.
See Also:
Comparator

compare

public static int compare(org.olat.modules.fo.ForumHelper.MessageWrapper a,
                          org.olat.modules.fo.ForumHelper.MessageWrapper b,
                          boolean sortAscending)
Compares two MessageWrappers.
If a and b both sticky or if none sticky, let the caller do the sorting (return NOT_MY_JOB),
else if a is sticky and sortAscending is true then a less then b (return -1)
else if b is sticky and sortAscending is true then a greater then b (return 1)

Parameters:
a -
b -
sortAscending -
Returns:
-1, 1, or NOT_MY_JOB which means the caller has to do the comparison.