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

Kaffe CVS cvs-commits at kaffe.org
Thu Jul 7 16:22:34 PDT 2005


PatchSet 6714 
Date: 2005/07/07 23:17:20
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: swing and http fixes

2005-07-08  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU classpath.

        2005-07-07  Roman Kennke  <roman at kennke.org>

        * javax/swing/plaf/basic/BasicTreeUI.java
        (MouseInputHandler.mouseClicked): Access static TreeSelectionModel
        fields via the class and not via an instance.

        2005-07-07  Roman Kennke  <roman at kennke.org>

        * javax/swing/plaf/basic/BasicTreeUI.java:
        Reformatted source file to better match our coding standards.

        2005-07-06  Chris Burdess  <dog at gnu.org>

        * gnu/java/net/protocol/http/HTTPConnection.java,
        gnu/java/net/protocol/http/HTTPURLConnection.java:
        Fix bug with multiple threads and persistent connections.

Members: 
	ChangeLog:1.4238->1.4239 
	libraries/javalib/gnu/java/net/protocol/http/HTTPConnection.java:1.8->1.9 
	libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.12->1.13 
	libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4238 kaffe/ChangeLog:1.4239
--- kaffe/ChangeLog:1.4238	Thu Jul  7 03:08:31 2005
+++ kaffe/ChangeLog	Thu Jul  7 23:17:20 2005
@@ -1,3 +1,24 @@
+2005-07-08  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU classpath.
+
+	2005-07-07  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/basic/BasicTreeUI.java
+        (MouseInputHandler.mouseClicked): Access static TreeSelectionModel
+        fields via the class and not via an instance.
+
+	2005-07-07  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/basic/BasicTreeUI.java:
+        Reformatted source file to better match our coding standards.
+
+	2005-07-06  Chris Burdess  <dog at gnu.org>
+
+        * gnu/java/net/protocol/http/HTTPConnection.java,
+        gnu/java/net/protocol/http/HTTPURLConnection.java:
+        Fix bug with multiple threads and persistent connections.
+
 2005-07-07  Dalibor Topic  <robilad at kaffe.org>
 
 	* kaffe/kaffe/main.c (main): Duplicate classpath string received from getenv
Index: kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPConnection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPConnection.java:1.8 kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPConnection.java:1.9
--- kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPConnection.java:1.8	Mon Jul  4 00:05:31 2005
+++ kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPConnection.java	Thu Jul  7 23:17:25 2005
@@ -402,7 +402,7 @@
    * Retrieves the socket associated with this connection.
    * This creates the socket if necessary.
    */
-  protected Socket getSocket()
+  protected synchronized Socket getSocket()
     throws IOException
   {
     if (socket == null)
@@ -489,7 +489,7 @@
     sslSocketFactory = factory;
   }
 
-  protected InputStream getInputStream()
+  protected synchronized InputStream getInputStream()
     throws IOException
   {
     if (socket == null)
@@ -499,7 +499,7 @@
     return in;
   }
 
