diff --git a/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java b/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java deleted file mode 100644 index e98d92504..000000000 --- a/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * $Id$ - * - * Copyright 2006 The Apache Software Foundation. - * - * Licensed 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.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.views.annotations.StrutsTagAttribute; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * AbstractRemoteCallUIBean is superclass for all components dealing with remote - * calls. - */ -/** - * TODO: Document AbstractRemoteCallUIBean. - * - * @author $Author$ - * @version $Revision$ $Date$ - */ -public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements RemoteUICallBean { - - protected String href; - protected String errorText; - protected String afterLoading; - protected String beforeLoading; - protected String executeScripts; - protected String loadingText; - protected String listenTopics; - protected String handler; - protected String formId; - protected String formFilter; - protected String notifyTopics; - protected String showErrorTransportText; - protected String indicator; - protected String showLoadingText; - - public AbstractRemoteCallUIBean(ValueStack stack, HttpServletRequest request, - HttpServletResponse response) { - super(stack, request, response); - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (href != null) - addParameter("href", findString(href)); - if (errorText != null) - addParameter("errorText", findString(errorText)); - if (loadingText != null) - addParameter("loadingText", findString(loadingText)); - if (afterLoading != null) - addParameter("afterLoading", findString(afterLoading)); - if (beforeLoading != null) - addParameter("beforeLoading", findString(beforeLoading)); - if (executeScripts != null) - addParameter("executeScripts", findValue(executeScripts, Boolean.class)); - if (listenTopics != null) - addParameter("listenTopics", findValue(listenTopics, String.class)); - if (notifyTopics != null) - addParameter("notifyTopics", findValue(notifyTopics, String.class)); - if (handler != null) - addParameter("handler", findString(handler)); - if (formId != null) - addParameter("formId", findString(formId)); - if (formFilter != null) - addParameter("formFilter", findString(formFilter)); - if (indicator != null) - addParameter("indicator", findString(indicator)); - if (showErrorTransportText != null) - addParameter("showErrorTransportText", findValue(showErrorTransportText, Boolean.class)); - else - addParameter("showErrorTransportText", true); - if (showLoadingText != null) - addParameter("showLoadingText", findString(showLoadingText)); - } - - - @StrutsTagAttribute(description="Topic that will trigger the remote call") - public void setListenTopics(String listenTopics) { - this.listenTopics = listenTopics; - } - - @StrutsTagAttribute(description="The URL to call to obtain the content. Note: If used with ajax context, the value must be set as an url tag value.") - public void setHref(String href) { - this.href = href; - } - - - @StrutsTagAttribute(description="The text to display to the user if the is an error fetching the content") - public void setErrorText(String errorText) { - this.errorText = errorText; - } - - - /* (non-Javadoc) - * @see org.apache.struts2.components.RemoteUICallBean#setAfterLoading(java.lang.String) - */ - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - - /* (non-Javadoc) - * @see org.apache.struts2.components.RemoteUICallBean#setBeforeLoading(java.lang.String) - */ - public void setBeforeLoading(String beforeLoading) { - this.beforeLoading = beforeLoading; - } - - - @StrutsTagAttribute(description="Javascript code in the fetched content will be executed", type="Boolean", defaultValue="false") - public void setExecuteScripts(String executeScripts) { - this.executeScripts = executeScripts; - } - - @StrutsTagAttribute(description="Text to be shown while content is being fetched", defaultValue="Loading...") - public void setLoadingText(String loadingText) { - this.loadingText = loadingText; - } - - - @StrutsTagAttribute(description="Javascript function name that will make the request") - public void setHandler(String handler) { - this.handler = handler; - } - - - @StrutsTagAttribute(description="Function name used to filter the fields of the form.") - public void setFormFilter(String formFilter) { - this.formFilter = formFilter; - } - - @StrutsTagAttribute(description="Form id whose fields will be serialized and passed as parameters") - public void setFormId(String formId) { - this.formId = formId; - } - - @StrutsTagAttribute(description="Topics that will published when the remote call completes") - public void setNotifyTopics(String notifyTopics) { - this.notifyTopics = notifyTopics; - } - - - @StrutsTagAttribute(description="Set whether errors will be shown or not", type="Boolean", defaultValue="true") - public void setShowErrorTransportText(String showError) { - this.showErrorTransportText = showError; - } - - @StrutsTagAttribute(description="Id of element that will be shown while making request") - public void setIndicator(String indicator) { - this.indicator = indicator; - } - - @StrutsTagAttribute(description="Show loading text on targets", type="Boolean", defaultValue="true") - public void setShowLoadingText(String showLoadingText) { - this.showLoadingText = showLoadingText; - } -} diff --git a/core/src/main/java/org/apache/struts2/components/Anchor.java b/core/src/main/java/org/apache/struts2/components/Anchor.java index e0bc6b46a..2c9383b67 100644 --- a/core/src/main/java/org/apache/struts2/components/Anchor.java +++ b/core/src/main/java/org/apache/struts2/components/Anchor.java @@ -31,109 +31,29 @@ import com.opensymphony.xwork2.util.ValueStack; /** * * - * A tag that creates a HTML <a href='' /> that when clicked calls a URL remote XMLHttpRequest call via the dojo - * framework.

- * - * - * THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED - *

- * 'resultDivId' Deprecated. Use targets.

- * 'targets' is a list of element ids whose content will be updated with the - * text returned from request.

- * 'errorText' is the text that will be displayed when there is an error making the request.

- * 'onLoadJS' Deprecated. Use 'notifyTopics'.

- * 'preInvokeJS' Deprecated. Use 'notifyTopics'.

- * 'executeScripts' if set to true will execute javascript sections in the returned text.

- * 'loadingText' is the text that will be displayed on the 'targets' elements while making the - * request.

- * 'handler' is the name of the function that will take care of making the AJAX request. Dojo's widget - * and dom node are passed as parameters).

- * 'formId' is the id of the html form whose fields will be seralized and passed as parameters - * in the request.

- * 'formFilter' is the name of a function which will be used to filter the fields that will be - * seralized. This function takes as a parameter the element and returns true if the element - * should be included.

- * 'listenTopics' comma separated list of topics names, that will trigger a request - * 'indicator' element to be shown while the request executing - * 'showErrorTransportText': whether errors should be displayed (on 'targets')

- * 'showLoadingText' show loading text on targets

- * 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:

- *

+ * A tag that creates a HTML <a >.

* - * + * *

Examples * *

  * 
- * <s:a id="link1" theme="ajax" href="/DoIt.action" errorText="An error ocurred" loadingText="Loading...">
+ * <s:a id="link1" theme="ajax" href="/DoIt.action">
  *     <img border="none" src="<%=request.getContextPath()%>/images/delete.gif"/>
  *     <s:param name="id" value="1"/>
  * </s:a>
  * 
  * 
* - *

- * - * - * - * Results in - * - * - * - *

- * - *
- * 
- * <a dojoType="BindAnchor" executeScripts="true" id="link1" href="/DoIt.action?id=1" errorText="An error ocurred"></a>
- * 
- * 
- * - *

- * - * - * - * Here is an example that uses the beforeLoading. This example is in altSyntax=true: - * - * - * - *

- * - *
- * 
- * <s:a id="test" theme="ajax" href="/simpeResult.action" beforeLoading="confirm('Are you sure?')">
- *  A
- * </s:a>
- * 
- * 
- * */ @StrutsTag(name="a", tldTagClass="org.apache.struts2.views.jsp.ui.AnchorTag", description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets") -public class Anchor extends AbstractRemoteCallUIBean { +public class Anchor extends ClosingUIBean { public static final String OPEN_TEMPLATE = "a"; public static final String TEMPLATE = "a-close"; public static final String COMPONENT_NAME = Anchor.class.getName(); - protected String targets; - + protected String href; + public Anchor(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); } @@ -145,27 +65,16 @@ public class Anchor extends AbstractRemoteCallUIBean { protected String getDefaultTemplate() { return TEMPLATE; } - + public void evaluateExtraParams() { super.evaluateExtraParams(); - if(targets != null) - addParameter("targets", findString(targets)); + if (href != null) + addParameter("href", findString(href)); } - - @StrutsTagAttribute(description="Comma delimited list of ids of the elements whose content will be updated") - public void setTargets(String targets) { - this.targets = targets; - } - - @StrutsTagAttribute(name="onLoadJS", description="Deprecated. Use 'notifyTopics'. Javascript code execute after reload") - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - - @StrutsTagAttribute(name="preInvokeJS", description="Deprecated. Use 'notifyTopics'. Javascript code execute before reload") - public void setBeforeLoading(String beforeLoading) { - this.beforeLoading = beforeLoading; + + @StrutsTagAttribute(description="The URL.") + public void setHref(String href) { + this.href = href; } } diff --git a/core/src/main/java/org/apache/struts2/components/Autocompleter.java b/core/src/main/java/org/apache/struts2/components/Autocompleter.java deleted file mode 100644 index 70fed88d7..000000000 --- a/core/src/main/java/org/apache/struts2/components/Autocompleter.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * $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.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.views.annotations.StrutsTag; -import org.apache.struts2.views.annotations.StrutsTagAttribute; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

The autocomplete tag is a combobox that can autocomplete text entered on the input box. - * When used on the "simple" theme, the autocompleter can be used like the ComboBox. - * When used on the "ajax" theme, the list can be retieved from an action.

- * - * - * THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED - * - * 'dropdownWidth' width in pixels of the drodpdown, same as autocompleter's width by default

- * 'dropdownHeight' height in pixels of the drodown, 120 px by default

- * 'forceValidOption' if invalid option is selected, clear autocompleter's text when focus is lost

- * 'autoComplete', if true, make suggestions on the textbox

- * 'formId' is the id of the html form whose fields will be seralized and passed as parameters - * in the request.

- * 'formFilter' is the name of a function which will be used to filter the fields that will be - * seralized. This function takes as a parameter the element and returns true if the element - * should be included.

- * 'listenTopics' comma separated list of topics names, that will trigger a request - * 'indicator' element to be shown while the request executing - * 'showErrorTransportText': whether errors should be displayed (on 'targets')

- * 'loadOnTextChange' options will be reloaded everytime a character is typed on the textbox

- * 'loadMinimumCount' minimum number of characters that will force the content to be loaded

- * 'showDownError' show or hide the down arrow button

- * 'searchType' how the search must be performed, options are: "startstring", "startword" and "substring"

- * 'keyName' name of the field to which the selected key will be assigned

- * 'iconPath' path of icon used for the dropdown

- * 'templateCssPath' path to css file used to customize Dojo's widget

- * 'dataFieldName' name of the field to be used as the list in the returned JSON string

- * 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:

- *