Author: musachy
Date: Thu Aug 30 10:45:40 2007
New Revision: 571253

URL: http://svn.apache.org/viewvc?rev=571253&view=rev
Log:
WW-2136 Missing tag TextArea on dojo plugin 

Added:
    
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java
    
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TextAreaModel.java
    
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TextareaTag.java
    
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TextAreaDirective.java
Modified:
    
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
    
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
    
struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/textarea.ftl

Added: 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java?rev=571253&view=auto
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java
 (added)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java
 Thu Aug 30 10:45:40 2007
@@ -0,0 +1,60 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dojo.components;
+
+import java.util.Random;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.views.annotations.StrutsTag;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * Render Dojo Editor2 widget
+ *
+ */
[EMAIL PROTECTED](name="textarea", 
tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TextareaTag", 
description="Renders Dojo Editor2 widget")
+public class TextArea extends org.apache.struts2.components.TextArea {
+
+    public TextArea(ValueStack stack, HttpServletRequest request,
+        HttpServletResponse response) {
+        super(stack, request, response);
+    }
+    
+    public void evaluateExtraParams() {
+        super.evaluateExtraParams();
+
+        boolean generateId = 
!(Boolean)stack.getContext().get(Head.PARSE_CONTENT);
+        addParameter("pushId", generateId);
+        if ((this.id == null || this.id.length() == 0) && generateId) {
+            Random random = new Random();
+            this.id = "widget_" + Math.abs(random.nextInt());
+            addParameter("id", this.id);
+        }
+    }
+
+    @Override
+    public String getTheme() {
+        return "ajax";
+    }
+}

Modified: 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java?rev=571253&r1=571252&r2=571253&view=diff
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
 (original)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
 Thu Aug 30 10:45:40 2007
@@ -35,6 +35,7 @@
 import org.apache.struts2.dojo.views.velocity.components.HeadDirective;
 import org.apache.struts2.dojo.views.velocity.components.SubmitDirective;
 import org.apache.struts2.dojo.views.velocity.components.TabbedPanelDirective;
+import org.apache.struts2.dojo.views.velocity.components.TextAreaDirective;
 import org.apache.struts2.dojo.views.velocity.components.TreeDirective;
 import org.apache.struts2.dojo.views.velocity.components.TreeNodeDirective;
 import org.apache.struts2.views.TagLibrary;
@@ -60,7 +61,8 @@
             TreeDirective.class,
             TreeNodeDirective.class,
             HeadDirective.class,
-            BindDirective.class
+            BindDirective.class,
+            TextAreaDirective.class
         };
         return Arrays.asList(directives);
     }

Modified: 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java?rev=571253&r1=571252&r2=571253&view=diff
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
 (original)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
 Thu Aug 30 10:45:40 2007
@@ -33,6 +33,7 @@
     protected SubmitModel submit;
     protected BindModel bind;
     protected HeadModel head;
+    protected TextAreaModel textarea;
     
     private ValueStack stack;
     private HttpServletRequest req;
@@ -50,6 +51,14 @@
         }
 
         return bind;
+    }
+    
+    public TextAreaModel getTextarea() {
+        if (textarea == null) {
+            textarea = new TextAreaModel(stack, req, res);
+        }
+
+        return textarea;
     }
     
     public HeadModel getHead() {

Added: 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TextAreaModel.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TextAreaModel.java?rev=571253&view=auto
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TextAreaModel.java
 (added)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TextAreaModel.java
 Thu Aug 30 10:45:40 2007
@@ -0,0 +1,43 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dojo.views.freemarker.tags;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.Component;
+import org.apache.struts2.dojo.components.TextArea;
+import org.apache.struts2.views.freemarker.tags.TagModel;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * @see TextArea
+ */
+public class TextAreaModel extends TagModel {
+    public TextAreaModel(ValueStack stack, HttpServletRequest req, 
HttpServletResponse res) {
+        super(stack, req, res);
+    }
+
+    protected Component getBean() {
+        return new TextArea(stack, req, res);
+    }
+}

Added: 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TextareaTag.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TextareaTag.java?rev=571253&view=auto
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TextareaTag.java
 (added)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TextareaTag.java
 Thu Aug 30 10:45:40 2007
@@ -0,0 +1,51 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dojo.views.jsp.ui;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.Component;
+import org.apache.struts2.dojo.components.TextArea;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+
+/**
+ * @see TextArea
+ *
+ */
+public class TextareaTag extends  org.apache.struts2.views.jsp.ui.TextareaTag{
+    public Component getBean(ValueStack stack, HttpServletRequest req, 
HttpServletResponse res) {
+        return new TextArea(stack, req, res);
+    }
+
+    protected void populateParams() {
+        super.populateParams();
+
+        TextArea textArea = ((TextArea) component);
+        textArea.setCols(cols);
+        textArea.setReadonly(readonly);
+        textArea.setRows(rows);
+        textArea.setWrap(wrap);
+    }
+
+}

Added: 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TextAreaDirective.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TextAreaDirective.java?rev=571253&view=auto
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TextAreaDirective.java
 (added)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TextAreaDirective.java
 Thu Aug 30 10:45:40 2007
@@ -0,0 +1,27 @@
+package org.apache.struts2.dojo.views.velocity.components;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.Component;
+import org.apache.struts2.dojo.components.TextArea;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * @see TextArea
+ */
+public class TextAreaDirective extends DojoAbstractDirective {
+    public String getBeanName() {
+        return "textarea";
+    }
+
+    protected Component getBean(ValueStack stack, HttpServletRequest req,
+        HttpServletResponse res) {
+        return new TextArea(stack, req, res);
+    }
+
+    public int getType() {
+        return BLOCK;
+    }
+}

Modified: 
struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/textarea.ftl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/textarea.ftl?rev=571253&r1=571252&r2=571253&view=diff
==============================================================================
--- 
struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/textarea.ftl 
(original)
+++ 
struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/textarea.ftl 
Thu Aug 30 10:45:40 2007
@@ -59,4 +59,7 @@
 <#if parameters.nameValue?exists>
 <@s.property value="parameters.nameValue"/><#t/>
 </#if>
-</textarea>
\ No newline at end of file
+</textarea>
+<#if parameters.pushId>
+<script language="JavaScript" 
type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
\ No newline at end of file


Reply via email to