jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.swing.tree;
  27 
  28 import javax.swing.event.TreeModelEvent;
  29 import java.awt.Dimension;
  30 import java.awt.Rectangle;

  31 import java.util.Enumeration;
  32 
  33 /**
  34  * <strong>Warning:</strong>
  35  * Serialized objects of this class will not be compatible with
  36  * future Swing releases. The current serialization support is
  37  * appropriate for short term storage or RMI between applications running
  38  * the same version of Swing.  As of 1.4, support for long term storage
  39  * of all JavaBeans&trade;
  40  * has been added to the <code>java.beans</code> package.
  41  * Please see {@link java.beans.XMLEncoder}.
  42  *
  43  * @author Scott Violet
  44  */
  45 @SuppressWarnings("serial") // Same-version serialization only
  46 public abstract class AbstractLayoutCache implements RowMapper {
  47     /** Object responsible for getting the size of a node. */
  48     protected NodeDimensions     nodeDimensions;
  49 
  50     /** Model providing information. */


  95      */
  96     public void setModel(TreeModel newModel) {
  97         treeModel = newModel;
  98     }
  99 
 100     /**
 101      * Returns the <code>TreeModel</code> that is providing the data.
 102      *
 103      * @return the <code>TreeModel</code> that is providing the data
 104      */
 105     public TreeModel getModel() {
 106         return treeModel;
 107     }
 108 
 109     /**
 110      * Determines whether or not the root node from
 111      * the <code>TreeModel</code> is visible.
 112      *
 113      * @param rootVisible true if the root node of the tree is to be displayed
 114      * @see #rootVisible
 115      * @beaninfo
 116      *        bound: true
 117      *  description: Whether or not the root node
 118      *               from the TreeModel is visible.
 119      */


 120     public void setRootVisible(boolean rootVisible) {
 121         this.rootVisible = rootVisible;
 122     }
 123 
 124     /**
 125      * Returns true if the root node of the tree is displayed.
 126      *
 127      * @return true if the root node of the tree is displayed
 128      * @see #rootVisible
 129      */
 130     public boolean isRootVisible() {
 131         return rootVisible;
 132     }
 133 
 134     /**
 135      * Sets the height of each cell.  If the specified value
 136      * is less than or equal to zero the current cell renderer is
 137      * queried for each row's height.
 138      *
 139      * @param rowHeight the height of each cell, in pixels
 140      * @beaninfo
 141      *        bound: true
 142      *  description: The height of each cell.
 143      */


 144     public void setRowHeight(int rowHeight) {
 145         this.rowHeight = rowHeight;
 146     }
 147 
 148     /**
 149      * Returns the height of each row.  If the returned value is less than
 150      * or equal to 0 the height for each row is determined by the
 151      * renderer.
 152      *
 153      * @return the height of each row
 154      */
 155     public int getRowHeight() {
 156         return rowHeight;
 157     }
 158 
 159     /**
 160      * Sets the <code>TreeSelectionModel</code> used to manage the
 161      * selection to new LSM.
 162      *
 163      * @param newLSM  the new <code>TreeSelectionModel</code>




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */

  25 package javax.swing.tree;
  26 
  27 import javax.swing.event.TreeModelEvent;

  28 import java.awt.Rectangle;
  29 import java.beans.BeanProperty;
  30 import java.util.Enumeration;
  31 
  32 /**
  33  * <strong>Warning:</strong>
  34  * Serialized objects of this class will not be compatible with
  35  * future Swing releases. The current serialization support is
  36  * appropriate for short term storage or RMI between applications running
  37  * the same version of Swing.  As of 1.4, support for long term storage
  38  * of all JavaBeans&trade;
  39  * has been added to the <code>java.beans</code> package.
  40  * Please see {@link java.beans.XMLEncoder}.
  41  *
  42  * @author Scott Violet
  43  */
  44 @SuppressWarnings("serial") // Same-version serialization only
  45 public abstract class AbstractLayoutCache implements RowMapper {
  46     /** Object responsible for getting the size of a node. */
  47     protected NodeDimensions     nodeDimensions;
  48 
  49     /** Model providing information. */


  94      */
  95     public void setModel(TreeModel newModel) {
  96         treeModel = newModel;
  97     }
  98 
  99     /**
 100      * Returns the <code>TreeModel</code> that is providing the data.
 101      *
 102      * @return the <code>TreeModel</code> that is providing the data
 103      */
 104     public TreeModel getModel() {
 105         return treeModel;
 106     }
 107 
 108     /**
 109      * Determines whether or not the root node from
 110      * the <code>TreeModel</code> is visible.
 111      *
 112      * @param rootVisible true if the root node of the tree is to be displayed
 113      * @see #rootVisible




 114      */
 115     @BeanProperty(description
 116             = "Whether or not the root node from the TreeModel is visible.")
 117     public void setRootVisible(boolean rootVisible) {
 118         this.rootVisible = rootVisible;
 119     }
 120 
 121     /**
 122      * Returns true if the root node of the tree is displayed.
 123      *
 124      * @return true if the root node of the tree is displayed
 125      * @see #rootVisible
 126      */
 127     public boolean isRootVisible() {
 128         return rootVisible;
 129     }
 130 
 131     /**
 132      * Sets the height of each cell.  If the specified value
 133      * is less than or equal to zero the current cell renderer is
 134      * queried for each row's height.
 135      *
 136      * @param rowHeight the height of each cell, in pixels



 137      */
 138     @BeanProperty(description
 139             = "The height of each cell.")
 140     public void setRowHeight(int rowHeight) {
 141         this.rowHeight = rowHeight;
 142     }
 143 
 144     /**
 145      * Returns the height of each row.  If the returned value is less than
 146      * or equal to 0 the height for each row is determined by the
 147      * renderer.
 148      *
 149      * @return the height of each row
 150      */
 151     public int getRowHeight() {
 152         return rowHeight;
 153     }
 154 
 155     /**
 156      * Sets the <code>TreeSelectionModel</code> used to manage the
 157      * selection to new LSM.
 158      *
 159      * @param newLSM  the new <code>TreeSelectionModel</code>