edu.cmu.hcii.calo.view.task.viewer.ListSortButton Class Reference

List of all members.

Detailed Description

A button that emulates the sort buttons employed by Windows Vista's Explorer application to sort, filter, and group files.

Sort buttons consist of a toggle button (which makes the clicked sort button active and thereafter toggles the sorting direction) and a pop-up menu button (which invokes a menu allowing more advanced filtering, grouping, and stacking operations). In this implementation, the menu exists only as an unimplemented stub.

Author:
Brian Ellis


Public Types

enum  Direction
 The possibilities for sort direction. More...

Public Member Functions

 ListSortButton (String label, boolean isDecorative)
 Creates a list sort button with the given text label.
 ListSortButton (String label)
 Constructs a list sort button with the given label.
boolean isActive ()
 Returns whether this button is the active sort button for its associated list.
void setActive (boolean isActive)
 Sets this button as the active sort button for its associated list.
Direction getSortDirection ()
 Gets this button's current sort direction.
void setSortDirection (Direction sortDirection)
 Sets this button's current sort direction.
Dimension getPreferredSize ()
 Gets the preferred size of this button, which will always be 24 pixels tall with a width depending on the length of its label unless setPreferredSize() has been called with a non-null argument.

Protected Member Functions

void paintComponent (Graphics graphics)
 Paints this button.

Private Attributes

boolean isActive = false
 Whether this button is the currently active sort button for its associated list.
Direction sortDirection = Direction.DESCENDING
 The sort direction of this button.
boolean mouseIsOver = false
 Whether the mouse is currently over this button.
boolean mouseIsDown = false
 Whether the mouse is currently being held down after having been pressed inside this button.
boolean isDecorative
 If true, this button is not actually a button at all, but rather a decorative placard that looks identical but is not clickable and doesn't display its name.

Static Private Attributes

static final int MENU_BUTTON_WIDTH = 24
 The width of the menu button on the right side of the control.


Member Enumeration Documentation

enum edu::cmu::hcii::calo::view::task::viewer::ListSortButton::Direction

The possibilities for sort direction.

Author:
Brian Ellis


Constructor & Destructor Documentation

edu.cmu.hcii.calo.view.task.viewer.ListSortButton.ListSortButton ( String  label,
boolean  isDecorative 
)

Creates a list sort button with the given text label.

If isDecorative is true, this label will be ignored and the button will be blank and unclickable, for use as a decorative placard to round out the width of the button bar.

Parameters:
label the label for this button
isDecorative whether this button is a decorative placard

edu.cmu.hcii.calo.view.task.viewer.ListSortButton.ListSortButton ( String  label  ) 

Constructs a list sort button with the given label.

Equivalent to ListSortButton(label, false).

Parameters:
label the label for this button


Member Function Documentation

boolean edu.cmu.hcii.calo.view.task.viewer.ListSortButton.isActive (  ) 

Returns whether this button is the active sort button for its associated list.

Active buttons show their sort direction with an arrow. Note that ListSortButton does not itself guarantee that only one button will be active at a time; for that, consider using SortButtonGroup as well.

Returns:
true if this button is active, false otherwise

void edu.cmu.hcii.calo.view.task.viewer.ListSortButton.setActive ( boolean  isActive  ) 

Sets this button as the active sort button for its associated list.

Active buttons show their sort direction with an arrow. Note that ListSortButton does not itself guarantee that only one button will be active at a time; for that, consider using SortButtonGroup as well.

Parameters:
isActive true if the button should be active, false otherwise

Direction edu.cmu.hcii.calo.view.task.viewer.ListSortButton.getSortDirection (  ) 

Gets this button's current sort direction.

Returns:
the sort direction

void edu.cmu.hcii.calo.view.task.viewer.ListSortButton.setSortDirection ( Direction  sortDirection  ) 

Sets this button's current sort direction.

Parameters:
sortDirection the sort direction

void edu.cmu.hcii.calo.view.task.viewer.ListSortButton.paintComponent ( Graphics  graphics  )  [protected]

Paints this button.

Parameters:
graphics the graphics context to paint into
See also:
javax.swing.JComponent.paintComponent(java.awt.Graphics)

Dimension edu.cmu.hcii.calo.view.task.viewer.ListSortButton.getPreferredSize (  ) 

Gets the preferred size of this button, which will always be 24 pixels tall with a width depending on the length of its label unless setPreferredSize() has been called with a non-null argument.

See also:
javax.swing.JComponent.getPreferredSize()


Member Data Documentation

final int edu.cmu.hcii.calo.view.task.viewer.ListSortButton.MENU_BUTTON_WIDTH = 24 [static, private]

The width of the menu button on the right side of the control.

boolean edu.cmu.hcii.calo.view.task.viewer.ListSortButton.isActive = false [private]

Whether this button is the currently active sort button for its associated list.

Direction edu.cmu.hcii.calo.view.task.viewer.ListSortButton.sortDirection = Direction.DESCENDING [private]

The sort direction of this button.

boolean edu.cmu.hcii.calo.view.task.viewer.ListSortButton.mouseIsOver = false [private]

Whether the mouse is currently over this button.

boolean edu.cmu.hcii.calo.view.task.viewer.ListSortButton.mouseIsDown = false [private]

Whether the mouse is currently being held down after having been pressed inside this button.

boolean edu.cmu.hcii.calo.view.task.viewer.ListSortButton.isDecorative [private]

If true, this button is not actually a button at all, but rather a decorative placard that looks identical but is not clickable and doesn't display its name.

This can be used to extend the button bar to match the width of the list it's attached to.


The documentation for this class was generated from the following file:
Generated on Mon Aug 13 15:06:28 2007 for CALO by  doxygen 1.5.2