[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: corba and swing fixes

Kaffe CVS cvs-commits at kaffe.org
Wed Aug 10 18:26:45 PDT 2005


PatchSet 6812 
Date: 2005/08/11 01:18:40
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: corba and swing fixes

Members: 
	ChangeLog:1.4337->1.4338 
	libraries/javalib/Makefile.am:1.379->1.380 
	libraries/javalib/Makefile.in:1.469->1.470 
	libraries/javalib/all.files:1.149->1.150 
	libraries/javalib/java/awt/Container.java:1.37->1.38 
	libraries/javalib/javax/swing/DefaultCellEditor.java:1.6->1.7 
	libraries/javalib/javax/swing/JTable.java:1.26->1.27 
	libraries/javalib/javax/swing/JTree.java:1.25->1.26 
	libraries/javalib/javax/swing/plaf/basic/BasicLabelUI.java:1.6->1.7 
	libraries/javalib/javax/swing/plaf/basic/BasicTableUI.java:1.11->1.12 
	libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.15->1.16 
	libraries/javalib/javax/swing/plaf/metal/MetalLookAndFeel.java:1.17->1.18 
	libraries/javalib/javax/swing/table/DefaultTableCellRenderer.java:1.7->1.8 
	libraries/javalib/javax/swing/tree/DefaultTreeCellRenderer.java:1.9->1.10 
	libraries/javalib/javax/swing/tree/DefaultTreeModel.java:1.7->1.8 
	libraries/javalib/org/omg/CORBA/package.html:1.4->1.5 
	libraries/javalib/org/omg/DynamicAny/_DynAnyFactoryStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynAnyStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynArrayStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynEnumStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynFixedStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynSequenceStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynStructStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynUnionStub.java:1.1->1.2 
	libraries/javalib/org/omg/DynamicAny/_DynValueStub.java:1.1->1.2 
	libraries/javalib/org/omg/PortableInterceptor/Interceptor.java:INITIAL->1.1 
	libraries/javalib/org/omg/PortableInterceptor/InterceptorOperations.java:INITIAL->1.1 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4337 kaffe/ChangeLog:1.4338
--- kaffe/ChangeLog:1.4337	Wed Aug 10 23:13:54 2005
+++ kaffe/ChangeLog	Thu Aug 11 01:18:40 2005
@@ -1,3 +1,169 @@
+2005-08-10  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
+	2005-08-10  Lillian Angel  <langel at redhat.com>
+
+	* javax/swing/JTree.java
+	(doExpandParents): Took out call to checkExpandParents.
+	(checkExpandParents): Helper method not needed. Caused problems since
+	fireTreeWillExpand was being called too many times. fireTreeWillExpand is
+	called from BasicTreeUI whenever a node is expanded.
+
+	2005-08-10  Audrius Meskauskas  <AudriusA at Bioinformatics.org>
+
+        * org/omg/PortableInterceptor/Interceptor.java,
+        org/omg/PortableInterceptor/InterceptorOperations.java: New files.
+        * org/omg/DynamicAny/_DynAnyFactoryStub.java,
+        org/omg/DynamicAny/_DynAnyStub.java,
+        org/omg/DynamicAny/_DynArrayStub.java,
+        org/omg/DynamicAny/_DynEnumStub.java,
+        org/omg/DynamicAny/_DynFixedStub.java,
+        org/omg/DynamicAny/_DynStructStub.java,
+        org/omg/DynamicAny/_DynUnionStub.java,
+        org/omg/DynamicAny/_DynValueStub.java,
+        org/omg/DynamicAny/_DynSequenceStub.java: Added _opsClass field.
+
+	2005-08-10  Lillian Angel  <langel at redhat.com>
+
+	* javax/swing/plaf/basic/BasicTreeUI.java:
+	Formatted entire class.
+
+	2005-08-10  Lillian Angel  <langel at redhat.com>
+	
+	* javax/swing/plaf/basic/BasicTreeUI.java
+	(mouseClicked): Called fireTreeWillExpand and fireTreeWillCollapse when
+	appropriate.
+	(keyPressed): Likewise.
+
+	2005-08-10  Roman Kennke  <roman at kennke.org>
+
+	* java/awt/Container.java
+	(paint): Call visitChildren with lightweightOnly == true.
+	(update): Only call paint if we are not in a toplevel container.
+
+	2005-08-09  Anthony Balkissoon  <abalkiss at redhat.com>
+
+	* javax/swing/JTable.java:
+	(editingCancelled): Implemented.
+	(editCellAt): Added a KeyListener to our editor to listen for
+	the ESCAPE key and cancel editing upon receiving it.
+
+	2005-08-09  Lillian Angel  <langel at redhat.com>
+
+	* javax/swing/JTable.java
+	(setRowHeight): Fixed condition on when to throw exception.
+	(setRowHeight): Parameters were mixed up.
+
+	2005-08-09  Lillian Angel  <langel at redhat.com>
+
+	* javax/swing/plaf/basic/BasicLabelUI.java
+	(paint): Added in painting code for label border.
+	* javax/swing/plaf/basic/BasicTreeUI.java
+	(paintControlIcons): Fixed location for control icons.
+	* javax/swing/plaf/metal/MetalLookAndFeel.java:
+	Added defaults for selection and non-selection border for
+	tree cells.
+	* javax/swing/tree/DefaultTreeCellRenderer.java
+	(getTreeCellRendererComponent): Set borders for node. Also,
+	made node transparent (not opaque), So JLabel draws icon,
+	text and border appropriately.
+
+	2005-08-09  Lillian Angel  <langel at redhat.com>
+
+	* javax/swing/plaf/basic/BasicLabelUI.java
+	(paint): Added in code to paint background rect according to
+	API. Also, formatting changes.
+	* javax/swing/plaf/basic/BasicTreeUI.java
+	(setCellRenderer): Fixed to changed renderer in JTree.
+	(uninstallDefaults): Line taken out because not needed.
+	(paintNode): Took out unneeded code because BasicLabelUI was fixed.
+	(paintRecursive): Fixed so lines are only drawn when parents have
+	children.	
+
+	2005-08-09  Anthony Balkissoon  <abalkiss at redhat.com>
+
+	* javax/swing/DefaultCellEditor.java:
+	(EditorDelegate.setValue): Implemented.
+	(EditorDelegate.getCellEditorValue): Implemented.
+	(EditorDelegate.isCellEditable): Implemented.
+	(EditorDelegate.shouldSelectCell): Implemented.
+	(EditorDelegate.stopCellEditing): Implemented.
+	(EditorDelegate.cancelCellEditing): Implemented.
+	(EditorDelegate.startCellEditing): Implemented.
+	(EditorDelegate.actionPerformed): Implemented.
+	(EditorDelegate.itemStateChanged): Implemented.
+	(EditorDelegate.fireEditingStopped): New implementation method.
+	(EditorDelegate.fireEditingCancelled): New implementation method.
+	(DefaultCellEditor): Implemented 3 constructors.
+	(getComponent): Implemented.
+	(getClickCountToStart): Implemented.
+	(setClickCountToStart): Implemented.
+	(getCellEditorValue): Implemented.
+	(isCellEditable): Implemented.
+	(shouldSelectCell): Implemented.
+	(cancelCellEditing): Implemented.
+	(getTableCellEditorComponent): Implemented.
+	* javax/swing/JTable.java:
+	(EditorUpdateTimer): New private class.
+	(editingStopped): Implemented.
+	(setValueAt): If the Object value is a Component, add it to the JTable
+	so it can obtain focus.
+	(editCellAt): Implemented.
+	(removeEditor): Implemented.
+	(prepareEditor): Implemented.
+	* javax/swing/plaf/basic/BasicTableUI.java:
+	(KeyHandler.keyPressed): Added F2 "start editing" key action.
+	(MouseHandler.mousePressed): Added check to see if a new cell was
+	selected and we need to stop editing.
+	(paint): If the cell is a JTextField, paint its Caret as well.
+	* javax/swing/table/DefaultTableCellRenderer.java:
+	(getTableCellRendererComponent): If a JTextField is passed in, return
+	one.  This is used for editing JTable cells.
+
+	2005-08-09  Mark Wielaard  <mark at klomp.org>
+
+	* javax/swing/tree/DefaultTreeModel.java: Fix copyright
+	boilerplate formatting.
+
+	2005-08-09  Lillian Angel  <langel at redhat.com>
+
+	* javax/swing/tree/DefaultTreeModel.java:
+	Fixed formatting of class.
+
+	2005-08-09  Lillian Angel  <langel at redhat.com>
+
+	Fixes Bug #23255
+	* javax/swing/plaf/basic/BasicTreeUI.java:
+	Fixed entire class to use Objects as opposed to TreeNodes.
+	(getPathBounds): Changed root to Object
+	(getPathForRow): Likewise.
+	(getRowCount): Likewise.
+	(getPreferredSize): Changed root and nextNode to be of type
+	Object.
+	(isLeaf): Took out unnecessary code. 
+	(keyPressed): Changed all TreeNodes to be of type Object.
+	(getCellLocation): Likewise.
+	(paintNode): Likewise.
+	(paintRecursive): Likewise.
+	(getParent): Implemented.
+	(findNode): Helper Implemented.
+	(getNextVisibleNode): Changed return and parameter type to Object.
+	(getPreviousVisibleNode): Likewise.
+	(getNextNode): Likewise.
+	(getPreviousNode): Likewise.
+	(getNextSibling): Likewise.
+	(getPreviousSibling): Likewise.
+	(getPathToRoot): Likewise.
+	(getLevel): Likewise.
+	* javax/swing/tree/DefaultTreeModel.java
+	(getIndexOfChild): Implemented.
+
+	2005-08-09  Audrius Meskauskas  <AudriusA at Bioinformatics.org>
+
+        * org/omg/CORBA/package.html: Documentation update.
+        * org/omg/DynamicAny/package.html: New file.
+
 2005-08-10  Andreas Tobler  <a.tobler at schweiz.ch>
 
 	* config/powerpc/ppc_stack_frame.h (FPFRAME): Return an address and
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.379 kaffe/libraries/javalib/Makefile.am:1.380
--- kaffe/libraries/javalib/Makefile.am:1.379	Wed Aug 10 11:37:47 2005
+++ kaffe/libraries/javalib/Makefile.am	Thu Aug 11 01:18:44 2005
@@ -4745,6 +4745,8 @@
 	org/omg/Messaging/SYNC_WITH_TRANSPORT.java \
 	org/omg/Messaging/SyncScopeHelper.java
 org_omg_PortableInterceptor_SRCS = \
+	org/omg/PortableInterceptor/Interceptor.java \
+	org/omg/PortableInterceptor/InterceptorOperations.java \
 	org/omg/PortableInterceptor/LOCATION_FORWARD.java \
 	org/omg/PortableInterceptor/SUCCESSFUL.java \
 	org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.469 kaffe/libraries/javalib/Makefile.in:1.470
--- kaffe/libraries/javalib/Makefile.in:1.469	Wed Aug 10 11:37:48 2005
+++ kaffe/libraries/javalib/Makefile.in	Thu Aug 11 01:18:45 2005
@@ -5380,6 +5380,8 @@
 	org/omg/Messaging/SyncScopeHelper.java
 
 org_omg_PortableInterceptor_SRCS = \
+	org/omg/PortableInterceptor/Interceptor.java \
+	org/omg/PortableInterceptor/InterceptorOperations.java \
 	org/omg/PortableInterceptor/LOCATION_FORWARD.java \
 	org/omg/PortableInterceptor/SUCCESSFUL.java \
 	org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.149 kaffe/libraries/javalib/all.files:1.150
--- kaffe/libraries/javalib/all.files:1.149	Wed Aug 10 11:37:51 2005
+++ kaffe/libraries/javalib/all.files	Thu Aug 11 01:18:46 2005
@@ -4093,6 +4093,8 @@
 org/omg/IOP/TransactionService.java
 org/omg/Messaging/SYNC_WITH_TRANSPORT.java
 org/omg/Messaging/SyncScopeHelper.java
+org/omg/PortableInterceptor/Interceptor.java
+org/omg/PortableInterceptor/InterceptorOperations.java
 org/omg/PortableInterceptor/LOCATION_FORWARD.java
 org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java
 org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
Index: kaffe/libraries/javalib/java/awt/Container.java
diff -u kaffe/libraries/javalib/java/awt/Container.java:1.37 kaffe/libraries/javalib/java/awt/Container.java:1.38
--- kaffe/libraries/javalib/java/awt/Container.java:1.37	Mon Aug  8 02:52:23 2005
+++ kaffe/libraries/javalib/java/awt/Container.java	Thu Aug 11 01:18:49 2005
@@ -761,7 +761,7 @@
     super.paint(g);
     // Visit heavyweights as well, in case they were
     // erased when we cleared the background for this container.
-    visitChildren(g, GfxPaintVisitor.INSTANCE, false);
+    visitChildren(g, GfxPaintVisitor.INSTANCE, true);
   }
 
   /**
@@ -785,8 +785,8 @@
   {
     if (getParent() == null)
       super.update(g);
-    
-    paint(g);
+    else
+      paint(g);
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/DefaultCellEditor.java
diff -u kaffe/libraries/javalib/javax/swing/DefaultCellEditor.java:1.6 kaffe/libraries/javalib/javax/swing/DefaultCellEditor.java:1.7
--- kaffe/libraries/javalib/javax/swing/DefaultCellEditor.java:1.6	Sat Jul 30 16:39:24 2005
+++ kaffe/libraries/javalib/javax/swing/DefaultCellEditor.java	Thu Aug 11 01:18:49 2005
@@ -43,9 +43,13 @@
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
 import java.io.Serializable;
 import java.util.EventObject;
 
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.CellEditorListener;
 import javax.swing.table.TableCellEditor;
 import javax.swing.tree.TreeCellEditor;
 
@@ -91,8 +95,10 @@
      *
      * @param event TODO
      */
