You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2004/12/24 15:13:17 UTC

cvs commit: incubator-myfaces/src/components/org/apache/myfaces/custom/tree HtmlTree.java

svieujot    2004/12/24 06:13:16

  Modified:    src/components/org/apache/myfaces/custom/tree/renderkit/html
                        HtmlTreeRenderer.java
               src/components/org/apache/myfaces/custom/tree HtmlTree.java
  Added:       src/components/org/apache/myfaces/custom/tree/resource/images
                        node_close_first.gif node_open_first.gif
                        node_open_last.gif node_close_last.gif
                        line_first.gif node_open.gif folder.gif
                        line_middle.gif node_close.gif line_last.gif
                        noline.gif node_close_middle.gif line.gif
                        folder.png node_open_middle.gif
  Removed:     webapps/examples/web/images/tree node_open.gif
                        node_open_middle.gif line_middle.gif
                        node_close_first.gif line_first.gif
                        node_open_first.gif node_close_middle.gif
                        folder.png node_open_last.gif folder.gif noline.gif
                        node_close.gif line.gif node_close_last.gif
                        line_last.gif
  Log:
  Upgrade the tree component to use the Extensions filter.
  
  Revision  Changes    Path
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_close_first.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_open_first.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_open_last.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_close_last.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/line_first.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_open.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/folder.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/line_middle.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_close.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/line_last.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/noline.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_close_middle.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/line.gif
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/folder.png
  
  	<<Binary file>>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/tree/resource/images/node_open_middle.gif
  
  	<<Binary file>>
  
  
  1.14      +7 -2      incubator-myfaces/src/components/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeRenderer.java
  
  Index: HtmlTreeRenderer.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeRenderer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HtmlTreeRenderer.java	22 Dec 2004 17:52:54 -0000	1.13
  +++ HtmlTreeRenderer.java	24 Dec 2004 14:13:16 -0000	1.14
  @@ -43,6 +43,9 @@
    * @version $Revision$ $Date$
    *
    *          $Log$
  + *          Revision 1.14  2004/12/24 14:13:16  svieujot
  + *          Upgrade the tree component to use the Extensions filter.
  + *
    *          Revision 1.13  2004/12/22 17:52:54  grantsmith
    *          Jira MYFACES-48: Tree Table Component Fixes & Tree Checkbox Support
    *
  @@ -58,6 +61,8 @@
   {
   
       private static final Integer ZERO = new Integer(0);
  +    
  +    private static final String DEFAULT_IMAGE_ICON_FOLDER = "images/folder.gif";
   
       public boolean getRendersChildren()
       {
  @@ -438,7 +443,7 @@
               if (!child.isLeaf(facesContext))
               {
                   // todo: icon provider
  -                url = "images/tree/folder.gif";
  +                url = HtmlTree.getDefaultImagePath( DEFAULT_IMAGE_ICON_FOLDER );
               }
               else
               {
  
  
  
  1.28      +89 -27    incubator-myfaces/src/components/org/apache/myfaces/custom/tree/HtmlTree.java
  
  Index: HtmlTree.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/tree/HtmlTree.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- HtmlTree.java	26 Nov 2004 12:46:38 -0000	1.27
  +++ HtmlTree.java	24 Dec 2004 14:13:16 -0000	1.28
  @@ -23,6 +23,7 @@
   import javax.faces.context.FacesContext;
   import javax.faces.el.ValueBinding;
   
  +import org.apache.myfaces.component.html.util.AddResource;
   import org.apache.myfaces.custom.tree.event.TreeSelectionEvent;
   import org.apache.myfaces.custom.tree.event.TreeSelectionListener;
   import org.apache.myfaces.custom.tree.model.TreeModel;
  @@ -49,6 +50,9 @@
    * @version $Revision$ $Date$
    *          <p/>
    *          $Log$
  + *          Revision 1.28  2004/12/24 14:13:16  svieujot
  + *          Upgrade the tree component to use the Extensions filter.
  + *
    *          Revision 1.27  2004/11/26 12:46:38  oros
    *          cleanup: removed unused iconChild attribute
    *
  @@ -70,7 +74,22 @@
       private static final int EVENT_REMOVED = 2;
       private static final int EVENT_STRUCTURE_CHANGED = 3;
       private static int counter = 0;
  -
  +    
  +    // Defaut images
  +    private static final String DEFAULT_IMAGE_ICON_LINE = "images/line.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NOLINE = "images/noline.gif";
  +    private static final String DEFAULT_IMAGE_ICON_CHILD_FIRST = "images/line_first.gif";
  +    private static final String DEFAULT_IMAGE_ICON_CHILD_MIDDLE = "images/line_middle.gif";
  +    private static final String DEFAULT_IMAGE_ICON_CHILD_LAST = "images/line_last.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_OPEN = "images/node_open.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_OPEN_FIRST = "images/node_open_first.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_OPEN_MIDDLE = "images/node_open_middle.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_OPEN_LAST = "images/node_open_last.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_CLOSE = "images/node_close.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_CLOSE_FIRST = "images/node_close_first.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_CLOSE_MIDDLE = "images/node_close_middle.gif";
  +    private static final String DEFAULT_IMAGE_ICON_NODE_CLOSE_LAST = "images/node_close_last.gif";
  +    
       private IconProvider iconProvider;
       private boolean itemStatesRestored = false;
       private String var;
  @@ -80,19 +99,19 @@
       private String columnClasses;
       private String selectedNodeClass;
       private String iconClass;
  -    private String iconLine = "images/tree/line.gif";
  -    private String iconNoline = "images/tree/noline.gif";
  -    private String iconChildFirst = "images/tree/line_first.gif";
  -    private String iconChildMiddle = "images/tree/line_middle.gif";
  -    private String iconChildLast = "images/tree/line_last.gif";
  -    private String iconNodeOpen = "images/tree/node_open.gif";
  -    private String iconNodeOpenFirst = "images/tree/node_open_first.gif";
  -    private String iconNodeOpenMiddle = "images/tree/node_open_middle.gif";
  -    private String iconNodeOpenLast = "images/tree/node_open_last.gif";
  -    private String iconNodeClose = "images/tree/node_close.gif";
  -    private String iconNodeCloseFirst = "images/tree/node_close_first.gif";
  -    private String iconNodeCloseMiddle = "images/tree/node_close_middle.gif";
  -    private String iconNodeCloseLast = "images/tree/node_close_last.gif";
  +    private String iconLine;
  +    private String iconNoline;
  +    private String iconChildFirst;
  +    private String iconChildMiddle;
  +    private String iconChildLast;
  +    private String iconNodeOpen;
  +    private String iconNodeOpenFirst;
  +    private String iconNodeOpenMiddle;
  +    private String iconNodeOpenLast;
  +    private String iconNodeClose;
  +    private String iconNodeCloseFirst;
  +    private String iconNodeCloseMiddle;
  +    private String iconNodeCloseLast;
       private int uniqueIdCounter = 0;
       private int[] selectedPath;
       private int internalId;
  @@ -170,7 +189,10 @@
   
       public String getIconLine()
       {
  -        return iconLine;
  +        if( iconLine != null )
  +            return iconLine;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_LINE );
       }
   
   
  @@ -182,7 +204,10 @@
   
       public String getIconNoline()
       {
  -        return iconNoline;
  +        if( iconNoline != null )
  +            return iconNoline;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NOLINE );
       }
   
   
  @@ -194,7 +219,10 @@
   
       public String getIconChildFirst()
       {
  -        return iconChildFirst;
  +        if( iconChildFirst != null )
  +            return iconChildFirst;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_CHILD_FIRST );
       }
   
   
  @@ -206,7 +234,10 @@
   
       public String getIconChildMiddle()
       {
  -        return iconChildMiddle;
  +        if( iconChildMiddle != null )
  +            return iconChildMiddle;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_CHILD_MIDDLE );
       }
   
   
  @@ -218,7 +249,10 @@
   
       public String getIconChildLast()
       {
  -        return iconChildLast;
  +        if( iconChildLast != null )
  +            return iconChildLast;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_CHILD_LAST );
       }
   
   
  @@ -230,7 +264,10 @@
   
       public String getIconNodeOpen()
       {
  -        return iconNodeOpen;
  +        if( iconNodeOpen != null )
  +            return iconNodeOpen;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_OPEN );
       }
   
   
  @@ -242,7 +279,10 @@
   
       public String getIconNodeOpenFirst()
       {
  +        if( iconNodeOpenFirst != null )
           return iconNodeOpenFirst;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_OPEN_FIRST );
       }
   
   
  @@ -254,7 +294,10 @@
   
       public String getIconNodeOpenMiddle()
       {
  -        return iconNodeOpenMiddle;
  +        if( iconNodeOpenMiddle != null )
  +            return iconNodeOpenMiddle;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_OPEN_MIDDLE );
       }
   
   
  @@ -266,7 +309,10 @@
   
       public String getIconNodeOpenLast()
       {
  -        return iconNodeOpenLast;
  +        if( iconNodeOpenLast != null )
  +            return iconNodeOpenLast;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_OPEN_LAST );
       }
   
   
  @@ -278,7 +324,10 @@
   
       public String getIconNodeClose()
       {
  -        return iconNodeClose;
  +        if( iconNodeClose != null )
  +            return iconNodeClose;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_CLOSE );
       }
   
   
  @@ -290,7 +339,10 @@
   
       public String getIconNodeCloseFirst()
       {
  -        return iconNodeCloseFirst;
  +        if( iconNodeCloseFirst != null )
  +            return iconNodeCloseFirst;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_CLOSE_FIRST );
       }
   
   
  @@ -302,7 +354,10 @@
   
       public String getIconNodeCloseMiddle()
       {
  -        return iconNodeCloseMiddle;
  +        if( iconNodeCloseMiddle != null )
  +            return iconNodeCloseMiddle;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_CLOSE_MIDDLE );
       }
   
   
  @@ -314,7 +369,10 @@
   
       public String getIconNodeCloseLast()
       {
  -        return iconNodeCloseLast;
  +        if( iconNodeCloseLast != null )
  +            return iconNodeCloseLast;
  +        
  +        return getDefaultImagePath( DEFAULT_IMAGE_ICON_NODE_CLOSE_LAST );
       }
   
   
  @@ -889,6 +947,10 @@
           }
       }
   
  +    public static String getDefaultImagePath(String relativePathInResourceFolder)
  +    {
  +        return AddResource.getResourceMappedPath(HtmlTree.class, relativePathInResourceFolder, null);
  +    }
   
       private static class ModelListener implements TreeModelListener
       {