Source for javax.swing.tree.AbstractLayoutCache

   1: /* AbstractLayoutCache.java --
   2:    Copyright (C) 2002, 2004  Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.swing.tree;
  40: 
  41: import java.awt.Rectangle;
  42: import java.util.Enumeration;
  43: 
  44: import javax.swing.event.TreeModelEvent;
  45: 
  46: /**
  47:  * class AbstractLayoutCache
  48:  * 
  49:  * @author Andrew Selkirk
  50:  */
  51: public abstract class AbstractLayoutCache
  52:         implements RowMapper
  53: {
  54:     /**
  55:      * class NodeDimensions
  56:      */
  57:     public abstract static class NodeDimensions
  58:     {
  59:         /**
  60:          * Creates <code>NodeDimensions</code> object.
  61:          */
  62:         public NodeDimensions()
  63:         {
  64:             // Do nothing here.
  65:         }
  66: 
  67:         /**
  68:          * getNodeDimensions
  69:          * 
  70:          * @param value0 TODO
  71:          * @param value1 TODO
  72:          * @param value2 TODO
  73:          * @param value3 TODO
  74:          * @param value4 TODO
  75:          * @return Rectangle
  76:          */
  77:         public abstract Rectangle getNodeDimensions(Object value0, int value1,
  78:                 int value2, boolean value3, Rectangle value4);
  79:     }
  80: 
  81:     /**
  82:      * nodeDimensions
  83:      */
  84:     protected NodeDimensions nodeDimensions;
  85: 
  86:     /**
  87:      * treeModel
  88:      */
  89:     protected TreeModel treeModel;
  90: 
  91:     /**
  92:      * treeSelectionModel
  93:      */
  94:     protected TreeSelectionModel treeSelectionModel;
  95: 
  96:     /**
  97:      * rootVisible
  98:      */
  99:     protected boolean rootVisible;
 100: 
 101:     /**
 102:      * rowHeight
 103:      */
 104:     protected int rowHeight;
 105: 
 106:     /**
 107:      * Constructor AbstractLayoutCache
 108:      */
 109:     public AbstractLayoutCache()
 110:     {
 111:         // Do nothing here.
 112:     }
 113: 
 114:     /**
 115:      * setNodeDimensions
 116:      * 
 117:      * @param dimensions TODO
 118:      */
 119:     public void setNodeDimensions(NodeDimensions dimensions)
 120:     {
 121:         nodeDimensions = dimensions;
 122:     }
 123: 
 124:     /**
 125:      * getNodeDimensions
 126:      * 
 127:      * @return NodeDimensions
 128:      */
 129:     public NodeDimensions getNodeDimensions()
 130:     {
 131:         return nodeDimensions;
 132:     }
 133: 
 134:     /**
 135:      * getNodeDimensions
 136:      * 
 137:      * @param value TODO
 138:      * @param row TODO
 139:      * @param depth TODO
 140:      * @param expanded TODO
 141:      * @param bounds TODO
 142:      * 
 143:      * @return Rectangle
 144:      */
 145:     protected Rectangle getNodeDimensions(Object value, int row, int depth,
 146:             boolean expanded, Rectangle bounds)
 147:     {
 148:         if (bounds == null)
 149:             return new Rectangle();
 150:         return null;
 151:         // TODO        
 152:     }
 153: 
 154:     /**
 155:      * Sets the model that provides the tree data.
 156:      * 
 157:      * @param model the model
 158:      */
 159:     public void setModel(TreeModel model)
 160:     {
 161:         treeModel = model;
 162:     }
 163: 
 164:     /**
 165:      * Returns the model that provides the tree data.
 166:      * 
 167:      * @return the model
 168:      */
 169:     public TreeModel getModel()
 170:     {
 171:         return treeModel;
 172:     }
 173: 
 174:     /**
 175:      * setRootVisible
 176:      * 
 177:      * @param visible <code>true</code> if root should be visible,
 178:      * <code>false</code> otherwise
 179:      */
 180:     public void setRootVisible(boolean visible)
 181:     {
 182:         rootVisible = visible;
 183:     }
 184: 
 185:     /**
 186:      * isRootVisible
 187:      * 
 188:      * @return <code>true</code> if root is visible,
 189:      * <code>false</code> otherwise
 190:      */
 191:     public boolean isRootVisible()
 192:     {
 193:         return rootVisible;
 194:     }
 195: 
 196:     /**
 197:      * setRowHeight
 198:      * 
 199:      * @param height the row height
 200:      */
 201:     public void setRowHeight(int height)
 202:     {
 203:         rowHeight = height;
 204:     }
 205: 
 206:     /**
 207:      * getRowHeight
 208:      * 
 209:      * @return the row height
 210:      */
 211:     public int getRowHeight()
 212:     {
 213:         return rowHeight;
 214:     }
 215: 
 216:     /**
 217:      * setSelectionModel
 218:      * 
 219:      * @param model the model
 220:      */
 221:     public void setSelectionModel(TreeSelectionModel model)
 222:     {
 223:         treeSelectionModel = model;
 224:     }
 225: 
 226:     /**
 227:      * getSelectionModel
 228:      * 
 229:      * @return the model
 230:      */
 231:     public TreeSelectionModel getSelectionModel()
 232:     {
 233:         return treeSelectionModel;
 234:     }
 235: 
 236:     /**
 237:      * getPreferredHeight
 238:      * 
 239:      * @return int
 240:      */
 241:     public int getPreferredHeight()
 242:     {
 243:         return 0; // TODO
 244:     }
 245: 
 246:     /**
 247:      * getPreferredWidth
 248:      * 
 249:      * @param value0 TODO
 250:      * 
 251:      * @return int
 252:      */
 253:     public int getPreferredWidth(Rectangle value0)
 254:     {
 255:         return 0; // TODO
 256:     }
 257: 
 258:     /**
 259:      * isExpanded
 260:      * 
 261:      * @param value0 TODO
 262:      * 
 263:      * @return boolean
 264:      */
 265:     public abstract boolean isExpanded(TreePath value0);
 266: 
 267:     /**
 268:      * getBounds
 269:      * 
 270:      * @param value0 TODO
 271:      * @param value1 TODO
 272:      * 
 273:      * @return Rectangle
 274:      */
 275:     public abstract Rectangle getBounds(TreePath value0, Rectangle value1);
 276: 
 277:     /**
 278:      * getPathForRow
 279:      * 
 280:      * @param row the row
 281:      * 
 282:      * @return the tree path
 283:      */
 284:     public abstract TreePath getPathForRow(int row);
 285: 
 286:     /**
 287:      * getRowForPath
 288:      * 
 289:      * @param path the tree path
 290:      * 
 291:      * @return the row
 292:      */
 293:     public abstract int getRowForPath(TreePath path);
 294: 
 295:     /**
 296:      * getPathClosestTo
 297:      * 
 298:      * @param value0 TODO
 299:      * @param value1 TODO
 300:      * 
 301:      * @return the tree path
 302:      */
 303:     public abstract TreePath getPathClosestTo(int value0, int value1);
 304: 
 305:     /**
 306:      * getVisiblePathsFrom
 307:      * 
 308:      * @param path the tree path
 309:      * 
 310:      * @return Enumeration
 311:      */
 312:     public abstract Enumeration getVisiblePathsFrom(TreePath path);
 313: 
 314:     /**
 315:      * getVisibleChildCount
 316:      * 
 317:      * @param path the tree path
 318:      * 
 319:      * @return int
 320:      */
 321:     public abstract int getVisibleChildCount(TreePath path);
 322: 
 323:     /**
 324:      * setExpandedState
 325:      * 
 326:      * @param value0 TODO
 327:      * 
 328:      * @param value1 TODO
 329:      */
 330:     public abstract void setExpandedState(TreePath value0, boolean value1);
 331: 
 332:     /**
 333:      * getExpandedState
 334:      * 
 335:      * @param path the tree path
 336:      * 
 337:      * @return boolean
 338:      */
 339:     public abstract boolean getExpandedState(TreePath path);
 340: 
 341:     /**
 342:      * getRowCount
 343:      * 
 344:      * @return the number of rows
 345:      */
 346:     public abstract int getRowCount();
 347: 
 348:     /**
 349:      * invalidateSizes
 350:      */
 351:     public abstract void invalidateSizes();
 352: 
 353:     /**
 354:      * invalidatePathBounds
 355:      * 
 356:      * @param path the tree path
 357:      */
 358:     public abstract void invalidatePathBounds(TreePath path);
 359: 
 360:     /**
 361:      * treeNodesChanged
 362:      * 
 363:      * @param event the event to send
 364:      */
 365:     public abstract void treeNodesChanged(TreeModelEvent event);
 366: 
 367:     /**
 368:      * treeNodesInserted
 369:      * 
 370:      * @param event the event to send
 371:      */
 372:     public abstract void treeNodesInserted(TreeModelEvent event);
 373: 
 374:     /**
 375:      * treeNodesRemoved
 376:      * 
 377:      * @param event the event to send
 378:      */
 379:     public abstract void treeNodesRemoved(TreeModelEvent event);
 380: 
 381:     /**
 382:      * treeStructureChanged
 383:      * 
 384:      * @param event the event to send
 385:      */
 386:     public abstract void treeStructureChanged(TreeModelEvent event);
 387: 
 388:     /**
 389:      * getRowsForPaths
 390:      * 
 391:      * @param paths the tree paths
 392:      * 
 393:      * @return an array of rows
 394:      */
 395:     public int[] getRowsForPaths(TreePath[] paths)
 396:     {
 397:         return null; // TODO
 398:     }
 399: 
 400:     /**
 401:      * isFixedRowHeight
 402:      * 
 403:      * @return boolean
 404:      */
 405:     protected boolean isFixedRowHeight()
 406:     {
 407:         return false; // TODO
 408:     }
 409: }