-  protected OutputStream getOutputStream()
+  protected synchronized OutputStream getOutputStream()
     throws IOException
   {
     if (socket == null)
@@ -512,7 +512,7 @@
   /**
    * Closes the underlying socket, if any.
    */
-  protected void closeConnection()
+  protected synchronized void closeConnection()
     throws IOException
   {
     if (socket != null)
Index: kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.12 kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.13
--- kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.12	Mon Jul  4 00:05:31 2005
+++ kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java	Thu Jul  7 23:17:25 2005
@@ -328,6 +328,8 @@
     if (keepAlive)
       {
         StringBuffer buf = new StringBuffer(secure ? "https://" : "http://");
+        buf.append(Thread.currentThread().hashCode());
+        buf.append('@');
         buf.append(host);
         buf.append(':');
         buf.append(port);
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.7 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.8
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.7	Thu Jul  7 02:19:02 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java	Thu Jul  7 23:17:25 2005
@@ -1,36 +1,39 @@
-/*
- * BasicTreeUI.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
- * 
- * 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.
- */
+/* BasicTreeUI.java --
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+   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. */
 
 package javax.swing.plaf.basic;
 
@@ -107,2397 +110,2401 @@
  * @author Lillian Angel (langel at redhat.com)
  */
 public class BasicTreeUI
-		extends TreeUI
+  extends TreeUI
 {
 
-	/** Collapse Icon for the tree. */
-	protected transient Icon collapsedIcon;
+  /** Collapse Icon for the tree. */
+  protected transient Icon collapsedIcon;
 
-	/** Expanded Icon for the tree. */
-	protected transient Icon expandedIcon;
+  /** Expanded Icon for the tree. */
+  protected transient Icon expandedIcon;
 
-	/** Distance between left margin and where vertical dashes will be drawn. */
-	protected int leftChildIndent;
+  /** Distance between left margin and where vertical dashes will be drawn. */
+  protected int leftChildIndent;
 
-	/**
-	 * Distance between leftChildIndent and where cell contents will be drawn.
-	 */
-	protected int rightChildIndent;
-
-	/**
-	 * Total fistance that will be indented. The sum of leftChildIndent and
-	 * rightChildIndent .
-	 */
-	protected int totalChildIndent;
-
-	/** Minimum preferred size. */
-	protected Dimension preferredMinsize;
-
-	/** Index of the row that was last selected. */
-	protected int lastSelectedRow;
-
-	/** Component that we're going to be drawing onto. */
-	protected JTree tree;
-
-	/** Renderer that is being used to do the actual cell drawing. */
-	protected transient TreeCellRenderer currentCellRenderer;
-
-	/**
-	 * Set to true if the renderer that is currently in the tree was created by
-	 * this instance.
-	 */
-	protected boolean createdRenderer;
-
-	/** Editor for the tree. */
-	protected transient TreeCellEditor cellEditor;
-
-	/**
-	 * Set to true if editor that is currently in the tree was created by this
-	 * instance.
-	 */
-	protected boolean createdCellEditor;
-
-	/**
-	 * Set to false when editing and shouldSelectCall() returns true meaning the
-	 * node should be selected before editing, used in completeEditing.
-	 */
-	protected boolean stopEditingInCompleteEditing;
-
-	/** Used to paint the TreeCellRenderer. */
-	protected CellRendererPane rendererPane;
-
-	/** Size needed to completely display all the nodes. */
-	protected Dimension preferredSize;
-
-	/** Is the preferredSize valid? */
-	protected boolean validCachedPreferredSize;
-
-	/** Object responsible for handling sizing and expanded issues. */
-	protected AbstractLayoutCache treeState;
-
-	/** Used for minimizing the drawing of vertical lines. */
-	protected Hashtable drawingCache;
-
-	/**
-	 * True if doing optimizations for a largeModel. Subclasses that don't
-	 * support this may wish to override createLayoutCache to not return a
-	 * FixedHeightLayoutCache instance.
-	 */
-	protected boolean largeModel;
-
-	/** Responsible for telling the TreeState the size needed for a node. */
-	protected AbstractLayoutCache.NodeDimensions nodeDimensions;
-
-	/** Used to determine what to display. */
-	protected TreeModel treeModel;
-
-	/** Model maintaining the selection. */
-	protected TreeSelectionModel treeSelectionModel;
-
-	/**
-	 * How much the depth should be offset to properly calculate x locations.
-	 * This is based on whether or not the root is visible, and if the root
-	 * handles are visible.
-	 */
-	protected int depthOffset;
-
-	/**
-	 * When editing, this will be the Component that is doing the actual
-	 * editing.
-	 */
-	protected Component editingComponent;
-
-	/** Path that is being edited. */
-	protected TreePath editingPath;
-
-	/**
-	 * Row that is being edited. Should only be referenced if editingComponent
-	 * is null.
-	 */
-	protected int editingRow;
-
-	/** Set to true if the editor has a different size than the renderer. */
-	protected boolean editorHasDifferentSize;
-
-	/** Listeners */
-	private PropertyChangeListener propertyChangeListener;
-	private FocusListener focusListener;
-	private TreeSelectionListener treeSelectionListener;
-	private MouseInputListener mouseInputListener;
-	private KeyListener keyListener;
-	private PropertyChangeListener selectionModelPropertyChangeListener;
-	private ComponentListener componentListener;
-	private CellEditorListener cellEditorListener;
-	private TreeExpansionListener treeExpansionListener;
-	private TreeModelListener treeModelListener;
-
-	/**
-	 * Creates a new BasicTreeUI object.
-	 */
-	public BasicTreeUI()
-	{
-		drawingCache = new Hashtable();
-		cellEditor = createDefaultCellEditor();
-		currentCellRenderer = createDefaultCellRenderer();
-		nodeDimensions = createNodeDimensions();
-		rendererPane = createCellRendererPane();
-		configureLayoutCache();
-
-		propertyChangeListener = createPropertyChangeListener();
-		focusListener = createFocusListener();
-		treeSelectionListener = createTreeSelectionListener();
-		mouseInputListener = new MouseInputHandler(null, null, null);
-		keyListener = createKeyListener();
-		selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();
-		componentListener = createComponentListener();
-		cellEditorListener = createCellEditorListener();
-		treeExpansionListener = createTreeExpansionListener();
-		treeModelListener = createTreeModelListener();
-
-		createdRenderer = true;
-		createdCellEditor = true;
-		editingRow = -1;
-		lastSelectedRow = -1;
-	}
-
-	/**
-	 * Returns an instance of the UI delegate for the specified component.
-	 * 
-	 * @param c the <code>JComponent</code> for which we need a UI delegate
-	 *        for.
-	 * @return the <code>ComponentUI</code> for c.
-	 */
-	public static ComponentUI createUI(JComponent c)
-	{
-		return new BasicTreeUI();
-	}
-
-	/**
-	 * Returns the Hash color.
-	 * 
-	 * @return the <code>Color</code> of the Hash.
-	 */
-	protected Color getHashColor()
-	{
-		return UIManager.getLookAndFeelDefaults().getColor("Tree.hash");
-	}
-
-	/**
-	 * Sets the Hash color.
-	 * 
-	 * @param the <code>Color</code> to set the Hash to.
-	 */
-	protected void setHashColor(Color color)
-	{
-		// FIXME: not implemented
-
-	}
-
-	/**
-	 * Sets the left child's indent value.
-	 * 
-	 * @param newAmount is the new indent value for the left child.
-	 */
-	public void setLeftChildIndent(int newAmount)
-	{
-		leftChildIndent = newAmount;
-	}
-
-	/**
-	 * Returns the indent value for the left child.
-	 * 
-	 * @return the indent value for the left child.
-	 */
-	public int getLeftChildIndent(int newAmount)
-	{
-		return leftChildIndent;
-	}
-
-	/**
-	 * Sets the right child's indent value.
-	 * 
-	 * @param newAmount is the new indent value for the right child.
-	 */
-	public void setRightChildIndent(int newAmount)
-	{
-		rightChildIndent = newAmount;
-	}
-
-	/**
-	 * Returns the indent value for the right child.
-	 * 
-	 * @return the indent value for the right child.
-	 */
-	public int getRightChildIndent(int newAmount)
-	{
-		return rightChildIndent;
-	}
-
-	/**
-	 * Sets the expanded icon.
-	 * 
-	 * @param newG is the new expanded icon.
-	 */
-	public void setExpandedIcon(Icon newG)
-	{
-		expandedIcon = newG;
-	}
-
-	/**
-	 * Returns the current expanded icon.
-	 * 
-	 * @return the current expanded icon.
-	 */
-	public Icon getExpandedIcon()
-	{
-		return expandedIcon;
-	}
-
-	/**
-	 * Sets the collapsed icon.
-	 * 
-	 * @param newG is the new collapsed icon.
-	 */
-	public void setCollapsedIcon(Icon newG)
-	{
-		collapsedIcon = newG;
-	}
-
-	/**
-	 * Returns the current collapsed icon.
-	 * 
-	 * @return the current collapsed icon.
-	 */
-	public Icon getCollapsedIcon()
-	{
-		return collapsedIcon;
-	}
-
-	/**
-	 * Updates the componentListener, if necessary.
-	 * 
-	 * @param largeModel sets this.largeModel to it.
-	 */
-	protected void setLargeModel(boolean largeModel)
-	{
-		if (largeModel != this.largeModel)
-		{
-			tree.removeComponentListener(componentListener);
-			this.largeModel = largeModel;
-			tree.addComponentListener(componentListener);
-		}
-	}
-
-	/**
-	 * Returns true if largeModel is set
-	 * 
-	 * @return true if largeModel is set, otherwise false.
-	 */
-	protected boolean isLargeModel()
-	{
-		return largeModel;
-	}
-
-	/**
-	 * Sets the row height.
-	 * 
-	 * @param rowHeight is the height to set this.rowHeight to.
-	 */
-	protected void setRowHeight(int rowHeight)
-	{
-		treeState.setRowHeight(rowHeight);
-	}
-
-	/**
-	 * Returns the current row height.
-	 * 
-	 * @return current row height.
-	 */
-	protected int getRowHeight()
-	{
-		return treeState.getRowHeight();
-	}
-
-	/**
-	 * Sets the TreeCellRenderer to <code>tcr</code>. This invokes
-	 * <code>updateRenderer</code>.
-	 * 
-	 * @param tcr is the new TreeCellRenderer.
-	 */
-	protected void setCellRenderer(TreeCellRenderer tcr)
-	{
-		currentCellRenderer = tcr;
-		updateRenderer();
-	}
-
-	/**
-	 * Return currentCellRenderer, which will either be the trees renderer, or
-	 * defaultCellRenderer, which ever was not null.
-	 * 
-	 * @return the current Cell Renderer
-	 */
-	protected TreeCellRenderer getCellRenderer()
-	{
-		if (currentCellRenderer != null)
-			return currentCellRenderer;
-
-		return createDefaultCellRenderer();
-	}
-
-	/**
-	 * Sets the tree's model.
-	 * 
-	 * @param model to set the treeModel to.
-	 */
-	protected void setModel(TreeModel model)
-	{
-		treeState.setModel(model);
-		treeModel = model;
-	}
-
-	/**
-	 * Returns the tree's model
-	 * 
-	 * @return treeModel
-	 */
-	protected TreeModel getModel()
-	{
-		return treeModel;
-	}
-
-	/**
-	 * Sets the root to being visible.
-	 * 
-	 * @param newValue sets the visibility of the root
-	 */
-	protected void setRootVisible(boolean newValue)
-	{
-		treeState.setRootVisible(newValue);
-	}
-
-	/**
-	 * Returns true if the root is visible.
-	 * 
-	 * @return true if the root is visible.
-	 */
-	protected boolean isRootVisible()
-	{
-		return treeState.isRootVisible();
-	}
-
-	/**
-	 * Determines whether the node handles are to be displayed.
-	 * 
-	 * @param newValue sets whether or not node handles should be displayed.
-	 */
-	protected void setShowsRootHandles(boolean newValue)
-	{
-		tree.setShowsRootHandles(newValue);
-	}
-
-	/**
-	 * Returns true if the node handles are to be displayed.
-	 * 
-	 * @return true if the node handles are to be displayed.
-	 */
-	protected boolean getShowsRootHandles()
-	{
-		return tree.getShowsRootHandles();
-	}
-
-	/**
-	 * Sets the cell editor.
-	 * 
-	 * @param editor to set the cellEditor to.
-	 */
-	protected void setCellEditor(TreeCellEditor editor)
-	{
-		cellEditor = editor;
-	}
-
-	/**
-	 * Returns the <code>TreeCellEditor</code> for this tree.
-	 * 
-	 * @return the cellEditor for this tree.
-	 */
-	protected TreeCellEditor getCellEditor()
-	{
-		return cellEditor;
-	}
-
-	/**
-	 * Configures the receiver to allow, or not allow, editing.
-	 * 
-	 * @param newValue sets the receiver to allow editing if true.
-	 */
-	protected void setEditable(boolean newValue)
-	{
-		tree.setEditable(newValue);
-	}
-
-	/**
-	 * Returns true if the receiver allows editing.
-	 * 
-	 * @return true if the receiver allows editing.
-	 */
-	protected boolean isEditable()
-	{
-		return tree.isEditable();
-	}
-
-	/**
-	 * Resets the selection model. The appropriate listeners are installed on
-	 * the model.
-	 * 
-	 * @param newLSM resets the selection model.
-	 */
-	protected void setSelectionModel(TreeSelectionModel newLSM)
-	{
-		if (newLSM != null)
-		{
-			treeSelectionModel = newLSM;
-			tree.setSelectionModel(treeSelectionModel);
-		}
-	}
-
-	/**
-	 * Returns the current selection model.
-	 * 
-	 * @return the current selection model.
-	 */
-	protected TreeSelectionModel getSelectionModel()
-	{
-		return treeSelectionModel;
-	}
-
-	/**
-	 * Returns the Rectangle enclosing the label portion that the last item in
-	 * path will be drawn to. Will return null if any component in path is
-	 * currently valid.
-	 * 
-	 * @param tree is the current tree the path will be drawn to.
-	 * @param path is the current path the tree to draw to.
-	 * @return the Rectangle enclosing the label portion that the last item in
-	 *         the path will be drawn to.
-	 */
-	public Rectangle getPathBounds(JTree tree, TreePath path)
-	{
-		// FIXME: not implemented
-		return null;
-	}
-
-	/**
-	 * Returns the path for passed in row. If row is not visible null is
-	 * returned.
-	 * 
-	 * @param tree is the current tree to return path for.
-	 * @param row is the row number of the row to return.
-	 * @return the path for passed in row. If row is not visible null is
-	 *         returned.
-	 */
-	public TreePath getPathForRow(JTree tree, int row)
-	{
-		DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree
-				.getModel()).getRoot());
+  /**
+   * Distance between leftChildIndent and where cell contents will be drawn.
+   */
+  protected int rightChildIndent;
+
+  /**
+   * Total fistance that will be indented. The sum of leftChildIndent and
+   * rightChildIndent .
+   */
+  protected int totalChildIndent;
+
+  /** Minimum preferred size. */
+  protected Dimension preferredMinsize;
+
+  /** Index of the row that was last selected. */
+  protected int lastSelectedRow;
+
+  /** Component that we're going to be drawing onto. */
+  protected JTree tree;
+
+  /** Renderer that is being used to do the actual cell drawing. */
+  protected transient TreeCellRenderer currentCellRenderer;
+
+  /**
+   * Set to true if the renderer that is currently in the tree was created by
+   * this instance.
+   */
+  protected boolean createdRenderer;
+
+  /** Editor for the tree. */
+  protected transient TreeCellEditor cellEditor;
+
+  /**
+   * Set to true if editor that is currently in the tree was created by this
+   * instance.
+   */
+  protected boolean createdCellEditor;
+
+  /**
+   * Set to false when editing and shouldSelectCall() returns true meaning the
+   * node should be selected before editing, used in completeEditing.
+   */
+  protected boolean stopEditingInCompleteEditing;
+
+  /** Used to paint the TreeCellRenderer. */
+  protected CellRendererPane rendererPane;
+
+  /** Size needed to completely display all the nodes. */
+  protected Dimension preferredSize;
+
+  /** Is the preferredSize valid? */
+  protected boolean validCachedPreferredSize;
+
+  /** Object responsible for handling sizing and expanded issues. */
+  protected AbstractLayoutCache treeState;
+
+  /** Used for minimizing the drawing of vertical lines. */
+  protected Hashtable drawingCache;
+
+  /**
+   * True if doing optimizations for a largeModel. Subclasses that don't
+   * support this may wish to override createLayoutCache to not return a
+   * FixedHeightLayoutCache instance.
+   */
+  protected boolean largeModel;
+
+  /** Responsible for telling the TreeState the size needed for a node. */
+  protected AbstractLayoutCache.NodeDimensions nodeDimensions;
+
+  /** Used to determine what to display. */
+  protected TreeModel treeModel;
+
+  /** Model maintaining the selection. */
+  protected TreeSelectionModel treeSelectionModel;
+
+  /**
+   * How much the depth should be offset to properly calculate x locations.
+   * This is based on whether or not the root is visible, and if the root
+   * handles are visible.
+   */
+  protected int depthOffset;
+
+  /**
+   * When editing, this will be the Component that is doing the actual
+   * editing.
+   */
+  protected Component editingComponent;
+
+  /** Path that is being edited. */
+  protected TreePath editingPath;
+
+  /**
+   * Row that is being edited. Should only be referenced if editingComponent
+   * is null.
+   */
+  protected int editingRow;
+
+  /** Set to true if the editor has a different size than the renderer. */
+  protected boolean editorHasDifferentSize;
+
+  /** Listeners */
+  private PropertyChangeListener propertyChangeListener;
+  private FocusListener focusListener;
+  private TreeSelectionListener treeSelectionListener;
+  private MouseInputListener mouseInputListener;
+  private KeyListener keyListener;
+  private PropertyChangeListener selectionModelPropertyChangeListener;
+  private ComponentListener componentListener;
+  private CellEditorListener cellEditorListener;
+  private TreeExpansionListener treeExpansionListener;
+  private TreeModelListener treeModelListener;
+
+  /**
+   * Creates a new BasicTreeUI object.
+   */
+  public BasicTreeUI()
+  {
+    drawingCache = new Hashtable();
+    cellEditor = createDefaultCellEditor();
+    currentCellRenderer = createDefaultCellRenderer();
+    nodeDimensions = createNodeDimensions();
+    rendererPane = createCellRendererPane();
+    configureLayoutCache();
+
+    propertyChangeListener = createPropertyChangeListener();
+    focusListener = createFocusListener();
+    treeSelectionListener = createTreeSelectionListener();
+    mouseInputListener = new MouseInputHandler(null, null, null);
+    keyListener = createKeyListener();
+    selectionModelPropertyChangeListener =
+      createSelectionModelPropertyChangeListener();
+    componentListener = createComponentListener();
+    cellEditorListener = createCellEditorListener();
+    treeExpansionListener = createTreeExpansionListener();
+    treeModelListener = createTreeModelListener();
+
+    createdRenderer = true;
+    createdCellEditor = true;
+    editingRow = -1;
+    lastSelectedRow = -1;
+  }
+
+  /**
+   * Returns an instance of the UI delegate for the specified component.
+   * 
+   * @param c the <code>JComponent</code> for which we need a UI delegate
+   *        for.
+   * @return the <code>ComponentUI</code> for c.
+   */
+  public static ComponentUI createUI(JComponent c)
+  {
+    return new BasicTreeUI();
+  }
+
+  /**
+   * Returns the Hash color.
+   * 
+   * @return the <code>Color</code> of the Hash.
+   */
+  protected Color getHashColor()
+  {
+    return UIManager.getLookAndFeelDefaults().getColor("Tree.hash");
+  }
+
+  /**
+   * Sets the Hash color.
+   * 
+   * @param the <code>Color</code> to set the Hash to.
+   */
+  protected void setHashColor(Color color)
+  {
+    // FIXME: not implemented
+    
+  }
+
+  /**
+   * Sets the left child's indent value.
+   * 
+   * @param newAmount is the new indent value for the left child.
+   */
+  public void setLeftChildIndent(int newAmount)
+  {
+    leftChildIndent = newAmount;
+  }
+
+  /**
+   * Returns the indent value for the left child.
+   * 
+   * @return the indent value for the left child.
+   */
+  public int getLeftChildIndent(int newAmount)
+  {
+    return leftChildIndent;
+  }
+
+  /**
+   * Sets the right child's indent value.
+   * 
+   * @param newAmount is the new indent value for the right child.
+   */
+  public void setRightChildIndent(int newAmount)
+  {
+    rightChildIndent = newAmount;
+  }
+
+  /**
+   * Returns the indent value for the right child.
+   * 
+   * @return the indent value for the right child.
+   */
+  public int getRightChildIndent(int newAmount)
+  {
+    return rightChildIndent;
+  }
+
+  /**
+   * Sets the expanded icon.
+   * 
+   * @param newG is the new expanded icon.
+   */
+  public void setExpandedIcon(Icon newG)
+  {
+    expandedIcon = newG;
+  }
+
+  /**
+   * Returns the current expanded icon.
+   * 
+   * @return the current expanded icon.
+   */
+  public Icon getExpandedIcon()
+  {
+    return expandedIcon;
+  }
+
+  /**
+   * Sets the collapsed icon.
+   * 
+   * @param newG is the new collapsed icon.
+   */
+  public void setCollapsedIcon(Icon newG)
+  {
+    collapsedIcon = newG;
+  }
+
+  /**
+   * Returns the current collapsed icon.
+   * 
+   * @return the current collapsed icon.
+   */
+  public Icon getCollapsedIcon()
+  {
+    return collapsedIcon;
+  }
+
+  /**
+   * Updates the componentListener, if necessary.
+   * 
+   * @param largeModel sets this.largeModel to it.
+   */
+  protected void setLargeModel(boolean largeModel)
+  {
+    if (largeModel != this.largeModel)
+      {
+        tree.removeComponentListener(componentListener);
+        this.largeModel = largeModel;
+        tree.addComponentListener(componentListener);
+      }
+  }
+
+  /**
+   * Returns true if largeModel is set
+   * 
+   * @return true if largeModel is set, otherwise false.
+   */
+  protected boolean isLargeModel()
+  {
+    return largeModel;
+  }
+
+  /**
+   * Sets the row height.
+   * 
+   * @param rowHeight is the height to set this.rowHeight to.
+   */
+  protected void setRowHeight(int rowHeight)
+  {
+    treeState.setRowHeight(rowHeight);
+  }
+
+  /**
+   * Returns the current row height.
+   * 
+   * @return current row height.
+   */
+  protected int getRowHeight()
+  {
+    return treeState.getRowHeight();
+  }
+
+  /**
+   * Sets the TreeCellRenderer to <code>tcr</code>. This invokes
+   * <code>updateRenderer</code>.

*** Patch too long, truncated ***




More information about the kaffe mailing list