-    public void setValue(Object event)
+    public void setValue(Object value)
     {
+      // TODO: should be setting the value in the editorComp
+      this.value = value;
     }
 
    /**
@@ -102,7 +108,8 @@
      */
     public Object getCellEditorValue()
     {
-      return null; // TODO
+      // TODO: should be getting the updated value from the editorComp
+      return value;
     } // getCellEditorValue()
 
     /**
@@ -114,7 +121,11 @@
      */
     public boolean isCellEditable(EventObject event)
     {
-      return false; // TODO
+      if (!(event instanceof MouseEvent))
+        return true;
+
+      //Todo: if the right number of clicks has occured, return true;
+      return false;
     } // isCellEditable()
 
     /**
@@ -126,7 +137,8 @@
      */
     public boolean shouldSelectCell(EventObject event)
     {
-      return false; // TODO
+      // return true to indicate that the editing cell may be selected
+      return true;
     } // shouldSelectCell()
 
     /**
@@ -136,7 +148,8 @@
      */
     public boolean stopCellEditing()
     {
-      return false; // TODO
+      fireEditingStopped();
+      return true;
     } // stopCellEditing()
 
     /**
@@ -144,7 +157,7 @@
      */
     public void cancelCellEditing()
     {
-      // TODO
+      fireEditingCanceled();
     } // cancelCellEditing()
 
     /**
@@ -156,7 +169,8 @@
      */
     public boolean startCellEditing(EventObject event)
     {
-      return false; // TODO
+      // return true to indicate that editing has begun
+      return true;
     } // startCellEditing()
 
     /**
@@ -166,7 +180,7 @@
      */
     public void actionPerformed(ActionEvent event)
     {
-      // TODO
+      stopCellEditing();
     } // actionPerformed()
 
     /**
@@ -176,9 +190,23 @@
      */
     public void itemStateChanged(ItemEvent event)
     {
-      // TODO
+      stopCellEditing();
     } // itemStateChanged()
 
+    void fireEditingStopped()
+    {
+      CellEditorListener[] listeners = getCellEditorListeners();
+      for (int index = 0; index < listeners.length; index++)
+        listeners[index].editingStopped(changeEvent);
+      
+    }
+    
+    void fireEditingCanceled()
+    {
+      CellEditorListener[] listeners = getCellEditorListeners();
+      for (int index = 0; index < listeners.length; index++)
+        listeners[index].editingCanceled(changeEvent);
+    }
   } // EditorDelegate
 
 	/**
@@ -203,7 +231,8 @@
    */
   public DefaultCellEditor(JTextField textfield)
   {
-    // TODO
+    editorComponent = textfield;
+    clickCountToStart = 2;
   } // DefaultCellEditor()
 
   /**
@@ -213,7 +242,8 @@
    */
   public DefaultCellEditor(JCheckBox checkbox)
   {
-    // TODO
+    editorComponent = checkbox;
+    clickCountToStart = 1;
   } // DefaultCellEditor()
 
   /**
@@ -223,7 +253,8 @@
    */
   public DefaultCellEditor(JComboBox combobox)
   {
-    // TODO
+    editorComponent = combobox;
+    clickCountToStart = 1;
   } // DefaultCellEditor()
 
   /**
@@ -233,7 +264,7 @@
    */
   public Component getComponent()
   {
-    return null; // TODO
+    return editorComponent; 
   } // getComponent()
 
   /**
@@ -243,7 +274,7 @@
    */
   public int getClickCountToStart()
   {
-    return 0; // TODO
+    return clickCountToStart;
   } // getClickCountToStart()
 
   /**
@@ -253,7 +284,7 @@
    */
   public void setClickCountToStart(int count)
   {
-    // TODO
+    clickCountToStart = count;
   } // setClickCountToStart()
 
   /**
@@ -263,7 +294,7 @@
    */
   public Object getCellEditorValue()
   {
-    return null; // TODO
+    return delegate.getCellEditorValue();
   } // getCellEditorValue()
 
   /**
@@ -275,7 +306,7 @@
    */
   public boolean isCellEditable(EventObject event)
   {
-    return false; // TODO
+    return delegate.isCellEditable(event);
   } // isCellEditable()
 
   /**
@@ -287,7 +318,7 @@
    */
   public boolean shouldSelectCell(EventObject event)
   {
-    return false; // TODO
+    return delegate.shouldSelectCell(event);
   } // shouldSelectCell()
 
   /**
@@ -297,7 +328,7 @@
    */
   public boolean stopCellEditing()
   {
-    return false; // TODO
+    return delegate.stopCellEditing();
   } // stopCellEditing()
 
   /**
@@ -305,7 +336,7 @@
    */
   public void cancelCellEditing()
   {
-    // TODO
+    delegate.cancelCellEditing();
   } // cancelCellEditing()
 
   /**
@@ -339,10 +370,30 @@
    *
    * @returns Component
    */
-  public Component getTableCellEditorComponent(JTable tree, Object value,
+  public Component getTableCellEditorComponent(JTable table, Object value,
                                                boolean isSelected, int row,
                                                int column)
   {
-    return null; // TODO
+    // NOTE: as specified by Sun, we don't call new() everytime, we return 
+    // editorComponent on each call to getTableCellEditorComponent or
+    // getTreeCellEditorComponent.  However, currently JTextFields have a
+    // problem with getting rid of old text, so without calling new() there
+    // are some strange results.  If you edit more than one cell in the table
+    // text from previously edited cells may unexpectedly show up in the 
+    // cell you are currently editing.  This will be fixed automatically
+    // when JTextField is fixed.
+    if (editorComponent instanceof JTextField)
+      {
+        ((JTextField)editorComponent).setText(value.toString());
+        delegate = new EditorDelegate();
+        ((JTextField)editorComponent).addActionListener(delegate);
+      }
+    else
+      {
+        // TODO
+      }
+    return editorComponent;
   } // getTableCellEditorComponent()
+
+
 }
Index: kaffe/libraries/javalib/javax/swing/JTable.java
diff -u kaffe/libraries/javalib/javax/swing/JTable.java:1.26 kaffe/libraries/javalib/javax/swing/JTable.java:1.27
--- kaffe/libraries/javalib/javax/swing/JTable.java:1.26	Mon Aug  8 02:52:26 2005
+++ kaffe/libraries/javalib/javax/swing/JTable.java	Thu Aug 11 01:18:49 2005
@@ -43,9 +43,14 @@
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.util.Date;
+import java.util.EventObject;
 import java.util.Hashtable;
 import java.util.Vector;
 
@@ -69,6 +74,7 @@
 import javax.swing.table.TableColumn;
 import javax.swing.table.TableColumnModel;
 import javax.swing.table.TableModel;
+import javax.swing.text.Caret;
 
 public class JTable extends JComponent
   implements TableModelListener, Scrollable, TableColumnModelListener,
@@ -351,6 +357,7 @@
    */
   protected transient Component editorComp;
 
+
   /**
    * Whether or not the table should automatically compute a matching
    * {@link TableColumnModel} and assign it to the {@link #columnModel}
@@ -555,7 +562,27 @@
    */
   protected JTableHeader tableHeader;
 
-  
+  /**
+   * The row of the cell being edited.
+   */
+  int rowBeingEdited = -1;
+
+  /**
+   * The column of the cell being edited.
+   */
+  int columnBeingEdited = -1;
+
+  /**
+   * The action listener for the editor's Timer.
+   */
+  Timer editorTimer = new EditorUpdateTimer();
+
+  /**
+   * Stores the old value of a cell before it was edited, in case
+   * editing is cancelled
+   */
+  Object oldCellValue;
+
   /**
    * Creates a new <code>JTable</code> instance.
    */
@@ -673,6 +700,51 @@
     this(new DefaultTableModel(data, columnNames));
   }
 
