JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing
Class JCSortableTable.SortableHeaderRenderer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.klg.jclass.util.swing.JCSortableTable.SortableHeaderRenderer
All Implemented Interfaces:
Accessible, ImageObserver, JCSortableTable.SortableColumnHeader, MenuContainer, Serializable, TableCellRenderer
Direct Known Subclasses:
JCTreeTable.SwitchRenderer
Enclosing class:
JCSortableTable

protected class JCSortableTable.SortableHeaderRenderer
extends JPanel
implements TableCellRenderer, JCSortableTable.SortableColumnHeader, Serializable

Renderer/editor that has two components: the label and the sort order icon, which is stored in a button.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  com.klg.jclass.util.swing.JCBrace brace
           
protected  boolean currentLayoutLeft
           
protected  JLabel label
           
protected  JButton sortButton
           
protected  Icon sortIcon
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JCSortableTable.SortableHeaderRenderer()
          Constructor that sets up the layout using a left to right orientation.
JCSortableTable.SortableHeaderRenderer(boolean orientationLeft)
          Constructor that sets up the layout using a passed in orientation indicator.
 
Method Summary
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the component used for drawing the cell.
 boolean isCurrentLayoutLeft()
          Is the most recent layout, left to right oriented.
 void reLayout(boolean orientationLeft)
          Remove all components and add the components back in based on their availability and the table's component orientation.
protected  void setProperties(JTable table)
          Set properties on the header renderer component based on the table header.
 void setSortIcon(Icon sortIcon)
          Sets the icon to use to draw the sort icon.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

protected JLabel label

sortButton

protected JButton sortButton

brace

protected com.klg.jclass.util.swing.JCBrace brace

sortIcon

protected Icon sortIcon

currentLayoutLeft

protected boolean currentLayoutLeft
Constructor Detail

JCSortableTable.SortableHeaderRenderer

public JCSortableTable.SortableHeaderRenderer()
Constructor that sets up the layout using a left to right orientation. No icon (stored in the sortButton) to start.


JCSortableTable.SortableHeaderRenderer

public JCSortableTable.SortableHeaderRenderer(boolean orientationLeft)
Constructor that sets up the layout using a passed in orientation indicator. No icon (stored in the sortButton) to start.

Parameters:
orientationLeft - If true, the renderer is oriented leftToRight.
Method Detail

isCurrentLayoutLeft

public boolean isCurrentLayoutLeft()
Is the most recent layout, left to right oriented.

Returns:
true if the most recent layout is left to right.

setProperties

protected void setProperties(JTable table)
Set properties on the header renderer component based on the table header.

Parameters:
table - The table whose header is used to set the properties.

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Returns the component used for drawing the cell. This method is used to configure the renderer appropriately before drawing.

Specified by:
getTableCellRendererComponent in interface TableCellRenderer
Parameters:
table - the JTable that is asking the renderer to draw; can be null
value - The value of the cell to be rendered. It is up to the specific renderer to interpret and draw the value. For example, if value is the String true, it could be rendered as a String, or it could be rendered as a check box that is checked. null is a valid value.
isSelected - true if the cell is to be rendered with the selection highlighted; otherwise false
hasFocus - If true, render cell appropriately. For example, put a special border on the cell, if the cell can be edited, rendered in the color used to indicate editing.
row - The row index of the cell being drawn. When drawing the header, the value of row is -1
column - the column index of the cell being drawn
Returns:
the component used for drawing the cell at the specified row and column index with the given value

setSortIcon

public void setSortIcon(Icon sortIcon)
Sets the icon to use to draw the sort icon.

Specified by:
setSortIcon in interface JCSortableTable.SortableColumnHeader
Parameters:
sortIcon - the new sort icon to use

reLayout

public void reLayout(boolean orientationLeft)
Remove all components and add the components back in based on their availability and the table's component orientation.

Parameters:
orientationLeft - If true, layout in left to right orientation.

Copyright © 2004 Quest Software Inc..
All rights reserved.