EchoPoint
1.0

echopoint.table
Class SortableTableHeaderRenderer

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.AbstractButton
          extended bynextapp.echo.Button
              extended byechopoint.table.SortableTableHeaderRenderer
All Implemented Interfaces:
nextapp.echo.event.ActionListener, java.util.EventListener, ReflectionSetter, java.io.Serializable, nextapp.echo.table.TableCellRenderer, nextapp.echo.ToolTipSupport
Direct Known Subclasses:
NonSortableTableHeaderRenderer

public class SortableTableHeaderRenderer
extends nextapp.echo.Button
implements nextapp.echo.table.TableCellRenderer, nextapp.echo.event.ActionListener, java.io.Serializable, ReflectionSetter

Renders the table header cells for a table with a SortableTableModel. The header cells are buttons that can be pressed to sort a particular table column.

See Also:
Serialized Form

Nested Class Summary
static class SortableTableHeaderRenderer.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static nextapp.echo.Color DEFAULT_HEADER_BACKGROUND
          Default Header Background Color
static nextapp.echo.ImageReference defaultDownIcon
           
static nextapp.echo.ImageReference defaultUpIcon
           
static java.lang.String DOWN_ICON_CHANGED_PROPERTY
           
static java.lang.String STYLE_DOWN_ICON
          Down Icon Property
static java.lang.String STYLE_UP_ICON
          Up Icon Property
static nextapp.echo.ImageReference transparentIcon
           
static java.lang.String UP_ICON_CHANGED_PROPERTY
           
 
Fields inherited from class nextapp.echo.AbstractButton
ACTION_COMMAND_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, ICON_TEXT_MARGIN_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, ROLLOVER_BACKGROUND_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_FONT_CHANGED_PROPERTY, ROLLOVER_FOREGROUND_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, STYLE_HORIZONTAL_ALIGNMENT, STYLE_HORIZONTAL_TEXT_POSITION, STYLE_ICON_TEXT_MARGIN, STYLE_ROLLOVER_BACKGROUND, STYLE_ROLLOVER_ENABLED, STYLE_ROLLOVER_FONT, STYLE_ROLLOVER_FOREGROUND, STYLE_VERTICAL_ALIGNMENT, STYLE_VERTICAL_TEXT_POSITION, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.ToolTipSupport
TOOL_TIP_TEXT_CHANGED_PROPERTY
 
Constructor Summary
SortableTableHeaderRenderer(SortableTableModel sortableTableModel)
          Constructs a SortableTableHeaderRenderer
 
Method Summary
 void actionPerformed(nextapp.echo.event.ActionEvent e)
          Invoked when an action occurs.
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
 nextapp.echo.ImageReference getDownIcon()
          Returns the Icon used for the decending sort order
 SortableTableModel getSortableTableModel()
          Returns the SortableTableModel in use.
 nextapp.echo.Component getTableCellRendererComponent(nextapp.echo.Table table, java.lang.Object value, int column, int row)
          Returns a component that will be rendered at the given coordinate.
 nextapp.echo.ImageReference getUpIcon()
          Returns the Icon used for the ascending sort order
 boolean isColumnSorted(int columnIndex)
          Returns true if the specified column is sortable.
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setColumnSorted(int columnIndex, boolean isSorted)
          Controls whether a Column in the TableModel is sortable.
 void setDownIcon(nextapp.echo.ImageReference newDownIcon)
          Sets the Icon used for the decending sort order
 void setSortableTableModel(SortableTableModel newModel)
          Sets the SortableTableModel to use.
 void setUpIcon(nextapp.echo.ImageReference newUpIcon)
          Sets the Icon used for the ascending sort order
 
Methods inherited from class nextapp.echo.AbstractButton
addActionListener, addChangeListener, addItemListener, doAction, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextMargin, getModel, getRolloverBackground, getRolloverFont, getRolloverForeground, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getText, getToolTipText, getVerticalAlignment, getVerticalTextPosition, hasActionListeners, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextMargin, setModel, setRolloverBackground, setRolloverEnabled, setRolloverFont, setRolloverForeground, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setToolTipText, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultUpIcon

