JIDE 3.5.15

com.jidesoft.grid
Class GroupTableHeader

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.table.JTableHeader
                  extended by com.jidesoft.grid.DraggingTableHeader
                      extended by com.jidesoft.grid.CellStyleTableHeader
                          extended by com.jidesoft.grid.SortableTableHeader
                              extended by com.jidesoft.grid.EditableTableHeader
                                  extended by com.jidesoft.grid.AutoFilterTableHeader
                                      extended by com.jidesoft.grid.GroupTableHeader
All Implemented Interfaces:
FilterableTableModelListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, CellEditorListener, TableColumnModelListener
Direct Known Subclasses:
AggregateTableHeader

public class GroupTableHeader
extends AutoFilterTableHeader

The GroupTableHeader allows the user to (un)group columns by dragging them with the mouse.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.table.JTableHeader
JTableHeader.AccessibleJTableHeader
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String PROPERTY_CONNECTION_LINE_VISIBLE
           
static String PROPERTY_GROUP_AREA_BACKGROUND
           
static String PROPERTY_GROUP_AREA_FOREGROUND
           
static String PROPERTY_GROUP_AREA_LABEL_FONT
           
static String PROPERTY_GROUP_HEADER_ENABLED
           
static String PROPERTY_MARGIN
           
static String PROPERTY_VERTICAL_INDENTION
           
 
Fields inherited from class com.jidesoft.grid.AutoFilterTableHeader
_autoFilterEnabled, _filterableTableModel, CLIENT_PROPERTY_CUSTOM_FILTER_EDITOR_TYPE, CUSTOM_FILTER_EDITOR_TYPE_TABLE_CUSTOM_FILTER_EDITOR, PROPERTY_ACCEPT_TEXT_INPUT, PROPERTY_AUTO_FILTER_ENABLED, PROPERTY_USE_NATIVE_CELL_RENDERER
 
Fields inherited from class com.jidesoft.grid.EditableTableHeader
_cellEditor, _defaultEditor, _editingColumn, _editorComp, HEADER_ROW
 
Fields inherited from class com.jidesoft.grid.SortableTableHeader
PROPERTY_SHOW_SORT_ARROW
 
Fields inherited from class com.jidesoft.grid.CellStyleTableHeader
_cellStyleList
 
Fields inherited from class com.jidesoft.grid.DraggingTableHeader
PROPERTY_DRAGGED_COLUMN, PROPERTY_DRAGGED_DISTANCE, PROPERTY_RESIZING_COLUMN
 
Fields inherited from class javax.swing.table.JTableHeader
columnModel, draggedColumn, draggedDistance, reorderingAllowed, resizingAllowed, resizingColumn, table, updateTableInRealTime
 
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
GroupTableHeader(JTable table)
          The constructor.
 
Method Summary
 int columnAtPoint(Point point)
           
protected  GroupTableInputListener createGroupTableInputListener()
          Create the mouse and key listener for DnD feature.
 int getActualHeaderHeight()
          Get the height of the real header.
 int getActualHeaderY()
          Get the start Y of the real header.
 String getActualUIClassID()
          Returns a string that specifies the name of the L&F class that renders this component.
 Color getGroupAreaBackground()
          Gets the background color of the group area.
 Color getGroupAreaForeground()
          Gets the foreground color of the group area.
 Rectangle getGroupedHeaderRect(int groupIndex)
          Get the rectangle for the group column
 Rectangle getHeaderRect(int column)
           
 Font getLabelFont()
          Gets the font of the label while there is no grouping column.
 int getLabelHeight()
          Gets the default label height if there is no grouped column.
 Insets getMargin()
          Get group header margin.
 String getResourceString(String key)
          Gets the resource string used in GroupTableHeader.
 int getRollOverGroupColumn()
           
 String getUIDelegateClassID()
          Returns a string that specifies the name of the UIDelegate class that paints this component.
 int getVerticalIndention()
          Get the indent to display next grouped column.
 int groupedColumnAtPoint(Point point)
          Returns the grouped column index at the specified point or -1 if no such column.
 boolean isConnectionLineVisible()
          Get the flag indicating if the connect lines between grouped columns are visible.
 boolean isGroupHeaderEnabled()
          Get the flag indicating if the group header is enabled.
