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.
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. |
The possibilities for sort direction.
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.
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
).
label | the label for this button |
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.
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.
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.
void edu.cmu.hcii.calo.view.task.viewer.ListSortButton.setSortDirection | ( | Direction | sortDirection | ) |
Sets this button's current sort direction.
sortDirection | the sort direction |
void edu.cmu.hcii.calo.view.task.viewer.ListSortButton.paintComponent | ( | Graphics | graphics | ) | [protected] |
Paints this button.
graphics | the graphics context to paint into |
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.
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.