public static final nextapp.echo.ImageReference defaultUpIcon

defaultDownIcon

public static final nextapp.echo.ImageReference defaultDownIcon

transparentIcon

public static final nextapp.echo.ImageReference transparentIcon

STYLE_UP_ICON

public static final java.lang.String STYLE_UP_ICON
Up Icon Property

See Also:
Constant Field Values

UP_ICON_CHANGED_PROPERTY

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

STYLE_DOWN_ICON

public static final java.lang.String STYLE_DOWN_ICON
Down Icon Property

See Also:
Constant Field Values

DOWN_ICON_CHANGED_PROPERTY

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

DEFAULT_HEADER_BACKGROUND

public static final nextapp.echo.Color DEFAULT_HEADER_BACKGROUND
Default Header Background Color

Constructor Detail

SortableTableHeaderRenderer

public SortableTableHeaderRenderer(SortableTableModel sortableTableModel)
Constructs a SortableTableHeaderRenderer

Method Detail

actionPerformed

public void actionPerformed(nextapp.echo.event.ActionEvent e)
Invoked when an action occurs.

Specified by:
actionPerformed in interface nextapp.echo.event.ActionListener
Parameters:
e - The event describing the action.

applyStyle

public void applyStyle(nextapp.echo.Style style)
Applies the provided style to the component. The base nextapp.echo.Component style names can be used as well.


getDownIcon

public nextapp.echo.ImageReference getDownIcon()
Returns the Icon used for the decending sort order

Returns:
nextapp.echo.ImageReference

getTableCellRendererComponent

public nextapp.echo.Component getTableCellRendererComponent(nextapp.echo.Table table,
                                                            java.lang.Object value,
                                                            int column,
                                                            int row)
Returns a component that will be rendered at the given coordinate. This is a button that is built using the current parameters of the cell renderer, which is itself a button.

Specified by:
getTableCellRendererComponent in interface nextapp.echo.table.TableCellRenderer
Parameters:
table - The table for which the component is to be generated.
value - The value for which to generate a component.
column - The column coordinate of the value in the table.
row - The row coordinate of the value in the table.
Returns:
A component representation of the value. This component must be unique. Returning a single instance of a component across multiple calls to this method will result in undefined behavior.

getUpIcon

public nextapp.echo.ImageReference getUpIcon()
Returns the Icon used for the ascending sort order

Returns:
nextapp.echo.ImageReference

setDownIcon

public void setDownIcon(nextapp.echo.ImageReference newDownIcon)
Sets the Icon used for the decending sort order

Parameters:
newDownIcon - nextapp.echo.ImageReference

setUpIcon

public void setUpIcon(nextapp.echo.ImageReference newUpIcon)
Sets the Icon used for the ascending sort order

Parameters:
newUpIcon - nextapp.echo.ImageReference

isColumnSorted

public boolean isColumnSorted(int columnIndex)
Returns true if the specified column is sortable.

Parameters:
columnIndex -
Returns:
true if the specified column is sortable.

setColumnSorted

public void setColumnSorted(int columnIndex,
                            boolean isSorted)
Controls whether a Column in the TableModel is sortable. Initially all columns are sortable. This can be changed by this method.

Parameters:
columnIndex - - the column in question
isSorted - - true if the column is sortable.

getSortableTableModel

public SortableTableModel getSortableTableModel()
Returns the SortableTableModel in use.

Returns:
the SortableTableModel in use.

setSortableTableModel

public void setSortableTableModel(SortableTableModel newModel)
Sets the SortableTableModel to use. NOTE: this resets the sortable state of each column to be true.

Parameters:
newModel - - a new sortable table model

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Specified by:
set in interface ReflectionSetter
Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0