Return-Path: Delivered-To: apmail-struts-commits-archive@locus.apache.org Received: (qmail 4208 invoked from network); 24 Aug 2006 00:17:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Aug 2006 00:17:04 -0000 Received: (qmail 63852 invoked by uid 500); 24 Aug 2006 00:16:59 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 63786 invoked by uid 500); 24 Aug 2006 00:16:59 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 63777 invoked by uid 99); 24 Aug 2006 00:16:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Aug 2006 17:16:59 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Aug 2006 17:16:58 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id E970F1A981A; Wed, 23 Aug 2006 17:16:37 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r434265 [1/2] - in /struts/struts2/trunk: apps/showcase/src/main/webapp/tags/ui/ core/src/main/java/org/apache/struts2/components/ core/src/main/java/org/apache/struts2/views/jsp/ui/ core/src/main/java/org/apache/struts2/views/velocity/comp... Date: Thu, 24 Aug 2006 00:16:36 -0000 To: commits@struts.apache.org From: husted@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060824001637.E970F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: husted Date: Wed Aug 23 17:16:35 2006 New Revision: 434265 URL: http://svn.apache.org/viewvc?rev=434265&view=rev Log: WW-1392 Bring over WW2.2.3 TLD. Review commit history. Add missing attribute (doubleAccesskey) and missing tag (debug). (Next: Update with example code.) Also change Velocity directive prefix from "s-" to "s", since the using special character wasn't working. Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm?rev=434265&r1=434264&r2=434265&view=diff ============================================================================== --- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm (original) +++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm Wed Aug 23 17:16:35 2006 @@ -1,32 +1,32 @@ UI Tags Example - #safhead() + #shead() -#safurl ("id=url" "value=index.jsp") +#surl ("id=url" "value=index.jsp") Back to index.jsp! -#safform ("action=exampleSubmitVelocity" "method=post" "enctype=multipart/form-data") - #saftextfield ("label=Name" "name=name") - #safdatepicker ("label=Birthday" "name=birthday") - #saftextarea ("label=Biograph" "name=bio" "cols=20" "rows=3") - #safselect ("label=Favorite Color" "list={'Red', 'Blue', 'Green'}" "name=favoriteColor" "emptyOption=true" "headerKey=None" "headerValue=None") - #safselect ("label=Favourite Language" "list=favouriteLanguages" "name=favouriteLanguage" "listKey=key" "listValue=description" "emptyOption=true" "headerKey=None" "headerValue=None") - #safcheckboxlist ("label=Friends" "list={'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=friends") - #safcheckbox ("label=Age 18+" "name=legalAge") - #safdoubleselect ("label=State" "name=region" "list={'North', 'South'}" "value='North'" "doubleValue='Florida'" "doubleList=top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" "doubleName=state" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" ) - #safdoubleselect ("label=Favourite Vehical" "name=favouriteVehicalType" "list=vehicalTypeList" "listKey=key" "listValue=description" "value='MotorcycleKey'" "doubleValue='YamahaKey'" "doubleList=vehicalSpecificList" "doubleListKey=key" "doubleListValue=description" "doubleName=favouriteVehicalSpecific" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" ) - #saffile ("label=Picture" "name=picture") - #safoptiontransferselect ("label=Favourite Cartoons Characters" "name=leftSideCartoonCharacters" "leftTitle=Left Title" "rightTitle=Right Title" "list={'Popeye', 'He-Man', 'Spiderman'}" "multiple=true" "headerKey=headerKey" "headerValue=--- Please Select ---" "emptyOption=true" "doubleList={'Superman', 'Mickey Mouse', 'Donald Duck'}" "doubleName=rightSideCartoonCharacters" "doubleHeaderKey=doubleHeaderKey" "doubleHeaderValue=--- Please Select ---" "doubleEmptyOption=true" "doubleMultiple=true" ) - #safsubmit() - #safreset() +#sform ("action=exampleSubmitVelocity" "method=post" "enctype=multipart/form-data") + #stextfield ("label=Name" "name=name") + #sdatepicker ("label=Birthday" "name=birthday") + #stextarea ("label=Biograph" "name=bio" "cols=20" "rows=3") + #sselect ("label=Favorite Color" "list={'Red', 'Blue', 'Green'}" "name=favoriteColor" "emptyOption=true" "headerKey=None" "headerValue=None") + #sselect ("label=Favourite Language" "list=favouriteLanguages" "name=favouriteLanguage" "listKey=key" "listValue=description" "emptyOption=true" "headerKey=None" "headerValue=None") + #scheckboxlist ("label=Friends" "list={'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=friends") + #scheckbox ("label=Age 18+" "name=legalAge") + #sdoubleselect ("label=State" "name=region" "list={'North', 'South'}" "value='North'" "doubleValue='Florida'" "doubleList=top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" "doubleName=state" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" ) + #sdoubleselect ("label=Favourite Vehical" "name=favouriteVehicalType" "list=vehicalTypeList" "listKey=key" "listValue=description" "value='MotorcycleKey'" "doubleValue='YamahaKey'" "doubleList=vehicalSpecificList" "doubleListKey=key" "doubleListValue=description" "doubleName=favouriteVehicalSpecific" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" ) + #sfile ("label=Picture" "name=picture") + #soptiontransferselect ("label=Favourite Cartoons Characters" "name=leftSideCartoonCharacters" "leftTitle=Left Title" "rightTitle=Right Title" "list={'Popeye', 'He-Man', 'Spiderman'}" "multiple=true" "headerKey=headerKey" "headerValue=--- Please Select ---" "emptyOption=true" "doubleList={'Superman', 'Mickey Mouse', 'Donald Duck'}" "doubleName=rightSideCartoonCharacters" "doubleHeaderKey=doubleHeaderKey" "doubleHeaderValue=--- Please Select ---" "doubleEmptyOption=true" "doubleMultiple=true" ) + #ssubmit() + #sreset() #end -#safa("href=${url}")Back to index.jsp#end +#sa("href=${url}")Back to index.jsp#end Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm?rev=434265&r1=434264&r2=434265&view=diff ============================================================================== --- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm (original) +++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm Wed Aug 23 17:16:35 2006 @@ -6,18 +6,18 @@

Example Submitted

- #saflabel ("label=Name" "name=name") - #saflabel ("label=Birthday" "name=birthday") - #saflabel ("label=Biography" "name=bio") - #saflabel ("label=Favourite Color" "name=favouriteColor") - #saflabel ("label=Friends" "name=friends") - #saflabel ("label=Legal Age" "name=legalAge") - #saflabel ("label=Region" "name=region") - #saflabel ("label=State" "name=state") - #saflabel ("label=Picture" "name=picture") - #saflabel ("label=Favourite Language" "name=favouriteLanguage") - #saflabel ("label=Favourite Vehical Type" "name=favouriteVehicalType") - #saflabel ("label=Favourite Vehical Specific" "name=favouriteVehicalSpecific") + #slabel ("label=Name" "name=name") + #slabel ("label=Birthday" "name=birthday") + #slabel ("label=Biography" "name=bio") + #slabel ("label=Favourite Color" "name=favouriteColor") + #slabel ("label=Friends" "name=friends") + #slabel ("label=Legal Age" "name=legalAge") + #slabel ("label=Region" "name=region") + #slabel ("label=State" "name=state") + #slabel ("label=Picture" "name=picture") + #slabel ("label=Favourite Language" "name=favouriteLanguage") + #slabel ("label=Favourite Vehical Type" "name=favouriteVehicalType") + #slabel ("label=Favourite Vehical Specific" "name=favouriteVehicalSpecific")
Favourite Cartoon Characters (Left): @@ -40,8 +40,8 @@
-#safurl ("id=url" "value=index.jsp") -#safa("href=${url}")Back to index.jsp#end +#surl ("id=url" "value=index.jsp") +#sa("href=${url}")Back to index.jsp#end Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java?rev=434265&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java (added) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java Wed Aug 23 17:16:35 2006 @@ -0,0 +1,94 @@ +package org.apache.struts2.components; + +import com.opensymphony.xwork2.util.OgnlUtil; +import com.opensymphony.xwork2.util.OgnlValueStack; +import org.apache.struts2.StrutsException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * + *

Renders an debug tag.

+ * + * The debug information contain mostly stack information: + *
    + *
  • Value Stack Contents
  • + *
  • Stack Context
  • + *
+ * + * + *

Examples + * + *

+ * 
+ * <ww:debug/>
+ * 
+ * 
+ * + * @s.tag name="debug" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.DebugTag" + * description="Render debug tag" + */ +public class Debug extends UIBean { + public static final String TEMPLATE = "debug"; + + public Debug(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) { + super(stack, request, response); + } + + protected String getDefaultTemplate() { + return TEMPLATE; + } + + public boolean start(Writer writer) { + boolean result = super.start(writer); + + OgnlValueStack stack = getStack(); + Iterator iter = stack.getRoot().iterator(); + List stackValues = new ArrayList(stack.getRoot().size()); + while (iter.hasNext()) { + Object o = iter.next(); + Map values; + try { + values = OgnlUtil.getBeanMap(o); + } catch (Exception e) { + throw new StrutsException("Caught an exception while getting the property values of " + o, e); + } + stackValues.add(new DebugMapEntry(o.getClass().getName(), values)); + } + + addParameter("stackValues", stackValues); + + return result; + } + + private class DebugMapEntry implements Map.Entry { + private Object key; + private Object value; + + DebugMapEntry(Object key, Object value) { + this.key = key; + this.value = value; + } + + public Object getKey() { + return key; + } + + public Object getValue() { + return value; + } + + public Object setValue(Object newVal) { + Object oldVal = value; + value = newVal; + return oldVal; + } + } + +} Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java?rev=434265&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java (added) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java Wed Aug 23 17:16:35 2006 @@ -0,0 +1,16 @@ +package org.apache.struts2.views.jsp.ui; + +import org.apache.struts2.components.Component; +import org.apache.struts2.components.Debug; +import com.opensymphony.xwork2.util.OgnlValueStack; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class DebugTag extends AbstractUITag { + + public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new Debug(stack, req, res); + } + +} Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java?rev=434265&r1=434264&r2=434265&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java Wed Aug 23 17:16:35 2006 @@ -36,7 +36,7 @@ public abstract class AbstractDirective extends Directive { public String getName() { - return "s-" + getBeanName(); + return "s" + getBeanName(); } public abstract String getBeanName();