Class JXTreeTable.TreeTableCellRenderer
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,Scrollable
,TableCellRenderer
- Enclosing class:
- JXTreeTable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jdesktop.swingx.JXTree
JXTree.CellEditorRemover, JXTree.DelegatingRenderer, JXTree.TreeAdapter, JXTree.XTreeModelHandler
Nested classes/interfaces inherited from class javax.swing.JTree
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector
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
FieldsModifier and TypeFieldDescriptionprotected Border
Border to draw around the tree, if this is non-null, it will be painted.protected JXTreeTable
protected int
Fields inherited from class org.jdesktop.swingx.JXTree
compoundHighlighter, dataAdapter, uiClassID
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) final void
bind
(JXTreeTable treeTable) Immutably binds this TreeTableModelAdapter to the specified JXTreeTable.protected RolloverProducer
Creates and returns the RolloverProducer to use with this tree.void
doClick()
getTableCellRendererComponent
(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) boolean
isRowSelected
(int row) boolean
void
Sublcassed to translate the graphics such that the last visible row will be drawn at 0,0.void
scrollRectToVisible
(Rectangle aRect) void
void
setBounds
(int x, int y, int w, int h) This is overridden to set the location to (0, 0) and set the dimension to exactly fill the bounds of the hierarchical column.protected void
setExpandedState
(TreePath path, boolean state) void
setRolloverEnabled
(boolean rolloverEnabled) Sets the property to enable/disable rollover support.void
setRowHeight
(int rowHeight) Sets the row height of the tree, and forwards the row height to the table.void
setToolTipText
(String text) protected boolean
Returns a boolean indicating whether the drop hack should be applied.void
updateUI()
updateUI is overridden to set the colors of the Tree's renderer to match that of the table.Methods inherited from class org.jdesktop.swingx.JXTree
addHighlighter, analyseFocus, collapseAll, createDefaultCellRenderer, createHighlighterChangeListener, createLinkController, createTreeModelListener, doFind, expandAll, getCellRenderer, getComponentAdapter, getComponentAdapter, getCompoundHighlighter, getHighlighterChangeListener, getHighlighters, getLinkController, getNextMatch, getPopupLocation, getPopupTriggerLocation, getSearchable, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionPaths, getSelectionRows, getStringAt, getStringAt, getWrappedCellRenderer, invalidateCellSizeCache, isOverwriteRendererIcons, isRolloverEnabled, removeHighlighter, removeNotify, setBackground, setCellRenderer, setClosedIcon, setCollapsedIcon, setExpandedIcon, setHighlighters, setLeafIcon, setModel, setOpenIcon, setOverwriteRendererIcons, setSearchable, setSelectionBackground, setSelectionForeground, setSelectionMode, startEditingAtPath, updateHighlighterUI, updatePopupTrigger, updateRendererEditorUI
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setDragEnabled, setDropMode, setEditable, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setRootVisible, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, stopEditing, treeDidChange
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, 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, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
highlightBorder
Border to draw around the tree, if this is non-null, it will be painted. -
treeTable
-
visibleRow
protected int visibleRow
-
-
Constructor Details
-
TreeTableCellRenderer
-
-
Method Details
-
setRolloverEnabled
public void setRolloverEnabled(boolean rolloverEnabled) Description copied from class:JXTree
Sets the property to enable/disable rollover support. If enabled, the tree fires property changes on per-cell mouse rollover state, i.e. when the mouse enters/leaves a tree cell.This can be enabled to show "live" rollover behaviour, f.i. the cursor over a cell rendered by a JXHyperlink.
The default value is false.
- Overrides:
setRolloverEnabled
in classJXTree
- Parameters:
rolloverEnabled
- a boolean indicating whether or not the rollover functionality should be enabled.- See Also:
-
addPropertyChangeListener
- Overrides:
addPropertyChangeListener
in classContainer
-
isVisible
public boolean isVisible()Overridden to hack around #766-swingx: cursor flickering in DnD when dragging over tree column. This is a core bug (#6700748) related to painting the rendering component on a CellRendererPane. A trick around is to let this return false.
This implementation applies the trick, that is returns false always. The hack can be disabled by setting the treeTable's client property DROP_HACK_FLAG_KEY to Boolean.FALSE.
-
shouldApplyDropHack
protected boolean shouldApplyDropHack()Returns a boolean indicating whether the drop hack should be applied.- Returns:
- a boolean indicating whether the drop hack should be applied.
-
setToolTipText
Overridden to not automatically de/register itself from/to the ToolTipManager. As rendering component it is not considered to be active in any way, so the manager must not listen.
- Overrides:
setToolTipText
in classJComponent
-
bind
Immutably binds this TreeTableModelAdapter to the specified JXTreeTable. For internal use by JXTreeTable only.- Parameters:
treeTable
- the JXTreeTable instance that this renderer is bound to
-
createRolloverProducer
Description copied from class:JXTree
Creates and returns the RolloverProducer to use with this tree.- Overrides:
createRolloverProducer
in classJXTree
- Returns:
RolloverProducer
to use with this tree- See Also:
-
scrollRectToVisible
- Overrides:
scrollRectToVisible
in classJComponent
-
setExpandedState
- Overrides:
setExpandedState
in classJTree
-
updateUI
public void updateUI()updateUI is overridden to set the colors of the Tree's renderer to match that of the table. -
setRowHeight
public void setRowHeight(int rowHeight) Sets the row height of the tree, and forwards the row height to the table.- Overrides:
setRowHeight
in classJTree
-
setBounds
public void setBounds(int x, int y, int w, int h) This is overridden to set the location to (0, 0) and set the dimension to exactly fill the bounds of the hierarchical column. -
paint
Sublcassed to translate the graphics such that the last visible row will be drawn at 0,0.- Overrides:
paint
in classJComponent
-
setBorder
Overridden to fix #swingx-1525: BorderHighlighter fills tree column.
Basically, the reason was that the border is set on the tree as a whole instead of on the cell level. The fix is to bypass super completely, keep a reference to the cell border and manually paint it around the cell in the overridden paint.
Note: in the paint we need to paint either the focus border or the cellBorder, the former taking precedence.
- Overrides:
setBorder
in classJComponent
-
doClick
public void doClick() -
isRowSelected
public boolean isRowSelected(int row) - Overrides:
isRowSelected
in classJTree
-
getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) - Specified by:
getTableCellRendererComponent
in interfaceTableCellRenderer
-