|
||||||||||
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.JPanel
ca.odell.glazedlists.swing.TreeTableCellPanel
public class TreeTableCellPanel
This panel exists to relieve the burdens of creating a
TableCellRenderer
or
TableCellEditor
that is appropriate for use in a
hierarchy column of a tree table. Specifically, it combines three different
components to produce a single panel. Those components are:
[indent pixels] [expand/collapse button] [spacer pixels] [nodeComponent]
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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.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 | |
---|---|
TreeTableCellPanel()
|
Method Summary | |
---|---|
void |
configure(TreeNodeData treeNodeData,
boolean showExpanderForEmptyParent,
Component nodeComponent,
boolean hasFocus,
int indent,
int spacer)
This method adjusts the contents of this panel to display thse given nodeComponent . |
Component |
getNodeComponent()
Return the Component that displays the data of the tree node. |
boolean |
isPointOverExpanderButton(Point p)
Returns true if p occurs within the bounds of the
expander button; false otherwise. |
boolean |
isPointOverNodeComponent(Point p)
Returns true if p occurs within the bounds of the
node component; false otherwise. |
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
This method is called by Swing when the TreeTableCellPanel is installed as a TableCellEditor. |
void |
setBackground(Color bg)
Set the background color of the TreeTableCellPanel and node component. |
void |
setFont(Font font)
Set the font of the TreeTableCellPanel and its inner node component. |
void |
setForeground(Color fg)
Set the foreground color of the TreeTableCellPanel and node component. |
void |
setNextFocusableComponent(Component aComponent)
This method is called by Swing when installing this TreeTableCellPanel as a TableCellEditor. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeTableCellPanel()
Method Detail |
---|
public void configure(TreeNodeData treeNodeData, boolean showExpanderForEmptyParent, Component nodeComponent, boolean hasFocus, int indent, int spacer)
nodeComponent
. Specifically, the panel is layed out like so:
[indent pixels] [expand/collapse button] [spacer pixels] [nodeComponent]
The expand/collapse button is visible if
TreeNodeData.isExpanded()
returns true. The expander
button's icon is either a traditional plus or minus icon depending on
the value of TreeNodeData.isExpanded()
.
The nodeComponent is displayed unmodified.
treeNodeData
- hierarhical information about the node within the treeshowExpanderForEmptyParent
- true indicates the expander
button should always be present, even when no children yet existnodeComponent
- a Component which displays the data of the tree nodehasFocus
- true indicates the cell currently has the focusindent
- the amount of space between the left cell edge and the expand/collapse buttonspacer
- the amount of space between the right edge of the expand/collapse button and the nodeComponentpublic void setBackground(Color bg)
setBackground
in class JComponent
public void setForeground(Color fg)
setForeground
in class JComponent
public void setFont(Font font)
setFont
in class JComponent
public Component getNodeComponent()
Component
that displays the data of the tree node.
public boolean isPointOverExpanderButton(Point p)
p
occurs within the bounds of the
expander button; false otherwise.
public boolean isPointOverNodeComponent(Point p)
p
occurs within the bounds of the
node component; false otherwise.
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
nodeComponent
so that it may have a chance to react.
This only need occur once for the KeyEvent that caused the cell edit,
after which time the focus will be within the nodeComponent
and
subsequent keystrokes should be ignored.
processKeyBinding
in class JComponent
public void setNextFocusableComponent(Component aComponent)
We override this method to ensure that if the nodeComponent
acting as the child editor of the TreeTableCellPanel has focus when the
cell edit is complete, focus is returned to the JTable in that case as
well.
setNextFocusableComponent
in class JComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |