* Add classes for form tag(just extend the ones on core)
* Copy datetimepicker.ftl from core
* Add common-events to the tags
* Remove dependency on xhtml theme
* Fix autocompleter failing test
* Restore compressed dojo.js (I overwrote it with the uncompressed one by mistake)


git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@515878 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Musachy Barroso
2007-03-08 01:26:24 +00:00
parent b65a8a7b40
commit c4509dbfbc
25 changed files with 11162 additions and 16931 deletions
@@ -30,7 +30,6 @@ import com.opensymphony.xwork2.util.ValueStack;
* AbstractRemoteCallUIBean is superclass for all components dealing with remote
* calls.
*/
@StrutsTagSkipInheritance
public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements RemoteUICallBean {
protected String href;
@@ -47,7 +47,6 @@ import com.opensymphony.xwork2.util.ValueStack;
*<!-- END SNIPPET: example -->
*/
@StrutsTag(name="autocompleter", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.AutocompleterTag", description="Renders a combobox with autocomplete and AJAX capabilities")
@StrutsTagSkipInheritance
public class Autocompleter extends ComboBox {
public static final String TEMPLATE = "autocompleter";
final private static String COMPONENT_NAME = Autocompleter.class.getName();
@@ -32,7 +32,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
import com.opensymphony.xwork2.util.ValueStack;
@@ -128,7 +127,6 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*/
@StrutsTag(name="datetimepicker", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.DateTimePickerTag", description="Render datetimepicker")
@StrutsTagSkipInheritance
public class DateTimePicker extends UIBean {
final public static String TEMPLATE = "datetimepicker";
@@ -0,0 +1,46 @@
/*
* "$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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTag;
import com.opensymphony.xwork2.util.ValueStack;
/**
* TODO
*
*/
@StrutsTag(name="form", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.FormTag", description="Renders an input form")
public class Form extends org.apache.struts2.components.Form {
public Form(ValueStack stack, HttpServletRequest request,
HttpServletResponse response) {
super(stack, request, response);
}
@Override
public String getTheme() {
return "ajax";
}
}
@@ -93,7 +93,6 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*/
@StrutsTag(name="submit", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.SubmitTag", description="Render a submit button")
@StrutsTagSkipInheritance
public class Submit extends FormButton implements RemoteUICallBean {
private static final Log LOG = LogFactory.getLog(Submit.class);
@@ -60,7 +60,6 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*/
@StrutsTag(name="tabbedPanel", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TabbedPanelTag", description="Render a tabbedPanel widget.")
@StrutsTagSkipInheritance
public class TabbedPanel extends ClosingUIBean {
public static final String TEMPLATE = "tabbedpanel";
public static final String TEMPLATE_CLOSE = "tabbedpanel-close";
@@ -70,7 +70,6 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*/
@StrutsTag(name="tree", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeTag", description="Render a tree widget.")
@StrutsTagSkipInheritance
public class Tree extends ClosingUIBean {
private static final String TEMPLATE = "tree-close";
@@ -214,6 +213,11 @@ public class Tree extends ClosingUIBean {
}
}
@Override
public String getTheme() {
return "ajax";
}
public String getDefaultOpenTemplate() {
return OPEN_TEMPLATE;
}
@@ -82,7 +82,6 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*/
@StrutsTag(name="treenode", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeNodeTag", description="Render a tree node within a tree widget.")
@StrutsTagSkipInheritance
public class TreeNode extends ClosingUIBean {
private static final String TEMPLATE = "treenode-close";
private static final String OPEN_TEMPLATE = "treenode";
@@ -91,6 +90,11 @@ public class TreeNode extends ClosingUIBean {
super(stack, request, response);
}
@Override
public String getTheme() {
return "ajax";
}
public String getDefaultOpenTemplate() {
return OPEN_TEMPLATE;
}
@@ -10,6 +10,7 @@ import org.apache.struts2.dojo.views.velocity.components.AnchorDirective;
import org.apache.struts2.dojo.views.velocity.components.AutocompleterDirective;
import org.apache.struts2.dojo.views.velocity.components.DateTimePickerDirective;
import org.apache.struts2.dojo.views.velocity.components.DivDirective;
import org.apache.struts2.dojo.views.velocity.components.FormDirective;
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.TreeDirective;
@@ -37,6 +38,7 @@ public class DojoTagLibrary implements TagLibrary {
TabbedPanelDirective.class,
TreeDirective.class,
TreeNodeDirective.class,
FormDirective.class
};
return Arrays.asList(directives);
}
@@ -14,10 +14,11 @@ public class DojoModels {
protected TabbedPanelModel tabbedPanel;
protected TreeModel treeModel;
protected TreeNodeModel treenodeModel;
protected AutocompleterModel autocompleterModel;
protected AutocompleterModel autocompleter;
protected DivModel div;
protected AnchorModel a;
protected SubmitModel submit;
protected FormModel form;
private ValueStack stack;
private HttpServletRequest req;
@@ -37,12 +38,20 @@ public class DojoModels {
return dateTimePicker;
}
public AutocompleterModel getAutocompleterModel() {
if (autocompleterModel == null) {
autocompleterModel = new AutocompleterModel(stack, req, res);
public FormModel getForm() {
if (form == null) {
form = new FormModel(stack, req, res);
}
return autocompleterModel;
return form;
}
public AutocompleterModel getAutocompleterModel() {
if (autocompleter == null) {
autocompleter = new AutocompleterModel(stack, req, res);
}
return autocompleter;
}
public TabbedPanelModel getTabbedpanelModel() {
@@ -0,0 +1,44 @@
/*
* "$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.Form;
import org.apache.struts2.views.freemarker.tags.TextFieldModel;
import com.opensymphony.xwork2.util.ValueStack;
/**
* @see Form
*/
public class FormModel extends TextFieldModel {
public FormModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
super(stack, req, res);
}
protected Component getBean() {
return new Form(stack, req, res);
}
}
@@ -0,0 +1,39 @@
/*
* "$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.Form;
import com.opensymphony.xwork2.util.ValueStack;
public class FormTag extends org.apache.struts2.views.jsp.ui.FormTag{
@Override
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new Form(stack, req, res);
}
}
@@ -0,0 +1,38 @@
/*
* $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.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
import org.apache.struts2.dojo.components.Form;
import com.opensymphony.xwork2.util.ValueStack;
/**
* @see Form
*/
public class FormDirective {
protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new Form(stack, req, res);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,3 +1,5 @@
<a dojoType="struts:BindAnchor"
<#include "/${parameters.templateDir}/ajax/ajax-common.ftl" />
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
>
@@ -92,6 +92,7 @@
dataFieldName="${parameters.dataFieldName?html}"
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
>
<#if parameters.list?exists>
<#if (parameters.headerKey?exists && parameters.headerValue?exists)>
@@ -7,5 +7,4 @@
${tag.addParameter('onblur', "validate(this);")}
</#if>
</#if>
<#include "/${parameters.templateDir}/${themeProperties.parent}/controlheader.ftl" />
@@ -0,0 +1,73 @@
<script type="text/javascript">
dojo.require("dojo.widget.DatePicker");
</script>
<div
<#if parameters.type?if_exists == "date">
dojoType="dropdowndatepicker"<#rt/>
<#else>
dojoType="struts:StrutsTimePicker"<#rt/>
</#if>
<#if parameters.id?if_exists != "">
id="${parameters.id?html}"<#rt/>
</#if>
<#if parameters.nameValue?if_exists != "">
value="${parameters.nameValue?html}"<#rt/>
</#if>
<#if parameters.language?if_exists != "">
lang="${parameters.language?html}"<#rt/>
</#if>
<#if parameters.name?if_exists != "">
name="dojo.${parameters.name?html}"<#rt/>
inputName="${parameters.name?html}"<#rt/>
</#if>
<#if parameters.displayWeeks?if_exists != "">
displayWeeks="${parameters.displayWeeks?html}"<#rt/>
</#if>
<#if parameters.adjustWeeks?exists>
adjustWeeks="${parameters.adjustWeeks?string?html}"<#rt/>
</#if>
<#if parameters.startDate?if_exists != "">
startDate="${parameters.startDate?html}"<#rt/>
</#if>
<#if parameters.endDate?if_exists != "">
endDate="${parameters.endDate?html}"<#rt/>
</#if>
<#if parameters.weekStartsOn?if_exists != "">
weekStartsOn="${parameters.weekStartsOn?html}"<#rt/>
</#if>
<#if parameters.staticDisplay?exists>
staticDisplay="${parameters.staticDisplay?string?html}"<#rt/>
</#if>
<#if parameters.dayWidth?if_exists != "">
dayWidth="${parameters.dayWidth?html}"<#rt/>
</#if>
<#if parameters.tabindex?if_exists != "">
tabindex="${parameters.tabindex?html}"<#rt/>
</#if>
<#if parameters.cssClass?if_exists != "">
class="${parameters.cssClass?html}"<#rt/>
</#if>
<#if parameters.cssStyle?if_exists != "">
style="${parameters.cssStyle?html}"<#rt/>
</#if>
<#if parameters.iconPath?if_exists != "">
iconURL="<@s.url value='${parameters.iconPath}' encode="false" includeParams='none'/>"<#rt/>
</#if>
<#if parameters.formatLength?if_exists != "">
formatLength="${parameters.formatLength?html}"<#rt/>
</#if>
<#if parameters.displayFormat?if_exists != "">
displayFormat="${parameters.displayFormat?html}"<#rt/>
</#if>
<#if parameters.toggleType?if_exists != "">
containerToggle="${parameters.toggleType?html}"<#rt/>
</#if>
<#if parameters.toggleDuration?exists>
containerToggleDuration="${parameters.toggleDuration?string?html}"<#rt/>
</#if>
<#if parameters.templateCssPath?exists>
templateCssPath="<@s.url value='${parameters.templateCssPath}' encode="false" includeParams='none'/>"
</#if>
saveFormat="rfc"<#rt/>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
></div>
@@ -22,4 +22,5 @@
</#if>
<#include "/${parameters.templateDir}/ajax/ajax-common.ftl" />
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
>
@@ -3,7 +3,7 @@
<script type="text/javascript" src="${base}/dwr/interface/validator.js"></script>
<script type="text/javascript" src="${base}/dwr/engine.js"></script>
<script type="text/javascript" src="${base}/struts/ajax/validation.js"></script>
<script type="text/javascript" src="${base}/struts/${themeProperties.parent}/validation.js"></script>
<script type="text/javascript" src="${base}/struts/ajax/validation.js"></script>
</#if>
<form<#rt/>
<#if parameters.namespace?exists>
@@ -1,5 +1,3 @@
<#--include "/${parameters.templateDir}/xhtml/head.ftl" /-->
<#include "/${parameters.templateDir}/${themeProperties.parent}/head.ftl" />
<script language="JavaScript" type="text/javascript"
src="<@s.url value='/struts/ajax/dojoRequire.js' includeParams='none' encode='false' />"></script>
<script language="JavaScript" type="text/javascript"
@@ -1,5 +1,3 @@
<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<textarea<#rt/>
dojoType="Editor2"
<#if parameters.editorControls?exists>
@@ -39,7 +37,4 @@
<#if parameters.nameValue?exists>
<@s.property value="parameters.nameValue"/><#t/>
</#if>
</textarea>
<#--include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /-->
<#include "/${parameters.templateDir}/${themeProperties.parent}/controlfooter.ftl" />
</textarea>
@@ -1 +1 @@
parent=xhtml
@@ -1,7 +1,7 @@
<input
dojoType="struts:ComboBox"
id="f"
dataUrl="a"
id="f"
forceValidOption="false"
searchType="B"
autoComplete="true"
@@ -1,23 +1,19 @@
<tr>
<td class="tdLabel"></td>
<td>
<script type="text/javascript">
dojo.require("dojo.widget.DatePicker");
</script>
<div dojoType="dropdowndatepicker"
id="id"
lang="i"
name="dojo.h"
inputName="h"
displayWeeks="true"
adjustWeeks="true"
startDate="e"
endDate="d"
weekStartsOn="g"
staticDisplay="false"
templateCssPath="j"
saveFormat="rfc">
</div>
</td>
</tr>
<script type="text/javascript">
dojo.require("dojo.widget.DatePicker");
</script>
<div dojoType="dropdowndatepicker"
id="id"
lang="i"
name="dojo.h"
inputName="h"
displayWeeks="true"
adjustWeeks="true"
startDate="e"
endDate="d"
weekStartsOn="g"
staticDisplay="false"
templateCssPath="j"
saveFormat="rfc">
</div>