com.sas.swing.visuals.tableview
Class SortHeaderRenderer

com.sas.swing.visuals.tableview.SortHeaderRenderer
All Implemented Interfaces:
Constants, com.sas.util.SortDirectionInterface, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants, javax.swing.table.TableCellRenderer
Direct Known Subclasses:
OLAPHeaderRenderer

public class SortHeaderRenderer
implements com.sas.util.SortDirectionInterface

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sas.swing.visuals.tableview.DefaultTableHeaderRenderer
focusBorder, headerOutsideBorder, nonFocusBorder
 
Fields inherited from class com.sas.swing.visuals.tableview.DefaultTableCellRenderer
border, font, gettingRenderer, isSelected, locale, noFocusBorder, splitCharacter, transform, unselectedBackground, unselectedForeground
 
Fields inherited from class com.sas.swing.visuals.LabelView
alignmentMode, BLOCK, clipped, INDIVIDUAL, leadingContentOffset, lineGap, lineWrap, orientation, preferredSpanSize, replaceNewline, replaceTab, SPAN_FILL, tabSize, topContentOffset, wordWrap
 
Fields inherited from interface com.sas.util.SortDirectionInterface
ASCENDING, DESCENDING, NOT_SORTED
 
Fields inherited from interface com.sas.swing.Constants
CENTER_BOTTOM, CENTER_LEADING, CENTER_LEFT, CENTER_RIGHT, CENTER_TOP, CENTER_TRAILING
 
Constructor Summary
SortHeaderRenderer()
          Creates a default table header renderer that has default icons used for sorting.
SortHeaderRenderer(java.lang.Character splitCharacter)
          Creates a default table header renderer that has default icons used for sorting.
 
Method Summary
 javax.swing.Icon getAscendingIcon()
          Returns the icon used for a column that has an ascending sort applied
 javax.swing.Icon getDescendingIcon()
          Returns the icon used for a column that has an descending sort applied
 java.awt.Dimension getPreferredSize()
          Overrode so that when a sort gets applied the preferred size will be the same since now a sort icon will be present.
 java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the default table cell renderer.
 void setAscendingIcon(javax.swing.Icon newIcon)
          Sets the icon used when a column has an ascending sort applied.
 void setDescendingIcon(javax.swing.Icon newIcon)
          Sets the icon used when a column has an descending sort applied.
 
Methods inherited from class com.sas.swing.visuals.tableview.DefaultTableHeaderRenderer
createOutsideBorder, getInsets, getInsets, updateUI
 
Methods inherited from class com.sas.swing.visuals.tableview.DefaultTableCellRenderer
equals, firePropertyChange, getLocale, getSplitCharacter, getTransform, isOpaque, repaint, repaint, revalidate, setBackground, setBorder, setFont, setForeground, setLocale, setSelected, setSplitCharacter, setTransform, setValue, validate
 
Methods inherited from class com.sas.swing.visuals.LabelView
checkHorizontalKey, checkVerticalKey, getAlignmentMode, getExtendedBeanInfo, getGapBetweenLines, getHorizontalAlignment, getHorizontalTextPosition, getLeadingContentOffset, getLineWrap, getOrientation, getPreferredSpanSize, getTabSize, getTopContentOffset, getUIClassID, getVerticalAlignment, getVerticalTextPosition, getWrapStyleWord, initializeLocalVars, isClipped, setAlignmentMode, setClipped, setGapBetweenLines, setHorizontalAlignment, setHorizontalTextPosition, setLeadingContentOffset, setLineWrap, setOrientation, setPreferredSpanSize, setTabSize, setTopContentOffset, setVerticalAlignment, setVerticalTextPosition, setWrapStyleWord
 

Constructor Detail

SortHeaderRenderer

public SortHeaderRenderer()
Creates a default table header renderer that has default icons used for sorting. The sort icons will only be used if the table's model is an instance of com.sas.table.SortableInterface.


SortHeaderRenderer

public SortHeaderRenderer(java.lang.Character splitCharacter)
Creates a default table header renderer that has default icons used for sorting. Sets the given character as the split character for the renderer.

Parameters:
splitCharacter - the split character to slit the lines in the renderer on, null by default
Method Detail

setAscendingIcon

public void setAscendingIcon(javax.swing.Icon newIcon)
Sets the icon used when a column has an ascending sort applied.

Parameters:
newIcon - the new icon to use for an ascending sort
See Also:
getAscendingIcon()

getAscendingIcon

public javax.swing.Icon getAscendingIcon()
Returns the icon used for a column that has an ascending sort applied

Returns:
an icon representing an ascending sort
See Also:
setAscendingIcon(Icon)

setDescendingIcon

public void setDescendingIcon(javax.swing.Icon newIcon)
Sets the icon used when a column has an descending sort applied.

Parameters:
newIcon - the new icon to use for an descending sort
See Also:
getDescendingIcon()

getDescendingIcon

public javax.swing.Icon getDescendingIcon()
Returns the icon used for a column that has an descending sort applied

Returns:
an icon representing an descending sort
See Also:
setDescendingIcon(Icon)

getTableCellRendererComponent

public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
                                                        java.lang.Object value,
                                                        boolean isSelected,
                                                        boolean hasFocus,
                                                        int row,
                                                        int column)
Returns the default table cell renderer. The renderer will get an icon applied representing the given sort direction for the column or a null icon if no sort is applied for the given column. The table must have a model that implements the com.sas.table.SortableInterface in order to show the sort icons.

Specified by:
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer
Overrides:
getTableCellRendererComponent in class DefaultTableHeaderRenderer
Parameters:
table - the JTable
value - the value to assign to the cell at [row, column]
isSelected - true if cell is selected
isFocus - true if cell has focus
row - the row of the cell to render
column - the column of the cell to render
Returns:
the default table cell renderer

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrode so that when a sort gets applied the preferred size will be the same since now a sort icon will be present.

Overrides:
getPreferredSize in class javax.swing.JComponent



Copyright © 2009 SAS Institute Inc. All Rights Reserved.