public class TreePainter<E extends javax.swing.JTree,U extends WebTreeUI,D extends IDecoration<E,D>> extends AbstractDecorationPainter<E,U,D> implements ITreePainter<E,U>
| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.tree.TreeCellRenderer |
currentCellRenderer |
protected boolean |
dashedLines |
protected int |
depthOffset |
protected javax.swing.tree.TreePath |
draggablePath |
protected ITreeDropLocationPainter |
dropLocationPainter
Tree drop location painter.
|
protected int |
editingRow |
protected ITreeNodePainter |
hoverPainter
Hover node background painter.
|
protected java.util.List<java.lang.Integer> |
initialSelection
Runtime variables.
|
protected int |
lastSelectionRow |
protected java.awt.Color |
linesColor |
protected java.awt.event.MouseAdapter |
mouseAdapter |
protected java.util.Hashtable<javax.swing.tree.TreePath,java.lang.Boolean> |
paintingCache |
protected boolean |
paintLines
Style settings.
|
protected javax.swing.CellRendererPane |
rendererPane |
protected ITreeRowPainter |
rowPainter
Tree rows background painter.
|
protected java.awt.Point |
selectionEnd |
protected ITreeNodePainter |
selectionPainter
Selected nodes background painter.
|
protected java.awt.Point |
selectionStart |
protected ITreeSelectorPainter |
selectorPainter
Tree nodes selector painter.
|
protected int |
totalChildIndent
Painting variables.
|
protected javax.swing.event.TreeExpansionListener |
treeExpansionListener |
protected javax.swing.tree.TreeModel |
treeModel |
protected javax.swing.event.TreeSelectionListener |
treeSelectionListener
Listeners.
|
protected javax.swing.tree.AbstractLayoutCache |
treeState |
ancestor, DECORATION_STATES_PROPERTY, decorationCache, decorations, focused, focusStateTracker, hierarchyTracker, hover, hoverStateTracker, neighboursTracker, statescomponent, listeners, ltr, propertyChangeListener, ui| Constructor and Description |
|---|
TreePainter() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
findCenteredX(int x,
int iconWidth)
Returns centered x coordinate for the icon.
|
protected int |
getHorizontalLegIndent()
Returns horizontal leg indent.
|
protected javax.swing.tree.TreePath |
getLastChildPath(javax.swing.tree.TreePath parent)
Returns a path to the last child of
parent. |
protected java.awt.Rectangle |
getPathBounds(javax.swing.tree.TreePath path)
Returns the Rectangle enclosing the label portion that the last item in path will be painted into.
|
protected java.awt.Rectangle |
getPathBounds(javax.swing.tree.TreePath path,
java.awt.Insets insets,
java.awt.Rectangle bounds)
Returns path bounds used for painting.
|
protected int |
getRowX(int row,
int depth)
Returns the location, along the x-axis, to render a particular row at.
|
protected java.util.List<SectionPainter<E,U>> |
getSectionPainters()
Returns section painters used within this painter.
|
protected java.util.List<java.awt.Rectangle> |
getSelectionRects()
Returns list of tree selections bounds.
|
protected boolean |
getShowsRootHandles()
Returns whether or not root handles should be displayed.
|
protected int |
getVerticalLegIndent()
The vertical element of legs between nodes starts at the bottom of the parent node by default.
|
void |
install(E c,
U ui)
Called when painter is installed onto some component.
|
protected boolean |
isDragAvailable()
Returns whether tree nodes drag available or not.
|
protected boolean |
isDropLocationAvailable()
Returns whether or not drop location is available.
|
protected boolean |
isFullLineSelection()
Returns whether tree selection style points that the whole line is a single cell or not.
|
boolean |
isHoverDecorationSupported()
Returns whether or not hover node decoration is supported by this tree painter.
|
protected boolean |
isLocationInExpandControl(javax.swing.tree.TreePath path,
int mouseX,
int mouseY)
Returns whether or not
mouseX and mouseY fall in the area of row that is used to expand/collapse the node and the
node at row does not represent a leaf. |
protected boolean |
isRootVisible()
Returns whether or not root is visible.
|
protected boolean |
isSelectorAvailable()
Returns whether selector is available for current tree or not.
|
protected void |
paintBackground(java.awt.Graphics2D g2d)
Paints tree background.
|
protected void |
paintCentered(java.awt.Component c,
java.awt.Graphics2D g2d,
javax.swing.Icon icon,
int x,
int y)
Paints centered icon.
|
protected void |
paintContent(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
Paints content decorated by this painter.
|
protected void |
paintDashedHorizontalLine(java.awt.Graphics2D g2d,
int y,
int x1,
int x2)
Paints dashed horizontal line.
|
protected void |
paintDashedVerticalLine(java.awt.Graphics2D g2d,
int x,
int y1,
int y2)
Paints dashed vertical line.
|
protected void |
paintDropLocation(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
Paints drop location if it is available.
|
protected void |
paintExpandControl(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
java.awt.Rectangle bounds,
javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Paints the expand (toggle) part of a row.
|
protected void |
paintHorizontalLine(java.awt.Graphics2D g2d,
int y,
int x1,
int x2)
Paints a horizontal line.
|
protected void |
paintHorizontalPartOfLeg(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
java.awt.Rectangle bounds,
javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Paints the horizontal part of the leg.
|
protected void |
paintHoverNodeBackground(java.awt.Graphics2D g2d)
Paints hover node highlight.
|
protected void |
paintMultiselector(java.awt.Graphics2D g2d)
Paints custom WebLaF multiselector.
|
protected void |
paintRow(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
java.awt.Rectangle bounds,
javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Paints the renderer part of a row.
|
protected void |
paintSelectedNodesBackground(java.awt.Graphics2D g2d)
Paints special WebLaF tree nodes selection.
|
protected void |
paintTree(java.awt.Graphics2D g2d)
Paints all base tree elements.
|
protected void |
paintVerticalLine(java.awt.Graphics2D g2d,
int x,
int y1,
int y2)
Paints a vertical line.
|
protected void |
paintVerticalPartOfLeg(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
javax.swing.tree.TreePath path)
Paints the vertical part of the leg.
|
void |
prepareToPaint(java.util.Hashtable<javax.swing.tree.TreePath,java.lang.Boolean> paintingCache,
javax.swing.tree.TreeCellRenderer currentCellRenderer)
Prepares painter to pain tree.
|
protected void |
propertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
Performs various updates on property changes.
|
protected void |
repaintSelection()
Repaints all rectangles containing tree selections.
|
protected boolean |
shouldPaintExpandControl(javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Returns whether or not the expand (toggle) control should be painted for the specified row.
|
void |
uninstall(E c,
U ui)
Called when painter is installed into some component.
|
protected void |
updateDepthOffset()
Updates how much each depth should be offset by.
|
adjustBounds, asList, collectDecorationStates, getBorders, getDecoration, getDecorations, getDecorationSize, getDecorationStates, getPreferredSize, installFocusListener, installHierarchyListener, installHoverListener, isDecorated, isDecorationPaintAllowed, isEnabled, isFocused, isHover, isOpaque, isOpaqueDecorated, isOpaqueUndecorated, isPlainBackgroundPaintAllowed, paint, provideShape, uninstallFocusListener, uninstallHierarchyListener, uninstallHoverListener, updateDecorationState, usesState, usesStateaddPainterListener, b, borderChange, getCompleteBorder, i, i, i, installPropertyChangeListener, isSectionPainter, isSettingsUpdateAllowed, orientationChange, p, removePainterListener, repaint, repaint, repaint, revalidate, saveOrientation, uninstallPropertyChangeListener, updateAll, updateBorder, updateOpacity, updateOrientationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPainterListener, getBorders, getPreferredSize, isOpaque, paint, removePainterListenerprotected boolean paintLines
protected boolean dashedLines
protected java.awt.Color linesColor
@DefaultPainter(value=AlternateTreeRowPainter.class) protected ITreeRowPainter rowPainter
@DefaultPainter(value=TreeNodePainter.class) protected ITreeNodePainter hoverPainter
@DefaultPainter(value=TreeNodePainter.class) protected ITreeNodePainter selectionPainter
@DefaultPainter(value=TreeDropLocationPainter.class) protected ITreeDropLocationPainter dropLocationPainter
@DefaultPainter(value=TreeSelectorPainter.class) protected ITreeSelectorPainter selectorPainter
protected javax.swing.event.TreeSelectionListener treeSelectionListener
protected javax.swing.event.TreeExpansionListener treeExpansionListener
protected java.awt.event.MouseAdapter mouseAdapter
protected java.util.List<java.lang.Integer> initialSelection
protected java.awt.Point selectionStart
protected java.awt.Point selectionEnd
protected javax.swing.tree.TreePath draggablePath
protected int totalChildIndent
protected int depthOffset
protected javax.swing.tree.TreeModel treeModel
protected javax.swing.tree.AbstractLayoutCache treeState
protected java.util.Hashtable<javax.swing.tree.TreePath,java.lang.Boolean> paintingCache
protected javax.swing.CellRendererPane rendererPane
protected javax.swing.tree.TreeCellRenderer currentCellRenderer
protected int editingRow
protected int lastSelectionRow
public void install(E c, U ui)
Painterinstall in interface Painter<E extends javax.swing.JTree,U extends WebTreeUI>install in class AbstractDecorationPainter<E extends javax.swing.JTree,U extends WebTreeUI,D extends IDecoration<E,D>>c - component this painter is being installed ontoui - component UIpublic void uninstall(E c, U ui)
Painteruninstall in interface Painter<E extends javax.swing.JTree,U extends WebTreeUI>uninstall in class AbstractDecorationPainter<E extends javax.swing.JTree,U extends WebTreeUI,D extends IDecoration<E,D>>c - component this painter is being uninstalled fromui - component UIprotected void propertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
AbstractPainterpropertyChange in class AbstractDecorationPainter<E extends javax.swing.JTree,U extends WebTreeUI,D extends IDecoration<E,D>>property - modified propertyoldValue - old property valuenewValue - new property valueprotected java.util.List<SectionPainter<E,U>> getSectionPainters()
AbstractDecorationPainternull in case no section painters are used within this one.
This method is used for various internal update mechanisms involving section painters.getSectionPainters in class AbstractDecorationPainter<E extends javax.swing.JTree,U extends WebTreeUI,D extends IDecoration<E,D>>protected void paintContent(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
AbstractDecorationPainterpaintContent in class AbstractDecorationPainter<E extends javax.swing.JTree,U extends WebTreeUI,D extends IDecoration<E,D>>g2d - graphics contextbounds - painting boundsc - painted componentui - painted component UIprotected void paintBackground(java.awt.Graphics2D g2d)
g2d - graphics contextpublic void prepareToPaint(java.util.Hashtable<javax.swing.tree.TreePath,java.lang.Boolean> paintingCache,
javax.swing.tree.TreeCellRenderer currentCellRenderer)
ITreePainterprepareToPaint in interface ITreePainter<E extends javax.swing.JTree,U extends WebTreeUI>paintingCache - vertical lines drawing cachecurrentCellRenderer - current cell rendererprotected void paintCentered(java.awt.Component c,
java.awt.Graphics2D g2d,
javax.swing.Icon icon,
int x,
int y)
c - componentg2d - graphicsicon - iconx - X coordinatey - Y coordinateprotected int findCenteredX(int x,
int iconWidth)
x - X coordinateiconWidth - icon widthpublic boolean isHoverDecorationSupported()
ITreePainterisHoverDecorationSupported in interface ITreePainter<E extends javax.swing.JTree,U extends WebTreeUI>protected void paintHoverNodeBackground(java.awt.Graphics2D g2d)
g2d - graphics contextprotected void paintSelectedNodesBackground(java.awt.Graphics2D g2d)
g2d - graphics contextprotected java.util.List<java.awt.Rectangle> getSelectionRects()
protected void repaintSelection()
protected void paintTree(java.awt.Graphics2D g2d)
g2d - graphics contextprotected boolean isLocationInExpandControl(javax.swing.tree.TreePath path,
int mouseX,
int mouseY)
mouseX and mouseY fall in the area of row that is used to expand/collapse the node and the
node at row does not represent a leaf.path - tree pathmouseX - mouse X locationmouseY - mouse Y locationmouseX and mouseY fall in the area of row that is used to expand/collapse the node and the node at
row does not represent a leaf, false otherwiseprotected void paintExpandControl(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
java.awt.Rectangle bounds,
javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
clipBounds, or insets.g2d - graphics contextclipBounds - clip boundsinsets - tree insetsbounds - tree path boundspath - tree pathrow - row indexisExpanded - whether row is expanded or nothasBeenExpanded - whether row has been expanded once before or notisLeaf - whether node is leaf or notprotected void paintRow(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
java.awt.Rectangle bounds,
javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
clipBounds, or insets.g2d - graphics contextclipBounds - clip boundsinsets - tree insetsbounds - tree path boundspath - tree pathrow - row indexisExpanded - whether row is expanded or nothasBeenExpanded - whether row has been expanded once before or notisLeaf - whether node is leaf or notprotected boolean shouldPaintExpandControl(javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
path - tree pathrow - row indexisExpanded - whether row is expanded or nothasBeenExpanded - whether row has been expanded once before or notisLeaf - whether node is leaf or notprotected boolean isRootVisible()
protected boolean getShowsRootHandles()
protected void paintHorizontalPartOfLeg(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
java.awt.Rectangle bounds,
javax.swing.tree.TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
g2d - graphicsclipBounds - clip boundsinsets - tree insetsbounds - tree path boundspath - tree pathrow - row indexisExpanded - whether row is expanded or nothasBeenExpanded - whether row has been expanded once before or notisLeaf - whether node is leaf or notprotected int getHorizontalLegIndent()
protected void paintVerticalPartOfLeg(java.awt.Graphics2D g2d,
java.awt.Rectangle clipBounds,
java.awt.Insets insets,
javax.swing.tree.TreePath path)
g2d - graphicsclipBounds - clip boundsinsets - tree insetspath - tree pathprotected javax.swing.tree.TreePath getLastChildPath(javax.swing.tree.TreePath parent)
parent.parent - parent tree pathparentprotected void paintVerticalLine(java.awt.Graphics2D g2d,
int x,
int y1,
int y2)
g2d - graphics contextx - X coordinatey1 - start Y coordinatey2 - end Y coordinateprotected void paintDashedVerticalLine(java.awt.Graphics2D g2d,
int x,
int y1,
int y2)
g2d - graphics contextx - X coordinatey1 - start Y coordinatey2 - end Y coordinateprotected void paintHorizontalLine(java.awt.Graphics2D g2d,
int y,
int x1,
int x2)
g2d - graphics contexty - Y coordinatex1 - start X coordinatex2 - end X coordinateprotected void paintDashedHorizontalLine(java.awt.Graphics2D g2d,
int y,
int x1,
int x2)
g2d - graphics contexty - Y coordinatex1 - start X coordinatex2 - end X coordinateprotected int getRowX(int row,
int depth)
row - Row to return x location fordepth - Depth of the rowprotected void updateDepthOffset()
protected int getVerticalLegIndent()
protected void paintDropLocation(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
g2d - graphics contextbounds - painting boundsc - painted componentui - painted component UIprotected boolean isDropLocationAvailable()
protected void paintMultiselector(java.awt.Graphics2D g2d)
g2d - graphics contextprotected boolean isSelectorAvailable()
protected java.awt.Rectangle getPathBounds(javax.swing.tree.TreePath path)
path - tree pathprotected java.awt.Rectangle getPathBounds(javax.swing.tree.TreePath path,
java.awt.Insets insets,
java.awt.Rectangle bounds)
path - tree pathinsets - tree insetsbounds - bounds bufferprotected boolean isFullLineSelection()
protected boolean isDragAvailable()