protected  void paintComponent(Graphics g)
          Overrides to paint the sort arrows on table header.
 void setComponentOrientation(ComponentOrientation o)
           
 void setConnectionLineVisible(boolean connectionLineVisible)
          Set the flag indicating if the connect lines between grouped columns are visible.
 void setGroupAreaBackground(Color groupAreaBackground)
          Sets the background color of the group area.
 void setGroupAreaForeground(Color groupAreaForeground)
          Sets the foreground color of the group area.
 void setGroupedWidths(int[] widths)
           
 void setGroupHeaderEnabled(boolean groupHeaderEnabled)
          Set the flag indicating if the group header is enabled.
 void setLabelFont(Font labelFont)
          Sets the font of the label while there is no grouping column.
 void setLabelHeight(int labelHeight)
          Sets the default label height if there is no grouped column.
 void setMargin(Insets margin)
          Set the group header margin.
 void setTable(JTable table)
           
 void setVerticalIndention(int verticalIndention)
          Set the indent to display next grouped column.
protected  int toggleSortOrder(int sorting)
          Toggle between sort orders

By default cycles through ascending and descending.

 
Methods inherited from class com.jidesoft.grid.AutoFilterTableHeader
clearFilters, columnMarginChanged, createDefaultEditor, createDefaultFilterableTableModel, createDefaultRenderer, createFilterableTableHeaderCellDecorator, createFilterableTableModel, customizeAutoFilterBox, editingStopped, filterableTableModelChanged, formatColumnTitle, getAutoFilterTableHeaderRenderer, getFilterableTableHeaderCellDecorator, getFilterableTableModel, getFilterableTableModel, getFilterIcon, getFormattedColumnName, getToolTipText, initTable, isAcceptTextInput, isAllowMultipleValues, isAllowMultipleValues, isAutoFilterEnabled, isAutoRequestFocus, isCellEditable, isPreferSelectedValues, isRolloverEnabled, isShowFilterIcon, isShowFilterName, isShowFilterNameAsToolTip, isUseNativeHeaderRenderer, propertyChange, setAcceptTextInput, setAllowMultipleValues, setAutoFilterEnabled, setPreferSelectedValues, setShowFilterIcon, setShowFilterName, setShowFilterNameAsToolTip, setShowSortArrow, setUseNativeHeaderRenderer, tableModelChanged
 
Methods inherited from class com.jidesoft.grid.EditableTableHeader
cancelEditing, customizeEditorComponent, editCellAt, editCellAt, editingCanceled, getCellEditor, getCellEditor, getDefaultEditor, getEditingColumn, getEditorComponent, isClickToStartEditing, isEditing, prepareEditor, removeEditor, removeNotify, resizeAndRepaint, setCellEditor, setClickToStartEditing, setDefaultEditor, setDraggedColumn, setEditingColumn, setRolloverEnabled, stopEditing
 
Methods inherited from class com.jidesoft.grid.SortableTableHeader
createSortableTableHeaderCellDecorator, createSortIcon, getSortableTableHeaderCellDecorator, isShowSortArrow, paintSortArrow, paintSortArrows
 
Methods inherited from class com.jidesoft.grid.CellStyleTableHeader
addCellDecorator, addCellDecorator, addCellStyleCustomizer, clearCellStyleCustomizers, collectCellStyles, createToolTip, customizeRendererComponent, getCellDecorators, getCellStyleAt, getCellStyleCustomizers, getDefaultCursor, mergeCellStyles, originalColumnAtPoint, releaseRendererComponent, removeCellDecorator, removeCellStyleCustomizer, setCursor, setDefaultRenderer, updateUI
 
