[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: swing fixes
Kaffe CVS
cvs-commits at kaffe.org
Fri Jun 10 13:01:57 PDT 2005
PatchSet 6615
Date: 2005/06/10 19:51:04
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: swing fixes
Members:
ChangeLog:1.4141->1.4142
libraries/javalib/javax/swing/JButton.java:1.4->1.5
libraries/javalib/javax/swing/JComponent.java:1.18->1.19
libraries/javalib/javax/swing/JList.java:1.9->1.10
libraries/javalib/javax/swing/JTree.java:1.15->1.16
libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java:1.1->1.2
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4141 kaffe/ChangeLog:1.4142
--- kaffe/ChangeLog:1.4141 Fri Jun 10 19:43:53 2005
+++ kaffe/ChangeLog Fri Jun 10 19:51:04 2005
@@ -2,6 +2,38 @@
Resynced with GNU Classpath.
+ 2005-05-30 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/JTree.java
+ (getNextMatch): Implemented new method.
+
+ 2005-05-30 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java:
+ (createUI): Do not share one instance of MetalSplitPaneUI
+ between multiple JSplitPanes.
+
+ 2005-05-30 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/JComponent.java:
+ Made JComponent.AccessibleJComponent implement
+ AccessibleExtendedComponent.
+
+ 2005-05-30 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/JButton.java
+ (constructor): Set initial actionCommand equal to the buttons label.
+
+ 2005-05-30 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/JList.java
+ (getNextMatch): Implemented new method.
+ (getCellBounds): Implemented new method.
+
+2005-06-10 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-05-30 Audrius Meskauskas <AudriusA at Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java (serve, portServer, serveStep):
Index: kaffe/libraries/javalib/javax/swing/JButton.java
diff -u kaffe/libraries/javalib/javax/swing/JButton.java:1.4 kaffe/libraries/javalib/javax/swing/JButton.java:1.5
--- kaffe/libraries/javalib/javax/swing/JButton.java:1.4 Thu May 26 11:10:40 2005
+++ kaffe/libraries/javalib/javax/swing/JButton.java Fri Jun 10 19:51:08 2005
@@ -79,6 +79,7 @@
{
super(text, icon);
setModel(new DefaultButtonModel());
+ setActionCommand(text);
}
public Object[] getSelectedObjects()
Index: kaffe/libraries/javalib/javax/swing/JComponent.java
diff -u kaffe/libraries/javalib/javax/swing/JComponent.java:1.18 kaffe/libraries/javalib/javax/swing/JComponent.java:1.19
--- kaffe/libraries/javalib/javax/swing/JComponent.java:1.18 Wed May 18 22:13:35 2005
+++ kaffe/libraries/javalib/javax/swing/JComponent.java Fri Jun 10 19:51:08 2005
@@ -73,6 +73,7 @@
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleExtendedComponent;
import javax.accessibility.AccessibleKeyBinding;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
@@ -104,6 +105,7 @@
public abstract class AccessibleJComponent
extends AccessibleAWTContainer
+ implements AccessibleExtendedComponent
{
protected class AccessibleFocusHandler
implements FocusListener
Index: kaffe/libraries/javalib/javax/swing/JList.java
diff -u kaffe/libraries/javalib/javax/swing/JList.java:1.9 kaffe/libraries/javalib/javax/swing/JList.java:1.10
--- kaffe/libraries/javalib/javax/swing/JList.java:1.9 Wed Mar 2 22:56:19 2005
+++ kaffe/libraries/javalib/javax/swing/JList.java Fri Jun 10 19:51:08 2005
@@ -53,6 +53,7 @@
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.plaf.ListUI;
+import javax.swing.text.Position;
/**
* <p>This class is a facade over three separate objects: {@link
@@ -1334,5 +1335,82 @@
int old = layoutOrientation;
layoutOrientation = orientation;
firePropertyChange("layoutOrientation", old, orientation);
+ }
+
+ /**
+ * Returns the bounds of the rectangle that encloses both list cells
+ * with index0 and index1.
+ *
+ * @param index0 the index of the first cell
+ * @param index1 the index of the second cell
+ *
+ * @return the bounds of the rectangle that encloses both list cells
+ * with index0 and index1, <code>null</code> if one of the indices is
+ * not valid
+ */
+ public Rectangle getCellBounds(int index0, int index1)
+ {
+ return ((ListUI) ui).getCellBounds(this, index0, index1);
+ }
+
+ /**
+ * Returns the next list element (beginning from <code>startIndex</code>
+ * that starts with <code>prefix</code>. Searching is done in the direction
+ * specified by <code>bias</code>.
+ *
+ * @param prefix the prefix to search for in the cell values
+ * @param startIndex the index where to start searching from
+ * @param bias the search direction, either {@link Position.Bias.Forward}
+ * or {@link Position.Bias.Backward}
+ *
+ * @return the index of the found element or -1 if no such element has
+ * been found
+ *
+ * @throws IllegalArgumentException if prefix is <code>null</code> or
+ * startIndex is not valid
+ *
+ * @since 1.4
+ */
+ public int getNextMatch(String prefix, int startIndex, Position.Bias bias)
+ {
+ if (prefix == null)
+ throw new IllegalArgumentException("The argument 'prefix' must not be"
+ + " null.");
+ if (startIndex < 0)
+ throw new IllegalArgumentException("The argument 'startIndex' must not"
+ + " be less than zero.");
+
+ int size = model.getSize();
+ if (startIndex > model.getSize())
+ throw new IllegalArgumentException("The argument 'startIndex' must not"
+ + " be greater than the number of"
+ + " elements in the ListModel.");
+
+ int index = -1;
+ if (bias == Position.Bias.Forward)
+ {
+ for (int i = startIndex; i < size; i++)
+ {
+ String item = model.getElementAt(i).toString();
+ if (item.startsWith(prefix))
+ {
+ index = i;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (int i = startIndex; i >= 0; i--)
+ {
+ String item = model.getElementAt(i).toString();
+ if (item.startsWith(prefix))
+ {
+ index = i;
+ break;
+ }
+ }
+ }
+ return index;
}
}
Index: kaffe/libraries/javalib/javax/swing/JTree.java
diff -u kaffe/libraries/javalib/javax/swing/JTree.java:1.15 kaffe/libraries/javalib/javax/swing/JTree.java:1.16
--- kaffe/libraries/javalib/javax/swing/JTree.java:1.15 Wed May 18 22:13:35 2005
+++ kaffe/libraries/javalib/javax/swing/JTree.java Fri Jun 10 19:51:08 2005
@@ -56,6 +56,7 @@
import javax.swing.event.TreeSelectionListener;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.plaf.TreeUI;
+import javax.swing.text.Position;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
@@ -1703,5 +1704,80 @@
}
}
return relevantPaths.elements();
+ }
+
+ /**
+ * Returns the next table element (beginning from the row
+ * <code>startingRow</code>
+ * that starts with <code>prefix</code>. Searching is done in the direction
+ * specified by <code>bias</code>.
+ *
+ * @param prefix the prefix to search for in the cell values
+ * @param startingRow the index of the row where to start searching from
+ * @param bias the search direction, either {@link Position.Bias.Forward}
+ * or {@link Position.Bias.Backward}
+ *
+ * @return the path to the found element or -1 if no such element has
+ * been found
+ *
+ * @throws IllegalArgumentException if prefix is <code>null</code> or
+ * startingRow is not valid
+ *
+ * @since 1.4
+ */
+ public TreePath getNextMatch(String prefix, int startingRow,
+ Position.Bias bias)
+ {
+ if (prefix == null)
+ throw new IllegalArgumentException("The argument 'prefix' must not be"
+ + " null.");
+ if (startingRow < 0)
+ throw new IllegalArgumentException("The argument 'startingRow' must not"
+ + " be less than zero.");
+
+ int size = getRowCount();
+ if (startingRow > size)
+ throw new IllegalArgumentException("The argument 'startingRow' must not"
+ + " be greater than the number of"
+ + " elements in the TreeModel.");
+
+ TreePath foundPath = null;
+ if (bias == Position.Bias.Forward)
+ {
+ for (int i = startingRow; i < size; i++)
+ {
+ TreePath path = getPathForRow(i);
+ Object o = path.getLastPathComponent();
+ // FIXME: in the following call to convertValueToText the
+ // last argument (hasFocus) should be done right.
+ String item = convertValueToText(o, isRowSelected(i),
+ isExpanded(i),
+ treeModel.isLeaf(o), i, false);
+ if (item.startsWith(prefix))
+ {
+ foundPath = path;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (int i = startingRow; i >= 0; i--)
+ {
+ TreePath path = getPathForRow(i);
+ Object o = path.getLastPathComponent();
+ // FIXME: in the following call to convertValueToText the
+ // last argument (hasFocus) should be done right.
+ String item = convertValueToText(o, isRowSelected(i),
+ isExpanded(i),
+ treeModel.isLeaf(o), i, false);
+ if (item.startsWith(prefix))
+ {
+ foundPath = path;
+ break;
+ }
+ }
+ }
+ return foundPath;
}
}
Index: kaffe/libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java:1.1 kaffe/libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java:1.2
--- kaffe/libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java:1.1 Tue Apr 19 18:43:23 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java Fri Jun 10 19:51:08 2005
@@ -38,6 +38,8 @@
package javax.swing.plaf.metal;
+import java.util.HashMap;
+
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicSplitPaneUI;
@@ -46,9 +48,8 @@
extends BasicSplitPaneUI
{
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalSplitPaneUIs */
- private static MetalSplitPaneUI instance = null;
+ /** The UI instances for MetalSplitPaneUIs */
+ private static HashMap instances;
/**
* Constructs a new instance of MetalSplitPaneUI.
@@ -67,8 +68,19 @@
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalSplitPaneUI();
+ if (instances == null)
+ instances = new HashMap();
+
+ Object o = instances.get(component);
+ MetalSplitPaneUI instance;
+ if (o == null)
+ {
+ instance = new MetalSplitPaneUI();
+ instances.put(component, instance);
+ }
+ else
+ instance = (MetalSplitPaneUI) o;
+
return instance;
}
}
More information about the kaffe
mailing list