org.jdesktop.swingx
Class JXTableHeader.SortGestureRecognizer

java.lang.Object
  extended by org.jdesktop.swingx.JXTableHeader.SortGestureRecognizer
Enclosing class:
JXTableHeader

public static class JXTableHeader.SortGestureRecognizer
extends Object

Controller for mapping left mouse clicks to sort/-unsort gestures for use in interested mouse listeners. This base class interprets a single click for toggling sort order, and a single SHIFT-left click for unsort.

A custom implementation which doesn't allow unsort.

 <code>
 public class CustomRecognizer extends SortGestureRecognizer {
        // Disable reset gesture.
          @Override 
           public boolean isResetSortOrderGesture(MouseEvent e) { 
                  return false; 
          }
 }
 tableHeader.setSortGestureRecognizer(new CustomRecognizer());
 </code>
 
Note: Unsort as of SwingX means to reset the sort of all columns. Which currently doesn't make a difference because it supports single column sorts only. Might become significant after switching to JDK 1.6 which supports multiple column sorting (if we can keep up the pluggable control).


Constructor Summary
JXTableHeader.SortGestureRecognizer()
           
 
Method Summary
protected  boolean isResetModifier(MouseEvent e)
          Returns a boolean indicating whether the mouse event's modifier should be interpreted as a unsort or not.
 boolean isResetSortOrderGesture(MouseEvent e)
          Returns a boolean indicating whether the mouse event should be interpreted as an unsort trigger or not.
 boolean isSortOrderGesture(MouseEvent e)
          Returns a boolean indicating whether the mouse event should be interpreted as any type of sort change trigger.
 boolean isToggleSortOrderGesture(MouseEvent e)
          Returns a boolean indicating whether the mouse event should be interpreted as a toggle sort trigger or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JXTableHeader.SortGestureRecognizer

public JXTableHeader.SortGestureRecognizer()
Method Detail

isResetSortOrderGesture

public boolean isResetSortOrderGesture(MouseEvent e)
Returns a boolean indicating whether the mouse event should be interpreted as an unsort trigger or not.

Parameters:
e - a mouseEvent representing a left mouse click.
Returns:
true if the mouse click should be used as a unsort gesture

isToggleSortOrderGesture

public boolean isToggleSortOrderGesture(MouseEvent e)
Returns a boolean indicating whether the mouse event should be interpreted as a toggle sort trigger or not.

Parameters:
e - a mouseEvent representing a left mouse click.
Returns:
true if the mouse click should be used as a toggle sort gesture

isSortOrderGesture

public boolean isSortOrderGesture(MouseEvent e)
Returns a boolean indicating whether the mouse event should be interpreted as any type of sort change trigger.

Parameters:
e - a mouseEvent representing a left mouse click.
Returns:
true if the mouse click should be used as a sort/unsort gesture

isResetModifier

protected boolean isResetModifier(MouseEvent e)
Returns a boolean indicating whether the mouse event's modifier should be interpreted as a unsort or not.

Parameters:
e - a mouseEvent representing a left mouse click.
Returns:
true if the mouse click's modifier should be interpreted as a reset.