User: ko5tik  
  Date: 02/04/04 09:13:39

  Modified:    src/java/xdocletgui/swing ClassFamily.java
                        TreeFactoryScratch.java
                        XDocletGuiTreeCellRenderer.java
  Added:       src/java/xdocletgui/swing TagNodeData.java
  Log:
  Now the tree shows everything down to the tags.
  Tooltips are also working
  
  Revision  Changes    Path
  1.3       +1 -1      xdocletgui/src/java/xdocletgui/swing/ClassFamily.java
  
  Index: ClassFamily.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/ClassFamily.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- ClassFamily.java  4 Apr 2002 14:12:27 -0000       1.2
  +++ ClassFamily.java  4 Apr 2002 17:13:39 -0000       1.3
  @@ -36,7 +36,7 @@
   package xdocletgui.swing;
   
   /**
  - * Describe what this class does
  + * Data holder for class family node in the tree
    *
    * @author kostik
    * @created April 3, 2002
  
  
  
  1.5       +42 -10    xdocletgui/src/java/xdocletgui/swing/TreeFactoryScratch.java
  
  Index: TreeFactoryScratch.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/TreeFactoryScratch.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- TreeFactoryScratch.java   4 Apr 2002 14:12:27 -0000       1.4
  +++ TreeFactoryScratch.java   4 Apr 2002 17:13:39 -0000       1.5
  @@ -90,6 +90,43 @@
   
   
        /**
  +      * create tag nodes for given program element. Tags have to belong to given
  +      * family
  +      *
  +      * @param node node to be processed
  +      * @param element program element to look for tags
  +      * @param tagFamilies Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      */
  +     private static void addTags(DefaultMutableTreeNode node, TagFamilies 
tagFamilies, XProgramElement element) {
  +             XDoc doc = element.doc();
  +             // walk through tag families
  +             for (int j = 0; j < tagFamilies.size(); j++) {
  +                     TagFamily tagFamily = tagFamilies.get(j);
  +
  +                     if (tagFamily.supports(element)) {
  +                             DefaultMutableTreeNode tfn = new 
DefaultMutableTreeNode(tagFamily);
  +                             node.add(tfn);
  +                             // walk through tag family tags
  +                             for (int i = 0; i < tagFamily.size(); i++) {
  +                                     Tag tag = tagFamily.getTag(i);
  +                                     if (tag.supports(element)) {
  +                                             // big question, whether we shall also 
look in superclasses.
  +                                             // say yes for now...
  +                                             XTag[] xtags = doc.tags(tag.getName(), 
true);
  +
  +                                             for (int t = 0; t < xtags.length; t++) 
{
  +                                                     DefaultMutableTreeNode tagNode 
= new DefaultMutableTreeNode(new TagNodeData(tag, xtags[t]));
  +                                                     tfn.add(tagNode);
  +                                             }
  +                                     }
  +                             }
  +                     }
  +             }
  +     }
  +
  +
  +     /**
         * Describe the method
         *
         * @param className Describe the method parameter
  @@ -117,22 +154,17 @@
                        if (classes[i].isA(className)) {
                                DefaultMutableTreeNode clazz = new 
DefaultMutableTreeNode(classes[i]);
                                classType.add(clazz);
  -
  -                             // add applicable tag families to class node
  -                             for (int j = 0; j < tagFamilies.size(); j++) {
  -                                     TagFamily tf = tagFamilies.get(j);
  -                                     if (tf.supports(classes[i])) {
  -                                             // add this tag family to the tree list
  -                                             DefaultMutableTreeNode tagF = new 
DefaultMutableTreeNode(tf);
  -                                             clazz.add(tagF);
  -                                     }
  -                             }
  +                             // add applicable tags
  +                             addTags(clazz, tagFamilies, classes[i]);
                                XMethod[] methods = classes[i].methods();
                                for (int m = 0; m < methods.length; m++) {
                                        DefaultMutableTreeNode method = new 
DefaultMutableTreeNode(methods[m]);
                                        clazz.add(method);
  +                                     addTags(method, tagFamilies, methods[m]);
  +
                                }
                        }
                }
        }
  +
   }
  
  
  
  1.3       +4 -4      
xdocletgui/src/java/xdocletgui/swing/XDocletGuiTreeCellRenderer.java
  
  Index: XDocletGuiTreeCellRenderer.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/XDocletGuiTreeCellRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- XDocletGuiTreeCellRenderer.java   4 Apr 2002 14:12:27 -0000       1.2
  +++ XDocletGuiTreeCellRenderer.java   4 Apr 2002 17:13:39 -0000       1.3
  @@ -115,7 +115,7 @@
                xtagFamilyIcon = new ImageIcon(myUrl);
   
                myUrl = 
XDocletGuiTreeCellRenderer.class.getResource("images/XTagIcon.gif");
  -             rootIcon = new ImageIcon(myUrl);
  +             xtagIcon = new ImageIcon(myUrl);
   
        }
   
  @@ -163,20 +163,20 @@
                }
                else if (isClassNode(value)) {
                        setIcon(classIcon);
  -                     _log.debug("tooltip text: " + 
((XProgramElement)((DefaultMutableTreeNode)value).getUserObject()).doc().firstSentence()
 + " program element: " + 
(XProgramElement)((DefaultMutableTreeNode)value).getUserObject());
                        
setToolTipText(((XProgramElement)((DefaultMutableTreeNode)value).getUserObject()).doc().firstSentence());
                }
                else if (isMethodNode(value)) {
                        setIcon(methodIcon);
  -                     _log.debug("tooltip text: " + 
((XProgramElement)((DefaultMutableTreeNode)value).getUserObject()).doc().firstSentence()
 + " program element: " + 
(XProgramElement)((DefaultMutableTreeNode)value).getUserObject());
                        
setToolTipText(((XProgramElement)((DefaultMutableTreeNode)value).getUserObject()).doc().firstSentence());
                }
   
                else if (isTagFamilyNode(value)) {
                        setIcon(xtagFamilyIcon);
  +                     
setToolTipText(((TagFamily)((DefaultMutableTreeNode)value).getUserObject()).getUsage());
                }
                else if (isTagNode(value)) {
                        setIcon(xtagIcon);
  +                     
setToolTipText(((TagNodeData)((DefaultMutableTreeNode)value).getUserObject()).getTag().getUsage());
                }
                else {
                        setToolTipText(null);
  @@ -261,7 +261,7 @@
         */
        boolean isTagNode(Object value) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
  -             return node.getUserObject() instanceof Tag;
  +             return node.getUserObject() instanceof TagNodeData;
        }
   
   }
  
  
  
  1.1                  xdocletgui/src/java/xdocletgui/swing/TagNodeData.java
  
  Index: TagNodeData.java
  ===================================================================
  /*
   * Copyright (c) 2001, Aslak Hellesøy, BEKK Consulting
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
   *
   * - Redistributions of source code must retain the above copyright notice,
   *   this list of conditions and the following disclaimer.
   *
   * - Redistributions in binary form must reproduce the above copyright
   *   notice, this list of conditions and the following disclaimer in the
   *   documentation and/or other materials provided with the distribution.
   *
   * - Neither the name of BEKK Consulting nor the names of its
   *   contributors may be used to endorse or promote products derived from
   *   this software without specific prior written permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
   * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
   * DAMAGE.
   */
  
  /*
   * Change log
   *
   */
  package xdocletgui.swing;
  
  import xjavadoc.XTag;
  import xtags.Tag;
  /**
   * Describe what this class does
   *
   * @author kostik
   * @created April 4, 2002
   * @todo-javadoc Write javadocs
   */
  public class TagNodeData {
  
        /**
         * @todo-javadoc Describe the field
         */
        Tag _tag;
        /**
         * @todo-javadoc Describe the field
         */
        XTag _xtag;
  
  
        /**
         * Describe what the TagNodeData constructor does
         *
         * @param tag Describe what the parameter does
         * @param xtag Describe what the parameter does
         * @todo-javadoc Write javadocs for constructor
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
        public TagNodeData(Tag tag, XTag xtag) {
                _tag = tag;
                _xtag = xtag;
        }
  
  
        /**
         * Gets the Tag attribute of the TagNodeData object
         *
         * @return The Tag value
         */
        public Tag getTag() {
                return _tag;
        }
  
  
        /**
         * Gets the XTag attribute of the TagNodeData object
         *
         * @return The XTag value
         */
        public XTag getXTag() {
                return _xtag;
        }
  
  
        /**
         * Describe what the method does
         *
         * @return Describe the return value
         * @todo-javadoc Write javadocs for return value
         * @todo-javadoc Write javadocs for method
         */
        public String toString() {
                return getTag().toString();
        }
  }
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to