[kaffe] CVS kaffe (robilad): Resynced with gnu classpath: swing, awt and xslt fixes
Kaffe CVS
cvs-commits at kaffe.org
Wed Jul 6 19:26:16 PDT 2005
PatchSet 6712
Date: 2005/07/07 02:18:56
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with gnu classpath: swing, awt and xslt fixes
Members:
ChangeLog:1.4236->1.4237
libraries/javalib/gnu/xml/transform/StreamSerializer.java:1.7->1.8
libraries/javalib/gnu/xml/xpath/EqualityExpr.java:1.5->1.6
libraries/javalib/javax/swing/AbstractButton.java:1.17->1.18
libraries/javalib/javax/swing/JTree.java:1.20->1.21
libraries/javalib/javax/swing/plaf/basic/BasicBorders.java:1.3->1.4
libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.6->1.7
libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java:1.6->1.7
libraries/javalib/javax/swing/tree/DefaultTreeSelectionModel.java:1.12->1.13
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4236 kaffe/ChangeLog:1.4237
--- kaffe/ChangeLog:1.4236 Thu Jul 7 00:40:11 2005
+++ kaffe/ChangeLog Thu Jul 7 02:18:56 2005
@@ -1,5 +1,63 @@
2005-07-07 Dalibor Topic <robilad at kaffe.org>
+ Resynced with GNU classpath.
+
+ 2005-07-06 David Gilbert <david.gilbert at object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicBorders.java: fixed API docs all over.
+
+ 2005-07-06 Chris Burdess <dog at gnu.org>
+
+ * gnu/xml/transform/StreamSerializer.java,
+ gnu/xml/xpath/EqualityExpr.java: XSLT conformance fixes.
+
+ 2005-07-06 Lillian Angel <langel at redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathForRow): took out redundant code.
+
+ 2005-07-06 Lillian Angel <langel at redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getNextVisibleNode): Implemented
+ (getPathForRow): Fixed so the next node retrieved is visible.
+
+ 2005-07-06 Lillian Angel <langel at redhat.com>
+
+ * javax/swing/JTree.java
+ Initialized the Hashtable.
+ (addSelectionPath): removed redundant code.
+ (doExpandParents): added in line so that state is
+ changed for current path. Changed while loop to if
+ statement, an infinite loop was occurring.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathForRow): Implemented to work with visibility.
+ (isLeaf): Implemented
+ (mouseClicked): add in check for expand/collapse.
+ Selection for DISCONTIGUOUS tree selection is
+ implemented.
+ (treeExpanded): called repaint, so the tree updates
+ visually when something is expanded.
+ (treeCollapse): Similar to treeExpanded.
+ (paintLeaf): changed to paint leaf only when visible.
+ (paintNonLeaf): paints only when visible.
+ (paintRecursive): lines for tree are only painted when
+ needed. checked for visibility of current object and
+ parent.
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (getTreeCellRendererComponent): setting icons when
+ expanded.
+ * javax/swing/tree/DefaultTreeSelectionModel.java
+ (clearSelection): set leadPath to null because selection
+ should be completely reset.
+
+ 2005-07-06 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/AbstractButton.java
+ (setContentAreaFilled): Set the opaque property here.
+
+2005-07-07 Dalibor Topic <robilad at kaffe.org>
+
* FAQ/FAQ.classlibrary-compile: Updated URL for jikes.
Reported by: Ito Kazumitsu <kaz at maczuka.gcd.org>
Index: kaffe/libraries/javalib/gnu/xml/transform/StreamSerializer.java
diff -u kaffe/libraries/javalib/gnu/xml/transform/StreamSerializer.java:1.7 kaffe/libraries/javalib/gnu/xml/transform/StreamSerializer.java:1.8
--- kaffe/libraries/javalib/gnu/xml/transform/StreamSerializer.java:1.7 Mon Jul 4 00:05:57 2005
+++ kaffe/libraries/javalib/gnu/xml/transform/StreamSerializer.java Thu Jul 7 02:19:01 2005
@@ -627,15 +627,30 @@
text = buf.toString();
}
ByteBuffer encoded = encoder.encode(CharBuffer.wrap(text));
+ int len = encoded.limit() - encoded.position();
if (encoded.hasArray())
{
- return encoded.array();
+ byte[] ret = encoded.array();
+ if (ret.length > len)
+ {
+ // Why?
+ byte[] ret2 = new byte[len];
+ System.arraycopy(ret, 0, ret2, 0, len);
+ ret = ret2;
+ }
+ return ret;
}
encoded.flip();
- int len = encoded.limit() - encoded.position();
byte[] ret = new byte[len];
encoded.get(ret, 0, len);
return ret;
+ }
+
+ String hex(byte[] b) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < b.length; i++)
+ buf.append(Integer.toHexString(b[i])).append(' ');
+ return buf.toString();
}
String encode(String text, boolean encodeCtl, boolean inAttr)
Index: kaffe/libraries/javalib/gnu/xml/xpath/EqualityExpr.java
diff -u kaffe/libraries/javalib/gnu/xml/xpath/EqualityExpr.java:1.5 kaffe/libraries/javalib/gnu/xml/xpath/EqualityExpr.java:1.6
--- kaffe/libraries/javalib/gnu/xml/xpath/EqualityExpr.java:1.5 Mon Jul 4 00:05:59 2005
+++ kaffe/libraries/javalib/gnu/xml/xpath/EqualityExpr.java Thu Jul 7 02:19:01 2005
@@ -91,6 +91,10 @@
{
Collection lns = (Collection) left;
Collection rns = (Collection) right;
+ if (lns.isEmpty())
+ {
+ return false;
+ }
boolean all = true;
for (Iterator i = lns.iterator(); i.hasNext(); )
{
@@ -119,7 +123,7 @@
}
}
}
- return false;
+ return all;
}
/*
* If one object to be compared is a node-set and the other is a number,
Index: kaffe/libraries/javalib/javax/swing/AbstractButton.java
diff -u kaffe/libraries/javalib/javax/swing/AbstractButton.java:1.17 kaffe/libraries/javalib/javax/swing/AbstractButton.java:1.18
--- kaffe/libraries/javalib/javax/swing/AbstractButton.java:1.17 Mon Jul 4 00:08:07 2005
+++ kaffe/libraries/javalib/javax/swing/AbstractButton.java Thu Jul 7 02:19:02 2005
@@ -1881,8 +1881,9 @@
boolean old = contentAreaFilled;
contentAreaFilled = b;
firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
- revalidate();
- repaint();
+ // The JDK sets the opaque property to the value of the contentAreaFilled
+ // property, so should we do.
+ setOpaque(b);
}
/**
Index: kaffe/libraries/javalib/javax/swing/JTree.java
diff -u kaffe/libraries/javalib/javax/swing/JTree.java:1.20 kaffe/libraries/javalib/javax/swing/JTree.java:1.21
--- kaffe/libraries/javalib/javax/swing/JTree.java:1.20 Wed Jul 6 02:01:15 2005
+++ kaffe/libraries/javalib/javax/swing/JTree.java Thu Jul 7 02:19:02 2005
@@ -273,7 +273,7 @@
* TreePath of a note to to its state. Valid states are EXPANDED and
* COLLAPSED. Nodes not in this Hashtable are assumed state COLLAPSED.
*/
- private Hashtable nodeStates;
+ private Hashtable nodeStates = new Hashtable();
protected transient TreeCellEditor cellEditor;
protected transient TreeCellRenderer cellRenderer;
protected boolean editable;
@@ -1079,13 +1079,6 @@
if (path != null)
selectionModel.addSelectionPath(path);
- else
- {
- selectionModel.clearSelection();
- // need to repaint because cant fire an event with
- // null selection.
- repaint();
- }
}
public void addSelectionRows(int[] rows)
@@ -1299,7 +1292,7 @@
// Don't expand if last path component is a leaf node.
if ((path == null) || (treeModel.isLeaf(path.getLastPathComponent())))
return;
-
+
setExpandedState(path, true);
}
@@ -1519,9 +1512,12 @@
private void doExpandParents(TreePath path, boolean state)
{
TreePath parent = path.getParentPath();
-
+
if (isExpanded(parent))
+ {
+ nodeStates.put(path, state ? EXPANDED : COLLAPSED);
return;
+ }
if (parent != null)
doExpandParents(parent, false);
@@ -1538,9 +1534,10 @@
try
{
- while (parent != null)
+ if (parent != null)
checkExpandParents(parent);
- } catch (ExpandVetoException e)
+ }
+ catch (ExpandVetoException e)
{
// Expansion vetoed.
return;
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicBorders.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicBorders.java:1.3 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicBorders.java:1.4
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicBorders.java:1.3 Mon Jul 4 00:08:33 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicBorders.java Thu Jul 7 02:19:02 2005
@@ -1,5 +1,5 @@
/* BasicBorders.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,9 +89,9 @@
* height="170" alt="[A screen shot of the returned border]" />
*
* @return a {@link
- * javax.swing.plaf.BorderUIResource#CompoundBorderUIResource}
- * whose outer border is a {@link #ButtonBorder} and whose
- * inner border is a {@link #MarginBorder}.
+ * javax.swing.plaf.BorderUIResource.CompoundBorderUIResource}
+ * whose outer border is a {@link ButtonBorder} and whose
+ * inner border is a {@link MarginBorder}.
*/
public static Border getButtonBorder()
{
@@ -139,9 +139,9 @@
* height="135" alt="[A screen shot of the returned border]" />
*
* @return a {@link
- * javax.swing.plaf.BorderUIResource#CompoundBorderUIResource}
- * whose outer border is a {@link #RadioButtonBorder} and whose
- * inner border is a {@link #MarginBorder}.
+ * javax.swing.plaf.BorderUIResource.CompoundBorderUIResource}
+ * whose outer border is a {@link RadioButtonBorder} and whose
+ * inner border is a {@link MarginBorder}.
*/
public static Border getRadioButtonBorder()
{
@@ -191,9 +191,9 @@
* height="135" alt="[A screen shot of the returned border]" />
*
* @return a {@link
- * javax.swing.plaf.BorderUIResource#CompoundBorderUIResource}
- * whose outer border is a {@link #ToggleButtonBorder} and whose
- * inner border is a {@link #MarginBorder}.
+ * javax.swing.plaf.BorderUIResource.CompoundBorderUIResource}
+ * whose outer border is a {@link ToggleButtonBorder} and whose
+ * inner border is a {@link MarginBorder}.
*/
public static Border getToggleButtonBorder()
{
@@ -241,7 +241,7 @@
* <p><img src="doc-files/BasicBorders.MenuBarBorder-1.png" width="500"
* height="140" alt="[A screen shot of a JMenuBar with this border]" />
*
- * @return a {@link #MenuBarBorder}.
+ * @return a {@link MenuBarBorder}.
*
* @see javax.swing.JMenuBar
*/
@@ -272,7 +272,7 @@
* <p><img src="doc-files/BasicBorders.SplitPaneBorder-2.png" width="520"
* height="200" alt="[A screen shot for JSplitPane.VERTICAL_SPLIT]" />
*
- * @return a {@link #SplitPaneBorder}.
+ * @return a {@link SplitPaneBorder}.
*
* @see javax.swing.JSplitPane
* @see #getSplitPaneDividerBorder()
@@ -339,8 +339,7 @@
* height="200" alt="[A screen shot of a border returned by
* this method]" />
*
- * @return an instance of
- * {@link javax.swing.plaf.basic.BasicBorders$FieldBorder}.
+ * @return an instance of {@link FieldBorder}.
*
* @see javax.swing.JTextField
* @see javax.swing.text.JTextComponent
@@ -592,7 +591,7 @@
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
@@ -756,7 +755,7 @@
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
@@ -1020,7 +1019,7 @@
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
@@ -1176,7 +1175,7 @@
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
@@ -1230,7 +1229,7 @@
* Paints the border around a rollover button. If <code>c</code>
* is not an {@link javax.swing.AbstractButton} whose model
* returns <code>true</code> for {@link
- * javax.swing.ButtonModel#isRollver}, nothing gets painted at
+ * javax.swing.ButtonModel#isRollover}, nothing gets painted at
* all.
*
* @param c the button whose border is to be painted.
@@ -1309,8 +1308,8 @@
* appearance of the Sun reference implementation. A bug report has
* been filed with Sun (review ID 188774).
*
- * @see {@link #getSplitPaneBorder()}
- * @see {@link #getSplitPaneDividerBorder()}
+ * @see #getSplitPaneBorder()
+ * @see #getSplitPaneDividerBorder()
*
* @author Sascha Brawer (brawer at dandelis.ch)
*/
@@ -1797,7 +1796,7 @@
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.6 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.7
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.6 Wed Jul 6 02:01:15 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java Thu Jul 7 02:19:02 2005
@@ -597,19 +597,53 @@
*/
public TreePath getPathForRow(JTree tree, int row)
{
- // FIXME: check visibility when expand/collapse is implemented
- DefaultMutableTreeNode pathForRow = ((DefaultMutableTreeNode) (tree
+ DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree
.getModel()).getRoot());
+
for (int i = 0; i < row; i++)
- {
- if (pathForRow != null)
- pathForRow = pathForRow.getNextNode();
- }
- if (pathForRow == null)
+ node = getNextVisibleNode(node);
+
+ // in case nothing was found
+ if (node == null)
return null;
- return new TreePath(pathForRow.getPath());
+
+ // something was found
+ return new TreePath(node.getPath());
+
}
+ /**
+ * Get next visible node in the tree.
+ *
+ * @param the current node
+ * @return the next visible node in the JTree. Return null if there
+ * are no more.
+ */
+ private DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode node)
+ {
+ DefaultMutableTreeNode next = null;
+ TreePath current = null;
+
+ if (node != null)
+ next = node.getNextNode();
+
+ if (next != null)
+ {
+ current = new TreePath(next.getPath());
+ if (tree.isVisible(current))
+ return next;
+
+ while (next != null && !tree.isVisible(current))
+ {
+ next = next.getNextNode();
+
+ if (next != null)
+ current = new TreePath(next.getPath());
+ }
+ }
+ return next;
+ }
+
/**
* Returns the row that the last item identified in path is visible at. Will
* return -1 if any of the elments in the path are not currently visible.
@@ -636,6 +670,7 @@
*/
public int getRowCount(JTree tree)
{
+ // FIXME: check visibility
return treeState.getRowCount();
}
@@ -1446,8 +1481,16 @@
*/
protected boolean isLeaf(int row)
{
- return false;
- // FIXME: not implemented
+ TreePath pathForRow = getPathForRow(tree, row);
+ if (pathForRow == null)
+ return true;
+
+ Object node = pathForRow.getLastPathComponent();
+
+ if (node instanceof TreeNode)
+ return ((TreeNode) node).isLeaf();
+ else
+ return true;
}
/* * INTERNAL CLASSES * */
@@ -1726,30 +1769,50 @@
{
Point click = e.getPoint();
int row = ((int) click.getY() / getRowHeight()) - 1;
-
- if (BasicTreeUI.this.tree.isRowSelected(row))
- BasicTreeUI.this.tree.removeSelectionRow(row);
- else if (BasicTreeUI.this.tree.getSelectionModel()
- .getSelectionMode() ==
- treeSelectionModel.SINGLE_TREE_SELECTION)
+ TreePath path = BasicTreeUI.this.tree.getPathForRow(row);
+
+ if (path == null)
{
- // clear selection, since only able to select one row at a time.
+ // nothing should be selected if user clicks outside of tree
BasicTreeUI.this.tree.getSelectionModel().clearSelection();
- BasicTreeUI.this.tree.addSelectionRow(row);
- }
- else if (BasicTreeUI.this.tree.getSelectionModel()
- .getSelectionMode() ==
- treeSelectionModel.CONTIGUOUS_TREE_SELECTION)
- {
- //TODO
+ BasicTreeUI.this.tree.repaint();
}
- else
+
+ if (BasicTreeUI.this.tree.isVisible(path))
{
- BasicTreeUI.this.tree.getSelectionModel()
- .setSelectionMode(
- treeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
- BasicTreeUI.this.tree.addSelectionRow(row);
- }
+ if (BasicTreeUI.this.tree.isExpanded(path))
+ {
+ BasicTreeUI.this.tree.collapsePath(path);
+ BasicTreeUI.this.tree.fireTreeCollapsed(path);
+ }
+ else
+ {
+ BasicTreeUI.this.tree.expandPath(path);
+ BasicTreeUI.this.tree.fireTreeExpanded(path);
+ }
+
+ if (BasicTreeUI.this.tree.isRowSelected(row))
+ BasicTreeUI.this.tree.removeSelectionRow(row);
+ else if (BasicTreeUI.this.tree.getSelectionModel()
+ .getSelectionMode() == treeSelectionModel
+ .SINGLE_TREE_SELECTION)
+ {
+ BasicTreeUI.this.tree.getSelectionModel().clearSelection();
+ BasicTreeUI.this.tree.addSelectionRow(row);
+ }
+ else if (BasicTreeUI.this.tree.getSelectionModel()
+ .getSelectionMode() == treeSelectionModel
+ .CONTIGUOUS_TREE_SELECTION)
+ {
+ // TODO
+ }
+ else
+ {
+ BasicTreeUI.this.tree.getSelectionModel().setSelectionMode(
+ treeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+ BasicTreeUI.this.tree.addSelectionRow(row);
+ }
+ }
}
/**
@@ -1969,6 +2032,7 @@
*/
public void treeExpanded(TreeExpansionEvent event)
{
+ BasicTreeUI.this.tree.repaint();
}
/**
@@ -1978,6 +2042,7 @@
*/
public void treeCollapsed(TreeExpansionEvent event)
{
+ BasicTreeUI.this.tree.repaint();
}
}// TreeExpansionHandler
@@ -2274,7 +2339,7 @@
} // TreeTraverseAction
/* * HELPER METHODS FOR PAINTING * */
-
+
/**
* Returns the cell bounds for painting selected cells
*
@@ -2293,7 +2358,7 @@
return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s), fm
.getHeight());
}
-
+
/**
* Paints a leaf in the tree
*
@@ -2305,25 +2370,29 @@
*/
private void paintLeaf(Graphics g, int x, int y, JTree tree, Object leaf)
{
- TreePath tp = new TreePath(((DefaultMutableTreeNode) leaf).getPath());
- boolean selected = tree.isPathSelected(tp);
+ TreePath curr = new TreePath(((DefaultMutableTreeNode) leaf)
+ .getPath());
+ boolean selected = tree.isPathSelected(curr);
- if (selected)
- {
- Component comp = tree.getCellRenderer()
- .getTreeCellRendererComponent(tree, leaf, true, false,
- true, 0, false);
- rendererPane.paintComponent(g, comp, tree, getCellBounds(x, y, leaf));
- }
- else
- {
- Component c = tree.getCellRenderer().getTreeCellRendererComponent(tree,
- leaf, false, false, true, 0, false);
-
- g.translate(x, y);
- c.paint(g);
- g.translate(-x, -y);
- }
+ if (tree.isVisible(curr))
+ if (selected)
+ {
+ Component comp = tree.getCellRenderer()
+ .getTreeCellRendererComponent(tree, leaf, true, false,
+ true, 0, false);
+ rendererPane.paintComponent(g, comp, tree,
+ getCellBounds(x, y, leaf));
+ }
+ else
+ {
+ Component c = tree.getCellRenderer()
+ .getTreeCellRendererComponent(tree,
+ leaf, false, false, true, 0, false);
+
+ g.translate(x, y);
+ c.paint(g);
+ g.translate(-x, -y);
+ }
}
/**
@@ -2337,26 +2406,31 @@
*/
private void paintNonLeaf(Graphics g, int x, int y, JTree tree,
Object nonLeaf)
- {
- TreePath tp = new TreePath(((DefaultMutableTreeNode) nonLeaf).getPath());
- boolean selected = tree.isPathSelected(tp);
-
- if (selected)
- {
- Component comp = tree.getCellRenderer()
- .getTreeCellRendererComponent(tree, nonLeaf, true, false,
- true, 0, false);
- rendererPane.paintComponent(g, comp, tree, getCellBounds(x, y, nonLeaf));
- }
- else
- {
- Component c = tree.getCellRenderer().getTreeCellRendererComponent(tree,
- nonLeaf, false, false, false, 0, false);
-
- g.translate(x, y);
- c.paint(g);
- g.translate(-x, -y);
- }
+ {
+ TreePath curr = new TreePath(((DefaultMutableTreeNode) nonLeaf)
+ .getPath());
+ boolean selected = tree.isPathSelected(curr);
+ boolean expanded = tree.isExpanded(curr);
+
+ if (tree.isVisible(curr))
+ if (selected)
+ {
+ Component comp = tree.getCellRenderer()
+ .getTreeCellRendererComponent(tree, nonLeaf, true,
+ expanded, false, 0, false);
+ rendererPane.paintComponent(g, comp, tree,
+ getCellBounds(x, y, nonLeaf));
+ }
+ else
+ {
+ Component c = tree.getCellRenderer()
+ .getTreeCellRendererComponent(tree,
+ nonLeaf, false, expanded, false, 0, false);
+
+ g.translate(x, y);
+ c.paint(g);
+ g.translate(-x, -y);
+ }
}
/**
@@ -2389,7 +2463,8 @@
{
paintLeaf(g, indentation, descent, tree, curr);
descent += getRowHeight();
- } else
+ }
+ else
{
if (depth > 0 || tree.isRootVisible())
{
@@ -2398,25 +2473,30 @@
y0 += halfHeight;
}
int max = mod.getChildCount(curr);
- for (int i = 0; i < max; ++i)
- {
- g.setColor(getHashColor());
- g.drawLine(indentation + halfWidth, descent + halfHeight,
- indentation + rightChildIndent, descent + halfHeight);
- descent = paintRecursive(g, indentation + rightChildIndent,
- descent, i, depth + 1, tree, mod, mod.getChild(curr, i));
- }
+ if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr)
+ .getPath())))
+ for (int i = 0; i < max; ++i)
+ {
+ g.setColor(getHashColor());
+ g.drawLine(indentation + halfWidth, descent + halfHeight,
+ indentation + rightChildIndent,
+ descent + halfHeight);
+ descent = paintRecursive(g, indentation + rightChildIndent,
+ descent, i, depth + 1, tree, mod,
+ mod.getChild(curr, i));
+ }
}
int y1 = descent - halfHeight;
- if (y0 != y1)
- {
- g.setColor(getHashColor());
- g
- .drawLine(indentation + halfWidth, y0, indentation
- + halfWidth, y1);
- }
-
+
+ if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr)
+ .getPath())))
+ if (y0 != y1)
+ {
+ g.setColor(getHashColor());
+ g.drawLine(indentation + halfWidth, y0, indentation
+ + halfWidth, y1);
+ }
return descent;
}
Index: kaffe/libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java
diff -u kaffe/libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java:1.6 kaffe/libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java:1.7
--- kaffe/libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java:1.6 Wed Jul 6 02:01:16 2005
+++ kaffe/libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java Thu Jul 7 02:19:02 2005
@@ -380,13 +380,6 @@
this.selected = selected;
this.hasFocus = hasFocus;
- if (leaf)
- setLeafIcon(getLeafIcon());
- else if (expanded)
- setOpenIcon(getOpenIcon());
- else
- setClosedIcon(getClosedIcon());
-
setText(val.toString());
setHorizontalAlignment(LEFT);
setOpaque(true);
@@ -394,17 +387,23 @@
setEnabled(true);
setFont(getFont());
+ if (leaf)
+ setIcon(getLeafIcon());
+ else if (expanded)
+ setIcon(getOpenIcon());
+ else
+ setIcon(getClosedIcon());
+
if (selected)
{
super.setBackground(getBackgroundSelectionColor());
- super.setForeground(getTextSelectionColor());
+ setForeground(getTextSelectionColor());
}
else
{
super.setBackground((tree.getParent()).getBackground());
- super.setForeground(getTextNonSelectionColor());
- }
-
+ setForeground(getTextNonSelectionColor());
+ }
return this;
}
Index: kaffe/libraries/javalib/javax/swing/tree/DefaultTreeSelectionModel.java
diff -u kaffe/libraries/javalib/javax/swing/tree/DefaultTreeSelectionModel.java:1.12 kaffe/libraries/javalib/javax/swing/tree/DefaultTreeSelectionModel.java:1.13
--- kaffe/libraries/javalib/javax/swing/tree/DefaultTreeSelectionModel.java:1.12 Wed Jul 6 02:01:16 2005
+++ kaffe/libraries/javalib/javax/swing/tree/DefaultTreeSelectionModel.java Thu Jul 7 02:19:02 2005
@@ -466,6 +466,7 @@
*/
public void clearSelection()
{
+ leadPath = null;
selection = null;
}
More information about the kaffe
mailing list