Methods inherited from class com.jidesoft.grid.DraggingTableHeader
getPreferredSize, setDraggedDistance, setResizingColumn
 
Methods inherited from class javax.swing.table.JTableHeader
columnAdded, columnMoved, columnRemoved, columnSelectionChanged, createDefaultColumnModel, getAccessibleContext, getColumnModel, getDefaultRenderer, getDraggedColumn, getDraggedDistance, getReorderingAllowed, getResizingAllowed, getResizingColumn, getTable, getUI, getUIClassID, getUpdateTableInRealTime, initializeLocalVars, paramString, setColumnModel, setReorderingAllowed, setResizingAllowed, setUI, setUpdateTableInRealTime
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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

PROPERTY_MARGIN

public static final String PROPERTY_MARGIN
See Also:
Constant Field Values

PROPERTY_VERTICAL_INDENTION

public static final String PROPERTY_VERTICAL_INDENTION
See Also:
Constant Field Values

PROPERTY_CONNECTION_LINE_VISIBLE

public static final String PROPERTY_CONNECTION_LINE_VISIBLE
See Also:
Constant Field Values

PROPERTY_GROUP_HEADER_ENABLED

public static final String PROPERTY_GROUP_HEADER_ENABLED
See Also:
Constant Field Values

PROPERTY_GROUP_AREA_BACKGROUND

public static final String PROPERTY_GROUP_AREA_BACKGROUND
See Also:
Constant Field Values

PROPERTY_GROUP_AREA_FOREGROUND

public static final String PROPERTY_GROUP_AREA_FOREGROUND
See Also:
Constant Field Values

PROPERTY_GROUP_AREA_LABEL_FONT

public static final String PROPERTY_GROUP_AREA_LABEL_FONT
See Also:
Constant Field Values
Constructor Detail

GroupTableHeader

public GroupTableHeader(JTable table)
The constructor.

Parameters:
table - the group table to install this header.
Method Detail

getActualUIClassID

public String getActualUIClassID()
Description copied from class: SortableTableHeader
Returns a string that specifies the name of the L&F class that renders this component.

Overrides:
getActualUIClassID in class AutoFilterTableHeader
Returns:
the string "SortableTableHeaderUI"

getUIDelegateClassID

public String getUIDelegateClassID()
Returns a string that specifies the name of the UIDelegate class that paints this component.

Overrides:
getUIDelegateClassID in class AutoFilterTableHeader
Returns:
the string "TableHeader.groupTableHeaderUIDelegate"
Since:
3.1.0

setTable

public void setTable(JTable table)
Overrides:
setTable in class AutoFilterTableHeader

setComponentOrientation

public void setComponentOrientation(ComponentOrientation o)
Overrides:
setComponentOrientation in class Component

getGroupAreaBackground

public Color getGroupAreaBackground()
Gets the background color of the group area.

Returns:
the background color of the group area.
Since:
3.3.0
See Also:
setGroupAreaBackground(java.awt.Color)

setGroupAreaBackground

public void setGroupAreaBackground(Color groupAreaBackground)
Sets the background color of the group area.

By default, the background color is null, which means using the default color.

Parameters:
groupAreaBackground - the background
Since:
3.3.0

getGroupAreaForeground

public Color getGroupAreaForeground()
Gets the foreground color of the group area.

Returns:
the foreground color of the group area.
Since:
3.3.0
See Also:
setGroupAreaForeground(java.awt.Color)

setGroupAreaForeground

public void setGroupAreaForeground(Color groupAreaForeground)
Sets the foreground color of the group area.

By default, the foreground color is Color.gray.

Parameters:
groupAreaForeground - the foreground
Since:
3.3.0

paintComponent

protected void paintComponent(Graphics g)
Description copied from class: SortableTableHeader
Overrides to paint the sort arrows on table header.

Overrides:
paintComponent in class SortableTableHeader
Parameters:
g - the Graphics object