+  /**
+   * The timer that updates the editor component.
+   */
+  private class EditorUpdateTimer
+    extends Timer
+    implements ActionListener
+  {
+    /**
+     * Creates a new EditorUpdateTimer object with a default delay of 0.5 seconds.
+     */
+    public EditorUpdateTimer()
+    {
+      super(500, null);
+      addActionListener(this);
+    }
+
+    /**
+     * Lets the caret blink and repaints the table.
+     */
+    public void actionPerformed(ActionEvent ev)
+    {
+      Caret c = ((JTextField)JTable.this.editorComp).getCaret();
+      if (c != null)
+        c.setVisible(!c.isVisible());
+      JTable.this.repaint();
+    }
+
+    /**
+     * Updates the blink delay according to the current caret.
+     */
+    public void update()
+    {
+      stop();
+      Caret c = ((JTextField)JTable.this.editorComp).getCaret();
+      if (c != null)
+	{
+	  setDelay(c.getBlinkRate());
+	  if (((JTextField)JTable.this.editorComp).isEditable())
+	    start();
+	  else
+	    c.setVisible(false);
+	}
+    }
+  }
+
   public void addColumn(TableColumn column)
   {
     if (column.getHeaderValue() == null)
@@ -774,11 +846,40 @@
 
   public void editingCanceled (ChangeEvent event)
   {
+    if (rowBeingEdited > -1 && columnBeingEdited > -1)
+      {
+        if (getValueAt(rowBeingEdited, columnBeingEdited) instanceof JTextField)
+          {
+            remove ((Component)getValueAt(rowBeingEdited, columnBeingEdited));
+            setValueAt(oldCellValue, rowBeingEdited, columnBeingEdited);
+          }
+        rowBeingEdited = -1;
+        columnBeingEdited = -1;
+      }
+    editorTimer.stop();
+    editorComp = null;
+    cellEditor = null;
+    requestFocusInWindow(false);
     repaint();
   }
 
   public void editingStopped (ChangeEvent event)
   {
+    if (rowBeingEdited > -1 && columnBeingEdited > -1)
+      {
+        if (getValueAt(rowBeingEdited, columnBeingEdited) instanceof JTextField)
+          {
+            remove((Component)getValueAt(rowBeingEdited, columnBeingEdited));
+            setValueAt(((JTextField)editorComp).getText(), 
+                       rowBeingEdited, columnBeingEdited);
+          }
+        rowBeingEdited = -1;
+        columnBeingEdited = -1;
+      }
+    editorTimer.stop();
+    editorComp = null;
+    cellEditor = null;
+    requestFocusInWindow(false);
     repaint();
   }
 
@@ -980,7 +1081,7 @@
 
     if (editor == null)
       editor = getDefaultEditor(dataModel.getColumnClass(column));
-
+    
     return editor;
   }
 
