/[classpath]/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
ViewVC logotype

Diff of /classpath/javax/swing/tree/DefaultTreeSelectionModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by rabbit78, Wed Apr 27 08:31:34 2005 UTC revision 1.13 by langel, Wed Jun 29 13:20:01 2005 UTC
# Line 1  Line 1 
1  /* DefaultTreeSelectionModel.java --  /* DefaultTreeSelectionModel.java --
2     Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.  Copyright (C) 2002, 2004  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 35  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
   
38  package javax.swing.tree;  package javax.swing.tree;
39    
40  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
# Line 54  import javax.swing.event.TreeSelectionLi Line 53  import javax.swing.event.TreeSelectionLi
53    
54  /**  /**
55   * DefaultTreeSelectionModel   * DefaultTreeSelectionModel
56     *
57   * @author Andrew Selkirk   * @author Andrew Selkirk
58   */   */
59  public class DefaultTreeSelectionModel  public class DefaultTreeSelectionModel
60    implements Cloneable, Serializable, TreeSelectionModel                  implements Cloneable, Serializable, TreeSelectionModel
61  {  {
62    static final long serialVersionUID = 3288129636638950196L;          static final long serialVersionUID = 3288129636638950196L;
63    
64    /**          /**
65     * SELECTION_MODE_PROPERTY           * SELECTION_MODE_PROPERTY
66     */           */
67    public static final String SELECTION_MODE_PROPERTY = "selectionMode";          public static final String SELECTION_MODE_PROPERTY = "selectionMode";
68    
69    /**          /**
70     * Our Swing property change support.           * Our Swing property change support.
71     */           */
72    protected SwingPropertyChangeSupport changeSupport;          protected SwingPropertyChangeSupport changeSupport;
73    
74    /**          /**
75     * The current selection.           * The current selection.
76     */           */
77    protected TreePath[] selection;          protected TreePath[] selection;
78    
79    /**          /**
80     * Our TreeSelectionListeners.           * Our TreeSelectionListeners.
81     */           */
82    protected EventListenerList listenerList;          protected EventListenerList listenerList;
83    
84    /**          /**
85     * The current RowMapper.           * The current RowMapper.
86     */           */
87    protected transient RowMapper rowMapper;          protected transient RowMapper rowMapper;
88    
89    /**          /**
90     * The current listSelectionModel.           * The current listSelectionModel.
91     */           */
92    protected DefaultListSelectionModel listSelectionModel;          protected DefaultListSelectionModel listSelectionModel;
93    
94    /**          /**
95     * The current selection mode.           * The current selection mode.
96     */           */
97    protected int selectionMode;          protected int selectionMode;
98    
99    /**          /**
100     * The path that has been added last.           * The path that has been added last.
101     */           */
102    protected TreePath leadPath;          protected TreePath leadPath;
103    
104    /**          /**
105     * The index of the last added path.           * The index of the last added path.
106     */           */
107    protected int leadIndex;          protected int leadIndex;
108    
109    /**          /**
110     * The row of the last added path according to the RowMapper.           * The row of the last added path according to the RowMapper.
111     */           */
112    protected int leadRow;          protected int leadRow;
113    
114    /**          /**
115     * Constructs a new DefaultTreeSelectionModel.           * Constructs a new DefaultTreeSelectionModel.
116     */           */
117    public DefaultTreeSelectionModel()          public DefaultTreeSelectionModel()
118    {          {
119      setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);                  setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
120      listenerList = new EventListenerList();                  listenerList = new EventListenerList();
121    }          }
122    
123    /**          /**
124     * Creates a clone of this DefaultTreeSelectionModel with the same           * Creates a clone of this DefaultTreeSelectionModel with the same
125     * selection.           * selection.
126     *           *
127     * @exception CloneNotSupportedException should not be thrown here           * @exception CloneNotSupportedException should not be thrown here
128     *           *
129     * @return a clone of this DefaultTreeSelectionModel           * @return a clone of this DefaultTreeSelectionModel
130     */           */
131    public Object clone() throws CloneNotSupportedException          public Object clone() throws CloneNotSupportedException
132    {          {
133      return null; // TODO                  return null; // TODO
134    }          }
135    
136    /**          /**
137     * Returns a string that shows this object's properties.           * Returns a string that shows this object's properties.
138     *           *
139     * @return a string that shows this object's properties           * @return a string that shows this object's properties
140     */           */
141    public String toString()          public String toString()
142    {          {
143      return null; // TODO                  return null; // TODO
144    }          }
145    
146    /**          /**
147     * writeObject           * writeObject
148     * @param value0 TODO           *
149     * @exception IOException TODO           * @param value0 TODO
150     */           * @exception IOException TODO
151    private void writeObject(ObjectOutputStream value0) throws IOException           */
152    {          private void writeObject(ObjectOutputStream value0) throws IOException
153      // TODO          {
154    }                  // TODO
155            }
156    /**  
157     * readObject          /**
158     * @param value0 TODO           * readObject
159     * @exception IOException TODO           *
160     * @exception ClassNotFoundException TODO           * @param value0 TODO
161     */           * @exception IOException TODO
162    private void readObject(ObjectInputStream value0)           * @exception ClassNotFoundException TODO
163      throws IOException, ClassNotFoundException           */
164    {          private void readObject(ObjectInputStream value0) throws IOException,
165      // TODO                          ClassNotFoundException
166    }          {
167                    // TODO
168    /**          }
169     * Sets the RowMapper that should be used to map between paths and their  
170     * rows.          /**
171     *           * Sets the RowMapper that should be used to map between paths and their
172     * @param rowMapper the RowMapper to set           * rows.
173     *           *
174     * @see {@link RowMapper           * @param rowMapper the RowMapper to set
175     */           *
176    public void setRowMapper(RowMapper value0)           * @see {@link RowMapper
177    {           */
178      // TODO          public void setRowMapper(RowMapper value0)
179    }          {
180                    // TODO
181    /**          }
182     * Returns the RowMapper that is currently used to map between paths and  
183     * their rows.          /**
184     *           * Returns the RowMapper that is currently used to map between paths and
185     * @return the current RowMapper           * their rows.
186     *           *
187     * @see {@link RowMapper           * @return the current RowMapper
188     */           *
189    public RowMapper getRowMapper()           * @see {@link RowMapper
190    {           */
191      return rowMapper;          public RowMapper getRowMapper()
192    }          {
193                    return rowMapper;
194    /**          }
195     * Sets the current selection mode. Possible values are  
196     * {@link #SINGLE_TREE_SELECTION}, {@link CONTIGUOUS_TREE_SELECTION}          /**
197     * and {@link #DISCONTIGUOUS_TREE_SELECTION}.           * Sets the current selection mode. Possible values are
198     *           * {@link #SINGLE_TREE_SELECTION}, {@link CONTIGUOUS_TREE_SELECTION} and
199     * @param mode the selection mode to be set           * {@link #DISCONTIGUOUS_TREE_SELECTION}.
200     *           *
201     * @see {@link #getSelectionMode}           * @param mode the selection mode to be set
202     * @see {@link #SINGLE_TREE_SELECTION}           *
203     * @see {@link #CONTIGUOUS_TREE_SELECTION}           * @see {@link #getSelectionMode}
204     * @see {@link #DISCONTIGUOUS_TREE_SELECTION}           * @see {@link #SINGLE_TREE_SELECTION}
205     */           * @see {@link #CONTIGUOUS_TREE_SELECTION}
206    public void setSelectionMode(int mode)           * @see {@link #DISCONTIGUOUS_TREE_SELECTION}
207    {           */
208      selectionMode = mode;          public void setSelectionMode(int mode)
209    }          {
210                    selectionMode = mode;
211    /**          }
212     * Returns the current selection mode.  
213     *          /**
214     * @return the current selection mode           * Returns the current selection mode.
215     *           *
216     * @see {@link #setSelectionMode}           * @return the current selection mode
217     * @see {@link #SINGLE_TREE_SELECTION}           *
218     * @see {@link #CONTIGUOUS_TREE_SELECTION}           * @see {@link #setSelectionMode}
219     * @see {@link #DISCONTIGUOUS_TREE_SELECTION}           * @see {@link #SINGLE_TREE_SELECTION}
220     */           * @see {@link #CONTIGUOUS_TREE_SELECTION}
221    public int getSelectionMode()           * @see {@link #DISCONTIGUOUS_TREE_SELECTION}
222    {           */
223      return selectionMode;          public int getSelectionMode()
224    }          {
225                    return selectionMode;
226    /**          }
227     * Sets this path as the only selection.  
228     *          /**
229     * If this changes the selection the registered TreeSelectionListeners           * Sets this path as the only selection.
230     * are notified.           *
231     *           * If this changes the selection the registered TreeSelectionListeners are
232     * @param path the path to set as selection           * notified.
233     */           *
234    public void setSelectionPath(TreePath path)           * @param path the path to set as selection
235    {           */
236      selection = new TreePath[] { path };          public void setSelectionPath(TreePath path)
237    }          {
238                    selection = new TreePath[] { path };
239    /**          }
240     * Sets the paths as selection. This method checks for duplicates and  
241     * removes them.          /**
242     *           * Sets the paths as selection. This method checks for duplicates and
243     * If this changes the selection the registered TreeSelectionListeners           * removes them.
244     * are notified.           *
245     *           * If this changes the selection the registered TreeSelectionListeners are
246     * @param paths the paths to set as selection           * notified.
247     */           *
248    public void setSelectionPaths(TreePath[] value0)           * @param paths the paths to set as selection
249    {           */
250      // TODO          public void setSelectionPaths(TreePath[] value0)
251    }          {
252                    // TODO
253    /**          }
254     * Adds a path to the list of selected paths. This method checks if the  
255     * path is already selected and doesn't add the same path twice.          /**
256     *           * Adds a path to the list of selected paths. This method checks if the path
257     * If this changes the selection the registered TreeSelectionListeners           * is already selected and doesn't add the same path twice.
258     * are notified.           *
259     *           * If this changes the selection the registered TreeSelectionListeners are
260     * @param path the path to add to the selection           * notified.
261     */           *
262    public void addSelectionPath(TreePath value0)           * @param path the path to add to the selection
263    {           */
264      // TODO          public void addSelectionPath(TreePath value0)
265    }          {
266                    if (!isPathSelected(value0))
267    /**                  {
268     * Adds the paths to the list of selected paths. This method checks if the                          if (isSelectionEmpty())
269     * paths are already selected and doesn't add the same path twice.                                  setSelectionPath(value0);
270     *                          else
271     * If this changes the selection the registered TreeSelectionListeners                          {
272     * are notified.                                  TreePath[] temp = new TreePath[selection.length + 1];
273     *                                  System.arraycopy(selection, 0, temp, 0, selection.length);
274     * @param paths the paths to add to the selection                                  temp[temp.length - 1] = value0;
275     */                                  selection = new TreePath[temp.length];
276    public void addSelectionPaths(TreePath[] value0)                                  System.arraycopy(temp, 0, selection, 0, temp.length);
277    {                          }
278      // TODO                  }
279    }          }
280    
281    /**          /**
282     * Removes the path from the selection.           * Adds the paths to the list of selected paths. This method checks if the
283     *           * paths are already selected and doesn't add the same path twice.
284     * If this changes the selection the registered TreeSelectionListeners           *
285     * are notified.           * If this changes the selection the registered TreeSelectionListeners are
286     *           * notified.
287     * @param path the path to remove           *
288     */           * @param paths the paths to add to the selection
289    public void removeSelectionPath(TreePath value0)           */
290    {          public void addSelectionPaths(TreePath[] value0)
291      // TODO          {
292    }                  TreePath v0 = null;
293                    for (int i = 0; i < value0.length; i++)
294    /**                  {
295     * Removes the paths from the selection.                          v0 = value0[i];
296     *                          if (!isPathSelected(v0))
297     * If this changes the selection the registered TreeSelectionListeners                          {
298     * are notified.                                  if (isSelectionEmpty())
299     *                                          setSelectionPath(v0);
300     * @param paths the path to remove                                  else
301     */                                  {
302    public void removeSelectionPaths(TreePath[] value0)                                          TreePath[] temp = new TreePath[selection.length + 1];
303    {                                          System.arraycopy(selection, 0, temp, 0, selection.length);
304      // TODO                                          temp[temp.length - 1] = v0;
305    }                                          selection = new TreePath[temp.length];
306                                            System.arraycopy(temp, 0, selection, 0, temp.length);
307    /**                                  }
308     * Returns the first path in the selection. This is especially useful                          }
309     * when the selectionMode is {@link #SINGLE_TREE_SELECTION}.                  }
310     *          }
311     * @return the first path in the selection  
312     */          /**
313    public TreePath getSelectionPath()           * Removes the path from the selection.
314    {           *
315      if ((selection == null) || (selection.length == 0))           * If this changes the selection the registered TreeSelectionListeners are
316        return null;           * notified.
317      else           *
318        return selection[0];           * @param path the path to remove
319    }           */
320            public void removeSelectionPath(TreePath value0)
321    /**          {
322     * Returns the complete selection.                  int index = -1;
323     *                  if (isPathSelected(value0))
324     * @return the complete selection                  {
325     */                          for (int i = 0; i < selection.length; i++)
326    public TreePath[] getSelectionPaths()                          {
327    {                                  if (selection[i].equals(value0))
328      return selection;                                  {
329    }                                          index = i;
330                                            break;
331    /**                                  }
332     * Returns the number of paths in the selection.                          }
333     *                          TreePath[] temp = new TreePath[selection.length - 1];
334     * @return the number of paths in the selection                          System.arraycopy(selection, 0, temp, 0, index);
335     */                          System.arraycopy(selection, index + 1, temp, index,
336    public int getSelectionCount()                                          selection.length - index - 1);
337    {                          selection = new TreePath[temp.length];
338      if (selection == null)                          System.arraycopy(temp, 0, selection, 0, temp.length);
339        return 0;                  }
340      else          }
341        return selection.length;  
342    }          /**
343             * Removes the paths from the selection.
344    /**           *
345     * Checks if a given path is in the selection.           * If this changes the selection the registered TreeSelectionListeners are
346     *           * notified.
347     * @param path the path to check           *
348     *           * @param paths the path to remove
349     * @return <code>true</code> if the path is in the selection,           */
350     *         <code>false</code> otherwise          public void removeSelectionPaths(TreePath[] value0)
351     */          {
352    public boolean isPathSelected(TreePath value0)                  int index = -1;
353    {                  TreePath v0 = null;
354      return false; // TODO                  for (int i = 0; i < value0.length; i++)
355    }                  {
356                            v0 = value0[i];
357    /**                          if (isPathSelected(v0))
358     * Checks if the selection is empty.                          {
359     *                                  for (int x = 0; x < selection.length; x++)
360     * @return <code>true</code> if the selection is empty,                                  {
361     *         <code>false</code> otherwise                                          if (selection[i].equals(v0))
362     */                                          {
363    public boolean isSelectionEmpty()                                                  index = x;
364    {                                                  break;
365      return ((selection == null) || (selection.length == 0));                                          }
366    }                                  }
367                                    TreePath[] temp = new TreePath[selection.length - 1];
368    /**                                  System.arraycopy(selection, 0, temp, 0, index);
369     * Removes all paths from the selection.                                  System.arraycopy(selection, index + 1, temp, index,
370     */                                                  selection.length - index - 1);
371    public void clearSelection()                                  selection = new TreePath[temp.length];
372    {                                  System.arraycopy(temp, 0, selection, 0, temp.length);
373      // TODO                          }
374    }                  }
375            }
376    /**  
377     * Adds a <code>TreeSelectionListener</code> object to this model.          /**
378     *           * Returns the first path in the selection. This is especially useful when
379     * @param listener the listener to add           * the selectionMode is {@link #SINGLE_TREE_SELECTION}.
380     */           *
381    public void addTreeSelectionListener(TreeSelectionListener listener)           * @return the first path in the selection
382    {           */
383      listenerList.add(TreeSelectionListener.class, listener);          public TreePath getSelectionPath()
384    }          {
385                    if ((selection == null) || (selection.length == 0))
386    /**                          return null;
387     * Removes a <code>TreeSelectionListener</code> object from this model.                  else
388     *                          return selection[0];
389     * @param listener the listener to remove          }
390     */  
391    public void removeTreeSelectionListener(TreeSelectionListener listener)          /**
392    {           * Returns the complete selection.
393      listenerList.remove(TreeSelectionListener.class, listener);           *
394    }           * @return the complete selection
395             */
396    /**          public TreePath[] getSelectionPaths()
397     * Returns all <code>TreeSelectionListener</code> added to this model.          {
398     *                  return selection;
399     * @return an array of listeners          }
400     *  
401     * @since 1.4          /**
402     */           * Returns the number of paths in the selection.
403    public TreeSelectionListener[] getTreeSelectionListeners()           *
404    {           * @return the number of paths in the selection
405      return (TreeSelectionListener[]) listenerList.getListeners(TreeSelectionListener.class);           */
406    }          public int getSelectionCount()
407            {
408    /**                  if (selection == null)
409     * fireValueChanged                          return 0;
410     *                  else
411     * @param event the event to fire.                          return selection.length;
412     */          }
413    protected void fireValueChanged(TreeSelectionEvent event)  
414    {          /**
415      TreeSelectionListener[] listeners = getTreeSelectionListeners();           * Checks if a given path is in the selection.
416             *
417      for (int i = listeners.length - 1; i >= 0; --i)           * @param path the path to check
418        listeners[i].valueChanged(event);           *
419    }           * @return <code>true</code> if the path is in the selection,
420             *         <code>false</code> otherwise
421    /**           */
422     * Returns all added listeners of a special type.          public boolean isPathSelected(TreePath value0)
423     *          {
424     * @param listenerType the listener type                  for (int i = 0; i < selection.length; i++)
425     *                  {
426     * @return an array of listeners                          if (selection[i].equals(value0))
427     *                                  return true;
428     * @since 1.3                  }
429     */                  return false;
430    public EventListener[] getListeners(Class listenerType)          }
431    {  
432      return listenerList.getListeners(listenerType);          /**
433    }           * Checks if the selection is empty.
434             *
435    /**           * @return <code>true</code> if the selection is empty, <code>false</code>
436     * Returns the currently selected rows.           *         otherwise
437     *           */
438     * @return the currently selected rows          public boolean isSelectionEmpty()
439     */          {
440    public int[] getSelectionRows()                  return ((selection == null) || (selection.length == 0));
441    {          }
442      if (rowMapper == null)  
443        return null;          /**
444      else           * Removes all paths from the selection.
445        return rowMapper.getRowsForPaths(selection);           */
446    }          public void clearSelection()
447            {
448    /**                  selection = null;
449     * Returns the smallest row index from the selection.          }
450     *  
451     * @return the smallest row index from the selection          /**
452     */           * Adds a <code>TreeSelectionListener</code> object to this model.
453    public int getMinSelectionRow()           *
454    {           * @param listener the listener to add
455      if ((rowMapper == null) || (selection == null) || (selection.length == 0))           */
456        return -1;          public void addTreeSelectionListener(TreeSelectionListener listener)
457      else {          {
458        int[] rows = rowMapper.getRowsForPaths(selection);                  listenerList.add(TreeSelectionListener.class, listener);
459        int minRow = Integer.MAX_VALUE;          }
460        for (int index = 0; index < rows.length; index++)  
461          minRow = Math.min(minRow, rows[index]);          /**
462        return minRow;           * Removes a <code>TreeSelectionListener</code> object from this model.
463      }           *
464    }           * @param listener the listener to remove
465             */
466    /**          public void removeTreeSelectionListener(TreeSelectionListener listener)
467     * Returns the largest row index from the selection.          {
468     *                  listenerList.remove(TreeSelectionListener.class, listener);
469     * @return the largest row index from the selection          }
470     */  
471    public int getMaxSelectionRow()          /**
472    {           * Returns all <code>TreeSelectionListener</code> added to this model.
473      if ((rowMapper == null) || (selection == null) || (selection.length == 0))           *
474        return -1;           * @return an array of listeners
475      else {           *
476        int[] rows = rowMapper.getRowsForPaths(selection);           * @since 1.4
477        int maxRow = -1;           */
478        for (int index = 0; index < rows.length; index++)          public TreeSelectionListener[] getTreeSelectionListeners()
479          maxRow = Math.max(maxRow, rows[index]);          {
480        return maxRow;                  return (TreeSelectionListener[]) listenerList
481      }                                  .getListeners(TreeSelectionListener.class);
482    }          }
483    
484    /**          /**
485     * Checks if a particular row is selected.           * fireValueChanged
486     *           *
487     * @param row the index of the row to check           * @param event the event to fire.
488     *           */
489     * @return <code>true</code> if the row is in this selection,          protected void fireValueChanged(TreeSelectionEvent event)
490     *         <code>false</code> otherwise          {
491     */                  TreeSelectionListener[] listeners = getTreeSelectionListeners();
492    public boolean isRowSelected(int value0)  
493    {                  for (int i = listeners.length - 1; i >= 0; --i)
494      return false; // TODO                          listeners[i].valueChanged(event);
495    }          }
496    
497    /**          /**
498     * Updates the mappings from TreePaths to row indices.           * Returns all added listeners of a special type.
499     */           *
500    public void resetRowSelection()           * @param listenerType the listener type
501    {           *
502      // TODO           * @return an array of listeners
503    }           *
504             * @since 1.3
505    /**           */
506     * getLeadSelectionRow          public EventListener[] getListeners(Class listenerType)
507     * @return int          {
508     */                  return listenerList.getListeners(listenerType);
509    public int getLeadSelectionRow()          }
510    {  
511      if ((rowMapper == null) || (leadPath == null))          /**
512        return -1;           * Returns the currently selected rows.
513      else           *
514        return rowMapper.getRowsForPaths(new TreePath[]{ leadPath })[0];           * @return the currently selected rows
515    }           */
516            public int[] getSelectionRows()
517    /**          {
518     * getLeadSelectionPath                  if (rowMapper == null)
519     * @return TreePath                          return null;
520     */                  else
521    public TreePath getLeadSelectionPath()                          return rowMapper.getRowsForPaths(selection);
522    {          }
523      return leadPath;  
524    }          /**
525             * Returns the smallest row index from the selection.
526    /**           *
527     * Adds a <code>PropertyChangeListener</code> object to this model.           * @return the smallest row index from the selection
528     *           */
529     * @param listener the listener to add.          public int getMinSelectionRow()
530     */          {
531    public void addPropertyChangeListener(PropertyChangeListener listener)                  if ((rowMapper == null) || (selection == null)
532    {                                  || (selection.length == 0))
533      changeSupport.addPropertyChangeListener(listener);                          return -1;
534    }                  else
535                    {
536    /**                          int[] rows = rowMapper.getRowsForPaths(selection);
537     * Removes a <code>PropertyChangeListener</code> object from this model.                          int minRow = Integer.MAX_VALUE;
538     *                          for (int index = 0; index < rows.length; index++)
539     * @param listener the listener to remove.                                  minRow = Math.min(minRow, rows[index]);
540     */                          return minRow;
541    public void removePropertyChangeListener(PropertyChangeListener listener)                  }
542    {          }
543      changeSupport.removePropertyChangeListener(listener);  
544    }          /**
545             * Returns the largest row index from the selection.
546    /**           *
547     * Returns all added <code>PropertyChangeListener</code> objects.           * @return the largest row index from the selection
548     *           */
549     * @return an array of listeners.          public int getMaxSelectionRow()
550     *          {
551     * @since 1.4                  if ((rowMapper == null) || (selection == null)
552     */                                  || (selection.length == 0))
553    public PropertyChangeListener[] getPropertyChangeListeners()                          return -1;
554    {                  else
555      return changeSupport.getPropertyChangeListeners();                  {
556    }                          int[] rows = rowMapper.getRowsForPaths(selection);
557                            int maxRow = -1;
558    /**                          for (int index = 0; index < rows.length; index++)
559     * Makes sure the currently selected paths are valid according to the                                  maxRow = Math.max(maxRow, rows[index]);
560     * current selectionMode.                          return maxRow;
561     *                  }
562     * If the selectionMode is set to {@link CONTIGUOUS_TREE_SELECTION}          }
563     * and the selection isn't contiguous then the selection is reset to  
564     * the first set of contguous paths.          /**
565     *           * Checks if a particular row is selected.
566     * If the selectionMode is set to {@link SINGLE_TREE_SELECTION}           *
567     * and the selection has more than one path, the selection is reset to           * @param row the index of the row to check
568     * the contain only the first path.           *
569     */           * @return <code>true</code> if the row is in this selection,
570    protected void insureRowContinuity()           *         <code>false</code> otherwise
571    {           */
572      // TODO          public boolean isRowSelected(int value0)
573    }          {
574                    return false; // TODO
575    /**          }
576     * Returns <code>true</code> if the paths are contiguous or we  
577     * have no RowMapper assigned.          /**
578     *           * Updates the mappings from TreePaths to row indices.
579     * @param paths the paths to check for continuity           */
580     * @return <code>true</code> if the paths are contiguous or we          public void resetRowSelection()
581     *         have no RowMapper assigned          {
582     */                  // TODO
583    protected boolean arePathsContiguous(TreePath[] value0)          }
584    {  
585      return false; // TODO          /**
586    }           * getLeadSelectionRow
587             *
588    /**           * @return int
589     * Checks if the paths can be added. This returns <code>true</code> if:           */
590     * <ul>          public int getLeadSelectionRow()
591     * <li><code>paths</code> is <code>null</code> or empty</li>          {
592     * <li>we have no RowMapper assigned</li>                  if ((rowMapper == null) || (leadPath == null))
593     * <li>nothing is currently selected</li>                          return -1;
594     * <li>selectionMode is {@link DISCONTIGUOUS_TREE_SELECTION</li>                  else
595     * <li>adding the paths to the selection still results in a contiguous set                          return rowMapper.getRowsForPaths(new TreePath[] { leadPath })[0];
596     *   of paths</li>          }
597     *  
598     * @param paths the paths to check          /**
599     *           * getLeadSelectionPath
600     * @return <code>true</code> if the paths can be added with respect to the           *
601     *         selectionMode           * @return TreePath
602     */           */
603    protected boolean canPathsBeAdded(TreePath[] value0)          public TreePath getLeadSelectionPath()
604    {          {
605      return false; // TODO                  return leadPath;
606    }          }
607    
608    /**          /**
609     * Checks if the paths can be removed without breaking the continuity of           * Adds a <code>PropertyChangeListener</code> object to this model.
610     * the selection according to selectionMode.           *
611     *           * @param listener the listener to add.
612     * @param paths the paths to check           */
613     * @return  <code>true</code> if the paths can be removed with respect to the          public void addPropertyChangeListener(PropertyChangeListener listener)
614     *         selectionMode          {
615     */                  changeSupport.addPropertyChangeListener(listener);
616    protected boolean canPathsBeRemoved(TreePath[] value0)          }
617    {  
618      return false; // TODO          /**
619    }           * Removes a <code>PropertyChangeListener</code> object from this model.
620             *
621    /**           * @param listener the listener to remove.
622     * notifyPathChange           */
623     * @param value0 TODO          public void removePropertyChangeListener(PropertyChangeListener listener)
624     * @param value1 TODO          {
625     */                  changeSupport.removePropertyChangeListener(listener);
626    protected void notifyPathChange(Vector value0, TreePath value1)          }
627    {  
628      // TODO          /**
629    }           * Returns all added <code>PropertyChangeListener</code> objects.
630             *
631    /**           * @return an array of listeners.
632     * Updates the lead index instance field.           *
633     */           * @since 1.4
634    protected void updateLeadIndex()           */
635    {          public PropertyChangeListener[] getPropertyChangeListeners()
636      // TODO          {
637    }                  return changeSupport.getPropertyChangeListeners();
638            }
639    /**  
640     * Deprecated and not used.          /**
641     */           * Makes sure the currently selected paths are valid according to the
642    protected void insureUniqueness()           * current selectionMode.
643    {           *
644      // TODO           * If the selectionMode is set to {@link CONTIGUOUS_TREE_SELECTION} and the
645    }           * selection isn't contiguous then the selection is reset to the first set
646             * of contguous paths.
647             *
648             * If the selectionMode is set to {@link SINGLE_TREE_SELECTION} and the
649             * selection has more than one path, the selection is reset to the contain
650             * only the first path.
651             */
652            protected void insureRowContinuity()
653            {
654                    // TODO
655            }
656    
657            /**
658             * Returns <code>true</code> if the paths are contiguous or we have no
659             * RowMapper assigned.
660             *
661             * @param paths the paths to check for continuity
662             * @return <code>true</code> if the paths are contiguous or we have no
663             *         RowMapper assigned
664             */
665            protected boolean arePathsContiguous(TreePath[] value0)
666            {
667                    return false; // TODO
668            }
669    
670            /**
671             * Checks if the paths can be added. This returns <code>true</code> if:
672             * <ul>
673             * <li><code>paths</code> is <code>null</code> or empty</li>
674             * <li>we have no RowMapper assigned</li>
675             * <li>nothing is currently selected</li>
676             * <li>selectionMode is {@link DISCONTIGUOUS_TREE_SELECTION</li>
677             * <li>adding the paths to the selection still results in a contiguous set
678             * of paths</li>
679             *
680             * @param paths the paths to check
681             *
682             * @return <code>true</code> if the paths can be added with respect to the
683             *         selectionMode
684             */
685            protected boolean canPathsBeAdded(TreePath[] value0)
686            {
687                    return false; // TODO
688            }
689    
690            /**
691             * Checks if the paths can be removed without breaking the continuity of the
692             * selection according to selectionMode.
693             *
694             * @param paths the paths to check
695             * @return <code>true</code> if the paths can be removed with respect to
696             *         the selectionMode
697             */
698            protected boolean canPathsBeRemoved(TreePath[] value0)
699            {
700                    return false; // TODO
701            }
702    
703            /**
704             * notifyPathChange
705             *
706             * @param value0 TODO
707             * @param value1 TODO
708             */
709            protected void notifyPathChange(Vector value0, TreePath value1)
710            {
711                    // TODO
712            }
713    
714            /**
715             * Updates the lead index instance field.
716             */
717            protected void updateLeadIndex()
718            {
719                    // TODO
720            }
721    
722            /**
723             * Deprecated and not used.
724             */
725            protected void insureUniqueness()
726            {
727                    // TODO
728            }
729  }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26