/[classpath]/classpath/javax/swing/JTree.java
ViewVC logotype

Diff of /classpath/javax/swing/JTree.java

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

revision 1.39 by langel, Tue Sep 13 20:46:02 2005 UTC revision 1.40 by langel, Fri Sep 16 20:11:17 2005 UTC
# Line 59  import javax.accessibility.AccessibleCom Line 59  import javax.accessibility.AccessibleCom
59  import javax.accessibility.AccessibleContext;  import javax.accessibility.AccessibleContext;
60  import javax.accessibility.AccessibleRole;  import javax.accessibility.AccessibleRole;
61  import javax.accessibility.AccessibleSelection;  import javax.accessibility.AccessibleSelection;
62    import javax.accessibility.AccessibleState;
63  import javax.accessibility.AccessibleStateSet;  import javax.accessibility.AccessibleStateSet;
64  import javax.accessibility.AccessibleText;  import javax.accessibility.AccessibleText;
65  import javax.accessibility.AccessibleValue;  import javax.accessibility.AccessibleValue;
# Line 110  public class JTree Line 111  public class JTree
111        private JTree tree;        private JTree tree;
112        private TreePath tp;        private TreePath tp;
113        private Accessible acc;        private Accessible acc;
114          private AccessibleStateSet states = new AccessibleStateSet();
115                
116        /**        /**
117         * Constructs an AccessibleJTreeNode         * Constructs an AccessibleJTreeNode
118           *
119           * @param t - the current tree
120           * @param p - the current path to be dealt with
121           * @param ap - the accessible object to use
122         */         */
123        public AccessibleJTreeNode(JTree t, TreePath p, Accessible ap)        public AccessibleJTreeNode(JTree t, TreePath p, Accessible ap)
124        {        {
# Line 124  public class JTree Line 130  public class JTree
130        /**        /**
131         * Adds the specified selected item in the object to the object's         * Adds the specified selected item in the object to the object's
132         * selection.         * selection.
133           *
134           * @param i - the i-th element in the TreePath to add to the selection
135         */         */
136        public void addAccessibleSelection(int i)        public void addAccessibleSelection(int i)
137        {        {
138            // FIXME: not implemented properly.
139        }        }
140                
141        /**        /**
142         * Adds the specified focus listener to receive focus events         * Adds the specified focus listener to receive focus events
143         * from this component.         * from this component.
144           *
145           * @param l - the new focus listener
146         */         */
147        public void addFocusListener(FocusListener l)        public void addFocusListener(FocusListener l)
148        {        {
149          AccessibleJTree.this.addFocusListener(l);          tree.addFocusListener(l);
150        }        }
151                
152        /**        /**
153         * Add a PropertyChangeListener to the listener list.         * Add a PropertyChangeListener to the listener list.
154           *
155           * @param l - the new property change listener
156         */         */
157        public void addPropertyChangeListener(PropertyChangeListener l)        public void addPropertyChangeListener(PropertyChangeListener l)
158        {        {
159          AccessibleJTree.this.addPropertyChangeListener(l);          // Nothing to do here.
160        }        }
161                
162        /**        /**
# Line 152  public class JTree Line 165  public class JTree
165         */         */
166        public void clearAccessibleSelection()        public void clearAccessibleSelection()
167        {        {
168            // Nothing to do here.
169        }        }
170                
171        /**        /**
172         * Checks whether the specified point is within this object's         * Checks whether the specified point is within this object's
173         * bounds, where the point's x and y coordinates are defined to be         * bounds, where the point's x and y coordinates are defined to be
174         * relative to the coordinate system of the object.         * relative to the coordinate system of the object.
175           *
176           * @param p - the point to check
177           * @return true if p is in the bounds
178         */         */
179        public boolean contains(Point p)        public boolean contains(Point p)
180        {        {
181          return false;          return getBounds().contains(p);
182        }        }
183                
184        /**        /**
185         * Perform the specified Action on the tree node.         * Perform the specified Action on the tree node.
186           *
187           * @param i - the i-th action to perform
188           * @return true if the the action was performed; else false.
189         */         */
190        public boolean doAccessibleAction(int i)        public boolean doAccessibleAction(int i)
191        {        {
192            // FIXME: Not implemented fully.
193          return false;          return false;
194        }        }
195                
196        /**        /**
197         * Get the AccessibleAction associated with this object.         * Get the AccessibleAction associated with this object.
198           *
199           * @return the action
200         */         */
201        public AccessibleAction getAccessibleAction()        public AccessibleAction getAccessibleAction()
202        {        {
203            // FIXME: Not implemented fully.
204          return super.getAccessibleAction();          return super.getAccessibleAction();
205        }        }
206                
207        /**        /**
208         * Returns the number of accessible actions available in this tree node.         * Returns the number of accessible actions available in this tree node.
209           *
210           * @return the number of actions
211         */         */
212        public int getAccessibleActionCount()        public int getAccessibleActionCount()
213        {        {
214            // FIXME: Not implemented fully.
215          return 0;          return 0;
216        }        }
217                
218        /**        /**
219         * Return a description of the specified action of the tree node.         * Return a description of the specified action of the tree node.
220           *
221           * @param i - the i-th action's description
222           * @return a description of the action
223         */         */
224        public String getAccessibleActionDescription(int i)        public String getAccessibleActionDescription(int i)
225        {        {
226          return null;          return super.getAccessibleDescription();
227        }        }
228                
229        /**        /**
230         * Returns the Accessible child, if one exists, contained at the         * Returns the Accessible child, if one exists, contained at the
231         * local coordinate Point.         * local coordinate Point.
232           *
233           * @param p - the point of the accessible
234           * @return the accessible at point p if it exists
235         */         */
236        public Accessible getAccessibleAt(Point p)        public Accessible getAccessibleAt(Point p)
237        {        {
238            TreePath acc = tree.getClosestPathForLocation(p.x, p.y);
239            if (acc != null)
240              return new AccessibleJTreeNode(tree, acc, this);
241          return null;          return null;
242        }        }
243                
244        /**        /**
245         * Return the specified Accessible child of the object.         * Return the specified Accessible child of the object.
246           *
247           * @param i - the i-th child of the current path
248           * @return the child if it exists
249         */         */
250        public Accessible getAccessibleChild(int i)        public Accessible getAccessibleChild(int i)
251        {        {
252          return AccessibleJTree.this.getAccessibleChild(i);          TreeModel mod = tree.getModel();
253            if (mod != null)
254              {
255                Object child = mod.getChild(tp.getLastPathComponent(), i);
256                if (child != null)
257                  return new AccessibleJTreeNode(tree, tp.pathByAddingChild(child),
258                                                 acc);
259              }
260            return null;
261        }        }
262                
263        /**        /**
264         * Returns the number of accessible children in the object.         * Returns the number of accessible children in the object.
265           *
266           * @return the number of children the current node has
267         */         */
268        public int getAccessibleChildrenCount()        public int getAccessibleChildrenCount()
269        {        {
270          return AccessibleJTree.this.getAccessibleChildrenCount();          TreeModel mod = getModel();
271            if (mod != null)
272              return mod.getChildCount(tp.getLastPathComponent());
273            return 0;
274        }        }
275                
276        /**        /**
277         * Get the AccessibleComponent associated with this object.         * Get the AccessibleComponent associated with this object.
278           *
279           * @return the accessible component if it is supported.
280         */         */
281        public AccessibleComponent getAccessibleComponent()        public AccessibleComponent getAccessibleComponent()
282        {        {
# Line 231  public class JTree Line 285  public class JTree
285                
286        /**        /**
287         * Get the AccessibleContext associated with this tree node.         * Get the AccessibleContext associated with this tree node.
288           *
289           * @return an instance of this class
290         */         */
291        public AccessibleContext getAccessibleContext()        public AccessibleContext getAccessibleContext()
292        {        {
293          return acc.getAccessibleContext();          return this;
294        }        }
295                
296        /**        /**
297         * Get the accessible description of this object.         * Get the accessible description of this object.
298           *
299           * @return the accessible description
300         */         */
301        public String getAccessibleDescription()        public String getAccessibleDescription()
302        {        {
303          return AccessibleJTree.this.getAccessibleDescription();          return super.getAccessibleDescription();
304        }        }
305                
306        /**        /**
307         * Get the index of this object in its accessible parent.         * Get the index of this object in its accessible parent.
308           *
309           * @return the index of this in the parent.
310         */         */
311        public int getAccessibleIndexInParent()        public int getAccessibleIndexInParent()
312        {        {
313          return 0;          AccessibleContext parent = getAccessibleParent().getAccessibleContext();
314            if (parent != null)
315              for (int i = 0; i < parent.getAccessibleChildrenCount(); i++)
316                {
317                  if ((parent.getAccessibleChild(i)).equals(this))
318                    return i;
319                }
320            return -1;
321        }        }
322                
323        /**        /**
324         * Get the accessible name of this object.         * Get the accessible name of this object.
325           *
326           * @return the accessible name
327         */         */
328        public String getAccessibleName()        public String getAccessibleName()
329        {        {
330          return AccessibleJTree.this.getAccessibleName();          return super.getAccessibleName();
331        }        }
332                
333        /**        /**
334         * Get the Accessible parent of this object.         * Get the Accessible parent of this object.
335           *
336           * @return the accessible parent if it exists.
337         */         */
338        public Accessible getAccessibleParent()        public Accessible getAccessibleParent()
339        {        {
# Line 271  public class JTree Line 342  public class JTree
342                
343        /**        /**
344         * Get the role of this object.         * Get the role of this object.
345           *
346           * @return the accessible role
347         */         */
348        public AccessibleRole getAccessibleRole()        public AccessibleRole getAccessibleRole()
349        {        {
# Line 279  public class JTree Line 352  public class JTree
352                
353        /**        /**
354         * Get the AccessibleSelection associated with this object if one exists.         * Get the AccessibleSelection associated with this object if one exists.
355           *
356           * @return the accessible selection for this.
357         */         */
358        public AccessibleSelection getAccessibleSelection()        public AccessibleSelection getAccessibleSelection()
359        {        {
360            // FIXME: Not implemented fully.
361          return super.getAccessibleSelection();          return super.getAccessibleSelection();
362        }        }
363                
364        /**        /**
365         * Returns an Accessible representing the specified selected item         * Returns an Accessible representing the specified selected item
366         * in the object.         * in the object.
367           *
368           * @return the accessible representing a certain selected item.
369         */         */
370        public Accessible getAccessibleSelection(int i)        public Accessible getAccessibleSelection(int i)
371        {        {
372          return null;          // FIXME: Not implemented properly.
373            return new AccessibleJTreeNode(tree, tree.
374                                           getSelectionModel().
375                                           getSelectionPaths()[i], acc);
376        }        }
377                
378        /**        /**
379         * Returns the number of items currently selected.         * Returns the number of items currently selected.
380           *
381           * @return the number of items selected.
382         */         */
383        public int getAccessibleSelectionCount()        public int getAccessibleSelectionCount()
384        {        {
385          return 0;          return AccessibleJTree.this.getAccessibleSelectionCount();
386        }        }
387                
388        /**        /**
389         * Get the state set of this object.         * Get the state set of this object.
390           *
391           * @return the state set for this object
392         */         */
393        public AccessibleStateSet getAccessibleStateSet()        public AccessibleStateSet getAccessibleStateSet()
394        {        {
395          return AccessibleJTree.this.getAccessibleStateSet();          TreeModel mod = tree.getModel();
396            if (isVisible())
397              states.add(AccessibleState.VISIBLE);
398            if (tree.isCollapsed(tp))
399              states.add(AccessibleState.COLLAPSED);
400            if (tree.isEditable())
401              states.add(AccessibleState.EDITABLE);
402            if (mod != null &&
403                !mod.isLeaf(tp.getLastPathComponent()))
404              states.add(AccessibleState.EXPANDABLE);
405            if (tree.isExpanded(tp))
406              states.add(AccessibleState.EXPANDED);
407            if (isFocusable())
408              states.add(AccessibleState.FOCUSABLE);
409            if (hasFocus())
410              states.add(AccessibleState.FOCUSED);
411            if (tree.getSelectionModel().getSelectionMode() !=
412              TreeSelectionModel.SINGLE_TREE_SELECTION)
413              states.add(AccessibleState.MULTISELECTABLE);
414            if (tree.isOpaque())
415              states.add(AccessibleState.OPAQUE);
416            if (tree.isPathSelected(tp))
417              states.add(AccessibleState.SELECTED);
418            if (isShowing())
419              states.add(AccessibleState.SHOWING);
420    
421            states.add(AccessibleState.SELECTABLE);
422            return states;
423        }        }
424                
425        /**        /**
426         * Get the AccessibleText associated with this object if one exists.         * Get the AccessibleText associated with this object if one exists.
427           *
428           * @return the accessible text
429         */         */
430        public AccessibleText getAccessibleText()        public AccessibleText getAccessibleText()
431        {        {
# Line 320  public class JTree Line 434  public class JTree
434                
435        /**        /**
436         * Get the AccessibleValue associated with this object if one exists.         * Get the AccessibleValue associated with this object if one exists.
437           *
438           * @return the accessible value if it exists
439         */         */
440        public AccessibleValue getAccessibleValue()        public AccessibleValue getAccessibleValue()
441        {        {
# Line 328  public class JTree Line 444  public class JTree
444                
445        /**        /**
446         * Get the background color of this object.         * Get the background color of this object.
447           *
448           * @return the color of the background.
449         */         */
450        public Color getBackground()        public Color getBackground()
451        {        {
452          return null;          return tree.getBackground();
453        }        }
454                
455        /**        /**
456         * Gets the bounds of this object in the form of a Rectangle object.         * Gets the bounds of this object in the form of a Rectangle object.
457           *
458           * @return the bounds of the current node.
459         */         */
460        public Rectangle getBounds()        public Rectangle getBounds()
461        {        {
462          return null;          return tree.getPathBounds(tp);
463        }        }
464                
465        /**        /**
466         * Gets the Cursor of this object.         * Gets the Cursor of this object.
467           *
468           * @return the cursor for the current node
469         */         */
470        public Cursor getCursor()        public Cursor getCursor()
471        {        {
472            // FIXME: Not implemented fully.
473          return null;          return null;
474        }        }
475                
476        /**        /**
477         * Gets the Font of this object.         * Gets the Font of this object.
478           *
479           * @return the font for the current node
480         */         */
481        public Font getFont()        public Font getFont()
482        {        {
483          return null;          return tree.getFont();
484        }        }
485                
486        /**        /**
487         * Gets the FontMetrics of this object.         * Gets the FontMetrics of this object.
488           *
489           * @param f - the current font.
490           * @return the font metrics for the given font.
491         */         */
492        public FontMetrics getFontMetrics(Font f)        public FontMetrics getFontMetrics(Font f)
493        {        {
494          return null;          return tree.getFontMetrics(f);
495        }        }
496                
497        /**        /**
498         * Get the foreground color of this object.         * Get the foreground color of this object.
499           *
500           * @return the foreground for this object.
501         */         */
502        public Color getForeground()        public Color getForeground()
503        {        {
504          return null;          return tree.getForeground();
505        }        }
506                
507        /**        /**
508         * Gets the locale of the component.         * Gets the locale of the component.
509           *
510           * @return the locale of the component.
511         */         */
512        public Locale getLocale()        public Locale getLocale()
513        {        {
514          return null;          return tree.getLocale();
515        }        }
516                
517        /**        /**
518         * Gets the location of the object relative to the         * Gets the location of the object relative to the
519         * parent in the form of a point specifying the object's         * parent in the form of a point specifying the object's
520         * top-left corner in the screen's coordinate space.         * top-left corner in the screen's coordinate space.
521           *
522           * @return the location of the current node.
523         */         */
524        public Point getLocation()        public Point getLocation()
525        {        {
526          return null;          return getLocationInJTree();
527        }        }
528                
529        /**        /**
530         * Returns the location in the tree.         * Returns the location in the tree.
531           *
532           * @return the location in the JTree.
533         */         */
534        protected  Point getLocationInJTree()        protected Point getLocationInJTree()
535        {        {
536          return null;          Rectangle bounds = tree.getPathBounds(tp);
537            return new Point(bounds.x, bounds.y);
538        }        }
539                
540        /**        /**
541         * Returns the location of the object on the screen.         * Returns the location of the object on the screen.
542           *
543           * @return the location of the object on the screen.
544         */         */
545        public Point getLocationOnScreen()        public Point getLocationOnScreen()
546        {        {
547          return null;          Point loc = getLocation();
548            SwingUtilities.convertPointToScreen(loc, tree);
549            return loc;
550        }        }
551                
552        /**        /**
553         * Returns the size of this object in the form of a Dimension object.         * Returns the size of this object in the form of a Dimension object.
554           *
555           * @return the size of the object
556         */         */
557        public Dimension getSize()        public Dimension getSize()
558        {        {
559          return null;          Rectangle b = getBounds();
560            return b.getSize();
561        }        }
562                
563        /**        /**
564         * Returns true if the current child of this object is selected.         * Returns true if the current child of this object is selected.
565           *
566           * @param i - the child of the current node
567           * @return true if the child is selected.
568         */         */
569        public boolean isAccessibleChildSelected(int i)        public boolean isAccessibleChildSelected(int i)
570        {        {
571          return false;          TreeModel mod = tree.getModel();
572            Object child = mod.getChild(tp.getLastPathComponent(), i);
573            return tree.isPathSelected(tp.pathByAddingChild(child));
574        }        }
575                
576        /**        /**
577         * Determines if the object is enabled.         * Determines if the object is enabled.
578           *
579           * @return true if the tree is enabled
580         */         */
581        public boolean isEnabled()        public boolean isEnabled()
582        {        {
583          return false;          return tree.isEnabled();
584        }        }
585                
586        /**        /**
587         * Returns whether this object can accept focus or not.         * Returns whether this object can accept focus or not.
588           *
589           * @return true, it is always focus traversable
590         */         */
591        public boolean isFocusTraversable()        public boolean isFocusTraversable()
592        {        {
593          return false;          return true;
594        }        }
595                
596        /**        /**
597         * Determines if the object is showing.         * Determines if the object is showing.
598           *
599           * @return true if the object is visible and the
600           * parent is visible.
601         */         */
602        public boolean isShowing()        public boolean isShowing()
603        {        {
604          return false;          return isVisible() && tree.isShowing();
605        }        }
606                
607        /**        /**
608         * Determines if the object is visible.         * Determines if the object is visible.
609           *
610           * @return true if the object is visible.
611         */         */
612        public boolean isVisible()        public boolean isVisible()
613        {        {
614          return false;          return tree.isVisible(tp);
615        }        }
616                
617        /**        /**
618         * Removes the specified selected item in the object from the         * Removes the specified selected item in the object from the
619         * object's selection.         * object's selection.
620           *
621           * @param i - the specified item to remove
622         */         */
623        public void removeAccessibleSelection(int i)        public void removeAccessibleSelection(int i)
624        {        {
625            // FIXME: Not implemented properly.
626            TreePath[] elements = tree.getSelectionPaths();
627            Object[] newElements = new Object[i];
628            for (int j = 0; j < i; j++)
629              newElements[j] = elements[j];
630            tree.removeSelectionPath(new TreePath(newElements));
631        }        }
632                
633        /**        /**
634         * Removes the specified focus listener so it no longer receives focus         * Removes the specified focus listener so it no longer receives focus
635         * events from this component.         * events from this component.
636           *
637           * @param l - the focus listener to remove
638         */         */
639        public void removeFocusListener(FocusListener l)        public void removeFocusListener(FocusListener l)
640        {        {
641          AccessibleJTree.this.removeFocusListener(l);          tree.removeFocusListener(l);
642        }        }
643                
644        /**        /**
645         * Remove a PropertyChangeListener from the listener list.         * Remove a PropertyChangeListener from the listener list.
646           *
647           * @param l - the property change listener to remove.
648         */         */
649        public void removePropertyChangeListener(PropertyChangeListener l)        public void removePropertyChangeListener(PropertyChangeListener l)
650        {        {
651          AccessibleJTree.this.removePropertyChangeListener(l);          // Nothing to do here.
652        }        }
653                
654        /**        /**
# Line 486  public class JTree Line 656  public class JTree
656         */         */
657        public void requestFocus()        public void requestFocus()
658        {        {
659            tree.requestFocus();
660        }        }
661                
662        /**        /**
# Line 494  public class JTree Line 665  public class JTree
665         */         */
666        public void selectAllAccessibleSelection()        public void selectAllAccessibleSelection()
667        {        {
668            // FIXME: Not implemented fully.
669        }        }
670                
671        /**        /**
672         * Set the accessible description of this object.         * Set the accessible description of this object.
673           *
674           * @param s - the string to set the accessible description to.
675         */         */
676        public void setAccessibleDescription(String s)        public void setAccessibleDescription(String s)
677        {        {
678            super.setAccessibleDescription(s);
679        }        }
680                
681        /**        /**
682         * Set the localized accessible name of this object.         * Set the localized accessible name of this object.
683           *
684           * @param s - the string to set the accessible name to.
685         */         */
686        public void setAccessibleName(String s)        public void setAccessibleName(String s)
687        {        {
688            super.setAccessibleName(s);
689        }        }
690                
691        /**        /**
692         * Set the background color of this object.         * Set the background color of this object.
693           *
694           * @param c - the color to set the background to.
695         */         */
696        public void setBackground(Color c)        public void setBackground(Color c)
697        {        {
698            // Nothing to do here.
699        }        }
700                
701        /**        /**
702         * Sets the bounds of this object in the form of a Rectangle object.         * Sets the bounds of this object in the form of a Rectangle object.
703           *
704           * @param r - the bounds to set the object o
705         */         */
706        public void setBounds(Rectangle r)        public void setBounds(Rectangle r)
707        {        {
708            // Nothing to do here.
709        }        }
710                
711        /**        /**
712         * Sets the Cursor of this object.         * Sets the Cursor of this object.
713           *
714           * @param c - the new cursor
715         */         */
716        public void setCursor(Cursor c)        public void setCursor(Cursor c)
717        {        {
718            // FIXME: Not implemented fully.
719        }        }
720                
721        /**        /**
722         * Sets the enabled state of the object.         * Sets the enabled state of the object.
723           *
724           * @param b - boolean to enable or disable object
725         */         */
726        public void setEnabled(boolean b)        public void setEnabled(boolean b)
727        {        {
728             // Nothing to do here.
729        }        }
730                
731        /**        /**
732         * Sets the Font of this object.         * Sets the Font of this object.
733           *
734           * @param f - the new font.
735         */         */
736        public void setFont(Font f)        public void setFont(Font f)
737        {        {
738             // Nothing to do here.
739        }        }
740                
741        /**        /**
742         * Sets the foreground color of this object.         * Sets the foreground color of this object.
743           *
744           * @param c - the new foreground color.
745         */         */
746        public void setForeground(Color c)        public void setForeground(Color c)
747        {        {
748            // Nothing to do here.
749        }        }
750                
751        /**        /**
752         * Sets the location of the object relative to the parent.         * Sets the location of the object relative to the parent.
753           *
754           * @param p - the new location for the object.
755         */         */
756        public void setLocation(Point p)        public void setLocation(Point p)
757        {        {
758            // Nothing to do here.
759        }        }
760                
761        /**        /**
762         * Resizes this object so that it has width and height.         * Resizes this object so that it has width and height.
763           *
764           * @param d - the new size for the object.
765         */         */
766        public void setSize(Dimension d)        public void setSize(Dimension d)
767        {        {
768            // Nothing to do here.
769        }        }
770                
771        /**        /**
772         * Sets the visible state of the object.         * Sets the visible state of the object.
773           *
774           * @param b - sets the objects visibility.
775         */         */
776        public void setVisible(boolean b)        public void setVisible(boolean b)
777        {        {
778            // Nothing to do here.
779        }        }
780      }      }
781            
782        /**
783         * Constructor
784         */
785      public AccessibleJTree()      public AccessibleJTree()
786      {      {
787          // FIXME: Not implemented fully.
788      }      }
789            
790      /**      /**
791       * Adds the specified selected item in the object to the object's selection.       * Adds the specified selected item in the object to the object's selection.
792         *
793         * @param i - the row to add to the tree's selection
794       */       */
795      public void addAccessibleSelection(int i)      public void addAccessibleSelection(int i)
796      {      {
797          addSelectionInterval(i, i);
798      }      }
799            
800      /**      /**
# Line 590  public class JTree Line 802  public class JTree
802       */       */
803      public void clearAccessibleSelection()      public void clearAccessibleSelection()
804      {      {
805          clearSelection();
806      }      }
807            
808      /**      /**
# Line 597  public class JTree Line 810  public class JTree
810       */       */
811      public void fireVisibleDataPropertyChange()      public void fireVisibleDataPropertyChange()
812      {      {
813          treeDidChange();
814      }      }
815            
816      /**      /**
817       * Returns the Accessible child, if one exists, contained at the local       * Returns the Accessible child, if one exists, contained at the local
818       * coordinate Point.       * coordinate Point.
819         *
820         * @param p - the point of the accessible to get.
821         * @return the accessible at point p.
822       */       */
823      public Accessible getAccessibleAt(Point p)      public Accessible getAccessibleAt(Point p)
824      {      {
825          // FIXME: Not implemented fully.
826        return null;        return null;
827      }      }
828            
829      /**      /**
830       * Return the nth Accessible child of the object.       * Return the nth Accessible child of the object.
831         *
832         * @param i - the accessible child to get
833         * @return the i-th child
834       */       */
835      public Accessible getAccessibleChild(int i)      public Accessible getAccessibleChild(int i)
836      {      {
837        return super.getAccessibleChild(i);        return null;
838      }      }
839            
840      /**      /**
841       * Returns the number of top-level children nodes of this JTree.       * Returns the number of top-level children nodes of this JTree.
842         *
843         * @return the number of top-level children
844       */       */
845      public int getAccessibleChildrenCount()      public int getAccessibleChildrenCount()
846      {      {
847        return super.getAccessibleChildrenCount();        TreeModel model = getModel();
848          if (model != null)
849            return model.getChildCount(model.getRoot());
850          return 0;
851      }      }
852            
853      /**      /**
854       * Get the index of this object in its accessible parent.       * Get the index of this object in its accessible parent.
855         *
856         * @return the index of this object.
857       */       */
858      public int getAccessibleIndexInParent()      public int getAccessibleIndexInParent()
859      {      {
# Line 634  public class JTree Line 862  public class JTree
862            
863      /**      /**
864       * Get the role of this object.       * Get the role of this object.
865         *
866         * @return the role of this object
867       */       */
868      public AccessibleRole getAccessibleRole()      public AccessibleRole getAccessibleRole()
869      {      {
# Line 642  public class JTree Line 872  public class JTree
872            
873      /**      /**
874       * Get the AccessibleSelection associated with this object.       * Get the AccessibleSelection associated with this object.
875         *
876         * @param the accessible selection of the tree
877       */       */
878      public AccessibleSelection getAccessibleSelection()      public AccessibleSelection getAccessibleSelection()
879      {      {
880          // FIXME: Not implemented fully.
881        return null;        return null;
882      }      }
883            
884      /**      /**
885       * Returns an Accessible representing the specified selected item in the object.       * Returns an Accessible representing the specified selected item in the object.
886         *
887         * @return the i-th accessible in the selection
888       */       */
889      public Accessible getAccessibleSelection(int i)      public Accessible getAccessibleSelection(int i)
890      {      {
891          // FIXME: Not implemented fully.
892        return null;        return null;
893      }      }
894            
895      /**      /**
896       * Returns the number of items currently selected.       * Returns the number of items currently selected.
897         *
898         * @param the number of selected accessibles.
899       */       */
900      public int getAccessibleSelectionCount()      public int getAccessibleSelectionCount()
901      {      {
902        return 0;        return getSelectionCount();
903      }      }
904            
905      /**      /**
906       * Returns true if the current child of this object is selected.       * Returns true if the current child of this object is selected.
907         *
908         * @param i - the child of this object
909         * @return true if the i-th child is selected.
910       */       */
911      public boolean isAccessibleChildSelected(int i)      public boolean isAccessibleChildSelected(int i)
912      {      {
913          // Nothing to do here.
914        return false;        return false;
915      }      }
916            
917      /**      /**
918       * Removes the specified selected item in the object from the object's       * Removes the specified selected item in the object from the object's
919       * selection.       * selection.
920         *
921         * @param i - the i-th selected item to remove
922       */       */
923      public void removeAccessibleSelection(int i)      public void removeAccessibleSelection(int i)
924      {      {
925          removeSelectionInterval(i, i);
926      }      }
927            
928      /**      /**
# Line 686  public class JTree Line 931  public class JTree
931       */       */
932      public void selectAllAccessibleSelection()      public void selectAllAccessibleSelection()
933      {      {
934          if (getSelectionModel().getSelectionMode() !=
935            TreeSelectionModel.SINGLE_TREE_SELECTION)
936          addSelectionInterval(0, getVisibleRowCount());
937      }      }
938            
939      /**      /**
940       * Tree Collapsed notification       * Tree Collapsed notification
941         *
942         * @param e - the event
943       */       */
944      public void treeCollapsed(TreeExpansionEvent e)      public void treeCollapsed(TreeExpansionEvent e)
945      {      {
946          fireTreeCollapsed(e.getPath());
947      }      }
948        
949      /**      /**
950       * Tree Model Expansion notification.       * Tree Model Expansion notification.
951         *
952         * @param e - the event
953       */       */
954      public void treeExpanded(TreeExpansionEvent e)      public void treeExpanded(TreeExpansionEvent e)
955      {      {
956          fireTreeExpanded(e.getPath());
957      }      }
958            
959      /**      /**
960       * Tree Model Node change notification.       * Tree Model Node change notification.
961         *
962         * @param e - the event
963       */       */
964      public void treeNodesChanged(TreeModelEvent e)      public void treeNodesChanged(TreeModelEvent e)
965      {      {
966          // Nothing to do here.
967      }      }
968            
969      /**      /**
970       * Tree Model Node change notification.       * Tree Model Node change notification.
971         *
972         * @param e - the event
973       */       */
974      public void treeNodesInserted(TreeModelEvent e)      public void treeNodesInserted(TreeModelEvent e)
975      {      {
976          // Nothing to do here.
977      }      }
978            
979      /**      /**
980       * Tree Model Node change notification.       * Tree Model Node change notification.
981         *
982         * @param e - the event
983       */       */
984      public void treeNodesRemoved(TreeModelEvent e)      public void treeNodesRemoved(TreeModelEvent e)
985      {      {
986          // Nothing to do here.
987      }      }
988            
989      /**      /**
990       * Tree Model structure change change notification.       * Tree Model structure change change notification.
991         *
992         * @param e - the event
993       */       */
994      public void treeStructureChanged(TreeModelEvent e)      public void treeStructureChanged(TreeModelEvent e)
995      {      {
996          // Nothing to do here.
997      }      }
998            
999      /**      /**
1000       * Tree Selection Listener value change method.       * Tree Selection Listener value change method.
1001         *
1002         * @param e - the event
1003       */       */
1004      public void valueChanged(TreeSelectionEvent e)      public void valueChanged(TreeSelectionEvent e)
1005      {      {
1006          fireValueChanged(e);
1007      }      }
1008    }    }
1009        
# Line 2297  public class JTree Line 2566  public class JTree
2566    /**    /**
2567     * Creates and returns an instance of {@link TreeModelHandler}.     * Creates and returns an instance of {@link TreeModelHandler}.
2568     *     *
2569     * @returns an instance of {@link TreeModelHandler}     * @return an instance of {@link TreeModelHandler}
2570     */     */
2571    protected TreeModelListener createTreeModelListener()    protected TreeModelListener createTreeModelListener()
2572    {    {

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

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