|
||||||||||
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.
toggleSortOrder(int)
and resetSortOrder()
JXTable.toggleSortOrder(int)
,
JXTable.resetSortOrder()
,
JXTableHeader.SortGestureRecognizer
,
Serialized FormNested Class Summary | |
---|---|
static class |
JXTableHeader.SortGestureRecognizer
Deprecated. no longer used internally - keep until we know better how to meet our requirments in Mustang |
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 |
---|
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)
Implements TableColumnModelExt to allow internal update after column property changes. |
protected JXTableHeader.SortGestureRecognizer |
createSortGestureRecognizer()
Deprecated. no longer used internally - keep until we know better how to meet our requirments in Mustang |
protected PropertyChangeListener |
createTablePropertyChangeListener()
Creates and returns the PropertyChangeListener to register on the owning table. |
TableCellRenderer |
getCellRenderer(int columnIndex)
Returns the TableCellRenderer to use for the column with the given index. |
protected String |
getColumnToolTipText(MouseEvent event)
Returns the column tooltip of the column at the position of the MouseEvent, if a tooltip is available. |
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)
Returns a reasonable minimal preferred height for the header. |
Dimension |
getPreferredSize()
If the preferredSize has been set to a
non-null value just returns it. |
protected Dimension |
getPreferredSize(Dimension pref)
Returns a preferred size which is adjusted to the maximum of all header renderers' height requirement. |
JXTableHeader.SortGestureRecognizer |
getSortGestureRecognizer()
Deprecated. no longer used internally - keep until we know better how to meet our requirments in Mustang |
protected PropertyChangeListener |
getTablePropertyChangeListener()
Returns the PropertyChangeListener to register on the owning table, lazily created. |
String |
getToolTipText(MouseEvent event)
Allows the renderer's tips to be used if there is text set. |
JXTable |
getXTable()
Returns the associated table if it is of type JXTable, or null if not. |
protected void |
installHeaderListener()
Creates and installs header listeners to service the extended functionality. |
protected void |
installTable()
Installs the table. |
protected boolean |
isColumnEvent(PropertyChangeEvent event)
Returns a boolean indicating if a property change event received from column changes is expected to be already broadcasted by the core TableColumnModel. |
void |
setDraggedDistance(int distance)
Sets the header's draggedDistance to distance . |
void |
setSortGestureRecognizer(JXTableHeader.SortGestureRecognizer recognizer)
Deprecated. no longer used internally - keep until we know better how to meet our requirments in Mustang |
void |
setTable(JTable table)
Sets the table associated with this header. |
protected void |
uninstallHeaderListener()
Uninstalls header listeners to service the extended functionality. |
protected void |
uninstallTable()
Uninstalls the table. |
protected void |
updateEnabledFromTable()
Synchs the header's enabled with the table's enabled property. |
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)
Sets the associated JTable. Enables enhanced header features if table is of type JXTable.
PENDING: who is responsible for synching the columnModel?
setTable
in class JTableHeader
table
- the new tableprotected void installTable()
This implemenation synchs enabled state and installs the PropertyChangeListener.
protected void updateEnabledFromTable()
protected void uninstallTable()
This implementation uninstalls the PropertyChangeListener.
public void columnPropertyChange(PropertyChangeEvent event)
This implementation triggers a resizeAndRepaint on every propertyChange which doesn't already fire a "normal" columnModelEvent.
columnPropertyChange
in interface TableColumnModelExtListener
event
- change notification from a contained TableColumn.isColumnEvent(PropertyChangeEvent)
,
TableColumnModelExtListener
protected boolean isColumnEvent(PropertyChangeEvent event)
This implementation returns true for notification of width, preferredWidth and visible properties, false otherwise.
event
- the PropertyChangeEvent received as TableColumnModelExtListener.
public String getToolTipText(MouseEvent event)
Overridden to respect the column tooltip, if available.
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 in view coordinates of the column
public Dimension getPreferredSize()
preferredSize
has been set to a
non-null
value just returns it.
If the UI delegate's getPreferredSize
method returns a non null
value then return that;
otherwise defer to the component's layout manager. Overridden to adjust for a reasonable minimum height. Done to fix Issue 334-swingx, which actually is a core issue misbehaving in returning a zero height if the first column has no text.
getPreferredSize
in class JComponent
preferredSize
propertygetPreferredSize(Dimension)
,
getMinimumHeight(int).
protected Dimension getPreferredSize(Dimension pref)
pref
- an initial preferred size
getPreferredSize()
,
getMinimumHeight(int)
protected int getMinimumHeight(int height)
This implementation returns the default header renderer's preferred height as measured with a dummy value if the input height is 0, otherwise returns the height unchanged.
height
- the initial height.
getPreferredSize()
,
getPreferredSize(Dimension)
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()
protected PropertyChangeListener getTablePropertyChangeListener()
protected PropertyChangeListener createTablePropertyChangeListener()
This implementation synchs the header's enabled properties with the table's enabled.
protected void installHeaderListener()
protected void uninstallHeaderListener()
@Deprecated public JXTableHeader.SortGestureRecognizer getSortGestureRecognizer()
setSortGestureRecognizer(SortGestureRecognizer)
,
createSortGestureRecognizer()
@Deprecated public void setSortGestureRecognizer(JXTableHeader.SortGestureRecognizer recognizer)
This is a bound property.
recognizer
- the SortGestureRecognizer to use for interpreting mouse events
as sort gesturesgetSortGestureRecognizer()
,
createSortGestureRecognizer()
@Deprecated protected JXTableHeader.SortGestureRecognizer createSortGestureRecognizer()
getSortGestureRecognizer()
,
setSortGestureRecognizer(SortGestureRecognizer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |