|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.table.JTableHeader
org.jdesktop.swingx.JXTableHeader
public class JXTableHeader
TableHeader with extended functionality if associated Table is of type JXTable.
The enhancements:
toggleSortOrder(int)
and resetSortOrder()
ColumnHeaderRenderer
,
JXTable.toggleSortOrder(int)
,
JXTable.resetSortOrder()
,
Serialized FormNested Class Summary | |
---|---|
static class |
JXTableHeader.SortGestureRecognizer
Encapsulates decision about which MouseEvents should trigger sort/unsort events. |
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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
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 | |
---|---|
JXTableHeader()
Constructs a JTableHeader with a default
TableColumnModel . |
|
JXTableHeader(TableColumnModel columnModel)
Constructs a JTableHeader which is initialized with
cm as the column model. |
Method Summary | |
---|---|
void |
columnPropertyChange(PropertyChangeEvent event)
Implementing TableColumnModelExt: listening to column property changes. |
protected JXTableHeader.SortGestureRecognizer |
createSortGestureRecognizer()
creates and returns the default SortGestureRecognizer. |
TableCellRenderer |
getCellRenderer(int columnIndex)
Returns the TableCellRenderer used for rendering the headerCell of the column at columnIndex. |
protected String |
getColumnToolTipText(MouseEvent event)
|
TableColumn |
getDraggedColumn()
Returns the the dragged column if and only if, a drag is in process and the column is visible, otherwise returns null . |
protected int |
getMinimumHeight(int height)
Allows to enforce a minimum heigth in the getXXSize methods. |
Dimension |
getPreferredSize()
Overridden to adjust for a minimum height as returned by #getMinimumHeight. |
protected Dimension |
getPreferredSize(Dimension pref)
Hack around #334-swingx: super doesnt measure all headerRenderers for prefSize. |
JXTableHeader.SortGestureRecognizer |
getSortGestureRecognizer()
Lazily creates and returns the SortGestureRecognizer. |
String |
getToolTipText(MouseEvent event)
overridden to respect the column tooltip, if available. |
JXTable |
getXTable()
|
protected void |
installHeaderListener()
|
protected boolean |
isColumnEvent(PropertyChangeEvent event)
|
protected void |
postUpdateRendererUI(TableCellRenderer oldRenderer)
Cleans up after the UIDelegate has updated the default renderer. |
protected TableCellRenderer |
preUpdateRendererUI()
Prepares the default renderer and internal state for updateUI. |
void |
setDraggedDistance(int distance)
Sets the header's draggedDistance to distance . |
void |
setSortGestureRecognizer(JXTableHeader.SortGestureRecognizer recognizer)
Set the SortGestureRecognizer for use in the HeaderListener. |
void |
setTable(JTable table)
Sets the associated JTable. |
protected void |
uninstallHeaderListener()
|
void |
updateUI()
Notification from the UIManager that the look and feel
(L&F) has changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.swing.event.TableColumnModelListener |
---|
columnAdded, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged |
Constructor Detail |
---|
public JXTableHeader()
JTableHeader
with a default
TableColumnModel
.
JTableHeader.createDefaultColumnModel()
public JXTableHeader(TableColumnModel columnModel)
JTableHeader
which is initialized with
cm
as the column model. If cm
is
null
this method will initialize the table header with a
default TableColumnModel
.
columnModel
- the column model for the tableJTableHeader.createDefaultColumnModel()
Method Detail |
---|
public void setTable(JTable table)
PENDING: who is responsible for synching the columnModel?
setTable
in class JTableHeader
table
- the new tablepublic void columnPropertyChange(PropertyChangeEvent event)
columnPropertyChange
in interface TableColumnModelExtListener
event
- change notification from a contained TableColumn.isColumnEvent(PropertyChangeEvent)
protected boolean isColumnEvent(PropertyChangeEvent event)
event
- the PropertyChangeEvent received as TableColumnModelExtListener.
public String getToolTipText(MouseEvent event)
getToolTipText
in class JTableHeader
event
- the location of the event identifies the proper
renderer and, therefore, the proper tip
protected String getColumnToolTipText(MouseEvent event)
event
- the mouseEvent representing the mouse location.
public JXTable getXTable()
public TableCellRenderer getCellRenderer(int columnIndex)
columnIndex
- the index of the column
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
preferredSize
propertyJComponent.setPreferredSize(java.awt.Dimension)
,
ComponentUI
protected Dimension getPreferredSize(Dimension pref)
pref
- the adjusted preferred size respecting all renderers
size requirements.protected int getMinimumHeight(int height)
height
- the prefHeigth as calcualated by super.
public void updateUI()
UIManager
that the look and feel
(L&F) has changed.
Replaces the current UI object with the latest version from the
UIManager
. Overridden to update the default renderer.
updateUI
in class JTableHeader
preUpdateRendererUI()
,
postUpdateRendererUI(TableCellRenderer)
,
ColumnHeaderRenderer
protected TableCellRenderer preUpdateRendererUI()
ColumnHeaderRenderer
's delegate.
updateUI()
protected void postUpdateRendererUI(TableCellRenderer oldRenderer)
updateUI
after calling super.updateUI
.
This implementation wraps a UIResource
default renderer into a
ColumnHeaderRenderer
.
oldRenderer
- the default renderer before updateUIupdateUI()
public void setDraggedDistance(int distance)
draggedDistance
to distance
.
Overridden to scroll the table to keep the dragged column visible.
This side-effect is enabled only if the header's autoscroll property is
true
and the associated table is of type JXTable.
The autoscrolls is disabled by default. With or without - core issue #6503981 has weird effects (for jdk 1.6 - 1.6u3) on a plain JTable as well as a JXTable, fixed in 1.6u4.
setDraggedDistance
in class JTableHeader
distance
- the distance draggedpublic TableColumn getDraggedColumn()
null
.
getDraggedColumn
in class JTableHeader
null
JTableHeader.getDraggedDistance()
public JXTableHeader.SortGestureRecognizer getSortGestureRecognizer()
public void setSortGestureRecognizer(JXTableHeader.SortGestureRecognizer recognizer)
recognizer
- the recognizer to use in HeaderListener.protected JXTableHeader.SortGestureRecognizer createSortGestureRecognizer()
protected void installHeaderListener()
protected void uninstallHeaderListener()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |