portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jf...@apache.org
Subject cvs commit: jakarta-jetspeed-2/taglibs/treecontrol/src/java/org/apache/jetspeed/portlets/tags PortletTreeControlTag.java
Date Wed, 20 Apr 2005 04:04:02 GMT
jford       2005/04/19 21:04:02

  Modified:    taglibs/treecontrol/src/java/org/apache/webapp/admin
                        TreeControlTag.java
               taglibs/treecontrol/src/java/org/apache/jetspeed/portlets/tags
                        PortletTreeControlTag.java
  Log:
  Switched to using divs in order to fix spacing issues
  
  Revision  Changes    Path
  1.5       +18 -30    jakarta-jetspeed-2/taglibs/treecontrol/src/java/org/apache/webapp/admin/TreeControlTag.java
  
  Index: TreeControlTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/taglibs/treecontrol/src/java/org/apache/webapp/admin/TreeControlTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TreeControlTag.java	9 Mar 2005 17:33:01 -0000	1.4
  +++ TreeControlTag.java	20 Apr 2005 04:04:02 -0000	1.5
  @@ -214,8 +214,7 @@
           TreeControl treeControl = getTreeControl();
           JspWriter out = pageContext.getOut();
           try {
  -            out.print
  -                ("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"");
  +            out.print("<div style=\"padding:0; margin:-2px; vertical-align: middle;\"
");
               if (style != null) {
                   out.print(" class=\"");
                   out.print(style);
  @@ -225,7 +224,7 @@
               int level = 0;
               TreeControlNode node = treeControl.getRoot();
               render(out, node, level, treeControl.getWidth(), true);
  -            out.println("</table>");
  +            out.println("</div>");
           } catch (IOException e) {
               throw new JspException(e);
           }
  @@ -324,7 +323,7 @@
           }
           
           // Render the beginning of this node
  -        out.println("  <tr valign=\"middle\">");
  +        out.println("<div style=\"display:block; white-space:nowrap;\">");
   
           // Create the appropriate number of indents
           for (int i = 0; i < level; i++) {
  @@ -333,13 +332,13 @@
               for (int j = 1; j <= levels; j++)
                   parent = parent.getParent();
               if (parent.isLast())
  -                out.print("    <td></td>");
  +                out.print("<div style=\"display:inline;\">&nbsp;</div>");
               else {
  -                out.print("    <td><img src=\"");
  +                out.print("<div style=\"display:inline;\"><img src=\"");
                   out.print(images);
                   out.print("/");
                   out.print(IMAGE_LINE_VERTICAL);
  -                out.print("\" alt=\"\" border=\"0\"></td>");
  +                out.print("\" alt=\"\" border=\"0\" /></div>");
               }
               out.println();
           }
  @@ -361,12 +360,12 @@
               ((HttpServletResponse) pageContext.getResponse()).
               encodeURL(updateTreeAction);
   
  -        out.print("    <td>");
  +        out.print("<div style=\"display:inline;\">");
           
   //      add an anchor so that we can return to this node
           out.print("<a name=\"");
           out.print(node.getName());
  -        out.print("\">");
  +        out.print("\" />");
           
           if ((action != null) && !node.isLeaf()) {
               out.print("<a href=\"");
  @@ -395,10 +394,10 @@
                   out.print(IMAGE_HANDLE_RIGHT_MIDDLE);
               out.print("\" alt=\"expand node");
           }
  -        out.print("\" border=\"0\">");
  +        out.print("\" border=\"0\" />");
           if ((action != null) && !node.isLeaf())
               out.print("</a>");
  -        out.println("</td>");
  +        out.println("</div>");
   
           // Calculate the hyperlink for this node (if any)
           String hyperlink = null;
  @@ -412,19 +411,8 @@
                   encodeURL(node.getAction());
   
           // Render the icon for this node (if any)
  -        out.print("    <td colspan=\"");
  -        out.print(width - level + 1);
  -        out.print("\"");
  +        out.print("<div style=\"display:inline; white-space:nowrap;\">");
           
  -        if(node.getLabel() != null)
  -        {
  -            //make sure text does not wrap
  -            out.print(" style=\"");
  -            out.print("white-space:nowrap;");
  -            out.print("\"");
  -        }
  -        
  -        out.print(">");
           if (node.getIcon() != null) {
               if (hyperlink != null) {
                   out.print("<a href=\"");
  @@ -447,7 +435,7 @@
               out.print("/");
               out.print(node.getIcon());
               out.print("\" alt=\"");
  -            out.print("\" border=\"0\">");
  +            out.print("\" border=\"0\" />");
               if (hyperlink != null)
                   out.print("</a>");
           }
  @@ -455,7 +443,7 @@
           // Render the label for this node (if any)
   
           if (node.getLabel() != null) {
  -            String labelStyle = null;
  +            String labelStyle = node.getCSSClass();
               if (node.isSelected() && (styleSelected != null))
                   labelStyle = styleSelected;
               else if (!node.isSelected() && (styleUnselected != null))
  @@ -491,7 +479,7 @@
                   out.print("\"");
                   out.print(">");
               } else if (labelStyle != null) {
  -                out.print("<span class=\"");
  +                out.print("<div style=\"display:inline;\" class=\"");
                   out.print(labelStyle);
                   out.print("\">");
               }
  @@ -499,12 +487,12 @@
               if (hyperlink != null)
                   out.print("</a>");
               else if (labelStyle != null)
  -                out.print("</span>");
  +                out.print("</div>");
           }
  -        out.println("</td>");
  +        out.println("</div>");
   
           // Render the end of this node
  -        out.println("  </tr>");
  +        out.println("</div>");
   
           // Render the children of this node
           if (node.isExpanded()) {
  
  
  
  1.10      +24 -25    jakarta-jetspeed-2/taglibs/treecontrol/src/java/org/apache/jetspeed/portlets/tags/PortletTreeControlTag.java
  
  Index: PortletTreeControlTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/taglibs/treecontrol/src/java/org/apache/jetspeed/portlets/tags/PortletTreeControlTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PortletTreeControlTag.java	4 Mar 2005 03:44:45 -0000	1.9
  +++ PortletTreeControlTag.java	20 Apr 2005 04:04:02 -0000	1.10
  @@ -107,6 +107,8 @@
                             int level, int width, boolean last)
           throws IOException {
   
  +        try
  +        {
           HttpServletResponse response =
               (HttpServletResponse) pageContext.getResponse();
           
  @@ -132,7 +134,7 @@
           }
           
           // Render the beginning of this node
  -        out.println("  <tr valign=\"middle\">");
  +        out.println("<div style=\"display:block; white-space:nowrap; vertical-align:
middle; margin:-3px;\">");
   
           // Create the appropriate number of indents
           for (int i = 0; i < level; i++) {
  @@ -141,13 +143,13 @@
               for (int j = 1; j <= levels; j++)
                   parent = parent.getParent();
               if (parent.isLast())
  -                out.print("    <td></td>");
  +                out.print("<div style=\"display:inline; vertical-align: middle;\">&nbsp;</div>");
               else {
  -                out.print("    <td><img src=\"");
  +                out.print("<div style=\"display:inline; vertical-align: middle;\"><img
src=\"");
                   out.print(images);
                   out.print("/");
                   out.print(IMAGE_LINE_VERTICAL);
  -                out.print("\" alt=\"\" border=\"0\"></td>");
  +                out.print("\" alt=\"\" border=\"0\" /></div>");
               }
               out.println();
           }
  @@ -172,12 +174,12 @@
   //            ((HttpServletResponse) pageContext.getResponse()).
   //            encodeURL(updateTreeAction);
   
  -        out.print("    <td>");
  +        out.print("<div style=\"display:inline; vertical-align: middle; padding:0; margin:0;\">");
           
   		//add an anchor so that we can return to this node
           out.print("<a name=\"");
           out.print(node.getName());
  -        out.print("\">");
  +        out.print("\" />");
           
           if ((action != null) && !node.isLeaf()) {
               out.print("<a href=\"");
  @@ -206,10 +208,10 @@
                   out.print(IMAGE_HANDLE_RIGHT_MIDDLE);
               out.print("\" alt=\"expand node");
           }
  -        out.print("\" border=\"0\">");
  +        out.print("\" border=\"0\" />");
           if ((action != null) && !node.isLeaf())
               out.print("</a>");
  -        out.println("</td>");
  +        out.println("</div>");
   
           // Calculate the hyperlink for this node (if any)
           String hyperlink = null;
  @@ -234,19 +236,8 @@
           }
   
           // Render the icon for this node (if any)
  -        out.print("    <td colspan=\"");
  -        out.print(width - level + 1);
  -        out.print("\"");
  +        out.print("<div style=\"display:inline; white-space:nowrap; vertical-align:
top; padding:0; margin:-2px;\">");
           
  -        if(node.getLabel() != null)
  -        {
  -            //make sure text does not wrap
  -            out.print(" style=\"");
  -            out.print("white-space:nowrap;");
  -            out.print("\"");
  -        }
  -        
  -        out.print(">");
           if (node.getIcon() != null) {
               if (hyperlink != null) {
                   out.print("<a href=\"");
  @@ -266,15 +257,18 @@
                   */
                   out.print(">");
               }
  +            out.print("<div style=\"display:inline; white-space:nowrap; vertical-align:
middle; padding:0; margin:-2px;\">");
               out.print("<img src=\"");
               out.print(images);
               out.print("/");
               out.print(node.getIcon());
               out.print("\" alt=\"");
  -            out.print("\" border=\"0\">");
  +            out.print("\" border=\"0\" />");
  +            out.print("</div>");
               if (hyperlink != null)
                   out.print("</a>");
           }
  +    
   
           // Render the label for this node (if any)
   
  @@ -317,7 +311,7 @@
                   */
                   out.print(">");
               } else if (labelStyle != null) {
  -                out.print("<span class=\"");
  +                out.print("<div style=\"display:inline; vertical-align: top;\" class=\"");
                   out.print(labelStyle);
                   out.print("\">");
               }
  @@ -325,12 +319,12 @@
               if (hyperlink != null)
                   out.print("</a>");
               else if (labelStyle != null)
  -                out.print("</span>");
  +                out.print("</div>");
           }
  -        out.println("</td>");
  +        out.println("</div>");
   
           // Render the end of this node
  -        out.println("  </tr>");
  +        out.println("</div>");
   
           // Render the children of this node
           if (node.isExpanded()) {
  @@ -341,6 +335,11 @@
                   render(out, children[i], newLevel, width, i == lastIndex);
               }
           }
  +      }
  +      catch(Exception e)
  +      {
  +          out.print(e.getLocalizedMessage());
  +      }
   
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message