@@ -1475,7 +1576,7 @@
    */ 
   public void setRowHeight(int r)
   {
-    if (rowHeight < 1)
+    if (r < 1)
       throw new IllegalArgumentException();
     
     rowHeight = r;
@@ -1490,7 +1591,7 @@
    * @param rh is the new rowHeight
    * @param row is the row to change the rowHeight of
    */
-  public void setRowHeight(int rh, int row)
+  public void setRowHeight(int row, int rh)
   {
      setRowHeight(rh);
      // FIXME: not implemented
@@ -2116,6 +2217,8 @@
 
   public void setValueAt(Object value, int row, int column)
   {
+    if (value instanceof Component)
+      add((Component)value);
     dataModel.setValueAt(value, row, convertColumnIndexToModel(column));
   }
 
@@ -2206,5 +2309,67 @@
         
         
       }
+  }
+
+  /**
+   * Programmatically starts editing the specified cell.
+   *
+   * @param row the row of the cell to edit.
+   * @param column the column of the cell to edit.
+   */
+  public boolean editCellAt (int row, int column)
+  {
+    oldCellValue = getValueAt(row, column);
+    setCellEditor(getCellEditor(row, column));
+    editorComp = prepareEditor(cellEditor, row, column);
+    editorComp.addKeyListener(new KeyAdapter() {
+        public void keyPressed(KeyEvent e) {
+          if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+            if (JTable.this.cellEditor != null)
+              JTable.this.cellEditor.cancelCellEditing();
+          }
+        }
+      });
+    cellEditor.addCellEditorListener(this);
+    rowBeingEdited = row;
+    columnBeingEdited = column;
+    setValueAt(editorComp, row, column);
+    ((JTextField)editorComp).requestFocusInWindow(false);
+    editorTimer.start();
+    return true;
+  }
+
+  /**
+   * Programmatically starts editing the specified cell.
+   *
+   * @param row the row of the cell to edit.
+   * @param column the column of the cell to edit.
+   */
+  public boolean editCellAt (int row, int column, EventObject e)
+  {
+    return editCellAt(row, column);
+  }
+
+  /**
+   * Discards the editor object.
+   */
+  public void removeEditor()
+  {
+    editingStopped(new ChangeEvent(this));
+  }
+
+  /**
+   * Prepares the editor by querying for the value and selection state of the
+   * cell at (row, column).
+   *
+   * @param editor the TableCellEditor to set up
+   * @param row the row of the cell to edit
+   * @param column the column of the cell to edit
+   * @return the Component being edited
+   */
+  public Component prepareEditor (TableCellEditor editor, int row, int column)
+  {
+    return editor.getTableCellEditorComponent
+      (this, getValueAt(row, column), isCellSelected(row, column), row, column);
   }
 }
Index: kaffe/libraries/javalib/javax/swing/JTree.java
diff -u kaffe/libraries/javalib/javax/swing/JTree.java:1.25 kaffe/libraries/javalib/javax/swing/JTree.java:1.26
--- kaffe/libraries/javalib/javax/swing/JTree.java:1.25	Wed Aug 10 11:37:53 2005
+++ kaffe/libraries/javalib/javax/swing/JTree.java	Thu Aug 11 01:18:49 2005
@@ -1297,7 +1297,7 @@
 		// Don't expand if last path component is a leaf node.
 		if ((path == null) || (treeModel.isLeaf(path.getLastPathComponent())))
 			return;