getActualHeaderHeight

public int getActualHeaderHeight()
Get the height of the real header.

Returns:
the height.

getActualHeaderY

public int getActualHeaderY()
Get the start Y of the real header.

Overrides:
getActualHeaderY in class CellStyleTableHeader
Returns:
the start Y.

getHeaderRect

public Rectangle getHeaderRect(int column)
Overrides:
getHeaderRect in class JTableHeader

columnAtPoint

public int columnAtPoint(Point point)
Overrides:
columnAtPoint in class JTableHeader

groupedColumnAtPoint

public int groupedColumnAtPoint(Point point)
Returns the grouped column index at the specified point or -1 if no such column.

Parameters:
point - the point
Returns:
the grouped column index at the specified point. -1 if no such column.

getGroupedHeaderRect

public Rectangle getGroupedHeaderRect(int groupIndex)
Get the rectangle for the group column

Parameters:
groupIndex - the index of the group column
Returns:
the rectangle it occupies.

setGroupedWidths

public void setGroupedWidths(int[] widths)

createGroupTableInputListener

protected GroupTableInputListener createGroupTableInputListener()
Create the mouse and key listener for DnD feature.

Returns:
the listener.

setMargin

public void setMargin(Insets margin)
Set the group header margin.

By default, the margin is {3, 0, 3, 0}.

Parameters:
margin - the margin

getMargin

public Insets getMargin()
Get group header margin.

Returns:
the margin.
See Also:
(java.awt.Insets)

getRollOverGroupColumn

public int getRollOverGroupColumn()

toggleSortOrder

protected int toggleSortOrder(int sorting)
Toggle between sort orders

By default cycles through ascending and descending.

Parameters:
sorting - current sort order
Returns:
next sort order.

getResourceString

public String getResourceString(String key)
Gets the resource string used in GroupTableHeader. Subclass can override it to provide their own strings.

Parameters:
key - the resource key
Returns:
the localized string.

getVerticalIndention

public int getVerticalIndention()
Get the indent to display next grouped column.

Returns:
the indent.

setVerticalIndention

public void setVerticalIndention(int verticalIndention)
Set the indent to display next grouped column.

By default, the value is -1 which means half of the original height.

Parameters:
verticalIndention - the indention

isConnectionLineVisible

public boolean isConnectionLineVisible()
Get the flag indicating if the connect lines between grouped columns are visible.

Returns:
true if connect lines are visible. Otherwise false.

setConnectionLineVisible

public void setConnectionLineVisible(boolean connectionLineVisible)
Set the flag indicating if the connect lines between grouped columns are visible.

By default, the flag is true.

Parameters:
connectionLineVisible - the flag

isGroupHeaderEnabled

public boolean isGroupHeaderEnabled()
Get the flag indicating if the group header is enabled.

Returns:
true if the group header is enabled. Otherwise false.

setGroupHeaderEnabled

public void setGroupHeaderEnabled(boolean groupHeaderEnabled)
Set the flag indicating if the group header is enabled.

By default the flag is false to keep the same DnD behavior with normal table header. You need set it to true explicitly to get the group header behavior.

Parameters:
groupHeaderEnabled - the flag

getLabelHeight

public int getLabelHeight()
Gets the default label height if there is no grouped column.

Returns:
the label height.

setLabelHeight

public void setLabelHeight(int labelHeight)
Sets the default label height if there is no grouped column.

Parameters:
labelHeight - the height of the label

getLabelFont

public Font getLabelFont()
Gets the font of the label while there is no grouping column.

Returns:
the font.
See Also:
setLabelFont(java.awt.Font)

setLabelFont

public void setLabelFont(Font labelFont)
Sets the font of the label while there is no grouping column.

By default, the value is null. In this case, the column will occupy exactly the same height with the actual header. If you set this font to a non-null value, the label size will be resized automatically.

Parameters:
labelFont - the font

JIDE 3.5.15