You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/02/21 03:05:35 UTC

svn commit: r154603 [1/5] - in incubator/beehive/trunk/netui: src/tags-html/org/apache/beehive/netui/tags/tree/ test/webapps/drt/coreWeb/bugs/j297/ test/webapps/drt/coreWeb/tree/images2/ test/webapps/drt/coreWeb/tree/inherit/ test/webapps/drt/coreWeb/tree/params/ test/webapps/drt/testRecorder/tests/

Author: dolander
Date: Sun Feb 20 18:05:30 2005
New Revision: 154603

URL: http://svn.apache.org/viewcvs?view=rev&rev=154603
Log:
Jira 339 -- Added an IconRoot attribute allowing the icons in the tree
to be specified from a different location that the core tree icons.

The purpose for this is it allows the site to create item icons and not
keep them in the Beehive provided resources.



Modified:
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/InheritableState.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHtmlAttribute.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderer.java
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j297/Test.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/images2/Test.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/inherit/index.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/params/index.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J297.xml
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/TreeImage2.xml
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/TreeInherit.xml
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/TreeParams.xml

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/InheritableState.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/InheritableState.java?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/InheritableState.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/InheritableState.java Sun Feb 20 18:05:30 2005
@@ -43,6 +43,7 @@
     private String _expansionAction = null;
     private String _selectTarget = null;
     private String _imageRoot = null;
+    private String _iconRoot = null;
 
     // A parent state object which we chain to if the state isn't set on this object.
     private InheritableState _parent;
@@ -226,6 +227,11 @@
         _selectTarget = target;
     }
 
+    /**
+     * Return the default location of all images.  It is used as the location
+     * for the tree structure images.
+     * @return
+     */
     public String getImageRoot()
     {
         if (_imageRoot != null)
@@ -235,9 +241,49 @@
         return null;
     }
 
+    /**
+     * Sets the default location of all the images.
+     * @param imageRoot
+     */
     public void setImageRoot(String imageRoot)
     {
         _imageRoot = imageRoot;
+    }
+
+    /**
+     * This will return the location of the icon images.  When the location
+     * is explicitly set, this works exactly the same as all other inheritable
+     * properties.  When this is not set, it will return the <code>getImageRoot</code>
+     * location.
+     * @return a String value of the icon root.
+     */
+    public String getIconRoot()
+    {
+        String ret = getRealIconRoot();
+        return (ret != null) ? ret : getImageRoot();
+    }
+
+    /**
+     * This method will walk the inheritable state looking for an icon root.
+     * It returns null if not found.
+     * @return the icon root or null.
+     */
+    private String getRealIconRoot()
+    {
+        if (_iconRoot != null)
+            return _iconRoot;
+        if (_parent != null)
+            return _parent.getRealIconRoot();
+        return null;
+    }
+
+    /**
+     * This will set the location of the icon images.
+     * @param iconRoot the location of the icon images.
+     */
+    public void setIconRoot(String iconRoot)
+    {
+        _iconRoot = iconRoot;
     }
 
     /**

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java Sun Feb 20 18:05:30 2005
@@ -370,6 +370,24 @@
     }
 
     /**
+     * This will set the location of the icon images.  When the location
+     * is explicitly set, this works exactly the same as all other inheritable
+     * properties.  When this is not set, it will return the <code>getImageRoot</code>
+     * location.
+     * @param iconRoot - the directory name for the icons
+     * @jsptagref.attributedescription The directory containing the icon images for tree items.
+     * @jsptagref.databindable false
+     * @jsptagref.attributesyntaxvalue <i>string_iconRoot</i>
+     * @netui:attribute required="false" rtexprvalue="true"
+     * description="Sets the name of the directory containing the images for our icons."
+     * @netui.tldx:attribute category="images"
+     */
+    public void setIconRoot(String iconRoot)
+    {
+        _iState.setIconRoot(iconRoot);
+    }
+
+    /**
      * Sets the image that will be used for the root when it is Collapsed.  The root must implement
      * ITreeRootElement to support this.
      * @param rootNodeCollapsedImage - the image representing a root that is collapsed.

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHtmlAttribute.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHtmlAttribute.java?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHtmlAttribute.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHtmlAttribute.java Sun Feb 20 18:05:30 2005
@@ -121,7 +121,7 @@
             ti.setItemAttribute(_info);
         }
         else {
-            // This needs to be logged....
+            // @todo: This needs to be logged....
             System.err.println("Unknown thing here");
         }
     }

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java Sun Feb 20 18:05:30 2005
@@ -186,6 +186,24 @@
     }
 
     /**
+     * This will set the location of the icon images.  When the location
+     * is explicitly set, this works exactly the same as all other inheritable
+     * properties.  When this is not set, it will return the <code>getImageRoot</code>
+     * location.
+     * @param iconRoot - the directory name for the icons
+     * @jsptagref.attributedescription The directory containing the icon images for tree items.
+     * @jsptagref.databindable false
+     * @jsptagref.attributesyntaxvalue <i>string_iconRoot</i>
+     * @netui:attribute required="false" rtexprvalue="true"
+     * description="Sets the name of the directory containing the images for our icons."
+     * @netui.tldx:attribute category="images"
+     */
+    public void setIconRoot(String iconRoot)
+    {
+        _iState.setIconRoot(iconRoot);
+    }
+
+    /**
      * Render this Tree control.
      * @throws JspException if a processing error occurs
      */

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderer.java?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderer.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderer.java Sun Feb 20 18:05:30 2005
@@ -402,10 +402,10 @@
         // icons by setting the useDefaultIcons attribute to false.
         String icon = node.getIcon();
         if (icon == null) {
-            icon = state.getImageRoot() + "/" + state.getItemIcon();
+            icon = state.getIconRoot() + "/" + state.getItemIcon();
         }
         else {
-            icon = state.getImageRoot() + "/" + icon;
+            icon = state.getIconRoot() + "/" + icon;
         }
 
         // write out the icon

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j297/Test.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j297/Test.jsp?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j297/Test.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j297/Test.jsp Sun Feb 20 18:05:30 2005
@@ -17,6 +17,7 @@
     <netui:scriptHeader/>
     <netui:tree dataSource="pageFlow.root" escapeForHtml="true"
         selectionAction="select" tagId="tree" runAtClient="true"
