Commits

Anonymous committed f0d43c2

tabbed pane stuff mostly working -- some URL issues outstanding

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@255573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits bf6713b

Comments (0)

Files changed (6)

File src/etc/example/xwork.xml

         <action name="Test" class="com.opensymphony.webwork.example.Test">
         </action>
 
+        <action name="TabbedPaneTest" class="com.opensymphony.webwork.example.TabbedPaneTest">
+            <result name="success">tabbedpanetest.jsp</result>
+        </action>
+
     </package>
 
     <include file="month.xml"/>

File src/etc/taglib.tld

         </attribute>
     </tag>
 
+    <tag>
+        <name>tabbedpane</name>
+        <tagclass>com.opensymphony.webwork.views.jsp.ui.TabbedPaneTag</tagclass>
+        <bodycontent>JSP</bodycontent>
+        <info>TabbedPane Tag</info>
+        <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>theme</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>contentName</name>
+            <required>true</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>tabAlign</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+    </tag>
+
     <!-- ******************** WebWork VUI Tags *************************** -->
     <tag>
         <name>field</name>

File src/example/com/opensymphony/webwork/example/TabbedPaneTest.java

+package com.opensymphony.webwork.example;
+
+import webwork.action.ActionSupport;
+
+import java.util.Vector;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+public class TabbedPaneTest extends ActionSupport
+{
+    static Set getData()
+    {
+        Map tmpMap = new HashMap();
+
+        tmpMap.put( "Counter", "/SimpleCounter.action" );
+        tmpMap.put( "UI Tags", "/TagTest.action" );
+        tmpMap.put( "Country List", "/CountryTest.action" );
+
+        return tmpMap.entrySet();
+    }
+
+    public Vector getTabs1() { return tabs1; }
+
+    // Attributes --------------------------------------------------------
+    private Vector tabs1 = new Vector( TabbedPaneTest.getData() );
+}

File src/java/com/opensymphony/webwork/util/URLBean.java

 
         return UrlHelper.buildUrl(page, request, response, params);
     }
+
+    public String toString() {
+        return getURL();
+    }
 }

File src/java/template/xhtml/tabbedpane.vm

   *#
 
 #bean ("com.opensymphony.webwork.util.Counter" $tabIndex)
-$tabIndex.setFirst(0)
-$tabIndex.setLast($content.size())
+#set ($tabIndex.first = 0)
+#set ($tabIndex.last = $tag.content.size())
 
-<table border="1" cellspacing="0" cellpadding="5" id="$webwork.encodeHtml($id)">
+<table border="1" cellspacing="0" cellpadding="5" id="$!webwork.htmlEncode($tag.id)">
 
-	<tr valign="bottom" align="$webwork.encodeHtml($tabAlign)">
+	<tr valign="bottom" align="$!webwork.htmlEncode($tag.tabAlign)">
 
 	#if ($tabAlign == 'CENTER' || $tabAlign == 'RIGHT')
         <th colspan ="1" width="*"></th>
     #end
 
-    #foreach ($c in $content)
-        $stack.pushValue($c)
+    #foreach ($c in $tag.content)
+        $stack.push($c)
 
         <th width="10%"
-            #if ($selectedIndex == #attr.tabIndex.current)
+            #if ($tag.selectedIndex == $tabIndex.current)
                 #set ($isCur = 'true')
                 bgcolor="#A0B3FC"
             #else
+                #set ($isCur = 'false')
                 bgcolor="#C0C0C0"
             #end
         >
 
-        <a href="#bodytag( URL "includeParams='all'" )
-            #param ("indexLink" #attr.tabIndex.next)
-        #end">
+        #url ($url)
+        <a href="$url.addParameter("indexLink", $tabIndex.next)">
 
-        #if ($isCur)
+        #if ($isCur == 'true')
             <em>
         #end
-        $webwork.encodeHtml($key)
-        #if ($isCur)
+        $!webwork.htmlEncode($key)
+        #if ($isCur == 'true')
             </em>
         #end
 
         </a>
+
         </th>
 
-        #set ($trash = $stack.popValue())
+        #set ($trash = $stack.pop())
     #end
 
-		<webwork:if test="tabAlign == 'CENTER' || tabAlign == 'LEFT'"><th colspan ="1" width="*"></th></webwork:if>
+    #if ($tabAlign == 'CENTER' || $tabAlign == 'LEFT')
+        <th colspan ="1" width="*"></th>
+    #end
 
-	</tr>
+    </tr>
 	<tr>
-		<td bgcolor="#E1EAE8" colspan="<webwork:property value="colSpanLength"/>" width="100%">
-			<webwork:include value="selectedUrl"/>
+		<td bgcolor="#E1EAE8" colspan="$tag.colSpanLength" width="100%">
+			#includeservlet ($tag.selectedUrl)
 		</td>
 	</tr>
+
 </table>

File src/webapp/tabbedpanetest.jsp

+<%@ taglib uri="webwork" prefix="webwork" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <title>TPTEST</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+    <form name="form1" method="post" action="<webwork:url/>">
+        <p><webwork:tabbedpane id="tp1" contentName="'tabs1'" tabAlign="'RIGHT'"/></p>
+    </form>
+</html>