-		
+
 		setExpandedState(path, true);
 	}
 
@@ -1503,21 +1503,9 @@
 		return null;
 	}
 
-	private void checkExpandParents(TreePath path) throws ExpandVetoException
-	{
-
-		TreePath parent = path.getParentPath();
-
-		if (parent != null)
-			checkExpandParents(parent);
-
-		fireTreeWillExpand(path);
-	}
-
 	private void doExpandParents(TreePath path, boolean state)
 	{
-		TreePath parent = path.getParentPath();
-		
+		TreePath parent = path.getParentPath();		
 		if (isExpanded(parent))
 		{
 			nodeStates.put(path, state ? EXPANDED : COLLAPSED);
@@ -1536,17 +1524,6 @@
 			return;
 
 		TreePath parent = path.getParentPath();
-
-		try
-		{
-			if (parent != null)
-				checkExpandParents(parent);
-		} 
-		catch (ExpandVetoException e)
-		{
-			// Expansion vetoed.
-			return;
-		}
 
 		doExpandParents(path, state);
 	}
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLabelUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLabelUI.java:1.6 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLabelUI.java:1.7
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLabelUI.java:1.6	Sun Jul 10 02:11:42 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLabelUI.java	Thu Aug 11 01:18:50 2005
@@ -1,39 +1,39 @@
 /* BasicLabelUI.java
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
-This file is part of GNU Classpath.
+ This file is part of GNU Classpath.
 
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library.  Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module.  An independent module is a module which is not derived from
+ or based on this library.  If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version. */
 
 package javax.swing.plaf.basic;
 
@@ -56,12 +56,13 @@
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.LabelUI;
 
-
 /**
  * This is the Basic Look and Feel class for the JLabel.  One BasicLabelUI
  * object is used to paint all JLabels that utilize the Basic Look and Feel.
  */
-public class BasicLabelUI extends LabelUI implements PropertyChangeListener
+public class BasicLabelUI
+    extends LabelUI
+    implements PropertyChangeListener
 {
   /** The labelUI that is shared by all labels. */
   protected static BasicLabelUI labelUI;
@@ -99,20 +100,20 @@
    *
    * @return The preferred size.
    */
-  public Dimension getPreferredSize(JComponent c) 
+  public Dimension getPreferredSize(JComponent c)
   {
-    JLabel lab = (JLabel)c;
+    JLabel lab = (JLabel) c;
     Rectangle vr = new Rectangle();
     Rectangle ir = new Rectangle();
     Rectangle tr = new Rectangle();
-    Insets insets = lab.getInsets();      
+    Insets insets = lab.getInsets();
     FontMetrics fm = lab.getToolkit().getFontMetrics(lab.getFont());
     layoutCL(lab, fm, lab.getText(), lab.getIcon(), vr, ir, tr);
     Rectangle cr = tr.union(ir);
-    return new Dimension(insets.left + cr.width + insets.right,
-                         insets.top + cr.height + insets.bottom);
-    
-  }  
+    return new Dimension(insets.left + cr.width + insets.right, insets.top
+        + cr.height + insets.bottom);
+
+  }
 
   /**
    * This method returns the minimum size of the {@link JComponent} given. If
@@ -144,7 +145,7 @@
 
   /**
    * The method that paints the label according to its current state.
-   *
+   * 
    * @param g The {@link Graphics} object to paint with.
    * @param c The {@link JComponent} to paint.
    */
@@ -169,26 +170,39 @@
       vr.width = 0;
     if (vr.height < 0)
       vr.height = 0;
-      
+
     Icon icon = (b.isEnabled()) ? b.getIcon() : b.getDisabledIcon();
 
     String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr);
-    
+
     if (icon != null)
-      icon.paintIcon(b, g, ir.x, ir.y);
-    if (text != null && ! text.equals(""))
+      icon.paintIcon(b, g, ir.x, ir.y);        
+    if (text != null && !text.equals(""))
+    {
+      g.setColor(b.getBackground());
+
+      if (b.isOpaque())

*** Patch too long, truncated ***



More information about the kaffe mailing list