+	iconRoot="/coreWeb/tree/images"
         selectedStyle="background-color: #FFD185; font-color: #FFFFFF; text-decoration: none;"
 	unselectedStyle="text-decoration: none"
     >

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/images2/Test.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/images2/Test.jsp?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/images2/Test.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/images2/Test.jsp Sun Feb 20 18:05:30 2005
@@ -57,23 +57,25 @@
         selectionAction="select" tagId="tree2" runAtClient="true"
         selectedStyle="background-color: #FFD185; font-color: #FFFFFF; text-decoration: none;"
 	unselectedStyle="text-decoration: none"
+	iconRoot="/coreWeb/tree/images"
     >
             <netui:treeItem expanded="true" action="select">
                 <netui:treeLabel>0</netui:treeLabel>
-                <netui:treeItem expanded="true" action="select">
+                <netui:treeItem expanded="true" action="select" icon="alien.gif">
                     <netui:treeLabel>0.0</netui:treeLabel>
-                    <netui:treeItem expanded="true" action="select">
+                    <netui:treeItem expanded="true" icon="alien.gif" action="select">
                         <netui:treeLabel>0.0.0</netui:treeLabel>
                         <netui:treeItem icon="alien.gif" action="select">0.0.0.0</netui:treeItem>
                         <netui:treeItem icon="alien.gif" action="select">0.0.0.1</netui:treeItem>
                     </netui:treeItem>
                 </netui:treeItem>
-                <netui:treeItem expanded="true" action="select">
+                <netui:treeItem expanded="true" action="select" icon="cool.gif">
                     <netui:treeLabel>0.1</netui:treeLabel>
                     <netui:treeItem icon="cool.gif" action="select">0.1.0</netui:treeItem>
                     <netui:treeItem icon="cool.gif" action="select">0.1.1</netui:treeItem>
                 </netui:treeItem>
-                <netui:treeItem expanded="true" action="select"><netui:treeLabel>0.2</netui:treeLabel>
+                <netui:treeItem expanded="true" action="select" icon="cool.gif">
+		    <netui:treeLabel>0.2</netui:treeLabel>
                     <netui:treeItem icon="cool.gif" action="select">0.2.0</netui:treeItem>
                     <netui:treeItem icon="cool.gif" action="select">0.2.1</netui:treeItem>
 		</netui:treeItem>

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/inherit/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/inherit/index.jsp?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/inherit/index.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/inherit/index.jsp Sun Feb 20 18:05:30 2005
@@ -18,6 +18,7 @@
         selectionAction="select" tagId="tree" runAtClient="true"
         selectedStyle="background-color: #FFD185; font-color: #FFFFFF; text-decoration: none;"
 	unselectedStyle="text-decoration: none"
+        iconRoot="/coreWeb/tree/images"
     >
             <netui:treeItem expanded="true">
                 <netui:treeLabel>0</netui:treeLabel>

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/params/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/params/index.jsp?view=diff&r1=154602&r2=154603
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/params/index.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tree/params/index.jsp Sun Feb 20 18:05:30 2005
@@ -17,6 +17,7 @@
         selectionAction="select" tagId="tree" runAtClient="true"
         selectedStyle="background-color: #FFD185; font-color: #FFFFFF; text-decoration: none;"
 	unselectedStyle="text-decoration: none"
+        iconRoot="/coreWeb/tree/images"
     >
             <netui:treeItem expanded="true">
                 <netui:treeLabel>0</netui:treeLabel>