Top Description Inners Fields Constructors Methods
org.apache.pdfbox.debugger.ui

public Class PDFTreeCellRenderer

extends DefaultTreeCellRenderer
Class Inheritance
Imports
java.awt.Component, .Graphics, java.net.URL, java.util.ArrayList, .List, javax.swing.ImageIcon, .JTree, javax.swing.tree.DefaultTreeCellRenderer, org.apache.pdfbox.cos.COSArray, .COSBase, .COSBoolean, .COSDictionary, .COSFloat, .COSInteger, .COSName, .COSNull, .COSObject, .COSStream, .COSString

A class to render tree cells for the pdfviewer.
Author
Ben Litchfield

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
PDFTreeCellRenderer.OverlayIcon

An ImageIcon which allows other ImageIcon overlays.

Field Summary

Modifier and TypeField and Description
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final ImageIcon
private static final long
Inherited from javax.swing.tree.DefaultTreeCellRenderer:
backgroundNonSelectionColorbackgroundSelectionColorborderSelectionColorclosedIconhasFocusleafIconopenIconselectedtextNonSelectionColortextSelectionColor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static URL
public Component
getTreeCellRendererComponent(JTree
the receiver is being configured for
tree
,
Object
the value to render
nodeValue
,
boolean
whether node is selected
isSelected
,
boolean
whether node is expanded
expanded
,
boolean
whether node is a lead node
leaf
,
int
row index
row
,
boolean
whether node has focus
componentHasFocus
)

Overrides javax.swing.tree.DefaultTreeCellRenderer.getTreeCellRendererComponent.

Implements javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

Configures the renderer based on the passed in components.

private ImageIcon
lookupIcon(Object nodeValue)

private ImageIcon
private Object
toTreeObject(Object nodeValue)

private String
toTreePostfix(Object nodeValue)

Inherited from javax.swing.tree.DefaultTreeCellRenderer:
firePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangefirePropertyChangegetBackgroundNonSelectionColorgetBackgroundSelectionColorgetBorderSelectionColorgetClosedIcongetDefaultClosedIcongetDefaultLeafIcongetDefaultOpenIcongetFontgetLeafIcongetOpenIcongetPreferredSizegetTextNonSelectionColorgetTextSelectionColorinvalidatepaintrepaintrepaintrepaintrevalidatesetBackgroundsetBackgroundNonSelectionColorsetBackgroundSelectionColorsetBorderSelectionColorsetClosedIconsetFontsetLeafIconsetOpenIconsetTextNonSelectionColorsetTextSelectionColorupdateUIvalidate

Field Detail

ICON_ARRAYback to summary
private static final ImageIcon ICON_ARRAY
ICON_BOOLEANback to summary
private static final ImageIcon ICON_BOOLEAN
ICON_DICTback to summary
private static final ImageIcon ICON_DICT
ICON_HEXback to summary
private static final ImageIcon ICON_HEX
ICON_INDIRECTback to summary
private static final ImageIcon ICON_INDIRECT
ICON_INTEGERback to summary
private static final ImageIcon ICON_INTEGER
ICON_NAMEback to summary
private static final ImageIcon ICON_NAME
ICON_NULLback to summary
private static final ImageIcon ICON_NULL
ICON_PAGEback to summary
private static final ImageIcon ICON_PAGE
ICON_PDFback to summary
private static final ImageIcon ICON_PDF
ICON_REALback to summary
private static final ImageIcon ICON_REAL
ICON_STREAM_DICTback to summary
private static final ImageIcon ICON_STREAM_DICT
ICON_STRINGback to summary
private static final ImageIcon ICON_STRING
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Container.serialVersionUID.

Constructor Detail

PDFTreeCellRendererback to summary
public PDFTreeCellRenderer()

Method Detail

getImageUrlback to summary
private static URL getImageUrl(String name)
getTreeCellRendererComponentback to summary
public Component getTreeCellRendererComponent(JTree tree, Object nodeValue, boolean isSelected, boolean expanded, boolean leaf, int row, boolean componentHasFocus)

Overrides javax.swing.tree.DefaultTreeCellRenderer.getTreeCellRendererComponent.

Implements javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

Doc from javax.swing.tree.DefaultTreeCellRenderer.getTreeCellRendererComponent.

Configures the renderer based on the passed in components. The value is set from messaging the tree with convertValueToText, which ultimately invokes toString on value. The foreground color is set based on the selection and the icon is set based on the leaf and expanded parameters.

Parameters
tree:JTree

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

the receiver is being configured for

nodeValue:Object

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

the value to render

isSelected:boolean

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

whether node is selected

expanded:boolean

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

whether node is expanded

leaf:boolean

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

whether node is a lead node

row:int

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

row index

componentHasFocus:boolean

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

whether node has focus

Returns:Component

Doc from javax.swing.tree.TreeCellRenderer.getTreeCellRendererComponent.

the Component that the renderer uses to draw the value

Annotations
@Override
lookupIconback to summary
private ImageIcon lookupIcon(Object nodeValue)
lookupIconWithOverlayback to summary
private ImageIcon lookupIconWithOverlay(Object nodeValue)
toTreeObjectback to summary
private Object toTreeObject(Object nodeValue)
toTreePostfixback to summary
private String toTreePostfix(Object nodeValue)
org.apache.pdfbox.debugger.ui back to summary

private Class PDFTreeCellRenderer.OverlayIcon

extends ImageIcon
Class Inheritance

An ImageIcon which allows other ImageIcon overlays.

Field Summary

Modifier and TypeField and Description
private final ImageIcon
private final List<ImageIcon>
private static final long
Inherited from javax.swing.ImageIcon:
componenttracker

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
add(ImageIcon overlay)

public synchronized void
paintIcon(Component
the component to be used as the observer if this icon has no image observer
c
,
Graphics
the graphics context
g
,
int
the X coordinate of the icon's top-left corner
x
,
int
the Y coordinate of the icon's top-left corner
y
)

Overrides javax.swing.ImageIcon.paintIcon.

Implements javax.swing.Icon.paintIcon.

Paints the icon.

Inherited from javax.swing.ImageIcon:
getAccessibleContextgetDescriptiongetIconHeightgetIconWidthgetImagegetImageLoadStatusgetImageObserverloadImagesetDescriptionsetImagesetImageObservertoString

Field Detail

baseback to summary
private final ImageIcon base
overlaysback to summary
private final List<ImageIcon> overlays
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

OverlayIconback to summary
pack-priv OverlayIcon(ImageIcon base)

Method Detail

addback to summary
pack-priv void add(ImageIcon overlay)
paintIconback to summary
public synchronized void paintIcon(Component c, Graphics g, int x, int y)

Overrides javax.swing.ImageIcon.paintIcon.

Implements javax.swing.Icon.paintIcon.

Doc from javax.swing.ImageIcon.paintIcon.

Paints the icon. The top-left corner of the icon is drawn at the point (x, y) in the coordinate space of the graphics context g. If this icon has no image observer, this method uses the c component as the observer.

Parameters
c:Component

the component to be used as the observer if this icon has no image observer

g:Graphics

the graphics context

x:int

the X coordinate of the icon's top-left corner

y:int

the Y coordinate of the icon's top-left corner

Annotations
@Override