diff --git a/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java b/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java index 95c0fc93d..4c4540920 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java @@ -105,9 +105,8 @@ public class HttpHeaderResult implements Result { * @param parse true if HTTP header values should be evaluated agains the ValueStack, false * otherwise. */ - public HttpHeaderResult setParse(boolean parse) { + public void setParse(boolean parse) { this.parse = parse; - return this; } /** @@ -116,9 +115,8 @@ public class HttpHeaderResult implements Result { * @param status the Http status code * @see javax.servlet.http.HttpServletResponse#setStatus(int) */ - public HttpHeaderResult setStatus(int status) { + public void setStatus(int status) { this.status = status; - return this; } /** @@ -126,9 +124,8 @@ public class HttpHeaderResult implements Result { * @param name * @param value */ - public HttpHeaderResult addHeader(String name, String value) { + public void addHeader(String name, String value) { headers.put(name, value); - return this; } /** diff --git a/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java b/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java index 671eeef44..62490a4f0 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java @@ -101,9 +101,8 @@ public class PlainTextResult extends StrutsResultSupport { * * @param charSet The character set */ - public PlainTextResult setCharSet(String charSet) { + public void setCharSet(String charSet) { this.charSet = charSet; - return this; } /* (non-Javadoc) diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java index 4d4a92072..33222a810 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java @@ -204,9 +204,8 @@ public class ServletActionRedirectResult extends ServletRedirectResult { * * @param actionName The name */ - public ServletActionRedirectResult setActionName(String actionName) { + public void setActionName(String actionName) { this.actionName = actionName; - return this; } /** @@ -214,9 +213,8 @@ public class ServletActionRedirectResult extends ServletRedirectResult { * * @param namespace The namespace */ - public ServletActionRedirectResult setNamespace(String namespace) { + public void setNamespace(String namespace) { this.namespace = namespace; - return this; } /** @@ -224,9 +222,8 @@ public class ServletActionRedirectResult extends ServletRedirectResult { * * @param method The method */ - public ServletActionRedirectResult setMethod(String method) { + public void setMethod(String method) { this.method = method; - return this; } /** diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 86ddba8ce..5eee5b9b3 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -94,9 +94,8 @@ public class ServletRedirectResult extends StrutsResultSupport { * @param prependServletContext true to prepend the location with the servlet context path, * false otherwise. */ - public ServletRedirectResult setPrependServletContext(boolean prependServletContext) { + public void setPrependServletContext(boolean prependServletContext) { this.prependServletContext = prependServletContext; - return this; } /** diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java b/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java index a698164b5..6f4f0a044 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java @@ -104,9 +104,8 @@ public class StreamResult extends StrutsResultSupport { /** * @param bufferSize The bufferSize to set. */ - public StreamResult setBufferSize(int bufferSize) { + public void setBufferSize(int bufferSize) { this.bufferSize = bufferSize; - return this; } /** @@ -119,9 +118,8 @@ public class StreamResult extends StrutsResultSupport { /** * @param contentType The contentType to set. */ - public StreamResult setContentType(String contentType) { + public void setContentType(String contentType) { this.contentType = contentType; - return this; } /** @@ -134,9 +132,8 @@ public class StreamResult extends StrutsResultSupport { /** * @param contentLength The contentLength to set. */ - public StreamResult setContentLength(String contentLength) { + public void setContentLength(String contentLength) { this.contentLength = contentLength; - return this; } /** @@ -149,9 +146,8 @@ public class StreamResult extends StrutsResultSupport { /** * @param contentDisposition the Content-disposition header value to use. */ - public StreamResult setContentDisposition(String contentDisposition) { + public void setContentDisposition(String contentDisposition) { this.contentDisposition = contentDisposition; - return this; } /** @@ -164,9 +160,8 @@ public class StreamResult extends StrutsResultSupport { /** * @param inputName The inputName to set. */ - public StreamResult setInputName(String inputName) { + public void setInputName(String inputName) { this.inputName = inputName; - return this; } /** diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java index 326073493..ac6105df0 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java @@ -113,9 +113,8 @@ public class FreemarkerResult extends StrutsResultSupport { super(location); } - public FreemarkerResult setContentType(String aContentType) { + public void setContentType(String aContentType) { pContentType = aContentType; - return this; } /** diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java b/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java index 49b6b5441..b5d3c5aa9 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java @@ -73,9 +73,8 @@ public class PortletFreemarkerResult extends StrutsResultSupport { super(location); } - public PortletFreemarkerResult setContentType(String aContentType) { + public void setContentType(String aContentType) { pContentType = aContentType; - return this; } /** diff --git a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java index 93f496b0b..b0ee149cb 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java @@ -214,11 +214,10 @@ public class XSLTResult implements Result { setStylesheetLocation(location); } - public XSLTResult setStylesheetLocation(String location) { + public void setStylesheetLocation(String location) { if (location == null) throw new IllegalArgumentException("Null location"); this.stylesheetLocation = location; - return this; } public String getStylesheetLocation() { @@ -230,9 +229,8 @@ public class XSLTResult implements Result { * * @param parse */ - public XSLTResult setParse(boolean parse) { + public void setParse(boolean parse) { this.parse = parse; - return this; } public void execute(ActionInvocation invocation) throws Exception { diff --git a/trunk/all/pom.xml b/trunk/all/pom.xml deleted file mode 100644 index 9ae365fae..000000000 --- a/trunk/all/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-parent - 2.0.1 - - org.apache.struts - struts2-all - jar - Combined Struts 2 Jar - - - - org.codehaus.mojo - dependency-maven-plugin - - - unjar-deps - compile - - unpack - - - - - org.apache.struts - struts2-core - ${version} - - - org.apache.struts - struts2-api - ${version} - - - - org.apache.struts - - struts2-config-browser-plugin - - ${version} - - - org.apache.struts - - struts2-jasperreports-plugin - - ${version} - - - org.apache.struts - - struts2-jfreechart-plugin - - ${version} - - - org.apache.struts - - struts2-jsf-plugin - - ${version} - - - org.apache.struts - - struts2-pell-multipart-plugin - - ${version} - - - org.apache.struts - - struts2-plexus-plugin - - ${version} - - - org.apache.struts - - struts2-quickstart-plugin - - ${version} - - - org.apache.struts - - struts2-sitegraph-plugin - - ${version} - - - org.apache.struts - - struts2-sitemesh-plugin - - ${version} - - - org.apache.struts - - struts2-struts1-plugin - - ${version} - - - org.apache.struts - - struts2-tiles-plugin - - ${version} - - - - ${project.build.directory}/classes - - - - - - - diff --git a/trunk/api/pom.xml b/trunk/api/pom.xml deleted file mode 100644 index 801b1425f..000000000 --- a/trunk/api/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-parent - 2.0.1 - - org.apache.struts - struts2-api - jar - Struts 2 API - - - javax.servlet - servlet-api - 2.4 - provided - - - junit - junit - 3.8.1 - test - - true - - - org.easymock - easymock - test - 2.0 - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - false - - - - - diff --git a/trunk/api/src/main/java/org/apache/struts2/Action.java b/trunk/api/src/main/java/org/apache/struts2/Action.java deleted file mode 100644 index ded7942b1..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/Action.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.struts2; - -/** - * Default action interface. Provided purely for user convenience. Struts does not require actions to implement any - * interfaces. Actions need only implement a public, no argument method which returns {@code String}. If a user does - * not specify a method name, Struts defaults to {@code execute()}. - * - *

For example: - * - *

- *   static import ResultNames.*;
- *
- *   public class MyAction implements Action {
- *
- *     public String execute() {
- *       return SUCCESS;
- *     }
- *   }
- * 
- * - *

is equivalent to: - * - *

- *   static import ResultNames.*;
- *
- *   public class MyAction {
- *
- *     public String execute() {
- *       return SUCCESS;
- *     }
- *   }
- * 
- * - * @author crazybob@google.com (Bob Lee) - */ -public interface Action { - - /** - * Executes this action. - * - * @return result name which matches a result name from the action mapping in the configuration file. See {@link - * ResultNames} for common suggestions. - */ - String execute(); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/MessageAware.java b/trunk/api/src/main/java/org/apache/struts2/MessageAware.java deleted file mode 100644 index 70357b95e..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/MessageAware.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.apache.struts2; - -/** - * Implemented by actions which may need to record errors or messages. - * - *
- *   static import ResultNames.*;
- *
- *   public class SetName implements MessageAware {
- *
- *     Messages messages;
- *     String name;
- *
- *     public String execute() {
- *       return SUCCESS;
- *     }
- *
- *     public void setName(String name) {
- *       if ("".equals(name))
- *         messages.forField("name").addError("name.required");
- *
- *       this.name = name;
- *     }
- *
- *     public void setMessages(Messages messages) {
- *       this.messages = messages;
- *     }
- *   }
- * 
- * - * @author crazybob@google.com (Bob Lee) - */ -public interface MessageAware { - - /** - * Sets messages. - * - * @param messages messages - */ - void setMessages(Messages messages); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/Messages.java b/trunk/api/src/main/java/org/apache/struts2/Messages.java deleted file mode 100644 index d3a3d29f0..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/Messages.java +++ /dev/null @@ -1,196 +0,0 @@ -package org.apache.struts2; - -import java.util.List; -import java.util.Set; -import java.util.Map; - -/** - * Collection of messages. Supports nesting messages by field name. - * - *

Uses keys when adding instead of actual messages to decouple code from messages. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface Messages { - - // TODO: Use Object[] for args instead of String[]. - - /** - * Message severity. - */ - public enum Severity { - - /** - * Informational messages. - */ - INFO, - - /** - * Warning messages. - */ - WARN, - - /** - * Error messages. - */ - ERROR, - } - - /** - * Gets nested messages for the given field. - * - *

Supports dot notation to represent nesting. For example: - * - *

-     * messages.forField("foo").forField("bar") == messages.forField("foo.bar")
-     * 
- * - * @param fieldName name of the field - * @return nested {@code Messages} for given field name - */ - Messages forField(String fieldName); - - /** - * Gets map of field name to messages for that field. - * - * @return map of field name to {@code Messages} - */ - Map forFields(); - - /** - * Adds informational message. - * - * @param key message key - * @see Severity.INFO - */ - void addInformation(String key); - - /** - * Adds informational message. - * - * @param key message key - * @param arguments message arguments - * @see Severity.INFO - */ - void addInformation(String key, String... arguments); - - /** - * Adds warning message. - * - * @param key message key - * @see Severity.WARN - */ - void addWarning(String key); - - /** - * Adds warning message. - * - * @param key message key - * @param arguments message arguments - * @see Severity.WARN - */ - void addWarning(String key, String... arguments); - - /** - * Adds error message. - * - * @param key message key - * @see Severity.ERROR - */ - void addError(String key); - - /** - * Adds error message. - * - * @param key message key - * @param arguments message arguments - * @see Severity.ERROR - */ - void addError(String key, String... arguments); - - /** - * Adds message. - * - * @param severity message severity - * @param key message key - */ - void add(Severity severity, String key); - - /** - * Adds request-scoped message. - * - * @param severity message severity - * @param key message key - * @param arguments message arguments - */ - void add(Severity severity, String key, String... arguments); - - /** - * Gets set of severities for which this {@code Messages} instance has messages. Not recursive. - * - * @return unmodifiable set of {@link Severity} sorted from least to most severe - */ - Set getSeverities(); - - /** - * Gets message strings for the given severity. Not recursive. - * - * @param severity message severity - * @return unmodifiable list of messages - */ - List forSeverity(Severity severity); - - /** - * Gets error message strings for this {@code Messages} instance. Not recursive. - * - * @return unmodifiable list of messages - */ - List getErrors(); - - /** - * Gets error message strings for this {@code Messages} instance. Not recursive. - * - * @return unmodifiable list of messages - */ - List getWarnings(); - - /** - * Gets informational message strings for this {@code Messages} instance. Not recursive. - * - * @return unmodifiable list of messages - */ - List getInformation(); - - /** - * Returns true if this or a nested {@code Messages} instance has error messages. - * - * @see Severity.ERROR - */ - boolean hasErrors(); - - /** - * Returns true if this or a nested {@code Messages} instance has warning messages. - * - * @see Severity.WARN - */ - boolean hasWarnings(); - - /** - * Returns true if this or a nested {@code Messages} instance has informational messages. - * - * @see Severity.INFO - */ - boolean hasInformation(); - - /** - * Returns true if this and all nested {@code Messages} instances have no messages. - */ - boolean isEmpty(); - - /** - * Returns true if this and all nested {@code Messages} instances have no messages for the given severity. - * - * @param severity message severity - */ - boolean isEmpty(Severity severity); -} \ No newline at end of file diff --git a/trunk/api/src/main/java/org/apache/struts2/ResultNames.java b/trunk/api/src/main/java/org/apache/struts2/ResultNames.java deleted file mode 100644 index 1a93a7d89..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/ResultNames.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.apache.struts2; - -/** - * Commonly used result names returned by action methods. - * - * @author crazybob@google.com (Bob Lee) - */ -public final class ResultNames { - - private ResultNames() {} - - /** - * The action executed successfully. - */ - public static final String SUCCESS = "success"; - - /** - * The action requires more input, i.e. a validation error occurred. - */ - public static final String INPUT = "input"; - - /** - * The action requires the user to log in before executing. - */ - public static final String LOGIN = "login"; - - /** - * The action execution failed irrecoverably. - */ - public static final String ERROR = "error"; - - /** - * The action executed successfully, but do not execute a result. - */ - public static final String NONE = "none"; -} diff --git a/trunk/api/src/main/java/org/apache/struts2/Validatable.java b/trunk/api/src/main/java/org/apache/struts2/Validatable.java deleted file mode 100644 index b3eef9c88..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/Validatable.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.apache.struts2; - -import org.apache.struts2.MessageAware; - -/** - * Implemented by actions which wish to execute some validation logic before their action method. Useful for - * cross-field validations. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface Validatable extends MessageAware { - - /** - * Validates input. Executes before action method. - */ - public void validate(); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/servlet/ParameterAware.java b/trunk/api/src/main/java/org/apache/struts2/servlet/ParameterAware.java deleted file mode 100644 index 1dcfbe4b3..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/servlet/ParameterAware.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.struts2.servlet; - -import java.util.Map; - -/** - * Implemented by actions which need direct access to the request parameters. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface ParameterAware { - - /** - * Sets parameters. - * - * @param parameters map of parameter name to parameter values - */ - void setParameters(Map parameters); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/servlet/ServletRequestAware.java b/trunk/api/src/main/java/org/apache/struts2/servlet/ServletRequestAware.java deleted file mode 100644 index 49e110b19..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/servlet/ServletRequestAware.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.struts2.servlet; - -import javax.servlet.http.HttpServletRequest; - -/** - * Implemented by actions which need direct access to the servlet request. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface ServletRequestAware { - - /** - * Sets the servlet request. - * - * @param request servlet request. - */ - void setServletRequest(HttpServletRequest request); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/servlet/ServletResponseAware.java b/trunk/api/src/main/java/org/apache/struts2/servlet/ServletResponseAware.java deleted file mode 100644 index 427e986ac..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/servlet/ServletResponseAware.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.struts2.servlet; - -import javax.servlet.http.HttpServletResponse; - -/** - * Implemented by actions which need direct access to the servlet response. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface ServletResponseAware { - - /** - * Sets the servlet response. - * - * @param response servlet response - */ - void setServletResponse(HttpServletResponse response); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/spi/ActionContext.java b/trunk/api/src/main/java/org/apache/struts2/spi/ActionContext.java deleted file mode 100644 index e45754a0f..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/spi/ActionContext.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.struts2.spi; - -import java.lang.reflect.Method; - -/** - * Context of an action execution. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface ActionContext { - - /** - * Gets action instance. - */ - Object getAction(); - - /** - * Gets action method. - */ - Method getMethod(); - - /** - * Gets action name. - */ - String getActionName(); - - /** - * Gets the path for the action's namespace. - */ - String getNamespacePath(); - - /** - * Gets the {@link Result} instance for the action. - * - * @return {@link Result} instance or {@code null} if we don't have a result yet. - */ - Result getResult(); - - /** - * Adds a result interceptor for the action. Enables executing code before and after a result, executing an - * alternate result, etc. - */ - void addResultInterceptor(Result interceptor); - - /** - * Gets context of action which chained to us. - * - * @return context of previous action or {@code null} if this is the first action in the chain - */ - ActionContext getPrevious(); - - /** - * Gets context of action which this action chained to. - * - * @return context of next action or {@code null} if we haven't chained to another action yet or this is the last - * action in the chain. - */ - ActionContext getNext(); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/spi/Interceptor.java b/trunk/api/src/main/java/org/apache/struts2/spi/Interceptor.java deleted file mode 100644 index 16b27bc17..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/spi/Interceptor.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.apache.struts2.spi; - -/** - * Intercepts an action request. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface Interceptor { - - /** - * Intercepts an action request. - * - * @param requestContext current request context - */ - String intercept(RequestContext requestContext) throws Exception; -} diff --git a/trunk/api/src/main/java/org/apache/struts2/spi/RequestContext.java b/trunk/api/src/main/java/org/apache/struts2/spi/RequestContext.java deleted file mode 100644 index 559e8bde8..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/spi/RequestContext.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.apache.struts2.spi; - -import org.apache.struts2.Messages; - -import javax.servlet.ServletContext; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** - * Request context. A single request may span multiple actions with action chaining. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface RequestContext { - - /** - * Gets context of the currently executing action. - * - * @return current action context - */ - ActionContext getActionContext(); - - /** - * Convenience method. Equivalent to {@code getActionContext().getAction()}. - * - * @return currently executing action - */ - Object getAction(); - - /** - * Gets map of request parameters. - */ - Map getParameterMap(); - - /** - * Gets map of request attributes. - */ - Map getAttributeMap(); - - /** - * Gets map of session attributes. - */ - Map getSessionMap(); - - /** - * Gets map of application (servlet context) attributes. - */ - Map getApplicationMap(); - - /** - * Finds cookies with the given name, - */ - List findCookiesForName(String name); - - /** - * Gets locale. - */ - Locale getLocale(); - - /** - * Sets locale. Stores the locale in the session for future requests. - */ - void setLocale(Locale locale); - - /** - * Gets messages. - */ - Messages getMessages(); - - /** - * Gets the servlet request. - */ - HttpServletRequest getServletRequest(); - - /** - * Gets the servlet response. - */ - HttpServletResponse getServletResponse(); - - /** - * Gets the servlet context. - */ - ServletContext getServletContext(); - - /** - * Gets the value stack. - */ - ValueStack getValueStack(); - - /** - * Invokes the next interceptor or the action method if no more interceptors remain. - * - * @return result name - * @throws IllegalStateException if already invoked or called from the action - */ - String proceed() throws Exception; -} diff --git a/trunk/api/src/main/java/org/apache/struts2/spi/RequestContextAware.java b/trunk/api/src/main/java/org/apache/struts2/spi/RequestContextAware.java deleted file mode 100644 index 2bd6797f2..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/spi/RequestContextAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.apache.struts2.spi; - -import org.apache.struts2.spi.RequestContext; - -/** - * Implemented by actions that need access to the current {@link org.apache.struts2.spi.RequestContext}. Use - * judiciously. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface RequestContextAware { - - /** - * Sets {@link org.apache.struts2.spi.RequestContext}. - * - * @param requestContext - */ - void setRequestContext(RequestContext requestContext); -} diff --git a/trunk/api/src/main/java/org/apache/struts2/spi/Result.java b/trunk/api/src/main/java/org/apache/struts2/spi/Result.java deleted file mode 100644 index 6cb4ecd61..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/spi/Result.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.struts2.spi; - -import org.apache.struts2.spi.RequestContext; - -/** - * The result of an action request. Struts creates a new {@code Result} instance for each request. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface Result { - - /** - * Executes result. - * - * @param requestContext - */ - void execute(RequestContext requestContext) throws Exception; -} diff --git a/trunk/api/src/main/java/org/apache/struts2/spi/ValueStack.java b/trunk/api/src/main/java/org/apache/struts2/spi/ValueStack.java deleted file mode 100644 index b3cd87b00..000000000 --- a/trunk/api/src/main/java/org/apache/struts2/spi/ValueStack.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.apache.struts2.spi; - -/** - * A central fixture of the Struts framework, the {@code ValueStack} is a stack which contains the actions - * which have executed in addition to other objects. Users can get and set values on the stack using expressions. The - * {@code ValueStack} will search down the stack starting with the most recent objects until it finds an object to - * which the expression can apply. - * - * @author crazybob@google.com (Bob Lee) - */ -public interface ValueStack extends Iterable { - - /** - * Gets the top, most recent object from the stack without changing the stack. - * - * @return the top object - */ - Object peek(); - - /** - * Removes the top, most recent object from the stack. - * - * @return the top object - */ - Object pop(); - - /** - * Pushes an object onto the stack. - * - * @param o - */ - void push(Object o); - - /** - * Creates a shallow copy of this stack. - * - * @return a new stack which contains the same objects as this one - */ - ValueStack clone(); - - /** - * Queries the stack. Starts with the top, most recent object. If the expression can apply to the object, this - * method returns the result of evaluating the expression. If the expression does not apply, this method moves - * down the stack to the next object and repeats. Returns {@code null} if the expression doesn't apply to any - * objects. - * - * @param expression - * @return the evaluation of the expression against the first applicable object in the stack - */ - Object get(String expression); - - /** - * Queries the stack and converts the result to the specified type. Starts with the top, most recent object. If - * the expression can apply to the object, this method returns the result of evaluating the expression converted - * to the specified type. If the expression does not apply, this method moves down the stack to the next object - * and repeats. Returns {@code null} if the expression doesn't apply to any objects. - * - * @param expression - * @param asType the type to convert the result to - * @return the evaluation of the expression against the first applicable object in the stack converted to the - * specified type - */ - T get(String expression, Class asType); - - /** - * Queries the stack and converts the result to a {@code String}. Starts with the top, most recent object. If the - * expression can apply to the object, this method returns the result of evaluating the expression converted to a - * {@code String}. If the expression does not apply, this method moves down the stack to the next object and - * repeats. Returns {@code null} if the expression doesn't apply to any objects. - * - * @param expression - * @return the evaluation of the expression against the first applicable object in the stack converted to a {@code - * String} - */ - String getString(String expression); - - /** - * Sets a value on an object from the stack. This method starts at the top, most recent object. If the expression - * applies to that object, this methods sets the given value on that object using the expression and converting - * the type as necessary. If the expression does not apply, this method moves to the next object and repeats. - * - * @param expression - * @param value - */ - void set(String expression, Object value); - - /** - * Returns the number of object on the stack. - * - * @return size of stack - */ - int size(); -} diff --git a/trunk/apps/blank/README.txt b/trunk/apps/blank/README.txt deleted file mode 100644 index db14cea57..000000000 --- a/trunk/apps/blank/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -README.txt - blank - -This is an "empty" application that you can deploy as the basis of your own -application. - -For more on getting started with Struts, see - -* http://cwiki.apache.org/WW/home.html - ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/trunk/apps/blank/pom.xml b/trunk/apps/blank/pom.xml deleted file mode 100644 index 96c0d2bf2..000000000 --- a/trunk/apps/blank/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-apps - 2.0.1 - - org.apache.struts - struts2-blank - war - Blank Webapp - - - - javax.servlet - servlet-api - 2.4 - provided - - - - - - - - org.mortbay.jetty - maven-jetty6-plugin - - 10 - - - - org.apache.geronimo.specs - geronimo-j2ee_1.4_spec - 1.0 - provided - - - - - - - - diff --git a/trunk/apps/blank/src/main/java/example/ExampleSupport.java b/trunk/apps/blank/src/main/java/example/ExampleSupport.java deleted file mode 100644 index c86b1fc25..000000000 --- a/trunk/apps/blank/src/main/java/example/ExampleSupport.java +++ /dev/null @@ -1,9 +0,0 @@ -package example; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * Base Action class for the Tutorial package. - */ -public class ExampleSupport extends ActionSupport { -} diff --git a/trunk/apps/blank/src/main/java/example/HelloWorld.java b/trunk/apps/blank/src/main/java/example/HelloWorld.java deleted file mode 100644 index 68f8e7202..000000000 --- a/trunk/apps/blank/src/main/java/example/HelloWorld.java +++ /dev/null @@ -1,40 +0,0 @@ -package example; - -/** - * Set welcome message. - */ -public class HelloWorld extends ExampleSupport { - - public String execute() throws Exception { - setMessage(getText(MESSAGE)); - return SUCCESS; - } - - /** - * Provide default valuie for Message property. - */ - public static final String MESSAGE = "HelloWorld.message"; - - /** - * Field for Message property. - */ - private String message; - - /** - * Return Message property. - * - * @return Message property - */ - public String getMessage() { - return message; - } - - /** - * Set Message property. - * - * @param message Text to display on HelloWorld page. - */ - public void setMessage(String message) { - this.message = message; - } -} diff --git a/trunk/apps/blank/src/main/java/example/Login.java b/trunk/apps/blank/src/main/java/example/Login.java deleted file mode 100644 index a4e6804e5..000000000 --- a/trunk/apps/blank/src/main/java/example/Login.java +++ /dev/null @@ -1,38 +0,0 @@ -package example; - -public class Login extends ExampleSupport { - - public String execute() throws Exception { - - if (isInvalid(getUsername())) return INPUT; - - if (isInvalid(getPassword())) return INPUT; - - return SUCCESS; - } - - private boolean isInvalid(String value) { - return (value == null || value.length() == 0); - } - - private String username; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - private String password; - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - -} \ No newline at end of file diff --git a/trunk/apps/blank/src/main/java/example/build.bat b/trunk/apps/blank/src/main/java/example/build.bat deleted file mode 100644 index a3f4edd01..000000000 --- a/trunk/apps/blank/src/main/java/example/build.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -set CLASSPATH=..\..\..\lib\xwork-2.0-beta-1.jar -javac *.java -d ..\..\..\classes diff --git a/trunk/apps/blank/src/main/resources/example.xml b/trunk/apps/blank/src/main/resources/example.xml deleted file mode 100644 index 5a18fe5a1..000000000 --- a/trunk/apps/blank/src/main/resources/example.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - /example/HelloWorld.jsp - - - - /example/Login.jsp - Menu - - - - /example/{1}.jsp - - - - - diff --git a/trunk/apps/blank/src/main/resources/example/Login-validation.xml b/trunk/apps/blank/src/main/resources/example/Login-validation.xml deleted file mode 100644 index d703ee7a3..000000000 --- a/trunk/apps/blank/src/main/resources/example/Login-validation.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/trunk/apps/blank/src/main/resources/example/package.properties b/trunk/apps/blank/src/main/resources/example/package.properties deleted file mode 100644 index 77d589daf..000000000 --- a/trunk/apps/blank/src/main/resources/example/package.properties +++ /dev/null @@ -1,5 +0,0 @@ -HelloWorld.message= Struts is up and running ... -requiredstring = ${getText(fieldName)} is required. -password = Password -username = User Name -Missing.message = This feature is under construction. Please try again in the next interation. diff --git a/trunk/apps/blank/src/main/resources/example/package_es.properties b/trunk/apps/blank/src/main/resources/example/package_es.properties deleted file mode 100644 index e4740a48b..000000000 --- a/trunk/apps/blank/src/main/resources/example/package_es.properties +++ /dev/null @@ -1,5 +0,0 @@ -HelloWorld.message= ¡Struts está bien! ... -requiredstring = ${getText(fieldName)} se requiere. -password = Contraseña -username = Nombre de Usuario -Missing.message = ¡en obras! ¡seguir intentando! diff --git a/trunk/apps/blank/src/main/resources/struts.properties b/trunk/apps/blank/src/main/resources/struts.properties deleted file mode 100644 index 8c29875f6..000000000 --- a/trunk/apps/blank/src/main/resources/struts.properties +++ /dev/null @@ -1,2 +0,0 @@ -struts.devMode = true -struts.enable.DynamicMethodInvocation = false diff --git a/trunk/apps/blank/src/main/resources/struts.xml b/trunk/apps/blank/src/main/resources/struts.xml deleted file mode 100644 index 67e1a9392..000000000 --- a/trunk/apps/blank/src/main/resources/struts.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/trunk/apps/blank/src/main/webapp/WEB-INF/applicationContext.xml b/trunk/apps/blank/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index afbdcb4cc..000000000 --- a/trunk/apps/blank/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/trunk/apps/blank/src/main/webapp/WEB-INF/web.xml b/trunk/apps/blank/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index c5c245a6e..000000000 --- a/trunk/apps/blank/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - Struts Blank - - - struts2 - org.apache.struts2.dispatcher.FilterDispatcher - - - - struts2 - /* - - - - org.springframework.web.context.ContextLoaderListener - - - - index.html - - - - - diff --git a/trunk/apps/blank/src/main/webapp/example/HelloWorld.jsp b/trunk/apps/blank/src/main/webapp/example/HelloWorld.jsp deleted file mode 100644 index 938c76132..000000000 --- a/trunk/apps/blank/src/main/webapp/example/HelloWorld.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - <s:text name="HelloWorld.message"/> - - - -

- -

Languages

-
    -
  • - - en - - English -
  • -
  • - - es - - Espanol -
  • -
- - - diff --git a/trunk/apps/blank/src/main/webapp/example/Login.jsp b/trunk/apps/blank/src/main/webapp/example/Login.jsp deleted file mode 100644 index 13d2dc4da..000000000 --- a/trunk/apps/blank/src/main/webapp/example/Login.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Sign On - - - - - - - - - - diff --git a/trunk/apps/blank/src/main/webapp/example/Menu.jsp b/trunk/apps/blank/src/main/webapp/example/Menu.jsp deleted file mode 100644 index a74bd2c76..000000000 --- a/trunk/apps/blank/src/main/webapp/example/Menu.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - \ No newline at end of file diff --git a/trunk/apps/blank/src/main/webapp/example/Missing.jsp b/trunk/apps/blank/src/main/webapp/example/Missing.jsp deleted file mode 100644 index 7c01ac9be..000000000 --- a/trunk/apps/blank/src/main/webapp/example/Missing.jsp +++ /dev/null @@ -1,11 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - -Missing Feature - - -

- -

- - diff --git a/trunk/apps/blank/src/main/webapp/example/Register.jsp b/trunk/apps/blank/src/main/webapp/example/Register.jsp deleted file mode 100644 index a74bd2c76..000000000 --- a/trunk/apps/blank/src/main/webapp/example/Register.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - \ No newline at end of file diff --git a/trunk/apps/blank/src/main/webapp/example/Welcome.jsp b/trunk/apps/blank/src/main/webapp/example/Welcome.jsp deleted file mode 100644 index dbd3a22e9..000000000 --- a/trunk/apps/blank/src/main/webapp/example/Welcome.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Welcome - " rel="stylesheet" - type="text/css"/> - - - -

Commands

- - - - diff --git a/trunk/apps/blank/src/main/webapp/index.html b/trunk/apps/blank/src/main/webapp/index.html deleted file mode 100644 index 8747c2483..000000000 --- a/trunk/apps/blank/src/main/webapp/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -

Loading ...

- - diff --git a/trunk/apps/blank/src/test/java/example/ConfigTest.java b/trunk/apps/blank/src/test/java/example/ConfigTest.java deleted file mode 100644 index 9b23765d3..000000000 --- a/trunk/apps/blank/src/test/java/example/ConfigTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package example; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.config.RuntimeConfiguration; -import com.opensymphony.xwork2.config.entities.ActionConfig; -import com.opensymphony.xwork2.config.entities.ResultConfig; -import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; - -import java.util.Map; -import java.util.List; - -import org.apache.struts2.StrutsTestCase; - -public class ConfigTest extends StrutsTestCase { - - protected void assertSuccess(String result) throws Exception { - assertTrue("Expected a success result!", - ActionSupport.SUCCESS.equals(result)); - } - - protected void assertInput(String result) throws Exception { - assertTrue("Expected an input result!", - ActionSupport.INPUT.equals(result)); - } - - protected Map assertFieldErrors(ActionSupport action) throws Exception { - assertTrue(action.hasFieldErrors()); - return action.getFieldErrors(); - } - - protected void assertFieldError(Map field_errors, String field_name, String error_message) { - - List errors = (List) field_errors.get(field_name); - assertNotNull("Expected errors for " + field_name, errors); - assertTrue("Expected errors for " + field_name, errors.size()>0); - // TODO: Should be a loop - assertEquals(error_message,errors.get(0)); - - } - - protected void setUp() throws Exception { - super.setUp(); - XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml"); - configurationManager.addConfigurationProvider(c); - configurationManager.reload(); - } - - protected ActionConfig assertClass(String namespace, String action_name, String class_name) { - RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration(); - ActionConfig config = configuration.getActionConfig(namespace, action_name); - assertNotNull("Mssing action", config); - assertTrue("Wrong class name: [" + config.getClassName() + "]", - class_name.equals(config.getClassName())); - return config; - } - - protected ActionConfig assertClass(String action_name, String class_name) { - return assertClass("", action_name, class_name); - } - - protected void assertResult(ActionConfig config, String result_name, String result_value) { - Map results = config.getResults(); - ResultConfig result = (ResultConfig) results.get(result_name); - Map params = result.getParams(); - String value = (String) params.get("actionName"); - if (value == null) - value = (String) params.get("location"); - assertTrue("Wrong result value: [" + value + "]", - result_value.equals(value)); - } - - public void testConfig() throws Exception { - assertNotNull(configurationManager); - } - -} diff --git a/trunk/apps/blank/src/test/java/example/HelloWorldTest.java b/trunk/apps/blank/src/test/java/example/HelloWorldTest.java deleted file mode 100644 index 6933c32df..000000000 --- a/trunk/apps/blank/src/test/java/example/HelloWorldTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package example; - -import com.opensymphony.xwork2.ActionSupport; -import junit.framework.TestCase; - -public class HelloWorldTest extends TestCase { - - public void testHelloWorld() throws Exception { - HelloWorld hello_world = new HelloWorld(); - String result = hello_world.execute(); - assertTrue("Expected a success result!", - ActionSupport.SUCCESS.equals(result)); - assertTrue("Expected the default message!", - hello_world.getText(HelloWorld.MESSAGE).equals(hello_world.getMessage())); - } -} diff --git a/trunk/apps/blank/src/test/java/example/LoginTest.java b/trunk/apps/blank/src/test/java/example/LoginTest.java deleted file mode 100644 index 1d4669d2a..000000000 --- a/trunk/apps/blank/src/test/java/example/LoginTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package example; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.config.entities.ActionConfig; - -import java.util.Map; -import java.util.Collection; -import java.util.List; - -public class LoginTest extends ConfigTest { - - public void FIXME_testLoginConfig() throws Exception { - ActionConfig config = assertClass("example", "Login!input", "example.Login"); - assertResult(config, ActionSupport.SUCCESS, "Menu"); - assertResult(config, ActionSupport.INPUT, "/example/Login.jsp"); - } - - public void testLoginSubmit() throws Exception { - Login login = new Login(); - login.setUsername("username"); - login.setPassword("password"); - String result = login.execute(); - assertSuccess(result); - } - - // Needs access to an envinronment that includes validators - public void FIXME_testLoginSubmitInput() throws Exception { - Login login = new Login(); - String result = login.execute(); - assertInput(result); - Map errors = assertFieldErrors(login); - assertFieldError(errors,"username","Username is required."); - assertFieldError(errors,"password","Password is required."); - } - -} diff --git a/trunk/apps/mailreader/README.txt b/trunk/apps/mailreader/README.txt deleted file mode 100644 index 802aea4d4..000000000 --- a/trunk/apps/mailreader/README.txt +++ /dev/null @@ -1,18 +0,0 @@ -README.txt - mailreader - -The MailReader demonstrates a localized application with a master/child -CRUD workflow. - -This rendition also demonstrates using wildcards to "normalize" an -application. - -See the Sandbox for other MailReader examples using other architectures. - -* http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/ - -For more about the MailReader applicaton genneraly, visit Struts University. - -* http://www.StrutsUniversity.org/ - - ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/trunk/apps/mailreader/pom.xml b/trunk/apps/mailreader/pom.xml deleted file mode 100644 index f4ca03c1a..000000000 --- a/trunk/apps/mailreader/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-apps - 2.0.1 - - org.apache.struts - struts2-mailreader - war - Starter Webapp - - - - javax.servlet - servlet-api - 2.4 - provided - - - ${pom.groupId} - struts-mailreader-dao - 1.3.5 - - - - - - - - src/main/java - - **/*.xml - **/*.properties - - - - - - org.mortbay.jetty - maven-jetty6-plugin - - 10 - - - - org.apache.geronimo.specs - geronimo-j2ee_1.4_spec - 1.0 - provided - - - - - - diff --git a/trunk/apps/mailreader/src/main/java/alternate.properties b/trunk/apps/mailreader/src/main/java/alternate.properties deleted file mode 100644 index 03dbf277b..000000000 --- a/trunk/apps/mailreader/src/main/java/alternate.properties +++ /dev/null @@ -1,3 +0,0 @@ -password=Enter your Password here ==> -struts.logo.path=struts-power.gif -struts.logo.alt=Powered by Struts diff --git a/trunk/apps/mailreader/src/main/java/alternate_ja.properties b/trunk/apps/mailreader/src/main/java/alternate_ja.properties deleted file mode 100644 index 981adc82c..000000000 --- a/trunk/apps/mailreader/src/main/java/alternate_ja.properties +++ /dev/null @@ -1 +0,0 @@ -.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b==> diff --git a/trunk/apps/mailreader/src/main/java/applicationContext.xml b/trunk/apps/mailreader/src/main/java/applicationContext.xml deleted file mode 100644 index b98e1d8d7..000000000 --- a/trunk/apps/mailreader/src/main/java/applicationContext.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/trunk/apps/mailreader/src/main/java/mailreader-default.xml b/trunk/apps/mailreader/src/main/java/mailreader-default.xml deleted file mode 100644 index 973551b39..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader-default.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /pages/Error.jsp - /pages/Error.jsp - Login!input - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader-support.xml b/trunk/apps/mailreader/src/main/java/mailreader-support.xml deleted file mode 100644 index 05091bafc..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader-support.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - /tour.html - - - - - /Welcome.jsp - - - - - Welcome - - - - /Login.jsp - Welcome - MainMenu - ChangePassword - - - - - - /Registration.jsp - MainMenu - - - - - - - - /Subscription.jsp - Registration!input - - - - - - - - - - - - - - /{1}.jsp - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java b/trunk/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java deleted file mode 100644 index 4570cc43a..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright 1999-2002,2004 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. - * - * $Id$ - */ - -package mailreader2; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import java.io.*; - -/** - *

ServletContextListener that initializes and finalizes the - * persistent storage of User and Subscription information for the Struts - * Demonstration Application, using an in-memory database backed by an XML - * file.

- *

- *

IMPLEMENTATION WARNING - If this web application is run - * from a WAR file, or in another environment where reading and writing of the - * web application resource is impossible, the initial contents will be copied - * to a file in the web application temporary directory provided by the - * container. This is for demonstration purposes only - you should - * NOT assume that files written here will survive a restart - * of your servlet container.

- *

- *

This class was borrowed from the Shale Mailreader. Changes were:

- *

- *

    - *

    - *

  • Path to database.xml (under classes here).
  • - *

    - *

  • Class to store protocol list (an array here).
  • - *

    - *

- *

- * DEVELOPMENT NOTE - Another approach would be to instantiate the database via Spring. - *

- */ - -public final class ApplicationListener implements ServletContextListener { - - // ------------------------------------------------------ Manifest Constants - - - /** - *

Appication scope attribute key under which the in-memory version of - * our database is stored.

- */ - public static final String DATABASE_KEY = "database"; - - - /** - *

Application scope attribute key under which the valid selection - * items for the protocol property is stored.

- */ - public static final String PROTOCOLS_KEY = "protocols"; - - // ------------------------------------------------------ Instance Variables - - - /** - *

The ServletContext for this web application.

- */ - private ServletContext context = null; - - - /** - * The {@link MemoryUserDatabase} object we construct and make available. - */ - private MemoryUserDatabase database = null; - - - /** - *

Logging output for this plug in instance.

- */ - private Log log = LogFactory.getLog(this.getClass()); - - // ------------------------------------------------------------- Properties - - - /** - *

The web application resource path of our persistent database storage - * file.

- */ - private String pathname = "/WEB-INF/database.xml"; - - /** - *

Return the application resource path to the database.

- * - * @return application resource path path to the database - */ - public String getPathname() { - return (this.pathname); - } - - /** - *

Set the application resource path to the database.

- * - * @param pathname to the database - */ - public void setPathname(String pathname) { - this.pathname = pathname; - } - - // ------------------------------------------ ServletContextListener Methods - - - /** - *

Gracefully shut down this database, releasing any resources that - * were allocated at initialization.

- * - * @param event ServletContextEvent to process - */ - public void contextDestroyed(ServletContextEvent event) { - - log.info("Finalizing memory database plug in"); - - if (database != null) { - try { - database.close(); - } catch (Exception e) { - log.error("Closing memory database", e); - } - } - - context.removeAttribute(DATABASE_KEY); - context.removeAttribute(PROTOCOLS_KEY); - database = null; - context = null; - - } - - - /** - *

Initialize and load our initial database from persistent - * storage.

- * - * @param event The context initialization event - */ - public void contextInitialized(ServletContextEvent event) { - - log.info("Initializing memory database plug in from '" + - pathname + "'"); - - // Remember our associated ServletContext - this.context = event.getServletContext(); - - // Construct a new database and make it available - database = new MemoryUserDatabase(); - try { - String path = calculatePath(); - if (log.isDebugEnabled()) { - log.debug(" Loading database from '" + path + "'"); - } - database.setPathname(path); - database.open(); - } catch (Exception e) { - log.error("Opening memory database", e); - throw new IllegalStateException("Cannot load database from '" + - pathname + "': " + e); - } - context.setAttribute(DATABASE_KEY, database); - - } - - // -------------------------------------------------------- Private Methods - - - /** - *

Calculate and return an absolute pathname to the XML file to contain - * our persistent storage information.

- * - * @throws Exception if an input/output error occurs - */ - private String calculatePath() throws Exception { - - // Can we access the database via file I/O? - String path = context.getRealPath(pathname); - if (path != null) { - return (path); - } - - // Does a copy of this file already exist in our temporary directory - File dir = (File) - context.getAttribute("javax.servlet.context.tempdir"); - File file = new File(dir, "struts-example-database.xml"); - if (file.exists()) { - return (file.getAbsolutePath()); - } - - // Copy the static resource to a temporary file and return its path - InputStream is = - context.getResourceAsStream(pathname); - BufferedInputStream bis = new BufferedInputStream(is, 1024); - FileOutputStream os = - new FileOutputStream(file); - BufferedOutputStream bos = new BufferedOutputStream(os, 1024); - byte buffer[] = new byte[1024]; - while (true) { - int n = bis.read(buffer); - if (n <= 0) { - break; - } - bos.write(buffer, 0, n); - } - bos.close(); - bis.close(); - return (file.getAbsolutePath()); - - } - - -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/AuthenticationInterceptor.java b/trunk/apps/mailreader/src/main/java/mailreader2/AuthenticationInterceptor.java deleted file mode 100644 index 10cc36823..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/AuthenticationInterceptor.java +++ /dev/null @@ -1,31 +0,0 @@ -package mailreader2; - -import com.opensymphony.xwork2.interceptor.Interceptor; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.Action; -import java.util.Map; -import org.apache.struts.apps.mailreader.dao.User; - -public class AuthenticationInterceptor implements Interceptor { - - public void destroy () {} - - public void init() {} - - public String intercept(ActionInvocation actionInvocation) throws Exception { - - Map session = actionInvocation.getInvocationContext().getSession(); - - User user = (User) session.get(Constants.USER_KEY); - - boolean isAuthenticated = (null!=user) && (null!=user.getDatabase()); - - if (!isAuthenticated) { - return Action.LOGIN; - } - else { - return actionInvocation.invoke(); - } - - } -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Constants.java b/trunk/apps/mailreader/src/main/java/mailreader2/Constants.java deleted file mode 100644 index 81733bd94..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Constants.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * $Id$ - * - * Copyright 1999-2004 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 mailreader2; - -/** - *

Manifest constants for the MailReader application.

- */ -public final class Constants { - - // --- Tokens ---- - - /** - *

The token representing a "cancel" request.

- */ - public static final String CANCEL = "cancel"; - - /** - *

The token representing a "create" task.

- */ - public static final String CREATE = "Create"; - - /** - *

The application scope attribute under which our user database is - * stored.

- */ - public static final String DATABASE_KEY = "database"; - - /** - *

The token representing a "edit" task.

- */ - public static final String DELETE = "Delete"; - - /** - *

The token representing a "edit" task.

- */ - public static final String EDIT = "Edit"; - - /** - *

The package name for this application.

- */ - public static final String PACKAGE = "org.apache.struts.apps.mailreader"; - - /** - *

The session scope attribute under which the Subscription object - * currently selected by our logged-in User is stored.

- */ - public static final String SUBSCRIPTION_KEY = "subscription"; - - /** - *

The session scope attribute under which the User object for the - * currently logged in user is stored.

- */ - public static final String USER_KEY = "user"; - - /** - *

The token representing the "Host" property. - */ - public static final String HOST = "host"; - - - // ---- Error Messages ---- - - /** - *

- * A static message in case message resource is not loaded. - *

- */ - public static final String ERROR_MESSAGES_NOT_LOADED = - "ERROR: Message resources not loaded -- check servlet container logs for error messages."; - - /** - *

- * A static message in case database resource is not loaded. - *

- */ - public static final String ERROR_DATABASE_NOT_LOADED = - "ERROR: User database not loaded -- check servlet container logs for error messages."; - - /** - *

- * A standard key from the message resources file, to test if it is available. - *

- */ - public static final String ERROR_DATABASE_MISSING = "error.database.missing"; - - /** - *

- * A "magic" username to trigger an ExpiredPasswordException for testing. - *

- */ - public static final String EXPIRED_PASSWORD_EXCEPTION = "ExpiredPasswordException"; - - /** - *

- * Name of field to associate with authentification errors. - *

- */ - public static final String PASSWORD_MISMATCH_FIELD = "password"; - - // ---- Log Messages ---- - - /** - *

Message to log if saving a user fails.

- */ - public static final String LOG_DATABASE_SAVE_ERROR = - " Unexpected error when saving User: "; - - -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Login.java b/trunk/apps/mailreader/src/main/java/mailreader2/Login.java deleted file mode 100644 index 7de355718..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Login.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id$ - * - * Copyright 2000-2004 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 mailreader2; - -import org.apache.struts.apps.mailreader.dao.User; -import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException; - -/** - *

Validate a user login.

- */ -public final class Login extends MailreaderSupport { - - public String execute() throws ExpiredPasswordException { - - User user = findUser(getUsername(), getPassword()); - - if (user != null) { - setUser(user); - } - - if (hasErrors()) { - return INPUT; - } - - return SUCCESS; - - } - -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Logon-validation.xml b/trunk/apps/mailreader/src/main/java/mailreader2/Logon-validation.xml deleted file mode 100644 index 4a04c7629..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Logon-validation.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Logout.java b/trunk/apps/mailreader/src/main/java/mailreader2/Logout.java deleted file mode 100644 index 1d079aebb..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Logout.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * $Id$ - * - * Copyright 2000-2004 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 mailreader2; - -/** - *

Log user out of the current session.

- */ -public class Logout extends MailreaderSupport { - - public String execute() { - - setUser(null); - - return SUCCESS; - } -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java b/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java deleted file mode 100644 index f93aeebcb..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java +++ /dev/null @@ -1,559 +0,0 @@ -/* - * $Id$ - * - * Copyright 1999-2004 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 mailreader2; - -import org.apache.struts2.interceptor.ApplicationAware; -import org.apache.struts2.interceptor.SessionAware; -import com.opensymphony.xwork2.ActionSupport; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException; -import org.apache.struts.apps.mailreader.dao.Subscription; -import org.apache.struts.apps.mailreader.dao.User; -import org.apache.struts.apps.mailreader.dao.UserDatabase; -import org.apache.struts.apps.mailreader.dao.impl.memory.MemorySubscription; -import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUser; -import org.springframework.beans.BeanUtils; - -import java.util.Map; - -/** - *

Base Action for MailreaderSupport application.

- *

- *

Note that this class does NOT implement model driven because of the way - * the pre-existing model is designed. The MailReader DAO includes immutable - * fields that can only be set on construction, and some objects do not have a - * default construction. One approach would be to mirror all the DAO - * properties on the Actions. As an alternative, this implementations uses the - * DAO properties where possible, and uses local Action properties only as - * needed. To create new objects, a blank temporary object is constructed, and - * the page uses a mix of local Action properties and DAO properties. When the - * new object is to be saved, the local Action properties are used to create - * the object using the DAO factory methods, the input values are copied from - * the temporary object, and the new object is saved. It's kludge, but it - * avoids creating unnecessary local properties. Pick your poison.

- */ -public class MailreaderSupport extends ActionSupport - implements SessionAware, ApplicationAware { - - /** - * Return CANCEL so apropriate result can be selected. - * @return "cancel" so apropriate result can be selected. - */ - public String cancel() { - return Constants.CANCEL; - } - - - // ---- ApplicationAware ---- - - /** - *

Field to store application context or its proxy.

- *

- *

The application context lasts for the life of the application. A - * reference to the database is stored in the application context at - * startup.

- */ - private Map application; - - /** - *

Store a new application context.

- * - * @param value A Map representing application state - */ - public void setApplication(Map value) { - application = value; - } - - /** - *

Provide application context.

- */ - public Map getApplication() { - return application; - } - - // ---- SessionAware ---- - - /** - *

Field to store session context, or its proxy.

- */ - private Map session; - - /** - *

Store a new session context.

- * - * @param value A Map representing session state - */ - public void setSession(Map value) { - session = value; - } - - /** - *

Provide session context.

- * - * @return session context - */ - public Map getSession() { - return session; - } - - // ---- Task property (utilized by UI) ---- - - /** - *

Field to store workflow task.

- *

- *

The Task is used to track the state of the CRUD workflows. It can be - * set to Constant.CREATE, Constant.EDIT, or Constant.DELETE as - * needed.

- */ - private String task = null; - - - /** - *

Provide worklow task.

- * - * @return Returns the task. - */ - public String getTask() { - return task; - } - - /** - *

Store new workflow task.

- * - * @param value The task to set. - */ - public void setTask(String value) { - task = value; - } - - // ---- Token property (utilized by UI) ---- - - /** - *

Field to store double-submit guard.

- */ - private String token = null; - - - /** - *

Provide Token.

- * - * @return Returns the token. - */ - public String getToken() { - return token; - } - - /** - *

Store new Token.

- * - * @param value The token to set. - */ - public void setToken(String value) { - token = value; - } - - - // ---- Host property ---- - - /** - *

Field to store Subscription host.

- *

- *

The host is an immutable property of the Subscrtion DAP object, so - * we need to store it locally until we are ready to create the - * Subscription.

- */ - private String host; - - /** - *

Provide tSubscription host.

- * - * @return host property - */ - public String getHost() { - return host; - } - - /** - *

Store new Subscription host.

- * - * @param value - */ - public void setHost(String value) { - host = value; - } - - // ---- Password property ---- - - /** - *

Field to store User password property.

- *

- *

The User DAO object password proerty is immutable, so we store it - * locally until we are ready to create the object.

- */ - private String password = null; - - - /** - *

Provide User password

- * - * @return Returns the password. - */ - public String getPassword() { - return password; - } - - /** - *

Store new User Password

- * - * @param value The password to set. - */ - public void setPassword(String value) { - password = value; - } - - // ---- Password2 property (confirmation) ---- - - /** - *

Field to store the User password confirmation.

- *

- *

When a User object is created, we ask the client to enter the - * password twice, to help ensure the password is being typed - * correctly.

- */ - private String password2 = null; - - - /** - *

Provide the User password confirmation.

- * - * @return Returns the confirmationpassword. - */ - public String getPassword2() { - return password2; - } - - /** - *

Store a new User password confirmation.

- * - * @param value The confirmation password to set. - */ - public void setPassword2(String value) { - password2 = value; - } - - // ---- Username property ---- - - /** - *

Field to store User username.

- *

- *

The User DAO object password proerty is immutable, so we store it - * locally until we are ready to create the object.

- */ - private String username = null; - - - /** - *

Provide User username.

- * - * @return Returns the User username. - */ - public String getUsername() { - return username; - } - - /** - *

Store new User username

- * - * @param value The username to set. - */ - public void setUsername(String value) { - username = value; - } - - // ---- Database property ---- - - /** - *

Provide reference to UserDatabase, or null if the database is not - * available.

- * - * @return a reference to the UserDatabase or null if the database is not - * available - */ - public UserDatabase getDatabase() { - Object db = getApplication().get(Constants.DATABASE_KEY); - if (db == null) { - this.addActionError(getText("error.database.missing")); - } - return (UserDatabase) db; - } - - /** - *

Store a new reference to UserDatabase

- * - * @param database - */ - public void setDatabase(UserDatabase database) { - getApplication().put(Constants.DATABASE_KEY, database); - } - - // ---- User property ---- - - /** - *

Provide reference to User object for authenticated user.

- * - * @return User object for authenticated user. - */ - public User getUser() { - return (User) getSession().get(Constants.USER_KEY); - } - - /** - *

Store new reference to User Object.

- * - * @param user User object for authenticated user - */ - public void setUser(User user) { - getSession().put(Constants.USER_KEY, user); - } - - /** - *

Obtain User object from database, or return null if the credentials - * are not found or invalid.

- * - * @param username User username - * @param password User password - * @return User object or null if not found - * @throws ExpiredPasswordException - */ - public User findUser(String username, String password) - throws ExpiredPasswordException { - // FIXME: Stupid testing hack to compensate for inadequate DAO layer - if (Constants.EXPIRED_PASSWORD_EXCEPTION.equals(username)) { - throw new ExpiredPasswordException(Constants.EXPIRED_PASSWORD_EXCEPTION); - } - - User user = getDatabase().findUser(username); - if ((user != null) && !user.getPassword().equals(password)) { - user = null; - } - if (user == null) { - this.addFieldError(Constants.PASSWORD_MISMATCH_FIELD, - getText("error.password.mismatch")); - } - return user; - } - - /** - *

Log instance for this application.

- */ - protected Log log = LogFactory.getLog(Constants.PACKAGE); - - /** - *

Persist the User object, including subscriptions, to the database. - *

- * - * @throws java.lang.Exception on database error - */ - public void saveUser() throws Exception { - try { - getDatabase().save(); - } catch (Exception e) { - String message = Constants.LOG_DATABASE_SAVE_ERROR + getUser() - .getUsername(); - log.error(message, e); - throw new Exception(message, e); - } - } - - public void createInputUser() { - User user = new MemoryUser(null, null); - setUser(user); - } - - /** - *

Verify input for creating a new user, create the user, and process - * the login.

- * - * @return A new User and empty Errors if create succeeds, or null and - * Errors if create fails - */ - public User createUser(String username, String password) { - - UserDatabase database = getDatabase(); - User user; - - try { - user = database.findUser(username); - } - - catch (ExpiredPasswordException e) { - user = getUser(); // Just so that it is not null - } - - if (user != null) { - this.addFieldError("username", "error.username.unique"); - return null; - } - - return database.createUser(username); - } - - // Since user.username is immutable, we have to use some local properties - - /** - *

Use the current User object to create a new User object, and make - * the new User object the authenticated user.

- *

- *

The "current" User object is usually a temporary object being used - * to capture input.

- * - * @param _username User username - * @param _password User password - */ - public void copyUser(String _username, String _password) { - User input = getUser(); - input.setPassword(_password); - User user = createUser(_username, _password); - if (null != user) { - BeanUtils.copyProperties(input,user); - setUser(user); - } - } - - // ---- Subscription property ---- - - /** - *

Obtain the cached Subscription object, if any.

- * - * @return Cached Subscription object or null - */ - public Subscription getSubscription() { - return (Subscription) getSession().get(Constants.SUBSCRIPTION_KEY); - } - - /** - *

Store new User Subscription.

- * - * @param subscription - */ - public void setSubscription(Subscription subscription) { - getSession().put(Constants.SUBSCRIPTION_KEY, subscription); - } - - /** - *

Obtain User Subscription object for the given host, or return null - * if not found.

- * - *

It would be possible for this code to throw a NullPointerException, - * but the ExceptionHandler in the xwork.xml will catch that for us.

- * - * @return The matching Subscription or null - */ - public Subscription findSubscription(String host) { - Subscription subscription; - subscription = getUser().findSubscription(host); - return subscription; - } - - /** - *

Obtain uSER Subscription for the local Host property.

- *

- *

Usually, the host property will be set from the client request, - * because it was embedded in a link to the Subcription action. - * - * @return Subscription or null if not found - */ - public Subscription findSubscription() { - return findSubscription(getHost()); - } - - /** - *

Provide a "temporary" User Subscription object that can be used to - * capture input values.

- */ - public void createInputSubscription() { - Subscription sub = new MemorySubscription(getUser(), null); - setSubscription(sub); - setHost(sub.getHost()); - } - - /** - *

Provide new User Subscription object for the given host, or null if - * the host is not unique.

- * - * @param host - * @return New User Subscription object or null - */ - public Subscription createSubscription(String host) { - - Subscription sub; - - sub = findSubscription(host); - - if (null != sub) { - // FIXME - localization - "error.host.unique") - addFieldError(Constants.HOST,"That hostname is already defined"); - return null; - } - - return getUser().createSubscription(host); - } - - /** - *

Create a new Subscription from the current Subscription object, - * making the new Subscription the current Subscription.

- *

- *

Usually, the "current" Subscription is a temporary object being used - * to capture input values.

- * - * @param host - */ - public void copySubscription(String host) { - Subscription input = getSubscription(); - Subscription sub = createSubscription(host); - if (null != sub) { - BeanUtils.copyProperties(input, sub); - setSubscription(sub); - setHost(sub.getHost()); - } - } - - /** - *

Delete the current Subscription object from the database.

- */ - public void removeSubscription() { - getUser().removeSubscription(getSubscription()); - getSession().remove(Constants.SUBSCRIPTION_KEY); - } - - /** - *

Provide MailServer Host for current User Subscription.

- * - * @return MailServer Host for current User Subscription - */ - public String getSubscriptionHost() { - Subscription sub = getSubscription(); - if (null == sub) { - return null; - } - return sub.getHost(); - } - -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties b/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties deleted file mode 100644 index 6fd171ba2..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties +++ /dev/null @@ -1,93 +0,0 @@ -button.cancel=Cancel -button.confirm=Confirm -button.doSubmit=DO_SUBMIT -button.doReset=DO_RESULT -button.doCancel=org.apache.struts.taglib.html.CANCEL -button.reset=Reset -button.save=Save -change.message=Your password has expired. Please ask the system administrator to change it. -change.try=Try Again -change.title=Password Has Expired -database.load=Cannot load database from {0} -error.database.missing=User database is missing, cannot validate login credentials -error.fromAddress.format=Invalid format for From Address -error.fromAddress.required=From Address is required -error.fullName.required=Full Name is required -error.host.required=Mail Server is required -error.noSubscription=No Subscription bean in user session -error.password.expired=Your password has expired for username {0} -error.password.required=Password is required -error.password2.required=Confirmation password is required -error.password.match=Password and confirmation password must match -error.password.mismatch=Invalid username and/or password, please try again -error.replyToAddress.format=Invalid format for Reply To Address -struts.messages.invalid.token=Cannot submit this form out of order -error.type.invalid=Server Type must be 'imap' or 'pop3' -error.type.required=Server Type is required -error.username.required=Username is required -error.username.unique=That username is already in use - please select another -errors.footer=
-errors.header=

Validation Error

You must correct the following error(s) before proceeding:

    -errors.prefix=
  • -errors.suffix=
  • -errors.ioException=I/O exception rendering error messages: {0} -expired.password=User Password has expired for {0} -heading.autoConnect=Auto -heading.subscriptions=Current Subscriptions -heading.host=Host Name -heading.user=User Name -heading.type=Server Type -heading.action=Action -index.heading=MailReader Demonstration Application Options -index.login=Log on to the MailReader Demonstration Application -index.registration=Register with the MailReader Demonstration Application -index.title=MailReader Demonstration Application -index.tour=A Walking Tour of the MailReader Demonstration Application -linkSubscription.io=I/O Error: {0} -linkSubscription.noSubscription=No subscription under attribute {0} -linkUser.io=I/O Error: {0} -linkUser.noUser=No user under attribute {0} -login.title=MailReader Demonstration Application - Login -mainMenu.heading=Main Menu Options for -mainMenu.logout=Log off MailReader Demonstration Application -mainMenu.registration=Edit your user registration profile -mainMenu.title=MailReader Demonstration Application - Main Menu -option.imap=IMAP Protocol -option.pop3=POP3 Protocol -# prompt. -autoConnect=Auto Connect -fromAddress=From Address -fullName=Full Name -mailHostname=Mail Server -mailPassword=Mail Password -mailServerType=Server Type -mailUsername=Mail Username -password=Password -password2=(Repeat) Password -replyToAddress=Reply To Address -username=Username -registration.addSubscription=Add -registration.deleteSubscription=Delete -registration.editSubscription=Edit -registration.title.create=Register for the MailReader Demonstration Application -registration.title.edit=Edit Registration for the MailReader Demonstration Application -subscription.title.create=Create New Mail Subscription -subscription.title.delete=Delete Existing Mail Subscription -subscription.title.edit=Edit Existing Mail Subscription - -# Standard error messages for validator framework checks -errors.required=${getText(fieldName)} is required. -errors.minlength=${getText(fieldName)} cannot be less than {1} characters. -errors.maxlength=${getText(fieldName)} cannot be greater than {1} characters. -errors.invalid=${getText(fieldName)} is invalid. -errors.byte=${getText(fieldName)} must be an byte. -errors.short=${getText(fieldName)} must be an short. -errors.integer=${getText(fieldName)} must be an integer. -errors.long=${getText(fieldName)} must be an long. -errors.float=${getText(fieldName)} must be an float. -errors.double=${getText(fieldName)} must be an double. -errors.date=${getText(fieldName)} is not a date. -errors.range=${getText(fieldName)} is not in the range ${minLength} through ${maxLength}. -errors.creditcard=${getText(fieldName)} is not a valid credit card number. -errors.email=${getText(fieldName)} is an invalid e-mail address. -errors.literal=${getText(fieldName)} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport_ja.properties b/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport_ja.properties deleted file mode 100644 index 6bb198a05..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport_ja.properties +++ /dev/null @@ -1,89 +0,0 @@ -button.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb -button.confirm=\u78ba\u8a8d -button.reset=\u30ea\u30bb\u30c3\u30c8 -button.save=\u4fdd\u5b58 -change.message=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u6709\u52B9\u671F\u9650\u304C\u904E\u304E\u307E\u3057\u305F\u3002\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u4E0B\u3055\u3044 -change.try=\u518D\u8A66\u884C -change.title=\u30d1\u30b9\u30ef\u30fc\u30c9\u671f\u9650\u5207\u308c -database.load= {0} \u304B\u3089\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093 -error.database.missing=\u30E6\u30FC\u30B6\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u30ED\u30B0\u30AA\u30F3\u306E\u8A8D\u8A3C\u304C\u51FA\u6765\u307E\u305B\u3093 -error.fromAddress.format=From\u30A2\u30C9\u30EC\u30B9\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093 -error.fromAddress.required=From\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 -error.fullName.required=\u30D5\u30EB\u30CD\u30FC\u30E0\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 -error.host.required=\u30E1\u30FC\u30EB\u30B5\u30FC\u30D0\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 -error.noSubscription=Subscription bean \u304c\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u4e2d\u306b\u3042\u308a\u307e\u305b\u3093 -error.password.expired=\u30E6\u30FC\u30B6 {0} \u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u6709\u52B9\u671F\u9650\u304C\u904E\u304E\u307E\u3057\u305F -error.password.required=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u5FC5\u8981\u3067\u3059 -error.password2.required=\u30D1\u30B9\u30EF\u30FC\u30C9(\u78BA\u8A8D\u7528)\u304C\u5FC5\u8981\u3067\u3059 -error.password.match=\u30D1\u30B9\u30EF\u30FC\u30C9\u3068\u78BA\u8A8D\u7528\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u3066\u3044\u307E\u305B\u3093 -error.password.mismatch=\u30E6\u30FC\u30B6\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E0D\u6B63\u3067\u3059\u3002\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 -error.replyToAddress.format=\u8FD4\u4FE1\u30A2\u30C9\u30EC\u30B9\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093 -struts.messages.invalid.token=\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306E\u5185\u5BB9\u304C\u6B63\u3057\u304F\u306A\u3044\u305F\u3081\u9001\u4FE1\u3059\u308B\u3053\u3068\u304C\u51FA\u6765\u307E\u305B\u3093 -error.type.invalid=\u30B5\u30FC\u30D0\u30BF\u30A4\u30D7\u306F 'imap' \u304B 'pop3'\u306E\u3069\u3061\u3089\u304B\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093 -error.type.required=\u30B5\u30FC\u30D0\u30BF\u30A4\u30D7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 -error.username.required=\u30E6\u30FC\u30B6\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 -error.username.unique=\u305D\u306E\u30E6\u30FC\u30B6\u540D\u306F\u65E2\u306B\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u3002 \u5225\u306E\u30E6\u30FC\u30B6\u540D\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044 -errors.footer=

-errors.header=

\u5165\u529b\u30c1\u30a7\u30c3\u30af\u30a8\u30e9\u30fc

\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044:

    -errors.prefix=
  • -errors.suffix=
  • -errors.ioException=I/O\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f: {0} -expired.password=\u30E6\u30FC\u30B6 {0} \u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u6709\u52B9\u671F\u9650\u304C\u904E\u304E\u307E\u3057\u305F -heading.autoConnect=\u81ea\u52d5\u63a5\u7d9a -heading.subscriptions=\u73fe\u5728\u306e\u8cfc\u8aad\u60c5\u5831 -heading.host=\u30db\u30b9\u30c8\u540d -heading.user=\u30e6\u30fc\u30b6\u540d -heading.type=\u30b5\u30fc\u30d0\u30bf\u30a4\u30d7 -heading.action=\u64cd\u4f5c -index.heading=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30aa\u30d7\u30b7\u30e7\u30f3 -index.login=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30ed\u30b0\u30aa\u30f3 -index.registration=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30e6\u30fc\u30b6\u767b\u9332 -index.title=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3(Struts 1.1-dev) -index.tour=\u30b5\u30f3\u30d7\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u6563\u7b56\u3059\u308b -linkSubscription.io=I/O\u30a8\u30e9\u30fc: {0} -linkSubscription.noSubscription=\u5c5e\u6027 {0} \u306b\u8cfc\u8aad\u60c5\u5831\u304c\u5b58\u5728\u3057\u307e\u305b\u3093 -linkUser.io=I/O\u30a8\u30e9\u30fc: {0} -linkUser.noUser=\u5c5e\u6027 {0} \u306b\u30e6\u30fc\u30b6\u60c5\u5831\u304c\u5b58\u5728\u3057\u307e\u305b\u3093 -login.title=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30ed\u30b0\u30aa\u30f3 -mainMenu.heading=\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc -mainMenu.logout=MailReader \u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u30aa\u30d5 -mainMenu.registration=\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6 -mainMenu.title=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc -option.imap=IMAP \u30d7\u30ed\u30c8\u30b3\u30eb -option.pop3=POP3 \u30d7\u30ed\u30c8\u30b3\u30eb -# prompt. -autoConnect=\u81ea\u52d5\u63a5\u7d9a -fromAddress=From\u30a2\u30c9\u30ec\u30b9 -fullName=\u30d5\u30eb\u30cd\u30fc\u30e0 -mailHostname=\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0 -mailPassword=\u30e1\u30fc\u30eb\u30d1\u30b9\u30ef\u30fc\u30c9 -mailServerType=\u30b5\u30fc\u30d0\u30bf\u30a4\u30d7 -mailUsername=\u30e1\u30fc\u30eb\u30e6\u30fc\u30b6\u540d -.password=\u30d1\u30b9\u30ef\u30fc\u30c9 -password2=\u30d1\u30b9\u30ef\u30fc\u30c9(\u78ba\u8a8d\u7528) -replyToAddress=\u8fd4\u4fe1\u30a2\u30c9\u30ec\u30b9 -username=\u30e6\u30fc\u30b6\u540d -registration.addSubscription=\u65b0\u898f\u4f5c\u6210 -registration.deleteSubscription=\u524a\u9664 -registration.editSubscription=\u7de8\u96c6 -registration.title.create=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30e6\u30fc\u30b6\u767b\u9332 -registration.title.edit=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u7de8\u96c6 -subscription.title.create=\u30e1\u30fc\u30eb\u8cfc\u8aad\u60c5\u5831\u306e\u65b0\u898f\u4f5c\u6210 -subscription.title.delete=\u30e1\u30fc\u30eb\u8cfc\u8aad\u60c5\u5831\u306e\u524a\u9664 -subscription.title.edit=\u30e1\u30fc\u30eb\u8cfc\u8aad\u60c5\u5831\u306e\u7de8\u96c6 - -# Standard error messages for validator framework checks -errors.required=${getText(fieldName)} \u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -errors.minlength=${getText(fieldName)} \u306f {1} \u6587\u5b57\u4ee5\u4e0a\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.maxlength=${getText(fieldName)} \u306f {2} \u6587\u5b57\u4ee5\u4e0b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.invalid=${getText(fieldName)} \u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002 -errors.byte=${getText(fieldName)} \u306fbyte\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.short=${getText(fieldName)} \u306fshort\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.integer=${getText(fieldName)} \u306finteger\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.long=${getText(fieldName)} \u306flong\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.float=${getText(fieldName)} \u306ffloat\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.double=${getText(fieldName)} \u306fdouble\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.date=${getText(fieldName)} \u306f\u65e5\u4ed8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -errors.range=${getText(fieldName)} \u306f {1} \u304b\u3089 {2} \u306e\u9593\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 -errors.creditcard=${getText(fieldName)} \u306f\u6b63\u3057\u3044\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u756a\u53f7\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -errors.email=${getText(fieldName)} \u306f\u6b63\u3057\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport_ru.properties b/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport_ru.properties deleted file mode 100644 index e7d1772f5..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport_ru.properties +++ /dev/null @@ -1,89 +0,0 @@ -button.cancel=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c -button.confirm=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c -button.reset=\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c -button.save=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c -change.message=Your password has expired. Please ask the system administrator to change it. -change.try=Try Again -change.title=Password Has Expired -database.load=\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0438\u0437 {0} -error.database.missing=\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f - \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e. -error.fromAddress.format=\u0412 \u043f\u043e\u043b\u0435 '\u0410\u0434\u0440\u0435\u0441 \u041e\u0442:' \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435. -error.fromAddress.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0432 \u043f\u043e\u043b\u0435 '\u0410\u0434\u0440\u0435\u0441 \u041e\u0442:'. -error.fullName.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f. -error.host.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. -error.noSubscription=\u041f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f -error.password.expired=Your password has expired for username {0} -error.password.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c. -error.password2.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f. -error.password.match=\u041f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442. -error.password.mismatch=\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u044f \u0438/\u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c - \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0441\u043d\u043e\u0432\u0430. -error.replyToAddress.format=\u0412 \u043f\u043e\u043b\u0435 '\u0410\u0434\u0440\u0435\u0441 \u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430:' \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435. -struts.messages.invalid.token=\u042d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 - \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. -error.type.invalid=\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0438\u043f\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043b\u0438\u0448\u044c 'imap' \u0438\u043b\u0438 'pop3' -error.type.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0438\u043f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 -error.username.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f -error.username.unique=\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f - \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0434\u0440\u0443\u0433\u043e\u0435 \u0438\u043c\u044f. -errors.footer=

-errors.header=

\u041e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445

\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0438:

    -errors.prefix=
  • -errors.suffix=
  • -errors.ioException=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430/\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445: {0} -expired.password=User Password has expired for {0} -heading.autoConnect=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 -heading.subscriptions=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 -heading.host=\u0421\u0435\u0440\u0432\u0435\u0440 -heading.user=\u0418\u043c\u044f -heading.type=\u0422\u0438\u043f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 -heading.action=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 -index.heading=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b' -index.login=\u0412\u043e\u0439\u0442\u0438 \u043a\u0430\u043a \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c -index.registration=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f -index.title=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b' (Struts 1.1-dev) -index.tour=\u041e\u0431\u0437\u043e\u0440 \u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b' -linkSubscription.io=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438): {0} -linkSubscription.noSubscription=\u0410\u0442\u0440\u0438\u0431\u0443\u0442 {0} \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. -linkUser.io=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f): {0} -linkUser.noUser=\u0410\u0442\u0440\u0438\u0431\u0443\u0442 {0} \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0438\u043b\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. -login.title=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b - \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u043c\u0435\u043d\u0438 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f. -mainMenu.heading=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e \u0434\u043b\u044f -mainMenu.logout=\u0412\u044b\u0439\u0442\u0438 -mainMenu.registration=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 -mainMenu.title=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b' - \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e -option.imap=\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b IMAP -option.pop3=\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b POP3 -# prompt. -autoConnect=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435: -fromAddress=\u0410\u0434\u0440\u0435\u0441 \u041e\u0442: -fullName=\u041f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f: -mailHostname=\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440: -mailPassword=\u041f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430: -mailServerType=\u0422\u0438\u043f \u0441\u0435\u0440\u0432\u0435\u0440\u0430: -mailUsername=\u0418\u043c\u044f \u0434\u043b\u044f \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430: -password=\u041f\u0430\u0440\u043e\u043b\u044c: -password2=(\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435) \u041f\u0430\u0440\u043e\u043b\u044c: -replyToAddress=\u0410\u0434\u0440\u0435\u0441 \u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430: -username=\u0418\u043c\u044f: -registration.addSubscription=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c -registration.deleteSubscription=\u0423\u0434\u0430\u043b\u0438\u0442\u044c -registration.editSubscription=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c -registration.title.create=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f -registration.title.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 -subscription.title.create=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 -subscription.title.delete=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 -subscription.title.edit=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 - -# Standard error messages for validator framework checks -errors.required=${getText(fieldName)} is required. -errors.minlength=${getText(fieldName)} cannot be less than {1} characters. -errors.maxlength=${getText(fieldName)} cannot be greater than {2} characters. -errors.invalid=${getText(fieldName)} is invalid. -errors.byte=${getText(fieldName)} must be an byte. -errors.short=${getText(fieldName)} must be an short. -errors.integer=${getText(fieldName)} must be an integer. -errors.long=${getText(fieldName)} must be an long. -errors.float=${getText(fieldName)} must be an float. -errors.double=${getText(fieldName)} must be an double. -errors.date=${getText(fieldName)} is not a date. -errors.range=${getText(fieldName)} is not in the range {1} through {2}. -errors.creditcard=${getText(fieldName)} is not a valid credit card number. -errors.email=${getText(fieldName)} is an invalid e-mail address. diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Registration-Registration!save-validation.xml b/trunk/apps/mailreader/src/main/java/mailreader2/Registration-Registration!save-validation.xml deleted file mode 100644 index 689640742..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Registration-Registration!save-validation.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - true - 4 - 10 - - - - - - - - - - - - password eq password2 - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Registration-validation.xml b/trunk/apps/mailreader/src/main/java/mailreader2/Registration-validation.xml deleted file mode 100644 index 44d66bc19..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Registration-validation.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Registration.java b/trunk/apps/mailreader/src/main/java/mailreader2/Registration.java deleted file mode 100644 index e87fdf2c5..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Registration.java +++ /dev/null @@ -1,101 +0,0 @@ -package mailreader2; - -import org.apache.struts.apps.mailreader.dao.User; - - -/** - *

    Insert or update a User object to the persistent store.

    - */ -public class Registration extends MailreaderSupport { - - /** - *

    Double check that there is not a valid User login.

    - * - * @return True if there is not a valid User login - */ - private boolean isCreating() { - User user = getUser(); - return (null == user) || (null == user.getDatabase()); - } - - /** - *

    Retrieve User object to edit or null if User does not exist.

    - * - * @return The "Success" result for this mapping - * @throws Exception on any error - */ - public String input() throws Exception { - - if (isCreating()) { - createInputUser(); - setTask(Constants.CREATE); - } else { - setTask(Constants.EDIT); - setUsername(getUser().getUsername()); - setPassword(getUser().getPassword()); - setPassword2(getUser().getPassword()); - } - - return INPUT; - } - - /** - *

    Insert or update a Registration.

    - * - * @return The "outcome" result code - * @throws Exception on any error - */ - public String save() throws Exception { - return execute(); - } - - /** - *

    Insert or update a User object to the persistent store.

    - *

    - *

    If a User is not logged in, then a new User is created and - * automatically logged in. Otherwise, the existing User is updated.

    - * - * @return The "outcome" result code - * @throws Exception on any error - */ - public String execute() - throws Exception { - - boolean creating = Constants.CREATE.equals(getTask()); - creating = creating && isCreating(); // trust but verify - - if (creating) { - - User user = findUser(getUsername(), getPassword()); - boolean haveUser = (user != null); - - if (haveUser) { - addActionError(getText("error.username.unique")); - return INPUT; - } - - copyUser(getUsername(), getPassword()); - - } else { - - // FIXME: Any way to call the RegisrationSave validators from here? - String newPassword = getPassword(); - if (newPassword != null) { - String confirmPassword = getPassword2(); - boolean matches = ((null != confirmPassword) - && (confirmPassword.equals(newPassword))); - if (matches) { - getUser().setPassword(newPassword); - } else { - addActionError(getText("error.password.match")); - return INPUT; - } - } - } - - saveUser(); - - return SUCCESS; - } - -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Subscription-Subscription!save-validation.xml b/trunk/apps/mailreader/src/main/java/mailreader2/Subscription-Subscription!save-validation.xml deleted file mode 100644 index 9f2f6d793..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Subscription-Subscription!save-validation.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Subscription-validation.xml b/trunk/apps/mailreader/src/main/java/mailreader2/Subscription-validation.xml deleted file mode 100644 index df903c25b..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Subscription-validation.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Subscription.java b/trunk/apps/mailreader/src/main/java/mailreader2/Subscription.java deleted file mode 100644 index a3f32edd3..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Subscription.java +++ /dev/null @@ -1,124 +0,0 @@ -package mailreader2; - -import com.opensymphony.xwork2.Preparable; - -import java.util.LinkedHashMap; -import java.util.Map; - -/** - *

    Provide an Edit method for retrieving an existing subscription, and a - * Save method for updating or inserting a subscription.

    - */ -public class Subscription extends MailreaderSupport - implements Preparable { - - /** - *

    Field to store list of MailServer types

    - */ - private Map types = null; - - /** - *

    Provide the list of MailServer types.

    - * - * @return List of MailServer types - */ - public Map getTypes() { - return types; - } - - /** - *

    Setup the MailerServer types and set the local Host property from - * the User Subscription (if any).

    - */ - public void prepare() { - - Map m = new LinkedHashMap(); - m.put("imap", "IMAP Protocol"); - m.put("pop3", "POP3 Protocol"); - types = m; - - setHost(getSubscriptionHost()); - } - - /** - *

    Setup a temporary User Subscription object to capture input - * values.

    - * - * @return INPUT - */ - public String input() { - createInputSubscription(); - setTask(Constants.CREATE); - return INPUT; - } - - /** - *

    Load User Subscription for the local Host property.

    - *

    - *

    Usually, the Host is being set from the request by a link to an Edit - * or Delete task.

    - * - * @return INPUT or Error, if Subscription is not found - */ - public String find() { - - org.apache.struts.apps.mailreader.dao.Subscription - sub = findSubscription(); - - if (sub == null) { - return ERROR; - } - - setSubscription(sub); - - return INPUT; - - } - - /** - *

    Prepare to present a confirmation page before removing - * Subscription.

    - * - * @return INPUT or Error, if Subscription is not found - */ - public String delete() { - - setTask(Constants.DELETE); - return find(); - } - - /** - *

    Prepare to edit User Subscription.

    - * - * @return INPUT or Error, if Subscription is not found - */ - public String edit() { - - setTask(Constants.EDIT); - return find(); - } - - /** - *

    Examine the Task property and DELETE, CREATE, or save the User - * Subscription, as appropriate.

    - * - * @return SUCCESS - * @throws Exception on a database error - */ - public String save() throws Exception { - - if (Constants.DELETE.equals(getTask())) { - removeSubscription(); - } - - if (Constants.CREATE.equals(getTask())) { - copySubscription(getHost()); - } - - if (hasErrors()) return INPUT; - - saveUser(); - return SUCCESS; - } - -} diff --git a/trunk/apps/mailreader/src/main/java/mailreader2/Welcome.java b/trunk/apps/mailreader/src/main/java/mailreader2/Welcome.java deleted file mode 100644 index 08ec12581..000000000 --- a/trunk/apps/mailreader/src/main/java/mailreader2/Welcome.java +++ /dev/null @@ -1,28 +0,0 @@ -package mailreader2; - -/** - * Verify that essential resources are available. - */ -public class Welcome extends MailreaderSupport { - - public String execute() { - - // Confirm message resources loaded - String message = getText(Constants.ERROR_DATABASE_MISSING); - if (Constants.ERROR_DATABASE_MISSING.equals(message)) { - addActionError(Constants.ERROR_MESSAGES_NOT_LOADED); - } - - // Confirm database loaded - if (null==getDatabase()) { - addActionError(Constants.ERROR_DATABASE_NOT_LOADED); - } - - if (hasErrors()) { - return ERROR; - } - else { - return SUCCESS; - } - } -} diff --git a/trunk/apps/mailreader/src/main/java/struts.properties b/trunk/apps/mailreader/src/main/java/struts.properties deleted file mode 100644 index 14f925247..000000000 --- a/trunk/apps/mailreader/src/main/java/struts.properties +++ /dev/null @@ -1,4 +0,0 @@ -struts.objectFactory = spring -struts.devMode = false -struts.action.extension = do -struts.enable.DynamicMethodInvocation = false diff --git a/trunk/apps/mailreader/src/main/java/struts.xml b/trunk/apps/mailreader/src/main/java/struts.xml deleted file mode 100644 index fa904e2ee..000000000 --- a/trunk/apps/mailreader/src/main/java/struts.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/trunk/apps/mailreader/src/main/webapp/ChangePassword.jsp b/trunk/apps/mailreader/src/main/webapp/ChangePassword.jsp deleted file mode 100644 index 7743bf1b1..000000000 --- a/trunk/apps/mailreader/src/main/webapp/ChangePassword.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - <s:text name="change.title"/> - " rel="stylesheet" - type="text/css"/> - - - - -

    - -

    - -

    - "> - - -

    - - - diff --git a/trunk/apps/mailreader/src/main/webapp/Error.jsp b/trunk/apps/mailreader/src/main/webapp/Error.jsp deleted file mode 100644 index 05ab5e083..000000000 --- a/trunk/apps/mailreader/src/main/webapp/Error.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - Unexpected Error - - - -

    An unexpected error has occured

    - -

    - Please report this error to your system administrator - or appropriate technical support personnel. - Thank you for your cooperation. -

    - -
    - -

    Error Message

    - - - -

    - -

    - -
    - -

    Technical Details

    - -

    - -

    - - - - - diff --git a/trunk/apps/mailreader/src/main/webapp/Footer.jsp b/trunk/apps/mailreader/src/main/webapp/Footer.jsp deleted file mode 100644 index 2b3b86c48..000000000 --- a/trunk/apps/mailreader/src/main/webapp/Footer.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@ taglib uri="/struts-tags" prefix="s" %> -
    - -

    - "> -

    diff --git a/trunk/apps/mailreader/src/main/webapp/Login.jsp b/trunk/apps/mailreader/src/main/webapp/Login.jsp deleted file mode 100644 index 39ca9e049..000000000 --- a/trunk/apps/mailreader/src/main/webapp/Login.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - <s:text name="login.title"/> - " rel="stylesheet" - type="text/css"/> - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/webapp/META-INF/context.xml b/trunk/apps/mailreader/src/main/webapp/META-INF/context.xml deleted file mode 100644 index 9b0b5d00f..000000000 --- a/trunk/apps/mailreader/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/trunk/apps/mailreader/src/main/webapp/MainMenu.jsp b/trunk/apps/mailreader/src/main/webapp/MainMenu.jsp deleted file mode 100644 index 4b96feb01..000000000 --- a/trunk/apps/mailreader/src/main/webapp/MainMenu.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - <s:text name="mainMenu.title"/> - " rel="stylesheet" - type="text/css"/> - - - -

    - - - diff --git a/trunk/apps/mailreader/src/main/webapp/Registration.jsp b/trunk/apps/mailreader/src/main/webapp/Registration.jsp deleted file mode 100644 index 5b3ad5a34..000000000 --- a/trunk/apps/mailreader/src/main/webapp/Registration.jsp +++ /dev/null @@ -1,126 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - - <s:text name="registration.title.create"/> - - - <s:text name="registration.title.edit"/> - - " rel="stylesheet" - type="text/css"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - -
    - - - - - - - - - - "> - - -   - "> - - - -
    - - "> - -
    - - - - - diff --git a/trunk/apps/mailreader/src/main/webapp/Subscription.jsp b/trunk/apps/mailreader/src/main/webapp/Subscription.jsp deleted file mode 100644 index eb08f8d7f..000000000 --- a/trunk/apps/mailreader/src/main/webapp/Subscription.jsp +++ /dev/null @@ -1,68 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - - <s:text name="subscription.title.create"/> - - - <s:text name="subscription.title.edit"/> - - - <s:text name="subscription.title.delete"/> - - " rel="stylesheet" - type="text/css"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/mailreader/src/main/webapp/WEB-INF/database.xml b/trunk/apps/mailreader/src/main/webapp/WEB-INF/database.xml deleted file mode 100644 index 5710477aa..000000000 --- a/trunk/apps/mailreader/src/main/webapp/WEB-INF/database.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/trunk/apps/mailreader/src/main/webapp/WEB-INF/web.xml b/trunk/apps/mailreader/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 72571326a..000000000 --- a/trunk/apps/mailreader/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - Struts 2 Mailreader - - - contextConfigLocation - classpath*:applicationContext*.xml - - - - Struts2 - - org.apache.struts2.dispatcher.FilterDispatcher - - - - - Struts2 - /* - - - - - org.springframework.web.context.ContextLoaderListener - - - - - - - mailreader2.ApplicationListener - - - - - index.html - - - diff --git a/trunk/apps/mailreader/src/main/webapp/Welcome.jsp b/trunk/apps/mailreader/src/main/webapp/Welcome.jsp deleted file mode 100644 index a707fba4f..000000000 --- a/trunk/apps/mailreader/src/main/webapp/Welcome.jsp +++ /dev/null @@ -1,56 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib uri="/struts-tags" prefix="s" %> - - - - - <s:text name="index.title"/> - " rel="stylesheet" - type="text/css"/> - - - -

    - - - -

    Language Options

    -
      -
    • - - en - - English -
    • -
    • - - ja - - Japanese -
    • -
    • - - ru - - Russian -
    • -
    - -
    - -

    - " - alt=""/> -

    - -

    ">

    - - - - diff --git a/trunk/apps/mailreader/src/main/webapp/css/mailreader.css b/trunk/apps/mailreader/src/main/webapp/css/mailreader.css deleted file mode 100644 index bfc76487e..000000000 --- a/trunk/apps/mailreader/src/main/webapp/css/mailreader.css +++ /dev/null @@ -1,46 +0,0 @@ -/** -* Mailreader stylesheet -*/ - -body { - background-color: #FFFFFF; - color: #000000; - link: 000066; - visited: #660066; - active: #33CCCC; -} - -A:hover { - color: #FF0000; -} - -h1 { - font-family: Arial, Helvetica, sans-serif; -} - -h2 { - font-family: Arial, Helvetica, sans-serif; -} - -h3 { - font-family: Arial, Helvetica, sans-serif; -} - -h4 { - font-family: Arial, Helvetica, sans-serif; -} - -h5 { - font-family: Arial, Helvetica, sans-serif; -} - -h6 { - font-family: Arial, Helvetica, sans-serif; -} - -font.hint { - font-style: italic; - font-size: 80%; - font-family: Arial, Helvetica, sans-serif; - text-align: left; -} \ No newline at end of file diff --git a/trunk/apps/mailreader/src/main/webapp/index.html b/trunk/apps/mailreader/src/main/webapp/index.html deleted file mode 100644 index 1b01b3fb3..000000000 --- a/trunk/apps/mailreader/src/main/webapp/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -

    Loading ...

    - - diff --git a/trunk/apps/mailreader/src/main/webapp/struts-power.gif b/trunk/apps/mailreader/src/main/webapp/struts-power.gif deleted file mode 100644 index 5f4e9d426..000000000 Binary files a/trunk/apps/mailreader/src/main/webapp/struts-power.gif and /dev/null differ diff --git a/trunk/apps/mailreader/src/main/webapp/tour.html b/trunk/apps/mailreader/src/main/webapp/tour.html deleted file mode 100644 index 851ec084d..000000000 --- a/trunk/apps/mailreader/src/main/webapp/tour.html +++ /dev/null @@ -1,2479 +0,0 @@ - - - - - - - - A Walking Tour of the Struts 2 MailReader Application - - - -
    -

    A Walking Tour of the Struts 2 MailReader Application

    - -

    - - This article is meant to introduce a new user to Apache Struts 2 by - "walking through" a simple, but functional, application. - The article includes code snippets, but for the best result, you might - want to install the MailReader application on your own development - workstation and follow along. - Of course, the full source code to the MailReader is included in the - distribution. - -

    - -

    - - The tour assumes the reader has a basic understanding of the Java - language, JavaBeans, web applications, and JavaServer Pages. For - background on these technologies, see the - - Key Technologies Primer. - -

    - -
    - - - - - - - - - - -
    - -

    - The premise of the MailReader is that it is the first iteration of a - portal application. - This version allows users to register and maintain a set of - accounts with various mail servers. - If completed, the application would let users read mail from their - accounts. -

    - -

    - The MailReader application demonstrates registering with an application, - logging into an application, maintaining a master record, and maintaining - child records. - This article overviews the constructs needed to do these things, - including the server pages, Java classes, and configuration elements. -

    - -

    - For more about the MailReader, including alternate implementations and a - set of formal Use Cases, - please visit the - Struts University MailReader site. -

    - -
    -
    -

    - JAAS - - Note that for compatibility and ease of deployment, the MailReader - uses "application-based" authorization. - However, use of the standard Java Authentication and Authorization - Service (JAAS) is recommended for most applications. - (See the - Key Technologies Primer for more about - authentication technologies.) -

    -
    -
    - -

    - The tour starts with how the initial welcome page is displayed, and - then steps through logging into the application and editing a subscription. - Please note that this not a quick peek at a "Hello World" application. - The tour is a rich trek into a realistic, best practices application. - You may need to adjust your chair and get a fresh cup of coffee. - Printed, the article is 29 pages long (US). -

    - -

    Welcome Page

    - -

    - A web application, like any other web site, can specify a list of welcome pages. - When you open a web application without specifying a particular page, a - default "welcome page" is served as the response. -

    - -

    web.xml

    - -

    - When a web application loads, - the container reads and parses the "Web Application Deployment - Descriptor", or "web.xml" file. - The framework plugs into a web application via a servlet filter. - Like any filter, the "struts2" filter is deployed via the "web.xml". -

    - -
    -
    web.xml - The Web Application Deployment Descriptor
    -
    <?xml version="1.0" encoding="ISO-8859-1"?>
    -<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    -  "http://java.sun.com/dtd/web-app_2_3.dtd">
    -<web-app>
    -
    -  <display-name>Struts 2 MailReader</display-name>
    -
    -  <filter>
    -    <filter-name>struts2</filter-name>
    -    <filter-class>
    -      org.apache.struts2.dispatcher.FilterDispatcher
    -    </filter-class>
    -   </filter>
    -
    -  <filter-mapping>
    -    <filter-name>struts2</filter-name>
    -    <url-pattern>/*</url-pattern>
    -  </filter-mapping>
    -
    -  <listener>
    -    <listener-class>
    -      org.springframework.web.context.ContextLoaderListener
    -    </listener-class>
    -  </listener>
    -
    -  <!-- Application Listener for MailReader database -->
    -  <listener>
    -    <listener-class>
    -      mailreader2.ApplicationListener
    -    </listener-class>
    -  </listener>
    -
    -  <welcome-file-list>
    -    <welcome-file>index.html</welcome-file>
    -  </welcome-file-list>
    -
    -  </web-app>
    -
    - -

    - You might note taht the web.xml configuration does not specify which file extension - to use with actions. - The default extension for Struts 2 is ".action", - but the extension can be changed in the struts.properties file. - For compatability with prior releases, the MailReader uses a .do extension for actions. -

    - -
    -
    struts.properties
    -
    struts.action.extension = do
    -
    - -

    - The web.xml does specify a "Welcome File List" for the application. - When a web address refers to a directory rather than an individual file, - the container consults the Welcome File List for the name of a page to - open by default. -

    - -

    - However, most Struts applications do not refer to physical pages, - but to "virtual resources" called actions. - Actions specify code that we want to be run before a page - or other resource renders the response. - An accepted practice is to never link directly to server pages, - but only to logical action mappings. - By linking to actions, developers can often "rewire" an application - without editing the server pages. -

    - -
    -
    Best Practice:
    -
    -

    "Link actions not pages."

    -
    -
    - -

    - The actions are listed in one or more XML configuration files, - the default configuration file being named "struts.xml". - When the application loads, the struts.xml, and any other files - it includes, are parsed, and the framework creates a set of - configuration objects. - Among other things, the configuration maps a request for a certain - page to a certain action mapping. -

    - - -

    - Sites can list zero or more "Welcome" pages in the web.xml. - - Unless you are using Java 1.5, - actions cannot be specified as a Welcome page. - So, in the case of a Welcome page, - how do we follow the best practice of navigating through actions - rather than pages? -

    - -

    - One solution is to use a page to "bootstrap" one of our actions. - We can register the usual "index.html" as the Welcome page and have it - redirect to a "Welcome" action. -

    - -
    -
    MailReader's index.html
    -
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    -<html><head>
    -  <META HTTP-EQUIV="Refresh" CONTENT="0;URL=Welcome.do">
    -  </head>
    -  <body>
    -    <p>Loading ...</p>
    -</body></html>
    -
    - -

    - As an alternative, - we could also have used a JSP page that issued the redirect with a Struts tag, - but a plain HTML solution works as well. -

    - -

    Welcome.do

    - -

    - When the client requests "Welcome.do", the request is passed to the "struts2" - FilterDispatcher (that we registered in the web.xml file). - The FilterDispatcher retrieves the appropriate action mapping from the - configuration. - If we just wanted to forward to the Welcome page, we could use a simple - configuration element. -

    -
    -
    A simple "forward thru" action element
    -
    <action name="Welcome">
    -  <result>/pages/Welcome.jsp</result>
    -</action>
    -
    - -

    - If a client asks for the Welcome action ("Welcome.do"), the "/page/Welcome.jsp" - page would be returned in response. - The client does not know, or need to know, that the physical resource is located at - "/pages/Welcome.jsp". - All the client knows is that it requested the resource "Welcome.do". -

    - -

    - But if we peek at the configuration file for the MailReader, - we find a slightly more complicated XML element for the Welcome action. -

    - -
    -
    The Welcome action element
    -
    <action name="Welcome" class="mailreader2.Welcome">
    -    <result>/pages/Welcome.jsp</result>
    -    <interceptor-ref name="guest"/>
    -    </action>
    -
    - -

    - Here, the Welcome Java class executes whenever - someone asks for the Welcome action. - As it completes, the Action class can select which "result" is displayed. - The default result name is "success". - Another available result, defined at a global scope, is "error". -

    - -
    -
    Key concept:
    -
    -

    - The Action class doesn't need to know what result type is needed - for "success" or "error". - The Action can just return the logical name for a result, - without knowing how the result is implemented. -

    -
    -
    - -

    - The net effect is that all of the result details, - including the paths to server pages, - all can be declared once in the configuration. - Tightly coupled implementation details are not scattered all over - the application. -

    - -
    -
    Key concept:
    -
    -

    - The Struts configuration lets us separate concerns and "say it once". - The configuration helps us "normalize" an application, - in much the same way we normalize a database schema. -

    -
    -
    - - -

    - OK ... but why would a Welcome Action want to choose between "success" and - "error"? -

    - -

    Welcome Action

    - -

    - The MailReader application retains a list of users along with their email - accounts. - The application stores this information in a database. - If the application can't connect to the database, the application can't do - its job. - So before displaying the Welcome page, the Welcome - class checks to see if the database is available. -

    - -

    - The MailReader is also an internationalized application. - So, the Welcome Action class checks to see if the message resources are - available too. - If both resources are available, the class passes back the "success" token. - Otherwise, the class passes back the "error" token, - so that the appropriate messages can be displayed. -

    - -
    -
    The Welcome Action class
    -
    package mailreader2;
    -public class Welcome extends MailreaderSupport {
    -
    -  public String execute() {
    -
    -    // Confirm message resources loaded
    -    String message = getText(Constants.ERROR_DATABASE_MISSING);
    -    if (Constants.ERROR_DATABASE_MISSING.equals(message)) {
    -      addActionError(Constants.ERROR_MESSAGES_NOT_LOADED);
    -    }
    -
    -    // Confirm database loaded
    -    if (null==getDatabase()) {
    -      addActionError(Constants.ERROR_DATABASE_NOT_LOADED);
    -    }
    -
    -    if (hasErrors()) {
    -      return ERROR;
    -    }
    -    else {
    -      return SUCCESS;
    -    }
    -  }
    -}
    -
    - -

    - Several common result names are predefined, - including ERROR, SUCCESS, LOGIN, NONE, and INPUT, - so that these tokens can be used consistently across Struts 2 applications. -

    - - -

    Global Results

    - -

    - As mentioned, "error" is defined in a global scope. - Other actions may have trouble connecting to the database later, - or other unexpected errors may occur. - The MailReader defines the "error" result as a Global Result, - so that any action can use it. -

    - -
    -
    MailReader's global-result element
    -
     <global-results>
    -  <result name="error">/pages/Error.jsp</result>
    -  <result name="invalid.token">/pages/Error.jsp</result>
    -  <result name="login" type="redirect-action">Login!input</result>
    -</global-results>
    -
    - -

    - Of course, if an individual action mapping defines its own "error" result type, - the local result would be used instead. -

    - -

    ApplicationListener.java -

    - -

    - The database is exposed as an object stored in application scope. - The database object is based on an interface. - Different implementations of the database could be loaded without changing - the rest of the application. - But how is the database object loaded in the first place? -

    - -

    - The database is created by a custom Listener that we configured in the "web.xml". -

    - -
    -
    mailreader2.ApplicationListener
    -
     <listener>
    -  <listener-class>
    -    mailreader2.ApplicationListener
    -  </listener-class>
    -</listener>
    -
    - -

    - By default, our ApplicationListener loads a MemoryDatabase - implementation of the UserDatabase. - MemoryDatabase stores the database content as a XML document, - which is parsed and loaded as a set of nested hashtables. - The outer table is the list of user objects, each of which has its own - inner hashtable of subscriptions. - When you register, a user object is stored in this hashtable. - When you login, the user object is stored within the session context. -

    - -

    - The database comes seeded with a sample user. - If you check the "database.xml" file under "/src/main/resources", - you'll see the sample user described in XML. -

    - -
    -
    The "seed" user element from the MailReader database.xml
    -
    <user username="user" fromAddress="John.User@somewhere.com"
    -  fullName="John Q. User" password="pass">
    -    <subscription host="mail.hotmail.com" autoConnect="false"
    -      password="bar" type="pop3" username="user1234">
    -    </subscription>
    -    <subscription host="mail.yahoo.com" autoConnect="false" password="foo"
    -      type="imap" username="jquser">
    -    </subscription>
    -</user>
    -
    - -

    - The "seed" user element creates a registration record for "John Q. User", - with the subscription detail for his hotmail and yahoo accounts. -

    - -

    Message Resources -

    - -

    - As mentioned, MailReader is an internationalized application. - In Struts 2, message resources are associated with the Action class being processed. - If we check the source, we find a language resource bundle named - MailreaderSupport. - MailreaderSupport is our base class for all the MailReader Actions. - Since all of our Actions extend MailreaderSupport, - all of our Actions can use the same resource bundle. -

    - -
    -
    Message Resource entries used by the Welcome page
    -
    index.heading=MailReader Application Options
    -index.login=Log on to the MailReader Application
    -index.registration=Register with the MailReader Application
    -index.title=MailReader Demonstration Application
    -index.tour=A Walking Tour of the MailReader Demonstration Application
    -
    - -

    - If you change a message in the resource, and then rebuild and reload the - application, the change will appear throughout the application. - If you provide message resources for additional locales, you can - localize your application. - The MailReader provides resources for English, Russian, and Japanese. -

    - -

    Welcome Page

    - -

    - After confirming that the necessary resources exist, the Welcome action - forwards to the Welcome page. -

    -
    -
    Welcome.jsp
    -
    <%@ page contentType="text/html; charset=UTF-8" %>
    -<%@ taglib prefix="s" uri="http://struts.apache.org/tags" %>
    -  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    -  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    -    <head>
    -      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    -      <title><s:text name="index.title"/></title>
    -      <link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
    -      type="text/css"/>
    -    </head>
    -
    -    <body>
    -      <h3><s:text name="index.heading"/></h3>
    -
    -      <ul>
    -        <li><a href="<s:url action="Registration!input"/>"><s:text
    -          name="index.registration"/></a></li>
    -        <li><a href="<s:url action="Login!input"/>"><s:text
    -          name="index.login"/></a></li>
    -      </ul>
    -
    -      <h3>Language Options</h3>
    -      <ul>
    -          <li>
    -              <s:url id="en" action="Welcome">
    -                  <s:param name="request_locale">en</s:param>
    -              </s:url>
    -               <s:a href="%{en}">English</s:a>
    -           </li>
    -          <li>
    -              <s:url id="ja" action="Welcome">
    -                <s:param name="request_locale">ja</s:param>
    -              </s:url>
    -              <s:a href="%{ja}">Japanese</s:a>
    -          </li>
    -          <li>
    -              <s:url id="ru" action="Welcome">
    -              <s:param name="request_locale">ru</s:param>
    -              </s:url>
    -              <s:a href="%{ru}">Russian</s:a>
    -          </li>
    -      </ul>
    -
    -    <hr />
    -
    -    <p><s:i18n name="alternate">
    -    <img src="<s:text name="struts.logo.path"/>"
    -      alt="<s:text name="struts.logo.alt"/>"/>
    -    </s:i18n></p>
    -
    -    <p><a href="<s:url action="Tour" />"><s:text name="index.tour"/></a></p>
    -
    -  </body>
    -</html>
    -
    - -

    - At the top of the Welcome page, there are several directives that load the - Struts 2 tag libraries. - These are just the usual red tape that goes with any JSP file. - The rest of the page utilizes three Struts JSP tags: - "text", "url", and "i18n". -

    - -

    - (We use the tag prefix "s:" in the Struts 2 MailReader application, - but you can use whatever prefix you like in your applications.) -

    - -

    - The text tag inserts a message from an - application's default resource bundle. - If the framework's locale setting is changed for a user, - the text tag will render messages from the new locale's resource - bundle instead. -

    - -

    - The url tag can render a reference to an - action or any other web resource, - applying "URL encoding" to the hyperlinks as needed. - Java's URL encoding feature lets your application maintain client state - without requiring cookies. -

    - -
    -
    Tip:
    -
    -

    - Cookies - - If you turn cookies off in your browser, and then reload your browser - and this page, - you will see the links with the Java session id information attached. - (If you are using Internet Explorer and try this, - be sure you reset cookies for the appropriate security zone, - and that you disallow "per-session" cookies.) -

    -
    -
    - -

    - The i18n tag provides access to multiple resource bundles. - The MailReader application uses a second set of message resources for - non-text elements. - When these are needed, we use the "i18n" tag to specify a different bundle. -

    - -

    - The alternate bundle is stored in the {{/src/main/resources}} folder, - so that it ends up under "classes", which is on the application's class path. -

    - -

    - In the span of a single request for the Welcome page, the framework has done - quite a bit already: -

    - -
      -
    • - Confirmed that required resources were loaded during initialization. -
    • - -
    • - Written all the page headings and labels from internationalized - message resources. -
    • - -
    • - Automatically URL-encoded paths as needed. -
    • -
    - -

    - When rendered, the Welcome page lists two menu options: - one to register with the application and one to log on (if you have - already registered). - Let's follow the Login link first. -

    - -

    Login

    - -

    - If you choose the Login link, and all goes well, the Login action forwards - control to the Login page. -

    - -

    Login Page

    - -

    - The Login page displays a form that accepts a username and password. - You can use the default username and password to login - (user and pass), if - you like. Try omitting or misspelling the username and password in - various combinations to see how the application reacts. - Note that both the username and password are case sensitive. -

    - -
    -
    Login.jsp
    -
    <%@ page contentType="text/html; charset=UTF-8" %>
    -  <%@ taglib prefix="s" uri="http://struts.apache.org/tags"  %>
    -  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    -  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    -  <head>
    -    <title><s:text name="login.title"/></title>
    -      <link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
    -        type="text/css"/>
    -  </head>
    -  <body onLoad="self.focus();document.Login.username.focus()">
    -    <s:actionerror/>
    -    <s:form action="Login" validate="true">
    -      <s:textfield label="%{getText('username')}" name="username"/>
    -      <s:password label="%{getText('password')}" name="password"/>
    -      <s:submit value="%{getText('button.save')}"/>
    -      <s:reset value="%{getText('button.reset')}"/>
    -      <s:submit action="Login!cancel" onclick="form.onsubmit=null"
    -        value="%{getText('button.cancel')}"/>
    -    </s:form>
    -    <jsp:include page="Footer.jsp"/>
    -  </body>
    -</html>
    -
    - -

    - We already saw some of the tags used by the Login page on the Welcome page. - Let's focus on the new tags. -

    - -

    - The first new tag on the Login page is actionerrors. - Most of the possible validation errors are related to a single field. - If you don't enter a username, - the framework can place an error message near the tag prompting you to - enter a username. - But some messages are not related to a single field. - For example, the database might be down. - If the action returns an "Action Error", as opposed to a "Field Error", - the messages are rendered in place of the "actionerror" tag. - The text for the validation errors, whether they are Action Errors or - Field Errors, can be specified in the resource bundle, - making the messages easy to manage and localize. -

    - -

    - The second new tag is form. - This tag renders a HTML form tag. - The "validate=true" setting enables client-side validation, - so that the form can be validated with JavaScript before being sent - back to the server. - The framework will still validate the form again, just to be sure, but the - client-side validation can save a few round-trips to the server. -

    - -

    - Within the form tag, - we see four more new tags: "textfield", "password", "submit", - and "reset". We also see a second usage of "submit" that utilizes an - "action" attribute. -

    - -

    - When we place a control on a form, we usually need to code a set of - HTML tags to do everything we want to do. - Most often, we do not just want a plain "input type=text" tag. - We want the input field to have a label too, and maybe even - a tooltip. And, of course, a place to print a message - should invalid data be entered. -

    - -

    - The Struts Tags support templates and themes so that a set of HTML tags can be - rendered from a single Struts Tag. For example, the single tag -

    - -
    
    -    <s:textfield label="%{getText('username')}" name="username"/>
    -
    - -

    - generates a wad of HTML markup. -

    - -
    -
    <tr>
    -  <td class="tdLabel">
    -    <label for="Login_username" class="label">Username:</label>
    -  </td>
    -  <td>
    -    <input type="text" name="username" value="" id="Login_username"/>
    -  </td>
    -</tr>
    -
    - -

    - If for some reason you don't like the markup generated by a Struts Tag, - it's each to change. - Each tag is driven by a template that can be updated on a tag-by-tag basis. - For example, - here is the default template that generates the markup for the ActionErrors tag: -

    - -
    -
    <#if (actionErrors?exists && actionErrors?size > 0)>
    -  <ul>
    -    <#list actionErrors as error>
    -      <li><span class="errorMessage">${error}</span></li>
    -    </#list>
    -  </ul>
    -</#if>
    -
    - -

    - If you wanted ActionErrors displayed in a table instead of a list, - you could edit a copy of this file, save it as a file named - "template/simple/actionerror.ftl", - and place this one file at the base of your application's classpath. -

    - -
    -
    <#if (actionErrors?exists && actionErrors?size > 0)>
    -  <table>
    -    <#list actionErrors as error>
    -      <tr><td><span class="errorMessage">${error}</span></td></tr>
    -    </#list>
    -  </table>
    -</#if>
    -
    - -

    - Under the covers, the framework uses - Freemarker - for its standard templating language. - FreeMarker is similar to - Velocity, - but it offers better error reporting and some additional features. - If you prefer, Velocity and JSP templates can also be used to create your own tags. -

    - -

    - The password tag renders a "input type=password" - tag, along with the usual template/theme markup. - By default, the password tag will not retain input if the submit fails. - If the username is wrong, - the client will have to enter the password again too. - (If you did want to retain the password when validation fails, - you can set the tag's "showPassword" property to true.) -

    - -

    - Unsurprisingly, the submit and reset tags - render buttons of the corresponding types. -

    - -

    - The second submit button is more interesting. -

    - -
      <s:submit action="Login!cancel" onclick="form.onsubmit=null"
    -    value="%{getText('button.cancel')}"/>
    -
    - -

    - Here we are creating the Cancel button for the form. - The button's attribute action="Login!cancel" - tells the framework to submit to the Login's "cancel" method - instead of the usual "execute" method. - The onclick="form.onsubmit=null" script defeats client-side validation. - On the server side, "cancel" is on a special list of methods that bypass validation, - so the request will go directly to the Action's cancel method. - Another entry on the special-case list is the "input" method. -

    - -
    -
    Tip:
    -
    -

    - The Struts Tags have options and capabilities beyond what we have shown here. - For more see, the - Struts Tag documentation. -

    -
    -
    - -

    - OK, but how do the tags know that both of these fields are required? - How do they know what message to display when the fields are empty? -

    - -

    - For the answers, we need to look at another flavor of configuration file: - the "validation" file. -

    - -

    Login-validation.xml -

    - -

    - While it is not hard to code data-entry validation into an Action class, - the framework provides an even easier way to validate input. -

    - -

    - The validation framework is configured through another XML document, the - Login-validation.xml. -

    - -
    -
    Validation file for Login Action
    -
    <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
    -  "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
    -<validators>
    -  <field name="username">
    -    <field-validator type="requiredstring">
    -    <message key="error.username.required"/>
    -  </field-validator>
    -  </field>
    -  <field name="password">
    -    <field-validator type="requiredstring">
    -    <message key="error.password.required"/>
    -    </field-validator>
    -  </field>
    -</validators>
    -
    -
    - -

    - You may note that the DTD refers to "XWork". - - Open Symphony XWork - is a generic command-pattern framework that can be used outside of a - web environment. In practice, Struts 2 is a web-based extension of the - XWork framework. -

    - -

    - The field elements correspond to the ActionForm properties. - The username and password field elements - say that each field depends on the "requiredstring" validator. - If the username is blank or absent, validation will fail and an error - message is generated. - The messages would be based on the "error.username.required" or - "error.password.required" message templates, from the resource bundle. -

    - - - -

    Login Action

    - -

    - If validation passes, the framework invokes the "execute" method of the Login Action. - The actual Login Action is brief, since most of the functionality derives - from the base class, MailreaderSupport. -

    - -
    -
    Login.java
    -
    package mailreader2;
    -import org.apache.struts.apps.mailreader.dao.User;
    -public final class Login extends MailreaderSupport {
    -public String execute() throws ExpiredPasswordException {
    -  User user = findUser(getUsername(), getPassword());
    -  if (user != null) {
    -    setUser(user);
    -  }
    -  if (hasErrors()) {
    -    return INPUT;
    -  }
    -    return SUCCESS;
    -  }
    -}
    -
    - -

    - Login lays out what we do to authenticate a user. - We try to find the user using the credentials provided. - If the user is found, we cache a reference. - If the user is not found, we return "input" so the client can try again. - Otherwise, we return "success", so that the client can access the rest of the application. -

    - -

    MailreaderSupport.java

    - -

    - Let's look at the relevant properties and methods from MailreaderSupport - and another base class, ActionSupport, namely - "getUsername", "getPassword", "findUser", "setUser", and "hasErrors". -

    - -

    - The framework lets you define - JavaBean properties - directly on the Action. - Any JavaBean property can be used, including rich objects. - When a request comes in, - any public properties on the Action class are matched with the request parameters. - When the names match, the request parameter value is set to the JavaBean property. - The framework will make its best effort to convert the data, - and, if necessary, it will report any conversion errors. -

    - -

    - The Username and Password properties are nothing fancy, - just standard JavaBean properties. -

    - -
    -
    MailreaderSupport.getUsername() and getPassword()
    -
    private String username = null;
    -public String getUsername() {
    -  return this.username;
    -}
    -public void setUsername(String username) {
    -  this.username = username;
    -}
    -
    -private String password = null;
    -public String getPassword() {
    -  return this.password;
    -}
    -public void setPassword(String password) {
    -  this.password = password;
    -}
    -
    - -

    - We use these properties to capture the client's credentials, - and pass them to the more interesting findUser method. -

    - -
    -
    MailreaderSupport.findUser
    -
    public User findUser(String username, String password)
    -  throws ExpiredPasswordException {
    -  User user = getDatabase().findUser(username);
    -  if ((user != null) && !user.getPassword().equals(password)) {
    -    user = null;
    -  }
    -  if (user == null) {
    -    this.addFieldError("password", getText("error.password.mismatch"));
    -  }
    -  return user;
    -}
    -
    - -

    - The "findUser" method dips into the MailReader Data Access Object layer, - which is represented by the Database property. - The code for the DAO layer is maintained as a separate component. - The MailReader application imports the DAO JAR, - but it is not responsible for maintaining any of the DAO source. - Keeping the data access layer at "arms-length" is a very good habit. - It encourages a style of development where the data access layer - can be tested and developed independently of a specific end-user application. - In fact, there are several renditions of the MailReader application, - all which share the same MailReader DAO JAR! -

    - -
    -
    Best Practice:
    -
    -

    - "Strongly separate data access and business logic from the rest of - the application." -

    -
    -
    - -

    - When "findUser" returns, - the Login Action looks to see if a valid (non-null) User object is returned. - A valid User is passed to the User property. - Although it is still a JavaBean property, - the User property is not implemented in quite the same way as Username and Password. -

    - -
    -
    MailreaderSupport.setUser
    -
    public User getUser() {
    -  return (User) getSession().get(Constants.USER_KEY);
    -}
    -public void setUser(User user) {
    -  getSession().put(Constants.USER_KEY, user);
    -}
    -
    - -

    - Instead of using a field to store the property value, - "setUser" passes it to a Session property. -

    - -
    -
    MailreaderSupport.getSession() and setSession()
    -
    private Map session;
    -public Map getSession() {
    -  return session;
    -
    -public void setSession(Map value) {
    -  session = value;
    -}
    -
    - -

    - To look at the MailreaderSupport class, - you would think the Session property is a plain-old Map. - In fact, - the Session property is an adapter that is backed by the servlet session object at runtime. - The MailreaderSupport class doesn't need to know that though. - It can treat Session like any other Map. - We can also test the MailreaderSupport class by passing it some other implementation of - Map, running the test, - and then looking to see what changes MailreaderSupport made to our "mock" Session object. -

    - -

    - But, when MailreaderSupport is running inside a web application, - how does it acquire a reference to the servlet session? -

    - -

    - Good question. If you were to look at just the MailreaderSupport class, - you would not see a single line of code that sets the session property. - But, yet, when we run the class, the session property is not null. - Hmmm. -

    - -

    - The magic that provides the Session property a runtime value is called - "dependency injection". - The MailreaderSupport class implements a interface called SessionAware. - SessionAware is bundled with the framework, - and it defines a setter for the Session property. -

    - -

    - public void setSession(Map session); -

    - -

    - Also bundled with the framework is an object called the - ServletConfigInterceptor. - If the ServletConfigInterceptor sees that an Action implements the SessionAware interface, - it automatically set the session property. -

    - -
    if (action instanceof SessionAware) {
    -  ((SessionAware) action).setSession(context.getSession());
    -}
    - -

    - The framework uses these "Interceptor" classes to create a front controller - for each action an application defines. - Each Interceptor can peek at the request before an Action class is invoked, - and then again after the Action class is invoked. - (If you have worked with Servlet - Filters, - you will recognize this pattern. - But, unlike Filters, Interceptors are not tied to HTTP. - Interceptors can be tested and developed outside of a web application.) -

    - -

    - You can use the same set of Interceptors for all your actions, - or define a special set of Interceptors for any given action, - or define different sets of Interceptors to use with different types of actions. - The framework comes with a default set of Interceptors, - that it will use when another set is not specified, - but you can designate your own default Interceptor set (or "stack") - in the Struts configuration. -

    - -

    - Many Interceptors provide a utility or helper functions, - like setting the session property. - Others, like the ValidationInterceptor, - can change the workflow of an action. - Interceptors are key feature of the framework, - and we will see a few more on the tour. -

    - -

    - If a valid User is not found, or the password doesn't match, - the "findUser" method invokes the addFieldError method to note the - problem. - When "findUser" returns, the Login Action checks for errors, - and then it returns either INPUT or SUCCESS. -

    - -

    - The "addFieldError" method is provided by the ActionSupport class, - which is bundled with the framework. - The constants for INPUT and SUCCESS are also provided by ActionSupport. - While the ActionSupport class provides many useful utilities, - you are not required to use it as a base class. - Any Java class can be used as an Action, if you like. -

    - -

    - It is a good practice to provide a base class with utilities - that can be shared by an application's Action classes. - The framework does this with ActionSupport, - and the MailReader application does the same with the MailreaderSupport class. -

    - -
    -
    Best Practice:
    -
    -

    "Use a base class to define common functionality."

    -
    -
    - -

    - But, what happens if Login returns INPUT instead of SUCCESS. - How does the framework know what to do next? -

    - -

    - To answer that question, - we need to turn back to the Struts configuration - and look at how Login is declared. -

    - - -

    Login Configuration

    - -

    - The Login action element outlines how the Login workflow operates, - including what to do when the Action returns "input", - or the default result name "success". -

    - -
    -
    mailreader-support.xml Login
    -
    <action name="Login!*" method="{1}" class="mailreader2.Login">
    -  <result name="input">/pages/Login.jsp</result>
    -  <result name="cancel" type="redirect-action">Welcome</result>
    -  <result type="redirect-action">MainMenu</result>
    -  <result name="expired" type="chain">ChangePassword</result>
    -  <exception-mapping
    -    exception="org.apache.struts.apps.mailreader.dao.ExpiredPasswordException"
    -  result="expired"/>
    -  <interceptor-ref name="guest"/>
    -</action>
    -
    - -

    - You might notice that the name of the Login action element is not "Login" - but "Login!*". - The asterisk is a special "wildcard" notation that tells the framework to match any series - of character at this point. - In the method attribute, - the "{1}" notation indicates that framework should substitute whatever characters match - the asterisk at runtime. - When we cite actions like "Login!cancel" or "Login!input", - the framework matches "cancel" or "input" with the wildcard and fills in the blanks. -

    - -

    - The "trailing bang" notation was hardwired into WebWork 2. - To provide backward compatibility, - the notation is supported by Struts 2.0. - If you prefer to use wildcards to emulate the same notation, - as the Mailreader does, - you should disable the old notation in the Struts properties file. -

    - -
    -
    struts.properties
    -
    struts.enable.DynamicMethodInvocation = false
    -
    - -

    - Using wildcards with a exclamation point (or "bang") is not the only way we can use - wilcards to invoke methods. - If we wanted to use actions like "inputLogin", - we could move the asterisk and use an action name like "*Login". -

    - -

    - Within the Login action element, the first result element is named "input". - If validation or authentification fail, - the Action class will return "input" and the framework will transfer control to the - "Login.jsp" page. -

    - -

    - The second result element is named cancel. - If someone presses the cancel button on the Login page, - the Action class will return "cancel", this result will be selected, - and the framework will issue a redirect to the Welcome action. -

    - -

    - The third result has no name, - so it will be called if the default success token is returned. - So, if the Login succeeds, - control will transfer to the MainMenu action. -

    - -

    - The MailReader DAO exposes a "ExpiredPasswordException". - If the DAO throws this exception when the User logs in, - the framework will process the exception-mapping - and transfer control to the "ChangePassword" action. -

    - -

    - Just in case any other Exceptions are thrown, - the MailReader application also defines a global handler. -

    - -
    -
    mailreader-default.xml exception-mapping
    -
    <global-exception-mappings>
    -  <exception-mapping
    -    result="error"
    -    exception="java.lang.Exception"/>
    -</global-exception-mappings>
    -
    - -

    - If an unexpected Exception is thrown, - the exception-mapping will transfer control to the action's "error" result, - or to a global "error" result. - The MailReader defines a global "error" result - which transfers control to an "Error.jsp" page - that can display the error message. -

    - -
    -
    Error.jsp
    -
    <%@ page contentType="text/html; charset=UTF-8" %>
    -<%@ taglib prefix="s" uri="http://struts.apache.org/tags" %>
    -  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    -  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    -  <head>
    -    <title>Unexpected Error</title>
    -  </head>
    -  <body>
    -    <h2>An unexpected error has occured</h2>
    -    <p>
    -      Please report this error to your system administrator
    -      or appropriate technical support personnel.
    -      Thank you for your cooperation.
    -    </p>
    -    <hr />
    -    <h3>Error Message</h3>
    -    <s:actionerror />
    -    <p>
    -      <s:property value="%{exception.message}"/>
    -    </p>
    -    <hr />
    -    <h3>Technical Details</h3>
    -    <p>
    -      <s:property value="%{exceptionStack}"/>
    -    </p>
    -    <jsp:include page="Footer.jsp"/>
    -  </body>
    -</html>
    -
    - -

    - The Error page uses property tags to expose - the Exception message and the Exception stack. -

    - -

    - Finally, the Login action specifies an InterceptorStack - named defaultStack. - If you've worked with Struts 2 or WebWork 2 before, that might seem strange, - since "defaultStack" is the factory default. -

    - -

    - In the MailReader application, most of the actions are only available - to authenticated users. - The exceptions are the Welcome, Login, and Register actions - which are available to everyone. - To authenticate clients, - the MailReader uses a custom Interceptor and a custom Interceptor stack. -

    - -
    -
    mailreader2.AuthenticationInterceptor
    -
    package mailreader2;
    -import com.opensymphony.xwork2.interceptor.Interceptor;
    -import com.opensymphony.xwork2.ActionInvocation;
    -import com.opensymphony.xwork2.Action;
    -import java.util.Map;
    -import org.apache.struts.apps.mailreader.dao.User;
    -
    -public class AuthenticationInterceptor implements Interceptor {
    -  public void destroy () {}
    -  public void init() {}
    -  public String intercept(ActionInvocation actionInvocation) throws Exception {
    -    Map session = actionInvocation.getInvocationContext().getSession();
    -    User user = (User) session.get(Constants.USER_KEY);
    -    boolean isAuthenticated = (null!=user) && (null!=user.getDatabase());
    -    if (isAuthenticated) {
    -      return actionInvocation.invoke();
    -    }
    -    else {
    -      return Action.LOGIN;
    -    }
    -  }
    -}
    -
    - -

    - The AuthenticationInterceptor looks to see if a User object - has been stored in the client's session state. - If so, it returns normally, and the next Interceptor in the set would be invoked. - If the User object is missing, the Interceptors returns "login". - The framework would match "login" to the global result, - and transfer control to the Login action. -

    - -

    - The MailReader defines three custom Interceptor stacks: "user", "user-submit", - and "guest". -

    - -
    -
    mailreader-default.xml interceptors
    -
    <interceptors>
    -  <interceptor name="authentication"
    -               class="mailreader2.AuthenticationInterceptor"/>
    -  <interceptor-stack name="user" >
    -      <interceptor-ref name="authentication" />
    -      <interceptor-ref name="defaultStack"/>
    -  </interceptor-stack>
    -  <interceptor-stack name="user-submit" >
    -      <interceptor-ref name="token-session" />
    -      <interceptor-ref name="user"/>
    -  </interceptor-stack>
    -  <interceptor-stack name="guest" >
    -      <interceptor-ref name="defaultStack"/>
    -  </interceptor-stack>
    -</interceptors>
    -<default-interceptor-ref name="user"/>
    -
    - -

    - The user stacks require that the client be authenticated. - In other words, that a User object is present in the session. - The actions using a guest stack can be accessed by any client. - The -submit versions of each can be used with actions - with forms, to guard against double submits. -

    - -
    Double Submits
    - -

    - A common problem with designing web applications is that users are impatient - and response times can vary. - Sometimes, people will press a submit button a second time. - When this happens, the browser submits the request again, - so that we now have two requests for the same thing. - In the case of registering a user, if someone does press the submit button - again, and their timing is bad, - it could result in the system reporting that the username has already been - used. - (The first time the button was pressed.) - In practice, this would probably never happen, but for a longer running - process, like checking out a shopping cart, - it's easier for a double submit to occur. -

    - -

    - To forestall double submits, and "back button" resubmits, - the framework can generate a token that is embedded in the form - and also kept in the session. - If the value of the tokens do not compare, - then we know that there has been a problem, - and that a form has been submitted twice or out of sequence. -

    - -

    - The Token Session Interceptor will also attempt to provide intelligent - fail-over in the event of multiple requests using the same session. - That is, it will block subsequent requests until the first request is complete, - and then instead of returning the "invalid.token" code, - it will attempt to display the same response that the - original, valid action invocation would have displayed -

    - -

    - Because the default interceptor stack will now authenticate the client, - we need to specify the standard "defaultStack" for the three - "guest actions", Welcome, Login, and Register. - Requiring authentification by default is the better practice, since it - means that we won't forget to enable it when creating new actions. - Meanwhile, those pesky users will ensure that we don't forget to disable - authentification for "guest" services. -

    - -

    MainMenu

    - -

    - On a successful login, the Main Menu page displays. - If you logged in using the demo account, - the page title should be "Main Menu Options for John Q. User". - Below this legend should be two links: -

    - -
      -
    • - Edit your user registration profile -
    • -
    • - Log off MailReader Demonstration Application -
    • -
    - -

    - Let's review the source for the "MainMenu" action mapping, - and the "MainMenu.jsp". -

    - -
    -
    Action mapping element for MainMenu
    -
    <action name="MainMenu" class="mailreader2.MailreaderSupport">
    -    <result>/pages/MainMenu.jsp</result>
    -    </action>
    - -
    MainMenu.jsp
    -
    <%@ page contentType="text/html; charset=UTF-8" %>
    -<%@ taglib prefix="s" uri="http://struts.apache.org/tags"  %>
    -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    -  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    -  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    -  <head>
    -    <title><s:text name="mainMenu.title"/></title>
    -      <link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
    -      type="text/css"/>
    -  </head>
    -
    -  <body>
    -  <h3><s:text name="mainMenu.heading"/> <s:property
    -    value="user.fullName"/></h3>
    -  <ul>
    -    <li><a href="<s:url action="Registration!input" />">
    -        <s:text name="mainMenu.registration"/>
    -      </a>
    -    </li>
    -    <li><a href="<s:url action="Logout" />">
    -      <s:text name="mainMenu.logout"/>
    -      </a>
    -    </ul>
    -  </body>
    -</html>
    -
    - -

    - The source for "MainMenu.jsp" also contains a new tag, - property, which we use to customize the page with the - "fullName" property of the authenticated user. -

    - -

    - Displaying the user's full name is the reason the MainMenu action - references the MailreaderSupport class. - The MailreaderSupport class has a User property that the text tag - can access. - If we did not utilize MailreaderSupport, - the property tag would not be able to find the User object to print - the full name. -

    - -

    - The customized MainMenu page offers two standard links. - One is to "Edit your user registration profile". - The other is to "Logout the MailReader Demonstration Application". -

    - -

    Registration page -

    - -

    - If you follow the "Edit your user registration profile" link from the Main - Menu page, - we will finally reach the heart of the MailReader application: the - Registration, or "Profile", page. - This page displays everything MailReader knows about you - (or at least your login), - while utilizing several interesting techniques. -

    - -

    - To do double duty as the "Create" Registration page and the "Edit" - Registration page, - the "Registration.jsp" makes extensive use of the test tags, - to make it appears as though there are two distinct pages. -

    - -
    -
    Registration.jsp - head element
    -
    <head>
    -  <s:if test="task=='Create'">
    -    <title><s:text name="registration.title.create"/></title>
    -  </s:if>
    -  <s:if test="task=='Edit'">
    -    <title><s:text name="registration.title.edit"/></title>
    -  </s:if>
    -  <link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
    -    type="text/css"/>
    -</head>
    -
    - -

    - For example, if client is editing the form (task == 'Edit'), - the page inserts the username from the User object. - For a new Registration (task == 'Create'), - the page creates an empty data-entry field. -

    - -
    -
    Note:
    -
    -

    - Presention Logic - - The "test" tag is a convenient way to express presentation - logic within your pages. - Customized pages help to prevent user error, - and dynamic customization reduces the number of server pages your - application needs to maintain, among other benefits. -

    -
    -
    - -

    - The page also uses logic tags to display a list of subscriptions - for the given user. - If the RegistrationForm has task set to "Edit", - the lower part of the page that lists the subscriptions is exposed. -

    - -
    -
    -
    <s:if test="task == 'Edit'">
    -  <div align="center">
    -    <h3><s:text name="heading.subscriptions"/></h3>
    -  </div>
    -    <!-- ... -->
    -  </s:if>
    -<jsp:include page="Footer.jsp"/>
    -</body></html>
    -
    - -

    - Otherwise, the page contains just the top portion -- - a data-entry form for managing the user's registration. -

    - -

    iterator

    - -

    - Besides "if" there are several other control tags that you can use - to sort, filter, or iterate over data. - The Registration page includes a good example of using the iterator - tag to display the User's Subscriptions. -

    - -

    - The subscriptions are stored in a hashtable object, which is in turn - stored in the user object. - So to display each subscription, we have to reach into the user object, - and loop through the members of the subscription collection. - Using the iterator tag, you can code it the way it sounds. -

    - -
    -
    Using iterator to list the Subscriptions
    -
    <s:iterator value="user.subscriptions">
    -  <tr>
    -    <td align="left">
    -      <s:property value="host"/>
    -    </td>
    -    <td align="left">
    -       <s:property value="username"/>
    -   </td>
    -  <td align="center">
    -      <s:property value="type"/>
    -  </td>
    -  <td align="center">
    -     <s:property value="autoConnect"/>
    -  </td>
    -  <td align="center">
    -    <a href="<s:url action="Subscription!delete"><s:param name="host" value="host"/></s:url>">
    -      <s:text name="registration.deleteSubscription"/>
    -    </a> 
    -    <a href="<s:url action="Subscription!edit"><s:param name="host" value="host"/></s:url>">
    -      <s:text name="registration.editSubscription"/>
    -     </a>
    -   </td>
    - </tr>
    -</s:iterator>
    -
    - -

    - When the iterator renders, it generates a list of Subscriptions for the current User. -

    - -
    - -
    -

    Current Subscriptions

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Host Name - - User Name - - Server Type - - Auto - - Action -
    - mail.hotmail.com - - user1234 - - pop3 - - false - - - Delete - -   - - Edit - -
    - mail.yahoo.com - - jquser - - imap - - false - - - Delete - -   - - Edit - -
    - Add - -
    - -

    - Now look back at the code used to generate this block. -

    -

    - Notice anything nifty? -

    -

    - How about that the markup between the iterator tag is - actually simpler than the markup that we would use to render one row of the - table? -

    -

    - Instead of using a qualified reference like "value=user.subscription[0].host", - we use the simplest possible reference: "value=host". - We didn't have to define a local variable, and reference that local in the loop code. - The reference to each item in the list is automatically resolved, no fuss, no muss. -

    -

    - Nice trick! -

    - -

    - The secret to this magic is the value stack. - Next to Interceptors, the value stack is probably the coolest thing there is about the - framework. - To explain the value stack, let's step back and start from the beginning. -

    - -

    - Merging dynamic data into static web pages is a primary reason - we create web applications. - The Java API has a mechanism that allows you to - place objects in a servlet scope (page, request, session, or - application), and then retrieve them using a JSP scriplet. - If the object is placed directly in one of the scopes, - a JSP tag or scriptlet can find that object by searching page scope and - then request scope, and session scope, and finally application scope. -

    - -

    - The value stack works much the same way, only better. - When you push an object on the value stack, - the public properties of that object become first-class properties of the stack. - The object's properties become the stack's properties. - If another object on the stack has properties of the same name, - the last object pushed onto the stack wins. (Last-In, First-Out.) -

    - -

    - When the iterator tag loops through a collection, - it pushes each item in the collection onto the stack. - The item's properties become the stack's property. - In the case of the Subscriptions, - if the Subscription has a public Host property, - then during that iteration, - the stack can access the same property. -

    - -

    - Of course, at the end of each iteration, the tag "pops" the item off the stack. - If we were to try and access the Host property later in the page, - it won't be there. -

    - -

    - When an Action is invoked, the Action class is pushed onto the value stack. - Since the Action is on the value stack, - our tags can access any property of the Action - as if it were an implicit property of the page. - The tags don't access the Action directly. - If a textfield tag is told to render the "Username" property, - the tag asks the value stack for the value of "Username", - and the value stack returns the first property it finds by that name, - on any object on the stack. -

    - -

    - The Validators also use the stack. - When validation fails on a field, - the value for the field is pushed onto the value stack. - As a result, if the client enters text into an Integer field, - the framework can still redisplay whatever was entered. - An invalid input value is not stored in the field (even if it could be). - The invalid input is pushed onto the stack for the scope of the request. -

    - -

    - The Subscription list uses another new tag: the param tag. - As tags go, "param" takes very few parameters of its own: just "name" and "value", - and neither is required. - Although simple, "param" is one of the most powerful tags the framework provides. - Not so much because of what it does, - but because of what "param" allows the other tags to do. -

    - -

    - Essentially, the "param" tag provides parameters to other tags. - A tag like "text" might be retrieving a message template with several replaceable - parameters. - No matter how many parameters are in the template, and no matter what they are named, - you can use the "param" tag to pass in whatever you need. -

    - -
    pager.legend = Displaying {current} of {count} items matching {criteria}.
    -...
    -<s:text name="pager.legend">
    -    <s:param name="current" value="42" />
    -    <s:param name="count" value="314" />
    -    <s:param name="criteria" value="Life, the Universe, and Everything" />
    -</s:text>
    - -

    - In the case of an "url" tag, - we can use "param" to create the query string. - A statement like this: -

    - -
    
    -  <s:url action="Subscription!edit"><s:param name="host" value="host"/></s:url>">
    -
    - -

    - can render a hyperlink like this: -

    - -
    
    -  <a href="/struts2-mailreader/Subscription!edit.do?host=mail.yahoo.com">Edit</a>
    -
    - - - -

    - If a hyperlink needs more parameters, - you can use "param" to add as many parameters as needed. -

    - -

    - Subscription -

    - -

    - If we follow one of the "Edit" subscription links on the Registration page, - we come to the Subscriptions page, - which displays the details of our description in a data-entry form. - Let's have a look at the Subscription configuration - and follow the bouncing ball from page to action to page. -

    - -
    -
    mailreader-support.xml Subscription element
    -
    <action name="Subscription!*" method="{1}" class="mailreader2.Subscription">
    -  <result name="input">/pages/Subscription.jsp</result>
    -  <result type="redirect-action">Registration!input</result>
    -</action>
    -
    - -

    - The Edit link specified the Subscription action, - but also includes the qualifier !edit. - The wildcard notation tells the framework to use any characters given after "Subscription!" - as the name of a method to invoke on the Action class, - instead of the default execute method. - The "alternate" execute methods are called alias methods. -

    - -
    -
    Subscription edit alias
    -
    public String edit() {
    -  setTask(Constants.EDIT);>
    -  return find();
    -}
    -
    -public String find() {
    -  org.apache.struts.apps.mailreader.dao.Subscription
    -    sub = findSubscription();
    -   if (sub == null) {
    -       return ERROR;
    -   }
    -   setSubscription(sub);
    -   return INPUT;
    -}
    -
    - -

    - The "edit" alias has two responsibilities. - First, it must set the Task property to "Edit". - The Subscription page will render itself differently - depending on the value of the Task property. - Second, "edit" must locate the relevant Subscription - and set it to the Subscription property. - If all goes well, "edit" returns the INPUT token, - so that the "input" result will be invoked. -

    - -

    - In the normal course, the Subscription should always be found, - since we selected the entry from a system-generated list. - If the Subscription is not found, - it would be because the database disappeared - or the request is being spoofed. - If the Subscription is not found, - edit returns the token for the global "error" result, - because this condition is unexpected. -

    - -

    - The business logic for the "edit" alias is a simple wrapper - around the MailReader DAO classes. -

    - -
    -
    MailreaderSupport findSubscription()
    -
    public Subscription findSubscription() {
    -    return findSubscription(getHost());
    -}
    -
    -public Subscription findSubscription(String host) {
    -    Subscription subscription;
    -    subscription = getUser().findSubscription(host);
    -    return subscription;
    -}
    -
    - -

    - This code is very simple - and doesn't seem to provide much in the way of error handling. - But, that's OK. - Since the page is suppose to be entered from a link that we created, - we do expect everything to go right here. - But, if it doesn't, the global exception handler we defined in the - MailReader configuration will trap the exception for us. -

    - -

    - Likewise, the AuthentificationInterceptor will ensure that only clients - with a valid User object can try to edit a Subscription. - If the session expired, or someone bookmarked the page, - the client will be redirected to the Login page automatically. -

    - -

    - As a final layer of defense, we also configured a validator for Subscription, - to ensure that we are passed a Host parameter. -

    - -
    -
    Subscription-validation.xml
    -
    <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
    -<validators>
    -  <field name="host">
    -    <field-validator type="requiredstring">
    -        <message key="error.host.required"/>
    -    </field-validator>
    -  </field>
    -</validators>
    -
    - -

    - By keeping routine safety precautions out of the Action class, - the all-important Actions becomes smaller and easier to maintain. -

    - -

    - After setting the relevent Subscription object to the Subscription property, - the framework transfers control to the (you guessed it) Subscription page. -

    - -
    -
    Subscription.jsp
    -
    <%@ page contentType="text/html; charset=UTF-8" %>
    -<%@ taglib prefix="s" uri="http://struts.apache.org/tags" %>
    -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    -  <head>
    -    <s:if test="task=='Create'">
    -        <title><s:text name="subscription.title.create"/></title>
    -    </s:if>
    -    <s:if test="task=='Edit'">
    -        <title><s:text name="subscription.title.edit"/></title>
    -    </s:if>
    -    <s:if test="task=='Delete'">
    -        <title><s:text name="subscription.title.delete"/></title>
    -    </s:if>
    -    <link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
    -          type="text/css"/>
    -  </head>
    -  <body onLoad="self.focus();document.Subscription.username.focus()">
    -
    -    <s:actionerror/>
    -    <s:form action="Subscription!save" validate="true">
    -      <s:token />
    -      <s:hidden name="task"/>
    -      <s:label label="%{getText('username')}" name="user.username"/>
    -
    -      <s:if test="task == 'Create'">
    -        <s:textfield label="%{getText('mailHostname')}" name="host"/>
    -      </s:if>
    -      <s:else>
    -        <s:label label="%{getText('mailHostname')}" name="host"/>
    -        <s:hidden name="host"/>
    -      </s:else>
    -
    -      <s:if test="task == 'Delete'">
    -        <s:label label="%{getText('mailUsername')}"
    -                   name="subscription.username"/>
    -        <s:label label="%{getText('mailPassword')}"
    -                   name="subscription.password"/>
    -        <s:label label="%{getText('mailServerType')}"
    -                   name="subscription.type"/>
    -        <s:label label="%{getText('autoConnect')}"
    -                   name="subscription.autoConnect"/>
    -        <s:submit value="%{getText('button.confirm')}"/>
    -      </s:if>
    -      <s:else>
    -        <s:textfield label="%{getText('mailUsername')}"
    -                       name="subscription.username"/>
    -        <s:textfield label="%{getText('mailPassword')}"
    -                       name="subscription.password"/>
    -        <s:select label="%{getText('mailServerType')}"
    -                    name="subscription.type" list="types"/>
    -        <s:checkbox label="%{getText('autoConnect')}"
    -                      name="subscription.autoConnect"/>
    -        <s:submit value="%{getText('button.save')}"/>
    -        <s:reset value="%{getText('button.reset')}"/>
    -      </s:else>
    -
    -      <s:submit action="Registration!input"
    -                value="%{getText('button.cancel')}"
    -                onclick="form.onsubmit=null"/>
    -  </s:form>
    -
    -  <jsp:include page="Footer.jsp"/>
    -  </body>
    -</html>
    -
    - -

    - As before, we'll discuss the tags and attributes that are new to this page: - "token", "hidden", "label", "select", and "checkbox". -

    - -

    - The token tag works with the Token Session Interceptor to foil double - submits. - The tag generates a key that is embedded in the form and cached in the session. - Without this tag, the Interceptor can't work it's magic. -

    - -

    - The hidden tag embeds the Task property into the form. - When the form is submitted, - the Subscription!save action will use the Task property to decide - whether to insert or update the form. -

    - -

    - The label renders a "read only" version of a property, - suitable for placement in the form. - In Edit or Delete mode, we want the Host property to be immutable, - since it is used as a key. (As unwise as that might sound.) - In Delete mode, all of the properties are immutable, - since we are simply confirming the delete operation. -

    - -

    - Saving the best for last, the Subscription form utilizes two more interesting - tags, "select" and "checkbox". -

    - -

    - Unsurprisingly, the select tag renders a select control, - but the tag does so without requiring a lot of markup or redtape. -

    - -
    <s:select label="%{getText('mailServerType')}"
    -  name="subscription.type" list="types" />
    -
    - -

    - The interesting attribute of the "select" tag is "list", - which, in our case, specifies a value of "types". - If we take another look at the Subscription action, - we can see that it implements an interface named Preparable - and populates a Types property in a method named "prepare". -

    - -
    -
    Subscription-validation.xml
    -
    public class Subscription extends MailreaderSupport
    -  implements Preparable {
    -
    -  private Map types = null;
    -  public Map getTypes() {
    -    return types;
    -   }
    -
    -   public void prepare() {
    -     Map m = new LinkedHashMap();
    -       m.put("imap", "IMAP Protocol");
    -       m.put("pop3", "POP3 Protocol");
    -       types = m;
    -       setHost(getSubscriptionHost());
    -    }
    -
    -    // ... 
    -
    - -

    - The default Interceptor stack includes the PrepareInterceptor, - which observes the Preparable interface. -

    - -
    -
    PrepareInterceptor
    -
    public class PrepareInterceptor extends AroundInterceptor {
    -
    -  protected void after(ActionInvocation dispatcher, String result) throws Exception {
    -  }
    -
    -  protected void before(ActionInvocation invocation) throws Exception {
    -    Object action = invocation.getAction();
    -     if (action instanceof Preparable) {
    -        ((Preparable) action).prepare();
    -    }
    -  }
    -}
    - -

    - The PrepareInterceptor ensures that the "prepare" method will always be called - before "execute" or an alias method is invoked. - We use "prepare" to setup the list of items for the select list to display. - We also transfer the Host property from our Subscription object - to a local property, where it is easier to manage. -

    - -

    - Subscription.java -

    - -

    - Like many applications, the MailReader uses mainly String properties. - One exception is the AutoConnect property of the Subscription object. - On the HTML form, the AutoConnect property is represented by a checkbox. -

    - -

    - When writing web applications, the checkbox can be a tricky control. - The Subscription object has a boolean AutoConnect property, - and the checkbox simply has to represent its state. - The problem is, if you clear a checkbox, the browser client will not submit anything. - Nada. Zip. - It is as if the checkbox control never existed. - The HTTP protocol has no way to affirm "false". - If the control is missing, we need to figure out it's been unclicked. -

    - -

    - In Struts 1, - we use the reset method to work around checkbox issues. - In Struts 2, checkbox state is handled automatically. - The framework can detect when a checkbox tag has not been sent back, - and when that happens, - a default "false" value is used for the checkbox value. - No worries, mate. -

    - -

    - If we press the SAVE button, - the form will be submitted to the Subscription!save action. - Since the save method needs some additional validation, - we can add a validation file. -

    - -
    -
    Subscription-Subscription!save-validation.xml
    -
    <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
    -    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
    -<validators>
    -  <field name="host">
    -    <field-validator type="requiredstring">
    -        <message key="error.host.required"/>
    -    </field-validator>
    -  </field>
    -</validators>
    -
    - -

    - The validators follow the same type of inheritance path as the classes. - SubscriptionSave extends Subscription, - so when Subscription!save is validated, - the Host property specified by "Subscription-validation.xml" will also be required. -

    - -

    - If validation succeeds, the save method of Subscription will fire. -

    - -
    -
    Subscription
    - -
    public String save() throws Exception {
    -
    -  if (Constants.DELETE.equals(getTask())) {
    -   removeSubscription();
    -  }
    -
    -  if (Constants.CREATE.equals(getTask())) {
    -    copySubscription(getHost());
    -  }
    -
    -  saveUser();
    -  return SUCCESS;
    -}
    -
    - -

    - The save method uses the Task property to handle - the special cases of deleting and creating, - and then updates the state of the User object. -

    - -

    - The removeSubscription method calls the DAO facade, - and then updates the application state. -

    - -
    -
    removeSubscription
    -
    public void removeSubscription() throws Exception {
    -  getUser().removeSubscription(getSubscription());
    -  getSession().remove(Constants.SUBSCRIPTION_KEY);
    -}
    -
    - -

    - The copySubscription method is a bit more interesting. - The MailReader DAO layer API includes some immutable fields - that can't be set once the object is created. - Because key fields are immutable, - we can't just create a Subscription, let the framework populate all the fields, - and then save it when we are done -- because some fields can't be populated, - except at construction. -

    - -

    - One workaround would be to declare properties on the Action - for all the properties we need to pass to the Subscription or User objects. - When we are ready to create the object, - we could pass the new object values from the Action properties. -

    - -

    - Another workaround is to declare only the immutable properties on the Action, - and then use what we can from the domain object. -

    - -

    - This implementation of the MailReader utilizes the second alternative. - We define User and Subscription objects on our base Action, - and add other properties only as needed. -

    - -

    - To add a new Subscription or User, - we create a blank object to capture whatever fields we can. - When this "input" object returns, we create a new object, - setting the immutable fields to appropriate values, - and copy over the rest of the properties. -

    - -
    -
    copySubscription
    -
    public void copySubscription(String host) {
    -  Subscription input = getSubscription();
    -  Subscription sub = createSubscription(host);
    -  if (null != sub) {
    -    BeanUtils.setValues(sub, input, null);
    -    setSubscription(sub);
    -    setHost(sub.getHost());
    -  }
    -}
    -
    - -

    - Of course, this is not a preferred solution, - but merely a way to work around an issue in the MailReader DAO API - that would not be easy for us change. -

    - -

    Subscription Submit

    - -

    - When we pressed the SAVE button, there was one step that we overlooked. - The Mailreader application uses a "double submit" guard to keep people - from clicking the SAVE button multiple times and submitting the form again. -

    - -

    - To add the double-submit guard, we can change the actions default processing - stack to user-submit. - But, we don't want to just copy and paste the other action settings from - the main Subscription action. - What we can do is put the subscription actions in their own package, - so that they can share result types. -

    - -
    -
    mailreader-support.xml
    -
    
    -</package>
    -
    -<package name="subscription" namespace="/" extends="mailreader-support">
    -
    -    <global-results>
    -        <result name="input">/Subscription.jsp</result>
    -        <result type="redirect-action">Registration!input</result>
    -    </global-results>
    -
    -    <action name="Subscription!save" method="save" class="mailreader2.Subscription">
    -        <interceptor-ref name="user-submit" />
    -    </action>
    -
    -    <action name="Subscription!*" method="{1}" class="mailreader2.Subscription" />
    -
    -</package>
    -
    -<package name="wildcard" namespace="/" extends="mailreader-support">
    -
    -    <action name="*" class="mailreader2.MailreaderSupport">
    -        <result>/{1}.jsp</result>
    -    </action>
    -
    -</package>
    -}
    -
    - -

    - Aftering a successful save, - the Subscription Action will return "success", - and the framework will redirect us back to Registration input. -

    - -

    Summary

    -

    - At this point, we've booted the application, logged on, - reviewed a Registration record, and edited a Subscription. - Of course, there's more, but from here on, it is mostly more of the same. - The full source code for MailReader is - - available online - and in the distribution. -

    - -

    - Enjoy! -

    - - - diff --git a/trunk/apps/pom.xml b/trunk/apps/pom.xml deleted file mode 100644 index eb115cc72..000000000 --- a/trunk/apps/pom.xml +++ /dev/null @@ -1,216 +0,0 @@ - - - - - 4.0.0 - - org.apache.struts - struts2-parent - 2.0.1 - - org.apache.struts - struts2-apps - pom - Webapps - - blank - mailreader - portlet - showcase - - - - - apache-site - scp://people.apache.org/www/struts.apache.org/struts2/apps - - - - - - hostedqa - - - com.hostedqa - hostedqa-remote-ant - 1.0-SNAPSHOT - test - - - - - codehaus - codehaus - http://repository.codehaus.org - - - maven-hostedqa - maven-hostedqa - - true - always - ignore - - - true - - http://maven.hostedqa.com - - - - - - - src/main/java - - **/*.properties - **/*.xml - - - - - - maven-antrun-plugin - org.apache.maven.plugins - - - package - - run - - - - - - - - - - - - - - com.hostedqa - hostedqa-remote-ant - 1.0-SNAPSHOT - - - - - - - - - - - - org.codehaus.cargo - cargo-maven2-plugin - - - tomcat5x - ${cargo.tomcat5x.home} - ${project.build.directory}/tomcat5x.log - ${project.build.directory}/tomcat5x.out - - - ${project.build.directory}/tomcat5x - - - - - - maven-antrun-plugin - - - copy-sources - process-sources - - - - - - - - - - - - run - - - - - - - ${pom.artifactId} - - - - - - - org.apache.struts - struts2-core - ${pom.version} - - - - - org.springframework - spring-beans - 1.2.8 - - - - org.springframework - spring-core - 1.2.8 - - - - org.springframework - spring-context - 1.2.8 - - - - org.springframework - spring-web - 1.2.8 - - - - org.springframework - spring-mock - 1.2.8 - test - - - - diff --git a/trunk/apps/portlet/README.txt b/trunk/apps/portlet/README.txt deleted file mode 100644 index efcb67bbc..000000000 --- a/trunk/apps/portlet/README.txt +++ /dev/null @@ -1,17 +0,0 @@ -README.txt - portlet - -This is a simple example of using the portlet API with Struts applications. - -For more on getting started with Struts, see - -* http://cwiki.apache.org/WW/home.html - -WARNING - Additional configuration required for deployment - -Due to difference in portlet contrainer implementations, the porlet -WAR is not ready-to-run. Extract the porlet WAR, and then copy the -contents of apps/portlet/src/main/etc// into the -WAR's WEB-INF directory. - - ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/trunk/apps/portlet/pom.xml b/trunk/apps/portlet/pom.xml deleted file mode 100644 index 64a1f11d0..000000000 --- a/trunk/apps/portlet/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-apps - 2.0.1 - - org.apache.struts - struts2-portlet - war - Portlet Webapp - - - portlet-api - portlet-api - 1.0 - provided - - - - - - javax.servlet - servlet-api - 2.4 - provided - - - commons-lang - commons-lang - 2.0 - - - - - diff --git a/trunk/apps/portlet/src/main/etc/exo/web.xml b/trunk/apps/portlet/src/main/etc/exo/web.xml deleted file mode 100644 index 675c913d0..000000000 --- a/trunk/apps/portlet/src/main/etc/exo/web.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - struts-portlet - - - contextConfigLocation - /WEB-INF/applicationContext*.xml - - - action2 - - org.apache.struts2.dispatcher.FilterDispatcher - - - - - action2 - /* - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.apache.struts2.portlet.context.ServletContextHolderListener - - - - - org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener - - - - - preparator - - org.apache.struts2.portlet.context.PreparatorServlet - - - - dwr - uk.ltd.getahead.dwr.DWRServlet - - - PortletWrapper - - org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper - - - - - dwr - /dwr/* - - - PortletWrapper - /PortletWrapper - - - diff --git a/trunk/apps/portlet/src/main/etc/gridsphere/README-gridsphere.txt b/trunk/apps/portlet/src/main/etc/gridsphere/README-gridsphere.txt deleted file mode 100644 index e502e0699..000000000 --- a/trunk/apps/portlet/src/main/etc/gridsphere/README-gridsphere.txt +++ /dev/null @@ -1,2 +0,0 @@ -Put the empty 'struts-portlet' file in the $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/portlets -folder of your Gridsphere installation. You will need to add the gridsphere-ui-tags-2.1.2.jar to your project. diff --git a/trunk/apps/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml b/trunk/apps/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml deleted file mode 100644 index ed15d11cb..000000000 --- a/trunk/apps/portlet/src/main/etc/gridsphere/gridsphere-portlet.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - JSR Portlet Servlet - PortletServlet - - - - - Portlet Servlet - en - - Portlet Servlet - Portlet Servlet - A JSR Portlet Loader - portlet servlet - - - - - diff --git a/trunk/apps/portlet/src/main/etc/gridsphere/group.xml b/trunk/apps/portlet/src/main/etc/gridsphere/group.xml deleted file mode 100644 index d04e4e7b1..000000000 --- a/trunk/apps/portlet/src/main/etc/gridsphere/group.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - StrutsPortlet - StrutsPortlet Example Application - PUBLIC - - struts-portlet#StrutsPortlet - USER - - diff --git a/trunk/apps/portlet/src/main/etc/gridsphere/layout.xml b/trunk/apps/portlet/src/main/etc/gridsphere/layout.xml deleted file mode 100644 index 14a160bd9..000000000 --- a/trunk/apps/portlet/src/main/etc/gridsphere/layout.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - StrutsPortlet Example - - - StrutsPortlet Example Application - - - - - struts-portlet#StrutsPortlet - - - - - - - - diff --git a/trunk/apps/portlet/src/main/etc/gridsphere/struts-portlet b/trunk/apps/portlet/src/main/etc/gridsphere/struts-portlet deleted file mode 100644 index e69de29bb..000000000 diff --git a/trunk/apps/portlet/src/main/etc/gridsphere/web.xml b/trunk/apps/portlet/src/main/etc/gridsphere/web.xml deleted file mode 100644 index e453c960b..000000000 --- a/trunk/apps/portlet/src/main/etc/gridsphere/web.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - struts-portlet - - - contextConfigLocation - /WEB-INF/applicationContext*.xml - - - action2 - - org.apache.struts2.dispatcher.FilterDispatcher - - - - - action2 - /* - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.apache.struts2.portlet.context.ServletContextHolderListener - - - - - org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet - - - - - preparator - - org.apache.struts2.portlet.context.PreparatorServlet - - - - dwr - uk.ltd.getahead.dwr.DWRServlet - - - PortletServlet - - org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet - - - - - dwr - /dwr/* - - - PortletServlet - /jsr/struts-portlet - - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-app.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-app.xml deleted file mode 100644 index 02e09d53b..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-app.xml +++ /dev/null @@ -1,3 +0,0 @@ - - struts-portlet - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml deleted file mode 100644 index 663eaf395..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-portlet.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - StrutsPortlet - - - - - StrutsPortlet2 - - - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-web.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-web.xml deleted file mode 100644 index 9d9c645cc..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.0/jboss-web.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml deleted file mode 100644 index c22073d5c..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.0/portlet-instances.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - StrutsPortletInstance - StrutsPortlet - - - StrutsPortlet2Instance - StrutsPortlet2 - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml deleted file mode 100644 index 255c4530d..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.0/struts-portlet-pages.xml +++ /dev/null @@ -1,18 +0,0 @@ - - default - - struts-portlet - - StrutsPortletWindow - struts-portlet.StrutsPortlet.StrutsPortletInstance - left - 0 - - - StrutsPortletWindow2 - struts-portlet.StrutsPortlet2.StrutsPortlet2Instance - right - 0 - - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-app.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-app.xml deleted file mode 100644 index 02e09d53b..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-app.xml +++ /dev/null @@ -1,3 +0,0 @@ - - struts-portlet - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml deleted file mode 100644 index 663eaf395..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-portlet.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - StrutsPortlet - - - - - StrutsPortlet2 - - - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-web.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-web.xml deleted file mode 100644 index 9d9c645cc..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.2/jboss-web.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/trunk/apps/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml b/trunk/apps/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml deleted file mode 100644 index 2e062ad2a..000000000 --- a/trunk/apps/portlet/src/main/etc/jbossportal2.2/struts-portlet-object.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - overwrite - default - - - StrutsPortlet Example - - - StrutsWindow - StrutsPortletInstance - center - 0 - - - - - overwrite - - StrutsPortletInstance - struts-portlet.StrutsPortlet - - - diff --git a/trunk/apps/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt b/trunk/apps/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt deleted file mode 100644 index acde566d3..000000000 --- a/trunk/apps/portlet/src/main/etc/jetspeed2/README-jetspeed2.txt +++ /dev/null @@ -1 +0,0 @@ -Copy the struts-portlet.psml file to the JETSPEED2_INSTALL_DIR/webapps/jetspeed/WEB-INF/pages directory. diff --git a/trunk/apps/portlet/src/main/etc/jetspeed2/struts-portlet.psml b/trunk/apps/portlet/src/main/etc/jetspeed2/struts-portlet.psml deleted file mode 100644 index d6c795489..000000000 --- a/trunk/apps/portlet/src/main/etc/jetspeed2/struts-portlet.psml +++ /dev/null @@ -1,20 +0,0 @@ - - - Struts Portlet Example Application - Struts Portlet Example Application - - - - - - - - - - public-view - - \ No newline at end of file diff --git a/trunk/apps/portlet/src/main/etc/liferay3.6.1/web.xml b/trunk/apps/portlet/src/main/etc/liferay3.6.1/web.xml deleted file mode 100644 index b5fedfbad..000000000 --- a/trunk/apps/portlet/src/main/etc/liferay3.6.1/web.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - struts-portlet - - contextConfigLocation - /WEB-INF/applicationContext*.xml - - - company_id - struts.apache.org - - - action2 - - org.apache.struts2.dispatcher.FilterDispatcher - - - - - action2 - /* - - - - com.liferay.portal.servlet.PortletContextListener - - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.apache.struts2.portlet.context.ServletContextHolderListener - - - - - - StrutsPortlet - - com.liferay.portal.servlet.PortletServlet - - - portlet-class - - org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher - - - 0 - - - - preparator - - org.apache.struts2.portlet.context.PreparatorServlet - - - - dwr - uk.ltd.getahead.dwr.DWRServlet - - - - dwr - /dwr/* - - - StrutsPortlet - /StrutsPortlet/* - - - diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java deleted file mode 100644 index 93bf68ca6..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java +++ /dev/null @@ -1,36 +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.portlet.example; - -import java.util.Map; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionSupport; - -public class ExampleAction extends ActionSupport { - - private String name = "PortletWork Example"; - - public String getName() { - return name; - } - - public Map getRenderParameters() { - return ActionContext.getContext().getParameters(); - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java deleted file mode 100644 index 694eb12c4..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java +++ /dev/null @@ -1,44 +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.portlet.example; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class FormExample extends ActionSupport { - - String firstName = null; - String lastName = null; - public String execute() throws Exception { - // TODO Auto-generated method stub - return super.execute(); - } - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java deleted file mode 100644 index ec14710f7..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java +++ /dev/null @@ -1,44 +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.portlet.example; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class FormExampleWithValidation extends ActionSupport { - private String firstName = null; - private String lastName = null; - - public String input() { - return SUCCESS; - } - - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java deleted file mode 100644 index 4dc22714e..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java +++ /dev/null @@ -1,46 +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.portlet.example; - -import java.util.Collection; -import java.util.Map; - -import javax.portlet.RenderRequest; - -import org.apache.struts2.portlet.context.PortletActionContext; -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class FormResultAction extends ActionSupport { - - private String result = null; - - public String getResult() { - return result; - } - public void setResult(String result) { - this.result = result; - } - - public Collection getRenderParams() { - RenderRequest req = PortletActionContext.getRenderRequest(); - Map params = req.getParameterMap(); - return params.entrySet(); - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java deleted file mode 100644 index b2dacde5a..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java +++ /dev/null @@ -1,33 +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.portlet.example; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class FormTestAction extends ActionSupport { - - private String name = null; - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java deleted file mode 100644 index f9a5efae6..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java +++ /dev/null @@ -1,59 +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.portlet.example; - -import javax.portlet.ActionRequest; -import javax.portlet.PortletPreferences; - -import org.apache.struts2.portlet.context.PortletActionContext; -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class SavePrefsAction extends ActionSupport { - private String preferenceOne = null; - private String preferenceTwo = null; - public String getPreferenceOne() { - return preferenceOne; - } - public void setPreferenceOne(String preferenceOne) { - this.preferenceOne = preferenceOne; - } - public String getPreferenceTwo() { - return preferenceTwo; - } - public void setPreferenceTwo(String preferenceTwo) { - this.preferenceTwo = preferenceTwo; - } - - public String execute() throws Exception { - ActionRequest req = PortletActionContext.getActionRequest(); - PortletPreferences prefs = req.getPreferences(); - prefs.setValue("preferenceOne", preferenceOne); - prefs.setValue("preferenceTwo", preferenceTwo); - prefs.store(); - return SUCCESS; - } - - public String showForm() throws Exception { - PortletPreferences prefs = PortletActionContext.getRequest().getPreferences(); - preferenceOne = prefs.getValue("preferenceOne", "not set"); - preferenceTwo = prefs.getValue("preferenceTwo", "not set"); - return SUCCESS; - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java deleted file mode 100644 index 78704a268..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java +++ /dev/null @@ -1,55 +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.portlet.example.spring; - -import java.util.List; - -import org.apache.commons.lang.StringUtils; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class SpringAction extends ActionSupport { - - private ThingManager thingManager = null; - private String thing = null; - - public void setThingManager(ThingManager thingManager) { - this.thingManager = thingManager; - } - - public List getThings() { - return thingManager.getThings(); - } - - public String getThing() { - return thing; - } - - public void setThing(String thing) { - this.thing = thing; - } - - public String execute() { - if(StringUtils.isNotEmpty(thing)) { - thingManager.addThing(thing); - } - return SUCCESS; - } -} diff --git a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java b/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java deleted file mode 100644 index cbbb3b9f0..000000000 --- a/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java +++ /dev/null @@ -1,35 +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.portlet.example.spring; - -import java.util.ArrayList; -import java.util.List; - -/** - */ -public class ThingManager { - private List things = new ArrayList(); - - public void addThing(String thing) { - things.add(thing); - } - - public List getThings() { - return things; - } -} diff --git a/trunk/apps/portlet/src/main/resources/commons-logging.properties b/trunk/apps/portlet/src/main/resources/commons-logging.properties deleted file mode 100644 index a9eceaf5f..000000000 --- a/trunk/apps/portlet/src/main/resources/commons-logging.properties +++ /dev/null @@ -1,2 +0,0 @@ -org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog diff --git a/trunk/apps/portlet/src/main/resources/log4j.xml b/trunk/apps/portlet/src/main/resources/log4j.xml deleted file mode 100644 index c6803daad..000000000 --- a/trunk/apps/portlet/src/main/resources/log4j.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml b/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml deleted file mode 100644 index 4effe04b1..000000000 --- a/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-processValidationExample-validation.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - You must enter a first name - - - - - You must enter a last name - - - diff --git a/trunk/apps/portlet/src/main/resources/struts.properties b/trunk/apps/portlet/src/main/resources/struts.properties deleted file mode 100644 index cb40069a7..000000000 --- a/trunk/apps/portlet/src/main/resources/struts.properties +++ /dev/null @@ -1 +0,0 @@ -struts.objectFactory = spring diff --git a/trunk/apps/portlet/src/main/resources/template/xhtml/components/checkbox.vm b/trunk/apps/portlet/src/main/resources/template/xhtml/components/checkbox.vm deleted file mode 100644 index 6d952f938..000000000 --- a/trunk/apps/portlet/src/main/resources/template/xhtml/components/checkbox.vm +++ /dev/null @@ -1,12 +0,0 @@ -
    -
    - $!struts.htmlEncode($parameters.label) -
    diff --git a/trunk/apps/portlet/src/main/resources/template/xhtml/components/datefield.vm b/trunk/apps/portlet/src/main/resources/template/xhtml/components/datefield.vm deleted file mode 100644 index 7b3f44bef..000000000 --- a/trunk/apps/portlet/src/main/resources/template/xhtml/components/datefield.vm +++ /dev/null @@ -1,8 +0,0 @@ -#set ($name = $parameters.name) -#set ($label = $parameters.label) -#set ($size = $parameters.mysize) -#set ($yearsize = $parameters.yearsize) -$label: - / - / - (dd/mm/yyyy) diff --git a/trunk/apps/portlet/src/main/resources/template/xhtml/components/mytextfield.vm b/trunk/apps/portlet/src/main/resources/template/xhtml/components/mytextfield.vm deleted file mode 100644 index 21c75be32..000000000 --- a/trunk/apps/portlet/src/main/resources/template/xhtml/components/mytextfield.vm +++ /dev/null @@ -1,15 +0,0 @@ -
    -
    - $!struts.htmlEncode($parameters.label) -
    diff --git a/trunk/apps/portlet/src/main/resources/validators.xml b/trunk/apps/portlet/src/main/resources/validators.xml deleted file mode 100644 index 4c06d8b10..000000000 --- a/trunk/apps/portlet/src/main/resources/validators.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/trunk/apps/portlet/src/main/resources/xwork.xml b/trunk/apps/portlet/src/main/resources/xwork.xml deleted file mode 100644 index 001f60a71..000000000 --- a/trunk/apps/portlet/src/main/resources/xwork.xml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - /WEB-INF/view/index.jsp - - - - - /WEB-INF/view/formExampleInput.jsp - - - - - - /WEB-INF/view/formExampleInput.jsp - - - /WEB-INF/view/formExample.jsp - - - - - - /WEB-INF/view/formExampleInputValidation.jsp - - - - - - /WEB-INF/view/formExample.jsp - - - /WEB-INF/view/formExampleInputValidation.jsp - - - - - - - /WEB-INF/view/tokenExampleInput.jsp - - - - - - /WEB-INF/view/tokenExampleInput.jsp - - - /WEB-INF/view/tokenExampleInput.jsp - - - /WEB-INF/view/tokenExample.jsp - - - - - - - - /WEB-INF/view/springExample.jsp - - - - - - /WEB-INF/view/ajaxExample.jsp - - - - - /WEB-INF/view/ajaxData.jsp - - - - - /WEB-INF/view/freeMarkerExampleInput.ftl - - - - - /view/processFreeMarkerView.action?firstName=${firstName}&lastName=${lastName} - - - - /WEB-INF/view/freeMarkerExample.ftl - - - - /WEB-INF/view/helloWorld.vm - - - - - - - /WEB-INF/edit/index.jsp - - - /WEB-INF/edit/test.jsp - - - - /WEB-INF/edit/formExampleInput.jsp - - - - - - /WEB-INF/edtt/formExampleInput.jsp - - - /edit/processFormExampleForward.action?firstName=${firstName}&lastName=${lastName} - - - - - - /WEB-INF/edit/formExample.jsp - - - - - - - /WEB-INF/edit/namespaceTest.jsp - - - - - - /WEB-INF/help/index.jsp - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/applicationContext.xml b/trunk/apps/portlet/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index 6bd3e54ba..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/dwr.xml b/trunk/apps/portlet/src/main/webapp/WEB-INF/dwr.xml deleted file mode 100644 index 4ede30035..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/dwr.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - ); - ]]> - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/defaultEdit.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/defaultEdit.jsp deleted file mode 100644 index 61b05c612..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/defaultEdit.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -

    StrutsPortlet

    -This is the default edit page! -

    -">Set some prefs diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/formExample.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/formExample.jsp deleted file mode 100644 index 7d62563ab..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/formExample.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -

    Hello

    -

    -">Back to front page diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/formExampleInput.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/formExampleInput.jsp deleted file mode 100644 index 43c981df6..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/formExampleInput.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -

    Input your name

    - - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/index.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/index.jsp deleted file mode 100644 index 6b03c99f3..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/index.jsp +++ /dev/null @@ -1,11 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -There are no examples in edit mode yet - -

    -">Test -

    -">Form test -

    -">Dummy test -

    -">Back to view mode diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/namespaceTest.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/namespaceTest.jsp deleted file mode 100644 index 7e373a131..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/namespaceTest.jsp +++ /dev/null @@ -1,4 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -">Test page for namespace /edit/test -

    -">Back to edit index diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/prefsForm.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/prefsForm.jsp deleted file mode 100644 index af8b02cd7..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/prefsForm.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/prefsSaved.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/prefsSaved.jsp deleted file mode 100644 index 6aca664f1..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/prefsSaved.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -The preferences has been saved. - -">Back diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/test.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/test.jsp deleted file mode 100644 index 615860c47..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/edit/test.jsp +++ /dev/null @@ -1,4 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -">Test page -

    -">Back to edit index diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/help/defaultHelp.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/help/defaultHelp.jsp deleted file mode 100644 index c8fb774f7..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/help/defaultHelp.jsp +++ /dev/null @@ -1 +0,0 @@ -This is the default help page! diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/help/index.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/help/index.jsp deleted file mode 100644 index ea58ff820..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/help/index.jsp +++ /dev/null @@ -1 +0,0 @@ -There are no examples in help mode yet diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml b/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml deleted file mode 100644 index 1d1896695..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - Struts Test Portlet - StrutsPortlet - Struts Test Portlet - - org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher - - - - viewNamespace - /view - - - - defaultViewAction - index - - - - editNamespace - /edit - - - - defaultEditAction - index - - - - helpNamespace - /help - - - - defaultHelpAction - index - - - - - 0 - - - text/html - edit - help - - - en - - - My StrutsPortlet portlet - SP - struts,portlet - - - - - Struts Test Portlet2 - StrutsPortlet2 - Struts Test Portlet2 - - org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher - - - - viewNamespace - /view - - - - defaultViewAction - index - - - - editNamespace - /edit - - - - defaultEditAction - index - - - - helpNamespace - /help - - - - defaultHelpAction - index - - - - - 0 - - - text/html - edit - help - - - en - - - My StrutsPortlet portlet2 - SP2 - struts,portlet - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/readme.txt b/trunk/apps/portlet/src/main/webapp/WEB-INF/readme.txt deleted file mode 100644 index 53633149c..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -Configurations: - -JBoss Portal specific configuration files ------------------------------------------ -jboss-app.xml -jboss-portlet.xml -jboss-web.xml -portlet-instances.xml -struts-example-object.xml -struts-example-pages.xml diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajax.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajax.jsp deleted file mode 100644 index e24ec7c17..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajax.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Hello from Ajax!

    diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajaxData.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajaxData.jsp deleted file mode 100644 index 796b0d77d..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajaxData.jsp +++ /dev/null @@ -1 +0,0 @@ -This data is fetched via Ajax! The server time is <%= new java.util.Date() %> diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajaxExample.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajaxExample.jsp deleted file mode 100644 index d0b55af40..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/ajaxExample.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -"> -This is a tabbed pane with two panels that fetches data from a remote action via ajax - - - - This is the left pane
    - -
    - -
    -
    - - - middle tab
    - -
    - -
    -
    - -
    - -

    -A DIV that waits for 5 seconds before loading the contents - - Waiting for data -

    -A DIV that is updated every 2 seconds -Initial Content - -

    -">Back to front page diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExample.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExample.jsp deleted file mode 100644 index 7d62563ab..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExample.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -

    Hello

    -

    -">Back to front page diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInput.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInput.jsp deleted file mode 100644 index 468d0eb4f..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInput.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -

    Input your name

    - - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputValidation.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputValidation.jsp deleted file mode 100644 index f64745747..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputValidation.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -"> -

    Input your name

    - - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/freeMarkerExample.ftl b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/freeMarkerExample.ftl deleted file mode 100644 index cb70dc7c4..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/freeMarkerExample.ftl +++ /dev/null @@ -1,3 +0,0 @@ -Hello from FreeMarker, ${firstName} ${lastName}! -

    -">Back to front page diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/freeMarkerExampleInput.ftl b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/freeMarkerExampleInput.ftl deleted file mode 100644 index 86ebbfbe7..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/freeMarkerExampleInput.ftl +++ /dev/null @@ -1,5 +0,0 @@ -<@s.form action="processFreeMarkerExample" method="POST"> - <@s.textfield label="First name" name="firstName"/> - <@s.textfield label="Last name" name="lastName"/> - <@s.submit value="Say hello!"/> - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/helloWorld.vm b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/helloWorld.vm deleted file mode 100644 index b2933c41b..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/helloWorld.vm +++ /dev/null @@ -1 +0,0 @@ -Hello World from velocity! diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp deleted file mode 100644 index 5686c2e94..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -

    Welcome to the Struts example portlet

    -

    -Here you'll find examples of what is possible with the Struts Portlet integration framework. -

    diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/notImplemented.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/notImplemented.jsp deleted file mode 100644 index a3af7eb2b..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/notImplemented.jsp +++ /dev/null @@ -1 +0,0 @@ -

    This example has not yet been implemented

    diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/springExample.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/springExample.jsp deleted file mode 100644 index 8a0da4287..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/springExample.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -

    Example of Spring managed singleton. All the 'things' are contained in a Spring defined ThingManager

    - -Things in the list: -

    - -
    -
    -

    - - - - -

    -">Back to front page diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/tokenExample.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/tokenExample.jsp deleted file mode 100644 index e41c9e96e..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/tokenExample.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -

    The form was successfully submitted with a valid token

    - -"/>Back to front page diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/tokenExampleInput.jsp b/trunk/apps/portlet/src/main/webapp/WEB-INF/view/tokenExampleInput.jsp deleted file mode 100644 index 7aa2e31aa..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/view/tokenExampleInput.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - ERROR:
    - - -
    -
    -
    -
    -

    Form with invalid token

    - - - - -

    Form with valid token

    - - - - - diff --git a/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml b/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 62ba4e4c1..000000000 --- a/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - contextConfigLocation - /WEB-INF/applicationContext*.xml - - - action2 - - org.apache.struts2.dispatcher.FilterDispatcher - - - - - action2 - /* - - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.apache.struts2.portlet.context.ServletContextHolderListener - - - - - - preparator - - org.apache.struts2.portlet.context.PreparatorServlet - - - - dwr - uk.ltd.getahead.dwr.DWRServlet - - - - dwr - /dwr/* - - - diff --git a/trunk/apps/portlet/src/main/webapp/styles/styles.css b/trunk/apps/portlet/src/main/webapp/styles/styles.css deleted file mode 100644 index 3dafc085a..000000000 --- a/trunk/apps/portlet/src/main/webapp/styles/styles.css +++ /dev/null @@ -1,7 +0,0 @@ -.wwFormTable {} -.label {font-style:italic; } -.errorLabel {font-style:italic; color:red; } -.errorMessage {font-weight:bold; text-align: center; color:red; } -.checkboxLabel {} -.checkboxErrorLabel {color:red; } -.required {color:red;} diff --git a/trunk/apps/showcase/README.txt b/trunk/apps/showcase/README.txt deleted file mode 100644 index 4d483c78c..000000000 --- a/trunk/apps/showcase/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -README.txt - showcase - -Showcase is a collection of examples with code that you might be adopt and -adapt in your own applications. - -For more on getting started with Struts, see - -* http://cwiki.apache.org/WW/home.html - ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/trunk/apps/showcase/pom.xml b/trunk/apps/showcase/pom.xml deleted file mode 100644 index b01f55e39..000000000 --- a/trunk/apps/showcase/pom.xml +++ /dev/null @@ -1,161 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-apps - 2.0.1 - - org.apache.struts - struts2-showcase - war - Showcase Webapp - - - hostedqa - - 12 - 9 - 8 - 7 - - - - - - - org.apache.struts - struts2-struts1-plugin - ${pom.version} - - - - org.apache.struts - struts2-jsf-plugin - ${pom.version} - - - - org.apache.struts - struts2-config-browser-plugin - ${pom.version} - - - - org.apache.struts - struts2-sitemesh-plugin - ${pom.version} - - - - org.apache.struts - struts2-tiles-plugin - ${pom.version} - - - - javax.servlet - servlet-api - 2.4 - provided - - - - - velocity - velocity - 1.4 - true - - - - velocity-tools - velocity-tools - 1.1 - true - - - - - opensymphony - sitemesh - 2.2.1 - - - log4j - log4j - 1.2.9 - - - uk.ltd.getahead - dwr - 1.1-beta-3 - - - org.apache.myfaces.core - myfaces-impl - 1.1.2 - - - org.apache.myfaces.core - myfaces-api - 1.1.2 - - - org.rifers - rife-continuations - 0.0.2 - - - commons-fileupload - commons-fileupload - 1.1.1 - - - - - - - - - org.mortbay.jetty - maven-jetty-plugin - 6.0.1 - - 10 - - - - org.apache.myfaces.core - myfaces-impl - 1.1.2 - - - org.apache.myfaces.core - myfaces-api - 1.1.2 - - - log4j - log4j - 1.2.9 - - - - - - - - src/main/resources - - - src/main/java - - **/*.java - - - - - - diff --git a/trunk/apps/showcase/quickstart.xml b/trunk/apps/showcase/quickstart.xml deleted file mode 100644 index 6bb5a9039..000000000 --- a/trunk/apps/showcase/quickstart.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - ../../../xwork/xwork.iml,../../core/struts2-core.iml,struts2-showcase.iml - - - /showcase - - - 8080 - - - - - - - - src/main/resources - target/classes - ../../core/target/classes - - - - - - / - src/main/webapp - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java deleted file mode 100644 index 242c9d7bb..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java +++ /dev/null @@ -1,104 +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.showcase; - -import com.opensymphony.xwork2.ActionSupport; - -import java.text.DateFormat; -import java.util.Date; -import java.util.Calendar; -import java.util.GregorianCalendar; - -/** - * DateAction - * - */ -public class DateAction extends ActionSupport { - - private static DateFormat DF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); - - private Date now; - private Date past; - private Date future; - private Date after; - private Date before; - - - public String getDate() { - return DF.format(new Date()); - } - - - /** - * @return Returns the future. - */ - public Date getFuture() { - return future; - } - - /** - * @return Returns the now. - */ - public Date getNow() { - return now; - } - - /** - * @return Returns the past. - */ - public Date getPast() { - return past; - } - - /** - * - * @return Returns the before date. - */ - public Date getBefore() { - return before; - } - - /** - * - * @return Returns the after date. - */ - public Date getAfter() { - return after; - } - - /** - * @see com.opensymphony.xwork2.ActionSupport#execute() - */ - public String execute() throws Exception { - Calendar cal = GregorianCalendar.getInstance(); - now = cal.getTime(); - cal.roll(Calendar.DATE, -1); - cal.roll(Calendar.HOUR, -3); - past = cal.getTime(); - cal.roll(Calendar.DATE, 2); - future = cal.getTime(); - - cal.roll(Calendar.YEAR, -1); - before = cal.getTime(); - - cal.roll(Calendar.YEAR, 2); - after = cal.getTime(); - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.properties deleted file mode 100644 index d49c743a5..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.properties +++ /dev/null @@ -1 +0,0 @@ -struts.date.format=yyyy/MM/dd hh:mm:ss \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java deleted file mode 100644 index 3fd80af93..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.struts2.showcase; - -import org.apache.struts2.showcase.ajax.tree.Category; - -import com.opensymphony.xwork2.ActionSupport; - -//START SNIPPET: treeExampleDynamicJavaSelected - -public class DynamicTreeSelectAction extends ActionSupport { - - private long nodeId; - private Category currentCategory; - - - public void setNodeId(long nodeId) { - this.nodeId = nodeId; - } - public long getNodeId() { - return nodeId; - } - - - public String execute() throws Exception { - currentCategory = Category.getById(nodeId); - return SUCCESS; - } - - - public String getNodeName() { - return currentCategory.getName(); - } -} - -//START SNIPPET: treeExampleDynamicJavaSelected - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java deleted file mode 100644 index b74d2f3d4..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java +++ /dev/null @@ -1,68 +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.showcase; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.Preparable; -import com.uwyn.rife.continuations.ContinuableObject; - -import java.util.Random; - -// START SNIPPET: example -public class Guess extends ActionSupport implements Preparable, ContinuableObject { - int guess; - - public void prepare() throws Exception { - // We clear the error message state before the action. - // That is because with continuations, the original (or cloned) action is being - // executed, which will still have the old errors and potentially cause problems, - // such as with the workflow interceptor - clearErrorsAndMessages(); - } - - public String execute() throws Exception { - int answer = new Random().nextInt(100) + 1; - int tries = 5; - - while (answer != guess && tries > 0) { - pause(Action.SUCCESS); - - if (guess > answer) { - addFieldError("guess", "Too high!"); - } else if (guess < answer) { - addFieldError("guess", "Too low!"); - } - - tries--; - } - - if (answer == guess) { - addActionMessage("You got it!"); - } else { - addActionMessage("You ran out of tries, the answer was " + answer); - } - - return Action.SUCCESS; - } - - public void setGuess(int guess) { - this.guess = guess; - } -} -// END SNIPPET: example diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java deleted file mode 100644 index ddc236055..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java +++ /dev/null @@ -1,223 +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.showcase; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class LotsOfOptiontransferselectAction extends ActionSupport { - - private List _favouriteCartoonCharactersKeys; - private List _notFavouriteCartoonCharactersKeys; - - private List _favouriteCarsKeys; - private List _notFavouriteCarsKeys; - - private List _favouriteMotorcyclesKeys; - private List _notFavouriteMotorcyclesKeys; - - private List _favouriteCountriesKeys; - private List _notFavouriteCountriesKeys; - - private List _prioritisedFavouriteCartoonCharacters; - private List _prioritisedFavouriteCars; - private List _prioritisedFavouriteCountries; - - - - // Cartoon Characters - public Map getDefaultFavouriteCartoonCharacters() { - Map m = new LinkedHashMap(); - m.put("heMan", "He-Man"); - m.put("popeye", "Popeye"); - m.put("mockeyMouse", "Mickey Mouse"); - return m; - } - - public Map getDefaultNotFavouriteCartoonCharacters() { - Map m = new LinkedHashMap(); - m.put("donaldDuck", "Donald Duck"); - m.put("atomicAnt", "Atomic Ant"); - m.put("pinkPainter", "Pink Painter"); - return m; - } - - public List getFavouriteCartoonCharacters() { - return _favouriteCartoonCharactersKeys; - } - - public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) { - _favouriteCartoonCharactersKeys = favouriteCartoonCharacters; - } - - public List getNotFavouriteCartoonCharacters() { - return _notFavouriteCartoonCharactersKeys; - } - - public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) { - _notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters; - } - - - - - - // Cars - public Map getDefaultFavouriteCars() { - Map m = new LinkedHashMap(); - m.put("alfaRomeo", "Alfa Romeo"); - m.put("Toyota", "Toyota"); - m.put("Mitsubitshi", "Mitsubitshi"); - return m; - } - - public Map getDefaultNotFavouriteCars() { - Map m = new LinkedHashMap(); - m.put("ford", "Ford"); - m.put("landRover", "Land Rover"); - m.put("mercedes", "Mercedes"); - return m; - } - - public List getFavouriteCars() { - return _favouriteCarsKeys; - } - - public void setFavouriteCars(List favouriteCars) { - _favouriteCarsKeys = favouriteCars; - } - - public List getNotFavouriteCars() { - return _notFavouriteCarsKeys; - } - - public void setNotFavouriteCars(List notFavouriteCars) { - _notFavouriteCarsKeys = notFavouriteCars; - } - - - - // Motorcycles - public Map getDefaultFavouriteMotorcycles() { - Map m = new LinkedHashMap(); - m.put("honda", "Honda"); - m.put("yamaha", "Yamaha"); - m.put("Aprillia", "Aprillia"); - return m; - } - - public Map getDefaultNotFavouriteMotorcycles() { - Map m = new LinkedHashMap(); - m.put("cagiva", "Cagiva"); - m.put("harleyDavidson", "Harley Davidson"); - m.put("suzuki", "Suzuki"); - return m; - } - - public List getFavouriteMotorcycles() { - return _favouriteMotorcyclesKeys; - } - - public void setFavouriteMotorcycles(List favouriteMotorcycles) { - _favouriteMotorcyclesKeys = favouriteMotorcycles; - } - - public List getNotFavouriteMotorcycles() { - return _notFavouriteMotorcyclesKeys; - } - - public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) { - _notFavouriteMotorcyclesKeys = notFavouriteMotorcycles; - } - - - - // Countries - public Map getDefaultFavouriteCountries() { - Map m = new LinkedHashMap(); - m.put("england", "England"); - m.put("america", "America"); - m.put("brazil", "Brazil"); - return m; - } - - public Map getDefaultNotFavouriteCountries() { - Map m = new LinkedHashMap(); - m.put("germany", "Germany"); - m.put("china", "China"); - m.put("russia", "Russia"); - return m; - } - - public List getFavouriteCountries() { - return _favouriteCountriesKeys; - } - - public void setFavouriteCountries(List favouriteCountries) { - _favouriteCountriesKeys = favouriteCountries; - } - - public List getNotFavouriteCountries() { - return _notFavouriteCountriesKeys; - } - - public void setNotFavouriteCountries(List notFavouriteCountries) { - _notFavouriteCountriesKeys = notFavouriteCountries; - } - - - public List getPrioritisedFavouriteCartoonCharacters() { - return _prioritisedFavouriteCartoonCharacters; - } - public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) { - _prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters; - } - - public List getPrioritisedFavouriteCars() { - return _prioritisedFavouriteCars; - } - public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) { - _prioritisedFavouriteCars = prioritisedFavouriteCars; - } - - - public List getPrioritisedFavouriteCountries() { - return _prioritisedFavouriteCountries; - } - public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) { - _prioritisedFavouriteCountries = prioritisedFavouriteCountries; - } - - - - - // actions - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction-lotsOfRichtexteditorSubmit-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction-lotsOfRichtexteditorSubmit-validation.xml deleted file mode 100644 index 8bf17c7c1..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction-lotsOfRichtexteditorSubmit-validation.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Description1 Is Required !!! - - - - - - Description2 Is Required !!! - - - - - - Description3 Is Required !!! - - - - - - Description4 Is Required !!! - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java deleted file mode 100644 index 952fda972..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java +++ /dev/null @@ -1,75 +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.showcase; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - */ -public class LotsOfRichtexteditorAction extends ActionSupport { - - public String description1; - public String description2 = "This is Description 2"; - public String description3; - public String description4 = "This is Description 4"; - - public String getDescription1() { - return this.description1; - } - public void setDescription1(String description1) { - this.description1 = description1; - } - - - public String getDescription2() { - return this.description2; - } - public void setDescription2(String description2) { - this.description2 = description2; - } - - - public String getDescription3() { - return this.description3; - } - public void setDescription3(String description3) { - this.description3 = description3; - } - - - - - public String getDescription4() { - return this.description4; - } - public void setDescription4(String description4) { - this.description4 = description4; - } - - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java deleted file mode 100644 index 838d76b63..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.apache.struts2.showcase; - -import org.apache.struts2.showcase.ajax.tree.Category; - -import com.opensymphony.xwork2.ActionSupport; - -// START SNIPPET: treeExampleDynamicJavaShow - -public class ShowDynamicTreeAction extends ActionSupport { - - public Category getTreeRootNode() { - return Category.getById(1); - } -} - -// END SNIPPET: treeExampleDynamicJavaShow - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample-conversion.properties deleted file mode 100644 index 2415dcf3c..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -Element_friends = java.lang.String diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java deleted file mode 100644 index 3a2729c83..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java +++ /dev/null @@ -1,314 +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.showcase; - -import org.apache.struts2.ServletActionContext; -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.Validateable; -import com.opensymphony.xwork2.util.ValueStack; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.io.File; - -/** - */ -public class UITagExample extends ActionSupport implements Validateable { - - private static final long serialVersionUID = -94044809860988047L; - - - String name; - Date birthday; - String bio; - String favoriteColor; - List friends; - boolean legalAge; - String state; - String region; - File picture; - String pictureContentType; - String pictureFileName; - String favouriteLanguage; - String favouriteVehicalType = "MotorcycleKey"; - String favouriteVehicalSpecific = "YamahaKey"; - - List leftSideCartoonCharacters; - List rightSideCartoonCharacters; - - List favouriteLanguages = new ArrayList(); - List vehicalTypeList = new ArrayList(); - Map vehicalSpecificMap = new HashMap(); - - String thoughts; - - public UITagExample() { - favouriteLanguages.add(new Language("EnglishKey", "English Language")); - favouriteLanguages.add(new Language("FrenchKey", "French Language")); - favouriteLanguages.add(new Language("SpanishKey", "Spanish Language")); - - VehicalType car = new VehicalType("CarKey", "Car"); - VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle"); - vehicalTypeList.add(car); - vehicalTypeList.add(motorcycle); - - List cars = new ArrayList(); - cars.add(new VehicalSpecific("MercedesKey", "Mercedes")); - cars.add(new VehicalSpecific("HondaKey", "Honda")); - cars.add(new VehicalSpecific("FordKey", "Ford")); - - List motorcycles = new ArrayList(); - motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki")); - motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha")); - - vehicalSpecificMap.put(car, cars); - vehicalSpecificMap.put(motorcycle, motorcycles); - } - - - - public List getLeftSideCartoonCharacters() { - return leftSideCartoonCharacters; - } - public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) { - this.leftSideCartoonCharacters = leftSideCartoonCharacters; - } - - - public List getRightSideCartoonCharacters() { - return rightSideCartoonCharacters; - } - public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) { - this.rightSideCartoonCharacters = rightSideCartoonCharacters; - } - - - public String getFavouriteVehicalType() { - return favouriteVehicalType; - } - - public void setFavouriteVehicalType(String favouriteVehicalType) { - this.favouriteVehicalType = favouriteVehicalType; - } - - public String getFavouriteVehicalSpecific() { - return favouriteVehicalSpecific; - } - - public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) { - this.favouriteVehicalSpecific = favouriteVehicalSpecific; - } - - public List getVehicalTypeList() { - return vehicalTypeList; - } - - public List getVehicalSpecificList() { - ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest()); - Object vehicalType = stack.findValue("top"); - if (vehicalType != null && vehicalType instanceof VehicalType) { - List l = (List) vehicalSpecificMap.get(vehicalType); - return l; - } - return Collections.EMPTY_LIST; - } - - public List getFavouriteLanguages() { - return favouriteLanguages; - } - - public String execute() throws Exception { - return SUCCESS; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getBirthday() { - return birthday; - } - - public void setBirthday(Date birthday) { - this.birthday = birthday; - } - - public String getBio() { - return bio; - } - - public void setBio(String bio) { - this.bio = bio; - } - - public String getFavoriteColor() { - return favoriteColor; - } - - public void setFavoriteColor(String favoriteColor) { - this.favoriteColor = favoriteColor; - } - - public List getFriends() { - return friends; - } - - public void setFriends(List friends) { - this.friends = friends; - } - - public boolean isLegalAge() { - return legalAge; - } - - public void setLegalAge(boolean legalAge) { - this.legalAge = legalAge; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getRegion() { - return region; - } - - public void setRegion(String region) { - this.region = region; - } - - public void setPicture(File picture) { - this.picture = picture; - } - - public void setPictureContentType(String pictureContentType) { - this.pictureContentType = pictureContentType; - } - - public void setPictureFileName(String pictureFileName) { - this.pictureFileName = pictureFileName; - } - - public void setFavouriteLanguage(String favouriteLanguage) { - this.favouriteLanguage = favouriteLanguage; - } - - public String getFavouriteLanguage() { - return favouriteLanguage; - } - - - public void setThoughts(String thoughts) { - this.thoughts = thoughts; - } - - public String getThoughts() { - return this.thoughts; - } - - - - public String doSubmit() { - return SUCCESS; - } - - - - // === inner class - public static class Language { - String description; - String key; - - public Language(String key, String description) { - this.key = key; - this.description = description; - } - - public String getKey() { - return key; - } - public String getDescription() { - return description; - } - - } - - - public static class VehicalType { - String key; - String description; - public VehicalType(String key, String description) { - this.key = key; - this.description = description; - } - - public String getKey() { return this.key; } - public String getDescription() { return this.description; } - - public boolean equals(Object obj) { - if (! (obj instanceof VehicalType)) { - return false; - } - else { - return key.equals(((VehicalType)obj).getKey()); - } - } - - public int hashCode() { - return key.hashCode(); - } - } - - - public static class VehicalSpecific { - String key; - String description; - public VehicalSpecific(String key, String description) { - this.key = key; - this.description = description; - } - - public String getKey() { return this.key; } - public String getDescription() { return this.description; } - - public boolean equals(Object obj) { - if (! (obj instanceof VehicalSpecific)) { - return false; - } - else { - return key.equals(((VehicalSpecific)obj).getKey()); - } - } - - public int hashCode() { - return key.hashCode(); - } - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java deleted file mode 100644 index d57b30f54..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java +++ /dev/null @@ -1,93 +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.showcase.action; - -import org.apache.log4j.Logger; -import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.showcase.dao.Dao; -import org.apache.struts2.showcase.model.IdEntity; - -import java.util.Collection; -import java.io.Serializable; - -/** - * AbstractCRUDAction. - * - */ - -public abstract class AbstractCRUDAction extends ActionSupport { - - private static final Logger log = Logger.getLogger(AbstractCRUDAction.class); - - private Collection availableItems; - private String[] toDelete; - - protected abstract Dao getDao(); - - - public Collection getAvailableItems() { - return availableItems; - } - - public String[] getToDelete() { - return toDelete; - } - - public void setToDelete(String[] toDelete) { - this.toDelete = toDelete; - } - - public String list() throws Exception { - this.availableItems = getDao().findAll(); - if (log.isDebugEnabled()) { - log.debug("AbstractCRUDAction - [list]: " + (availableItems !=null?""+availableItems.size():"no") + " items found"); - } - return execute(); - } - - public String delete() throws Exception { - if (toDelete != null) { - int count=0; - for (int i = 0, j=toDelete.length; i < j; i++) { - count = count + getDao().delete(toDelete[i]); - } - if (log.isDebugEnabled()) { - log.debug("AbstractCRUDAction - [delete]: " + count + " items deleted."); - } - } - return SUCCESS; - } - - /** - * Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle. - * - * @param tryId The id to try to get persistent object for - * @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent - * object for - * @return The persistent object, if found. null otherwise. - */ - protected IdEntity fetch(Serializable tryId, IdEntity tryObject) { - IdEntity result = null; - if (tryId != null) { - result = getDao().get(tryId); - } else if (tryObject != null) { - result = getDao().get(tryObject.getId()); - } - return result; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction-conversion.properties deleted file mode 100644 index 21d3eda97..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -Element_selectedSkills=java.lang.String diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction-validation.xml deleted file mode 100644 index c49959888..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction-validation.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - true - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java deleted file mode 100644 index b434d0333..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java +++ /dev/null @@ -1,122 +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.showcase.action; - -import com.opensymphony.xwork2.Preparable; -import org.apache.log4j.Logger; -import org.apache.struts2.showcase.application.TestDataProvider; -import org.apache.struts2.showcase.dao.Dao; -import org.apache.struts2.showcase.dao.EmployeeDao; -import org.apache.struts2.showcase.model.Employee; -import org.apache.struts2.showcase.model.Skill; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -/** - * JsfEmployeeAction. - */ - -public class EmployeeAction extends AbstractCRUDAction implements Preparable { - - private static final long serialVersionUID = 7047317819789938957L; - - private static final Logger log = Logger.getLogger(EmployeeAction.class); - - private Long empId; - protected EmployeeDao employeeDao; - private Employee currentEmployee; - private List selectedSkills; - - public Long getEmpId() { - return empId; - } - - public void setEmpId(Long empId) { - this.empId = empId; - } - - public Employee getCurrentEmployee() { - return currentEmployee; - } - - public void setCurrentEmployee(Employee currentEmployee) { - this.currentEmployee = currentEmployee; - } - - public String[] getAvailablePositions() { - return TestDataProvider.POSITIONS; - } - - public List getAvailableLevels() { - return Arrays.asList(TestDataProvider.LEVELS); - } - - public List getSelectedSkills() { - return selectedSkills; - } - - public void setSelectedSkills(List selectedSkills) { - this.selectedSkills = selectedSkills; - } - - protected Dao getDao() { - return employeeDao; - } - - public void setEmployeeDao(EmployeeDao employeeDao) { - if (log.isDebugEnabled()) { - log.debug("JsfEmployeeAction - [setEmployeeDao]: employeeDao injected."); - } - this.employeeDao = employeeDao; - } - - /** - * This method is called to allow the action to prepare itself. - * - * @throws Exception thrown if a system level exception occurs. - */ - public void prepare() throws Exception { - Employee preFetched = (Employee) fetch(getEmpId(), getCurrentEmployee()); - if (preFetched != null) { - setCurrentEmployee(preFetched); - } - } - - public String execute() throws Exception { - if (getCurrentEmployee() != null && getCurrentEmployee().getOtherSkills() != null) { - setSelectedSkills(new ArrayList()); - Iterator it = getCurrentEmployee().getOtherSkills().iterator(); - while (it.hasNext()) { - getSelectedSkills().add(((Skill) it.next()).getName()); - } - } - return super.execute(); - } - - public String save() throws Exception { - if (getCurrentEmployee() != null) { - setEmpId((Long) employeeDao.merge(getCurrentEmployee())); - employeeDao.setSkills(getEmpId(), getSelectedSkills()); - } - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.properties deleted file mode 100644 index e2e548b3c..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.properties +++ /dev/null @@ -1,9 +0,0 @@ -employee=Employee -employee.firstName=First Name -employee.lastName=Last Name -employee.description=Description - -employee.id.required=Id is required -employee.lastName.required=Last Name is required -employee.birthDate.required=Birthdate is required -employee.backtolist=Back to Employee List diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction_de.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction_de.properties deleted file mode 100644 index ca594de4d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction_de.properties +++ /dev/null @@ -1,9 +0,0 @@ -employee=Mitarbeiter -employee.firstName=Vorname -employee.lastName=Nachname -employee.description=Beschreibung - -employee.id.required=ID muß angegeben werden -employee.lastName.required=Nachname wird benötigt -employee.birthDate.required=Geburtsdatum wird benötigt -employee.backtolist=Zurück zur Mitarbeiterliste diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction-validation.xml deleted file mode 100644 index 486e79f61..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction-validation.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - true - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java deleted file mode 100644 index dfcb5dfa0..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java +++ /dev/null @@ -1,85 +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.showcase.action; - -import org.apache.struts2.showcase.dao.Dao; -import org.apache.struts2.showcase.dao.SkillDao; -import org.apache.struts2.showcase.model.Skill; -import com.opensymphony.xwork2.Preparable; -import org.apache.log4j.Logger; - -/** - * SkillAction. - * - */ - -public class SkillAction extends AbstractCRUDAction implements Preparable { - - private static final Logger log = Logger.getLogger(SkillAction.class); - - private String skillName; - protected SkillDao skillDao; - private Skill currentSkill; - - public String getSkillName() { - return skillName; - } - - public void setSkillName(String skillName) { - this.skillName = skillName; - } - - protected Dao getDao() { - return skillDao; - } - - public void setSkillDao(SkillDao skillDao) { - if (log.isDebugEnabled()) { - log.debug("SkillAction - [setSkillDao]: skillDao injected."); - } - this.skillDao = skillDao; - } - - public Skill getCurrentSkill() { - return currentSkill; - } - - public void setCurrentSkill(Skill currentSkill) { - this.currentSkill = currentSkill; - } - - /** - * This method is called to allow the action to prepare itself. - * - * @throws Exception thrown if a system level exception occurs. - */ - public void prepare() throws Exception { - Skill preFetched = (Skill) fetch(getSkillName(), getCurrentSkill()); - if (preFetched != null) { - setCurrentSkill(preFetched); - } - } - - public String save() throws Exception { - if (getCurrentSkill() != null) { - setSkillName((String) skillDao.merge(getCurrentSkill())); - } - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.properties deleted file mode 100644 index 27b7c81df..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.properties +++ /dev/null @@ -1,6 +0,0 @@ -skill=Skill -skill.name=Name -skill.description=Description - -skill.name.required=Name is required -skill.backtolist=Back to Skill List diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction_de.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction_de.properties deleted file mode 100644 index 7c7156f71..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction_de.properties +++ /dev/null @@ -1,6 +0,0 @@ -skill=Kenntnis -skill.name=Name -skill.description=Beschreibung - -skill.name.required=Name muss angegeben werden -skill.backtolist=Zurück zur Kenntnis Liste diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java deleted file mode 100644 index c9dfed9e9..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java +++ /dev/null @@ -1,42 +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.showcase.actionchaining; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - */ -public class ActionChain1 extends ActionSupport { - - private static final long serialVersionUID = -6811701750042275153L; - - private String actionChain1Property1 = "Property Set In Action Chain 1"; - - public String getActionChain1Property1() { - return actionChain1Property1; - } - public void setActionChain1Property1(String actionChain1Property1) { - this.actionChain1Property1 = actionChain1Property1; - } - - - public String input() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java deleted file mode 100644 index e4b30f9a8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java +++ /dev/null @@ -1,55 +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.showcase.actionchaining; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - */ -public class ActionChain2 extends ActionSupport { - - private static final long serialVersionUID = 3951745956044674809L; - - private String actionChain1Property1; - private String actionChain2Property1 = "Property Set in Action Chain 2"; - - - public String getActionChain1Property1() { - return actionChain1Property1; - } - public void setActionChain1Property1(String actionChain1Property1) { - this.actionChain1Property1 = actionChain1Property1; - } - - - - public String getActionChain2Property1() { - return actionChain2Property1; - } - public void setActionChain2Property1(String actionChain2Property1) { - this.actionChain2Property1 = actionChain2Property1; - } - - - - - public String execute() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java deleted file mode 100644 index 53e7587a5..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java +++ /dev/null @@ -1,65 +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.showcase.actionchaining; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - */ -public class ActionChain3 extends ActionSupport { - - private static final long serialVersionUID = -1456568865075250621L; - - private String actionChain1Property1; - private String actionChain2Property1; - private String actionChain3Property1 = "Property set in Action Chain 3"; - - - public String getActionChain1Property1() { - return actionChain1Property1; - } - public void setActionChain1Property1(String actionChain1Property1) { - this.actionChain1Property1 = actionChain1Property1; - } - - - - public String getActionChain2Property1() { - return actionChain2Property1; - } - public void setActionChain2Property1(String actionChain2Property1) { - this.actionChain2Property1 = actionChain2Property1; - } - - - - public String getActionChain3Property1() { - return actionChain3Property1; - } - public void setActionChain3Property1(String actionChain3Property1) { - this.actionChain3Property1 = actionChain3Property1; - } - - - - - public String execute() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java deleted file mode 100644 index 89e7efccb..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java +++ /dev/null @@ -1,49 +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.showcase.ajax; - -import com.opensymphony.xwork2.Action; - - -/** - */ -public class AjaxTestAction implements Action { - - private static int counter = 0; - private String data; - - public long getServerTime() { - return System.currentTimeMillis(); - } - - public int getCount() { - return ++counter; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public String execute() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java deleted file mode 100644 index 8935bead7..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java +++ /dev/null @@ -1,72 +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.showcase.ajax; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * @version $Date$ $Id$ - */ -public class Example4ShowPanelAction extends ActionSupport { - - private String name; - private String gender; - - private static final long serialVersionUID = 7751976335066456596L; - - public String panel1() throws Exception { - return SUCCESS; - } - - public String panel2() throws Exception { - return SUCCESS; - } - - public String panel3() throws Exception { - return SUCCESS; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getTodayDate() { - SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy"); - return sdf.format(new Date()); - } - - public String getTodayTime() { - SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss"); - return sdf.format(new Date()); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java deleted file mode 100644 index da3c4708b..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.apache.struts2.showcase.ajax; - -import com.opensymphony.xwork2.ActionSupport; - -public class Example5Action extends ActionSupport { - - private static final long serialVersionUID = 2111967621952300611L; - - private String name; - private Integer age; - - - public String getName() { return name; } - public void setName(String name) { this.name = name; } - - public Integer getAge() { return age; } - public void setAge(Integer age) { this.age = age; } - - @Override - public String execute() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java deleted file mode 100644 index a66cadb15..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java +++ /dev/null @@ -1,101 +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.showcase.ajax.tree; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ArrayList; - -/** - */ -public class Category { - private static Map catMap = new HashMap(); - - static { - new Category(1, "Root", - new Category(2, "Java", - new Category(3, "Web Frameworks", - new Category(4, "Struts"), - new Category(7, "Stripes"), - new Category(8, "Rife")), - new Category(9, "Persistence", - new Category(10, "iBatis"), - new Category(11, "Hibernate"), - new Category(12, "JDO"), - new Category(13, "JDBC"))), - new Category(14, "JavaScript", - new Category(15, "Dojo"), - new Category(16, "Prototype"), - new Category(17, "Scriptaculous"), - new Category(18, "OpenRico"), - new Category(19, "DWR"))); - } - - public static Category getById(long id) { - return catMap.get(id); - } - - private long id; - private String name; - private List children; - private boolean toggle; - - public Category(long id, String name, Category... children) { - this.id = id; - this.name = name; - this.children = new ArrayList(); - for (Category child : children) { - this.children.add(child); - } - - catMap.put(id, this); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - - public void toggle() { - toggle = !toggle; - } - - public boolean isToggle() { - return toggle; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java deleted file mode 100644 index 329c653c0..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java +++ /dev/null @@ -1,46 +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.showcase.ajax.tree; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class GetCategory extends ActionSupport { - private long catId; - private Category category; - - public String execute() throws Exception { - if (catId < 1) { - // force the root - catId = 1; - } - - category = Category.getById(catId); - - return SUCCESS; - } - - public void setCatId(long catId) { - this.catId = catId; - } - - public Category getCategory() { - return category; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java deleted file mode 100644 index 80a50a292..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java +++ /dev/null @@ -1,32 +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.showcase.ajax.tree; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class Toggle extends GetCategory { - public String execute() throws Exception { - super.execute(); - - getCategory().toggle(); - - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java deleted file mode 100644 index 2c09afc15..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java +++ /dev/null @@ -1,140 +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.showcase.application; - -import org.apache.struts2.showcase.exception.CreateException; -import org.apache.struts2.showcase.exception.DuplicateKeyException; -import org.apache.struts2.showcase.exception.StorageException; -import org.apache.struts2.showcase.exception.UpdateException; -import org.apache.struts2.showcase.model.IdEntity; -import org.apache.struts2.showcase.application.Storage; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * MemoryStorage. - * Very simple in-memory persistence emulation. - * - */ - -public class MemoryStorage implements Storage { - - private static final long serialVersionUID = 8611213748834904125L; - - - private Map memory = new HashMap(); - - private Map getEntityMap ( Class entityClass ) { - if (entityClass != null) { - Map tryMap = (Map) memory.get(entityClass); - if (tryMap == null) { - synchronized(memory) { - tryMap = new HashMap(); - memory.put(entityClass, tryMap); - } - } - return tryMap; - } else { - return null; - } - } - - private IdEntity intStore( Class entityClass, IdEntity object ) { - getEntityMap(entityClass).put(object.getId(), object); - return object; - } - - public IdEntity get( Class entityClass, Serializable id ) { - if (entityClass != null && id != null) { - return (IdEntity) getEntityMap(entityClass).get(id); - } else { - return null; - } - } - - public Serializable create ( IdEntity object ) throws CreateException { - if (object == null) { - throw new CreateException("Either given class or object was null"); - } - if (object.getId() == null) { - throw new CreateException("Cannot store object with null id"); - } - if (get(object.getClass(), object.getId()) != null) { - throw new DuplicateKeyException("Object with this id already exists."); - } - return intStore(object.getClass(), object).getId(); - } - - public IdEntity update ( IdEntity object ) throws UpdateException { - if (object == null) { - throw new UpdateException("Cannot update null object."); - } - if ( get(object.getClass(), object.getId())==null ) { - throw new UpdateException("Object to update not found."); - } - return intStore(object.getClass(), object); - } - - public Serializable merge ( IdEntity object ) throws StorageException { - if (object == null) { - throw new StorageException("Cannot merge null object"); - } - if (object.getId() == null || get(object.getClass(), object.getId())==null) { - return create(object); - } else { - return update(object).getId(); - } - } - - public int delete( Class entityClass, Serializable id ) throws CreateException { - try { - if (get(entityClass, id) != null) { - getEntityMap(entityClass).remove(id); - return 1; - } else { - return 0; - } - } catch (Exception e) { - throw new CreateException(e); - } - } - - public int delete( IdEntity object ) throws CreateException { - if (object == null) { - throw new CreateException("Cannot delete null object"); - } - return delete(object.getClass(), object.getId()); - } - - public Collection findAll( Class entityClass ) { - if (entityClass != null) { - return getEntityMap(entityClass).values(); - } else { - return new ArrayList(); - } - } - - public void reset() { - this.memory = new HashMap(); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java deleted file mode 100644 index ceba1832f..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java +++ /dev/null @@ -1,47 +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.showcase.application; - -import org.apache.struts2.showcase.model.IdEntity; -import org.apache.struts2.showcase.exception.CreateException; -import org.apache.struts2.showcase.exception.UpdateException; -import org.apache.struts2.showcase.exception.StorageException; - -import java.io.Serializable; -import java.util.Collection; - -/** - * Storage. Interface. - * - */ - -public interface Storage extends Serializable { - IdEntity get( Class entityClass, Serializable id ); - - Serializable create ( IdEntity object ) throws CreateException; - - IdEntity update ( IdEntity object ) throws UpdateException; - - Serializable merge ( IdEntity object ) throws StorageException; - - int delete( Class entityClass, Serializable id ) throws CreateException; - - int delete( IdEntity object ) throws CreateException; - - Collection findAll( Class entityClass ); -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java deleted file mode 100644 index 6378a00e3..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java +++ /dev/null @@ -1,115 +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.showcase.application; - -import org.apache.struts2.showcase.dao.EmployeeDao; -import org.apache.struts2.showcase.dao.SkillDao; -import org.apache.struts2.showcase.exception.StorageException; -import org.apache.struts2.showcase.model.Employee; -import org.apache.struts2.showcase.model.Skill; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.InitializingBean; - -import java.io.Serializable; -import java.util.Date; -import java.util.Arrays; - -/** - * TestDataProvider. - * - */ - -public class TestDataProvider implements Serializable, InitializingBean { - - private static final long serialVersionUID = 1L; - - private static final Logger log = Logger.getLogger(TestDataProvider.class); - - public static final String[] POSITIONS = { - "Developer", - "System Architect", - "Sales Manager", - "CEO" - }; - - public static final String[] LEVELS = { - "Junior", - "Senior", - "Master" - }; - - private static final Skill[] TEST_SKILLS = { - new Skill("WW-SEN", "Struts Senior Developer"), - new Skill("WW-JUN", "Struts Junior Developer"), - new Skill("SPRING-DEV", "Spring Developer") - }; - - public static final Employee[] TEST_EMPLOYEES = { - new Employee(new Long(1), "Alan", "Smithee", new Date(), new Float(2000f), true, POSITIONS[0], - TEST_SKILLS[0], null, "alan", LEVELS[0], "Nice guy"), - new Employee(new Long(2), "Robert", "Robson", new Date(), new Float(10000f), false, POSITIONS[1], - TEST_SKILLS[1], Arrays.asList(TEST_SKILLS).subList(1,TEST_SKILLS.length), "rob", LEVELS[1], "Smart guy") - }; - - private SkillDao skillDao; - private EmployeeDao employeeDao; - - public void setSkillDao(SkillDao skillDao) { - this.skillDao = skillDao; - } - - public void setEmployeeDao(EmployeeDao employeeDao) { - this.employeeDao = employeeDao; - } - - protected void addTestSkills() { - try { - for (int i = 0, j = TEST_SKILLS.length; i < j; i++) { - skillDao.merge(TEST_SKILLS[i]); - } - if (log.isInfoEnabled()) { - log.info("TestDataProvider - [addTestSkills]: Added test skill data."); - } - } catch (StorageException e) { - log.error("TestDataProvider - [addTestSkills]: Exception catched: " + e.getMessage()); - } - } - - protected void addTestEmployees() { - try { - for (int i = 0, j = TEST_EMPLOYEES.length; i < j; i++) { - employeeDao.merge(TEST_EMPLOYEES[i]); - } - if (log.isInfoEnabled()) { - log.info("TestDataProvider - [addTestEmployees]: Added test employee data."); - } - } catch (StorageException e) { - log.error("TestDataProvider - [addTestEmployees]: Exception catched: " + e.getMessage()); - } - } - - protected void addTestData() { - addTestSkills(); - addTestEmployees(); - } - - public void afterPropertiesSet() throws Exception { - addTestData(); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java deleted file mode 100644 index 8c934df1d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java +++ /dev/null @@ -1,57 +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.showcase.chat; - - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.dispatcher.SessionMap; - -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; - -public class ChatAuthenticationInterceptor implements Interceptor { - - private static final long serialVersionUID = 1L; - - private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class); - - public static final String USER_SESSION_KEY = "chatUserSessionKey"; - - public void destroy() { - } - - public void init() { - } - - public String intercept(ActionInvocation invocation) throws Exception { - - _log.debug("Authenticating chat user"); - - SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION); - User user = (User) session.get(USER_SESSION_KEY); - - if (user == null) { - return Action.LOGIN; - } - return invocation.invoke(); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java deleted file mode 100644 index 0207d6192..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java +++ /dev/null @@ -1,33 +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.showcase.chat; - -public class ChatException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public enum ErrorType { - ROOM_ALREADY_EXISTS, - USER_ALREADY_EXISTS, - NO_SUCH_ROOM_EXISTS - } - - public ChatException(String description, ErrorType type) { - super(description); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java deleted file mode 100644 index 791aeed43..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java +++ /dev/null @@ -1,58 +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.showcase.chat; - -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; - -/** - * Authenticate showcase chat example, make sure everyone have a username. - */ -public class ChatInterceptor implements Interceptor { - - private static final Log _log = LogFactory.getLog(ChatInterceptor.class); - - private static final long serialVersionUID = 1L; - - public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey"; - - public void destroy() { - } - - public void init() { - } - - public String intercept(ActionInvocation invocation) throws Exception { - HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION); - User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY); - if (chatUser == null) { - _log.debug("Chat user not logged in"); - return Action.LOGIN; - } - return invocation.invoke(); - } -} - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java deleted file mode 100644 index 28450a7c8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java +++ /dev/null @@ -1,65 +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.showcase.chat; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class ChatLoginAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 1L; - - private ChatService chatService; - private Map session; - - private String name; - - public ChatLoginAction(ChatService chatService) { - this.chatService = chatService; - } - - public String getName() { - return this.name; - } - public void setName(String name) { - this.name = name; - } - - - public String execute() throws Exception { - try { - chatService.login(new User(name)); - session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name)); - } - catch(ChatException e) { - e.printStackTrace(); - addActionError(e.getMessage()); - return INPUT; - } - return SUCCESS; - } - - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java deleted file mode 100644 index 7f2d326f6..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java +++ /dev/null @@ -1,55 +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.showcase.chat; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class ChatLogoutAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 1L; - - private ChatService chatService; - - private Map session; - - - public ChatLogoutAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - if (user != null) { - chatService.logout(user.getName()); - session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY); - } - - return SUCCESS; - } - - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java deleted file mode 100644 index f2828b818..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java +++ /dev/null @@ -1,46 +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.showcase.chat; - -import java.util.Date; - -public class ChatMessage { - - private Date creationDate; - private String message; - private User creator; - - public ChatMessage(String message, User creator) { - assert(message != null); - assert(creator != null); - - this.creationDate = new Date(System.currentTimeMillis()); - this.message = message; - this.creator = creator; - } - - public Date getCreationDate() { - return creationDate; - } - public User getCreator() { - return creator; - } - public String getMessage() { - return message; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java deleted file mode 100644 index 91e31ab8a..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java +++ /dev/null @@ -1,34 +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.showcase.chat; - -import java.util.List; - -public interface ChatService { - List getAvailableUsers(); - void login(User user); - void logout(String name); - - List getAvailableRooms(); - void addRoom(Room room); - void enterRoom(User user, String roomName); - void exitRoom(String userName, String roomName); - List getMessagesInRoom(String roomName); - void sendMessageToRoom(String roomName, User user, String message); - List getUsersAvailableInRoom(String roomName); -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java deleted file mode 100644 index 3f90971ac..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java +++ /dev/null @@ -1,112 +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.showcase.chat; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class ChatServiceImpl implements ChatService { - - private Map availableUsers = new LinkedHashMap(); - private Map availableRooms = new LinkedHashMap(); - - - public List getAvailableUsers() { - return new ArrayList(availableUsers.values()); - } - - public List getAvailableRooms() { - return new ArrayList(availableRooms.values()); - } - - public void addRoom(Room room) { - if (availableRooms.containsKey(room.getName())) { - throw new ChatException("room ["+room.getName()+"] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS")); - } - availableRooms.put(room.getName(), room); - } - - public void login(User user) { - assert(user != null); - if (availableUsers.containsKey(user.getName())) { - throw new ChatException("User ["+user.getName()+"] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS")); - } - availableUsers.put(user.getName(), user); - } - - public void logout(String name) { - assert(name != null); - assert(name.trim().length() > 0); - availableUsers.remove(name); - for (Room room : availableRooms.values()) { - if (room.hasMember(name)) { - room.memberExit(name); - } - } - } - - public void exitRoom(String userName, String roomName) { - assert(roomName != null); - assert(roomName.trim().length()> 0); - - if (availableRooms.containsKey(roomName)) { - Room room = availableRooms.get(roomName); - room.memberExit(userName); - } - } - - public void enterRoom(User user, String roomName) { - assert(roomName != null); - assert(roomName.trim().length() > 0); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - room.memberEnter(user); - } - - public List getMessagesInRoom(String roomName) { - assert(roomName != null); - assert(roomName.trim().length() > 0); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - return room.getChatMessages(); - } - - public void sendMessageToRoom(String roomName, User user, String message) { - assert(roomName != null); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - room.addMessage(new ChatMessage(message, user)); - } - - public List getUsersAvailableInRoom(String roomName) { - assert(roomName != null); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - return room.getMembers(); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java deleted file mode 100644 index 57acc1461..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java +++ /dev/null @@ -1,50 +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.showcase.chat; - -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionEvent; -import javax.servlet.http.HttpSessionListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -public class ChatSessionListener implements HttpSessionListener { - - private static final Log _log = LogFactory.getLog(ChatSessionListener.class); - - public void sessionCreated(HttpSessionEvent event) { - } - - public void sessionDestroyed(HttpSessionEvent event) { - HttpSession session = event.getSession(); - WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext()); - if (context != null) { - User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY); - if (user != null) { - ChatService service = (ChatService) context.getBean("chatService"); - service.logout(user.getName()); - - _log.info("session expired, logged user ["+user.getName()+"] out"); - } - } - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java deleted file mode 100644 index 59435246e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java +++ /dev/null @@ -1,22 +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.showcase.chat; - -public class Constants { - public static String UPDATE_FREQ = "30000"; -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java deleted file mode 100644 index 307742720..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java +++ /dev/null @@ -1,61 +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.showcase.chat; - -import com.opensymphony.xwork2.ActionSupport; - -public class CrudRoomAction extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private ChatService chatService; - - private String name; - private String description; - - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CrudRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String create() throws Exception { - try { - chatService.addRoom(new Room(name, description)); - } - catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java deleted file mode 100644 index d2c89ae35..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java +++ /dev/null @@ -1,56 +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.showcase.chat; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.util.StrutsTypeConverter; - -public class DateConverter extends StrutsTypeConverter { - - private static final Log _log = LogFactory.getLog(DateConverter.class); - - public Object convertFromString(Map context, String[] values, Class toClass) { - - if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) { - SimpleDateFormat sdf = new SimpleDateFormat(); - try { - return sdf.parse(values[0]); - } - catch(ParseException e) { - _log.error("error converting value ["+values[0]+"] to Date ", e); - } - } - return null; - } - - public String convertToString(Map context, Object o) { - - if (o instanceof Date) { - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); - return sdf.format((Date) o); - } - return ""; - } -} - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java deleted file mode 100644 index 707e3b5b1..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java +++ /dev/null @@ -1,59 +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.showcase.chat; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class EnterRoomAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 1L; - - private ChatService chatService; - private Map session; - private String roomName; - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { this.roomName = roomName; } - - public EnterRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - try { - chatService.enterRoom(user, roomName); - } - catch(Exception e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } - - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java deleted file mode 100644 index 2ff90a5f9..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java +++ /dev/null @@ -1,55 +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.showcase.chat; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class ExitRoomAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 1L; - - private String roomName; - - private Map session; - - public String getRoomName() { return roomName; } - public void setRoomName(String roomName) { this.roomName = roomName; } - - private ChatService chatService; - - public ExitRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - chatService.exitRoom(user.getName(), roomName); - - return SUCCESS; - } - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java deleted file mode 100644 index 427a2b9ee..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java +++ /dev/null @@ -1,56 +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.showcase.chat; - -import java.util.ArrayList; -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -public class MessagesAvailableInRoomAction extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private String roomName; - private ChatService chatService; - private List messagesAvailableInRoom = new ArrayList(); - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { - this.roomName = roomName; - } - - public List getMessagesAvailableInRoom() { - return messagesAvailableInRoom; - } - - public MessagesAvailableInRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - try { - messagesAvailableInRoom = chatService.getMessagesInRoom(roomName); - } - catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java deleted file mode 100644 index 9ab85da73..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java +++ /dev/null @@ -1,98 +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.showcase.chat; - -import java.util.ArrayList; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class Room { - - private static final int MAX_CHAT_MESSAGES = 10; - - private String name; - private String description; - private Date creationDate; - - private List messages = new ArrayList(); - - private Map members = new LinkedHashMap(); - - public Room(String name, String description) { - this.name = name; - this.description = description; - this.creationDate = new Date(System.currentTimeMillis()); - } - - - // properties - public Date getCreationDate() { - return creationDate; - } - - public String getDescription() { - return description; - } - - public String getName() { - return name; - } - - - // (behaviour) members - public List getMembers() { - return new ArrayList(members.values()); - } - public User findMember(String name) { - assert(name != null); - return members.get(name); - } - public boolean hasMember(String name) { - assert(name != null); - return members.containsKey(name); - } - public void memberEnter(User member) { - assert(member != null); - if (! hasMember(member.getName())) { - members.put(member.getName(), member); - } - } - - public void memberExit(String memberName) { - assert(memberName != null); - assert(memberName.trim().length() > 0); - members.remove(memberName); - } - - - // (behaviour) chat messags - public void addMessage(ChatMessage chatMessage) { - if (messages.size() > MAX_CHAT_MESSAGES) { - // messages.remove(messages.size() - 1); - messages.remove(0); - } - messages.add(chatMessage); - } - - public List getChatMessages() { - return new ArrayList(messages); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java deleted file mode 100644 index 111420bd7..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java +++ /dev/null @@ -1,45 +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.showcase.chat; - -import java.util.ArrayList; -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -public class RoomsAvailableAction extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private List availableRooms = new ArrayList(); - - private ChatService chatService; - - public RoomsAvailableAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - availableRooms = chatService.getAvailableRooms(); - return SUCCESS; - } - - public List getAvailableRooms() { - return availableRooms; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java deleted file mode 100644 index 42875d78d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java +++ /dev/null @@ -1,67 +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.showcase.chat; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class SendMessageToRoomAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 1L; - - private ChatService chatService; - - private String roomName; - private String message; - private Map session; - - - public SendMessageToRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { - this.roomName = roomName; - } - - public String getMessage() { return this.message; } - public void setMessage(String message) { - this.message = message; - } - - - public String execute() throws Exception { - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - try { - chatService.sendMessageToRoom(roomName, user, message); - }catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } - - public void setSession(Map session) { - this.session = session; - } - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java deleted file mode 100644 index 8ca098d62..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java +++ /dev/null @@ -1,45 +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.showcase.chat; - -import java.io.Serializable; -import java.util.Date; - -/** - * Represends a user in the Chat example. - */ -public class User implements Serializable { - - private static final long serialVersionUID = -1434958919516089297L; - - private String name; - private Date creationDate; - - - public User(String name) { - this.name = name; - this.creationDate = new Date(System.currentTimeMillis()); - } - - public Date getCreationDate() { - return creationDate; - } - public String getName() { - return name; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java deleted file mode 100644 index 82886fe06..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java +++ /dev/null @@ -1,46 +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.showcase.chat; - -import java.util.ArrayList; -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -public class UsersAvailableAction extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private List availableUsers = new ArrayList(); - private ChatService chatService; - - public UsersAvailableAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - - availableUsers = chatService.getAvailableUsers(); - - return SUCCESS; - } - - public List getAvailableUsers() { - return availableUsers; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java deleted file mode 100644 index 96db8aae8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java +++ /dev/null @@ -1,58 +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.showcase.chat; - -import java.util.ArrayList; -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -public class UsersAvailableInRoomAction extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private ChatService chatService; - private List usersAvailableInRoom = new ArrayList(); - - private String roomName; - - public UsersAvailableInRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { - this.roomName = roomName; - } - - public List getUsersAvailableInRoom() { - return usersAvailableInRoom; - } - - public String execute() throws Exception { - try { - usersAvailableInRoom = chatService.getUsersAvailableInRoom(roomName); - } - catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java deleted file mode 100644 index bf501834e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - - -/** - * @version $Date$ $Id$ - */ -public class Address { - - private String id; - private String address; - - public String getId() { return id; } - public void setId(String id) { this.id = id; } - - public String getAddress() { return address; } - public void setAddress(String address) { this.address = address; } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction-conversion.properties deleted file mode 100644 index 1a6d70055..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction-conversion.properties +++ /dev/null @@ -1,6 +0,0 @@ - -KeyProperty_addresses=id -Element_addresses=org.apache.struts2.showcase.conversion.Address -CreateIfNull_addresses=true - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java deleted file mode 100644 index 35f17f5fd..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.LinkedHashSet; -import java.util.Set; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * @version $Date$ $Id$ - */ -public class AddressAction extends ActionSupport { - - private Set addresses = new LinkedHashSet(); - - public Set getAddresses() { return addresses; } - public void setAddresses(Set addresses) { this.addresses = addresses; } - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - System.out.println(addresses); - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java deleted file mode 100644 index 0a1b1aa38..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.struts2.util.StrutsTypeConverter; - -/** - * @version $Date$ $Id$ - */ -public class EnumTypeConverter extends StrutsTypeConverter { - - @Override - public Object convertFromString(Map context, String[] values, Class toClass) { - List result = new ArrayList(); - for (int a=0; a< values.length; a++) { - Enum e = Enum.valueOf(OperationsEnum.class, values[a]); - if (e != null) - result.add(e); - } - return result; - } - - @Override - public String convertToString(Map context, Object o) { - List l = (List) o; - String result ="<"; - for (Iterator i = l.iterator(); i.hasNext(); ) { - result = result + "["+ i.next() +"]"; - } - result = result+">"; - return result; - } - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java deleted file mode 100644 index 2db119448..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -/** - * - * @version $Date$ $Id$ - */ -public enum OperationsEnum { - ADD, - MINUS, - DIVIDE, - MULTIPLY, - REMAINDER; -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction-conversion.properties deleted file mode 100644 index 621beafba..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction-conversion.properties +++ /dev/null @@ -1,4 +0,0 @@ - -selectedOperations=org.apache.struts2.showcase.conversion.EnumTypeConverter -Element_selectedOperations=org.apache.struts2.showcase.conversion.OperationsEnum - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java deleted file mode 100644 index ee2327ff3..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - * @version $Date$ $Id$ - */ -public class OperationsEnumAction extends ActionSupport { - - private static final long serialVersionUID = -2229489704988870318L; - - private List selectedOperations = new LinkedList(); - - public List getSelectedOperations() { return this.selectedOperations; } - public void setSelectedOperations(List selectedOperations) { - this.selectedOperations = selectedOperations; - } - - - public List getAvailableOperations() { - return Arrays.asList(OperationsEnum.values()); - } - - public String input() throws Exception { - return SUCCESS; - } - public String submit() throws Exception { - return SUCCESS; - } -} - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java deleted file mode 100644 index f87072c11..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java +++ /dev/null @@ -1,34 +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.showcase.conversion; - -import java.io.Serializable; - -/** - * - */ -public class Person implements Serializable { - private String name; - private Integer age; - - public void setName(String name) { this.name = name; } - public String getName() { return this.name; } - - public void setAge(Integer age) { this.age = age; } - public Integer getAge() { return this.age; } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction-conversion.properties deleted file mode 100644 index 12f602f16..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -Element_persons=org.apache.struts2.showcase.conversion.Person diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java deleted file mode 100644 index 1e0bd55e3..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java +++ /dev/null @@ -1,43 +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.showcase.conversion; - -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - */ -public class PersonAction extends ActionSupport { - - private List persons; - - public List getPersons() { return persons; } - public void setPersons(List persons) { this.persons = persons; } - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java deleted file mode 100644 index 3c61468a1..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java +++ /dev/null @@ -1,74 +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.showcase.dao; - -import org.apache.struts2.showcase.model.IdEntity; -import org.apache.struts2.showcase.exception.CreateException; -import org.apache.struts2.showcase.exception.UpdateException; -import org.apache.struts2.showcase.exception.StorageException; -import org.apache.struts2.showcase.application.Storage; - -import java.io.Serializable; -import java.util.Collection; - -/** - * AbstractDao. - * - */ - -public abstract class AbstractDao implements Serializable, Dao { - - private Storage storage; - - public Storage getStorage() { - return storage; - } - - public void setStorage(Storage storage) { - this.storage = storage; - } - - public IdEntity get(Serializable id) { - return getStorage().get(getFeaturedClass(), id); - } - - public Serializable create(IdEntity object) throws CreateException { - return getStorage().create(object); - } - - public IdEntity update(IdEntity object) throws UpdateException { - return getStorage().update(object); - } - - public Serializable merge(IdEntity object) throws StorageException { - return getStorage().merge(object); - } - - public int delete(Serializable id) throws CreateException { - return getStorage().delete(getFeaturedClass(), id); - } - - public int delete(IdEntity object) throws CreateException { - return getStorage().delete(object); - } - - public Collection findAll() { - return getStorage().findAll(getFeaturedClass()); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java deleted file mode 100644 index c27eb7ade..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java +++ /dev/null @@ -1,50 +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.showcase.dao; - -import org.apache.struts2.showcase.model.IdEntity; -import org.apache.struts2.showcase.exception.CreateException; -import org.apache.struts2.showcase.exception.UpdateException; -import org.apache.struts2.showcase.exception.StorageException; - -import java.io.Serializable; -import java.util.Collection; - -/** - * Dao. Interface. - * - */ - -public interface Dao { - - Class getFeaturedClass(); - - IdEntity get(Serializable id); - - Serializable create(IdEntity object) throws CreateException; - - IdEntity update(IdEntity object) throws UpdateException; - - Serializable merge(IdEntity object) throws StorageException; - - int delete(Serializable id) throws CreateException; - - int delete(IdEntity object) throws CreateException; - - Collection findAll(); -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java deleted file mode 100644 index 392dcc86f..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java +++ /dev/null @@ -1,64 +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.showcase.dao; - -import org.apache.struts2.showcase.model.Employee; -import org.apache.struts2.showcase.model.Skill; - -import java.util.List; -import java.util.ArrayList; - -/** - * EmployeeDao. - * - */ - -public class EmployeeDao extends AbstractDao { - - private static final long serialVersionUID = -6615310540042830594L; - - protected SkillDao skillDao; - - public void setSkillDao(SkillDao skillDao) { - this.skillDao = skillDao; - } - - public Class getFeaturedClass() { - return Employee.class; - } - - public Employee getEmployee( Long id ) { - return (Employee) get(id); - } - - public Employee setSkills(Employee employee, List skillNames) { - if (employee!= null && skillNames != null) { - employee.setOtherSkills(new ArrayList()); - for (int i = 0, j = skillNames.size(); i < j; i++) { - Skill skill = (Skill) skillDao.get((String) skillNames.get(i)); - employee.getOtherSkills().add(skill); - } - } - return employee; - } - - public Employee setSkills(Long empId, List skillNames) { - return setSkills((Employee) get(empId), skillNames); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java deleted file mode 100644 index d21a3b48d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java +++ /dev/null @@ -1,38 +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.showcase.dao; - -import org.apache.struts2.showcase.model.Skill; - -/** - * SkillDao. - * - */ - -public class SkillDao extends AbstractDao { - - private static final long serialVersionUID = -8160406514074630866L; - - public Class getFeaturedClass() { - return Skill.class; - } - - public Skill getSkill( String name ) { - return (Skill) get(name); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java deleted file mode 100644 index fbf8b93fc..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java +++ /dev/null @@ -1,40 +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.showcase.exception; - -/** - * CreateException. - * - */ - -public class CreateException extends StorageException { - - private static final long serialVersionUID = 6734349565111633783L; - - public CreateException(String message) { - super(message); - } - - public CreateException(String message, Throwable cause) { - super(message, cause); - } - - public CreateException(Throwable cause) { - super(cause); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java deleted file mode 100644 index 86022d1b5..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java +++ /dev/null @@ -1,41 +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.showcase.exception; - -/** - * DeleteException. - * - */ - -public class DeleteException extends StorageException { - - private static final long serialVersionUID = -5286362812955627352L; - - public DeleteException(String message) { - super(message); - } - - public DeleteException(Throwable cause) { - super(cause); - } - - public DeleteException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java deleted file mode 100644 index 4085de5b8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java +++ /dev/null @@ -1,41 +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.showcase.exception; - -/** - * DuplicateKeyException. - * - */ - -public class DuplicateKeyException extends CreateException { - - private static final long serialVersionUID = 989620752592415898L; - - public DuplicateKeyException(String message) { - super(message); - } - - public DuplicateKeyException(Throwable cause) { - super(cause); - } - - public DuplicateKeyException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java deleted file mode 100644 index d40397c17..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java +++ /dev/null @@ -1,41 +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.showcase.exception; - -/** - * StorageException. - * - */ - -public class StorageException extends Exception { - - private static final long serialVersionUID = -2528721270540362905L; - - public StorageException(String message) { - super(message); - } - - public StorageException(Throwable cause) { - super(cause); - } - - public StorageException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java deleted file mode 100644 index bb9304b94..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java +++ /dev/null @@ -1,42 +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.showcase.exception; - - -/** - * UpdateException. - * - */ - -public class UpdateException extends StorageException { - - private static final long serialVersionUID = -4728238600375630452L; - - - public UpdateException(String message) { - super(message); - } - - public UpdateException(Throwable cause) { - super(cause); - } - - public UpdateException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java deleted file mode 100644 index 51040156d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java +++ /dev/null @@ -1,41 +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.showcase.filedownload; - -import org.apache.struts2.ServletActionContext; -import com.opensymphony.xwork2.Action; - -import java.io.InputStream; - -/** - * Action to demonstrate how to use file download. - *

    - * This action is used to download a jpeg file from the image folder. - * - */ -public class FileDownloadAction implements Action { - - public InputStream getImageStream() throws Exception { - return ServletActionContext.getServletContext().getResourceAsStream("/images/struts.gif"); - } - - public String execute() throws Exception { - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java deleted file mode 100644 index 3d2906a38..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java +++ /dev/null @@ -1,82 +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.showcase.fileupload; - -import com.opensymphony.xwork2.ActionSupport; - -import java.io.File; - -/** - * Show case File Upload example's action. FileUploadAction - * - */ -public class FileUploadAction extends ActionSupport { - - private static final long serialVersionUID = 5156288255337069381L; - - private String contentType; - private File upload; - private String fileName; - private String caption; - - // since we are using the file name will be - // obtained through getter/setter of FileName - public String getUploadFileName() { - return fileName; - } - public void setUploadFileName(String fileName) { - this.fileName = fileName; - } - - - // since we are using the content type will be - // obtained through getter/setter of ContentType - public String getUploadContentType() { - return contentType; - } - public void setUploadContentType(String contentType) { - this.contentType = contentType; - } - - - // since we are using the File itself will be - // obtained through getter/setter of - public File getUpload() { - return upload; - } - public void setUpload(File upload) { - this.upload = upload; - } - - - public String getCaption() { - return caption; - } - public void setCaption(String caption) { - this.caption = caption; - } - - public String input() throws Exception { - return SUCCESS; - } - - public String upload() throws Exception { - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java deleted file mode 100644 index 40b685307..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java +++ /dev/null @@ -1,54 +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.showcase.freemarker; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.views.freemarker.FreemarkerManager; -import org.apache.struts2.views.freemarker.ScopesHashModel; - -import com.opensymphony.xwork2.util.OgnlValueStack; - -/** - * This is an example of a custom FreemarkerManager, mean to be - * instantiated through Spring. - *

    - * - * It will add into Freemarker's model - * an utility class called {@link CustomFreemarkerManagerUtil} as a simple - * example demonstrating how to extends FreemarkerManager. - *

    - * - * The {@link CustomFreemarkerManagerUtil} will be created by Spring and - * injected through constructor injection. - *

    - */ -public class CustomFreemarkerManager extends FreemarkerManager { - - private CustomFreemarkerManagerUtil util; - - public CustomFreemarkerManager(CustomFreemarkerManagerUtil util) { - this.util = util; - } - - public void populateContext(ScopesHashModel model, OgnlValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) { - super.populateContext(model, stack, action, request, response); - model.put("customFreemarkerManagerUtil", util); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java deleted file mode 100644 index f27079e1e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java +++ /dev/null @@ -1,39 +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.showcase.freemarker; - -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * This class is just a simple util that gets injected into - * {@link CustomFreemarkerManager} through Spring's constructor - * injection, serving as a simple example in Struts' Showcase. - */ -public class CustomFreemarkerManagerUtil { - - public String getTodayDate() { - SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); - return sdf.format(new Date()); - } - - public String getTimeNow() { - SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss"); - return sdf.format(new Date()); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java deleted file mode 100644 index 9e5ec7055..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.struts2.showcase.hangman; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class GetUpdatedHangmanAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 5506025785406043027L; - - private Map session; - private Hangman hangman; - - - public String execute() throws Exception { - hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY); - - System.out.println("\n\n\n"); - System.out.println("hangman="+hangman); - System.out.println("available = "+hangman.getCharactersAvailable().size()); - System.out.println("guess left="+hangman.guessLeft()); - System.out.println("\n\n\n"); - - return SUCCESS; - } - - public void setSession(Map session) { - this.session = session; - } - - public Hangman getHangman() { - return hangman; - } - public void setHangman(Hangman hangman) { - this.hangman = hangman; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java deleted file mode 100644 index aa1851140..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.struts2.showcase.hangman; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class GuessCharacterAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 9050915577007590674L; - - private Map session; - private Character character; - private Hangman hangman; - - public String execute() throws Exception { - hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY); - hangman.guess(character); - - return SUCCESS; - } - - public Hangman getHangman() { - return hangman; - } - - public void setSession(Map session) { - this.session = session; - } - - public void setCharacter(Character character) { - this.character = character; - } - - public Character getCharacter() { - return this.character; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java deleted file mode 100644 index cfbf7a59c..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java +++ /dev/null @@ -1,106 +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.showcase.hangman; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class Hangman implements Serializable { - - private static final long serialVersionUID = 8566954355839652509L; - - private Vocab vocab; - - private Boolean win = false; - - private int guessLeft = 5; - public List charactersAvailable; - public List charactersGuessed; - - public Hangman(Vocab vocab) { - // Arrays.asList(...) returns List that doesn't support remove(), hence - // we wrap it with an ArrayList to avoid UnsupportedOperationException - // when doing a remove() - charactersAvailable = new ArrayList(Arrays.asList( - new Character[] { - Character.valueOf('A'), Character.valueOf('B'), Character.valueOf('C'), - Character.valueOf('D'), Character.valueOf('E'), Character.valueOf('F'), - Character.valueOf('G'), Character.valueOf('H'), Character.valueOf('I'), - Character.valueOf('J'), Character.valueOf('K'), Character.valueOf('L'), - Character.valueOf('M'), Character.valueOf('N'), Character.valueOf('O'), - Character.valueOf('P'), Character.valueOf('Q'), Character.valueOf('R'), - Character.valueOf('S'), Character.valueOf('T'), Character.valueOf('U'), - Character.valueOf('V'), Character.valueOf('W'), Character.valueOf('X'), - Character.valueOf('Y'), Character.valueOf('Z') - })); - charactersGuessed = new ArrayList(); - this.vocab = vocab; - } - - public void guess(Character character) { - assert(character != null); - - synchronized(charactersAvailable) { - if (guessLeft < 0) { - throw new HangmanException( - HangmanException.Type.valueOf("GAME_ENDED"), "Game already eneded"); - } - Character characterInUpperCase = Character.toUpperCase(character); - boolean ok = charactersAvailable.remove(characterInUpperCase); - if (ok) { - charactersGuessed.add(characterInUpperCase); - if (! vocab.containCharacter(characterInUpperCase)) { - guessLeft = guessLeft - 1; - } - } - if (vocab.containsAllCharacter(charactersGuessed)) { - win = true; - } - System.out.println(" *********************************** "+win); - } - } - - public Boolean isWin() { - return this.win; - } - - public Vocab getVocab() { - return vocab; - } - - public Boolean gameEnded() { - return ((guessLeft < 0) || win); - } - - public Integer guessLeft() { - return guessLeft; - } - - public List getCharactersAvailable() { - synchronized(charactersAvailable) { - return new ArrayList(charactersAvailable); - //return charactersAvailable; - } - } - - public boolean characterGuessedBefore(Character character) { - return charactersGuessed.contains(character); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java deleted file mode 100644 index 2c5fd14a4..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.apache.struts2.showcase.hangman; - -public class HangmanConstants { - // keeps a Hangman object in HttpSession - public static final String HANGMAN_SESSION_KEY = "Hangman_Session_Key"; -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java deleted file mode 100644 index 95ac17e84..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java +++ /dev/null @@ -1,41 +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.showcase.hangman; - -public class HangmanException extends RuntimeException { - - private static final long serialVersionUID = -8500292863595941335L; - - enum Type { - GAME_ENDED, - NO_VOCAB, - NO_VOCAB_SOURCE; - } - - - private Type type; - - public HangmanException (Type type, String reason) { - super(reason); - this.type = type; - } - - public Type getType() { - return type; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java deleted file mode 100644 index 0219bfe34..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java +++ /dev/null @@ -1,31 +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.showcase.hangman; - -public class HangmanService { - - public VocabSource vocabSource; - - public HangmanService(VocabSource vocabSource) { - this.vocabSource = vocabSource; - } - - public Hangman startNewGame() { - return new Hangman(vocabSource.getRandomVocab()); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java deleted file mode 100644 index ec3e1a89a..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java +++ /dev/null @@ -1,68 +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.showcase.hangman; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -public class PropertiesVocabSource implements VocabSource { - - private Properties prop; - private List vocabs; - - public PropertiesVocabSource() { - } - - public PropertiesVocabSource(Properties prop) { - assert(prop != null); - this.prop = prop; - vocabs = readVocab(prop); - } - - public void setVocabProperties(Properties prop) { - assert(prop != null); - this.prop = prop; - vocabs = readVocab(prop); - } - - public Vocab getRandomVocab() { - if (vocabs == null) { - throw new HangmanException(HangmanException.Type.valueOf("NO_VOCAB_SOURCE"), "No vocab source"); - } - if (vocabs.size() <= 0) { - throw new HangmanException(HangmanException.Type.valueOf("NO_VOCAB"), "No vocab"); - } - long vocabIndex = Math.round((Math.random() * (double)prop.size())); - vocabIndex = vocabIndex == vocabs.size() ? vocabs.size() - 1 : vocabIndex; - return vocabs.get((int)vocabIndex); - } - - protected List readVocab(Properties prop) { - List vocabList = new ArrayList(); - - for (Map.Entry e : prop.entrySet()) { - String vocab = (String) e.getKey(); - String hint = (String) e.getValue(); - - vocabList.add(new Vocab(vocab, hint)); - } - return vocabList; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java deleted file mode 100644 index 508874834..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java +++ /dev/null @@ -1,58 +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.showcase.hangman; - -import static org.apache.struts2.showcase.hangman.HangmanConstants.*; - -import java.util.Map; - -import org.apache.struts2.interceptor.SessionAware; - -import com.opensymphony.xwork2.ActionSupport; - -public class StartHangmanAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 2333463075324892521L; - - private HangmanService service; - private Hangman hangman; - private Map session; - - - public StartHangmanAction(HangmanService service) { - this.service = service; - } - - public String execute() throws Exception { - - hangman = service.startNewGame(); - session.put(HANGMAN_SESSION_KEY, hangman); - - return SUCCESS; - } - - public Hangman getHangman() { - return hangman; - } - - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java deleted file mode 100644 index b01b4317e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java +++ /dev/null @@ -1,83 +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.showcase.hangman; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class Vocab implements Serializable { - - private static final long serialVersionUID = 1L; - - private String vocab; - private String hint; - private Character[] characters; // character this vocab is made up of - - public Vocab(String vocab, String hint) { - assert(vocab != null); - assert(hint != null); - - this.vocab = vocab.toUpperCase(); - this.hint = hint; - } - - public String getVocab() { return this.vocab; } - public String getHint() { return this.hint; } - - public Boolean containCharacter(Character character) { - assert(character != null); - - return (vocab.contains(character.toString())) ? true : false; - } - - public Character[] inCharacters() { - if (characters == null) { - char[] c = vocab.toCharArray(); - characters = new Character[c.length]; - for (int a=0; a< c.length; a++) { - characters[a] = Character.valueOf(c[a]); - } - } - return characters; - } - - public boolean containsAllCharacter(List charactersGuessed) { - Character[] chars = inCharacters(); - List tmpChars = Arrays.asList(chars); - return charactersGuessed.containsAll(tmpChars); - } - - public static void main(String args[]) throws Exception { - Vocab v = new Vocab("JAVA", "a java word"); - - List list1= new ArrayList(); - list1.add(new Character('J')); - list1.add(new Character('V')); - - List list2 = new ArrayList(); - list2.add(new Character('J')); - list2.add(new Character('V')); - list2.add(new Character('A')); - - System.out.println(v.containsAllCharacter(list1)); - System.out.println(v.containsAllCharacter(list2)); - - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java deleted file mode 100644 index 4682d81a2..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java +++ /dev/null @@ -1,22 +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.showcase.hangman; - -public interface VocabSource { - Vocab getRandomVocab(); -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java deleted file mode 100644 index 49e8d3728..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Id: Gangster.java 418530 2006-07-01 23:58:13Z mrdon $ - * - * 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.showcase.integration; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class EditGangsterAction extends Action { - - /* (non-Javadoc) - * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) - */ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { - // Some code to load the gangster from the db as necessary - - return mapping.findForward("success"); - } - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java deleted file mode 100644 index 477135f48..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.apache.struts2.showcase.integration; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; -import org.apache.struts.validator.ValidatorForm; - -public class GangsterForm extends ValidatorForm { - - private String name; - private String age; - private String description; - private boolean bustedBefore; - - /* (non-Javadoc) - * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) - */ - @Override - public void reset(ActionMapping arg0, HttpServletRequest arg1) { - bustedBefore = false; - } - - /* (non-Javadoc) - * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) - */ - @Override - public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { - ActionErrors errors = super.validate(mapping, request); - if (name == null || name.length() == 0) { - errors.add("name", new ActionMessage("The name must not be blank")); - } - - return errors; - } - - /** - * @return the age - */ - public String getAge() { - return age; - } - /** - * @param age the age to set - */ - public void setAge(String age) { - this.age = age; - } - /** - * @return the bustedBefore - */ - public boolean isBustedBefore() { - return bustedBefore; - } - /** - * @param bustedBefore the bustedBefore to set - */ - public void setBustedBefore(boolean bustedBefore) { - this.bustedBefore = bustedBefore; - } - /** - * @return the description - */ - public String getDescription() { - return description; - } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java deleted file mode 100644 index 86204855a..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: Gangster.java 418530 2006-07-01 23:58:13Z mrdon $ - * - * 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.showcase.integration; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; -import org.apache.struts.action.ActionMessages; - -public class SaveGangsterAction extends Action { - - /* (non-Javadoc) - * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) - */ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { - - // Some code to save the gangster to the db as necessary - GangsterForm gform = (GangsterForm) form; - ActionMessages messages = new ActionMessages(); - messages.add("msg", new ActionMessage("Gangster "+gform.getName()+" added successfully")); - addMessages(request, messages); - - return mapping.findForward("success"); - } - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java deleted file mode 100644 index 89f2db5de..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java +++ /dev/null @@ -1,119 +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.showcase.jsf; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.struts2.showcase.action.EmployeeAction; -import org.apache.struts2.showcase.dao.SkillDao; -import org.apache.struts2.showcase.model.Employee; -import org.apache.struts2.showcase.model.Skill; - -/** - * Overriding the EmployeeAction to main provide getters returning the data in - * the form required by the JSF components - */ -public class JsfEmployeeAction extends EmployeeAction { - - private static final long serialVersionUID = 1L; - - /** - * Creating a default employee and main skill, since the JSF EL can't handle - * creating new objects as necessary - * - */ - public JsfEmployeeAction() { - Employee e = new Employee(); - e.setMainSkill(new Skill()); - setCurrentEmployee(e); - } - - private SkillDao skillDao; - - public void setSkillDao(SkillDao skillDao) { - this.skillDao = skillDao; - } - - /** - * Returning a List because the JSF dataGrid can't handle a Set for some - * reason - */ - @Override - public Collection getAvailableItems() { - return new ArrayList(super.getAvailableItems()); - } - - /** - * Changing the String array into a Map - */ - public Map getAvailablePositionsAsMap() { - Map map = new LinkedHashMap(); - for (String val : super.getAvailablePositions()) { - map.put(val, val); - } - return map; - } - - /** - * Converting the list into a map - */ - public Map getAvailableLevelsAsMap() { - Map map = new LinkedHashMap(); - for (Object val : super.getAvailableLevels()) { - map.put(val, val); - } - return map; - } - - /** - * Converting the Skill object list into a map - */ - public Map getAvailableSkills() { - Map map = new HashMap(); - for (Object val : skillDao.findAll()) { - Skill skill = (Skill) val; - map.put(skill.getDescription(), skill.getName()); - } - return map; - } - - /** - * Gets the selected Skill objects as a list - */ - public List getSelectedSkillsAsList() { - System.out.println("asked for skills"); - List list = new ArrayList(); - List skills = super.getSelectedSkills(); - if (skills != null) { - for (Object val : skills) { - if (val instanceof Skill) { - list.add(((Skill) val).getDescription()); - } else { - Skill skill = skillDao.getSkill((String) val); - list.add(skill.getDescription()); - } - } - } - return list; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java deleted file mode 100644 index 9d8ff6208..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java +++ /dev/null @@ -1,173 +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.showcase.model; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * Employee. - * - */ - -public class Employee implements IdEntity { - - private static final long serialVersionUID = -6226845151026823748L; - - private Long empId; //textfield w/ conversion - private String firstName; - private String lastName; - private Date birthDate; //datepicker - private Float salary; //textfield w/ conversion - private boolean married; //checkbox - private String position; //combobox - private Skill mainSkill; //select - private List otherSkills; //doubleSelect - private String password; //password - private String level; //radio - private String comment; //textarea - - public Employee() { - } - - public Employee(Long empId, String firstName, String lastName) { - this.empId = empId; - this.firstName = firstName; - this.lastName = lastName; - } - - public Employee(Long empId, String firstName, String lastName, Date birthDate, Float salary, boolean married, String position, Skill mainSkill, List otherSkills, String password, String level, String comment) { - this.empId = empId; - this.firstName = firstName; - this.lastName = lastName; - this.birthDate = birthDate; - this.salary = salary; - this.married = married; - this.position = position; - this.mainSkill = mainSkill; - this.otherSkills = otherSkills; - this.password = password; - this.level = level; - this.comment = comment; - } - - public Long getEmpId() { - return empId; - } - - public void setEmpId(Long empId) { - this.empId = empId; - } - - public Serializable getId() { - return getEmpId(); - } - - public void setId(Serializable id) { - setEmpId((Long) id); - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public Date getBirthDate() { - return birthDate; - } - - public void setBirthDate(Date birthDate) { - this.birthDate = birthDate; - } - - public Float getSalary() { - return salary; - } - - public void setSalary(Float salary) { - this.salary = salary; - } - - public boolean isMarried() { - return married; - } - - public void setMarried(boolean married) { - this.married = married; - } - - public String getPosition() { - return position; - } - - public void setPosition(String position) { - this.position = position; - } - - public Skill getMainSkill() { - return mainSkill; - } - - public void setMainSkill(Skill mainSkill) { - this.mainSkill = mainSkill; - } - - public List getOtherSkills() { - return otherSkills; - } - - public void setOtherSkills(List otherSkills) { - this.otherSkills = otherSkills; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getLevel() { - return level; - } - - public void setLevel(String level) { - this.level = level; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java deleted file mode 100644 index 6f43eb831..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java +++ /dev/null @@ -1,33 +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.showcase.model; - -import java.io.Serializable; - -/** - * IdEntity. Interface. - * - */ - -public interface IdEntity extends Serializable { - - Serializable getId (); - - void setId ( Serializable id ); - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java deleted file mode 100644 index ab2122c84..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java +++ /dev/null @@ -1,69 +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.showcase.model; - -import java.io.Serializable; - -/** - * Skill. - * - */ - -public class Skill implements IdEntity { - - private static final long serialVersionUID = -4150317722693212439L; - - private String name; - private String description; - - public Skill() { - } - - public Skill(String name, String description) { - this.name = name; - this.description = description; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Serializable getId() { - return getName(); - } - - public void setId(Serializable id) { - setName((String) id); - } - - public String toString() { - return getName(); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java deleted file mode 100644 index 90f0d05f8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java +++ /dev/null @@ -1,59 +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.showcase.modelDriven; - -import java.io.Serializable; - -/** - * A model class to be used by the simple Model-Driven example. - * - */ -public class Gangster implements Serializable { - - private static final long serialVersionUID = 3688389475320294992L; - - private String name; - private int age; - private String description; - private boolean bustedBefore; - - public int getAge() { - return age; - } - public void setAge(int age) { - this.age = age; - } - public boolean isBustedBefore() { - return bustedBefore; - } - public void setBustedBefore(boolean bustedBefore) { - this.bustedBefore = bustedBefore; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java deleted file mode 100644 index 1484dc567..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java +++ /dev/null @@ -1,42 +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.showcase.modelDriven; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.ModelDriven; - -/** - * Action to demonstrate simple model-driven feature of the framework. - * - */ -public class ModelDrivenAction extends ActionSupport implements ModelDriven { - - private static final long serialVersionUID = 1271130427666936592L; - - public String input() throws Exception { - return SUCCESS; - } - - public String execute() throws Exception { - return SUCCESS; - } - - public Object getModel() { - return new Gangster(); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/CreatePerson-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/CreatePerson-validation.xml deleted file mode 100644 index 6d19ebdf6..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/CreatePerson-validation.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/CreatePerson.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/CreatePerson.java deleted file mode 100644 index 7e6c63e3e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/CreatePerson.java +++ /dev/null @@ -1,48 +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.showcase.person; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class CreatePerson extends ActionSupport { - - private static final long serialVersionUID = 200410824352645515L; - - PersonManager personManager; - Person person; - - public void setPersonManager(PersonManager personManager) { - this.personManager = personManager; - } - - public String execute() { - personManager.createPerson(person); - - return SUCCESS; - } - - public Person getPerson() { - return person; - } - - public void setPerson(Person person) { - this.person = person; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPerson-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPerson-conversion.properties deleted file mode 100644 index 00b2a0365..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPerson-conversion.properties +++ /dev/null @@ -1,3 +0,0 @@ -KeyProperty_persons=id -Element_persons=org.apache.struts2.showcase.person.Person -CreateIfNull_persons=true diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPerson.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPerson.java deleted file mode 100644 index 43db2859e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPerson.java +++ /dev/null @@ -1,76 +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.showcase.person; - -import com.opensymphony.xwork2.ActionSupport; - -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; - -/** - * EditPerson - * - */ -public class EditPerson extends ActionSupport { - - private static final long serialVersionUID = 7699491775215130850L; - - PersonManager personManager; - List persons = new ArrayList(); - - public void setPersonManager(PersonManager personManager) { - this.personManager = personManager; - } - - public List getPersons() { - return persons; - } - - public void setPersons(List persons) { - this.persons = persons; - } - - /** - * A default implementation that does nothing an returns "success". - * - * @return {@link #SUCCESS} - */ - public String execute() throws Exception { - persons.addAll(personManager.getPeople()); - return SUCCESS; - } - - /** - * A default implementation that does nothing an returns "success". - * - * @return {@link #SUCCESS} - */ - public String save() throws Exception { - - // Set people = personManager.getPeople(); - - for ( Iterator iter = persons.iterator(); iter.hasNext();) { - Person p = (Person) iter.next(); - personManager.getPeople().remove(p); - personManager.getPeople().add(p); - } - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeople.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeople.java deleted file mode 100644 index ca605a7d8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeople.java +++ /dev/null @@ -1,52 +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.showcase.person; - -import com.opensymphony.xwork2.ActionSupport; - -import java.util.List; -import java.util.ArrayList; - -/** - */ -public class ListPeople extends ActionSupport { - - private static final long serialVersionUID = 3608017189783645371L; - - PersonManager personManager; - List people = new ArrayList(); - - public void setPersonManager(PersonManager personManager) { - this.personManager = personManager; - } - - public String execute() { - people.addAll(personManager.getPeople()); - - return SUCCESS; - } - - public List getPeople() { - return people; - } - - public int getPeopleCount() { - return people.size(); - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person-validation.xml deleted file mode 100644 index da2c81f0c..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person-validation.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - You must enter a first name. - - - - - You must enter a last name - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java deleted file mode 100644 index 20cb4d52d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java +++ /dev/null @@ -1,83 +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.showcase.person; - -/** - */ -public class Person { - Long id; - String name; - String lastName; - - public Person() { - } - - public Person(Long id, String name, String lastName) { - this.id = id; - this.name = name; - this.lastName = lastName; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final Person person = (Person) o; - - if (id != null ? !id.equals(person.id) : person.id != null) return false; - - return true; - } - - public int hashCode() { - return (id != null ? id.hashCode() : 0); - } - - - public String toString() { - return "Person{" + - "id=" + id + - ", name='" + name + '\'' + - ", lastName='" + lastName + '\'' + - '}'; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java deleted file mode 100644 index 1a984b108..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java +++ /dev/null @@ -1,55 +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.showcase.person; - -import java.util.Set; -import java.util.HashSet; - -/** - */ -public class PersonManager { - private static Set people = new HashSet(5); - private static long COUNT = 5; - - static { - // create some imaginary persons - Person p1 = new Person(new Long(1), "Patrick", "Lightbuddie"); - Person p2 = new Person(new Long(2), "Jason", "Carrora"); - Person p3 = new Person(new Long(3), "Alexandru", "Papesco"); - Person p4 = new Person(new Long(4), "Jay", "Boss"); - Person p5 = new Person(new Long(5), "Rainer", "Hermanos"); - people.add(p1); - people.add(p2); - people.add(p3); - people.add(p4); - people.add(p5); - } - - public void createPerson(Person person) { - person.setId(new Long(++COUNT)); - people.add(person); - } - - public void updatePerson(Person person) { - people.add(person); - } - - public Set getPeople() { - return people; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java deleted file mode 100644 index ad701c3f5..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.apache.struts2.showcase.sitemesh; - -import com.opensymphony.module.sitemesh.Decorator; -import com.opensymphony.module.sitemesh.Page; -import com.opensymphony.module.sitemesh.mapper.AbstractDecoratorMapper; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author Patrick Lightbody (plightbo at gmail dot com) - */ -public class NoneDecoratorMapper extends AbstractDecoratorMapper { - public Decorator getDecorator(HttpServletRequest req, Page page) { - if ("none".equals(req.getAttribute("decorator"))) { - return null; - } - - return super.getDecorator(req, page); - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java deleted file mode 100644 index 327bfe489..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * $Id: CreatePerson.java 420385 2006-07-10 00:57:05Z mrdon $ - * - * 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.showcase.source; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletContext; - -import org.apache.struts2.util.ServletContextAware; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.util.ClassLoaderUtil; - -/** - * Processes configuration, page, and action class paths to create snippets - * of the files for display. - */ -public class ViewSourceAction extends ActionSupport implements ServletContextAware { - - private String page; - private String className; - private String config; - - private List pageLines; - private List classLines; - private List configLines; - - private int configLine; - private int padding = 10; - - private ServletContext servletContext; - - public String execute() throws MalformedURLException, IOException { - - if (page != null) { - - InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//")+1), getClass()); - page = page.replace("//", "/"); - - if (in == null) { - in = servletContext.getResourceAsStream(page); - while (in == null && page.indexOf('/', 1) > 0) { - page = page.substring(page.indexOf('/', 1)); - in = servletContext.getResourceAsStream(page); - } - } - pageLines = read(in, -1); - } - - if (className != null) { - className = "/"+className.replace('.', '/') + ".java"; - InputStream in = getClass().getResourceAsStream(className); - if (in == null) { - in = servletContext.getResourceAsStream("/WEB-INF/src"+className); - } - classLines = read(in, -1); - } - - if (config != null) { - int pos = config.lastIndexOf(':'); - configLine = Integer.parseInt(config.substring(pos+1)); - config = config.substring(0, pos).replace("//", "/"); - configLines = read(new URL(config).openStream(), configLine); - } - return SUCCESS; - } - - /** - * @param className the className to set - */ - public void setClassName(String className) { - this.className = className; - } - - /** - * @param config the config to set - */ - public void setConfig(String config) { - this.config = config; - } - - /** - * @param page the page to set - */ - public void setPage(String page) { - this.page = page; - } - - /** - * @param padding the padding to set - */ - public void setPadding(int padding) { - this.padding = padding; - } - - - - /** - * @return the classLines - */ - public List getClassLines() { - return classLines; - } - - /** - * @return the configLines - */ - public List getConfigLines() { - return configLines; - } - - /** - * @return the pageLines - */ - public List getPageLines() { - return pageLines; - } - - /** - * @return the className - */ - public String getClassName() { - return className; - } - - /** - * @return the config - */ - public String getConfig() { - return config; - } - - /** - * @return the page - */ - public String getPage() { - return page; - } - - /** - * @return the configLine - */ - public int getConfigLine() { - return configLine; - } - - /** - * @return the padding - */ - public int getPadding() { - return padding; - } - - /** - * Reads in a strea, optionally only including the target line number - * and its padding - * - * @param in The input stream - * @param targetLineNumber The target line number, negative to read all - * @return A list of lines - */ - private List read(InputStream in, int targetLineNumber) { - List snippet = null; - if (in != null) { - snippet = new ArrayList(); - int startLine = 0; - int endLine = Integer.MAX_VALUE; - if (targetLineNumber > 0) { - startLine = targetLineNumber - padding; - endLine = targetLineNumber + padding; - } - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - - int lineno = 0; - String line; - while ((line = reader.readLine()) != null) { - lineno++; - if (lineno >= startLine && lineno <= endLine) { - snippet.add(line); - } - } - } catch (Exception ex) { - // ignoring as snippet not available isn't a big deal - } - } - return snippet; - } - - public void setServletContext(ServletContext arg0) { - this.servletContext = arg0; - } - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java deleted file mode 100644 index fb20f27d9..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.apache.struts2.showcase.tag.nonui.actionPrefix; - -import com.opensymphony.xwork2.ActionSupport; - -public class SubmitAction extends ActionSupport { - - private static final long serialVersionUID = -7832803019378213087L; - - private String text; - - public String getText() { return text; } - public void setText(String text) { this.text = text; } - - public String execute() throws Exception { - return SUCCESS; - } - - public String alternateMethod() { - return "methodPrefixResult"; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java deleted file mode 100644 index 1874adffd..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java +++ /dev/null @@ -1,35 +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.showcase.tag.nonui.actiontag; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class ActionTagDemo extends ActionSupport { - - private static final long serialVersionUID = -2749145880590245184L; - - public String show() throws Exception { - return SUCCESS; - } - - public String doInclude() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java deleted file mode 100644 index b4cc3d033..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java +++ /dev/null @@ -1,77 +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.showcase.tag.nonui.iteratortag; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.Validateable; - -/** - * - */ -public class AppendIteratorTagDemo extends ActionSupport implements Validateable { - - private static final long serialVersionUID = -6525059998526094664L; - - private String iteratorValue1; - private String iteratorValue2; - - - public void validate() { - if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0 ) { - addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); - } - else if (iteratorValue1.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); - } - if (iteratorValue2 == null || iteratorValue2.trim().length() <= 0) { - addFieldError("iteratorValue2", "iterator value 2 cannot be empty"); - } - else if (iteratorValue2.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue2", "iterator value 2 needs to be comma separated"); - } - } - - - - - public String getIteratorValue1() { - return iteratorValue1; - } - public void setIteratorValue1(String iteratorValue1) { - this.iteratorValue1 = iteratorValue1; - } - - - - public String getIteratorValue2() { - return iteratorValue2; - } - public void setIteratorValue2(String iteratorValue2) { - this.iteratorValue2 = iteratorValue2; - } - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo-validation.xml deleted file mode 100644 index 55f9577b2..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo-validation.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - true - Value must not be empty - - - - - - - Count must be an integer - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java deleted file mode 100644 index bbd214ae5..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java +++ /dev/null @@ -1,66 +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.showcase.tag.nonui.iteratortag; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public class IteratorGeneratorTagDemo extends ActionSupport { - - private static final long serialVersionUID = 6893616642389337039L; - - private String value; - private Integer count; - private String separator; - - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - - public Integer getCount() { - return count; - } - public void setCount(Integer count) { - this.count = count; - } - - - - public String getSeparator() { - return this.separator; - } - public void setSeparator(String separator) { - this.separator = separator; - } - - - public String submit() throws Exception { - return SUCCESS; - } - - - public String input() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java deleted file mode 100644 index 9bd13c43d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java +++ /dev/null @@ -1,78 +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.showcase.tag.nonui.iteratortag; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.Validateable; - - -/** - */ -public class MergeIteratorTagDemo extends ActionSupport implements Validateable { - - private static final long serialVersionUID = 4401107963952961695L; - - private String iteratorValue1; - private String iteratorValue2; - - - public void validate() { - if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0 ) { - addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); - } - else if (iteratorValue1.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); - } - if (iteratorValue2 == null || iteratorValue2.trim().length() <= 0) { - addFieldError("iteratorValue2", "iterator value 2 cannot be empty"); - } - else if (iteratorValue2.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue2", "iterator value 2 needs to be comma separated"); - } - } - - - - public String getIteratorValue1() { - return this.iteratorValue1; - } - public void setIteratorValue1(String iteratorValue1) { - this.iteratorValue1 = iteratorValue1; - } - - - - public String getIteratorValue2() { - return this.iteratorValue2; - } - public void setIteratorValue2(String iteratorValue2) { - this.iteratorValue2 = iteratorValue2; - } - - - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java deleted file mode 100644 index c313eb7ed..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java +++ /dev/null @@ -1,85 +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.showcase.tag.nonui.iteratortag; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.Validateable; - -/** - * - */ -public class SubsetIteratorTagDemo extends ActionSupport implements Validateable { - - private static final long serialVersionUID = -8151855954644052650L; - - private String iteratorValue; - private Integer count; - private Integer start; - - - public void validate() { - if (iteratorValue == null || iteratorValue.trim().length() <= 0 ) { - addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); - } - else if (iteratorValue.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); - } - } - - - - public String getIteratorValue() { - return this.iteratorValue; - } - public void setIteratorValue(String iteratorValue) { - this.iteratorValue = iteratorValue; - } - - - - public Integer getCount() { - return this.count; - } - public void setCount(Integer count) { - this.count = count; - } - - - - public Integer getStart() { - return this.start; - } - public void setStart(Integer start) { - this.start = start; - } - - - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } - - - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java deleted file mode 100644 index 9101dd40d..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java +++ /dev/null @@ -1,81 +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.showcase.token; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionSupport; - -import java.util.Date; - -/** - * Example to illustrate the token and token-session interceptor. - * - */ -public class TokenAction extends ActionSupport { - - private static final long serialVersionUID = 616150375751184884L; - - private int amount; - - public String execute() throws Exception { - // transfer from source to destination - - Integer balSource = (Integer) ActionContext.getContext().getSession().get("balanceSource"); - Integer balDest = (Integer) ActionContext.getContext().getSession().get("balanceDestination"); - - Integer newSource = new Integer(balSource.intValue() - amount); - Integer newDest = new Integer(balDest.intValue() + amount); - - ActionContext.getContext().getSession().put("balanceSource", newSource); - ActionContext.getContext().getSession().put("balanceDestination", newDest); - ActionContext.getContext().getSession().put("time", new Date()); - - Thread.sleep(2000); // to simulate processing time - - return SUCCESS; - } - - public String doInput() throws Exception { - // prepare input form - Integer balSource = (Integer) ActionContext.getContext().getSession().get("balanceSource"); - Integer balDest = (Integer) ActionContext.getContext().getSession().get("balanceDestination"); - - if (balSource == null) { - // first time set up an initial account balance - balSource = new Integer(1200); - ActionContext.getContext().getSession().put("balanceSource", balSource); - } - - if (balDest == null) { - // first time set up an initial account balance - balDest = new Integer(2500); - ActionContext.getContext().getSession().put("balanceDestination", balDest); - } - - return INPUT; - } - - public int getAmount() { - return amount; - } - - public void setAmount(int amount) { - this.amount = amount; - } - -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java deleted file mode 100644 index 4fa481726..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import com.opensymphony.xwork2.ActionSupport; - -public class HelloName extends ActionSupport { - - public String execute() throws Exception { - if (getName() == null || getName().length() == 0) - return ERROR; - else - return SUCCESS; - } - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java deleted file mode 100644 index 11d51a570..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.interceptor.ParameterAware; - -import java.util.Map; - -public class HelloName2 extends ActionSupport implements ParameterAware { - - public static String NAME = "name"; - - public String execute() { - String[] name = (String[]) parameters.get(NAME); - if (name == null || name[0] == null || name[0].length() == 0) - return ERROR; - else - return SUCCESS; - } - - Map parameters; - - public Map getParameters() { - return parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java deleted file mode 100644 index 28a45ba76..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import com.opensymphony.xwork2.Action; - -import java.text.DateFormat; -import java.util.Date; - -public class HelloWorld implements Action { - - public String execute() { - message = "Hello, World!\n"; - message += "The time is:\n"; - message += DateFormat.getDateInstance().format(new Date()); - return SUCCESS; - } - - private String message; - - public String getMessage() { - return message; - } - -} \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java deleted file mode 100644 index 39d1047f8..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java +++ /dev/null @@ -1,33 +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.showcase.validation; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ -public abstract class AbstractValidationActionSupport extends ActionSupport { - - public String submit() throws Exception { - return "success"; - } - - public String input() throws Exception { - return "input"; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-conversion.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-conversion.properties deleted file mode 100644 index 2f970dc18..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -dateValidatorField=java.util.Date \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xml deleted file mode 100644 index 215a7c9ac..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - true - - - - - - true - - - - - - 1 - 10 - - - - - - 01/01/1990 - 01/01/2000 - - - - - - - - - - - - - - - - 4 - 2 - true - - - - - - .*\.txt - - - - - - (fieldExpressionValidatorField == requiredValidatorField) - - - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml deleted file mode 100644 index 97250cf93..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - true - - - - - - 1 - 10 - - - - - - 01/01/1990 - 01/01/2000 - - - - - - - - - - - - - - - - 4 - 2 - true - - - - - - .*\.txt - - - - - - (fieldExpressionValidatorField == requiredValidatorField) - - - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java deleted file mode 100644 index 9da8bd8af..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java +++ /dev/null @@ -1,104 +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.showcase.validation; - -import java.sql.Date; - -/** - */ - -// START SNIPPET: fieldValidatorsExample - -public class FieldValidatorsExampleAction extends AbstractValidationActionSupport { - - private static final long serialVersionUID = -4829381083003175423L; - - private String requiredValidatorField = null; - private String requiredStringValidatorField = null; - private Integer integerValidatorField = null; - private Date dateValidatorField = null; - private String emailValidatorField = null; - private String urlValidatorField = null; - private String stringLengthValidatorField = null; - private String regexValidatorField = null; - private String fieldExpressionValidatorField = null; - - - - public Date getDateValidatorField() { - return dateValidatorField; - } - public void setDateValidatorField(Date dateValidatorField) { - this.dateValidatorField = dateValidatorField; - } - public String getEmailValidatorField() { - return emailValidatorField; - } - public void setEmailValidatorField(String emailValidatorField) { - this.emailValidatorField = emailValidatorField; - } - public Integer getIntegerValidatorField() { - return integerValidatorField; - } - public void setIntegerValidatorField(Integer integerValidatorField) { - this.integerValidatorField = integerValidatorField; - } - public String getRegexValidatorField() { - return regexValidatorField; - } - public void setRegexValidatorField(String regexValidatorField) { - this.regexValidatorField = regexValidatorField; - } - public String getRequiredStringValidatorField() { - return requiredStringValidatorField; - } - public void setRequiredStringValidatorField(String requiredStringValidatorField) { - this.requiredStringValidatorField = requiredStringValidatorField; - } - public String getRequiredValidatorField() { - return requiredValidatorField; - } - public void setRequiredValidatorField(String requiredValidatorField) { - this.requiredValidatorField = requiredValidatorField; - } - public String getStringLengthValidatorField() { - return stringLengthValidatorField; - } - public void setStringLengthValidatorField(String stringLengthValidatorField) { - this.stringLengthValidatorField = stringLengthValidatorField; - } - public String getFieldExpressionValidatorField() { - return fieldExpressionValidatorField; - } - public void setFieldExpressionValidatorField( - String fieldExpressionValidatorField) { - this.fieldExpressionValidatorField = fieldExpressionValidatorField; - } - - public String getUrlValidatorField() { - return urlValidatorField; - } - - public void setUrlValidatorField(String urlValidatorField) { - this.urlValidatorField = urlValidatorField; - } -} - - -// END SNIPPET: fieldValidatorsExample - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.properties b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.properties deleted file mode 100644 index 14f04121a..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.properties +++ /dev/null @@ -1 +0,0 @@ -i18n.requiredstring=Test String for required Strings... diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml deleted file mode 100644 index cba25b09e..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java deleted file mode 100644 index 1461fcda0..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java +++ /dev/null @@ -1,57 +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.showcase.validation; - -/** - */ - -// START SNIPPET: nonFieldValidatorsExample - -public class NonFieldValidatorsExampleAction extends AbstractValidationActionSupport { - - private static final long serialVersionUID = -524460368233581186L; - - private String someText; - private String someTextRetype; - private String someTextRetypeAgain; - - public String getSomeText() { - return someText; - } - public void setSomeText(String someText) { - this.someText = someText; - } - public String getSomeTextRetype() { - return someTextRetype; - } - public void setSomeTextRetype(String someTextRetype) { - this.someTextRetype = someTextRetype; - } - public String getSomeTextRetypeAgain() { - return someTextRetypeAgain; - } - public void setSomeTextRetypeAgain(String someTextRetypeAgain) { - this.someTextRetypeAgain = someTextRetypeAgain; - } -} - - -// END SNIPPET: nonFieldValidatorsExample - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction-validation.xml deleted file mode 100644 index dd716fade..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction-validation.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - You must enter a name - - - - - 13 - 19 - Only people ages 13 to 19 may take this quiz - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java deleted file mode 100644 index b1c4e6b6f..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java +++ /dev/null @@ -1,61 +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.showcase.validation; - -import com.opensymphony.xwork2.ActionSupport; - -/** - */ - -// START SNIPPET: quizAction - -public class QuizAction extends ActionSupport { - - private static final long serialVersionUID = -7505437345373234225L; - - String name; - int age; - String answer; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getAnswer() { - return answer; - } - - public void setAnswer(String answer) { - this.answer = answer; - } -} - -// END SNIPPET: quizAction - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java deleted file mode 100644 index 7fbfecac2..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java +++ /dev/null @@ -1,57 +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.showcase.validation; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - * @version $Date$ $Id$ - */ -public class SubmitApplication extends ActionSupport { - - private String name; - private Integer age; - - public void setName(String name) { - this.name = name; - } - public String getName() { - return this.name; - } - - public void setAge(Integer age) { - this.age = age; - } - public Integer getAge() { - return age; - } - - public String submitApplication() throws Exception { - return SUCCESS; - } - - public String applicationOk() throws Exception { - addActionMessage("Your application looks ok."); - return SUCCESS; - } - public String cancelApplication() throws Exception { - addActionMessage("So you have decided to cancel the application"); - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User-userContext-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User-userContext-validation.xml deleted file mode 100644 index 508eb6590..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User-userContext-validation.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - Name Required - - - - - 1 - 100 - Age Required (1-100) - - - - - Birthday Required - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java deleted file mode 100644 index 32a88f228..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java +++ /dev/null @@ -1,50 +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.showcase.validation; - -import java.sql.Date; - -/** - */ -public class User { - - private String name; - private Integer age; - private Date birthday; - - - public Integer getAge() { - return age; - } - public void setAge(Integer age) { - this.age = age; - } - public Date getBirthday() { - return birthday; - } - public void setBirthday(Date birthday) { - this.birthday = birthday; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } -} - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml deleted file mode 100644 index a8af8f005..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - userContext - true - User: - - - - - - diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java deleted file mode 100644 index 08a489d19..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java +++ /dev/null @@ -1,39 +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.showcase.validation; - - -// START SNIPPET: visitorValidatorsExample - -public class VisitorValidatorsExampleAction extends AbstractValidationActionSupport { - - private static final long serialVersionUID = 4375454086939598216L; - - private User user; - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } -} - - -// END SNIPPET: visitorValidatorsExample diff --git a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java b/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java deleted file mode 100644 index 7f33be892..000000000 --- a/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java +++ /dev/null @@ -1,47 +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.showcase.wait; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * Example to illustrate the execAndWait interceptor. - * - */ -public class LongProcessAction extends ActionSupport { - - private static final long serialVersionUID = 2471910747833998708L; - - private int time; - - public int getTime() { - return time; - } - - public void setTime(int time) { - this.time = time; - } - - public String execute() throws Exception { - System.err.println("time: " + time); - Thread.sleep(time); - - return SUCCESS; - } - -} diff --git a/trunk/apps/showcase/src/main/resources/globalMessages.properties b/trunk/apps/showcase/src/main/resources/globalMessages.properties deleted file mode 100644 index 24a39d45c..000000000 --- a/trunk/apps/showcase/src/main/resources/globalMessages.properties +++ /dev/null @@ -1,7 +0,0 @@ -save=Save - -item.edit=Edit {0} -item.create=Create {0} -item.list={0} List - -token.transfer.time=The bank transfer was executed at {0,date,HH:mm:ss MM-dd-yyyy} diff --git a/trunk/apps/showcase/src/main/resources/globalMessages_de.properties b/trunk/apps/showcase/src/main/resources/globalMessages_de.properties deleted file mode 100644 index 0dc66efa8..000000000 --- a/trunk/apps/showcase/src/main/resources/globalMessages_de.properties +++ /dev/null @@ -1,7 +0,0 @@ -save=Speichern - -item.edit={0} bearbeiten -item.create={0} neu anlegen -item.list={0}-Liste - -token.transfer.time=Die \u00dcberweisung wurde am {0,date,HH:mm:ss MM-dd-yyyy} durchgef\u00fchrt diff --git a/trunk/apps/showcase/src/main/resources/log4j.properties b/trunk/apps/showcase/src/main/resources/log4j.properties deleted file mode 100644 index 226f3de08..000000000 --- a/trunk/apps/showcase/src/main/resources/log4j.properties +++ /dev/null @@ -1,31 +0,0 @@ -# -# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging) -# -# The five logging levels used by Log are (in order): -# -# 1. DEBUG (the least serious) -# 2. INFO -# 3. WARN -# 4. ERROR -# 5. FATAL (the most serious) - - -# Set root logger level to WARN and append to stdout -log4j.rootLogger=WARN, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout - -# Pattern to output the caller's file name and line number. -log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n - -# Print only messages of level ERROR or above in the package noModule. -log4j.logger.noModule=FATAL - -# OpenSymphony Stuff -log4j.logger.com.opensymphony=INFO -log4j.logger.org.apache.struts2=DEBUG - -# Spring Stuff -log4j.logger.org.springframework=INFO - diff --git a/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl b/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl deleted file mode 100644 index 544f44e60..000000000 --- a/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl +++ /dev/null @@ -1,6 +0,0 @@ -

    -

    -Freemarker Custom Template - -parameter 'paramName' - ${parameters.paramName} -

    -
    diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/DateAction.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/DateAction.properties deleted file mode 100644 index d49c743a5..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/DateAction.properties +++ /dev/null @@ -1 +0,0 @@ -struts.date.format=yyyy/MM/dd hh:mm:ss \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/LotsOfRichtexteditorAction-lotsOfRichtexteditorSubmit-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/LotsOfRichtexteditorAction-lotsOfRichtexteditorSubmit-validation.xml deleted file mode 100644 index 8bf17c7c1..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/LotsOfRichtexteditorAction-lotsOfRichtexteditorSubmit-validation.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Description1 Is Required !!! - - - - - - Description2 Is Required !!! - - - - - - Description3 Is Required !!! - - - - - - Description4 Is Required !!! - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/UITagExample-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/UITagExample-conversion.properties deleted file mode 100644 index 2415dcf3c..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/UITagExample-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -Element_friends = java.lang.String diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction-conversion.properties deleted file mode 100644 index 21d3eda97..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -Element_selectedSkills=java.lang.String diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction-validation.xml deleted file mode 100644 index c49959888..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction-validation.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - true - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction.properties deleted file mode 100644 index e2e548b3c..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction.properties +++ /dev/null @@ -1,9 +0,0 @@ -employee=Employee -employee.firstName=First Name -employee.lastName=Last Name -employee.description=Description - -employee.id.required=Id is required -employee.lastName.required=Last Name is required -employee.birthDate.required=Birthdate is required -employee.backtolist=Back to Employee List diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction_de.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction_de.properties deleted file mode 100644 index ca594de4d..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/EmployeeAction_de.properties +++ /dev/null @@ -1,9 +0,0 @@ -employee=Mitarbeiter -employee.firstName=Vorname -employee.lastName=Nachname -employee.description=Beschreibung - -employee.id.required=ID muß angegeben werden -employee.lastName.required=Nachname wird benötigt -employee.birthDate.required=Geburtsdatum wird benötigt -employee.backtolist=Zurück zur Mitarbeiterliste diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction-validation.xml deleted file mode 100644 index 486e79f61..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction-validation.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - true - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction.properties deleted file mode 100644 index 27b7c81df..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction.properties +++ /dev/null @@ -1,6 +0,0 @@ -skill=Skill -skill.name=Name -skill.description=Description - -skill.name.required=Name is required -skill.backtolist=Back to Skill List diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction_de.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction_de.properties deleted file mode 100644 index 7c7156f71..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/action/SkillAction_de.properties +++ /dev/null @@ -1,6 +0,0 @@ -skill=Kenntnis -skill.name=Name -skill.description=Beschreibung - -skill.name.required=Name muss angegeben werden -skill.backtolist=Zurück zur Kenntnis Liste diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml deleted file mode 100644 index b80e7d54a..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - Name is required - - - - - Age is required - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/ChatLoginAction-chatLogin-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/ChatLoginAction-chatLogin-validation.xml deleted file mode 100644 index d4ab29906..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/ChatLoginAction-chatLogin-validation.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - true - Name is required - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/ChatMessage-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/ChatMessage-conversion.properties deleted file mode 100644 index 8869d38e6..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/ChatMessage-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -creationDate=org.apache.struts2.showcase.chat.DateConverter diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/CrudRoomAction-createRoom-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/CrudRoomAction-createRoom-validation.xml deleted file mode 100644 index bf8977c3b..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/CrudRoomAction-createRoom-validation.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - true - Room name is required - - - - - true - Room description is required - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/Room-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/Room-conversion.properties deleted file mode 100644 index 8869d38e6..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/Room-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -creationDate=org.apache.struts2.showcase.chat.DateConverter diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/SendMessageToRoomAction-sendMessageToRoom-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/SendMessageToRoomAction-sendMessageToRoom-validation.xml deleted file mode 100644 index b4197a443..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/chat/SendMessageToRoomAction-sendMessageToRoom-validation.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - true - Message is required - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/conversion/PersonAction-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/conversion/PersonAction-conversion.properties deleted file mode 100644 index 12f602f16..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/conversion/PersonAction-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -Element_persons=org.apache.struts2.showcase.conversion.Person diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/CreatePerson-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/CreatePerson-validation.xml deleted file mode 100644 index 6d19ebdf6..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/CreatePerson-validation.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/EditPerson-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/EditPerson-conversion.properties deleted file mode 100644 index 00b2a0365..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/EditPerson-conversion.properties +++ /dev/null @@ -1,3 +0,0 @@ -KeyProperty_persons=id -Element_persons=org.apache.struts2.showcase.person.Person -CreateIfNull_persons=true diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/Person-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/Person-validation.xml deleted file mode 100644 index da2c81f0c..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/person/Person-validation.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - You must enter a first name. - - - - - You must enter a last name - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo-validation.xml deleted file mode 100644 index 55f9577b2..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo-validation.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - true - Value must not be empty - - - - - - - Count must be an integer - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-conversion.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-conversion.properties deleted file mode 100644 index 2f970dc18..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-conversion.properties +++ /dev/null @@ -1 +0,0 @@ -dateValidatorField=java.util.Date \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xml deleted file mode 100644 index 215a7c9ac..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - true - - - - - - true - - - - - - 1 - 10 - - - - - - 01/01/1990 - 01/01/2000 - - - - - - - - - - - - - - - - 4 - 2 - true - - - - - - .*\.txt - - - - - - (fieldExpressionValidatorField == requiredValidatorField) - - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml deleted file mode 100644 index 97250cf93..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - true - - - - - - 1 - 10 - - - - - - 01/01/1990 - 01/01/2000 - - - - - - - - - - - - - - - - 4 - 2 - true - - - - - - .*\.txt - - - - - - (fieldExpressionValidatorField == requiredValidatorField) - - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.properties b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.properties deleted file mode 100644 index 14f04121a..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.properties +++ /dev/null @@ -1 +0,0 @@ -i18n.requiredstring=Test String for required Strings... diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml deleted file mode 100644 index cba25b09e..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation.xml deleted file mode 100644 index dd716fade..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - You must enter a name - - - - - 13 - 19 - Only people ages 13 to 19 may take this quiz - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/SubmitApplication-submitApplication-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/SubmitApplication-submitApplication-validation.xml deleted file mode 100644 index 0dbb123f9..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/SubmitApplication-submitApplication-validation.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - You must provide a name - - - - - You must provide your age - - - 18 - 50 - Your age must be between 18 and 50 - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/User-userContext-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/User-userContext-validation.xml deleted file mode 100644 index 508eb6590..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/User-userContext-validation.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - Name Required - - - - - 1 - 100 - Age Required (1-100) - - - - - Birthday Required - - - - - diff --git a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml b/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml deleted file mode 100644 index a8af8f005..000000000 --- a/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - userContext - true - User: - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-actionchaining.xml b/trunk/apps/showcase/src/main/resources/struts-actionchaining.xml deleted file mode 100644 index f0818a0b4..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-actionchaining.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - actionChain2 - - - actionChain3 - - - /actionchaining/actionChainingResult.jsp - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-ajax.xml b/trunk/apps/showcase/src/main/resources/struts-ajax.xml deleted file mode 100644 index 5cbc9512c..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-ajax.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - /ajax/AjaxResult.jsp - - - - /ajax/AjaxResult2.js - - - - /ajax/AjaxResult3.jsp - - - - /ajax/remoteforms/test2.jsp - - - - /ajax/remoteforms/test3.jsp - - - - /ajax/testjs.jsp - - - - /ajax/tree/tree.jsp - - - - /ajax/tree/getCategory.jsp - - - - /ajax/tree/toggle.jsp - - - - /ajax/tabbedpanel/example4.ftl - - - - /ajax/tabbedpanel/example5.jsp - /ajax/tabbedpanel/example5Ok.jsp - - - - - - - /ajax/tabbedpanel/nodecorate/panel1.ftl - - - /ajax/tabbedpanel/nodecorate/panel2.ftl - - - /ajax/tabbedpanel/nodecorate/panel3.ftl - - - /ajax/tabbedpanel/nodecorate/panel2Submit.ftl - - - /ajax/tabbedpanel/nodecorate/panel3Submit.ftl - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-chat.xml b/trunk/apps/showcase/src/main/resources/struts-chat.xml deleted file mode 100644 index 173d3bcee..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-chat.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - input,back,cancel,browse - - - input,back,cancel,browse - - - - - - - /chat/chatLogin.ftl - - - - - /chat/roomSelection.ftl - - - - - /chat/showRooms.action - /chat/chatLogin.ftl - - - - - /chat/main.action - - - - - /chat/roomSelection.ftl - - - - - /chat/showRoom.ftl - - - - - /chat/showRooms.action - - - - - - - - - - - - - - - - - - - - - - - input,back,cancel,browse - - - input,back,cancel,browse - - - - - - - - - /chat/usersAvailable.ftl - - - - - /chat/roomsAvailable.ftl - - - - - /chat/createRoom.ftl - /chat/createRoom.ftl - - - - - /chat/messagesAvailableInRoom.ftl - /chat/messagesAvailableInRoom.ftl - - - - - /chat/sendMessageToRoomResult.ftl - /chat/sendMessageToRoomResult.ftl - - - - - /chat/usersAvailableInRoom.ftl - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-continuations.xml b/trunk/apps/showcase/src/main/resources/struts-continuations.xml deleted file mode 100644 index dc806e3f8..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-continuations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - guess.ftl - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-conversion.xml b/trunk/apps/showcase/src/main/resources/struts-conversion.xml deleted file mode 100644 index c3259e6a9..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-conversion.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - enterPersonInfo.jsp - - - showPersonInfo.jsp - enterPersonInfo.jsp - - - /conversion/enterPersonInfo.jsp - - - /conversion/PersonAction.java.txt - - - /conversion/Person.java.txt - - - - - - enterAddressInfo.jsp - - - showAddressInfo.jsp - enterAddressInfo.jsp - - - /conversion/enterAddressInfo.jsp - - - /conversion/AddressAction.java.txt - - - /conversion/Address.java.txt - - - - - - enterOperations.jsp - - - showOperations.jsp - enterOperations.jsp - - - /conversion/enterOperations.jsp - - - /conversion/OperationsEnum.java.txt - - - /conversion/OperationsEnumAction.java.txt - - - /conversion/EnumTypeConverter.java.txt - - - /conversion/OperationsEnumActionConversion.txt - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-filedownload.xml b/trunk/apps/showcase/src/main/resources/struts-filedownload.xml deleted file mode 100644 index c64a643ce..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-filedownload.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - image/jpeg - imageStream - filename="logo.png" - 4096 - - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-fileupload.xml b/trunk/apps/showcase/src/main/resources/struts-fileupload.xml deleted file mode 100644 index b416fac2e..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-fileupload.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - upload.jsp - - - - upload-success.jsp - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-freemarker.xml b/trunk/apps/showcase/src/main/resources/struts-freemarker.xml deleted file mode 100644 index af352a4ca..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-freemarker.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - /freemarker/customFreemarkerManagerUsage.ftl - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-hangman.xml b/trunk/apps/showcase/src/main/resources/struts-hangman.xml deleted file mode 100644 index b12ddcee4..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-hangman.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - /hangman/hangmanMenu.ftl - - - /hangman/hangmanAjax.ftl - - - /hangman/hangmanNonAjax.ftl - - - /hangman/test.ftl - - - /hangman/blank.ftl - - - /hangman/hangmanNonAjax.ftl - - - - - - - - /hangman/blank.ftl - - - /hangman/updateVocabCharacters.ftl - - - /hangman/updateCharacterAvailable.ftl - - - /hangman/updateScaffold.ftl - - - /hangman/updateGuessLeft.ftl - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-integration.xml b/trunk/apps/showcase/src/main/resources/struts-integration.xml deleted file mode 100644 index 66f28d2d7..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-integration.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - org.apache.struts2.showcase.integration.GangsterForm - gangsterForm - - - /org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml - - - - - - - - - - - - - - - - - - - org.apache.struts2.showcase.integration.EditGangsterAction - modelDriven.jsp - - - - - org.apache.struts2.showcase.integration.SaveGangsterAction - true - modelDriven.jsp - modelDrivenResult.jsp - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/resources/struts-jsf.xml b/trunk/apps/showcase/src/main/resources/struts-jsf.xml deleted file mode 100644 index 2ef59b500..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-jsf.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - list.action - list.action - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-model-driven.xml b/trunk/apps/showcase/src/main/resources/struts-model-driven.xml deleted file mode 100644 index bf3d57e4e..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-model-driven.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - modelDriven.jsp - - - - - modelDrivenResult.jsp - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/resources/struts-person.xml b/trunk/apps/showcase/src/main/resources/struts-person.xml deleted file mode 100644 index 88462257d..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-person.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - listPeople.ftl - - - - listPeople.action - newPerson.ftl - - - - editPeople.jsp - - - - editPeople.jsp - listPeople.action - - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-tags-non-ui.xml b/trunk/apps/showcase/src/main/resources/struts-tags-non-ui.xml deleted file mode 100644 index 0200b7b8f..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-tags-non-ui.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - /tags/non-ui/actionTag/showActionTagDemo.jsp - - - /tags/non-ui/actionTag/includedPage.jsp - - - /tags/non-ui/actionTag/includedPage2.jsp - - - /tags/non-ui/actionTag/includedPage3.jsp - - - /tags/non-ui/actionTag/showActionTagDemo.jsp - - - - - - - - - - /tags/non-ui/iteratorTag/showIteratorGeneratorTagDemo.jsp - - - /tags/non-ui/iteratorTag/showIteratorGeneratorTagDemo.jsp - /tags/non-ui/iteratorTag/iteratorGeneratorTagDemoResult.jsp - - - - - - - - - - /tags/non-ui/iteratorTag/showAppendIteratorTagDemo.jsp - - - /tag/non-ui/iteratorTag/showAppendIteratorTagDemo.jsp - /tags/non-ui/iteratorTag/appendIteratorTagDemoResult.jsp - - - - - - - - - - /tags/non-ui/iteratorTag/showMergeIteratorTagDemo.jsp - - - /tags/non-ui/iteratorTag/showMergeIteratorTagDemo.jsp - /tags/non-ui/iteratorTag/mergeIteratorTagDemoResult.jsp - - - - - - - - - /tags/non-ui/iteratorTag/subsetIteratorTagDemo.jsp - - - /tags/non-ui/iteratorTag/subsetIteratorTagDemo.jsp - /tags/non-ui/iteratorTag/subsetIteratorTagDemoResult.jsp - - - - - - - - - /tags/non-ui/actionPrefix/actionPrefixExample.ftl - - - /tags/non-ui/actionPrefix/normalSubmit.ftl - - - /tags/non-ui/actionPrefix/methodPrefix.ftl - - - /tags/non-ui/actionPrefix/actionPrefix.ftl - - - /tags/non-ui/actionPrefix/redirectPrefix.ftl - - - /tags/non-ui/actionPrefix/redirectActionPrefix.ftl - - - /tags/non-ui/actionPrefix/actionPrefixExample.ftl - - - - - - - - - /tags/non-ui/ifTag/testIf.jsp - - - /tags/non-ui/ifTag/testIf.ftl - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-tags-ui.xml b/trunk/apps/showcase/src/main/resources/struts-tags-ui.xml deleted file mode 100644 index 527470650..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-tags-ui.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - example.jsp - example.jsp - - - exampleSubmited.jsp - example.jsp - - - example.vm - example.vm - - - exampleSubmited.vm - example.vm - - - lotsOfOptiontransferselect.jsp - - - lotsOfOptiontransferselect.jsp - lotsOfOptiontransferselectSubmit.jsp - - - - - - /tags/ui/treeExampleDynamic.jsp - - - - - - - /tags/ui/componentTagExample.jsp - - - - - - - - - - /tags/ui/staticTreeSelect.jsp - - - /tags/ui/dynamicTreeSelect.jsp - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-tags.xml b/trunk/apps/showcase/src/main/resources/struts-tags.xml deleted file mode 100644 index 4b5995241..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-tags.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-token.xml b/trunk/apps/showcase/src/main/resources/struts-token.xml deleted file mode 100644 index a06098c37..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-token.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - example1.jsp - - - - - - doublePost.jsp - transferDone.jsp - - - - - - - example2.jsp - - - - - - doublePost.jsp - transferDone.jsp - - - - - - - example3.jsp - - - - - - doublePost.jsp - transferDone.jsp - - - - - - - example4.ftl - - - - - - doublePost.jsp - transferDone.jsp - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-validation.xml b/trunk/apps/showcase/src/main/resources/struts-validation.xml deleted file mode 100755 index 3cedcf4aa..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-validation.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - quiz-basic.jsp - quiz-success.jsp - - - - quiz-client.jsp - quiz-success.jsp - - - - quiz-client-css.jsp - quiz-success.jsp - - - - quiz-ajax.jsp - quiz-success.jsp - - - - - - - - index.jsp - - - - - - - - - /validation/fieldValidatorsExample.jsp - - - - /validation/fieldValidatorsExample.jsp - /validation/successFieldValidatorsExample.jsp - - - - - - - - - - /validation/nonFieldValidatorsExample.jsp - - - - /validation/nonFieldValidatorsExample.jsp - /validation/successNonFieldValidatorsExample.jsp - - - - - - - - - - /validation/visitorValidatorsExample.jsp - - - - /validation/visitorValidatorsExample.jsp - /validation/successVisitorValidatorsExample.jsp - - - - - - - - - - /validation/clientSideValidationExample.jsp - - - - /validation/clientSideValidationExample.jsp - /validation/successClientSideValidationExample.jsp - - - - - - - - - STORE - - - /validation/resubmitApplication.action - /validation/applicationOk.action - - - - RETRIEVE - - /validation/storeErrorsAcrossRequestExample.jsp - - - - RETRIEVE - - /validation/storeErrorsAcrossRequestOk.jsp - - - /validation/storeErrorsAcrossRequestCancel.jsp - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts-wait.xml b/trunk/apps/showcase/src/main/resources/struts-wait.xml deleted file mode 100644 index e39863416..000000000 --- a/trunk/apps/showcase/src/main/resources/struts-wait.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - wait.jsp - complete.jsp - - - - - - 2000 - - wait.jsp - complete.jsp - - - - - - 3000 - 1000 - - wait.jsp - complete.jsp - - - - - diff --git a/trunk/apps/showcase/src/main/resources/struts.properties b/trunk/apps/showcase/src/main/resources/struts.properties deleted file mode 100644 index 6352045a4..000000000 --- a/trunk/apps/showcase/src/main/resources/struts.properties +++ /dev/null @@ -1,11 +0,0 @@ -struts.i18n.reload=true -struts.devMode = true -struts.configuration.xml.reload=true -struts.continuations.package = org.apache.struts2.showcase -struts.objectFactory = spring -struts.custom.i18n.resources=globalMessages -#struts.action.extension=jspa -struts.url.http.port = 8080 -struts.freemarker.manager.classname=customFreemarkerManager -struts.serve.static=true -struts.serve.static.browserCache=false diff --git a/trunk/apps/showcase/src/main/resources/struts.xml b/trunk/apps/showcase/src/main/resources/struts.xml deleted file mode 100644 index 2f316fa8d..000000000 --- a/trunk/apps/showcase/src/main/resources/struts.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - showcase.jsp - - - - viewSource.jsp - - - - /date.jsp - - - - - - - - - /empmanager/listSkills.jsp - - - - /empmanager/editSkill.jsp - - - - - /empmanager/editSkill.jsp - edit.action?skillName=${currentSkill.name} - - - /empmanager/editSkill.jsp - edit.action?skillName=${currentSkill.name} - - - - - - - - /empmanager/listEmployees.jsp - - - - {1} - /empmanager/editEmployee.jsp - execute - - - /empmanager/editEmployee.jsp - edit-${currentEmployee.empId}.action - - - /empmanager/editEmployee.jsp - edit-${currentEmployee.empId}.action - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/applicationContext.xml b/trunk/apps/showcase/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index cec8c6871..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A popular programming language that is used to create the Struts framework - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators.xml b/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators.xml deleted file mode 100644 index 31936b952..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - /debug.jsp - /styles/* - /scripts/* - /images/* - /dojo/* - /struts/* - /ajax/AjaxResult* - /AjaxTest.action - /ajax/remoteforms/AjaxRemoteForm.action - /tags/ui/ajax/* - /chat/ajax/* - /hangman/ajax/* - /nodecorate/* - - - - /* - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp b/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp deleted file mode 100644 index 978b77380..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp +++ /dev/null @@ -1,119 +0,0 @@ - - -<% - response.setHeader("Pragma", "no-cache"); - response.setHeader("Cache-Control", "no-cache"); - response.setDateHeader("Expires", 0); - - // Calculate the view sources url - String sourceUrl = request.getContextPath()+"/viewSource.action"; - com.opensymphony.xwork2.ActionInvocation inv = com.opensymphony.xwork2.ActionContext.getContext().getActionInvocation(); - org.apache.struts2.dispatcher.mapper.ActionMapping mapping = org.apache.struts2.ServletActionContext.getActionMapping(); - if (inv != null) { - sourceUrl += "?config="+inv.getProxy().getConfig().getLocation().getURI()+":"+inv.getProxy().getConfig().getLocation().getLineNumber(); - sourceUrl += "&className="+inv.getProxy().getConfig().getClassName(); - - if (inv.getResult() != null && inv.getResult() instanceof org.apache.struts2.dispatcher.StrutsResultSupport) { - sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation(); - } - } else { - sourceUrl += "?page="+request.getServletPath(); - } -%> -<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> -<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> -<%@taglib prefix="s" uri="/struts-tags" %> - - - - <decorator:title default="Struts Showcase"/> - - - - - - - - - - - - - - -
    -
    - -
    - - - -
    -

    - View Sources -

    -
    - -

    - -

    - - - diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/dwr.xml b/trunk/apps/showcase/src/main/webapp/WEB-INF/dwr.xml deleted file mode 100644 index 99869bf4a..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/dwr.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - ); - ]]> - - - diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh-decorator.tld b/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh-decorator.tld deleted file mode 100644 index 18f525c6e..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh-decorator.tld +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - 1.0 - 1.1 - SiteMesh Decorator Tags - sitemesh-decorator - - - head - com.opensymphony.module.sitemesh.taglib.decorator.HeadTag - JSP - - - - body - com.opensymphony.module.sitemesh.taglib.decorator.BodyTag - JSP - - - - title - com.opensymphony.module.sitemesh.taglib.decorator.TitleTag - JSP - - default - false - true - - - - - getProperty - com.opensymphony.module.sitemesh.taglib.decorator.PropertyTag - JSP - - property - true - true - - - default - false - true - - - writeEntireProperty - false - true - - - - - usePage - com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag - com.opensymphony.module.sitemesh.taglib.decorator.UsePageTEI - JSP - - id - true - false - - - - - useHtmlPage - com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag - com.opensymphony.module.sitemesh.taglib.decorator.UseHTMLPageTEI - JSP - - id - true - false - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh-page.tld b/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh-page.tld deleted file mode 100644 index 797ec5d61..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh-page.tld +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - 1.0 - 1.1 - SiteMesh Page Tags - sitemesh-page - - - applyDecorator - com.opensymphony.module.sitemesh.taglib.page.ApplyDecoratorTag - JSP - - name - false - true - - - page - false - true - - - title - false - true - - - id - false - true - - - contentType - false - true - - - encoding - false - true - - - - - - apply-decorator - com.opensymphony.module.sitemesh.taglib.page.ApplyDecoratorTag - JSP - - name - false - true - - - page - false - true - - - title - false - true - - - id - false - true - - - contentType - false - true - - - encoding - false - true - - - - - param - com.opensymphony.module.sitemesh.taglib.page.ParamTag - JSP - - name - false - true - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh.xml b/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh.xml deleted file mode 100644 index cfd1b3449..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/sitemesh.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/validation.xml b/trunk/apps/showcase/src/main/webapp/WEB-INF/validation.xml deleted file mode 100644 index 284975364..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/validation.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - -
    - - - -
    - -
    - -
    diff --git a/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml b/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 6278bb6e8..000000000 --- a/trunk/apps/showcase/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - Struts Showcase Application - - - - struts-cleanup - org.apache.struts2.dispatcher.ActionContextCleanUp - - - - struts - org.apache.struts2.dispatcher.FilterDispatcher - - - - sitemesh - com.opensymphony.module.sitemesh.filter.PageFilter - - - - - - struts-cleanup - /* - - - - sitemesh - /* - - - - struts - /* - - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.apache.myfaces.webapp.StartupServletContextListener - - - - - - - org.apache.struts2.showcase.chat.ChatSessionListener - - - - - - - dwr - uk.ltd.getahead.dwr.DWRServlet - - debug - true - - - - - - faces - javax.faces.webapp.FacesServlet - 1 - - - - - faces - *.action - - - - dwr - /dwr/* - - - - - - - - - - index.jsp - default.jsp - index.html - - - diff --git a/trunk/apps/showcase/src/main/webapp/actionchaining/actionChainingResult.jsp b/trunk/apps/showcase/src/main/webapp/actionchaining/actionChainingResult.jsp deleted file mode 100644 index b16511308..000000000 --- a/trunk/apps/showcase/src/main/webapp/actionchaining/actionChainingResult.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Action Chaining Result - - -

    Action Chaining Result:

    -
    -
    -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult.jsp b/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult.jsp deleted file mode 100644 index b93c00f92..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult.jsp +++ /dev/null @@ -1,10 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -<% - request.setAttribute("decorator", "none"); - response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 - response.setHeader("Pragma","no-cache"); //HTTP 1.0 - response.setDateHeader ("Expires", 0); //prevents caching at the proxy server -%> - -Result: @ diff --git a/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult2.js b/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult2.js deleted file mode 100644 index 537c3905d..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult2.js +++ /dev/null @@ -1,2 +0,0 @@ -alert('This JavaScript currently being evaluated is the result...'); -alert('... of an action executed on the server!'); diff --git a/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult3.jsp b/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult3.jsp deleted file mode 100644 index 45cb2b0ce..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/AjaxResult3.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -<% - request.setAttribute("decorator", "none"); - response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 - response.setHeader("Pragma","no-cache"); //HTTP 1.0 - response.setDateHeader ("Expires", 0); //prevents caching at the proxy server -%> - -Result: @ - -The value you entered was:
    diff --git a/trunk/apps/showcase/src/main/webapp/ajax/commonInclude.jsp b/trunk/apps/showcase/src/main/webapp/ajax/commonInclude.jsp deleted file mode 100644 index f004910a3..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/commonInclude.jsp +++ /dev/null @@ -1,4 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/footer.jsp b/trunk/apps/showcase/src/main/webapp/ajax/footer.jsp deleted file mode 100644 index 482348732..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/footer.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - -
    - - - - -Back To AJAX Examples  -Back To Showcase diff --git a/trunk/apps/showcase/src/main/webapp/ajax/index.jsp b/trunk/apps/showcase/src/main/webapp/ajax/index.jsp deleted file mode 100644 index 75a5fce92..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/index.jsp +++ /dev/null @@ -1,20 +0,0 @@ - -AJAX Examples - - - -

    AJAX Example

    - -Note: these examples have only been tested under FireFox 1.5 and IE 6. - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example1.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example1.jsp deleted file mode 100644 index fe9b1d1e9..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example1.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - - - Initial Content - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example2.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example2.jsp deleted file mode 100644 index 9fbb89488..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example2.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - Initial Content - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example3.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example3.jsp deleted file mode 100644 index d90cb5178..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example3.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - -Initial Content - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example4.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example4.jsp deleted file mode 100644 index f8db61e46..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example4.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - -loading now - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example5.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example5.jsp deleted file mode 100644 index 6fa03633e..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example5.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - -loading now - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example6.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example6.jsp deleted file mode 100644 index 3088742bc..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example6.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - -loading now - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example7.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example7.jsp deleted file mode 100644 index bff2bdfe7..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example7.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - -loading now - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example8.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example8.jsp deleted file mode 100644 index 600027fcb..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example8.jsp +++ /dev/null @@ -1,27 +0,0 @@ - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - - - Initial Content ... should not change - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/index.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotediv/index.jsp deleted file mode 100644 index 7bf1ec36c..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotediv/index.jsp +++ /dev/null @@ -1,56 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - AJAX-based remote DIV tag - <%@ include file="/ajax/commonInclude.jsp" %> - - - - -

    Examples

    - -

    -

      -
    1. - A simple DIV that refreshes only once -
    2. - -
    3. - A simple DIV that updates every 2 seconds -
    4. - -
    5. - A simple DIV that obtains the update freq (3 secs) from the value - stack/action -
    6. - -
    7. - A simple DIV that updates every 5 seconds with loading text and reloading text -
    8. - -
    9. - A simple DIV's that cannot contact the server -
    10. - -
    11. - A simple DIV's that cannot contact the server and displays the transport error - message -
    12. - -
    13. - A div that calls the server, and JS in the resulting page is executed -
    14. - -
    15. - A div that will not update itself (updateFreq=0 and delay=0) -
    16. - -
    - - -

    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/index.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/index.jsp deleted file mode 100644 index 9b96d0f10..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/index.jsp +++ /dev/null @@ -1,111 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - - - - - -Remote form replacing another div:
    - -
    initial content
    - - - - - - - - - -Remote form replacing the forms content:
    - - - - - - - - -Remote form evaluating suplied JS on completion:
    - - - - - - - - -Remote form replacing the forms content after confirming results:
    - - - - - - - - -Remote form replacing the forms content after running a function:
    - - - - - - - - -A form with no remote submit (so should not be ajaxified):
    - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test1.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test1.jsp deleted file mode 100644 index e3c06ce9e..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test1.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - - - - - Test 1 Form - - - -test2 - before - -test3 - before - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test2.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test2.jsp deleted file mode 100644 index 9eecf5099..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test2.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Test 2 form - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test3.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test3.jsp deleted file mode 100644 index 9862ad25b..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remoteforms/test3.jsp +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -Test 3 Page - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp b/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp deleted file mode 100644 index 2e06e8666..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp +++ /dev/null @@ -1,112 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Examples - - - - - -One Component: -Initial Content - -

    - -Two Component: -Initial Content -

    - -Three Component: -Initial Content -

    - -Fourth Component: -Initial Content -

    - - - - - -Remote link 1 updating "One Component" and "Two Component"
    - -Update -

    - -Remote link 2 updating "Two Component" and "Three Component"
    -Update -

    - -Remote DIV that is not connected to any remote links: -Initial Content -

    - -A Remote link that doesn't trigger any remote DIV updates
    - -Update - -

    - -A Remote link that will update "Fourth Component" -Update -

    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example1.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example1.jsp deleted file mode 100644 index 5769826b4..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example1.jsp +++ /dev/null @@ -1,113 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax examples - tabbled panel - - - "> - "> - " media="print"> - - - - - - - - - - - - - - - -
    - - - This is the first pane
    - -
    - -
    -
    - - This is the second panel - - - This is the three - -
    -
    - - - This is the left pane
    - -
    - -
    -
    - - - middle tab
    - -
    - -
    -
    - -
    -
    - - - - - - - - - - - Outer one
    - - Inner 1 - Inner 2 - Inner 3 - -
    - - Outer two
    - - Inner 21 - Inner 22 - Inner 23 - -
    - - Outer three
    - - Inner 31 - Inner 32 - Inner 33 - -
    -
    -
    - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example2.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example2.jsp deleted file mode 100644 index ec2d6f688..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example2.jsp +++ /dev/null @@ -1,52 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax examples - tabbled panel - - - "> - "> - " media="print"> - - - - - - - - - - -
    - - - This is the first pane
    - -
    - -
    -
    - - This is the second panel - - - This is the three - -
    -
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp deleted file mode 100644 index 55dedaa11..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp +++ /dev/null @@ -1,57 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax examples - tabbled panel - - - "> - "> - " media="print"> - - - - - - - - - - -
    - - - - This is the left pane
    - -
    - -
    -
    - - - middle tab
    - -
    - -
    -
    - -
    - -
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example4.ftl b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example4.ftl deleted file mode 100644 index c533d15d0..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example4.ftl +++ /dev/null @@ -1,18 +0,0 @@ - - - Example 4 - <@s.head theme="ajax" debug="false" /> - " /> - - - <@s.url id="panel1url" action="panel1" namespace="/nodecorate" includeContext="false" /> - <@s.url id="panel2url" action="panel2" namespace="/nodecorate" includeContext="false"/> - <@s.url id="panel3url" action="panel3" namespace="/nodecorate" includeContext="false"/> - <@s.tabbedPanel id="tabbedpanel" > - <@s.panel id="panel1" tabName="Panel1" remote="true" href="%{#panel1url}" theme="ajax" /> - <@s.panel id="panel2" tabName="Panel2" remote="true" href="%{#panel2url}" theme="ajax" /> - <@s.panel id="panel3" tabName="Panel3" remote="true" href="%{#panel3url}" theme="ajax" /> - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp deleted file mode 100644 index 770b353cd..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp deleted file mode 100644 index 5c3b801ee..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> - -

    OK

    -
    -
    - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/index.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/index.jsp deleted file mode 100644 index 7c501dfe7..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/index.jsp +++ /dev/null @@ -1,33 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Tabbed Panes - <%@ include file="/ajax/commonInclude.jsp" %> - - - - -

    Examples

    - -

    -

      -
    1. A local tabbed panel
    2. -
    3. A remote and local tabbed panel
    4. -
    5. Various remote and local tabbed panels (with enclosed tabbed pannels)
    6. -
    7. - - Only remove tabbed panel -
    8. -
    9. - - Remote form validation inside tabbed panel -
    10. -
    - - -

    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel1.ftl b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel1.ftl deleted file mode 100644 index 601c06058..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel1.ftl +++ /dev/null @@ -1,3 +0,0 @@ - -Hello,
    -Today is ${todayDate}, the time now is ${todayTime} diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel2.ftl b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel2.ftl deleted file mode 100644 index b027ee088..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel2.ftl +++ /dev/null @@ -1,7 +0,0 @@ - -
    -
    -<@s.form action="panel2Submit" namespace="/nodecorate" theme="ajax"> - <@s.textfield label="Name" name="name" theme="ajax" /> - <@s.submit theme="ajax" resultDivId="result" /> - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel2Submit.ftl b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel2Submit.ftl deleted file mode 100644 index 34e4e0d15..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel2Submit.ftl +++ /dev/null @@ -1,2 +0,0 @@ - -Hello, ${name} diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel3.ftl b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel3.ftl deleted file mode 100644 index 1d0a374b4..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel3.ftl +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - -<@s.form action="panel3Submit" namespace="/nodecorate" theme="ajax"> - <@s.select label="Gender" name="gender" list=r"%{#{'Male':'Male','Female':'Female'}}" theme="ajax" /> - <@s.submit theme="ajax" resultDivId="result" /> - - diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel3Submit.ftl b/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel3Submit.ftl deleted file mode 100644 index ee436e125..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/nodecorate/panel3Submit.ftl +++ /dev/null @@ -1,2 +0,0 @@ - -So, you are a ${gender} diff --git a/trunk/apps/showcase/src/main/webapp/ajax/testjs.jsp b/trunk/apps/showcase/src/main/webapp/ajax/testjs.jsp deleted file mode 100644 index 5223ef707..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/testjs.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<% - request.setAttribute("decorator", "none"); - response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 - response.setHeader("Pragma","no-cache"); //HTTP 1.0 - response.setDateHeader ("Expires", 0); //prevents caching at the proxy server -%> - - -Show me some text also - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tree/getCategory.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tree/getCategory.jsp deleted file mode 100644 index 1cdf2801e..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tree/getCategory.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@include file="partialChunkHeader.jsp"%> -
      - -
    • - - + - - -
    • - - - - - - - - -
      -
    \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tree/partialChunkHeader.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tree/partialChunkHeader.jsp deleted file mode 100644 index 01113d688..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tree/partialChunkHeader.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<% - request.setAttribute("decorator", "none"); - response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 - response.setHeader("Pragma","no-cache"); //HTTP 1.0 - response.setDateHeader ("Expires", 0); //prevents caching at the proxy server -%> diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tree/toggle.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tree/toggle.jsp deleted file mode 100644 index 35010bb5e..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tree/toggle.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@include file="partialChunkHeader.jsp"%> -<% - response.setContentType("text/javascript"); -%> -dojo.event.topic.publish("children_"); -var d = document.getElementById("children_"); -if (d.style.display != "none") { - d.style.display = "none"; -} else { - d.style.display = ""; -} diff --git a/trunk/apps/showcase/src/main/webapp/ajax/tree/tree.jsp b/trunk/apps/showcase/src/main/webapp/ajax/tree/tree.jsp deleted file mode 100644 index 6d8e18c34..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/tree/tree.jsp +++ /dev/null @@ -1,13 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Tree - - - - - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/ajax/widgets/index.jsp b/trunk/apps/showcase/src/main/webapp/ajax/widgets/index.jsp deleted file mode 100644 index b9f6afeee..000000000 --- a/trunk/apps/showcase/src/main/webapp/ajax/widgets/index.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Ajax Widgets - - - - -NOTES: -
      -
    • Make sure that there is a 'value' attribute in the textarea with the content for the editor
    • -
    • This is experimental
    • -
    - -Default Editor configuration:
    - - - - -
    - -Configured Editor configuration:
    - - - textGroup;|;justifyGroup;|;listGroup;|;indentGroup - - - -
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/chat/chatLogin.ftl b/trunk/apps/showcase/src/main/webapp/chat/chatLogin.ftl deleted file mode 100644 index 1dfa3ca8c..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/chatLogin.ftl +++ /dev/null @@ -1,16 +0,0 @@ - - - - Showcase - Chat - Login - <@s.head theme="ajax" /> - - - <@s.actionerror /> - <@s.actionmessage /> - <@s.fielderror /> - <@s.form action="login" namespace="/chat" method="POST"> - <@s.textfield name="name" label="Name" required="true" /> - <@s.submit/> - - - diff --git a/trunk/apps/showcase/src/main/webapp/chat/createRoom.ftl b/trunk/apps/showcase/src/main/webapp/chat/createRoom.ftl deleted file mode 100644 index fbe71cc91..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/createRoom.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<@s.actionerror /> -<@s.fielderror /> diff --git a/trunk/apps/showcase/src/main/webapp/chat/index.jsp b/trunk/apps/showcase/src/main/webapp/chat/index.jsp deleted file mode 100644 index b58d7a302..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/index.jsp +++ /dev/null @@ -1,3 +0,0 @@ - -<% response.sendRedirect("main.action"); %> - diff --git a/trunk/apps/showcase/src/main/webapp/chat/messagesAvailableInRoom.ftl b/trunk/apps/showcase/src/main/webapp/chat/messagesAvailableInRoom.ftl deleted file mode 100644 index 2550dcd2d..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/messagesAvailableInRoom.ftl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - -<@s.iterator id="message" value="%{messagesAvailableInRoom}" status="stat"> - - <#if stat.odd> - - <#if stat.odd> - - <#if stat.odd> - - - -
    SenderDateMessage
    - <#else> - - - <@s.property value="%{#message.creator.name}" /> - - <#else> - - - <@s.property value="%{#message.creationDate}" /> - - <#else> - - - <@s.property value="%{#message.message}" /> -
    diff --git a/trunk/apps/showcase/src/main/webapp/chat/roomSelection.ftl b/trunk/apps/showcase/src/main/webapp/chat/roomSelection.ftl deleted file mode 100644 index 2af660821..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/roomSelection.ftl +++ /dev/null @@ -1,163 +0,0 @@ - - - - - Showcase - Chat - Room Selection - <@s.head theme="ajax" /> - - - -
    - - -
    -
    -

    Operations

    - <@s.url id="url" action="logout" namespace="/chat" /> -
      -
    • <@s.a href="%{#url}">Logout
    • -
    -
    - <#if (actionErrors?size gt 0)> -
    -

    Action Errors

    - <@s.actionerrors /> -
    - -
    -

    Users Available In Chat

    - <@s.div id="usersAvailable" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" - theme="ajax" href="/chat/ajax/usersAvailable.action" - class="box"> - Initial Loading Users ... - -
    -
    - - -
    -
    -

    Rooms Available In Chat

    - <@s.div id="roomsAvailable" listenTopics="topicRoomCreated" - delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" - theme="ajax" href="/chat/ajax/roomsAvailable.action" > - Initial Loading Rooms ... - -
    - -
    -

    Create Room In Chat

    -
    - <@s.form id="createRoomId" action="createRoom" namespace="/chat/ajax" method="POST" theme="ajax"> - <@s.textfield label="Room Name" required="true" name="name" /> - <@s.textarea theme="xhtml" label="Room Description" required="true" name="Description" /> - <@s.submit value="%{'Create Room'}" resultDivId="createRoomResult" notifyTopics="topicRoomCreated" theme="ajax" align="left" /> - -
    -
    - -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/chat/roomsAvailable.ftl b/trunk/apps/showcase/src/main/webapp/chat/roomsAvailable.ftl deleted file mode 100644 index 1d343c00e..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/roomsAvailable.ftl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - -<@s.iterator id="room" value="%{availableRooms}" status="stat"> - - <#if stat.isOdd()> - - <#if stat.odd> - - <#if stat.odd> - - <#if stat.odd> - - - -
    OperationNameDescriptionDate Created
    - <#else> - - - <@s.url id="url" action="enterRoom" namespace="/chat"> - <@s.param name="roomName" value="%{#room.name}" /> - - <@s.a href="%{url}">Enter - - <#else> - - - <@s.property value="%{#room.name}" /> - - <#else> - - - <@s.property value="%{#room.description}" /> - - <#else> - - - <@s.property value="%{#room.creationDate}" /> -
    diff --git a/trunk/apps/showcase/src/main/webapp/chat/sendMessageToRoomResult.ftl b/trunk/apps/showcase/src/main/webapp/chat/sendMessageToRoomResult.ftl deleted file mode 100644 index c75d32bca..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/sendMessageToRoomResult.ftl +++ /dev/null @@ -1,2 +0,0 @@ - -<@s.fielderror /> diff --git a/trunk/apps/showcase/src/main/webapp/chat/showRoom.ftl b/trunk/apps/showcase/src/main/webapp/chat/showRoom.ftl deleted file mode 100644 index e04a404cd..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/showRoom.ftl +++ /dev/null @@ -1,160 +0,0 @@ - - - - Showcase - Chat - Show Room - <@s.head theme="ajax" /> - - - -
    -
    -
    -

    Operation

    - <@s.url id="url" action="exitRoom" namespace="/chat"> - <@s.param name="roomName" value="%{roomName}" /> - -
      -
    • <@s.a href="%{#url}">Exit Room
    • -
    -
    -
    -

    Users Available In Chat

    - <@s.div id="usersAvailable" href="/chat/ajax/usersAvailable.action" - theme="ajax" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"> - Initial Users Available ... - -
    -
    - -
    -
    -

    Messages Posted In Room [${roomName?default('')}]

    - <@s.url id="url" value="/chat/ajax/messagesAvailableInRoom.action" includeContext="false"> - <@s.param name="roomName" value="%{roomName}" /> - - <@s.div id="messagesInRoom" href="%{#url}" includeContext="false" - theme="ajax" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" - listenTopics="topicMessageSend"> - Initial Messages In Room ... - -
    - -
    -

    Send Messages

    - <@s.form id="sendMessageForm" action="sendMessageToRoom" namespace="/chat/ajax" method="POST" theme="ajax"> -
    - <@s.textarea label="Message"name="message" theme="xhtml" /> - <@s.hidden name="roomName" value="%{roomName}" /> - <@s.submit id="submit" theme="ajax" resultDivId="sendMessageResult" notifyTopics="topicMessageSend" value="%{'Send'}" /> - -
    -
    - - -
    -
    -

    Users Available In Room [${roomName?default('')}]

    - <@s.url id="url" value="/chat/ajax/usersAvailableInRoom.action" includeContext="false"> - <@s.param name="roomName" value="%{roomName}" /> - - <@s.div id="usersAvailableInRoom" href="%{#url}" includeContext="false" - theme="ajax" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"> - Initial Users Available In Room ... - -
    -
    - - -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/chat/usersAvailable.ftl b/trunk/apps/showcase/src/main/webapp/chat/usersAvailable.ftl deleted file mode 100644 index e03fa37d0..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/usersAvailable.ftl +++ /dev/null @@ -1,6 +0,0 @@ - -
      -<#list availableUsers as user> -
    • ${user.name}
    • - -
    diff --git a/trunk/apps/showcase/src/main/webapp/chat/usersAvailableInRoom.ftl b/trunk/apps/showcase/src/main/webapp/chat/usersAvailableInRoom.ftl deleted file mode 100644 index 95822bf7a..000000000 --- a/trunk/apps/showcase/src/main/webapp/chat/usersAvailableInRoom.ftl +++ /dev/null @@ -1,8 +0,0 @@ - -
      -<@s.iterator id="member" value="%{usersAvailableInRoom}"> -
    • <@s.property value="%{#member.name}" />
    • - -
    - - diff --git a/trunk/apps/showcase/src/main/webapp/continuations/guess.ftl b/trunk/apps/showcase/src/main/webapp/continuations/guess.ftl deleted file mode 100644 index 453b0b9a5..000000000 --- a/trunk/apps/showcase/src/main/webapp/continuations/guess.ftl +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -<#list actionMessages as msg> - ${msg} - - -<@s.form action="guess" method="post"> - <@s.textfield label="Guess" name="guess"/> - <@s.submit value="Guess"/> - - - - diff --git a/trunk/apps/showcase/src/main/webapp/conversion/Address.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/Address.java.txt deleted file mode 100644 index bf501834e..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/Address.java.txt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - - -/** - * @version $Date$ $Id$ - */ -public class Address { - - private String id; - private String address; - - public String getId() { return id; } - public void setId(String id) { this.id = id; } - - public String getAddress() { return address; } - public void setAddress(String address) { this.address = address; } - -} diff --git a/trunk/apps/showcase/src/main/webapp/conversion/AddressAction.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/AddressAction.java.txt deleted file mode 100644 index 35f17f5fd..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/AddressAction.java.txt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.LinkedHashSet; -import java.util.Set; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * @version $Date$ $Id$ - */ -public class AddressAction extends ActionSupport { - - private Set addresses = new LinkedHashSet(); - - public Set getAddresses() { return addresses; } - public void setAddresses(Set addresses) { this.addresses = addresses; } - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - System.out.println(addresses); - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/webapp/conversion/EnumTypeConverter.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/EnumTypeConverter.java.txt deleted file mode 100644 index 0a1b1aa38..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/EnumTypeConverter.java.txt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.struts2.util.StrutsTypeConverter; - -/** - * @version $Date$ $Id$ - */ -public class EnumTypeConverter extends StrutsTypeConverter { - - @Override - public Object convertFromString(Map context, String[] values, Class toClass) { - List result = new ArrayList(); - for (int a=0; a< values.length; a++) { - Enum e = Enum.valueOf(OperationsEnum.class, values[a]); - if (e != null) - result.add(e); - } - return result; - } - - @Override - public String convertToString(Map context, Object o) { - List l = (List) o; - String result ="<"; - for (Iterator i = l.iterator(); i.hasNext(); ) { - result = result + "["+ i.next() +"]"; - } - result = result+">"; - return result; - } - - -} diff --git a/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnum.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnum.java.txt deleted file mode 100644 index 2db119448..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnum.java.txt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -/** - * - * @version $Date$ $Id$ - */ -public enum OperationsEnum { - ADD, - MINUS, - DIVIDE, - MULTIPLY, - REMAINDER; -} diff --git a/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnumAction.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnumAction.java.txt deleted file mode 100644 index ee2327ff3..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnumAction.java.txt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - * @version $Date$ $Id$ - */ -public class OperationsEnumAction extends ActionSupport { - - private static final long serialVersionUID = -2229489704988870318L; - - private List selectedOperations = new LinkedList(); - - public List getSelectedOperations() { return this.selectedOperations; } - public void setSelectedOperations(List selectedOperations) { - this.selectedOperations = selectedOperations; - } - - - public List getAvailableOperations() { - return Arrays.asList(OperationsEnum.values()); - } - - public String input() throws Exception { - return SUCCESS; - } - public String submit() throws Exception { - return SUCCESS; - } -} - diff --git a/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnumActionConversion.txt b/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnumActionConversion.txt deleted file mode 100644 index 621beafba..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/OperationsEnumActionConversion.txt +++ /dev/null @@ -1,4 +0,0 @@ - -selectedOperations=org.apache.struts2.showcase.conversion.EnumTypeConverter -Element_selectedOperations=org.apache.struts2.showcase.conversion.OperationsEnum - diff --git a/trunk/apps/showcase/src/main/webapp/conversion/Person.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/Person.java.txt deleted file mode 100644 index 2ce9e0fdb..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/Person.java.txt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: AbstractDao.java 394498 2006-04-16 15:28:06Z tmjee $ - * - * 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.showcase.conversion; - -import java.io.Serializable; - -/** - * - */ -public class Person implements Serializable { - private String name; - private Integer age; - - public void setName(String name) { this.name = name; } - public String getName() { return this.name; } - - public void setAge(Integer age) { this.age = age; } - public Integer getAge() { return this.age; } -} diff --git a/trunk/apps/showcase/src/main/webapp/conversion/PersonAction.java.txt b/trunk/apps/showcase/src/main/webapp/conversion/PersonAction.java.txt deleted file mode 100644 index 015fab018..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/PersonAction.java.txt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * $Id: AbstractDao.java 394498 2006-04-16 15:28:06Z tmjee $ - * - * 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.showcase.conversion; - -import java.util.List; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - */ -public class PersonAction extends ActionSupport { - - private List persons; - - public List getPersons() { return persons; } - public void setPersons(List persons) { this.persons = persons; } - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/apps/showcase/src/main/webapp/conversion/enterAddressInfo.jsp b/trunk/apps/showcase/src/main/webapp/conversion/enterAddressInfo.jsp deleted file mode 100644 index 2d028a869..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/enterAddressInfo.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Showcase - Conversion - Set - - - -

    -An example populating a Set of object (Address.java) into Struts' action (AddressAction.java) - -

    - -See the jsp code here.
    -See the code for PersonAction.java here.
    -See the code for Person.java here.
    - -

    - - - - - - - - - <%-- - The following is how its done statically - --%> - <%-- - - - - - - - --%> - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/conversion/enterOperations.jsp b/trunk/apps/showcase/src/main/webapp/conversion/enterOperations.jsp deleted file mode 100644 index c01d6489b..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/enterOperations.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Showcase - Conversion - Tiger 5 Enum - - - -See the jsp code here.
    -See the code for OperationsEnum.java here.
    -See the code for OperationsEnumAction.java here.
    -See the code for EnumTypeConverter.java here.
    -See the properties for OperationsEnumAction-conversion.properties here. -
    -
    - - - - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/conversion/enterPersonInfo.jsp b/trunk/apps/showcase/src/main/webapp/conversion/enterPersonInfo.jsp deleted file mode 100644 index 8e9c54166..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/enterPersonInfo.jsp +++ /dev/null @@ -1,58 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Conversion - Populate Object into Struts' action List - - - -

    -An example populating a list of object (Person.java) into Struts' action (PersonAction.java) - -

    - -See the jsp code here.
    -See the code for PersonAction.java here.
    -See the code for Person.java here.
    - -

    - - - - - - <%-- - The following is done Dynamically - --%> - - - - - - - - <%-- - The following is done statically:- - --%> - <%-- - - - - - - - --%> - - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/conversion/index.jsp b/trunk/apps/showcase/src/main/webapp/conversion/index.jsp deleted file mode 100644 index 69f17c460..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/index.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Showcase - Conversion - - - -

      -
    • - - Populate into the Struts action class a List of Person.java Object -
    • -
    • - - Populate into Struts action class a Set of Address.java Object -
    • -
    • - - Populate into Struts action class a List of OperationEnum.java (Java5 Enum) -
    • -
    - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/conversion/showAddressInfo.jsp b/trunk/apps/showcase/src/main/webapp/conversion/showAddressInfo.jsp deleted file mode 100644 index 2f1d4e346..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/showAddressInfo.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Showcase - Conversion - Set - - - - ->
    -
    - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/conversion/showOperations.jsp b/trunk/apps/showcase/src/main/webapp/conversion/showOperations.jsp deleted file mode 100644 index c4b885903..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/showOperations.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Showcase - Conversion - Tiger 5 Enum - - - - -
    -
    - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/conversion/showPersonInfo.jsp b/trunk/apps/showcase/src/main/webapp/conversion/showPersonInfo.jsp deleted file mode 100644 index b0b10e1b1..000000000 --- a/trunk/apps/showcase/src/main/webapp/conversion/showPersonInfo.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - - -Showcase - Conversion - Populate Object into Struts action List - - - - -
    -
    -
    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl b/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl deleted file mode 100644 index 415233443..000000000 --- a/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl +++ /dev/null @@ -1,7 +0,0 @@ -
    -

    -Freemarker Custom Template - -parameter 'paramName' - ${parameters.paramName} -

    -
    - diff --git a/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp b/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp deleted file mode 100644 index 311c32987..000000000 --- a/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - -
    -

    -JSP Custom Template - -parameter 'paramName' - -

    -
    diff --git a/trunk/apps/showcase/src/main/webapp/date.jsp b/trunk/apps/showcase/src/main/webapp/date.jsp deleted file mode 100644 index 400cd6d24..000000000 --- a/trunk/apps/showcase/src/main/webapp/date.jsp +++ /dev/null @@ -1,2 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - diff --git a/trunk/apps/showcase/src/main/webapp/empmanager/editEmployee.jsp b/trunk/apps/showcase/src/main/webapp/empmanager/editEmployee.jsp deleted file mode 100644 index fb432e66b..000000000 --- a/trunk/apps/showcase/src/main/webapp/empmanager/editEmployee.jsp +++ /dev/null @@ -1,41 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - - - - - - - - <s:property value="#title"/> - - - - -

    - - - - - - - - - - - - - - - - - - -

    ">

    - - diff --git a/trunk/apps/showcase/src/main/webapp/empmanager/editSkill.jsp b/trunk/apps/showcase/src/main/webapp/empmanager/editSkill.jsp deleted file mode 100644 index a5544b0ca..000000000 --- a/trunk/apps/showcase/src/main/webapp/empmanager/editSkill.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - - - - - - - - -<s:property value="#title"/> - - -

    - - - - - <%--s:submit name="%{#submitType}" value="%{getText('save')}" /--%> - - -

    ">

    - - diff --git a/trunk/apps/showcase/src/main/webapp/empmanager/index.jsp b/trunk/apps/showcase/src/main/webapp/empmanager/index.jsp deleted file mode 100644 index b128df60c..000000000 --- a/trunk/apps/showcase/src/main/webapp/empmanager/index.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - CRUD - - -

    CRUD

    - -

    -

      -
    • List available Skills
    • -
    • Create/Edit Skill
    • -
    • List available Employees
    • -
    • Create/Edit Employee
    • -
    -

    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/empmanager/listEmployees.jsp b/trunk/apps/showcase/src/main/webapp/empmanager/listEmployees.jsp deleted file mode 100644 index 356bd0af4..000000000 --- a/trunk/apps/showcase/src/main/webapp/empmanager/listEmployees.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - -Available Employees - - -

    Available Employees

    - - - - - - - - - - - - - -
    IdFirst NameLast Name
    ">
    -

    ">Create new Employee

    -

    ">Back to Showcase Startpage

    - - diff --git a/trunk/apps/showcase/src/main/webapp/empmanager/listSkills.jsp b/trunk/apps/showcase/src/main/webapp/empmanager/listSkills.jsp deleted file mode 100644 index 3b1f77965..000000000 --- a/trunk/apps/showcase/src/main/webapp/empmanager/listSkills.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - -Available Skills - - -

    Available Skills

    - - - - - - - - - - -
    NameDescription
    ">
    - -

    ">Create new Skill

    -

    ">Back to Showcase Startpage

    - - diff --git a/trunk/apps/showcase/src/main/webapp/filedownload/index.jsp b/trunk/apps/showcase/src/main/webapp/filedownload/index.jsp deleted file mode 100644 index 0bd107e2c..000000000 --- a/trunk/apps/showcase/src/main/webapp/filedownload/index.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Showcase - - - -

    File Download Example

    - - Click this link to download Struts logo. - - - - diff --git a/trunk/apps/showcase/src/main/webapp/fileupload/upload-success.jsp b/trunk/apps/showcase/src/main/webapp/fileupload/upload-success.jsp deleted file mode 100644 index 15029cb54..000000000 --- a/trunk/apps/showcase/src/main/webapp/fileupload/upload-success.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page - language="java" - contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Showcase - - - -

    Fileupload sample

    - -

    -

      -
    • ContentType:
    • -
    • FileName:
    • -
    • File:
    • -
    • Caption:
    • -
    -

    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp b/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp deleted file mode 100644 index c683014d8..000000000 --- a/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@ page - language="java" - contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Showcase - - - -

    Fileupload sample

    - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl b/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl deleted file mode 100644 index 23f2b5963..000000000 --- a/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl +++ /dev/null @@ -1,26 +0,0 @@ - - - - Showcase - Freemarker - CustomFreemarkerManager Usage - - -

    Custom Freemarker Manager Usage

    - -

    - This page shows a simple example of using a custom freemarker manager. - The custom freemarker manager put into freemarker model an util classed - under the name 'customFreemarkerManagerUtil'. so one could use -

    -

      -
    • $ { customFreemarkerManagerUtil.getTodayDate() } - to get today's date
    • -
    • $ { customFreemarkerManagerUtil.todayDate } - to get today's date
    • -
    • $ { customFreemarkerManagerUtil.getTimeNow() } - to get the time now
    • -
    • $ { customFreemarkerManagerUtil.timeNow } - to get the time now
    • -
    - - Today's Date = ${customFreemarkerManagerUtil.todayDate}
    - Time now = ${customFreemarkerManagerUtil.getTimeNow()}
    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp b/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp deleted file mode 100644 index 1f6084e7e..000000000 --- a/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp +++ /dev/null @@ -1,20 +0,0 @@ - -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Freemarker - - - -
      -
    • - - Demo of usage of a Custom Freemarker Manager -
    • -
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/hangman/blank.ftl b/trunk/apps/showcase/src/main/webapp/hangman/blank.ftl deleted file mode 100644 index e69de29bb..000000000 diff --git a/trunk/apps/showcase/src/main/webapp/hangman/hangmanAjax.ftl b/trunk/apps/showcase/src/main/webapp/hangman/hangmanAjax.ftl deleted file mode 100644 index 1845984b9..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/hangmanAjax.ftl +++ /dev/null @@ -1,232 +0,0 @@ - - - - Showcase - Hangman - <@s.head theme="ajax" debug="false" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - <@s.url id="url" value="/hangman/images/hangman.png" /> - Hangman" - width="197" height="50" border="0"/> - - <#-- Guesses Left --> -
    - <@s.set name="guessLeftImageName" value="%{'Chalkboard_'+hangman.guessLeft()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#guessLeftImageName}" /> - No. Guesses Left" width="20" height="20" border="0" /> -
    -
    - <@s.url id="url" value="/hangman/images/guesses-left.png" /> - Guesses Left" width="164" height="11" border="0"/> -
    - <#-- Display Scaffold --> -
    - <@s.set name="scaffoldImageName" value="%{'scaffold_'+hangman.guessLeft()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#scaffoldImageName}" /> - " border="0"/> -
    -
    -

    - <@s.url id="url" value="/hangman/images/guess.png" /> - Current Guess" - align="MIDDLE" width="127" height="20" border="0"/>

    -
    - <#-- Display Vacab --> -
    - <@s.iterator id="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> - <#if hangman.characterGuessedBefore(currentCharacter)> - <@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter.toString()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#chalkboardImageName}" /> - <@s.property value=" - src="<@s.property value="%{#url}" />" width="36" border="0"/> - <#else> - <@s.url id="url" value="/hangman/images/Chalkboard_underscroll.png" /> - _" width="36" border="0"/> - - -
    -
    -

    - <@s.url id="url" value="/hangman/images/choose.png" /> - Choose" - height="20" width="151" border="0"/> -

    -
    - - <#-- Show Characters Available --> -
    - <@s.iterator id="currentCharacter" value="%{hangman.charactersAvailable}" status="stat"> - <@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter+'.png'}" /> - <@s.url id="chalkboardImageUrl" value="%{'/hangman/images/'+#chalkboardImageName}" /> - <@s.url id="spacerUrl" value="/hangman/images/letter-spacer.png" /> - - <@s.a theme="ajax" - href="ajax/blank.action" - id="%{#currentCharacter}" - notifyTopics="topicGuessMade" - showErrorTransportText="true"> - " width="36" border="0" /> - - -
    - - -
    - -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/hangman/hangmanMenu.ftl b/trunk/apps/showcase/src/main/webapp/hangman/hangmanMenu.ftl deleted file mode 100644 index 82bd032a2..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/hangmanMenu.ftl +++ /dev/null @@ -1,18 +0,0 @@ - - - - Showcase - Hangman - Menu - - -
      -
    • - <@s.url id="url" action="hangmanAjax" namespace="/hangman" /> - <@s.a href="%{#url}">Hangman (Ajax) -
    • -
    • - <@s.url id="url" action="hangmanNonAjax" namespace="/hangman" /> - <@s.a href="%{#url}">Hangman (Non Ajax) -
    • -
    - - diff --git a/trunk/apps/showcase/src/main/webapp/hangman/hangmanNonAjax.ftl b/trunk/apps/showcase/src/main/webapp/hangman/hangmanNonAjax.ftl deleted file mode 100644 index 73419f17f..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/hangmanNonAjax.ftl +++ /dev/null @@ -1,135 +0,0 @@ - - - Showcase - Hangman - <@s.head theme="xhtml" /> - - - - - - - - - - - - - - - - - - - - - - - - -
    - <@s.url id="url" value="/hangman/images/hangman.png" /> - Hangman" - width="197" height="50" border="0"/> - - <#-- Guesses Left --> -
    - <#if (hangman.guessLeft() >= 0)> - <@s.set name="guessLeftImageName" value="%{'Chalkboard_'+hangman.guessLeft()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#guessLeftImageName}" /> - No. Guesses Left" width="20" height="20" border="0" /> - -
    -
    - <@s.url id="url" value="/hangman/images/guesses-left.png" /> - Guesses Left" width="164" height="11" border="0"/> -
    - <#-- Display Scaffold --> -
    - <@s.set name="scaffoldImageName" value="%{'scaffold_'+hangman.guessLeft()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#scaffoldImageName}" /> - " border="0"/> -
    -
    -

    - <@s.url id="url" value="/hangman/images/guess.png" /> - Current Guess" - align="MIDDLE" width="127" height="20" border="0"/>

    -
    - <#-- Display Vacab --> -
    - <#if hangman.gameEnded()> - <@s.iterator id="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> - <@s.url id="url" value="%{'/hangman/images/Chalkboard_'+#currentCharacter.toString()+'.png'}" /> - <@s.property value=" - src="<@s.property value="%{#url}" />" width="36" border="0" /> - - <#else> - <@s.iterator id="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> - <#if hangman.characterGuessedBefore(currentCharacter)> - <@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter.toString()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#chalkboardImageName}" /> - <@s.property value=" - src="<@s.property value="%{#url}" />" width="36" border="0"/> - <#else> - <@s.url id="url" value="/hangman/images/Chalkboard_underscroll.png" /> - _" width="36" border="0"/> - - - -
    -
    -

    - <@s.url id="url" value="/hangman/images/choose.png" /> - Choose" - height="20" width="151" border="0"/> -

    -
    - - <#-- Show Characters Available --> -
    - <#if hangman.gameEnded()> - <@s.set name="winImageName" value="%{'you-win.png'}" /> - <@s.set name="looseImageName" value="%{'you-lose.png'}" /> - <@s.set name="startImageName" value="%{'start.png'}" /> - <@s.url id="winImageUrl" value="%{'/hangman/images/'+#winImageName}" /> - <@s.url id="looseImageUrl" value="%{'/hangman/images/'+#looseImageName}" /> - <@s.url id="startImageUrl" value="%{'/hangman/images/'+#startImageName}" /> - <@s.url id="startHref" action="hangmanNonAjax" namespace="/hangman" /> - - <#if hangman.isWin()> - " width="341" height="44" /> - <#else> - " width="381" height="44" /> - - <@s.a href="%{#startHref}"> - " width="250" height="43" /> - - <#else> - <@s.iterator id="currentCharacter" value="%{hangman.charactersAvailable}" status="stat"> - <@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter+'.png'}" /> - <@s.url id="chalkboardImageUrl" value="%{'/hangman/images/'+#chalkboardImageName}" /> - <@s.url id="spacerUrl" value="/hangman/images/letter-spacer.png" /> - <@s.url id="url" action="guessCharacterNonAjax" namespace="/hangman"> - <@s.param name="character" value="%{#currentCharacter}" /> - - - <@s.a href="%{#url}" - id="%{#currentCharacter}" - > - " width="36" border="0" /> - - - -
    - - -
    - -
    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_0.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_0.png deleted file mode 100644 index 7485012dd..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_0.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_1.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_1.png deleted file mode 100644 index 5a9a82d3c..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_1.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_2.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_2.png deleted file mode 100644 index 2fc9cddd3..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_2.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_3.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_3.png deleted file mode 100644 index 8b5377033..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_3.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_4.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_4.png deleted file mode 100644 index ee4d7a545..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_4.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_5.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_5.png deleted file mode 100644 index 2fec709cd..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_5.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_A.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_A.png deleted file mode 100644 index 837cae540..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_A.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_B.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_B.png deleted file mode 100644 index b69c2287d..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_B.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_C.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_C.png deleted file mode 100644 index 17e148595..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_C.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_D.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_D.png deleted file mode 100644 index 886a380d6..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_D.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_E.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_E.png deleted file mode 100644 index bcbea3fb8..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_E.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_F.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_F.png deleted file mode 100644 index 506a3c50f..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_F.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_G.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_G.png deleted file mode 100644 index ff73d7f0b..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_G.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_H.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_H.png deleted file mode 100644 index 61e95d2b8..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_H.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_I.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_I.png deleted file mode 100644 index 23cff0862..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_I.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_J.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_J.png deleted file mode 100644 index 4a4e5fce3..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_J.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_K.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_K.png deleted file mode 100644 index cd124f730..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_K.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_L.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_L.png deleted file mode 100644 index 8ae5113b6..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_L.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_M.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_M.png deleted file mode 100644 index 26ca8ffa5..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_M.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_N.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_N.png deleted file mode 100644 index bc3ef2264..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_N.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_O.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_O.png deleted file mode 100644 index 54c1923d2..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_O.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_P.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_P.png deleted file mode 100644 index c7c1e00c5..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_P.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Q.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Q.png deleted file mode 100644 index 9b84be3ca..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Q.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_R.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_R.png deleted file mode 100644 index fdc288741..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_R.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_S.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_S.png deleted file mode 100644 index 4020d6898..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_S.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_T.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_T.png deleted file mode 100644 index fbc00e605..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_T.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_U.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_U.png deleted file mode 100644 index 2d2b5da77..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_U.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_V.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_V.png deleted file mode 100644 index dea84433a..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_V.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_W.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_W.png deleted file mode 100644 index b26f97f68..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_W.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_X.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_X.png deleted file mode 100644 index 29dff7c73..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_X.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Y.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Y.png deleted file mode 100644 index 9e8a7328a..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Y.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Z.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Z.png deleted file mode 100644 index 04b3e33d7..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_Z.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_underscroll.png b/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_underscroll.png deleted file mode 100644 index 15f65abc1..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/Chalkboard_underscroll.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/choose.png b/trunk/apps/showcase/src/main/webapp/hangman/images/choose.png deleted file mode 100644 index f445bebf3..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/choose.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/guess.png b/trunk/apps/showcase/src/main/webapp/hangman/images/guess.png deleted file mode 100644 index 011978e7d..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/guess.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/guesses-left.png b/trunk/apps/showcase/src/main/webapp/hangman/images/guesses-left.png deleted file mode 100644 index 666ca5366..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/guesses-left.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/hangman.png b/trunk/apps/showcase/src/main/webapp/hangman/images/hangman.png deleted file mode 100644 index 8ba1431f5..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/hangman.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/letter-spacer.png b/trunk/apps/showcase/src/main/webapp/hangman/images/letter-spacer.png deleted file mode 100644 index bd6a7b010..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/letter-spacer.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/play-again.png b/trunk/apps/showcase/src/main/webapp/hangman/images/play-again.png deleted file mode 100644 index 48f2455be..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/play-again.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_-1.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_-1.png deleted file mode 100644 index f0d65f8cd..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_-1.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_0.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_0.png deleted file mode 100644 index 498e3cbc8..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_0.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_1.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_1.png deleted file mode 100644 index 8a24ba332..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_1.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_2.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_2.png deleted file mode 100644 index 6a1e91d84..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_2.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_3.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_3.png deleted file mode 100644 index c65d235e0..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_3.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_4.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_4.png deleted file mode 100644 index 7969f5a6e..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_4.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_5.png b/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_5.png deleted file mode 100644 index a15006b00..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/scaffold_5.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/start.png b/trunk/apps/showcase/src/main/webapp/hangman/images/start.png deleted file mode 100644 index 89fd770f4..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/start.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/you-lose.png b/trunk/apps/showcase/src/main/webapp/hangman/images/you-lose.png deleted file mode 100644 index 80e1726dd..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/you-lose.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/images/you-win.png b/trunk/apps/showcase/src/main/webapp/hangman/images/you-win.png deleted file mode 100644 index c6b3cf7fe..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/hangman/images/you-win.png and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/hangman/test.ftl b/trunk/apps/showcase/src/main/webapp/hangman/test.ftl deleted file mode 100644 index 0cbd17fdd..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/test.ftl +++ /dev/null @@ -1,21 +0,0 @@ - - - - <@s.head theme="ajax" debug="true" /> - - - - - click - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/hangman/updateCharacterAvailable.ftl b/trunk/apps/showcase/src/main/webapp/hangman/updateCharacterAvailable.ftl deleted file mode 100644 index 9dfe7a62a..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/updateCharacterAvailable.ftl +++ /dev/null @@ -1,47 +0,0 @@ -<#if hangman.gameEnded()> - <@s.set name="winImageName" value="%{'you-win.png'}" /> - <@s.set name="looseImageName" value="%{'you-lose.png'}" /> - <@s.set name="startImageName" value="%{'start.png'}" /> - <@s.url id="winImageUrl" value="%{'/hangman/images/'+#winImageName}" /> - <@s.url id="looseImageUrl" value="%{'/hangman/images/'+#looseImageName}" /> - <@s.url id="startImageUrl" value="%{'/hangman/images/'+#startImageName}" /> - <@s.url id="startHref" action="hangmanAjax" namespace="/hangman" /> - - <#if hangman.isWin()> - " width="341" height="44" /> - <#else> - " width="381" height="44" /> - - <@s.a href="%{#startHref}"> - " width="250" height="43" /> - -<#else> -<@s.iterator id="currentCharacter" value="%{hangman.charactersAvailable}" status="stat"> - <@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter+'.png'}" /> - <@s.url id="chalkboardImageUrl" value="%{'/hangman/images/'+#chalkboardImageName}" /> - <@s.url id="spacerUrl" value="/hangman/images/letter-spacer.png" /> - - - <@s.a theme="ajax" - id="%{#currentCharacter}" - href="ajax/blank.action" - notifyTopics="topicGuessMade" - showErrorTransportText="true"> - " width="36" border="0" /> - - - <#-- - " > - " width="36" border="0" /> - - - - --> - - diff --git a/trunk/apps/showcase/src/main/webapp/hangman/updateGuessLeft.ftl b/trunk/apps/showcase/src/main/webapp/hangman/updateGuessLeft.ftl deleted file mode 100644 index 8b5ef4ebe..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/updateGuessLeft.ftl +++ /dev/null @@ -1,7 +0,0 @@ -<#if (hangman.guessLeft() >= 0)> - <@s.set name="guessLeftImageName" value="%{'Chalkboard_'+hangman.guessLeft()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#guessLeftImageName}" /> - No. Guesses Left" width="20" height="20" border="0" /> - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/hangman/updateScaffold.ftl b/trunk/apps/showcase/src/main/webapp/hangman/updateScaffold.ftl deleted file mode 100644 index afd11b6e2..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/updateScaffold.ftl +++ /dev/null @@ -1,3 +0,0 @@ - <@s.set name="scaffoldImageName" value="%{'scaffold_'+hangman.guessLeft()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#scaffoldImageName}" /> - " border="0"/> diff --git a/trunk/apps/showcase/src/main/webapp/hangman/updateVocabCharacters.ftl b/trunk/apps/showcase/src/main/webapp/hangman/updateVocabCharacters.ftl deleted file mode 100644 index d4b370b97..000000000 --- a/trunk/apps/showcase/src/main/webapp/hangman/updateVocabCharacters.ftl +++ /dev/null @@ -1,20 +0,0 @@ -<#if hangman.gameEnded()> -<@s.iterator id="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> - <@s.url id="url" value="%{'/hangman/images/Chalkboard_'+#currentCharacter.toString()+'.png'}" /> - <@s.property value=" - src="<@s.property value="%{#url}" />" width="36" border="0" /> - -<#else> -<@s.iterator id="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> - <#if hangman.characterGuessedBefore(currentCharacter)> - <@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter.toString()+'.png'}" /> - <@s.url id="url" value="%{'/hangman/images/'+#chalkboardImageName}" /> - <@s.property value=" - src="<@s.property value="%{#url}" />" width="36" border="0"/> - <#else> - <@s.url id="url" value="/hangman/images/Chalkboard_underscroll.png" /> - _" width="36" border="0"/> - - - diff --git a/trunk/apps/showcase/src/main/webapp/help.jsp b/trunk/apps/showcase/src/main/webapp/help.jsp deleted file mode 100644 index 7da2b1459..000000000 --- a/trunk/apps/showcase/src/main/webapp/help.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - Struts ~ Getting Support - - - -
    -

    Getting support

    - - - - - - - - - - - - - - -
    LinkDescription
    User ListUse this mailing list if you encounter problems while developing and using with Struts
    Struts 2The Struts 2 website
    -
    - -
    - Struts Logo -
    - - diff --git a/trunk/apps/showcase/src/main/webapp/images/struts-power.gif b/trunk/apps/showcase/src/main/webapp/images/struts-power.gif deleted file mode 100644 index 5f4e9d426..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/images/struts-power.gif and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/images/struts.gif b/trunk/apps/showcase/src/main/webapp/images/struts.gif deleted file mode 100644 index 42e7d33d5..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/images/struts.gif and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/index.jsp b/trunk/apps/showcase/src/main/webapp/index.jsp deleted file mode 100644 index 391e0023d..000000000 --- a/trunk/apps/showcase/src/main/webapp/index.jsp +++ /dev/null @@ -1 +0,0 @@ -<% response.sendRedirect("showcase.action"); %> diff --git a/trunk/apps/showcase/src/main/webapp/integration/modelDriven.jsp b/trunk/apps/showcase/src/main/webapp/integration/modelDriven.jsp deleted file mode 100644 index ce7938b59..000000000 --- a/trunk/apps/showcase/src/main/webapp/integration/modelDriven.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Struts 1 Integration Example - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/integration/modelDrivenResult.jsp b/trunk/apps/showcase/src/main/webapp/integration/modelDrivenResult.jsp deleted file mode 100644 index 550c55815..000000000 --- a/trunk/apps/showcase/src/main/webapp/integration/modelDrivenResult.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Struts 1 Integration Example - - - - -
    -
    -
    -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/jsf/employee/edit.jsp b/trunk/apps/showcase/src/main/webapp/jsf/employee/edit.jsp deleted file mode 100644 index 717c82536..000000000 --- a/trunk/apps/showcase/src/main/webapp/jsf/employee/edit.jsp +++ /dev/null @@ -1,106 +0,0 @@ -<%-- - - 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. - - $Id$ - ---%> - -<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> -<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %> - - - - - - - JSF Integration Examples - - - - -

    Modify Employee

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    - - - -
    - - - - -
    \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/jsf/employee/list.jsp b/trunk/apps/showcase/src/main/webapp/jsf/employee/list.jsp deleted file mode 100644 index cad7d1c81..000000000 --- a/trunk/apps/showcase/src/main/webapp/jsf/employee/list.jsp +++ /dev/null @@ -1,69 +0,0 @@ -<%-- - - 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. - - $Id$ - ---%> - -<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> -<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %> - - - - -Available Employees - - -

    Available Employees

    - - - - - - - - - - - - - - - - - - - - - - - - - -

    - - - -

    - - - - - - - - -
    \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/jsf/index.jsp b/trunk/apps/showcase/src/main/webapp/jsf/index.jsp deleted file mode 100644 index e54666876..000000000 --- a/trunk/apps/showcase/src/main/webapp/jsf/index.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - JSF Integration - - -

    JavaServer Faces Integration

    - -

    -The following pages show how Struts and JSF components can work together, -each doing what they do best. -

    - -

    -

      -
    • List available Employees
    • -
    • Create/Edit Employee
    • -
    -

    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/modelDriven/modelDriven.jsp b/trunk/apps/showcase/src/main/webapp/modelDriven/modelDriven.jsp deleted file mode 100644 index 346ffcece..000000000 --- a/trunk/apps/showcase/src/main/webapp/modelDriven/modelDriven.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Model Driven Example - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/modelDriven/modelDrivenResult.jsp b/trunk/apps/showcase/src/main/webapp/modelDriven/modelDrivenResult.jsp deleted file mode 100644 index 5b96cca6e..000000000 --- a/trunk/apps/showcase/src/main/webapp/modelDriven/modelDrivenResult.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Model Driven Example - - - - -
    -
    -
    -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/person/editPeople.jsp b/trunk/apps/showcase/src/main/webapp/person/editPeople.jsp deleted file mode 100644 index e836cefec..000000000 --- a/trunk/apps/showcase/src/main/webapp/person/editPeople.jsp +++ /dev/null @@ -1,41 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - Edit Persons (batch-edit) - - - - - - - - - - - - - - - - - - -
    IDFirst NameLast Name
    - - - - - -
    - - -
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/person/index.jsp b/trunk/apps/showcase/src/main/webapp/person/index.jsp deleted file mode 100644 index 48afafe75..000000000 --- a/trunk/apps/showcase/src/main/webapp/person/index.jsp +++ /dev/null @@ -1,12 +0,0 @@ - - - Acme Corp - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/person/listPeople.ftl b/trunk/apps/showcase/src/main/webapp/person/listPeople.ftl deleted file mode 100644 index b2b854f65..000000000 --- a/trunk/apps/showcase/src/main/webapp/person/listPeople.ftl +++ /dev/null @@ -1,28 +0,0 @@ - - - All People - - - - -There are ${peopleCount} people... - - - - - -<#list people as person> - - - - - - -
    IDName
    ${person.id}${person.name}${person.lastName}
    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/person/newPerson.ftl b/trunk/apps/showcase/src/main/webapp/person/newPerson.ftl deleted file mode 100644 index 142eb07e1..000000000 --- a/trunk/apps/showcase/src/main/webapp/person/newPerson.ftl +++ /dev/null @@ -1,19 +0,0 @@ - - - New Person - - - -<@s.form action="newPerson"> - <@s.textfield label="First Name" name="person.name"/> - <@s.textfield label="Last Name" name="person.lastName"/> - <@s.submit value="Create person"/> - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/showcase.jsp b/trunk/apps/showcase/src/main/webapp/showcase.jsp deleted file mode 100644 index 10d2fcfb3..000000000 --- a/trunk/apps/showcase/src/main/webapp/showcase.jsp +++ /dev/null @@ -1,82 +0,0 @@ -<%-- - showcase.jsp - - @version $Date$ $Id$ ---%> - -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Showcase - - - - -

    Showcase samples

    - -

    The given examples will demonstrate the usages of all Struts tags as well as validations etc.

    - -

    -

      - -
    • Configuration browser (Great for development!)
    • - - -
    • Continuations Example
    • - - -
    • Tags Examples
    • - - -
    • File Upload Example
    • - - -
    • CRUD Examples
    • - - -
    • PersonManager Sample
    • - - -
    • Validation Examples
    • - - -
    • AJAX Examples
    • - - -
    • Action Chaining Example
    • - - -
    • Execute and Wait Examples
    • - - -
    • Token Examples (double post)
    • - - -
    • File Download Example
    • - - -
    • Model Driven Example - - -
    • Conversion Example
    • - - -
    • Freemarker Example
    • - - -
    • JavaServer Faces Example
    • - - -
    • Struts 1.3 Integration Example
    • - - -
    • Chat (AJAX) Example
    • - - -
    • Hangman (AJAX and Non AJAX) Example - -
    -

    - - - diff --git a/trunk/apps/showcase/src/main/webapp/styles/forms.css b/trunk/apps/showcase/src/main/webapp/styles/forms.css deleted file mode 100644 index 4cc218818..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/forms.css +++ /dev/null @@ -1,102 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -/* FORM ELEMENTS */ - form { - margin:0; - padding:0; - } - form div, - form p { - font-size: 1em; - margin: 0 0 1em 0; - padding: 0; - } - label { - font-weight: bold; - } - fieldset { - border: 1px solid #eee; - padding: 5px 10px; - margin: 0 0 1.5em 0; - } - fieldset legend { - color: #666; - font-size: 1.1em; - font-weight: bold; - margin: 0 0 0 0px; - padding: 0; - background-color: #ECF1F9; - } - * html fieldset legend { - margin: 0 0 10px -10px; - } - fieldset ul { - list-style: none; - margin: 0 0 1.5em 0; - padding: 0; - } - fieldset ul li { - list-style: none; - margin: 0 0 0.5em 0; - padding: 0; - } - - - input, select, textarea { - font-size:1em; - font-family: arial, helvetica, verdana, sans-serif; - - margin: 0; - padding: 2px; - } - - input, select { - vertical-align:middle; - } - - textarea { - width: 200px; - height: 8em; - } - - input.check { - border: none; - width: auto; - height: auto; - margin: 0; - } - input.radio { - border: none; - width: auto; - height: auto; - margin: 0; - } - input.file { - height: auto; - width: 250px; - } - input.readonly { - background-color: transparent; - border: none; - } - input.button { - width: 10em; - border:1px solid black; - background-color: #ddd; - } - input.image { - border: none; - width: auto; - height: auto; - } - - form div.submit { - margin: 1em 0; - } - form div.submit input { - height: 2em; - width: 15em; - } - -/* END FORM ELEMENTS */ - diff --git a/trunk/apps/showcase/src/main/webapp/styles/layout-navtop-1col.css b/trunk/apps/showcase/src/main/webapp/styles/layout-navtop-1col.css deleted file mode 100644 index 595123f4c..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/layout-navtop-1col.css +++ /dev/null @@ -1,33 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -@import url("nav-horizontal.css"); - -/* NAV BAR AT THE TOP AND ONE COLUMN OF CONTENT */ - div#content { - position: relative; - width: 98%; - - margin: 0 auto 20px auto; - padding: 0; - - text-align: left; - } - div#main { - width: 100%; - } - div#local { - width: 100%; - display: none; - } - div#sub { - width: 100%; - } - div#nav { - position: absolute; - top: -15px; - left: 0; - width: 100%; - - text-align: left; - } -/* END CONTENT */ diff --git a/trunk/apps/showcase/src/main/webapp/styles/layout-navtop-localleft.css b/trunk/apps/showcase/src/main/webapp/styles/layout-navtop-localleft.css deleted file mode 100644 index a12210c08..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/layout-navtop-localleft.css +++ /dev/null @@ -1,36 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -@import url("nav-horizontal.css"); - -/* NAV BAR AT THE TOP, LOCAL NAVIGATION ON THE LEFT AND ONE COLUMN OF CONTENT */ - div#content { - position: relative; - width: 98%; - - margin: 5em auto 20px auto; - padding: 0; - - text-align: left; - } - div#main { - float: right; - width: auto; - display: inline; - } - div#local { - float: left; - width: 275px; - display: inline; - } - div#sub { - display: none; - } - div#nav { - position: absolute; - top: -15px; - left: 0; - width: 100%; - - text-align: left; - } -/* END CONTENT */ diff --git a/trunk/apps/showcase/src/main/webapp/styles/layout.css b/trunk/apps/showcase/src/main/webapp/styles/layout.css deleted file mode 100644 index 5a7aec1dd..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/layout.css +++ /dev/null @@ -1,136 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -/* SITE SPECIFIC LAYOUT */ - body { - margin: 0; - padding: 0; - - background: white; - - text-align: center; - } - div#page { - width: 98%; - - margin: 0 auto; - padding: 0; - - text-align: center; - } - - /* HEADER */ - div#header { - margin: 0; - padding: 5px 0px 0 0; - - color: white; - background: #818EBD; - - text-align: left; - } - div#branding { - float: left; - width: 40%; - - margin: 0; - padding: 5px 0 5px 10px; - - text-align: left; - } - div#search { - float: right; - width: 49%; - - margin: 0; - padding: 8px 10px 0 0; - - text-align: right; - } - div#header_spacer { - display: block; - height: 5em; - background-color: transparent; - } - /* END HEADER */ - - - /* CONTENT */ - - /* END HEADER */ - - - /* CONTENT */ - div#content { - - } - - /* MAIN */ - div#main { - - } - /* END MAIN */ - - /* SUB */ - div#sub { - - } - /* END SUB */ - - /* END CONTENT */ - - - /* FOOTER */ - div#footer { - color: white; - background-color: #818EBD; - border-width:0; - margin-bottom: 4px; - } - div#footer p { - font-size: 0.8em; - - margin: 0; - padding: 5px; - } - /* END FOOTER */ -/* END LAYOUT */ - - - - -/* UL.SUBNAV */ - ul.subnav { - margin: 0; - padding: 0; - - font-size: 0.8em; - list-style: none; - } - ul.subnav li { - margin: 0 0 1em 0; - padding: 0; - list-style: none; - } - ul.subnav li a, - ul.subnav li a:link, - ul.subnav li a:visited, - ul.subnav li a:active { - text-decoration: none; - font-weight: bold; - color: black; - } - ul.subnav li a:hover { - text-decoration: underline; - } - ul.subnav li strong { - padding: 0 0 0 12px; - background: url("../i/subnav-highlight.gif") left top no-repeat transparent; - } - ul.subnav li strong a, - ul.subnav li strong a:link, - ul.subnav li strong a:visited, - ul.subnav li strong a:active { - color: white; - background-color: #818EBD; - } -/* END UL.SUBNAV */ diff --git a/trunk/apps/showcase/src/main/webapp/styles/main.css b/trunk/apps/showcase/src/main/webapp/styles/main.css deleted file mode 100644 index 3085ed369..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/main.css +++ /dev/null @@ -1,5 +0,0 @@ -@import url(layout-navtop-localleft.css); -@import url(layout.css); -@import url(forms.css); -@import url(typo.css); -@import url(tools.css); diff --git a/trunk/apps/showcase/src/main/webapp/styles/nav-horizontal.css b/trunk/apps/showcase/src/main/webapp/styles/nav-horizontal.css deleted file mode 100644 index 8e94d2238..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/nav-horizontal.css +++ /dev/null @@ -1,80 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -/* NAV */ - div#nav { - font-size: 0.8em; - } - * html div#nav { - /* hide ie/mac \*/ - height: 1%; - /* end hide */ - } - div#nav div.wrapper { - position: absolute; - left: 0; - bottom: 0; - width: 100%; - } - div#nav ul { - width: auto; - width: 100%; - - margin: 0; - padding: 0; - - line-height: 1em; - list-style: none; - } - div#nav li { - float: left; - display: inline; - - list-style: none; - - margin: 0; - padding: 0; - - line-height: 1em; - border-right: 1px solid #aaa; - } - div#nav li.last { - border-right: none; - } - div#nav a, - div#nav a:link, - div#nav a:active, - div#nav a:visited { - display: inline-block; - /* hide from ie/mac \*/ - display: block; - /* end hide */ - font-weight: bold; - text-decoration: none; - - margin: 0; - padding: 5px 10px 5px 10px; - - color: black; - background: #ddd; - } - div#nav a:hover { - text-decoration: underline; - } - div#nav strong { - display: inline-block; - /* hide from ie/mac \*/ - display: block; - /* end hide */ - - color: white; - background: #818EBD; - } - div#nav strong a, - div#nav strong a:link, - div#nav strong a:active, - div#nav strong a:visited, - div#nav strong a:hover { - color: white; - background-color: #818EBD; - } -/* END NAV */ diff --git a/trunk/apps/showcase/src/main/webapp/styles/tools.css b/trunk/apps/showcase/src/main/webapp/styles/tools.css deleted file mode 100644 index 351b10334..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/tools.css +++ /dev/null @@ -1,68 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -/* clearing */ - .stretch, - .clear { - clear:both; - height:1px; - margin:0; - padding:0; - font-size: 15px; - line-height: 1px; - } - .clearfix:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - * html>body .clearfix { - display: inline-block; - width: 100%; - } - - * html .clearfix { - /* Hides from IE-mac \*/ - height: 1%; - /* End hide from IE-mac */ - } -/* end clearing */ - - -/* replace */ - .replace { - display:block; - - background-repeat: no-repeat; - background-position: left top; - background-color:transparent; - } - /* tidy these up */ - .replace * { - text-indent: -10000px; - display:block; - - background-repeat: no-repeat; - background-position: left top; - background-color:transparent; - } - .replace a { - text-indent:0; - } - .replace a span { - text-indent:-10000px; - } -/* end replace */ - - -/* accessibility */ - span.accesskey { - text-decoration:none; - } - .accessibility { - position: absolute; - top: -999em; - left: -999em; - } -/* end accessibility */ diff --git a/trunk/apps/showcase/src/main/webapp/styles/typo.css b/trunk/apps/showcase/src/main/webapp/styles/typo.css deleted file mode 100644 index 349bd0be1..000000000 --- a/trunk/apps/showcase/src/main/webapp/styles/typo.css +++ /dev/null @@ -1,195 +0,0 @@ -/* A CSS Framework by Mike Stenhouse of Content with Style */ - -/* TYPOGRAPHY */ - body { - text-align: left; - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size: 76%; - line-height: 1em; - color: #333; - background: White; - } - div { - font-size: 1em; - } - img { - border: 0; - } - -/* LINKS */ - a, - a:link - a:active { - color: blue; - text-decoration: underline; - } - a:visited { - color: purple; - } - a:hover { - color: red; - text-decoration: none; - } -/* END LINKS */ - -/* HEADINGS */ - h1 { - font-size: 2em; - line-height: 1.5em; - margin: 0 0 0.5em 0; - padding: 0; - color: black; - } - - h1.title { - font-style: italic; - font-weight: bold; - color: white; - } - - h2 { - font-size: 1.5em; - line-height: 1.5em; - margin: 0 0 0.5em 0; - padding: 0; - color: black; - } - h3 { - font-size: 1.3em; - line-height: 1.3em; - margin: 0 0 0.5em 0; - padding:0; - color: black; - } - h4 { - font-size: 1.2em; - line-height: 1.3em; - margin: 0 0 0.25em 0; - padding: 0; - color: black; - } - h5 { - font-size: 1.1em; - line-height: 1.3em; - margin: 0 0 0.25em 0; - padding: 0; - color: black; - } - h6 { - font-size: 1em; - line-height: 1.3em; - margin: 0 0 0.25em 0; - padding: 0; - color: black; - } -/* END HEADINGS */ - -/* TEXT */ - p { - font-size: 1em; - margin: 0 0 1.5em 0; - padding: 0; - line-height:1.4em; - } - - blockquote { - margin-left:10px; - margin-right:10px; - margin-top:0px; - margin-bottom:0px; - display: block; - font: italic large Verdana, Geneva, Arial, Helvetica, sans-serif; - color: #A9A9A9; - background-color:#CDFFAA; - } - - blockquote p { - padding:5px; - margin: 0; - } - - pre { - font-family: monospace; - font-size: 1.0em; - } - strong, b { - font-weight: bold; - } - em, i { - font-style:italic; - } - code { - font-family: "Courier New", Courier, monospace; - font-size: 1em; - white-space: pre; - } -/* END TEXT */ - -/* LISTS */ - ul { - line-height:1.4em; - margin: 0 0 1.5em 0; - padding: 0; - } - ul li { - margin: 0 0 0.25em 30px; - padding: 0; - } - ol { - font-size: 1.0em; - line-height: 1.4em; - margin: 0 0 1.5em 0; - padding: 0; - } - ol li { - font-size: 1.0em; - margin: 0 0 0.25em 30px; - padding: 0; - } - dl { - margin: 0 0 1.5em 0; - padding: 0; - line-height: 1.4em; - } - dl dt { - font-weight: bold; - margin: 0.25em 0 0.25em 0; - padding: 0; - } - dl dd { - margin: 0 0 0 30px; - padding: 0; - } -/* END LISTS */ - - -/* TABLE */ - table { - font-size: 1em; - margin: 0 0 1.5em 0; - padding: 0; - } - table caption { - font-weight: bold; - margin: 0 0 0 0; - padding: 0 0 1.5em 0; - } - th { - font-weight: bold; - text-align: left; - } - td { - font-size: 1em; - } -/* END TABLE */ - - hr { - display: none; - } - div.hr { - height: 1px; - margin: 1.5em 10px; - border-bottom: 1px dotted black; - } - -/* END TYPOGRAPHY */ diff --git a/trunk/apps/showcase/src/main/webapp/tags/index.jsp b/trunk/apps/showcase/src/main/webapp/tags/index.jsp deleted file mode 100644 index 88fa036d8..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/index.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - - -

    Tags

    - -
      -
    • Non UI Tags Examples
    • -
    • UI Tags Example
    • -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/actionPrefix.ftl b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/actionPrefix.ftl deleted file mode 100644 index 70b8161f9..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/actionPrefix.ftl +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Showcase - Tags - Non UI - Action Prefix (freemarker) - - - - You have come to this page because you used an 'action' prefix.

    - - The text you've enter is ${text?default('')}

    - - <@s.url id="url" action="actionPrefixExampleUsingFreemarker" namespace="/tags/non-ui/actionPrefix" /> - <@s.a href="%{#url}">Back - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/actionPrefixExample.ftl b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/actionPrefixExample.ftl deleted file mode 100644 index 940771351..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/actionPrefixExample.ftl +++ /dev/null @@ -1,45 +0,0 @@ - - - - Showcase - Tags - Non UI - Action Prefix (Freemarker) - - - Action Prefix
    - By clicking on 'action prefix' button, the request will go to the action alias 'actionPrefix' - instead of the normal 'submit' action alias.

    - - Method Prefix
    - By clicking on the 'method prefix' button, the request will cause Struts to invoke 'submit' - action alias's 'alternateMethod' method instead of the default 'execute' method.

    - - Redirect Prefix
    - By clicking on the 'redirect prefix' button, the request will get redirected to www.google.com - instead

    - - Redirect Action Prefix
    - By clicking on the 'redirect-action prefix' button, the request will get redirected to - an action alias of 'redirectActionPrefix' instead of 'submit' action alias. Since this is a - redirect (a new request is issue from the client), the text entered will be lost.

    - - - <@s.url id="url" action="viewSource" namespace="/tags/non-ui/actionPrefix" /> - The JSP code can be read <@s.a href="%{#url}">here. - - - <@s.form action="submit" namespace="/tags/non-ui/actionPrefix" method="POST"> - - <@s.textfield label="Enter Some Text" name="text" /> - - <@s.submit name="action:actionPrefix" value="%{'action prefix'}" /> - - <@s.submit name="method:alternateMethod" value="%{'method prefix'}" /> - - <@s.submit name="redirect:http://www.google.com" value="%{'redirect prefix'}" /> - - <@s.submit name="redirect-action:redirectActionPrefix" value="%{'redirect-action prefix'}" /> - - <@s.submit value="Normal Submit" /> - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/index.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/index.jsp deleted file mode 100644 index e134c715c..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/index.jsp +++ /dev/null @@ -1,13 +0,0 @@ - -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - Non-Ui - Action Prefix - - -

      - Action Prefix Example (Freemarker)
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/methodPrefix.ftl b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/methodPrefix.ftl deleted file mode 100644 index fe9ac75b9..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/methodPrefix.ftl +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Showcase - Tags - Non UI - Action Prefix (freemarker) - - - - You have come to this page because you used an 'method' prefix.

    - - The text you've enter is ${text?default('')}

    - - <@s.url id="url" action="actionPrefixExampleUsingFreemarker" namespace="/tags/non-ui/actionPrefix" /> - <@s.a href="%{#url}">Back - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/normalSubmit.ftl b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/normalSubmit.ftl deleted file mode 100644 index c183d9726..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/normalSubmit.ftl +++ /dev/null @@ -1,17 +0,0 @@ - - - - Showcase - Tags - Non UI - Action Prefix (freemarker) - - - - You have come to this page because you did a normal submit.

    - - The text you've enter is %{text}

    - - <@s.url id="url" action="actionPrefixExampleUsingFreemarker" namespace="/tags/non-ui/prefix" /> - <@s.a href="%{#url}">Back - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/redirectActionPrefix.ftl b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/redirectActionPrefix.ftl deleted file mode 100644 index c991ee31b..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionPrefix/redirectActionPrefix.ftl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Showcase - Tags - Non UI - Action Prefix (freemarker) - - - - You have come to this page because you used an 'redirect-action' prefix.

    - - Because this is a 'redirect-action', the text will be lost, due to a redirection - implies a new request being issued from the client.

    - - The text you've enter is ${text?default('')}

    - - <@s.url id="url" action="actionPrefixExampleUsingFreemarker" namespace="/tags/non-ui/actionPrefix" /> - <@s.a href="%{#url}">Back - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage.jsp deleted file mode 100644 index bf84a3704..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage.jsp +++ /dev/null @@ -1 +0,0 @@ -

    This is INCLUDED by the action tag

    diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage2.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage2.jsp deleted file mode 100644 index 2b73ee077..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage2.jsp +++ /dev/null @@ -1,2 +0,0 @@ - -

    This is INCLUDED by the action tag (Page2)

    diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage3.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage3.jsp deleted file mode 100644 index cddd14d8c..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/includedPage3.jsp +++ /dev/null @@ -1,2 +0,0 @@ - -

    This is INCLUDED by the action tag (Page3)

    diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/showActionTagDemo.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/showActionTagDemo.jsp deleted file mode 100644 index c0340a94d..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/actionTag/showActionTagDemo.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Non-Ui Tag - Action Tag - - - -
    -

    This is Not - Included by the Action Tag

    -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -Source - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/date.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/date.jsp deleted file mode 100644 index 9303e7018..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/date.jsp +++ /dev/null @@ -1,104 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - UI Tags Example: Date - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameFormatOutput
    Before datetoString()
    Past datetoString()
    Now datetoString()
    Future datetoString()
    After datetoString()
    Current dateyyyy/MM/dd hh:mm:ss
    Current datedd.MM.yyyy hh:mm:ss
    Current time (24h)HH:mm:ss
    Before dateMMM, dd yyyy
    Before datenice
    After datedd.MM.yyyy
    After datenice
    Past datedd/MM/yyyy hh:mm
    Future dateMM-dd-yy
    Future date (fallback)fallback
    Past datenice
    Future datenice
    - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/debug.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/debug.jsp deleted file mode 100644 index 88de057b0..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/debug.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Non-UI Tags Example: Debug - - - - -

    Debug Tag Usage

    - -

    - This page shows a simple example of using the debug tag.
    - Just add <s:debug /> to your JSP page - and you will see the debug link. -

    - Just click on the Debug label to see the Struts ValueStack Debug information. -

    - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/ifTag/testIf.ftl b/trunk/apps/showcase/src/main/webapp/tags/non-ui/ifTag/testIf.ftl deleted file mode 100644 index a40b756c7..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/ifTag/testIf.ftl +++ /dev/null @@ -1,607 +0,0 @@ - - - TEST IF - - -

    -This is a simple freemarker template to test the If Tag (using freemarker directive). -There's quite a few combination being tested. The characters in bold and non-bold should be the same. -

    - - -1 - Foo - -<@s.if test="true"> - Foo - -<@s.else> - Bar - -
    -2 - Bar - -<@s.if test="false"> - Foo - -<@s.else> - Bar - -
    -3 - FooFooFoo - -<@s.if test="true"> - Foo - <@s.if test="true"> - FooFoo - - <@s.else> - BarBar - - -<@s.else> - Bar - -
    -4 - FooBarBar - -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - <@s.else> - BarBar - - -
    -5 - BarFooFoo - -<@s.if test="false"> - Foo - -<@s.else> - Bar - <@s.if test="true"> - FooFoo - - <@s.else> - BarBar - - -
    -6 - BarBarBar - -<@s.if test="false"> - Foo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - <@s.else> - BarBar - - -
    -7 - Foo - -<@s.if test="true"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - -
    -8 - Moo - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - -<@s.else> - Bar - -
    -9 - Bar - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - -
    -10 - FooFooFoo - -<@s.if test="true"> - Foo - <@s.if test="true"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - <@s.else> - BarBar - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - -
    -11 - FooMooMoo - -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - <@s.elseif test="true"> - MooMoo - - <@s.else> - BarBar - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - -
    -12 - FooBarBar - -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - <@s.else> - BarBar - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - -
    -13 - MooFooFoo - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="true"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - <@s.else> - BarBar - - -<@s.else> - Bar - -
    -14 - MooMooMoo - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="false"> - FooFoo - - <@s.elseif test="true"> - MooMoo - - <@s.else> - BarBar - - -<@s.else> - Bar - -
    -15 - MooBarBar - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="false"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - <@s.else> - BarBar - - -<@s.else> - Bar - -
    -16 - BarFooFoo - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="true"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - <@s.else> - BarBar - - -
    -17 - BarMooMoo - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - <@s.elseif test="true"> - MooMoo - - <@s.else> - BarBar - - -
    -18 - BarBarBar - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - <@s.else> - BarBar - - - -
    -19 - Foo - -<@s.if test="true"> - Foo - - -
    -20 - ** should not display anything ** - -<@s.if test="false"> - Foo - - -
    -21 FooFooFoo - -<@s.if test="true"> - Foo - <@s.if test="true"> - FooFoo - - -<@s.else> - Bar - - -
    -22 - Foo - -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - -<@s.else> - Bar - - -
    -23 - BarFooFoo - -<@s.if test="false"> - Foo - -<@s.else> - Bar - <@s.if test="true"> - FooFoo - - - -
    -24 - Bar - -<@s.if test="false"> - Foo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - - -
    -25 - FooFooFoo -<@s.if test="true"> - Foo - <@s.if test="true"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - - -
    -26 - FooMooMoo -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - <@s.elseif test="true"> - MooMoo - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - - -27 - Foo - -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - - -28 - MooFooFoo -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="true"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - -<@s.else> - Bar - - - -29 - MooMooMoo -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="false"> - FooFoo - - <@s.elseif test="true"> - MooMoo - - -<@s.else> - Bar - - - -30 - Moo - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="false"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - -<@s.else> - Bar - - - -31 - BarFooFoo - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="true"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - - -32 - BarMooMoo - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - <@s.elseif test="true"> - MooMoo - - - -33 - Bar - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - <@s.elseif test="false"> - MooMoo - - - -
    -34 - FooFooFoo - -<@s.if test="true"> - Foo - <@s.if test="true"> - FooFoo - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - - -
    -35 - Foo - -<@s.if test="true"> - Foo - <@s.if test="false"> - FooFoo - - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - - -
    -36 - MooFooFoo - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="true"> - FooFoo - - -<@s.else> - Bar - - -
    -37 - Moo - -<@s.if test="false"> - Foo - -<@s.elseif test="true"> - Moo - <@s.if test="false"> - FooFoo - - -<@s.else> - Bar - - -
    -38 - BarFooFoo - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="true"> - FooFoo - - - -
    -39 - Bar - -<@s.if test="false"> - Foo - -<@s.elseif test="false"> - Moo - -<@s.else> - Bar - <@s.if test="false"> - FooFoo - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/ifTag/testIf.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/ifTag/testIf.jsp deleted file mode 100644 index 62ec5888b..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/ifTag/testIf.jsp +++ /dev/null @@ -1,616 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - -<%@taglib prefix="s" uri="/struts-tags" %> - - - - - -Test If Tag - - -

    -This is a simple jsp to test the If Tag. There's quite a few combination being tested. -The characters in bold an non-bold should be the same. -

    - - -1 - Foo - - - Foo - - - Bar - -
    -2 - Bar - - - Foo - - - Bar - -
    -3 - FooFooFoo - - - Foo - - FooFoo - - - BarBar - - - - Bar - -
    -4 - FooBarBar - - - Foo - - FooFoo - - - BarBar - - -
    -5 - BarFooFoo - - - Foo - - - Bar - - FooFoo - - - BarBar - - -
    -6 - BarBarBar - - - Foo - - - Bar - - FooFoo - - - BarBar - - -
    -7 - Foo - - - Foo - - - Moo - - - Bar - -
    -8 - Moo - - - Foo - - - Moo - - - Bar - -
    -9 - Bar - - - Foo - - - Moo - - - Bar - -
    -10 - FooFooFoo - - - Foo - - FooFoo - - - MooMoo - - - BarBar - - - - Moo - - - Bar - -
    -11 - FooMooMoo - - - Foo - - FooFoo - - - MooMoo - - - BarBar - - - - Moo - - - Bar - -
    -12 - FooBarBar - - - Foo - - FooFoo - - - MooMoo - - - BarBar - - - - Moo - - - Bar - -
    -13 - MooFooFoo - - - Foo - - - Moo - - FooFoo - - - MooMoo - - - BarBar - - - - Bar - -
    -14 - MooMooMoo - - - Foo - - - Moo - - FooFoo - - - MooMoo - - - BarBar - - - - Bar - -
    -15 - MooBarBar - - - Foo - - - Moo - - FooFoo - - - MooMoo - - - BarBar - - - - Bar - -
    -16 - BarFooFoo - - - Foo - - - Moo - - - Bar - - FooFoo - - - MooMoo - - - BarBar - - -
    -17 - BarMooMoo - - - Foo - - - Moo - - - Bar - - FooFoo - - - MooMoo - - - BarBar - - -
    -18 - BarBarBar - - - Foo - - - Moo - - - Bar - - FooFoo - - - MooMoo - - - BarBar - - - -
    -19 - Foo - - - Foo - - -
    -20 - ** should not display anything ** - - - Foo - - -
    -21 FooFooFoo - - - Foo - - FooFoo - - - - Bar - - -
    -22 - Foo - - - Foo - - FooFoo - - - - Bar - - -
    -23 - BarFooFoo - - - Foo - - - Bar - - FooFoo - - - -
    -24 - Bar - - - Foo - - - Bar - - FooFoo - - - -
    -25 - FooFooFoo - - Foo - - FooFoo - - - MooMoo - - - - Moo - - - Bar - - -
    -26 - FooMooMoo - - Foo - - FooFoo - - - MooMoo - - - - Moo - - - Bar - - -
    -27 - Foo - - - Foo - - FooFoo - - - MooMoo - - - - Moo - - - Bar - - -
    -28 - MooFooFoo - - Foo - - - Moo - - FooFoo - - - MooMoo - - - - Bar - - -
    -29 - MooMooMoo - - Foo - - - Moo - - FooFoo - - - MooMoo - - - - Bar - - -
    -30 - Moo - - - Foo - - - Moo - - FooFoo - - - MooMoo - - - - Bar - - -
    -31 - BarFooFoo - - - Foo - - - Moo - - - Bar - - FooFoo - - - MooMoo - - - -
    -32 - BarMooMoo - - - Foo - - - Moo - - - Bar - - FooFoo - - - MooMoo - - - -
    -33 - Bar - - - Foo - - - Moo - - - Bar - - FooFoo - - - MooMoo - - - - -
    -34 - FooFooFoo - - - Foo - - FooFoo - - - - Moo - - - Bar - - -
    -35 - Foo - - - Foo - - FooFoo - - - - Moo - - - Bar - - -
    -36 - MooFooFoo - - - Foo - - - Moo - - FooFoo - - - - Bar - - -
    -37 - Moo - - - Foo - - - Moo - - FooFoo - - - - Bar - - -
    -38 - BarFooFoo - - - Foo - - - Moo - - - Bar - - FooFoo - - - -
    -39 - Bar - - - Foo - - - Moo - - - Bar - - FooFoo - - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/index.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/index.jsp deleted file mode 100644 index 2fc1a7bd4..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/index.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - Non UI Tags - - -

    Non UI Tags

    - -
      -
    • Action Tag
    • -
    • Date Tag
    • -
    • Debug Tag
    • -
    • Iterator Generator Tag
    • -
    • Append Iterator Tag -
    • Merge Iterator Demo -
    • Subset Tag -
    • Action Prefix Example
    • -
    • If Tag (JSP)
    • -
    • If Tag (Freemarker)
    • -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/appendIteratorTagDemoResult.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/appendIteratorTagDemoResult.jsp deleted file mode 100644 index 2e398de80..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/appendIteratorTagDemoResult.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tag - Non UI Tag - AppendIterator Tag - - - - - - - - - - - - -
    -
    - - Back To Non-UI Demo - Back To Showcase - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/iteratorGeneratorTagDemoResult.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/iteratorGeneratorTagDemoResult.jsp deleted file mode 100644 index efb582cdf..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/iteratorGeneratorTagDemoResult.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tag - Non Ui Tag - Iterator Generator Tag Demo - - - - - -
    -
    -
    - - Back To Non-UI Demo - Back To Showcase - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/mergeIteratorTagDemoResult.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/mergeIteratorTagDemoResult.jsp deleted file mode 100644 index 03b340d38..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/mergeIteratorTagDemoResult.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - Non UI Tag - MergeIterator Tag - - - - - - - - - - - - -
    -
    - - Back To Non-UI Demo - Back To Showcase - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showAppendIteratorTagDemo.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showAppendIteratorTagDemo.jsp deleted file mode 100644 index 838a9a128..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showAppendIteratorTagDemo.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tag - Non UI Tag - AppendIterator Tag - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showIteratorGeneratorTagDemo.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showIteratorGeneratorTagDemo.jsp deleted file mode 100644 index f076828c5..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showIteratorGeneratorTagDemo.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tag - Non Ui Tag - Iterator Generator Tag Demo - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showMergeIteratorTagDemo.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showMergeIteratorTagDemo.jsp deleted file mode 100644 index 032e27d46..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/showMergeIteratorTagDemo.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - Non UI Tag - MergeIterator Tag - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/subsetIteratorTagDemo.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/subsetIteratorTagDemo.jsp deleted file mode 100644 index 84f62495b..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/subsetIteratorTagDemo.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - Non UI Tags - SubsetTag Demo - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/subsetIteratorTagDemoResult.jsp b/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/subsetIteratorTagDemoResult.jsp deleted file mode 100644 index b34631b25..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/non-ui/iteratorTag/subsetIteratorTagDemoResult.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - Non UI Tags - Subset Tag - - - - - - - -
    -
    -
    - - Back To Non-UI Demo - Back To Showcase - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp deleted file mode 100644 index 2eb3df2bf..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp +++ /dev/null @@ -1,62 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - UI Tags - Component Tag - - - -This example tries to demonstrates the usage of <s:component ... > tag. -

    - -To have a look at the source of this jsp page click - -here -

    - -Example 1: -This example load the template from the webapp context path using -the default (ftl) as its template. - - - -

    - -Example 2: -This example load the template from the webapp context path using -jsp as its template (notice the *.jsp extension to the template). - - - -

    - -Example 3 -This example load the template from the webapp context path, -using the default template directory and theme (default to -'template' and 'xhtml' respectively) - - - -

    - - -Example 4 -This example load the template from the webapp classpath using -a custom themplate directory and theme. - - - -

    - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/dynamicTreeSelect.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/dynamicTreeSelect.jsp deleted file mode 100644 index 2c1cd2e07..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/dynamicTreeSelect.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - -Id:
    -Name:
    - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp deleted file mode 100644 index 410bbd21d..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp +++ /dev/null @@ -1,126 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - - - UI Tags Example - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm b/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm deleted file mode 100644 index e0eaf79cf..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm +++ /dev/null @@ -1,32 +0,0 @@ - - - UI Tags Example - #shead() - - - - -#surl ("id=url" "value=index.jsp") -Back to index.jsp! - - -#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 - -#sa("href=${url}")Back to index.jsp#end - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.jsp deleted file mode 100644 index 9fe707628..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Non-UI Tag - Example Submited - - - -

    Example Submitted

    - - - - - - - - - - - - - - - - - - - - - - - -
    - - .  - -
    - - .  - -
    - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm b/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm deleted file mode 100644 index e33f55229..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm +++ /dev/null @@ -1,47 +0,0 @@ - - -Showcase - Non-UI Tag - Example Submited - - - -

    Example Submitted

    - - #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): - #set ( $startCount = 1) - #foreach( $item in $leftSideCartoonCharacters) - $startCount.${item}  - #set ( $startCount = $startCount + 1) - #end -
    Favourite Cartoon Characters (Right): - #set ( $startCount = 1) - #foreach( $item in $rightSideCartoonCharacters) - $startCount.${item}  - #set ( $startCount = $startCount + 1) - #end -
    - -#surl ("id=url" "value=index.jsp") -#sa("href=${url}")Back to index.jsp#end - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/images/backgroundImage.jpg b/trunk/apps/showcase/src/main/webapp/tags/ui/images/backgroundImage.jpg deleted file mode 100644 index 0f9cb9253..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/tags/ui/images/backgroundImage.jpg and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/images/leopard.jpg b/trunk/apps/showcase/src/main/webapp/tags/ui/images/leopard.jpg deleted file mode 100644 index f67f96b75..000000000 Binary files a/trunk/apps/showcase/src/main/webapp/tags/ui/images/leopard.jpg and /dev/null differ diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp deleted file mode 100644 index a02dfb737..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Tags - UI Tags - - -

    UI Tags

    - -
      -
    • UI Example
    • -
    • UI Example (Velocity)
    • -
    • Option Transfer Select UI Example
    • -
    • Tree Example (static) -
    • Tree Example (dynamic) -
    • Component Tag Example - <%--li>UI population using iterator tag -
    - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp deleted file mode 100644 index 15569edd8..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp +++ /dev/null @@ -1,109 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Show Case - Tags - UI Tags - Optiontransferselect - - - - - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - -
    - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp deleted file mode 100644 index 5ee331474..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp +++ /dev/null @@ -1,101 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - Tags - UI Tags - Optiontransferoption Result - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Favourite Cartoons: - - .  - -
    Non Favourite Cartoons: - - .  - -
    Favourite Cars: - - .  - -
    Non Favourite Cars: - - .  - -
    Favourite Motorcycles: - - .  - -
    Non Favourite Motorcycles: - - .  - -
    Favourite Countries: - - .  - -
    Non Favourite Countries: - - .  - -
    Prioritised Favourite Cartoon Characters: - - .  - -
    Prioritised Favourite Cars: - - .  - -
    Prioritised Favourite Countries - - .  - -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/staticTreeSelect.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/staticTreeSelect.jsp deleted file mode 100644 index c08ed8a4e..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/staticTreeSelect.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - -<% - request.setAttribute("decorator", "none"); - response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 - response.setHeader("Pragma","no-cache"); //HTTP 1.0 - response.setDateHeader ("Expires", 0); //prevents caching at the proxy server -%> - - -<%-- - ---%> - -<%=request.getParameter("nodeId") %> diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp deleted file mode 100644 index 26929da2f..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - - -Showcase - UI Tag Example - Tree Example (Dynamic) - - - - - - - - - - -
    - - -
    - -
    -Please click on any of the tree nodes. -
    - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp b/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp deleted file mode 100644 index b9cf834ae..000000000 --- a/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%@taglib prefix="s" uri="/struts-tags" %> - - -Showcase - UI Tag Example - Tree Example (Static) - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - -
    -Please click on any node on the tree. -
    - - - - - \ No newline at end of file diff --git a/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp b/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp deleted file mode 100644 index 7ebb96781..000000000 --- a/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp +++ /dev/null @@ -1,9 +0,0 @@ - -<%@taglib prefix="s" uri="/struts-tags" %> - -
    -

    -JSP Custom Template - -parameter 'paramName' - -

    -
    diff --git a/trunk/apps/showcase/src/main/webapp/token/doublePost.jsp b/trunk/apps/showcase/src/main/webapp/token/doublePost.jsp deleted file mode 100644 index 6aa82231f..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/doublePost.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - -

    - Double post. Struts intercepted this request and prevents the action from executing again. -

    - -

    - Click here to return. - - - diff --git a/trunk/apps/showcase/src/main/webapp/token/example1.jsp b/trunk/apps/showcase/src/main/webapp/token/example1.jsp deleted file mode 100644 index 99aa5b809..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/example1.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Token Examples - - -

    Token Example 1

    - - Example 1: This example illustrates a situation where you can transfer money from - one account to another. We use the token to prevent double posts so the transfer only - happens once. -

    - -
    Balance of source account: -
    Balance of destination account: -

    - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/token/example2.jsp b/trunk/apps/showcase/src/main/webapp/token/example2.jsp deleted file mode 100644 index c3d99c4a0..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/example2.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Token Examples - - -

    Token Example 2

    - - Example 2: This example illustrates a situation where you can transfer money from - one account to another. We use the token to prevent double posts so the transfer only - happens once. This action will redirect after you have submitted the form. -

    - -
    Balance of source account: -
    Balance of destination account: -

    - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/token/example3.jsp b/trunk/apps/showcase/src/main/webapp/token/example3.jsp deleted file mode 100644 index c624ad6b7..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/example3.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Token Examples - - -

    Token Example 3

    - - Example 3: This example illustrates a situation where you can transfer money from - one account to another. We use the token to prevent double posts so the transfer only - happens once. This example uses the token session based interceptor and redirect after post. -

    - -
    Balance of source account: -
    Balance of destination account: -

    - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/token/example4.ftl b/trunk/apps/showcase/src/main/webapp/token/example4.ftl deleted file mode 100644 index f890ba30c..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/example4.ftl +++ /dev/null @@ -1,26 +0,0 @@ - - Token Examples - - -

    Token Example 4

    - - Example 4: This example illustrates a situation where you can transfer money from - one account to another. We use the token to prevent double posts so the transfer only - happens once. This page is rendered using freemarker. See the xwork-token.xml where - we must also use the createSession interceptor to be sure that a HttpSession exists - when freemarker renders this webpage, otherwise the @s.token tag causes an exception - while rendering the page. -

    - -
    Balance of source account: <@s.property value="#session.balanceSource"/> -
    Balance of destination account: <@s.property value="#session.balanceDestination"/> -

    - - <@s.form action="transfer4"> - <@s.token/> - <@s.textfield label="Amount" name="amount" required="true" value="400"/> - <@s.submit value="Transfer money"/> - - - - diff --git a/trunk/apps/showcase/src/main/webapp/token/index.jsp b/trunk/apps/showcase/src/main/webapp/token/index.jsp deleted file mode 100644 index 12908101b..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/index.jsp +++ /dev/null @@ -1,33 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Token Examples (double post) - - -

    Token Examples

    - - These examples illustrate Struts build in support of using tokens to prevent double post. -

    - You have a web page where user can input data and press a button to submit. - There could be a problem that the user submit the data many times, by either clicking the - button many times, or use the browser back button and then submit the form again. -
    A good solution is to use a hidden token in the form. The token is autogenerated and unique - from time to time. This token is then validated with the HttpSession that it is the first time - it is submitted, if not we have a double post and therefore can prevent the second submit action. -

    - For more information check out javadoc for org.apache.struts2.interceptor.TokenInterceptor - and org.apache.struts2.interceptor.TokenSessionStoreInterceptor. - -
    -
    Example 1 (token based .jsp example) - -
    -
    Example 2 (as example 1 with redirect after post) - -
    -
    Example 3 (token-session based .jsp example) - -
    -
    Example 4 (token based freemarker example) - - - diff --git a/trunk/apps/showcase/src/main/webapp/token/transferDone.jsp b/trunk/apps/showcase/src/main/webapp/token/transferDone.jsp deleted file mode 100644 index f296e7c47..000000000 --- a/trunk/apps/showcase/src/main/webapp/token/transferDone.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Token Examples (double post) - - -

    Token Examples

    - - The transfer is done at - -
    New balance of source account: -
    New balance of destination account: - -

    - Try using the browser back button and submit the form again. This should result in a double post - that Struts should intercept and handle accordingly. -

    - For example 3 (session token) you should notice that the date/time stays the same. This interceptor - catches that this is a double post but doens't display the double post page, but just renders the - web page result from the first post. - -

    - Click here to return. - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/clientSideValidationExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/clientSideValidationExample.jsp deleted file mode 100644 index 2c19f01d1..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/clientSideValidationExample.jsp +++ /dev/null @@ -1,55 +0,0 @@ -<%-- - fieldValidatorExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Validation - Field Validators Example - - - - - - - - -

    All Field Errors Will Appear Here

    - -
    - -

    Field Error due to 'Required String Validator Field' Will Appear Here

    - - - -
    - -

    Field Error due to 'String Length Validator Field' Will Appear Here

    - - stringLengthValidatorField - -
    - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/fieldValidatorsExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/fieldValidatorsExample.jsp deleted file mode 100644 index 8938fe12c..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/fieldValidatorsExample.jsp +++ /dev/null @@ -1,55 +0,0 @@ -<%-- - fieldValidatorExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Validation - Field Validators Example - - - - - - - - -

    All Field Errors Will Appear Here

    - -
    - -

    Field Error due to 'Required String Validator Field' Will Appear Here

    - - - -
    - -

    Field Error due to 'String Length Validator Field' Will Appear Here

    - - stringLengthValidatorField - -
    - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/footer.jsp b/trunk/apps/showcase/src/main/webapp/validation/footer.jsp deleted file mode 100644 index 11828c8fb..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/footer.jsp +++ /dev/null @@ -1,9 +0,0 @@ - <%@taglib prefix="s" uri="/struts-tags" %> - -
    - - - - -Back To Validation Examples  -Back To Showcase diff --git a/trunk/apps/showcase/src/main/webapp/validation/index.jsp b/trunk/apps/showcase/src/main/webapp/validation/index.jsp deleted file mode 100644 index f3860de1a..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/index.jsp +++ /dev/null @@ -1,42 +0,0 @@ -<%-- - index.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Validation - - -

    Validation Examples

    - - - - - - - - - - - - -
      -
    • Validation (basic)
    • -
    • Validation (client)
    • -
    • Validation (client using css_xhtml theme)
    • -
    • Validation (ajax)
    • -
    • Field Validators
    • -
    • Non Field Validator
    • -
    • Visitor Validator
    • -
    • Client side validation using JavaScript
    • -
    • Back To Showcase -
    • Store across request using MessageStoreInterceptor (Example)
    • -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/nonFieldValidatorsExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/nonFieldValidatorsExample.jsp deleted file mode 100644 index 04800872d..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/nonFieldValidatorsExample.jsp +++ /dev/null @@ -1,38 +0,0 @@ -<%-- - nonFieldValidatorsExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - - -<%@taglib prefix="s" uri="/struts-tags" %> - - - - Showcase - Validation - Non Field Validator Example - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/quiz-ajax.jsp b/trunk/apps/showcase/src/main/webapp/validation/quiz-ajax.jsp deleted file mode 100644 index 22840de97..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/quiz-ajax.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - - Validation - Basic - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/quiz-basic.jsp b/trunk/apps/showcase/src/main/webapp/validation/quiz-basic.jsp deleted file mode 100644 index 6d75c51d6..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/quiz-basic.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - - Validation - Basic - - - - - -What is your favorite color? -

    - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/quiz-client-css.jsp b/trunk/apps/showcase/src/main/webapp/validation/quiz-client-css.jsp deleted file mode 100644 index ac62bb2b7..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/quiz-client-css.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - - Validation - Basic - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/quiz-client.jsp b/trunk/apps/showcase/src/main/webapp/validation/quiz-client.jsp deleted file mode 100644 index 0517e0569..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/quiz-client.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - - - - Validation - Basic - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/quiz-success.jsp b/trunk/apps/showcase/src/main/webapp/validation/quiz-success.jsp deleted file mode 100644 index 738097a6c..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/quiz-success.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - Quiz submitted! - - - - -Thank you, . Your answer has been submitted as: - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestCancel.jsp b/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestCancel.jsp deleted file mode 100644 index ef6efcb49..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestCancel.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - -<%@taglib prefix="s" uri="/tags" %> - - - -Insert title here - - - - - - - -

    Application Canceled

    - - Try Again - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestExample.jsp deleted file mode 100644 index 1986e8c8d..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestExample.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/tags" %> - - - - -Showcase - Validation - Store Errors Across Request Example - - -

    - This is an example demonstrating the use of MessageStoreInterceptor. - When this form is submited a redirect is issue both when there's a validation - error or not. Normally, when a redirect is issue the action messages / errors and - field errors stored in the action will be lost (due to an action lives - only as long as a request). With a MessageStoreInterceptor in place and - configured, the action errors / messages / field errors will be store and - remains retrieveable even after a redirect. -

    -

    - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestOk.jsp b/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestOk.jsp deleted file mode 100644 index c60638f8d..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/storeErrorsAcrossRequestOk.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib prefix="s" uri="/tags" %> - - - - -Showcase - Validation - Store Errors Across Request Example - - - - - - - -

    Ok !

    - - - Try Again - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/successClientSideValidationExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/successClientSideValidationExample.jsp deleted file mode 100644 index 77f111c2d..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/successClientSideValidationExample.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%-- - successFieldValidatorsExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - -<%@taglib prefix="s" uri="/struts-tags" %> - - - Showcase - Validation - SuccessFieldValidatorsExample - -

    Success !

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Required Validator Field:
    Required String Validator Field:
    Integer Validator Field:
    Date Validator Field:
    Email Validator Field:
    URL Validator Field:
    String Length Validator Field:
    Regex Validator Field: Field Expression Validator Field:
    - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/successFieldValidatorsExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/successFieldValidatorsExample.jsp deleted file mode 100644 index 5e83be49c..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/successFieldValidatorsExample.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%-- - successFieldValidatorsExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - -<%@taglib prefix="s" uri="/struts-tags" %> - - - Showcase - Validation - SuccessFieldValidatorsExample - -

    Success !

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Required Validator Field:
    Required String Validator Field:
    Integer Validator Field:
    Date Validator Field:
    Email Validator Field:
    String Length Validator Field:
    Regex Validator Field: Field Expression Validator Field:
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/successNonFieldValidatorsExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/successNonFieldValidatorsExample.jsp deleted file mode 100644 index bc22e4fa9..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/successNonFieldValidatorsExample.jsp +++ /dev/null @@ -1,33 +0,0 @@ -<%-- - successNonFieldValidatorsExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - - -<%@taglib prefix="s" uri="/struts-tags" %> - - - Showcase - Validation - SuccessNonFieldValidatorsExample - -

    Success !

    - - - - - - - - - - - - - -
    Some Text:
    Some Text Retyped:
    Some Text Retyped Again:
    - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/successVisitorValidatorsExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/successVisitorValidatorsExample.jsp deleted file mode 100644 index 90e2b42ad..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/successVisitorValidatorsExample.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%-- - successVisitorValidatorsExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - - - -<%@taglib prefix="s" uri="/struts-tags" %> - - - Showcase - Validation - SuccessVisitorValidatorsExameple - -

    Success !

    - - - - - - - - - - - - - -
    User Name:
    User Age:
    User Birthday:
    - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/validation/validationExamplesStyles.css b/trunk/apps/showcase/src/main/webapp/validation/validationExamplesStyles.css deleted file mode 100644 index 961be7c2b..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/validationExamplesStyles.css +++ /dev/null @@ -1,11 +0,0 @@ -@CHARSET "UTF-8"; - -@CHARSET "UTF-8"; - -.errorMessage { - color: red; -} - -/*.errorLabel { - color: red; -}*/ diff --git a/trunk/apps/showcase/src/main/webapp/validation/visitorValidatorsExample.jsp b/trunk/apps/showcase/src/main/webapp/validation/visitorValidatorsExample.jsp deleted file mode 100644 index 0300a4fd6..000000000 --- a/trunk/apps/showcase/src/main/webapp/validation/visitorValidatorsExample.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%-- - visitorValidatorsExample.jsp - - @author tm_jee - @version $Date$ $Id$ ---%> - - -<%@taglib prefix="s" uri="/struts-tags" %> - - -Showcase - Validation - VisitorValidatorsExample - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/viewSource.jsp b/trunk/apps/showcase/src/main/webapp/viewSource.jsp deleted file mode 100644 index eac6c32ec..000000000 --- a/trunk/apps/showcase/src/main/webapp/viewSource.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - View Sources - - - "> - "> - " media="print"> - - - - -

    View Sources

    - - - -

    ${empty page ? "Unknown page" : page}

    -
    -
    -${row.count}: 
    -
    -
    - -

    ${empty config ? "Unknown configuration" : config}

    -
    -
    -
    -${configLine - padding + row.count - 1}: 
    -${configLine - padding + row.count - 1}: 
    -
    -
    - -

    ${empty className ? "Unknown or unavailable Action class" : className}

    -
    -
    -${row.count}: 
    -
    -
    - -
    - - - diff --git a/trunk/apps/showcase/src/main/webapp/wait/complete.jsp b/trunk/apps/showcase/src/main/webapp/wait/complete.jsp deleted file mode 100644 index f124310ec..000000000 --- a/trunk/apps/showcase/src/main/webapp/wait/complete.jsp +++ /dev/null @@ -1,13 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Execute and Wait Examples - - -

    The process is complete

    - - We have processed your request. -

    - Click here to return. - - - diff --git a/trunk/apps/showcase/src/main/webapp/wait/example1.jsp b/trunk/apps/showcase/src/main/webapp/wait/example1.jsp deleted file mode 100644 index d3c1d835f..000000000 --- a/trunk/apps/showcase/src/main/webapp/wait/example1.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Execute and Wait Examples - - -

    Execute and Wait Example 1

    - - Example 1: In the form below enter how long time to simulate the process should take. - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/wait/example2.jsp b/trunk/apps/showcase/src/main/webapp/wait/example2.jsp deleted file mode 100644 index 484636c03..000000000 --- a/trunk/apps/showcase/src/main/webapp/wait/example2.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Execute and Wait Examples - - -

    Execute and Wait Example 2

    - - Example 2: As example 1 but uses a delay of 2000 millis before the wait page is shown. Try simulating with - a value of 500 millis to see that no wait page is shown at all. - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/wait/example3.jsp b/trunk/apps/showcase/src/main/webapp/wait/example3.jsp deleted file mode 100644 index 3fe65044c..000000000 --- a/trunk/apps/showcase/src/main/webapp/wait/example3.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Execute and Wait Examples - - -

    Execute and Wait Example 3

    - - Example 3: As example 1 but uses a delay of 3000 millis before the wait page is shown. - While waiting for the wait page it will check every 1000 millis if the background process is already - done. Try simulating with a value of 700 millis to see that the wait page is shown soon thereafter. - - - - - - - - diff --git a/trunk/apps/showcase/src/main/webapp/wait/index.jsp b/trunk/apps/showcase/src/main/webapp/wait/index.jsp deleted file mode 100644 index 566bc55b4..000000000 --- a/trunk/apps/showcase/src/main/webapp/wait/index.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - Execute and Wait Examples - - -

    Execute and Wait Examples

    - - These examples illustrate Struts build in support for execute and wait. -

    - When you have a process that takes a long time your users can be impatient and starts to submit/click again. -
    A good solution is to show the user a progress page (wait page) while the process takes it time. - -
    -
    Example 1 (no delay) -
    Example 2 (with delay) -
    Example 2 (with longer check delay) - - - diff --git a/trunk/apps/showcase/src/main/webapp/wait/wait.jsp b/trunk/apps/showcase/src/main/webapp/wait/wait.jsp deleted file mode 100644 index 7913943e7..000000000 --- a/trunk/apps/showcase/src/main/webapp/wait/wait.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ taglib prefix="s" uri="/struts-tags" %> - - - "/> - - - -

    - We are processing your request. Please wait. -

    - -

    - You can click this link to ">refresh. - - - diff --git a/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java b/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java deleted file mode 100644 index e309ff0d6..000000000 --- a/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import junit.framework.TestCase; - -/** - * An example text class to verify the configuration. - */ -public class HelloTest extends TestCase { - - /** - * An example test that asserts true. - * - * @throws Exception On invalid assertions - */ - public void testHelloAction() throws Exception { - assertTrue(true); - } -} diff --git a/trunk/assembly/pom.xml b/trunk/assembly/pom.xml deleted file mode 100644 index 72d652ba8..000000000 --- a/trunk/assembly/pom.xml +++ /dev/null @@ -1,442 +0,0 @@ - - - - - 4.0.0 - org.apache.struts - struts2-assembly - pom - Struts 2 Assembly - - Struts 2 Assembly - - - - org.apache.struts - struts2-parent - 2.0.1 - - - - scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/assembly - - scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/assembly - http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/assembly - - - - - - org.codehaus.mojo - dependency-maven-plugin - - - copy-war - package - - copy - - - - - org.apache.struts - struts2-blank - ${version} - war - - - org.apache.struts - struts2-mailreader - ${version} - war - - - org.apache.struts - struts2-portlet - ${version} - war - - - org.apache.struts - struts2-showcase - ${version} - war - - - org.apache.struts - struts2-mailreader - ${version} - war - - - ${project.build.directory}/apps - - - - xwork-javadoc - package - - unpack - - - - - opensymphony - xwork - javadoc - 2.0-beta-1 - - - ${project.build.directory}/xwork-apidocs - - - - - - maven-assembly-plugin - 2.0.1 - - - src/main/assembly/all.xml - src/main/assembly/lib.xml - src/main/assembly/apps.xml - src/main/assembly/src.xml - - struts-${version} - target/assembly/out - target/assembly/work - - - - - - - - - org.apache.struts - struts2-api - ${version} - - - org.apache.struts - struts2-core - ${version} - - - - org.apache.struts - struts2-all - ${version} - - - - org.apache.struts - struts2-config-browser-plugin - ${version} - - - - org.apache.struts - struts2-jasperreports-plugin - ${version} - - - - org.apache.struts - struts2-jfreechart-plugin - ${version} - - - - org.apache.struts - struts2-jsf-plugin - ${version} - - - - org.apache.struts - struts2-pell-multipart-plugin - ${version} - - - - org.apache.struts - struts2-plexus-plugin - ${version} - - - - org.apache.struts - struts2-quickstart-plugin - ${version} - - - - org.apache.struts - struts2-sitegraph-plugin - ${version} - - - - org.apache.struts - struts2-sitemesh-plugin - ${version} - - - - org.apache.struts - struts2-struts1-plugin - ${version} - - - - org.apache.struts - struts2-tiles-plugin - ${version} - - - - - - javax.servlet - jsp-api - 2.0 - provided - - - - commons-lang - commons-lang - 2.0 - provided - - - - - uk.ltd.getahead - dwr - 1.1-beta-3 - provided - - - - - velocity - velocity - 1.4 - provided - - - - velocity-tools - velocity-tools - 1.1 - provided - - - - - commons-fileupload - commons-fileupload - 1.1.1 - provided - - - - - opensymphony - sitemesh - 2.2.1 - provided - - - - - jetty - org.mortbay.jetty - 5.1.4 - provided - - - - eclipse - jdtcore - 3.1.0 - provided - - - - ant - ant - 1.6.5 - provided - - - - tomcat - jasper-compiler - 5.5.12 - provided - - - - tomcat - jasper-runtime - 5.5.12 - provided - - - - tomcat - jasper-compiler-jdt - 5.5.12 - provided - - - - commons-el - commons-el - 1.0 - provided - - - - commons-io - commons-io - 1.0 - provided - - - - commons-lang - commons-lang - 2.1 - provided - - - - - xstream - xstream - 1.1.2 - provided - - - - - org.apache.struts.tiles - tiles-core - 0.2-SNAPSHOT - provided - - - commons-digester - commons-digester - 1.7 - provided - - - - - portlet-api - portlet-api - 1.0 - provided - - - - org.apache.pluto - pluto - 1.0.1-rc4 - provided - - - - - org.codehaus.plexus - plexus-container-default - 1.0-alpha-10-SNAPSHOT - provided - - - - - org.springframework - spring-beans - 1.2.8 - provided - - - - org.springframework - spring-core - 1.2.8 - provided - - - - org.springframework - spring-context - 1.2.8 - provided - - - - org.springframework - spring-web - 1.2.8 - provided - - - - org.springframework - spring-mock - 1.2.8 - provided - - - - - myfaces - myfaces-jsf-api - 1.0.9 - provided - - - - org.rifers - rife-continuations - 0.0.2 - provided - - - - - javax.servlet - servlet-api - 2.4 - provided - - - - - diff --git a/trunk/assembly/src/main/assembly/all.xml b/trunk/assembly/src/main/assembly/all.xml deleted file mode 100644 index 4724a49d6..000000000 --- a/trunk/assembly/src/main/assembly/all.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - all - - zip - - - - lib - runtime - - - - - src/main/resources - - - README* - LICENSE* - NOTICE* - - - - target/apps - apps - - *.war - - - - - - target/xwork-apidocs - docs/xwork-apidocs - - - - - ../target/site - docs - - - ../api/target/site - docs/struts2-api - - - ../core/target/site - docs/struts2-core - - - - - - ../plugins/config-browser/target/site - docs/struts2-plugins/struts2-config-browser-plugin - - - ../plugins/jasperreports/target/site - docs/struts2-plugins/struts2-jasperreports-plugin - - - ../plugins/jfreechart/target/site - docs/struts2-plugins/struts2-jfreechart-plugin - - - ../plugins/jsf/target/site - docs/struts2-plugins/struts2-jsf-plugin - - - ../plugins/pell-multipart/target/site - docs/struts2-plugins/struts2-pell-multipart-plugin - - - ../plugins/plexus/target/site - docs/struts2-plugins/struts2-plexus-plugin - - - ../plugins/quickstart/target/site - docs/struts2-plugins/struts2-quickstart-plugin - - - ../plugins/struts1/target/site - docs/struts2-plugins/struts2-struts1-plugin - - - ../plugins/sitegraph/target/site - docs/struts2-plugins/struts2-sitegraph-plugin - - - ../plugins/sitemesh/target/site - docs/struts2-plugins/struts2-sitemesh-plugin - - - ../plugins/tiles/target/site - docs/struts2-plugins/struts2-tiles-plugin - - - - - ../ - src/ - - pom.xml - src/ - - - - ../api - src/api - - pom.xml - src/ - - - - ../apps - src/apps - - pom.xml - src/ - - - - ../apps/blank - src/apps/blank - - pom.xml - src/ - - - - ../apps/portlet - src/apps/portlet - - pom.xml - src/ - - - - ../apps/showcase - src/apps/showcase - - pom.xml - src/ - - - - ../assembly - src/assembly - - pom.xml - src/ - - - - ../core - src/core - - pom.xml - src/ - - - - diff --git a/trunk/assembly/src/main/assembly/apps.xml b/trunk/assembly/src/main/assembly/apps.xml deleted file mode 100644 index 28d77c100..000000000 --- a/trunk/assembly/src/main/assembly/apps.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - apps - - zip - - - - src/main/resources - - - README* - LICENSE* - NOTICE* - - - - target/apps - apps - - *.war - - - - diff --git a/trunk/assembly/src/main/assembly/lib.xml b/trunk/assembly/src/main/assembly/lib.xml deleted file mode 100644 index d3107d181..000000000 --- a/trunk/assembly/src/main/assembly/lib.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - lib - - zip - - - - lib - runtime - - - - - src/main/resources - - - README* - LICENSE* - NOTICE* - - - - diff --git a/trunk/assembly/src/main/assembly/src.xml b/trunk/assembly/src/main/assembly/src.xml deleted file mode 100644 index c4c5fedd0..000000000 --- a/trunk/assembly/src/main/assembly/src.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - src - - zip - - true - - - lib - optional - - - lib - compile - - - lib - provided - - - - - - src/main/resources - - - README* - LICENSE* - NOTICE* - build.xml - - - - - - ../ - src/ - - pom.xml - src/ - - - - ../api - src/api - - pom.xml - src/ - - - - ../apps - src/apps - - pom.xml - src/ - - - - ../apps/blank - src/apps/blank - - pom.xml - src/ - - - - ../apps/portlet - src/apps/portlet - - pom.xml - src/ - - - - ../apps/showcase - src/apps/showcase - - pom.xml - src/ - - - - ../assembly - src/assembly - - pom.xml - src/ - - - - ../core - src/core - - pom.xml - src/ - - - - - diff --git a/trunk/assembly/src/main/resources/LICENSE.txt b/trunk/assembly/src/main/resources/LICENSE.txt deleted file mode 100644 index dd5b3a58a..000000000 --- a/trunk/assembly/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,174 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. diff --git a/trunk/assembly/src/main/resources/NOTICE.txt b/trunk/assembly/src/main/resources/NOTICE.txt deleted file mode 100644 index 439eb83b2..000000000 --- a/trunk/assembly/src/main/resources/NOTICE.txt +++ /dev/null @@ -1,3 +0,0 @@ -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/trunk/assembly/src/main/resources/build.xml b/trunk/assembly/src/main/resources/build.xml deleted file mode 100644 index d93200b75..000000000 --- a/trunk/assembly/src/main/resources/build.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/backport/ASM-LICENSE.txt b/trunk/backport/ASM-LICENSE.txt deleted file mode 100755 index 9496b1785..000000000 --- a/trunk/backport/ASM-LICENSE.txt +++ /dev/null @@ -1,28 +0,0 @@ - - ASM: a very small and fast Java bytecode manipulation framework - Copyright (c) 2000-2005 INRIA, France Telecom - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. diff --git a/trunk/backport/LICENSE.txt b/trunk/backport/LICENSE.txt deleted file mode 100644 index 28c9615e4..000000000 --- a/trunk/backport/LICENSE.txt +++ /dev/null @@ -1,29 +0,0 @@ - Retrotranslator: a Java bytecode transformer that translates Java classes - compiled with JDK 5.0 into classes that can be run on JVM 1.4. - - Copyright (c) 2005, 2006 Taras Puchko - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. diff --git a/trunk/backport/RETROTRANSLATOR-LICENSE.txt b/trunk/backport/RETROTRANSLATOR-LICENSE.txt deleted file mode 100755 index 28c9615e4..000000000 --- a/trunk/backport/RETROTRANSLATOR-LICENSE.txt +++ /dev/null @@ -1,29 +0,0 @@ - Retrotranslator: a Java bytecode transformer that translates Java classes - compiled with JDK 5.0 into classes that can be run on JVM 1.4. - - Copyright (c) 2005, 2006 Taras Puchko - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. diff --git a/trunk/backport/S2-FOR-J4-README.txt b/trunk/backport/S2-FOR-J4-README.txt deleted file mode 100755 index 7d845dc11..000000000 --- a/trunk/backport/S2-FOR-J4-README.txt +++ /dev/null @@ -1,22 +0,0 @@ -STRUTS 2 FOR JAVA 4 - -Struts 2 is targeted for Java 5, but a "backported" version to Java 4 is being made available, -using the RetroTranslator tool. - -To use Struts 2 with Java 4 (preferably Java 1.4.2), place the enclosed Struts, XWork, -RetroTranslator, and backport-util-concurrent JARs on your classpath. For complete details on -using RetroTranslator JARs, see the RetroTranslator site. - -* http://retrotranslator.sourceforge.net/ - -NOTE: The Struts 2 and XWork 2 JARs are complete replacements for the corresponding standard -Java 5 JARs. Do not use both sets of JARs in the same environment! - -If you discover any issues using the Struts 2 for Java 4 JAR, please report them to the Struts -Dev list or JIRA ticket ww-1391. - -* http://struts.apache.org/mail.html - -* https://issues.apache.org/struts/browse/WW-1391 - -Cheers! diff --git a/trunk/backport/STRUTS-LICENSE.txt b/trunk/backport/STRUTS-LICENSE.txt deleted file mode 100755 index c6055ec8f..000000000 --- a/trunk/backport/STRUTS-LICENSE.txt +++ /dev/null @@ -1,174 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. diff --git a/trunk/backport/XWORK-LICENSE.txt b/trunk/backport/XWORK-LICENSE.txt deleted file mode 100755 index ccae16959..000000000 --- a/trunk/backport/XWORK-LICENSE.txt +++ /dev/null @@ -1,50 +0,0 @@ -/* ==================================================================== - * The OpenSymphony Software License, Version 1.1 - * - * (this license is derived and fully compatible with the Apache Software - * License - see http://www.apache.org/LICENSE.txt) - * - * Copyright (c) 2001-2004 The OpenSymphony Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * OpenSymphony Group (http://www.opensymphony.com/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "OpenSymphony" and "The OpenSymphony Group" - * must not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact license@opensymphony.com . - * - * 5. Products derived from this software may not be called "OpenSymphony" - * or "XWork", nor may "OpenSymphony" or "XWork" appear in their - * name, without prior written permission of the OpenSymphony Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - */ \ No newline at end of file diff --git a/trunk/backport/backport-util-concurrent.jar b/trunk/backport/backport-util-concurrent.jar deleted file mode 100755 index 20a16877b..000000000 Binary files a/trunk/backport/backport-util-concurrent.jar and /dev/null differ diff --git a/trunk/backport/readme.html b/trunk/backport/readme.html deleted file mode 100644 index d4cafcf89..000000000 --- a/trunk/backport/readme.html +++ /dev/null @@ -1,549 +0,0 @@ - - - - Retrotranslator - - - - - - - - -

    Retrotranslator

    SourceForge.net Logo -
    - -

    Contents

    -
      -
    1. What is Retrotranslator?
    2. -
    3. What Java 5 features are supported?
    4. -
    5. How to use Retrotranslator from a command line?
    6. -
    7. How to use Retrotranslator from Apache Ant or Maven?
    8. -
    9. How to use Retrotranslator from IntelliJ IDEA?
    10. -
    11. How to use Just-in-Time Retrotranslator?
    12. -
    13. What Java 5 classes and methods are supported?
    14. -
    15. How to write an extension for Retrotranslator?
    16. -
    17. What are the limitations?
    18. -
    19. Alternative tools
    20. -
    21. Contact
    22. -
    23. License
    24. -
    - -

    What is Retrotranslator?

    -Retrotranslator is a Java bytecode transformer -that translates Java classes compiled with JDK 5.0 into classes that can be run on JVM 1.4. -It is a free, open-source tool based on the ASM bytecode manipulation framework -and concurrency utilities -backported to Java 1.4. - -

    What Java 5 features are supported?

    -
      -
    • Generics (generic types)
    • -
    • Annotations (metadata)
    • -
    • Reflection on generics and annotations
    • -
    • Typesafe enums (enumerated types)
    • -
    • Autoboxing/unboxing
    • -
    • Enhanced for loop (for-each loop)
    • -
    • Varargs (variable arguments)
    • -
    • Covariant return types
    • -
    • Static import
    • -
    • Concurrency utilities
    • -
    • Collections framework enhancements
    • -
    - -

    How to use Retrotranslator from a command line?

    -
      -
    1. Download - and unzip the binary distribution file Retrotranslator-n.n.n-bin.zip, - where n.n.n is the latest Retrotranslator release number. -
    2. -
    3. - Compile your classes with JDK 5.0 and put them into some directory, e.g. myclasses. -
    4. -
    5. - Go to the unzipped directory Retrotranslator-n.n.n-bin and execute:
      - java -jar retrotranslator-transformer-n.n.n.jar -srcdir myclasses -
    6. -
    7. - If you use Java 5 API put retrotranslator-runtime-n.n.n.jar and - backport-util-concurrent.jar into the classpath of your application. -
    8. -
    9. - Run or debug the application as usual on any JVM 1.4, preferably JRE 1.4.2. -
    10. -
    - -

    The full command line syntax:
    - java -jar retrotranslator-transformer-n.n.n.jar <options> -
    or
    - java -cp retrotranslator-transformer-n.n.n.jar net.sf.retrotranslator.transformer.Retrotranslator <options>

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    OptionDescriptionDefault
    -srcdirDirectory with classes compiled using JDK 5.0 (may be specified several times).-
    -srcjarJAR file with classes compiled using JDK 5.0 (may be specified several times).-
    -destdirDirectory to place classes compatible with J2SE 1.4.Location of sources
    -destjarJAR file to place classes compatible with J2SE 1.4.Location of sources
    -stripsignAsks the translator to strip signature (generics) information.Off
    -verboseAsks the translator for verbose output.Off
    -lazyAsks the translator to transform only Java 5 classes.Off
    -advancedAllows to override Java 1.4 methods for better Java 5 compatibility.Off
    -verifyAsks the translator for warnings when references to unknown classes, methods, or fields are found.Off
    -classpathThe classpath to use for verification including rt.jar, jce.jar, - jsse.jar (from JRE 1.4), retrotranslator-runtime-n.n.n.jar, - and backport-util-concurrent.jar.Current classpath
    -srcmaskFiles to translate (either bytecode or UTF-8 text) , e.g. "*.class;*.tld". - Only three special characters are supported: "*?;".*.class
    -embedPackage name for a private copy of retrotranslator-runtime-n.n.n.jar and - backport-util-concurrent.jar to be put into -destdir or -destjar. - This makes your application independent of other versions of Retrotranslator present in the classpath. - -
    -retainapiAsks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API. - References introduced by a compiler will also remain unchanged, - like the use of java.lang.StringBuilder for string concatenation - or the implicit valueOf method call for autoboxing.Off
    -

    - For example, if you have a Java 5 application myapplication5.jar you can use the following command - to produce myapplication4.jar that will run on J2SE 1.4 and is independent of Retrotranslator, - since required classes are added to the translated application with a different package name: -

    -

    - java -jar retrotranslator-transformer-n.n.n.jar - -srcjar myapplication5.jar -destjar myapplication4.jar -embed com.mycompany.internal
    -

    - -

    How to use Retrotranslator from Apache Ant or Maven?

    - -

    The distribution contains an integrated Apache Ant task - net.sf.retrotranslator.transformer.RetrotranslatorTask. It has the following syntax:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    AttributeDescriptionDefault
    srcdirDirectory with classes compiled using JDK 5.0.-
    srcjarJAR file with classes compiled using JDK 5.0.-
    destdirDirectory to place classes compatible with J2SE 1.4.Location of sources
    destjarJAR file to place classes compatible with J2SE 1.4.Location of sources
    stripsignAsks the translator to strip signature (generics) information.Off
    verboseAsks the translator for verbose output.Off
    lazyAsks the translator to transform only Java 5 classes.Off
    advancedAllows to override Java 1.4 methods for better Java 5 compatibility.Off
    verifyAsks the translator for warnings when references to unknown classes, methods, or fields are found.Off
    classpathThe classpath to use for verification including rt.jar, jce.jar, - jsse.jar (from JRE 1.4), retrotranslator-runtime-n.n.n.jar, - and backport-util-concurrent.jar. - Current classpath
    srcmaskFiles to translate (either bytecode or UTF-8 text) , e.g. "*.class;*.tld". - Only three special characters are supported: "*?;".*.class
    embedPackage name for a private copy of retrotranslator-runtime-n.n.n.jar and - backport-util-concurrent.jar to be put into -destdir or -destjar. - This makes your application independent of other versions of Retrotranslator present in the classpath. - -
    retainapiAsks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API. - References introduced by a compiler will also remain unchanged, - like the use of java.lang.StringBuilder for string concatenation - or the implicit valueOf method call for autoboxing.Off
    failonwarningIndicates whether the build will fail when there are verification warnings.On
    -

    - You may use nested src elements to specify source directories or JAR files, and nested - classpath elements to specify classpath for verification. For example: -

    -
    -    <path id="classpath">
    -        <fileset dir="lib" includes="**/*.jar"/>
    -    </path>
    -    <taskdef name="retrotranslator" classpathref="classpath"
    -             classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" />
    -    <retrotranslator destdir="build/classes14" verify="true">
    -        <src path="build/classes15"/>
    -        <classpath location="${java14_home}/jre/lib/rt.jar"/>
    -        <classpath refid="classpath"/>
    -    </retrotranslator>
    -
    -

    - For Maven there is a - Retrotranslator plugin - from the Mojo Project. -

    -

    How to use Retrotranslator from IntelliJ IDEA?

    -

    - To automatically translate and verify classes compiled by IntelliJ IDEA - you may download a plugin - that generates classes compatible with 1.4 virtual machines from your Java 5 source code. -

    - -

    How to use Just-in-Time Retrotranslator?

    - -

    - JIT Retrotranslator is able to translate at runtime Java classes loaded with any classloader. - It works on J2SE 1.4 from Sun, IBM, BEA, and Apple, but does nothing on J2SE 5.0 and other platforms. - However translation at runtime consumes additional memory and processing resources and it will not - work if your classes make use of Java 5 API but were compiled with "-target 1.4". -

    -
      -
    • - If you want to run a JAR file with the JIT, execute:
      - java -cp retrotranslator-transformer-n.n.n.jar - net.sf.retrotranslator.transformer.JITRetrotranslator -jar <jarfile> [<args...>] -
    • -
    • - When the first option does not work or if you just want to run a class from your classpath, execute:
      - java -cp retrotranslator-transformer-n.n.n.jar:<classpath> - net.sf.retrotranslator.transformer.JITRetrotranslator <class> [<args...>] -
    • -
    • - Alternatively you may simply call JITRetrotranslator.install() from some JVM 1.4 compatible class - before Java 5 classes are loaded. -
    • -
    - -

    What Java 5 classes and methods are supported?

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PackageClassMethods and fieldsCompatibility notes
    java.lang.annotation* (all classes)* (all methods) 
    java.util.concurrent,
    java.util.concurrent.atomic,
    java.util.concurrent.locks
    almost all classesalmost all methods - Backport of JSR 166
    - Condition.awaitNanos(long) method is supported but with - - very little accuracy guarantees. -
    java.ioCloseable* - new Closeable[...] is replaced with new Object[...] -
    Flushable* - new Flushable[...] is replaced with new Object[...] -
    PrintStream - append(CharSequence), append(CharSequence, int, int), append(char) -  
    PrintWriter - PrintWriter(File), PrintWriter(File, String), PrintWriter(String), PrintWriter(String, String) -  
    Readerread(CharBuffer) 
    Writer - append(CharSequence), append(CharSequence, int, int), append(char) -  
    java.langAppendable* - - new Appendable[...] is replaced with new Object[...] -
    BooleanparseBoolean(String), compareTo(Boolean) 
    BytevalueOf(byte) 
    CharactervalueOf(char) 
    Class* (21 new methods) - Class.getMethod(String, Class...) and Class.getDeclaredMethod(String, Class...) are - intercepted in advanced mode to better support generics and covariant return types on several JVM implementations. -
    Deprecated* 
    DoublevalueOf(double) 
    Enum* 
    FloatvalueOf(float) 
    IllegalArgumentExceptionIllegalArgumentException(String, Throwable),
    - IllegalArgumentException(Throwable)
     
    IllegalStateExceptionIllegalStateException(String, Throwable),
    - IllegalStateException(Throwable)
     
    IntegervalueOf(int) 
    Iterable* - new Iterable[...] is replaced with new Object[...] -
    LongvalueOf(long) 
    Package* (4 new methods) 
    Readable* - new Readable[...] is replaced with new Object[...] -
    ShortvalueOf(short) 
    Stringcontains(CharSequence),
    contentEquals(CharSequence),
    - replace(CharSequence, CharSequence)
     
    StringBuffer - StringBuffer(CharSequence), append(CharSequence), append(CharSequence, int, int), - insert(int, CharSequence), insert(int, CharSequence, int, int) -  
    StringBuilder - All methods supported in StringBuffer - StringBuilder is replaced with StringBuffer
    SuppressWarnings* 
    SystemnanoTime(), clearProperty(String) - Backport of JSR 166
    - System.nanoTime() method precision - - may vary on different platforms. -
    ThreadgetStackTrace(), getId() - Thread.getStackTrace() returns non-empty stack trace only for the current thread;
    - Thread.getId() does not reflect the order in which threads are created.
    TypeNotPresentException* 
    java.lang.reflectAnnotatedElement* - new AnnotatedElement[...] is replaced with new Object[...] -
    Constructor* (11 new methods) 
    Field* (8 new methods) 
    GenericArrayType* 
    GenericDeclaration* - new GenericDeclaration[...] is replaced with new Object[...] -
    GenericSignatureFormatError* 
    MalformedParameterizedTypeException* 
    Method* (14 new methods) 
    ParameterizedType* 
    Type* - new Type[...] is replaced with new Object[...] -
    TypeVariable* 
    WildcardType* 
    java.mathBigDecimal - BigDecimal(int), BigDecimal(long), ZERO, ONE, TEN, divideAndRemainder(BigDecimal), - divideToIntegralValue(BigDecimal), pow(int), remainder(BigDecimal), toPlainString(), valueOf(double), - valueOf(long)BigDecimal.setScale(int, int) supports negative scales in advanced mode.
    java.rmi.serverRemoteObjectInvocationHandler* 
    java.util.nioCharBuffer - append(CharSequence), append(CharSequence, int, int), append(char), read(CharBuffer) -  
    java.utilAbstractQueue* -  
    Arrays* (21 new methods) 
    Collections* (13 new methods) - Backport of JSR 166 -
    EnumMap* 
    EnumSet* 
    LinkedList* (5 new methods) 
    PriorityQueue* 
    Queue* - new Queue[...] is replaced with new Object[...] -
    UUID* 
    java.util.regexMatcher - quoteReplacement(String), toMatchResult() 
    MatchResult* - new MatchResult[...] is replaced with new Object[...] -
    Patternquote(String) 
    - -

    How to write an extension for Retrotranslator?

    - -

    - Since most backported classes are discovered by Retrotranslator at translation time, - you may write an extension and simply put it into the Retrotranslator classpath to make it work. - For example, all references to - java.util.EnumSet - are replaced with references to - - net.sf.retrotranslator.runtime.java.util.EnumSet_ (trailing underscore) if the latter can be found. - But if you replace a whole class that exists in J2SE 1.4 you may encounter interoperability issues with other libraries. - So, for example, support for Java 5 fields, methods, and constructors of - java.math.BigDecimal is placed into - - - net.sf.retrotranslator.runtime.java.math._BigDecimal (leading underscore): -

    -
      -
    • For a static field there is a public static field with the same name and type.
    • -
    • For a static method there is a public static method with the same signature.
    • -
    • For an instance method there is a public static method with the same signature - but with an additional first parameter representing an instance.
    • -
    • For a constructor there is a public static convertConstructorArguments method that - accepts constructor's arguments an returns an argument for a Java 1.4 constuctor.
    • -
    -

    - However, if the backported methods require access - to non-public methods or fields of the instance, they cannot be fully handled by Retrotranslator. - While you can use reflection to access any data, translated code generally should not depend on security settings. - For example, it is impossible to write an implementation for methods getSource() - and setSource() of java.beans.PropertyEditorSupport that will work in any environment. - Also this approach cannot be used to replace instance field references. -

    -

    - If you have written an extension that does not contain copyrighted code, you may send - a patch - under the Retrotranslator license. -

    - -

    What are the limitations?

    - -

    - Basically, only classes, methods, and fields listed above should work, and other features, - like formatted input/output, are not supported. Known issues: -

    -
      -
    • Reflection-based tools may be unable to discover additional classes and methods introduced in Java 5 when running on JRE 1.4.
    • -
    • Translated code running on JRE 5.0 may be incompatible with other Java 5 code when Java 5 API is used.
    • -
    • Reflection on generics and metadata may return incomplete information for dynamically generated classes.
    • -
    • Access modifiers and constants inlined by a compiler are ignored during the verification.
    • -
    • Upcasting may help to translate invocations of inherited methods introduced in Java 5:
      -  ((Writer) new FileWriter("file.tmp")).append("Hello").close();
    • -
    • Serialized objects produced by translated code may be incompatible with JRE 5.0.
    • -
    - -

    Alternative tools

    -
      -
    • Retroweaver - - a Java bytecode weaver that enables you to take advantage - of the new 1.5 language features in your source code, - while still retaining compatibility with 1.4 virtual machines.
    • -
    • Declawer - - a customized Java compiler which reduces 1.5 Generics to equivalent 1.4 syntax.
    • -
    - -

    Contact

    - - -

    License

    -
    -    Retrotranslator: a Java bytecode transformer that translates Java classes
    -    compiled with JDK 5.0 into classes that can be run on JVM 1.4.
    -
    -    Copyright (c) 2005, 2006 Taras Puchko
    -    All rights reserved.
    -
    -    Redistribution and use in source and binary forms, with or without
    -    modification, are permitted provided that the following conditions
    -    are met:
    -    1. Redistributions of source code must retain the above copyright
    -       notice, this list of conditions and the following disclaimer.
    -    2. Redistributions in binary form must reproduce the above copyright
    -       notice, this list of conditions and the following disclaimer in the
    -       documentation and/or other materials provided with the distribution.
    -    3. Neither the name of the copyright holders nor the names of its
    -       contributors may be used to endorse or promote products derived from
    -       this software without specific prior written permission.
    -
    -    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    -    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    -    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    -    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    -    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    -    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    -    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    -    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    -    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
    -    THE POSSIBILITY OF SUCH DAMAGE.
    -
    - - diff --git a/trunk/backport/retrotranslator-runtime-1.0.7.jar b/trunk/backport/retrotranslator-runtime-1.0.7.jar deleted file mode 100755 index 38a587ebf..000000000 Binary files a/trunk/backport/retrotranslator-runtime-1.0.7.jar and /dev/null differ diff --git a/trunk/backport/retrotranslator-runtime-1.0.8.jar b/trunk/backport/retrotranslator-runtime-1.0.8.jar deleted file mode 100644 index e6472d402..000000000 Binary files a/trunk/backport/retrotranslator-runtime-1.0.8.jar and /dev/null differ diff --git a/trunk/backport/retrotranslator-transformer-1.0.8.jar b/trunk/backport/retrotranslator-transformer-1.0.8.jar deleted file mode 100644 index 499fa687d..000000000 Binary files a/trunk/backport/retrotranslator-transformer-1.0.8.jar and /dev/null differ diff --git a/trunk/backport/translate.bat b/trunk/backport/translate.bat deleted file mode 100644 index 3348b95c4..000000000 --- a/trunk/backport/translate.bat +++ /dev/null @@ -1,4 +0,0 @@ -java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/struts2-core-2.0.0.jar -destjar struts2-core-j4-2.0.0.jar -java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/struts2-api-2.0.0.jar -destjar struts2-api-j4-2.0.0.jar -java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/struts2-extras-2.0.0.jar -destjar struts2-extras-j4-2.0.0.jar -java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/xwork-2.0-SNAPSHOT.jar -destjar xwork-j4-2.0-SNAPSHOT.jar diff --git a/trunk/core/pom.xml b/trunk/core/pom.xml deleted file mode 100644 index 76c20c616..000000000 --- a/trunk/core/pom.xml +++ /dev/null @@ -1,275 +0,0 @@ - - - 4.0.0 - - org.apache.struts - struts2-parent - 2.0.1 - - org.apache.struts - struts2-core - jar - Struts 2 Core - - - - - maven-javadoc-plugin - 2.0 - - src/main/java;../../xwork/src/java - - - Struts Packages - org.apache.struts2* - - - XWork Packages - com.opensymphony.xwork2* - - - - - - - - - - - opensymphony - xwork - 2.0-beta-1 - - - - org.apache.struts - struts2-api - ${pom.version} - - - - freemarker - freemarker - 2.3.4 - - - - javax.servlet - servlet-api - 2.4 - provided - - - - javax.servlet - jsp-api - 2.0 - provided - - - - ognl - ognl - 2.6.7 - - - - commons-logging - commons-logging - 1.0.4 - - - - commons-lang - commons-lang - 2.0 - true - - - - - uk.ltd.getahead - dwr - 1.1-beta-3 - true - - - - - velocity - velocity - 1.4 - true - - - - velocity-tools - velocity-tools - 1.1 - true - - - - - commons-fileupload - commons-fileupload - 1.1.1 - true - - - commons-io - commons-io - 1.0 - true - - - - commons-lang - commons-lang - 2.1 - true - - - - - portlet-api - portlet-api - 1.0 - true - - - - org.apache.pluto - pluto - 1.0.1-rc4 - true - - - - - org.springframework - spring-beans - 1.2.8 - true - - - - org.springframework - spring-core - 1.2.8 - true - - - - org.springframework - spring-context - 1.2.8 - true - - - - org.springframework - spring-web - 1.2.8 - true - - - - org.springframework - spring-mock - 1.2.8 - true - - - - - junit - junit - compile - 3.8.1 - - true - - - - jmock - jmock - 1.0.1 - test - - - org.easymock - easymock - 2.0 - test - - - - org.rifers - rife-continuations - 0.0.2 - true - - - - jmock - jmock-cglib - 1.0.1 - test - - - - mockobjects - mockobjects-core - 0.09 - test - - - - mockobjects - mockobjects-jdk1.3 - 0.09 - test - - - - mockobjects - mockobjects-alt-jdk1.3 - 0.09 - test - - - - mockobjects - mockobjects-alt-jdk1.3-j2ee1.3 - 0.09 - test - - - - mockobjects - mockobjects-jdk1.3-j2ee1.3 - 0.09 - test - - - - log4j - log4j - 1.2.9 - test - - - diff --git a/trunk/core/src/main/etc/taglib-settings.xml b/trunk/core/src/main/etc/taglib-settings.xml deleted file mode 100644 index cd2bd2e95..000000000 --- a/trunk/core/src/main/etc/taglib-settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - 1.1 - 1.2 - struts-tags - /tags - A tag library for processing Model-2 command results diff --git a/trunk/core/src/main/java/org/apache/struts2/RequestUtils.java b/trunk/core/src/main/java/org/apache/struts2/RequestUtils.java deleted file mode 100644 index 70a959130..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/RequestUtils.java +++ /dev/null @@ -1,53 +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; - -import javax.servlet.http.HttpServletRequest; - - -/** - * Request handling utility class. - */ -public class RequestUtils { - - /** - * Retrieves the current request servlet path. - * Deals with differences between servlet specs (2.2 vs 2.3+) - * - * @param request the request - * @return the servlet path - */ - public static String getServletPath(HttpServletRequest request) { - String servletPath = request.getServletPath(); - - if (null != servletPath && !"".equals(servletPath)) { - return servletPath; - } - - String requestUri = request.getRequestURI(); - int startIndex = request.getContextPath().equals("") ? 0 : request.getContextPath().length(); - int endIndex = request.getPathInfo() == null ? requestUri.length() : requestUri.lastIndexOf(request.getPathInfo()); - - if (startIndex > endIndex) { // this should not happen - endIndex = startIndex; - } - - return requestUri.substring(startIndex, endIndex); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/ServletActionContext.java b/trunk/core/src/main/java/org/apache/struts2/ServletActionContext.java deleted file mode 100644 index 4a618d904..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/ServletActionContext.java +++ /dev/null @@ -1,146 +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; - -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.PageContext; - -import org.apache.struts2.dispatcher.mapper.ActionMapping; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * Web-specific context information for actions. This class subclasses ActionContext which - * provides access to things like the action name, value stack, etc. This class adds access to - * web objects like servlet parameters, request attributes and things like the HTTP session. - */ -public class ServletActionContext extends ActionContext implements StrutsStatics { - - private static final long serialVersionUID = -666854718275106687L; - - public static final String STRUTS_VALUESTACK_KEY = "struts.valueStack"; - public static final String ACTION_MAPPING = "struts.actionMapping"; - - @SuppressWarnings("unused") - private ServletActionContext(Map context) { - super(context); - } - - /** - * Gets the current action context - * - * @param req The request - * @return The current action context - */ - public static ActionContext getActionContext(HttpServletRequest req) { - ValueStack vs = getValueStack(req); - if (vs != null) { - return new ActionContext(vs.getContext()); - } else { - return null; - } - } - - /** - * Gets the current value stack for this request - * - * @param req The request - * @return The value stack - */ - public static ValueStack getValueStack(HttpServletRequest req) { - return (ValueStack) req.getAttribute(STRUTS_VALUESTACK_KEY); - } - - /** - * Gets the action mapping for this context - * - * @return The action mapping - */ - public static ActionMapping getActionMapping() { - return (ActionMapping) ActionContext.getContext().get(ACTION_MAPPING); - } - - /** - * Returns the HTTP page context. - * - * @return the HTTP page context. - */ - public static PageContext getPageContext() { - return (PageContext) ActionContext.getContext().get(PAGE_CONTEXT); - } - - /** - * Sets the HTTP servlet request object. - * - * @param request the HTTP servlet request object. - */ - public static void setRequest(HttpServletRequest request) { - ActionContext.getContext().put(HTTP_REQUEST, request); - } - - /** - * Gets the HTTP servlet request object. - * - * @return the HTTP servlet request object. - */ - public static HttpServletRequest getRequest() { - return (HttpServletRequest) ActionContext.getContext().get(HTTP_REQUEST); - } - - /** - * Sets the HTTP servlet response object. - * - * @param response the HTTP servlet response object. - */ - public static void setResponse(HttpServletResponse response) { - ActionContext.getContext().put(HTTP_RESPONSE, response); - } - - /** - * Gets the HTTP servlet response object. - * - * @return the HTTP servlet response object. - */ - public static HttpServletResponse getResponse() { - return (HttpServletResponse) ActionContext.getContext().get(HTTP_RESPONSE); - } - - /** - * Gets the servlet context. - * - * @return the servlet context. - */ - public static ServletContext getServletContext() { - return (ServletContext) ActionContext.getContext().get(SERVLET_CONTEXT); - } - - /** - * Sets the current servlet context object - * - * @param servletContext The servlet context to use - */ - public static void setServletContext(ServletContext servletContext) { - ActionContext.getContext().put(SERVLET_CONTEXT, servletContext); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java b/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java deleted file mode 100644 index 6cd01089f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java +++ /dev/null @@ -1,133 +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; - -/** - * This class provides a central location for framework configuration keys - * used to retrieve and store Struts configuration settings. - */ -public final class StrutsConstants { - - /** Whether Struts is in development mode or not */ - public static final String STRUTS_DEVMODE = "struts.devMode"; - - /** Whether the localization messages should automatically be reloaded */ - public static final String STRUTS_I18N_RELOAD = "struts.i18n.reload"; - - /** The encoding to use for localization messages */ - public static final String STRUTS_I18N_ENCODING = "struts.i18n.encoding"; - - /** Whether to reload the XML configuration or not */ - public static final String STRUTS_CONFIGURATION_XML_RELOAD = "struts.configuration.xml.reload"; - - /** The URL extension to use to determine if the request is meant for a Struts action */ - public static final String STRUTS_ACTION_EXTENSION = "struts.action.extension"; - - /** Whether to use the alterative syntax for the tags or not */ - public static final String STRUTS_TAG_ALTSYNTAX = "struts.tag.altSyntax"; - - /** The HTTP port used by Struts URLs */ - public static final String STRUTS_URL_HTTP_PORT = "struts.url.http.port"; - - /** The HTTPS port used by Struts URLs */ - public static final String STRUTS_URL_HTTPS_PORT = "struts.url.https.port"; - - /** The default includeParams method to generate Struts URLs */ - public static final String STRUTS_URL_INCLUDEPARAMS = "struts.url.includeParams"; - - /** The com.opensymphony.xwork2.ObjectFactory implementation class */ - public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory"; - - /** The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class */ - public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer"; - - /** The package containing actions that use Rife continuations */ - public static final String STRUTS_CONTINUATIONS_PACKAGE = "struts.continuations.package"; - - /** The org.apache.struts2.config.Configuration implementation class */ - public static final String STRUTS_CONFIGURATION = "struts.configuration"; - - /** The default locale for the Struts application */ - public static final String STRUTS_LOCALE = "struts.locale"; - - /** Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic */ - public static final String STRUTS_DISPATCHER_PARAMETERSWORKAROUND = "struts.dispatcher.parametersWorkaround"; - - /** The org.apache.struts2.views.freemarker.FreemarkerManager implementation class */ - public static final String STRUTS_FREEMARKER_MANAGER_CLASSNAME = "struts.freemarker.manager.classname"; - - /** org.apache.struts2.views.velocity.VelocityManager implementation class */ - public static final String STRUTS_VELOCITY_MANAGER_CLASSNAME = "struts.velocity.manager.classname"; - - /** The Velocity configuration file path */ - public static final String STRUTS_VELOCITY_CONFIGFILE = "struts.velocity.configfile"; - - /** The location of the Velocity toolbox */ - public static final String STRUTS_VELOCITY_TOOLBOXLOCATION = "struts.velocity.toolboxlocation"; - - /** List of Velocity context names */ - public static final String STRUTS_VELOCITY_CONTEXTS = "struts.velocity.contexts"; - - /** The directory containing UI templates */ - public static final String STRUTS_UI_TEMPLATEDIR = "struts.ui.templateDir"; - - /** The default UI template theme */ - public static final String STRUTS_UI_THEME = "struts.ui.theme"; - - /** The maximize size of a multipart request (file upload) */ - public static final String STRUTS_MULTIPART_MAXSIZE = "struts.multipart.maxSize"; - - /** The directory to use for storing uploaded files */ - public static final String STRUTS_MULTIPART_SAVEDIR = "struts.multipart.saveDir"; - - /** - * The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation - * for a multipart request (file upload) - */ - public static final String STRUTS_MULTIPART_PARSER = "struts.multipart.parser"; - - /** Whether Spring should autoWire or not */ - public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE = "struts.objectFactory.spring.autoWire"; - - /** Whether Spring should use its class cache or not */ - public static final String STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE = "struts.objectFactory.spring.useClassCache"; - - /** Whether or not XSLT templates should not be cached */ - public static final String STRUTS_XSLT_NOCACHE = "struts.xslt.nocache"; - - /** Location of additional configuration properties files to load */ - public static final String STRUTS_CUSTOM_PROPERTIES = "struts.custom.properties"; - - /** Location of additional localization properties files to load */ - public static final String STRUTS_CUSTOM_I18N_RESOURCES = "struts.custom.i18n.resources"; - - /** The org.apache.struts2.dispatcher.mapper.ActionMapper implementation class */ - public static final String STRUTS_MAPPER_CLASS = "struts.mapper.class"; - - /** Whether the Struts filter should serve static content or not */ - public static final String STRUTS_SERVE_STATIC_CONTENT = "struts.serve.static"; - - /** If static content served by the Struts filter should set browser caching header properties or not */ - public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = "struts.serve.static.browserCache"; - - /** Allows one to disable dynamic method invocation from the URL */ - public static final String STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION = "struts.enable.DynamicMethodInvocation"; - - /** A list of configuration files automatically loaded by Struts */ - public static final String STRUTS_CONFIGURATION_FILES = "struts.configuration.files"; -} diff --git a/trunk/core/src/main/java/org/apache/struts2/StrutsException.java b/trunk/core/src/main/java/org/apache/struts2/StrutsException.java deleted file mode 100644 index b89ad7366..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/StrutsException.java +++ /dev/null @@ -1,101 +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; - -import com.opensymphony.xwork2.XWorkException; -import com.opensymphony.xwork2.util.location.Locatable; - - -/** - * A generic runtime exception that optionally contains Location information - */ -public class StrutsException extends XWorkException implements Locatable { - - private static final long serialVersionUID = 888724366243600135L; - - - /** - * Constructs a StrutsException with no detail message. - */ - public StrutsException() { - } - - /** - * Constructs a StrutsException with the specified - * detail message. - * - * @param s the detail message. - */ - public StrutsException(String s) { - this(s, null, null); - } - - /** - * Constructs a StrutsException with the specified - * detail message and target. - * - * @param s the detail message. - * @param target the target of the exception. - */ - public StrutsException(String s, Object target) { - this(s, (Throwable) null, target); - } - - /** - * Constructs a StrutsException with the root cause - * - * @param cause The wrapped exception - */ - public StrutsException(Throwable cause) { - this(null, cause, null); - } - - /** - * Constructs a StrutsException with the root cause and target - * - * @param cause The wrapped exception - * @param target The target of the exception - */ - public StrutsException(Throwable cause, Object target) { - this(null, cause, target); - } - - /** - * Constructs a StrutsException with the specified - * detail message and exception cause. - * - * @param s the detail message. - * @param cause the wrapped exception - */ - public StrutsException(String s, Throwable cause) { - this(s, cause, null); - } - - - /** - * Constructs a StrutsException with the specified - * detail message, cause, and target - * - * @param s the detail message. - * @param cause The wrapped exception - * @param target The target of the exception - */ - public StrutsException(String s, Throwable cause, Object target) { - super(s, cause, target); - } -} \ No newline at end of file diff --git a/trunk/core/src/main/java/org/apache/struts2/StrutsStatics.java b/trunk/core/src/main/java/org/apache/struts2/StrutsStatics.java deleted file mode 100644 index 5290d21a0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/StrutsStatics.java +++ /dev/null @@ -1,65 +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; - - -/** - * Constants used by Struts. The constants can be used to get or set objects - * out of the action context or other collections. - * - *

    - * - * Example: - *

      ActionContext.getContext().put(HTTP_REQUEST, request);
    - *

    - * or - *

    - *

      - * ActionContext context = ActionContext.getContext();
      - * HttpServletRequest request = (HttpServletRequest)context.get(HTTP_REQUEST);
    - */ -public interface StrutsStatics { - - /** - * Constant for the HTTP request object. - */ - public static final String HTTP_REQUEST = "com.opensymphony.xwork2.dispatcher.HttpServletRequest"; - - /** - * Constant for the HTTP response object. - */ - public static final String HTTP_RESPONSE = "com.opensymphony.xwork2.dispatcher.HttpServletResponse"; - - /** - * Constant for an HTTP {@link javax.servlet.RequestDispatcher request dispatcher}. - */ - public static final String SERVLET_DISPATCHER = "com.opensymphony.xwork2.dispatcher.ServletDispatcher"; - - /** - * Constant for the {@link javax.servlet.ServletContext servlet context} object. - */ - public static final String SERVLET_CONTEXT = "com.opensymphony.xwork2.dispatcher.ServletContext"; - - /** - * Constant for the JSP {@link javax.servlet.jsp.PageContext page context}. - */ - public static final String PAGE_CONTEXT = "com.opensymphony.xwork2.dispatcher.PageContext"; - - /** Constant for the PortletContext object */ - public static final String STRUTS_PORTLET_CONTEXT = "struts.portlet.context"; -} diff --git a/trunk/core/src/main/java/org/apache/struts2/StrutsTestCase.java b/trunk/core/src/main/java/org/apache/struts2/StrutsTestCase.java deleted file mode 100644 index 988c068a1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/StrutsTestCase.java +++ /dev/null @@ -1,60 +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; - -import org.apache.struts2.config.Settings; -import org.apache.struts2.config.StrutsXmlConfigurationProvider; -import org.apache.struts2.dispatcher.Dispatcher; -import org.springframework.mock.web.MockServletContext; - -import com.opensymphony.xwork2.XWorkTestCase; -import com.opensymphony.xwork2.config.ConfigurationManager; -import com.opensymphony.xwork2.util.LocalizedTextUtil; - -/** - * Base test case for unit testing Struts. - */ -public abstract class StrutsTestCase extends XWorkTestCase { - - - /** - * Sets up the configuration settings, XWork configuration, and - * message resources - */ - protected void setUp() throws Exception { - super.setUp(); - Settings.reset(); - LocalizedTextUtil.clearDefaultResourceBundles(); - Dispatcher du = new Dispatcher(new MockServletContext()); - Dispatcher.setInstance(du); - configurationManager = new ConfigurationManager(); - configurationManager.addConfigurationProvider( - new StrutsXmlConfigurationProvider("struts-default.xml", false)); - configurationManager.addConfigurationProvider( - new StrutsXmlConfigurationProvider("struts-plugin.xml", false)); - configurationManager.addConfigurationProvider( - new StrutsXmlConfigurationProvider("struts.xml", false)); - du.setConfigurationManager(configurationManager); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java b/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java deleted file mode 100644 index 4adf5003f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java +++ /dev/null @@ -1,294 +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 java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.PageContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsException; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.RequestMap; -import org.apache.struts2.views.jsp.TagUtils; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.ActionProxyFactory; -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.ValueStackFactory; - -/** - * - *

    This tag enables developers to call actions directly from a JSP page by specifying the action name and an optional - * namespace. The body content of the tag is used to render the results from the Action. Any result processor defined - * for this action in struts.xml will be ignored, unless the executeResult parameter is specified.

    - * - * - * - *
      - *
    • id (String) - the id (if specified) to put the action under stack's context. - *
    • name* (String) - name of the action to be executed (without the extension suffix eg. .action)
    • - *
    • namespace (String) - default to the namespace where this action tag is invoked
    • - *
    • executeResult (Boolean) - default is false. Decides wheather the result of this action is to be executed or not
    • - *
    • ignoreContextParams (Boolean) - default to false. Decides wheather the request parameters are to be included when the action is invoked
    • - *
    - * - * - *
    - * 
    - * public class ActionTagAction extends ActionSupport {
    - *
    - *	public String execute() throws Exception {
    - *		return "done";
    - *	}
    - *
    - *	public String doDefault() throws Exception {
    - *		ServletActionContext.getRequest().setAttribute("stringByAction", "This is a String put in by the action's doDefault()");
    - *		return "done";
    - *	}
    - * }
    - * 
    - * 
    - * - *
    - * 
    - *   
    - *      ....
    - *     
    - *         success.jsp
    - *     
    - *      
    - *         success.jsp
    - *     
    - *      ....
    - *   
    - * 
    - * 
    - * - *
    - * 
    - *  
    The following action tag will execute result and include it in this page
    - *
    - * - *
    - *
    The following action tag will do the same as above, but invokes method specialMethod in action
    - *
    - * - *
    - *
    The following action tag will not execute result, but put a String in request scope - * under an id "stringByAction" which will be retrieved using property tag
    - * - * - * - *
    - * - * @s.tag name="action" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ActionTag" - * description="Execute an action from within a view" - */ -public class ActionComponent extends Component { - private static final Log LOG = LogFactory.getLog(ActionComponent.class); - - protected HttpServletResponse res; - protected HttpServletRequest req; - - protected ActionProxy proxy; - protected String name; - protected String namespace; - protected boolean executeResult; - protected boolean ignoreContextParams; - - public ActionComponent(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack); - this.req = req; - this.res = res; - } - - public boolean end(Writer writer, String body) { - boolean end = super.end(writer, "", false); - try { - try { - writer.flush(); - } catch (IOException e) { - LOG.warn("error while trying to flush writer ", e); - } - executeAction(); - - if ((getId() != null) && (proxy != null)) { - getStack().setValue("#attr['" + getId() + "']", - proxy.getAction()); - } - } finally { - popComponentStack(); - } - return end; - } - - private Map createExtraContext() { - Map parentParams = null; - - if (!ignoreContextParams) { - parentParams = new ActionContext(getStack().getContext()).getParameters(); - } - - Map newParams = (parentParams != null) ? new HashMap(parentParams) : new HashMap(); - - if (parameters != null) { - newParams.putAll(parameters); - } - - ActionContext ctx = new ActionContext(stack.getContext()); - ServletContext servletContext = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT); - PageContext pageContext = (PageContext) ctx.get(ServletActionContext.PAGE_CONTEXT); - Map session = ctx.getSession(); - Map application = ctx.getApplication(); - - Dispatcher du = Dispatcher.getInstance(); - Map extraContext = du.createContextMap(new RequestMap(req), - newParams, - session, - application, - req, - res, - servletContext); - - ValueStack newStack = ValueStackFactory.getFactory().createValueStack(stack); - extraContext.put(ActionContext.VALUE_STACK, newStack); - - // add page context, such that ServletDispatcherResult will do an include - extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext); - - return extraContext; - } - - public ActionProxy getProxy() { - return proxy; - } - - /** - * Execute the requested action. If no namespace is provided, we'll - * attempt to derive a namespace using buildNamespace(). The ActionProxy - * and the namespace will be saved into the instance variables proxy and - * namespace respectively. - * - * @see org.apache.struts2.views.jsp.TagUtils#buildNamespace - */ - private void executeAction() { - String actualName = findString(name, "name", "Action name is required. Example: updatePerson"); - - if (actualName == null) { - throw new StrutsException("Unable to find value for name " + name); - } - - // handle "name!method" convention. - final String actionName; - final String methodName; - - int exclamation = actualName.lastIndexOf("!"); - if (exclamation != -1) { - actionName = actualName.substring(0, exclamation); - methodName = actualName.substring(exclamation + 1); - } else { - actionName = actualName; - methodName = null; - } - - String namespace; - - if (this.namespace == null) { - namespace = TagUtils.buildNamespace(getStack(), req); - } else { - namespace = findString(this.namespace); - } - - // get the old value stack from the request - ValueStack stack = getStack(); - // execute at this point, after params have been set - try { - Configuration config = Dispatcher.getInstance().getConfigurationManager().getConfiguration(); - proxy = ActionProxyFactory.getFactory().createActionProxy(config, namespace, actionName, createExtraContext(), executeResult, true); - if (null != methodName) { - proxy.setMethod(methodName); - } - // set the new stack into the request for the taglib to use - req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack()); - proxy.execute(); - - } catch (Exception e) { - String message = "Could not execute action: " + namespace + "/" + actualName; - LOG.error(message, e); - } finally { - // set the old stack back on the request - req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); - } - - if ((getId() != null) && (proxy != null)) { - final Map context = stack.getContext(); - context.put(getId(), proxy.getAction()); - } - } - - /** - * the id (if speficied) to put the action under stack's context. - * @s.tagattribute required="false" type="String" - */ - public void setId(String id) { - super.setId(id); - } - - /** - * name of the action to be executed (without the extension suffix eg. .action) - * @s.tagattribute required="true" type="String" - */ - public void setName(String name) { - this.name = name; - } - - /** - * namespace for action to call - * @s.tagattribute required="false" type="String" default="namespace from where tag is used" - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * whether the result of this action (probably a view) should be executed/rendered - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setExecuteResult(boolean executeResult) { - this.executeResult = executeResult; - } - - /** - * whether the request parameters are to be included when the action is invoked - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setIgnoreContextParams(boolean ignoreContextParams) { - this.ignoreContextParams = ignoreContextParams; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ActionError.java b/trunk/core/src/main/java/org/apache/struts2/components/ActionError.java deleted file mode 100644 index a37fa4ea1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ActionError.java +++ /dev/null @@ -1,62 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Render action errors if they exists the specific layout of the rendering depends on - * the theme itself. - * - * - * - *

    Examples - * - *

    - * 
    - *
    - *    <s:actionerror />
    - *    <s:form .... >>
    - *       ....
    - *    </s:form>
    - *
    - * 
    - * 
    - * - * @s.tag name="actionerror" tld-body-content="empty" tld-tag-class="org.apache.struts2.views.jsp.ui.ActionErrorTag" - * description="Render action errors if they exists" - */ -public class ActionError extends UIBean { - - public static final String TEMPLATE = "actionerror"; - - - public ActionError(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ActionMessage.java b/trunk/core/src/main/java/org/apache/struts2/components/ActionMessage.java deleted file mode 100644 index c614d44f7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ActionMessage.java +++ /dev/null @@ -1,58 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Render action messages if they exists, specific rendering layout depends on the - * theme itself. - * - * - * - *

    Examples - * - *

    - * 
    - *    <s:actionmessage />
    - *    <s:form .... >
    - *       ....
    - *    </s:form>
    - * 
    - * 
    - * - * @s.tag name="actionmessage" tld-body-content="empty" tld-tag-class="org.apache.struts2.views.jsp.ui.ActionMessageTag" - * description="Render action messages if they exists" - */ -public class ActionMessage extends UIBean { - - private static final String TEMPLATE = "actionmessage"; - - public ActionMessage(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java b/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java deleted file mode 100644 index 789aa3c95..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java +++ /dev/null @@ -1,139 +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 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 result from the URL is executed as JavaScript. If a "listenTopics" is supplied, it will publish a - * 'click' message to that topic when the result is returned. - * - * - * - *

    Examples - * - *

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

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

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

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

    - * - *
    - * 
    - * <s:a id="test" theme="ajax" href="/simpeResult.action" preInvokeJS="confirm(\'You sure\')">
    - * 	A
    - * </s:a>
    - * 
    - * 
    - * - * @s.tag name="a" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.AnchorTag" - * description="Render a HTML href element that when clicked calls a URL via remote XMLHttpRequest" - * - */ -public class Anchor extends RemoteCallUIBean { - final public static String OPEN_TEMPLATE = "a"; - final public static String TEMPLATE = "a-close"; - final public static String COMPONENT_NAME = Anchor.class.getName(); - - protected String notifyTopics; - protected String preInvokeJS; - - public Anchor(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public String getDefaultOpenTemplate() { - return OPEN_TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (notifyTopics != null) { - addParameter("notifyTopics", findString(notifyTopics)); - } - - if (preInvokeJS != null) { - addParameter("preInvokeJS", findString(preInvokeJS)); - } - } - - /** - * The id to assign the component - * @s.tagattribute required="false" type="String" - */ - public void setId(String id) { - super.setId(id); - } - - /** - * Topic names to post an event to after the remote call has been made - * @s.tagattribute required="false" - */ - public void setNotifyTopics(String notifyTopics) { - this.notifyTopics = notifyTopics; - } - - /** - * A javascript snippet that will be invoked prior to the execution of the target href. If provided must return true or false. True indicates to continue executing target, false says do not execute link target. Possible uses are for confirm dialogs. - * @s.tagattribute required="false" type="String" - */ - public void setPreInvokeJS(String preInvokeJS) { - this.preInvokeJS = preInvokeJS; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/AppendIterator.java b/trunk/core/src/main/java/org/apache/struts2/components/AppendIterator.java deleted file mode 100644 index 3f04b7b9e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/AppendIterator.java +++ /dev/null @@ -1,170 +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 java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.components.Param.UnnamedParametric; -import org.apache.struts2.util.AppendIteratorFilter; -import org.apache.struts2.util.MakeIterator; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    Component for AppendIteratorTag, which jobs is to append iterators to form an - * appended iterator whereby entries goes from one iterator to another after each - * respective iterator is exhausted of entries.

    - * - *

    For example, if there are 3 iterator appended (each iterator has 3 entries), - * the following will be how the appended iterator entries will be arranged:

    - * - *
      - *
    1. First Entry of the First Iterator
    2. - *
    3. Second Entry of the First Iterator
    4. - *
    5. Third Entry of the First Iterator
    6. - *
    7. First Entry of the Second Iterator
    8. - *
    9. Second Entry of the Second Iterator
    10. - *
    11. Third Entry of the Second Iterator
    12. - *
    13. First Entry of the Third Iterator
    14. - *
    15. Second Entry of the Third Iterator
    16. - *
    17. Third Entry of the Third ITerator
    18. - *
    - * - * - * - *
      - *
    • id (String) - the id of which if supplied will have the resultant - * appended iterator stored under in the stack's context
    • - *
    - * - * - * - * - * public class AppendIteratorTagAction extends ActionSupport { - * - * private List myList1; - * private List myList2; - * private List myList3; - * - * - * public String execute() throws Exception { - * - * myList1 = new ArrayList(); - * myList1.add("1"); - * myList1.add("2"); - * myList1.add("3"); - * - * myList2 = new ArrayList(); - * myList2.add("a"); - * myList2.add("b"); - * myList2.add("c"); - * - * myList3 = new ArrayList(); - * myList3.add("A"); - * myList3.add("B"); - * myList3.add("C"); - * - * return "done"; - * } - * - * public List getMyList1() { return myList1; } - * public List getMyList2() { return myList2; } - * public List getMyList3() { return myList3; } - *} - * - * - * - * <s:append id="myAppendIterator"> - * <s:param value="%{myList1}" /> - * <s:param value="%{myList2}" /> - * <s:param value="%{myList3}" /> - * </s:append> - * <s:iterator value="%{#myAppendIterator}"> - * <s:property /> - * </s:iterator> - * - * - * - * @see org.apache.struts2.util.AppendIteratorFilter - * @see org.apache.struts2.views.jsp.iterator.AppendIteratorTag - * - * @s.tag name="append" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.iterator.AppendIteratorTag" - * description="Append the values of a list of iterators to one iterator" - */ -public class AppendIterator extends Component implements UnnamedParametric { - - private static final Log _log = LogFactory.getLog(AppendIterator.class); - - private AppendIteratorFilter appendIteratorFilter= null; - private List _parameters; - - public AppendIterator(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - _parameters = new ArrayList(); - appendIteratorFilter = new AppendIteratorFilter(); - - return super.start(writer); - } - - public boolean end(Writer writer, String body) { - - for (Iterator paramEntries = _parameters.iterator(); paramEntries.hasNext(); ) { - - Object iteratorEntryObj = paramEntries.next(); - if (! MakeIterator.isIterable(iteratorEntryObj)) { - _log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator"); - continue; - } - appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj)); - } - - appendIteratorFilter.execute(); - - if (getId() != null && getId().length() > 0) { - getStack().getContext().put(getId(), appendIteratorFilter); - } - - appendIteratorFilter = null; - - return super.end(writer, body); - } - - // UnnamedParametric implementation -------------------------------------- - public void addParameter(Object value) { - _parameters.add(value); - } - - /** - * the id of which if supplied will have the resultant appended iterator stored under in the stack's context - * @s.tagattribute required="false" - */ - public void setId(String id) { - super.setId(id); - } -} - - diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Bean.java b/trunk/core/src/main/java/org/apache/struts2/components/Bean.java deleted file mode 100644 index b1dcaff90..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Bean.java +++ /dev/null @@ -1,146 +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 java.io.Writer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; -import com.opensymphony.xwork2.ObjectFactory; -import com.opensymphony.xwork2.util.OgnlUtil; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    Instantiates a class that conforms to the JavaBeans specification. This tag has a body which can contain - * a number of {@link Param} elements to set any mutator methods on that class.

    - *

    - *

    If the id attribute is set on the BeanTag, it will place the instantiated bean into the - * stack's Context.

    - *

    - * - * - * - * - *

      - *
    • id - the stack's context id (if supplied) that the created bean will be store under
    • - *
    • name* - the class name of the bean to be instantiated (must respect JavaBean specification)
    • - *
    - * - * - * - *

    Examples:

    - *

    - *

    - * 
    - * <-- in freemarker form -->
    - * [@s.bean name="org.apache.struts2.example.counter.SimpleCounter" id="counter"]
    - *   [s:param name="foo" value="BAR"/]
    - *   The value of foo is : [s:property value="foo"/], when inside the bean tag.
    - * [/s:bean] - * - * <-- in jsp form --> - * <s:bean name="org.apache.struts2.example.counter.SimpleCounter" id="counter"> - * <s:param name="foo" value="BAR" /> - * The value of foot is : <s:property value="foo"/>, when inside the bean tag <br /> - * </s:bean> - * - *
    - *

    - * - * - *

    This example instantiates a bean called SimpleCounter and sets the foo property (setFoo('BAR')). The - * SimpleCounter object is then pushed onto the Valuestack, which means that we can called its accessor methods (getFoo()) - * with the Property tag and get their values.

    - *

    - *

    In the above example, the id has been set to a value of counter. This means that the SimpleCounter class - * will be placed into the stack's context. You can access the SimpleCounter class using a Struts tag:

    - *

    - *

    - * <-- jsp form -->
    - * <s:property value="#counter" />
    - *
    - * <-- freemarker form -->
    - * [s:property value="#counter.foo"/]
    - * 
    - *

    - *

    In the property tag example, the # tells Ognl to search the context for the SimpleCounter class which has - * an id(key) of counter

    - * - * - * @see Param - * - * @s.tag name="bean" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.BeanTag" - * description="Instantiate a JavaBean and place it in the context." - */ -public class Bean extends Component { - protected static Log log = LogFactory.getLog(Bean.class); - - protected Object bean; - protected String name; - - public Bean(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - ValueStack stack = getStack(); - - try { - String beanName = findString(name, "name", "Bean name is required. Example: com.acme.FooBean"); - bean = ObjectFactory.getObjectFactory().buildBean(ClassLoaderUtil.loadClass(beanName, getClass()), stack.getContext()); - } catch (Exception e) { - log.error("Could not instantiate bean", e); - - return false; - } - - // push bean on stack - stack.push(bean); - - // store for reference later - if (getId() != null) { - getStack().getContext().put(getId(), bean); - } - - return result; - } - - public boolean end(Writer writer, String body) { - ValueStack stack = getStack(); - stack.pop(); - - return super.end(writer, body); - } - - public void addParameter(String key, Object value) { - OgnlUtil.setProperty(key, value, bean, getStack().getContext()); - } - - /** - * the class name of the bean to be instantiated (must respect JavaBean specification) - * @s.tagattribute required="true" type="String" - */ - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java b/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java deleted file mode 100644 index 5f080f379..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java +++ /dev/null @@ -1,82 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Renders an HTML input element of type checkbox, populated by the specified property from the ValueStack. - * - * - *

    Examples - * - *

    - * 
    - * JSP:
    - * <s:checkbox label="checkbox test" name="checkboxField1" value="aBoolean" fieldValue="true"/>
    - *
    - * Velocity:
    - * #tag( Checkbox "label=checkbox test" "name=checkboxField1" "value=aBoolean" )
    - *
    - * Resulting HTML (simple template, aBoolean == true):
    - * <input type="checkbox" name="checkboxField1" value="true" checked="checked" />
    - *
    - * 
    - * 
    - * - * @s.tag name="checkbox" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.CheckboxTag" - * description="Render a checkbox input field" - */ -public class Checkbox extends UIBean { - final public static String TEMPLATE = "checkbox"; - - protected String fieldValue; - - public Checkbox(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - protected void evaluateExtraParams() { - if (fieldValue != null) { - addParameter("fieldValue", findString(fieldValue)); - } else { - addParameter("fieldValue", "true"); - } - } - - protected Class getValueClassType() { - return Boolean.class; // for checkboxes, everything needs to end up as a Boolean - } - - /** - * The actual HTML value attribute of the checkbox. - * @s.tagattribute required="false" default="'true'" - */ - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/CheckboxList.java b/trunk/core/src/main/java/org/apache/struts2/components/CheckboxList.java deleted file mode 100644 index 86101b58c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/CheckboxList.java +++ /dev/null @@ -1,53 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Creates a series of checkboxes from a list. Setup is like <s:select /> or <s:radio />, but creates checkbox tags. - * - * - * - *

    Examples - * - *

    - * 
    - * <s:checkboxlist name="foo" list="bar"/>
    - * 
    - * 
    - * - * @s.tag name="checkboxlist" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.CheckboxListTag" - * description="Render a list of checkboxes" - */ -public class CheckboxList extends ListUIBean { - final public static String TEMPLATE = "checkboxlist"; - - public CheckboxList(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java b/trunk/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java deleted file mode 100644 index 466a63a47..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java +++ /dev/null @@ -1,65 +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 java.io.Writer; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * ClosingUIBean is the standard superclass for UI components such as div etc. - */ -public abstract class ClosingUIBean extends UIBean { - private static final Log LOG = LogFactory.getLog(ClosingUIBean.class); - - protected ClosingUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - String openTemplate; - - public abstract String getDefaultOpenTemplate(); - - /** - * Set template to use for opening the rendered html. - * @s.tagattribute required="false" - */ - public void setOpenTemplate(String openTemplate) { - this.openTemplate = openTemplate; - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - try { - evaluateParams(); - - mergeTemplate(writer, buildTemplateName(openTemplate, getDefaultOpenTemplate())); - } catch (Exception e) { - LOG.error("Could not open template", e); - e.printStackTrace(); - } - - return result; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ComboBox.java b/trunk/core/src/main/java/org/apache/struts2/components/ComboBox.java deleted file mode 100644 index 1b31cd43b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ComboBox.java +++ /dev/null @@ -1,211 +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 java.util.Collection; -import java.util.Iterator; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.util.MakeIterator; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo box - * functionality. You can place text in the INPUT control by using the SELECT control or type it in directly in - * the text field.

    - * - * In this example, the SELECT will be populated from id=year attribute. Counter is itself an Iterator. It will - * span from first to last. The population is done via javascript, and requires that this tag be surrounded by a - * <form>.

    - * - * Note that unlike the <s:select/> tag, there is no ability to define the individual <option> tags' id attribute - * or content separately. Each of these is simply populated from the toString() method of the list item. Presumably - * this is because the select box isn't intended to actually submit useful data, but to assist the user in filling - * out the text field.

    - * - * - *

    Examples - * - *

    - * 
    - * JSP:
    - * <-- Example One -->
    - * <s:bean name="struts.util.Counter" id="year">
    - *   <s:param name="first" value="text('firstBirthYear')"/>
    - *   <s:param name="last" value="2000"/>
    - *
    - *   <s:combobox label="Birth year" size="6" maxlength="4" name="birthYear" list="#year"/>
    - * </s:bean>
    - * 
    - * <-- Example Two -->
    - * 
    - *     
    - * <-- Example Two -->
    - * 
    - *
    - * Velocity:
    - * #tag( ComboBox "label=Birth year" "size=6" "maxlength=4" "name=birthYear" "list=#year" )
    - * 
    - * 
    - * - * @s.tag name="combobox" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.ComboBoxTag" - * description="Widget that fills a text box from a select" - */ -public class ComboBox extends TextField { - final public static String TEMPLATE = "combobox"; - - protected String list; - protected String listKey; - protected String listValue; - protected String headerKey; - protected String headerValue; - protected String emptyOption; - - - public ComboBox(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - Object value = findValue(list, "list", - "You must specify a collection/array/map/enumeration/iterator. " + - "Example: people or people.{name}"); - - if (headerKey != null) { - addParameter("headerKey", findString(headerKey)); - } - if (headerValue != null) { - addParameter("headerValue", findString(headerValue)); - } - if (emptyOption != null) { - addParameter("emptyOption", findValue(emptyOption, Boolean.class)); - } - - if (value instanceof Collection) { - Collection tmp = (Collection) value; - addParameter("list", tmp); - if (listKey != null) { - addParameter("listKey", listKey); - } - if (listValue != null) { - addParameter("listValue", listValue); - } - } - else if (value instanceof Map) { - Map tmp = (Map) value; - addParameter("list", MakeIterator.convert(tmp)); - addParameter("listKey", "key"); - addParameter("listValue", "value"); - } - else if (value.getClass().isArray()) { - Iterator i = MakeIterator.convert(value); - addParameter("list", i); - if (listKey != null) { - addParameter("listKey", listKey); - } - if (listValue != null) { - addParameter("listValue", listValue); - } - } - else { - Iterator i = MakeIterator.convert(value); - addParameter("list", i); - if (listKey != null) { - addParameter("listKey", listKey); - } - if (listValue != null) { - addParameter("listValue", listValue); - } - } - } - - /** - * Iteratable source to populate from. If this is missing, the select widget is simply not displayed. - * @s.tagattribute required="true" - */ - public void setList(String list) { - this.list = list; - } - - /** - * Decide if an empty option is to be inserted. Default false. - * @s.tagattribute required="false" - */ - public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } - - /** - * set the header key for the header option. - * @s.tagattribute required="false" - */ - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } - - /** - * set the header value for the header option. - * @s.tagattribute required="false" - */ - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } - - /** - * set the key used to retrive the option key. - * @s.tagattribute required="false" - */ - public void setListKey(String listKey) { - this.listKey = listKey; - } - - /** - * set the value used to retrive the option value. - * @s.tagattribute required="false" - */ - public void setListValue(String listValue) { - this.listValue = listValue; - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Component.java b/trunk/core/src/main/java/org/apache/struts2/components/Component.java deleted file mode 100644 index 3a6184167..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Component.java +++ /dev/null @@ -1,463 +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 java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Stack; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.StrutsException; -import org.apache.struts2.dispatcher.mapper.ActionMapper; -import org.apache.struts2.dispatcher.mapper.ActionMapperFactory; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.util.FastByteArrayOutputStream; -import org.apache.struts2.views.jsp.TagUtils; -import org.apache.struts2.views.util.ContextUtil; -import org.apache.struts2.views.util.UrlHelper; - -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.TextParseUtil; - -/** - * Base class to extend for UI components. - *

    - * This class is a good extension point when building reuseable UI components. - * - */ -public class Component { - public static final String COMPONENT_STACK = "__component_stack"; - - protected ValueStack stack; - protected Map parameters; - protected String id; - - /** - * Constructor. - * - * @param stack OGNL value stack. - */ - public Component(ValueStack stack) { - this.stack = stack; - this.parameters = new HashMap(); - getComponentStack().push(this); - } - - /** - * Get's the name of this component. - * @return the name of this component. - */ - private String getComponentName() { - Class c = getClass(); - String name = c.getName(); - int dot = name.lastIndexOf('.'); - - return name.substring(dot + 1).toLowerCase(); - } - - /** - * Get's the OGNL value stack assoicated with this component. - * @return the OGNL value stack assoicated with this component. - */ - public ValueStack getStack() { - return stack; - } - - /** - * Get's the component stack of this component. - * @return the component stack of this component, never null. - */ - public Stack getComponentStack() { - Stack componentStack = (Stack) stack.getContext().get(COMPONENT_STACK); - if (componentStack == null) { - componentStack = new Stack(); - stack.getContext().put(COMPONENT_STACK, componentStack); - } - return componentStack; - } - - /** - * Callback for the start tag of this component. - * Should the body be evaluated? - * - * @param writer the output writer. - * @return true if the body should be evaluated - */ - public boolean start(Writer writer) { - return true; - } - - /** - * Callback for the end tag of this component. - * Should the body be evaluated again? - *

    - * NOTE: will pop component stack. - * @param writer the output writer. - * @param body the rendered body. - * @return true if the body should be evaluated again - */ - public boolean end(Writer writer, String body) { - return end(writer, body, true); - } - - /** - * Callback for the start tag of this component. - * Should the body be evaluated again? - *

    - * NOTE: has a parameter to determine to pop the component stack. - * @param writer the output writer. - * @param body the rendered body. - * @param popComponentStack should the component stack be popped? - * @return true if the body should be evaluated again - */ - protected boolean end(Writer writer, String body, boolean popComponentStack) { - assert(body != null); - - try { - writer.write(body); - } catch (IOException e) { - throw new StrutsException("IOError while writing the body: " + e.getMessage(), e); - } - if (popComponentStack) { - popComponentStack(); - } - return false; - } - - /** - * Pops the component stack. - */ - protected void popComponentStack() { - getComponentStack().pop(); - } - - /** - * Finds the nearest ancestor of this component stack. - * @param clazz the class to look for, or if assignable from. - * @return the component if found, null if not. - */ - protected Component findAncestor(Class clazz) { - Stack componentStack = getComponentStack(); - int currPosition = componentStack.search(this); - if (currPosition >= 0) { - int start = componentStack.size() - currPosition - 1; - - //for (int i = componentStack.size() - 2; i >= 0; i--) { - for (int i = start; i >=0; i--) { - Component component = (Component) componentStack.get(i); - if (clazz.isAssignableFrom(component.getClass()) && component != this) { - return component; - } - } - } - - return null; - } - - /** - * Evaluates the OGNL stack to find a String value. - * @param expr OGNL expression. - * @return the String value found. - */ - protected String findString(String expr) { - return (String) findValue(expr, String.class); - } - - /** - * Evaluates the OGNL stack to find a String value. - *

    - * If the given expression is null a error is logged and a RuntimeException is thrown - * constructed with a messaged based on the given field and errorMsg paramter. - * - * @param expr OGNL expression. - * @param field field name used when throwing RuntimeException. - * @param errorMsg error message used when throwing RuntimeException. - * @return the String value found. - * @throws StrutsException is thrown in case of expression is null. - */ - protected String findString(String expr, String field, String errorMsg) { - if (expr == null) { - throw fieldError(field, errorMsg, null); - } else { - return findString(expr); - } - } - - /** - * Constructs?a RuntimeException based on the given information. - *

    - * A message is constructed and logged at ERROR level before being returned - * as a RuntimeException. - * @param field field name used when throwing RuntimeException. - * @param errorMsg error message used when throwing RuntimeException. - * @param e the caused exception, can be null. - * @return the constructed StrutsException. - */ - protected StrutsException fieldError(String field, String errorMsg, Exception e) { - String msg = "tag '" + getComponentName() + "', field '" + field + ( id != null ?"', id '" + id:"") + - ( parameters != null && parameters.containsKey("name")?"', name '" + parameters.get("name"):"") + - "': " + errorMsg; - throw new StrutsException(msg, e); - } - - /** - * Finds a value from the OGNL stack based on the given expression. - * Will always evaluate expr against stack except when expr - * is null. If altsyntax (%{...}) is applied, simply strip it off. - * - * @param expr the expression. Returns null if expr is null. - * @return the value, null if not found. - */ - protected Object findValue(String expr) { - if (expr == null) { - return null; - } - - if (altSyntax()) { - // does the expression start with %{ and end with }? if so, just cut it off! - if (expr.startsWith("%{") && expr.endsWith("}")) { - expr = expr.substring(2, expr.length() - 1); - } - } - - return getStack().findValue(expr); - } - - /** - * Is the altSyntax enabled? [TRUE] - *

    - * See struts.properties where the altSyntax flag is defined. - */ - public boolean altSyntax() { - return ContextUtil.isUseAltSyntax(stack.getContext()); - } - - /** - * Evaluates the OGNL stack to find an Object value. - *

    - * Function just like findValue(String) except that if the - * given expression is null a error is logged and - * a RuntimeException is thrown constructed with a - * messaged based on the given field and errorMsg paramter. - * - * @param expr OGNL expression. - * @param field field name used when throwing RuntimeException. - * @param errorMsg error message used when throwing RuntimeException. - * @return the Object found, is never null. - * @throws StrutsException is thrown in case of not found in the OGNL stack, or expression is null. - */ - protected Object findValue(String expr, String field, String errorMsg) { - if (expr == null) { - throw fieldError(field, errorMsg, null); - } else { - Object value = null; - Exception problem = null; - try { - value = findValue(expr); - } catch (Exception e) { - problem = e; - } - - if (value == null) { - throw fieldError(field, errorMsg, problem); - } - - return value; - } - } - - /** - * Evaluates the OGNL stack to find an Object of the given type. Will evaluate - * expr the portion wrapped with altSyntax (%{...}) - * against stack when altSyntax is on, else the whole expr - * is evaluated against the stack. - *

    - * This method only supports the altSyntax. So this should be set to true. - * @param expr OGNL expression. - * @param toType the type expected to find. - * @return the Object found, or null if not found. - */ - protected Object findValue(String expr, Class toType) { - if (altSyntax() && toType == String.class) { - return TextParseUtil.translateVariables('%', expr, stack); - } else { - if (altSyntax()) { - // does the expression start with %{ and end with }? if so, just cut it off! - if (expr.startsWith("%{") && expr.endsWith("}")) { - expr = expr.substring(2, expr.length() - 1); - } - } - - return getStack().findValue(expr, toType); - } - } - - /** - * Renders an action URL by consulting the {@link org.apache.struts2.dispatcher.mapper.ActionMapper}. - * @param action the action - * @param namespace the namespace - * @param method the method - * @param req HTTP request - * @param res HTTP response - * @param parameters parameters - * @param scheme http or https - * @param includeContext should the context path be included or not - * @param encodeResult should the url be encoded - * @return the action url. - */ - protected String determineActionURL(String action, String namespace, String method, - HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme, - boolean includeContext, boolean encodeResult) { - String finalAction = findString(action); - String finalNamespace = determineNamespace(namespace, getStack(), req); - ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, method, parameters); - ActionMapper mapper = ActionMapperFactory.getMapper(); - String uri = mapper.getUriFromActionMapping(mapping); - return UrlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult); - } - - /** - * Determines the namespace of the current page being renderdd. Useful for Form, URL, and href generations. - * @param namespace the namespace - * @param stack OGNL value stack - * @param req HTTP request - * @return the namepsace of the current page being rendered, is never null. - */ - protected String determineNamespace(String namespace, ValueStack stack, HttpServletRequest req) { - String result; - - if (namespace == null) { - result = TagUtils.buildNamespace(stack, req); - } else { - result = findString(namespace); - } - - if (result == null) { - result = ""; - } - - return result; - } - - /** - * Pushes this component's parameter Map as well as the component itself on to the stack - * and then copies the supplied parameters over. Because the component's parameter Map is - * pushed before the component itself, any key-value pair that can't be assigned to componet - * will be set in the parameters Map. - * - * @param params the parameters to copy. - */ - public void copyParams(Map params) { - stack.push(parameters); - stack.push(this); - try { - for (Iterator iterator = params.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - String key = (String) entry.getKey(); - stack.setValue(key, entry.getValue()); - } - } finally { - stack.pop(); - stack.pop(); - } - } - - /** - * Constructs a string representation of the given exception. - * @param t the exception - * @return the exception as a string. - */ - protected String toString(Throwable t) { - FastByteArrayOutputStream bout = new FastByteArrayOutputStream(); - PrintWriter wrt = new PrintWriter(bout); - t.printStackTrace(wrt); - wrt.close(); - - return bout.toString(); - } - - /** - * Get's the parameters. - * @return the parameters. Is never null. - */ - public Map getParameters() { - return parameters; - } - - /** - * Add's all the given parameters to this componenets own parameters. - * @param params the parameters to add. - */ - public void addAllParameters(Map params) { - parameters.putAll(params); - } - - /** - * Add's the given key and value to this components own parameter. - *

    - * If the provided key is null nothing happends. - * If the provided value is null any existing parameter with - * the given key name is removed. - * @param key the key of the new parameter to add. - * @param value the value assoicated with the key. - */ - public void addParameter(String key, Object value) { - if (key != null) { - Map params = getParameters(); - - if (value == null) { - params.remove(key); - } else { - params.put(key, value); - } - } - } - - /** - * Get's the id for referencing element. - * @return the id for referencing element. - */ - public String getId() { - return id; - } - - /** - * id for referencing element. For UI and form tags it will be used as HTML id attribute - * @s.tagattribute required="false" - */ - public void setId(String id) { - if (id != null) { - this.id = findString(id); - } - } - - /** - * Overwrite to set if body shold be used. - * @return always false for this component. - */ - public boolean usesBody() { - return false; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Date.java b/trunk/core/src/main/java/org/apache/struts2/components/Date.java deleted file mode 100644 index cec6a6c2f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Date.java +++ /dev/null @@ -1,383 +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 java.io.IOException; -import java.io.Writer; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.TextProvider; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Format Date object in different ways. - *

    - * The date tag will allow you to format a Date in a quick and easy way. - * You can specify a custom format (eg. "dd/MM/yyyy hh:mm"), you can generate - * easy readable notations (like "in 2 hours, 14 minutes"), or you can just fall back - * on a predefined format with key 'struts.date.format' in your properties file. - * - * If that key is not defined, it will finally fall back to the default DateFormat.MEDIUM - * formatting. - * - * Note: If the requested Date object isn't found on the stack, a blank will be returned. - *

    - * - * Configurable attributes are :- - *
      - *
    • name
    • - *
    • nice
    • - *
    • format
    • - *
    - * - *

    - * - * Following how the date component will work, depending on the value of nice attribute - * (which by default is false) and the format attribute. - * - *

    - * - * Condition 1: With nice attribute as true - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    i18n keydefault
    struts.date.format.past{0} ago
    struts.date.format.futurein {0}
    struts.date.format.secondsan instant
    struts.date.format.minutes{0,choice,1#one minute|1<{0} minutes}
    struts.date.format.hours{0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one minute|1<, {1} minutes}
    struts.date.format.days{0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, {1} hours}
    struts.date.format.years{0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one day|1<, {1} days}
    - * - *

    - * - * Condition 2: With nice attribute as false and format attribute is specified eg. dd/MM/yyyyy - *

    In this case the format attribute will be used.

    - * - *

    - * - * Condition 3: With nice attribute as false and no format attribute is specified - * - * - * - * - * - * - * - * - * - *
    i18n keydefault
    struts.date.formatif one is not found DateFormat.MEDIUM format will be used
    - * - * - * - * - *

    Examples - *

    - *  
    - *  <s:date name="person.birthday" format="dd/MM/yyyy" />
    - *  <s:date name="person.birthday" format="%{getText('some.i18n.key')}" />
    - *  <s:date name="person.birthday" nice="true" />
    - *  <s:date name="person.birthday" />
    - *  
    - * 
    - * - * Date - * - * @s.tag name="date" tld-body-content="empty" - * tld-tag-class="org.apache.struts2.views.jsp.DateTag" - * description="Render a formatted date." - */ -public class Date extends Component { - - private static final Log LOG = LogFactory.getLog(Date.class); - /** - * Property name to fall back when no format is specified - */ - public static final String DATETAG_PROPERTY = "struts.date.format"; - /** - * Property name that defines the past notation (default: {0} ago) - */ - public static final String DATETAG_PROPERTY_PAST = "struts.date.format.past"; - private static final String DATETAG_DEFAULT_PAST = "{0} ago"; - /** - * Property name that defines the future notation (default: in {0}) - */ - public static final String DATETAG_PROPERTY_FUTURE = "struts.date.format.future"; - private static final String DATETAG_DEFAULT_FUTURE = "in {0}"; - /** - * Property name that defines the seconds notation (default: in instant) - */ - public static final String DATETAG_PROPERTY_SECONDS = "struts.date.format.seconds"; - private static final String DATETAG_DEFAULT_SECONDS = "an instant"; - /** - * Property name that defines the minutes notation (default: {0,choice,1#one minute|1<{0} minutes}) - */ - public static final String DATETAG_PROPERTY_MINUTES = "struts.date.format.minutes"; - private static final String DATETAG_DEFAULT_MINUTES = "{0,choice,1#one minute|1<{0} minutes}"; - /** - * Property name that defines the hours notation (default: {0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one - * minute|1<, {1} minutes}) - */ - public static final String DATETAG_PROPERTY_HOURS = "struts.date.format.hours"; - private static final String DATETAG_DEFAULT_HOURS = "{0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one minute|1<, {1} minutes}"; - /** - * Property name that defines the days notation (default: {0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, - * {1} hours}) - */ - public static final String DATETAG_PROPERTY_DAYS = "struts.date.format.days"; - private static final String DATETAG_DEFAULT_DAYS = "{0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, {1} hours}"; - /** - * Property name that defines the years notation (default: {0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one - * day|1<, {1} days}) - */ - public static final String DATETAG_PROPERTY_YEARS = "struts.date.format.years"; - private static final String DATETAG_DEFAULT_YEARS = "{0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one day|1<, {1} days}"; - - private String name; - - private String format; - - private boolean nice; - - public Date(ValueStack stack) { - super(stack); - } - - private TextProvider findProviderInStack() { - for (Iterator iterator = getStack().getRoot().iterator(); iterator - .hasNext();) { - Object o = iterator.next(); - - if (o instanceof TextProvider) { - return (TextProvider) o; - } - } - return null; - } - - /** - * Calculates the difference in time from now to the given date, and outputs it nicely.

    An example:
    Now = - * 2006/03/12 13:38:00, date = 2006/03/12 15:50:00 will output "in 1 hour, 12 minutes". - * - * @param tp text provider - * @param date the date - * @return the date nicely - */ - public String formatTime(TextProvider tp, java.util.Date date) { - java.util.Date now = new java.util.Date(); - StringBuffer sb = new StringBuffer(); - List args = new ArrayList(); - long secs = Math.abs((now.getTime() - date.getTime()) / 1000); - long mins = secs / 60; - long sec = secs % 60; - int min = (int) mins % 60; - long hours = mins / 60; - int hour = (int) hours % 24; - int days = (int) hours / 24; - int day = days % 365; - int years = days / 365; - - if (years > 0) { - args.add(new Long(years)); - args.add(new Long(day)); - args.add(sb); - args.add(null); - sb.append(tp.getText(DATETAG_PROPERTY_YEARS, DATETAG_DEFAULT_YEARS, args)); - } else if (day > 0) { - args.add(new Long(day)); - args.add(new Long(hour)); - args.add(sb); - args.add(null); - sb.append(tp.getText(DATETAG_PROPERTY_DAYS, DATETAG_DEFAULT_DAYS, args)); - } else if (hour > 0) { - args.add(new Long(hour)); - args.add(new Long(min)); - args.add(sb); - args.add(null); - sb.append(tp.getText(DATETAG_PROPERTY_HOURS, DATETAG_DEFAULT_HOURS, args)); - } else if (min > 0) { - args.add(new Long(min)); - args.add(new Long(sec)); - args.add(sb); - args.add(null); - sb.append(tp.getText(DATETAG_PROPERTY_MINUTES, DATETAG_DEFAULT_MINUTES, args)); - } else { - args.add(new Long(sec)); - args.add(sb); - args.add(null); - sb.append(tp.getText(DATETAG_PROPERTY_SECONDS, DATETAG_DEFAULT_SECONDS, args)); - } - - args.clear(); - args.add(sb.toString()); - if (date.before(now)) { - // looks like this date is passed - return tp.getText(DATETAG_PROPERTY_PAST, DATETAG_DEFAULT_PAST, args); - } else { - return tp.getText(DATETAG_PROPERTY_FUTURE, DATETAG_DEFAULT_FUTURE, args); - } - } - - public boolean end(Writer writer, String body) { - String msg = null; - ValueStack stack = getStack(); - java.util.Date date = null; - // find the name on the valueStack, and cast it to a date - try { - date = (java.util.Date) findValue(name); - } catch (Exception e) { - LOG.error("Could not convert object with key '" + name - + "' to a java.util.Date instance"); - // bad date, return a blank instead ? - msg = ""; - } - - //try to find the format on the stack - if (format != null) { - format = findString(format); - } - if (date != null) { - TextProvider tp = findProviderInStack(); - if (tp != null) { - if (nice) { - msg = formatTime(tp, date); - } else { - if (format == null) { - String globalFormat = null; - - // if the format is not specified, fall back using the - // defined property DATETAG_PROPERTY - globalFormat = tp.getText(DATETAG_PROPERTY); - - // if tp.getText can not find the property then the - // returned string is the same as input = - // DATETAG_PROPERTY - if (globalFormat != null - && !DATETAG_PROPERTY.equals(globalFormat)) { - msg = new SimpleDateFormat(globalFormat, - ActionContext.getContext().getLocale()) - .format(date); - } else { - msg = DateFormat.getDateTimeInstance( - DateFormat.MEDIUM, DateFormat.MEDIUM, - ActionContext.getContext().getLocale()) - .format(date); - } - } else { - msg = new SimpleDateFormat(format, ActionContext - .getContext().getLocale()).format(date); - } - } - if (msg != null) { - try { - if (getId() == null) { - writer.write(msg); - } else { - stack.getContext().put(getId(), msg); - } - } catch (IOException e) { - LOG.error("Could not write out Date tag", e); - } - } - } - } - return super.end(writer, ""); - } - - /** - * Date or DateTime format pattern - * - * @s.tagattribute required="false" rtexprvalue="false" - */ - public void setFormat(String format) { - this.format = format; - } - - /** - * Whether to print out the date nicely - * - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setNice(boolean nice) { - this.nice = nice; - } - - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - - /** - * The date value to format - * - * @s.tagattribute required="true" type="String" - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return Returns the format. - */ - public String getFormat() { - return format; - } - - /** - * @return Returns the nice. - */ - public boolean isNice() { - return nice; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java b/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java deleted file mode 100644 index 6e59b9329..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java +++ /dev/null @@ -1,177 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Renders datepicker element.

    - * Format supported by this component are:- - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    FormatDescription
    #ddDisplay day in two digits format
    #dTry to display day in one digit format, if cannot use 2 digit format
    #MMDisplay month in two digits format
    #MTry to display month in one digits format, if cannot use 2 digit format
    #yyyyDisplay year in four digits format
    #yyDisplay the last two digits of the yaer
    #yDisplay the last digits of the year
    - * - *

    - * - * - * - * Examples - * - *

    - * 
    - *
    - * Example 1:
    - *     <s:datepicker name="order.date" label="Order Date" />
    - * Example 2:
    - *     <s:datepicker name="delivery.date" label="Delivery Date" format="#yyyy-#MM-#dd"  />
    - *     
    - * 
    - * 
    - *

    - * - * - * - * The css could be changed by using the following :- - * - * - * - *

    - * 
    - * 
    - * <s:datepicker name="birthday" label="Birthday" templateCss="...." />
    - * 
    - * 
    - * 
    - * - * @s.tag name="datepicker" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.DatePickerTag" - * description="Render datepicker" - */ -public class DatePicker extends TextField { - - final public static String TEMPLATE = "datepicker"; - - protected String format; - protected String dateIconPath; - protected String templatePath; - protected String templateCssPath; - protected String size; - - public DatePicker(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateParams() { - super.evaluateParams(); - - if (format != null) { - addParameter("format", findString(format)); - } - if (dateIconPath != null) { - addParameter("dateIconPath", dateIconPath); - } - if (templatePath != null) { - addParameter("templatePath", templatePath); - } - if (templateCssPath != null) { - addParameter("templateCssPath", templateCssPath); - } - if (size != null) { - addParameter("size", findValue(size, Integer.class)); - } - } - - /** - * The format to use for date field. - * @s.tagattribute required="false" type="String" default="Dateformat specified by language preset (%Y/%m/%d for en)" - */ - public void setFormat(String format) { - this.format = format; - } - - /** - * The date picker icon path - * @s.tagattribute required="false" type="String" default="/struts/dojo/struts/widgets/dateIcon.gif" - */ - public void setDateIconPath(String dateIconPath) { - this.dateIconPath = dateIconPath; - } - - /** - * The datepicker template path. - * @s.tagattribute required="false" type="String" - */ - public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; - } - - /** - * The datepicker template css path. - * @s.tagattribute required="false" type="String" - */ - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } - - /** - * The datepicker text field size. - * @s.tagattribute required="false" type="String" - */ - public void setSize(String size) { - this.size = size; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Debug.java b/trunk/core/src/main/java/org/apache/struts2/components/Debug.java deleted file mode 100644 index 4f1220be6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Debug.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.apache.struts2.components; - -import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.StrutsException; - -import com.opensymphony.xwork2.util.OgnlUtil; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    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="org.apache.struts2.views.jsp.ui.DebugTag" - * description="Render debug tag" - */ -public class Debug extends UIBean { - public static final String TEMPLATE = "debug"; - - public Debug(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - ValueStack 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; - } - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Div.java b/trunk/core/src/main/java/org/apache/struts2/components/Div.java deleted file mode 100644 index 8b54216c3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Div.java +++ /dev/null @@ -1,159 +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.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.views.util.UrlHelper; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * The div tag is primarily an AJAX tag, providing a remote call from the current page to update a section - * of content without having to refresh the entire page.

    - * - * It creates a HTML <DIV /> that obtains it's content via a remote XMLHttpRequest call - * via the dojo framework.

    - * - * If a "listenTopics" is supplied, it will listen to that topic and refresh it's content when any message - * is received.

    - * - * - * Important: Be sure to setup the page containing this tag to be Configured for AJAX

    - * - *

    Examples - * - *

    - * 
    - * <s:div ... />
    - * 
    - * 
    - * - * @s.tag name="div" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.DivTag" - * description="Render HTML div providing content from remote call via AJAX" - */ -public class Div extends RemoteCallUIBean { - - private static final Log _log = LogFactory.getLog(Div.class); - - - public static final String TEMPLATE = "div"; - public static final String TEMPLATE_CLOSE = "div-close"; - public static final String COMPONENT_NAME = Div.class.getName(); - - protected String updateFreq; - protected String delay; - protected String loadingText; - protected String listenTopics; - - public Div(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public String getDefaultOpenTemplate() { - return TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE_CLOSE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (null != updateFreq && !"".equals(updateFreq)) { - addParameter("updateFreq", findString(updateFreq)); - } else { - addParameter("updateFreq", "0"); - } - - if (null != delay && !"".equals(delay)) { - addParameter("delay", findString(delay)); - } else { - addParameter("delay", "0"); - } - - String tmpUpdateFreq = (String) getParameters().get("delay"); - String tmpDelay = (String) getParameters().get("updateFreq"); - try { - int _updateFreq = Integer.parseInt(tmpUpdateFreq); - int _delay = Integer.parseInt(tmpDelay); - - if (_updateFreq <= 0 && _delay <= 0) { - addParameter("autoStart", "false"); - } - } - catch(NumberFormatException e) { - // too bad, invalid updateFreq or delay provided, we - // can't determine autoStart mode. - _log.info("error while parsing updateFreq ["+tmpUpdateFreq+"] or delay ["+tmpDelay+"] to integer, cannot determine autoStart mode", e); - } - - if (loadingText != null) { - addParameter("loadingText", findString(loadingText)); - } - - if (listenTopics != null) { - addParameter("listenTopics", findString(listenTopics)); - } - - if (href != null) { - - // This is needed for portal and DOJO ajax stuff! - addParameter("href", null); - addParameter("href", UrlHelper.buildUrl(findString(href), request, response, null)); - } - } - - /** - * How often to re-fetch the content (in milliseconds) - * @s.tagattribute required="false" type="Integer" default="0" - */ - public void setUpdateFreq(String updateFreq) { - this.updateFreq = updateFreq; - } - - /** - * How long to wait before fetching the content (in milliseconds) - * @s.tagattribute required="false" type="Integer" default="0" - */ - public void setDelay(String delay) { - this.delay = delay; - } - - /** - * The text to display to the user while the new content is being fetched (especially good if the content will take awhile) - * @s.tagattribute required="false" rtexprvalue="true" - */ - public void setLoadingText(String loadingText) { - this.loadingText = loadingText; - } - - /** - * Topic name to listen to (comma delimited), that will cause the DIV's content to be re-fetched - * @s.tagattribute required="false" - */ - public void setListenTopics(String listenTopics) { - this.listenTopics = listenTopics; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java b/trunk/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java deleted file mode 100644 index dde415b5c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java +++ /dev/null @@ -1,667 +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 java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * DoubleListUIBean is the standard superclass of all Struts double list handling components. - * - *

    - * - * - * - * Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" - * respectively only when the doublelist attribute is evaluated to a Map or its decendant. - * Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. - * - * - * - */ -public abstract class DoubleListUIBean extends ListUIBean { - - protected String emptyOption; - protected String headerKey; - protected String headerValue; - protected String multiple; - protected String size; - - protected String doubleList; - protected String doubleListKey; - protected String doubleListValue; - protected String doubleName; - protected String doubleValue; - protected String formName; - - protected String doubleId; - protected String doubleDisabled; - protected String doubleMultiple; - protected String doubleSize; - protected String doubleHeaderKey; - protected String doubleHeaderValue; - protected String doubleEmptyOption; - - protected String doubleCssClass; - protected String doubleCssStyle; - - protected String doubleOnclick; - protected String doubleOndblclick; - protected String doubleOnmousedown; - protected String doubleOnmouseup; - protected String doubleOnmouseover; - protected String doubleOnmousemove; - protected String doubleOnmouseout; - protected String doubleOnfocus; - protected String doubleOnblur; - protected String doubleOnkeypress; - protected String doubleOnkeydown; - protected String doubleOnkeyup; - protected String doubleOnselect; - protected String doubleOnchange; - - protected String doubleAccesskey; - - - public DoubleListUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - //Object doubleName = null; - - if (emptyOption != null) { - addParameter("emptyOption", findValue(emptyOption, Boolean.class)); - } - - if (multiple != null) { - addParameter("multiple", findValue(multiple, Boolean.class)); - } - - if (size != null) { - addParameter("size", findString(size)); - } - - if ((headerKey != null) && (headerValue != null)) { - addParameter("headerKey", findString(headerKey)); - addParameter("headerValue", findString(headerValue)); - } - - - if (doubleMultiple != null) { - addParameter("doubleMultiple", findValue(doubleMultiple, Boolean.class)); - } - - if (doubleSize != null) { - addParameter("doubleSize", findString(doubleSize)); - } - - if (doubleDisabled != null) { - addParameter("doubleDisabled", findValue(doubleDisabled, Boolean.class)); - } - - if (doubleName != null) { - addParameter("doubleName", findString(this.doubleName)); - } - - if (doubleList != null) { - addParameter("doubleList", doubleList); - } - - Object tmpDoubleList = findValue(doubleList); - if (doubleListKey != null) { - addParameter("doubleListKey", doubleListKey); - }else if (tmpDoubleList instanceof Map) { - addParameter("doubleListKey", "key"); - } - - if (doubleListValue != null) { - if (altSyntax()) { - // the same logic as with findValue(String) - // if value start with %{ and end with }, just cut it off! - if (doubleListValue.startsWith("%{") && doubleListValue.endsWith("}")) { - doubleListValue = doubleListValue.substring(2, doubleListValue.length() - 1); - } - } - - addParameter("doubleListValue", doubleListValue); - }else if (tmpDoubleList instanceof Map) { - addParameter("doubleListValue", "value"); - } - - - if (formName != null) { - addParameter("formName", findString(formName)); - } else { - // ok, let's look it up - Component form = findAncestor(Form.class); - if (form != null) { - addParameter("formName", form.getParameters().get("name")); - } - } - - Class valueClazz = getValueClassType(); - - if (valueClazz != null) { - if (doubleValue != null) { - addParameter("doubleNameValue", findValue(doubleValue, valueClazz)); - } else if (doubleName != null) { - addParameter("doubleNameValue", findValue(doubleName.toString(), valueClazz)); - } - } else { - if (doubleValue != null) { - addParameter("doubleNameValue", findValue(doubleValue)); - } else if (doubleName != null) { - addParameter("doubleNameValue", findValue(doubleName.toString())); - } - } - - Form form = (Form) findAncestor(Form.class); - if (doubleId != null) { - // this check is needed for backwards compatibility with 2.1.x - if (altSyntax()) { - addParameter("doubleId", findString(doubleId)); - } else { - addParameter("doubleId", doubleId); - } - } else if (form != null) { - addParameter("doubleId", form.getParameters().get("id") + "_" +escape(this.doubleName)); - } - - if (doubleOnclick != null) { - addParameter("doubleOnclick", findString(doubleOnclick)); - } - - if (doubleOndblclick != null) { - addParameter("doubleOndblclick", findString(doubleOndblclick)); - } - - if (doubleOnmousedown != null) { - addParameter("doubleOnmousedown", findString(doubleOnmousedown)); - } - - if (doubleOnmouseup != null) { - addParameter("doubleOnmouseup", findString(doubleOnmouseup)); - } - - if (doubleOnmouseover != null) { - addParameter("doubleOnmouseover", findString(doubleOnmouseover)); - } - - if (doubleOnmousemove != null) { - addParameter("doubleOnmousemove", findString(doubleOnmousemove)); - } - - if (doubleOnmouseout != null) { - addParameter("doubleOnmouseout", findString(doubleOnmouseout)); - } - - if (doubleOnfocus != null) { - addParameter("doubleOnfocus", findString(doubleOnfocus)); - } - - if (doubleOnblur != null) { - addParameter("doubleOnblur", findString(doubleOnblur)); - } - - if (doubleOnkeypress != null) { - addParameter("doubleOnkeypress", findString(doubleOnkeypress)); - } - - if (doubleOnkeydown != null) { - addParameter("doubleOnkeydown", findString(doubleOnkeydown)); - } - - if (doubleOnselect != null) { - addParameter("doubleOnselect", findString(doubleOnselect)); - } - - if (doubleOnchange != null) { - addParameter("doubleOnchange", findString(doubleOnchange)); - } - - if (doubleCssClass != null) { - addParameter("doubleCss", findString(doubleCssClass)); - } - - if (doubleCssStyle != null) { - addParameter("doubleStyle", findString(doubleCssStyle)); - } - - if (doubleHeaderKey != null && doubleHeaderValue != null) { - addParameter("doubleHeaderKey", findString(doubleHeaderKey)); - addParameter("doubleHeaderValue", findString(doubleHeaderValue)); - } - - if (doubleEmptyOption != null) { - addParameter("doubleEmptyOption", findValue(doubleEmptyOption, Boolean.class)); - } - - if (doubleAccesskey != null) { - addParameter("doubleAccesskey", findString(doubleAccesskey)); - } - } - - /** - * The second iterable source to populate from. - * @s.tagattribute required="true" - */ - public void setDoubleList(String doubleList) { - this.doubleList = doubleList; - } - - /** - * The key expression to use for second list - * @s.tagattribute required="false" - */ - public void setDoubleListKey(String doubleListKey) { - this.doubleListKey = doubleListKey; - } - - /** - * The value expression to use for second list - * @s.tagattribute required="false" - */ - public void setDoubleListValue(String doubleListValue) { - this.doubleListValue = doubleListValue; - } - - /** - * The name for complete component - * @s.tagattribute required="true" - */ - public void setDoubleName(String doubleName) { - this.doubleName = doubleName; - } - - /** - * The value expression for complete component - * @s.tagattribute required="false" - */ - public void setDoubleValue(String doubleValue) { - this.doubleValue = doubleValue; - } - - /** - * The form name this component resides in and populates to - * @s.tagattribute required="false" - */ - public void setFormName(String formName) { - this.formName = formName; - } - - public String getFormName() { - return formName; - } - - /** - * The css class for the second list - * @s.tagattribute required="false" - */ - public void setDoubleCssClass(String doubleCssClass) { - this.doubleCssClass = doubleCssClass; - } - - public String getDoubleCssClass() { - return doubleCssClass; - } - - /** - * The css style for the second list - * @s.tagattribute required="false" - */ - public void setDoubleCssStyle(String doubleCssStyle) { - this.doubleCssStyle = doubleCssStyle; - } - - public String getDoubleCssStyle() { - return doubleCssStyle; - } - - /** - * The header key for the second list - * @s.tagattribute required="false" - */ - public void setDoubleHeaderKey(String doubleHeaderKey) { - this.doubleHeaderKey = doubleHeaderKey; - } - - public String getDoubleHeaderKey() { - return doubleHeaderKey; - } - - /** - * The header value for the second list - * @s.tagattribute required="false" - */ - public void setDoubleHeaderValue(String doubleHeaderValue) { - this.doubleHeaderValue = doubleHeaderValue; - } - - public String getDoubleHeaderValue() { - return doubleHeaderValue; - } - - /** - * Decides if the second list will add an empty option - * @s.tagattribute required="false" - */ - public void setDoubleEmptyOption(String doubleEmptyOption) { - this.doubleEmptyOption = doubleEmptyOption; - } - - public String getDoubleEmptyOption() { - return this.doubleEmptyOption; - } - - - public String getDoubleDisabled() { - return doubleDisabled; - } - - /** - * Decides if a disable attribute should be added to the second list - * @s.tagattribute required="false" - */ - public void setDoubleDisabled(String doubleDisabled) { - this.doubleDisabled = doubleDisabled; - } - - public String getDoubleId() { - return doubleId; - } - - /** - * The id of the second list - * @s.tagattribute required="false" - */ - public void setDoubleId(String doubleId) { - this.doubleId = doubleId; - } - - public String getDoubleMultiple() { - return doubleMultiple; - } - - /** - * Decides if multiple attribute should be set on the second list - * @s.tagattribute required="false" - */ - public void setDoubleMultiple(String doubleMultiple) { - this.doubleMultiple = doubleMultiple; - } - - public String getDoubleOnblur() { - return doubleOnblur; - } - - /** - * Set the onblur attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnblur(String doubleOnblur) { - this.doubleOnblur = doubleOnblur; - } - - public String getDoubleOnchange() { - return doubleOnchange; - } - - /** - * Set the onchange attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnchange(String doubleOnchange) { - this.doubleOnchange = doubleOnchange; - } - - public String getDoubleOnclick() { - return doubleOnclick; - } - - /** - * Set the onclick attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnclick(String doubleOnclick) { - this.doubleOnclick = doubleOnclick; - } - - public String getDoubleOndblclick() { - return doubleOndblclick; - } - - /** - * Set the ondbclick attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOndblclick(String doubleOndblclick) { - this.doubleOndblclick = doubleOndblclick; - } - - public String getDoubleOnfocus() { - return doubleOnfocus; - } - - /** - * Set the onfocus attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnfocus(String doubleOnfocus) { - this.doubleOnfocus = doubleOnfocus; - } - - public String getDoubleOnkeydown() { - return doubleOnkeydown; - } - - /** - * Set the onkeydown attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnkeydown(String doubleOnkeydown) { - this.doubleOnkeydown = doubleOnkeydown; - } - - public String getDoubleOnkeypress() { - return doubleOnkeypress; - } - - /** - * Set the onkeypress attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnkeypress(String doubleOnkeypress) { - this.doubleOnkeypress = doubleOnkeypress; - } - - public String getDoubleOnkeyup() { - return doubleOnkeyup; - } - - /** - * Set the onkeyup attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnkeyup(String doubleOnkeyup) { - this.doubleOnkeyup = doubleOnkeyup; - } - - public String getDoubleOnmousedown() { - return doubleOnmousedown; - } - - /** - * Set the onmousedown attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnmousedown(String doubleOnmousedown) { - this.doubleOnmousedown = doubleOnmousedown; - } - - public String getDoubleOnmousemove() { - return doubleOnmousemove; - } - - /** - * Set the onmousemove attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnmousemove(String doubleOnmousemove) { - this.doubleOnmousemove = doubleOnmousemove; - } - - public String getDoubleOnmouseout() { - return doubleOnmouseout; - } - - /** - * Set the onmouseout attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnmouseout(String doubleOnmouseout) { - this.doubleOnmouseout = doubleOnmouseout; - } - - public String getDoubleOnmouseover() { - return doubleOnmouseover; - } - - /** - * Set the onmouseover attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnmouseover(String doubleOnmouseover) { - this.doubleOnmouseover = doubleOnmouseover; - } - - public String getDoubleOnmouseup() { - return doubleOnmouseup; - } - - /** - * Set the onmouseup attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnmouseup(String doubleOnmouseup) { - this.doubleOnmouseup = doubleOnmouseup; - } - - public String getDoubleOnselect() { - return doubleOnselect; - } - - /** - * Set the onselect attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleOnselect(String doubleOnselect) { - this.doubleOnselect = doubleOnselect; - } - - public String getDoubleSize() { - return doubleSize; - } - - /** - * Set the size attribute of the second list - * @s.tagattribute required="false" - */ - public void setDoubleSize(String doubleSize) { - this.doubleSize = doubleSize; - } - - public String getDoubleList() { - return doubleList; - } - - /** - * Set the list key of the second attribute - * @s.tagattribute required="false" - */ - public String getDoubleListKey() { - return doubleListKey; - } - - public String getDoubleListValue() { - return doubleListValue; - } - - public String getDoubleName() { - return doubleName; - } - - public String getDoubleValue() { - return doubleValue; - } - - /** - * Decides of an empty option is to be inserted in the second list - * @s.tagattribute required="false" default="false" type="Boolean" - */ - public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } - - /** - * Set the header key of the second list. Must not be empty! "'-1'" and "''" is correct, "" is bad. - * @s.tagattribute required="false" - */ - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } - - /** - * Set the header value of the second list - * @s.tagattribute required="false" - */ - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } - - /** - * Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. - * @s.tagattribute required="false" - */ - public void setMultiple(String multiple) { - // TODO: Passing a Collection may work too? - this.multiple = multiple; - } - - /** - * Size of the element box (# of elements to show) - * @s.tagattribute required="false" type="Integer" - */ - public void setSize(String size) { - this.size = size; - } - - /** - * Set the html accesskey attribute. - * @s.tagattribute required="false" - */ - public void setDoubleAccesskey(String doubleAccesskey) { - this.doubleAccesskey = doubleAccesskey; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/DoubleSelect.java b/trunk/core/src/main/java/org/apache/struts2/components/DoubleSelect.java deleted file mode 100644 index d7d9eba3f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/DoubleSelect.java +++ /dev/null @@ -1,60 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Renders two HTML select elements with second one changing displayed values depending on selected entry of first one. - * - * - *

    Examples - * - *

    - * 
    - * <s:doubleselect label="doubleselect test1" name="menu" list="{'fruit','other'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" />
    - * <s:doubleselect label="doubleselect test2" name="menu" list="#{'fruit':'Nice Fruits', 'other':'Other Dishes'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" />
    - * 
    - * 
    - * - * @s.tag name="doubleselect" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.DoubleSelectTag" - * description="Renders two HTML select elements with second one changing displayed values depending on selected entry of first one." - */ -public class DoubleSelect extends DoubleListUIBean { - final public static String TEMPLATE = "doubleselect"; - - - public DoubleSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - // force the onchange parameter - addParameter("onchange", getParameters().get("name") + "Redirect(this.options.selectedIndex)"); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Else.java b/trunk/core/src/main/java/org/apache/struts2/components/Else.java deleted file mode 100644 index 128e22cfb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Else.java +++ /dev/null @@ -1,69 +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 java.io.Writer; -import java.util.Map; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - *

    Perform basic condition flow. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else' - * Tag.

    - * - * - * - * - * - * no params - * - * - * - * - *
    - * 
    - *  <s:if test="%{false}">
    - * 	    <div>Will Not Be Executed</div>
    - *  </s:if>
    - * 	<s:elseif test="%{true}">
    - * 	    <div>Will Be Executed</div>
    - *  </s:elseif>
    - *  <s:else>
    - * 	    <div>Will Not Be Executed</div>
    - *  </s:else>
    - * 
    - * 
    - * - * @s.tag name="else" bodycontent="JSP" description="Else tag" tld-tag-class="org.apache.struts2.views.jsp.ElseTag" - */ -public class Else extends Component { - public Else(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - Map context = stack.getContext(); - Boolean ifResult = (Boolean) context.get(If.ANSWER); - - context.remove(If.ANSWER); - - return !((ifResult == null) || (ifResult.booleanValue())); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ElseIf.java b/trunk/core/src/main/java/org/apache/struts2/components/ElseIf.java deleted file mode 100644 index de4968619..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ElseIf.java +++ /dev/null @@ -1,104 +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 java.io.Writer; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - *

    Perform basic condition flow. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else' - * Tag.

    - * - * - * - * - * - * - *
      - * - *
    • test* (Boolean) - Logic to determined if body of tag is to be displayed
    • - * - *
    - * - * - * - * - *
    - * 
    - *  <s:if test="%{false}">
    - * 	    <div>Will Not Be Executed</div>
    - *  </s:if>
    - * 	<s:elseif test="%{true}">
    - * 	    <div>Will Be Executed</div>
    - *  </s:elseif>
    - *  <s:else>
    - * 	    <div>Will Not Be Executed</div>
    - *  </s:else>
    - * 
    - * 
    - * - * @s.tag name="elseif" tld-body-content="JSP" description="Elseif tag" tld-tag-class="org.apache.struts2.views.jsp.ElseIfTag" - */ -public class ElseIf extends Component { - public ElseIf(ValueStack stack) { - super(stack); - } - - protected Boolean answer; - protected String test; - - public boolean start(Writer writer) { - Boolean ifResult = (Boolean) stack.getContext().get(If.ANSWER); - - if ((ifResult == null) || (ifResult.booleanValue())) { - return false; - } - - //make the comparision - answer = (Boolean) findValue(test, Boolean.class); - - if (answer == null) { - answer = Boolean.FALSE; - } - if (answer.booleanValue()) { - stack.getContext().put(If.ANSWER, answer); - } - return answer != null && answer.booleanValue(); - } - - public boolean end(Writer writer, String body) { - if (answer == null) { - answer = Boolean.FALSE; - } - if (answer.booleanValue()) { - stack.getContext().put(If.ANSWER, answer); - } - return super.end(writer, ""); - } - - /** - * Expression to determine if body of tag is to be displayed - * @s.tagattribute required="true" type="Boolean" - */ - public void setTest(String test) { - this.test = test; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/FieldError.java b/trunk/core/src/main/java/org/apache/struts2/components/FieldError.java deleted file mode 100644 index 72f8111b5..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/FieldError.java +++ /dev/null @@ -1,107 +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 java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Param.UnnamedParametric; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Render field errors if they exists. Specific layout depends on the particular theme. - * - * - * - *

    Examples - * - *

    - * 
    - * 
    - *    <!-- example 1 -->
    - *    <s:fielderror />
    - *
    - *    <!-- example 2 -->
    - *    <s:fielderror>
    - *         <s:param>field1</s:param>
    - *         <s:param>field2</s:param>
    - *    </s:fielderror>
    - *    <s:form .... >>
    - *       ....
    - *    </s:form>
    - *
    - *    OR
    - *
    - *    <s:fielderror>
    - *    		<s:param value="%{'field1'}" />
    - *    		<s:param value="%{'field2'}" />
    - *    </s:fielderror>
    - *    <s:form .... >>
    - *       ....
    - *    </s:form>
    - *    
    - * 
    - * 
    - * - * - *

    Description

    - * - * - *

    - * 
    - *
    - * Example 1: display all field errors

    - * Example 2: display field errors only for 'field1' and 'field2'

    - * - * - *

    - * - * @s.tag name="fielderror" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.FieldErrorTag" - * description="Render field error (all or partial depending on param tag nested)if they exists" - */ -public class FieldError extends UIBean implements UnnamedParametric { - - private List errorFieldNames = new ArrayList(); - - public FieldError(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - private static final String TEMPLATE = "fielderror"; - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void addParameter(Object value) { - if (value != null) { - errorFieldNames.add(value.toString()); - } - } - - public List getFieldErrorFieldNames() { - return errorFieldNames; - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/components/File.java b/trunk/core/src/main/java/org/apache/struts2/components/File.java deleted file mode 100644 index a1e2e6af2..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/File.java +++ /dev/null @@ -1,103 +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.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Renders an HTML file input element. - * - * - *

    Examples - * - *

    - * 
    - * <s:file name="anUploadFile" accept="text/*" />
    - * <s:file name="anohterUploadFIle" accept="text/html,text/plain" />
    - * 
    - * 
    - * - * @s.tag name="file" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.FileTag" - * description="Render a file input field" - */ -public class File extends UIBean { - private final static Log log = LogFactory.getLog(File.class); - - final public static String TEMPLATE = "file"; - - protected String accept; - protected String size; - - public File(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateParams() { - super.evaluateParams(); - - Form form = (Form) findAncestor(Form.class); - if (form != null) { - String encType = (String) form.getParameters().get("enctype"); - if (!"multipart/form-data".equals(encType)) { - // uh oh, this isn't good! Let's warn the developer - log.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!"); - } - - String method = (String) form.getParameters().get("method"); - if (!"post".equalsIgnoreCase(method)) { - // uh oh, this isn't good! Let's warn the developer - log.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!"); - } - } - - if (accept != null) { - addParameter("accept", findString(accept)); - } - - if (size != null) { - addParameter("size", findString(size)); - } - } - - /** - * HTML accept attribute to indicate accepted file mimetypes - * @s.tagattribute required="false" - */ - public void setAccept(String accept) { - this.accept = accept; - } - - /** - * HTML size attribute - * @s.tagattribute required="false" type="Integer" - */ - public void setSize(String size) { - this.size = size; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Form.java b/trunk/core/src/main/java/org/apache/struts2/components/Form.java deleted file mode 100644 index 996aa5996..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Form.java +++ /dev/null @@ -1,509 +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 java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.lang.StringUtils; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.mapper.ActionMapperFactory; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.portlet.context.PortletActionContext; -import org.apache.struts2.portlet.util.PortletUrlHelper; -import org.apache.struts2.views.util.UrlHelper; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ObjectFactory; -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.config.RuntimeConfiguration; -import com.opensymphony.xwork2.config.entities.ActionConfig; -import com.opensymphony.xwork2.config.entities.InterceptorMapping; -import com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; -import com.opensymphony.xwork2.validator.FieldValidator; -import com.opensymphony.xwork2.validator.ValidationInterceptor; -import com.opensymphony.xwork2.validator.Validator; - -/** - * - *

    - * Renders HTML an input form.

    - *

    - * The remote form allows the form to be submitted without the page being refreshed. The results from the form - * can be inserted into any HTML element on the page.

    - *

    - * NOTE:

    - * The order / logic in determining the posting url of the generated HTML form is as follows:- - *

      - *
    1. - * If the action attribute is not specified, then the current request will be used to - * determine the posting url - *
    2. - *
    3. - * If the action is given, Struts will try to obtain an ActionConfig. This will be - * successfull if the action attribute is a valid action alias defined struts.xml. - *
    4. - *
    5. - * If the action is given and is not an action alias defined in struts.xml, Struts - * will used the action attribute as if it is the posting url, separting the namespace - * from it and using UrlHelper to generate the final url. - *
    6. - *
    - *

    - * - *

    - *

    Examples - *

    - *

    - * 
    - * 

    - * <s:form ... /> - *

    - * - *

    - * - * @s.tag name="form" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.FormTag" - * description="Renders an input form" - */ -public class Form extends ClosingUIBean { - public static final String OPEN_TEMPLATE = "form"; - public static final String TEMPLATE = "form-close"; - - private int sequence = 0; - - protected String onsubmit; - protected String action; - protected String target; - protected String enctype; - protected String method; - protected String namespace; - protected String validate; - protected String portletMode; - protected String windowState; - protected String acceptcharset; - - public Form(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected boolean evaluateNameValue() { - return false; - } - - public String getDefaultOpenTemplate() { - return OPEN_TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - - /* - * Revised for Portlet actionURL as form action, and add wwAction as hidden - * field. Refer to template.simple/form.vm - */ - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - //boolean isAjax = "ajax".equalsIgnoreCase(this.theme); - - if (validate != null) { - addParameter("validate", findValue(validate, Boolean.class)); - } - - // calculate the action and namespace - /*String action = null; - if (this.action != null) { - // if it isn't specified, we'll make somethig up - action = findString(this.action); - } - - if (Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) { - evaluateExtraParamsPortletRequest(namespace, action); - } else { - String namespace = determineNamespace(this.namespace, getStack(), - request); - evaluateExtraParamsServletRequest(action, namespace, isAjax); - }*/ - - if (onsubmit != null) { - addParameter("onsubmit", findString(onsubmit)); - } - - if (target != null) { - addParameter("target", findString(target)); - } - - if (enctype != null) { - addParameter("enctype", findString(enctype)); - } - - if (method != null) { - addParameter("method", findString(method)); - } - - if (acceptcharset != null) { - addParameter("acceptcharset", findString(acceptcharset)); - } - - // keep a collection of the tag names for anything special the templates might want to do (such as pure client - // side validation) - if (!parameters.containsKey("tagNames")) { - // we have this if check so we don't do this twice (on open and close of the template) - addParameter("tagNames", new ArrayList()); - } - } - - /** - * Form component determine the its HTML element id as follows:- - *
      - *
    1. if an 'id' attribute is specified.
    2. - *
    3. if an 'action' attribute is specified, it will be used as the id.
    4. - *
    - */ - protected void populateComponentHtmlId(Form form) { - boolean isAjax = "ajax".equalsIgnoreCase(this.theme); - - String action = null; - if (this.action != null) { - // if it isn't specified, we'll make somethig up - action = findString(this.action); - } - - if (id != null) { - addParameter("id", escape(id)); - } - if (Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) { - evaluateExtraParamsPortletRequest(namespace, action); - } else { - String namespace = determineNamespace(this.namespace, getStack(), - request); - evaluateExtraParamsServletRequest(action, namespace, isAjax); - } - } - - /** - * @param isAjax - * @param namespace - * @param action - */ - private void evaluateExtraParamsServletRequest(String action, String namespace, boolean isAjax) { - if (action == null) { - // no action supplied? ok, then default to the current request (action or general URL) - ActionInvocation ai = (ActionInvocation) getStack().getContext().get(ActionContext.ACTION_INVOCATION); - if (ai != null) { - action = ai.getProxy().getActionName(); - namespace = ai.getProxy().getNamespace(); - } else { - // hmm, ok, we need to just assume the current URL cut down - String uri = request.getRequestURI(); - action = uri.substring(uri.lastIndexOf('/')); - } - } - - String actionMethod = ""; - // FIXME: our implementation is flawed - the only concept of ! should be in DefaultActionMapper - boolean allowDynamicMethodCalls = "true".equals(Settings.get(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)); - - // handle "name!method" convention. - if (allowDynamicMethodCalls) { - if (action.indexOf("!") != -1) { - int endIdx = action.lastIndexOf("!"); - actionMethod = action.substring(endIdx + 1, action.length()); - action = action.substring(0, endIdx); - } - } - - Configuration config = Dispatcher.getInstance().getConfigurationManager().getConfiguration(); - final ActionConfig actionConfig = config.getRuntimeConfiguration().getActionConfig(namespace, action); - String actionName = action; - if (actionConfig != null) { - - ActionMapping mapping = new ActionMapping(action, namespace, actionMethod, parameters); - String result = UrlHelper.buildUrl(ActionMapperFactory.getMapper().getUriFromActionMapping(mapping), request, response, null); - addParameter("action", result); - - // let's try to get the actual action class and name - // this can be used for getting the list of validators - addParameter("actionName", actionName); - try { - Class clazz = ObjectFactory.getObjectFactory().getClassInstance(actionConfig.getClassName()); - addParameter("actionClass", clazz); - } catch (ClassNotFoundException e) { - // this is OK, we'll just move on - } - - addParameter("namespace", namespace); - - // if the name isn't specified, use the action name - if (name == null) { - addParameter("name", action); - } - - // if the id isn't specified, use the action name - if (id == null) { - addParameter("id", action); - } - } else if (action != null) { - // Since we can't find an action alias in the configuration, we just assume - // the action attribute supplied is the path to be used as the uri this - // form is submitting to. - - String result = UrlHelper.buildUrl(action, request, response, null); - addParameter("action", result); - - // namespace: cut out anything between the start and the last / - int slash = result.lastIndexOf('/'); - if (slash != -1) { - addParameter("namespace", result.substring(0, slash)); - } else { - addParameter("namespace", ""); - } - - // name/id: cut out anything between / and . should be the id and name - if (id == null) { - slash = result.lastIndexOf('/'); - int dot = result.indexOf('.', slash); - if (dot != -1) { - id = result.substring(slash + 1, dot); - } else { - id = result.substring(slash + 1); - } - addParameter("id", escape(id)); - } - } - - // WW-1284 - // evaluate if client-side js is to be enabled. (if validation interceptor - // does allow validation eg. method is not filtered out) - evaluateClientSideJsEnablement(actionName, namespace, actionMethod); - } - - private void evaluateClientSideJsEnablement(String actionName, String namespace, String actionMethod) { - - // Only evaluate if Client-Side js is to be enable when validate=true - Boolean validate = (Boolean) getParameters().get("validate"); - if (validate != null && validate.booleanValue()) { - - addParameter("performValidation", Boolean.FALSE); - - RuntimeConfiguration runtimeConfiguration = Dispatcher.getInstance().getConfigurationManager().getConfiguration().getRuntimeConfiguration(); - ActionConfig actionConfig = runtimeConfiguration.getActionConfig(namespace, actionName); - - if (actionConfig != null) { - List interceptors = actionConfig.getInterceptors(); - for (Iterator i = interceptors.iterator(); i.hasNext();) { - InterceptorMapping interceptorMapping = (InterceptorMapping) i.next(); - if (ValidationInterceptor.class.isInstance(interceptorMapping.getInterceptor())) { - ValidationInterceptor validationInterceptor = (ValidationInterceptor) interceptorMapping.getInterceptor(); - - Set excludeMethods = validationInterceptor.getExcludeMethodsSet(); - Set includeMethods = validationInterceptor.getIncludeMethodsSet(); - - if (MethodFilterInterceptorUtil.applyMethod(excludeMethods, includeMethods, actionMethod)) { - addParameter("performValidation", Boolean.TRUE); - } - return; - } - } - } - } - } - - /** - * Constructs the action url adapted to a portal environment. - * - * @param action The action to create the URL for. - */ - private void evaluateExtraParamsPortletRequest(String namespace, String action) { - - if (this.action != null) { - // if it isn't specified, we'll make somethig up - action = findString(this.action); - } - - String type = "action"; - if (StringUtils.isNotEmpty(method)) { - if ("GET".equalsIgnoreCase(method.trim())) { - type = "render"; - } - } - if (action != null) { - String result = PortletUrlHelper.buildUrl(action, namespace, - getParameters(), type, portletMode, windowState); - addParameter("action", result); - - // namespace: cut out anything between the start and the last / - int slash = result.lastIndexOf('/'); - if (slash != -1) { - addParameter("namespace", result.substring(0, slash)); - } else { - addParameter("namespace", ""); - } - - // name/id: cut out anything between / and . should be the id and - // name - if (id == null) { - slash = action.lastIndexOf('/'); - int dot = action.indexOf('.', slash); - if (dot != -1) { - id = action.substring(slash + 1, dot); - } else { - id = action.substring(slash + 1); - } - addParameter("id", escape(id)); - } - } - - } - - public List getValidators(String name) { - Class actionClass = (Class) getParameters().get("actionClass"); - if (actionClass == null) { - return Collections.EMPTY_LIST; - } - - List all = ActionValidatorManagerFactory.getInstance().getValidators(actionClass, (String) getParameters().get("actionName")); - List validators = new ArrayList(); - for (Iterator iterator = all.iterator(); iterator.hasNext();) { - Validator validator = (Validator) iterator.next(); - if (validator instanceof FieldValidator) { - FieldValidator fieldValidator = (FieldValidator) validator; - if (fieldValidator.getFieldName().equals(name)) { - validators.add(fieldValidator); - } - } - } - - return validators; - } - - /** - * Get a incrementing sequence unique to this Form component. - * It is used by Form component's child that might need a - * sequence to make them unique. - * - * @return int - */ - protected int getSequence() { - return sequence++; - } - - - /** - * HTML onsubmit attribute - * - * @s.tagattribute required="false" - */ - public void setOnsubmit(String onsubmit) { - this.onsubmit = onsubmit; - } - - /** - * Set action nane to submit to, without .action suffix - * - * @s.tagattribute required="false" default="current action" - */ - public void setAction(String action) { - this.action = action; - } - - /** - * HTML form target attribute - * - * @s.tagattribute required="false" - */ - public void setTarget(String target) { - this.target = target; - } - - /** - * HTML form enctype attribute - * - * @s.tagattribute required="false" - */ - public void setEnctype(String enctype) { - this.enctype = enctype; - } - - /** - * HTML form method attribute - * - * @s.tagattribute required="false" - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * namespace for action to submit to - * - * @s.tagattribute required="false" default="current namespace" - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * Whether client side/remote validation should be performed. Only useful with theme xhtml/ajax - * - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setValidate(String validate) { - this.validate = validate; - } - - /** - * The portlet mode to display after the form submit - * - * @s.tagattribute required="false" - */ - public void setPortletMode(String portletMode) { - this.portletMode = portletMode; - } - - /** - * The window state to display after the form submit - * - * @s.tagattribute required="false" - */ - public void setWindowState(String windowState) { - this.windowState = windowState; - } - - /** - * The accepted charsets for this form. The values may be comma or blank delimited. - * - * @s.tagattribute required="false" - */ - public void setAcceptcharset(String acceptcharset) { - this.acceptcharset = acceptcharset; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/FormButton.java b/trunk/core/src/main/java/org/apache/struts2/components/FormButton.java deleted file mode 100644 index c9cc084b9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/FormButton.java +++ /dev/null @@ -1,174 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * FormButton. - */ -public abstract class FormButton extends UIBean { - - static final String BUTTONTYPE_INPUT = "input"; - static final String BUTTONTYPE_BUTTON = "button"; - static final String BUTTONTYPE_IMAGE = "image"; - - protected String action; - protected String method; - protected String align; - protected String type; - - public FormButton(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - //public void evaluateParams() { - public void evaluateExtraParams() { - super.evaluateExtraParams(); - if (align == null) { - align = "right"; - } - - String submitType = BUTTONTYPE_INPUT; - if (type != null && (BUTTONTYPE_BUTTON.equalsIgnoreCase(type) || (supportsImageType() && BUTTONTYPE_IMAGE.equalsIgnoreCase(type)))) - { - submitType = type; - } - - //super.evaluateParams(); - - addParameter("type", submitType); - - if (!BUTTONTYPE_INPUT.equals(submitType) && (label == null)) { - addParameter("label", getParameters().get("nameValue")); - } - - if (action != null || method != null) { - String name; - - if (action != null) { - name = "action:" + findString(action); - - if (method != null) { - name += "!" + findString(method); - } - } else { - name = "method:" + findString(method); - } - - addParameter("name", name); - } - - addParameter("align", findString(align)); - - } - - /** - * Override UIBean's implementation, such that component Html id is determined - * in the following order :- - *
      - *
    1. This component id attribute
    2. - *
    3. [containing_form_id]_[this_component_name]
    4. - *
    5. [containing_form_id]_[this_component_action]_[this_component_method]
    6. - *
    7. [containing_form_id]_[this_component_method]
    8. - *
    9. [this_component_name]
    10. - *
    11. [this_component_action]_[this_component_method]
    12. - *
    13. [this_component_method]
    14. - *
    15. [an increasing sequential number unique to the form starting with 0]
    16. - *
    - */ - protected void populateComponentHtmlId(Form form) { - String _tmp_id = ""; - if (id != null) { - // this check is needed for backwards compatibility with 2.1.x - if (altSyntax()) { - _tmp_id = findString(id); - } else { - _tmp_id = id; - } - } - else { - if (form != null && form.getParameters().get("id") != null) { - _tmp_id = _tmp_id + form.getParameters().get("id").toString() + "_"; - } - if (name != null) { - _tmp_id = _tmp_id + escape(name); - } else if (action != null || method != null){ - if (action != null) { - _tmp_id = _tmp_id + escape(action); - } - if (method != null) { - _tmp_id = _tmp_id + "_" + escape(method); - } - } else { - // if form is null, this component is used, without a form, i guess - // there's not much we could do then. - if (form != null) { - _tmp_id = _tmp_id + form.getSequence(); - } - } - } - addParameter("id", _tmp_id); - } - - /** - * Indicate whether the concrete button supports the type "image". - * - * @return true if type image is supported. - */ - protected abstract boolean supportsImageType(); - - /** - * Set action attribute. - * - * @s.tagattribute required="false" type="String" - */ - public void setAction(String action) { - this.action = action; - } - - /** - * Set method attribute. - * - * @s.tagattribute required="false" type="String" - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * HTML align attribute. - * - * @s.tagattribute required="false" type="String" - */ - public void setAlign(String align) { - this.align = align; - } - - /** - * The type of submit to use. Valid values are input, button and image. - * - * @s.tagattribute required="false" type="String" default="input" - */ - public void setType(String type) { - this.type = type; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/GenericUIBean.java b/trunk/core/src/main/java/org/apache/struts2/components/GenericUIBean.java deleted file mode 100644 index 0221742c9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/GenericUIBean.java +++ /dev/null @@ -1,125 +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.util.ContainUtil; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Renders an custom UI widget using the specified templates. Additional objects can be passed in to the template - * using the param tags.

    - * - * Freemarker:

    - * Objects provided can be retrieve from within the template via $parameters._paramname_.

    - * - * Jsp:

    - * Objects provided can be retrieve from within the template via <s:property value="%{parameters._paramname_}" />

    - * - * - * In the bottom JSP and Velocity samples, two parameters are being passed in to the component. From within the - * component, they can be accessed as:-

    - * - * Freemarker:

    - * $parameters.get('key1') and $parameters.get('key2') or $parameters.key1 and $parameters.key2

    - * - * Jsp:

    - * <s:property value="%{parameters.key1}" /> and <s:property value="%{'parameters.key2'}" /> or - * <s:property value="%{parameters.get('key1')}" /> and <s:property value="%{parameters.get('key2')}" />

    - * - * Currently, your custom UI components can be written in Velocity, JSP, or Freemarker, and the correct rendering - * engine will be found based on file extension.

    - * - * Remember: the value params will always be resolved against the ValueStack so if you mean to pass a - * string literal to your component, make sure to wrap it in quotes i.e. value="'value1'" otherwise, the the value - * stack will search for an Object on the stack with a method of getValue1(). (now that i've written this, i'm not - * entirely sure this is the case. i should verify this manana)

    - * - * - * - *

    Examples - * - *

    - * 
    - * JSP
    - *     <s:component template="/my/custom/component.vm"/>
    - *     
    - *       or
    - *
    - *     <s:component template="/my/custom/component.vm">
    - *       <s:param name="key1" value="value1"/>
    - *       <s:param name="key2" value="value2"/>
    - *     </s:component>
    - *
    - * Velocity
    - *     #s-component( "template=/my/custom/component.vm" )
    - *
    - *       or
    - *
    - *     #s-component( "template=/my/custom/component.vm" )
    - *       #s-param( "name=key1" "value=value1" )
    - *       #s-param( "name=key2" "value=value2" )
    - *     #end
    - *     
    - * Freemarker
    - *    <@s..component template="/my/custom/component.ftl" />
    - *    
    - *      or
    - *      
    - *    <@s..component template="/my/custom/component.ftl">
    - *       <@s..param name="key1" value="%{'value1'}" />
    - *       <@s..param name="key2" value="%{'value2'}" />
    - *    </@s..component>
    - *     
    - * 
    - * 
    - * - *

    - * - * NOTE: - * - * - * If Jsp is used as the template, the jsp template itself must lie within the - * webapp itself and not the classpath. Unlike Freemarker or Velocity, JSP template - * could not be picked up from the classpath. - * - * - * - * @s.tag name="component" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.ComponentTag" - * description="Render a custom ui widget" - */ -public class GenericUIBean extends UIBean { - private final static String TEMPLATE = "empty"; - - public GenericUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public boolean contains(Object obj1, Object obj2) { - return ContainUtil.contains(obj1, obj2); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Head.java b/trunk/core/src/main/java/org/apache/struts2/components/Head.java deleted file mode 100644 index 1c29db8b1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Head.java +++ /dev/null @@ -1,134 +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.StrutsConstants; -import org.apache.struts2.config.Settings; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Renders parts of the HEAD section for an HTML file. This is useful as some themes require certain CSS and JavaScript - * includes.

    - * - * If, for example, your page has ajax components integrated, without having the default theme set to ajax, you might - * want to use the head tag with theme="ajax" so that the typical ajax header setup will be included in the - * page.

    - * - * The tag also includes the option to set a custom datepicker theme if needed. See calendarcss parameter for - * description for details.

    - * - * If you use the ajax theme you can turn a debug flag on by setting the debug parameter to true. - * - * - * - *

    Examples - * - *

    - * 
    - * <head>
    - *   <title>My page</title>
    - *   <s:head/>
    - * </head>
    - * 
    - * 
    - * - *
    - * 
    - * <head>
    - *   <title>My page</title>
    - *   <s:head theme="ajax" calendarcss="calendar-green"/>
    - * </head>
    - * 
    - * 
    - * - *
    - * 
    - * <head>
    - *   <title>My page</title>
    - *   <s:head theme="ajax" debug="true"/>
    - * </head>
    - * 
    - * 
    - * - * @s.tag name="head" tld-body-content="empty" tld-tag-class="org.apache.struts2.views.jsp.ui.HeadTag" - * description="Render a chunk of HEAD for your HTML file" - */ -public class Head extends UIBean { - public static final String TEMPLATE = "head"; - - private String calendarcss = "calendar-blue.css"; - private boolean debug; - - public Head(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateParams() { - super.evaluateParams(); - - if (calendarcss != null) { - String css = findString(calendarcss); - if (css != null && css.trim().length() > 0) { - if (css.lastIndexOf(".css") < 0) { - addParameter("calendarcss", css + ".css"); - } else { - addParameter("calendarcss", css); - } - } - } - - addParameter("encoding", Settings.get(StrutsConstants.STRUTS_I18N_ENCODING)); - addParameter("debug", Boolean.valueOf(debug).toString()); - } - - public String getCalendarcss() { - return calendarcss; - } - - /** - * The jscalendar css theme to use" default="calendar-blue.css - * @s.tagattribute required="false" - */ - public void setCalendarcss(String calendarcss) { - this.calendarcss = calendarcss; - } - - public boolean isDebug() { - return debug; - } - - /** - * Set to true to enable debugging mode for AJAX themes - * @s.tagattribute required="false" - */ - public void setDebug(boolean debug) { - this.debug = debug; - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java b/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java deleted file mode 100644 index 3d1f1c9da..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java +++ /dev/null @@ -1,59 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Renders an HTML input element of type hidden, populated by the specified property from the ValueStack. - * - * - *

    Examples - * - *

    - * 
    - * <-- example one -->
    - * <s:hidden name="foo" />
    - * <-- example two -->
    - * <s:hidden name="foo" value="bar" />
    - *
    - * Example One Resulting HTML (if foo evaluates to bar):
    - * <input type="hidden" name="foo" value="bar" />
    - * Example Two Resulting HTML (if getBar method of the action returns 'bar')
    - * <input type="hidden" name="foo" value="bar" />
    - * 
    - * 
    - * - * @s.tag name="hidden" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.HiddenTag" - * description="Render a hidden input field" - */ -public class Hidden extends UIBean { - final public static String TEMPLATE = "hidden"; - - public Hidden(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/I18n.java b/trunk/core/src/main/java/org/apache/struts2/components/I18n.java deleted file mode 100644 index 832052148..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/I18n.java +++ /dev/null @@ -1,130 +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 java.io.Writer; -import java.util.Locale; -import java.util.ResourceBundle; - -import org.apache.struts2.StrutsException; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.LocaleProvider; -import com.opensymphony.xwork2.TextProviderSupport; -import com.opensymphony.xwork2.util.LocalizedTextUtil; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Gets a resource bundle and place it on the value stack. This allows - * the text tag to access messages from any bundle, and not just the bundle - * associated with the current action. - * - * - * - *

    - * - * - * - *

      - *
    • name* - the resource bundle's name (eg foo/bar/customBundle)
    • - *
    - * - * - * - *

    - * - * Example: - * - *

    - * 
    - * 
    - * <s:i18n name="myCustomBundle">
    - *    The i18n value for key aaa.bbb.ccc in myCustomBundle is <s:property value="text('aaa.bbb.ccc')" />
    - * </s:i18n>
    - * 
    - * 
    - * 
    - * - * - *
    - * 
    - * 
    - * <s:i18n name="some.package.bundle" >
    - *      <s:text name="some.key" />
    - * </s:i18n>
    - * 
    - * 
    - * 
    - * - * @s.tag name="i18n" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.I18nTag" - * description="Get a resource bundle and place it on the value stack" - */ -public class I18n extends Component { - protected boolean pushed; - protected String name; - - public I18n(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - try { - String name = this.findString(this.name, "name", "Resource bundle name is required. Example: foo or foo_en"); - ResourceBundle bundle = (ResourceBundle) findValue("texts('" + name + "')"); - - if (bundle == null) { - bundle = LocalizedTextUtil.findResourceBundle(name, (Locale) getStack().getContext().get(ActionContext.LOCALE)); - } - - if (bundle != null) { - final Locale locale = (Locale) getStack().getContext().get(ActionContext.LOCALE); - getStack().push(new TextProviderSupport(bundle, new LocaleProvider() { - public Locale getLocale() { - return locale; - } - })); - pushed = true; - } - } catch (Exception e) { - String msg = "Could not find the bundle " + name; - throw new StrutsException(msg, e); - } - - return result; - } - - public boolean end(Writer writer, String body) { - if (pushed) { - getStack().pop(); - } - - return super.end(writer, body); - } - - /** - * Name of ressource bundle to use (eg foo/bar/customBundle) - * @s.tagattribute required="true" default="String" - */ - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/If.java b/trunk/core/src/main/java/org/apache/struts2/components/If.java deleted file mode 100644 index 32322283a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/If.java +++ /dev/null @@ -1,95 +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 java.io.Writer; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - *

    Perform basic condition flow. 'If' tag could be used by itself or - * with 'Else If' Tag and/or single/multiple 'Else' Tag.

    - * - * - * - * - * - * - *
      - * - *
    • test* (Boolean) - Logic to determined if body of tag is to be displayed
    • - * - *
    - * - * - * - * - *
    - * 
    - *  <s:if test="%{false}">
    - *	    <div>Will Not Be Executed</div>
    - *  </s:if>
    - * 	<s:elseif test="%{true}">
    - *	    <div>Will Be Executed</div>
    - *  <s:else>
    - *  </s:elseif>
    - *	    <div>Will Not Be Executed</div>
    - *  </s:else>
    - * 
    - * 
    - * - * @see Else - * @see ElseIf - * - * @s.tag name="if" tld-body-content="JSP" description="If tag" tld-tag-class="org.apache.struts2.views.jsp.IfTag" - */ -public class If extends Component { - public static final String ANSWER = "struts.if.answer"; - - Boolean answer; - String test; - - /** - * Expression to determine if body of tag is to be displayed - * @s.tagattribute required="true" type="Boolean" - */ - public void setTest(String test) { - this.test = test; - } - - public If(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - answer = (Boolean) findValue(test, Boolean.class); - - if (answer == null) { - answer = Boolean.FALSE; - } - stack.getContext().put(ANSWER, answer); - return answer.booleanValue(); - } - - public boolean end(Writer writer, String body) { - stack.getContext().put(ANSWER, answer); - return super.end(writer, body); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Include.java b/trunk/core/src/main/java/org/apache/struts2/components/Include.java deleted file mode 100644 index 0d2099e47..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Include.java +++ /dev/null @@ -1,403 +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 java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Writer; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Stack; -import java.util.StringTokenizer; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.RequestUtils; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.util.FastByteArrayOutputStream; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    Include a servlet's output (result of servlet or a JSP page).

    - *

    Note: Any additional params supplied to the included page are not accessible within the rendered page - * through the <s:property...> tag!

    - * - * - * - * - *
      - *
    • value* (String) - jsp page to be included
    • - *
    - * - * - * - *

    Examples - *

    - * 
    - * <-- One: -->
    - * <s:include value="myJsp.jsp" />
    - *
    - * <-- Two: -->
    - * <s:include value="myJsp.jsp">
    - *    <s:param name="param1" value="value2" />
    - *    <s:param name="param2" value="value2" />
    - * </s:include>
    - *
    - * <-- Three: -->
    - * <s:include value="myJsp.jsp">
    - *    <s:param name="param1">value1</s:param>
    - *    <s:param name="param2">value2<s:param>
    - * </s:include>
    - * 
    - *
    - * 
    - * Example one - do an include myJsp.jsp page
    - * Example two - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2
    - * Example three - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2
    - * 
    - * 
    - * - * @s.tag name="include" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.IncludeTag" - * description="Include a servlet's output (result of servlet or a JSP page)" - */ -public class Include extends Component { - - private static final Log _log = LogFactory.getLog(Include.class); - - private static String encoding; - private static boolean encodingDefined = true; - - protected String value; - private HttpServletRequest req; - private HttpServletResponse res; - - public Include(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack); - this.req = req; - this.res = res; - } - - public boolean end(Writer writer, String body) { - String page = findString(value, "value", "You must specify the URL to include. Example: /foo.jsp"); - StringBuffer urlBuf = new StringBuffer(); - - // Add URL - urlBuf.append(page); - - // Add request parameters - if (parameters.size() > 0) { - urlBuf.append('?'); - - String concat = ""; - - // Set parameters - Iterator iter = parameters.entrySet().iterator(); - - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - Object name = entry.getKey(); - List values = (List) entry.getValue(); - - for (int i = 0; i < values.size(); i++) { - urlBuf.append(concat); - urlBuf.append(name); - urlBuf.append('='); - - try { - urlBuf.append(URLEncoder.encode(values.get(i).toString(), "UTF-8")); - } catch (Exception e) { - _log.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored"); - } - - concat = "&"; - } - } - } - - String result = urlBuf.toString(); - - // Include - try { - include(result, writer, req, res); - } catch (Exception e) { - LogFactory.getLog(getClass()).warn("Exception thrown during include of " + result, e); - } - - return super.end(writer, body); - } - - /** - * The jsp/servlet output to include - * @s.tagattribute required="true" type="String" - */ - public void setValue(String value) { - this.value = value; - } - - public static String getContextRelativePath(ServletRequest request, String relativePath) { - String returnValue; - - if (relativePath.startsWith("/")) { - returnValue = relativePath; - } else if (!(request instanceof HttpServletRequest)) { - returnValue = relativePath; - } else { - HttpServletRequest hrequest = (HttpServletRequest) request; - String uri = (String) request.getAttribute("javax.servlet.include.servlet_path"); - - if (uri == null) { - uri = RequestUtils.getServletPath(hrequest); - } - - returnValue = uri.substring(0, uri.lastIndexOf('/')) + '/' + relativePath; - } - - // .. is illegal in an absolute path according to the Servlet Spec and will cause - // known problems on Orion application servers. - if (returnValue.indexOf("..") != -1) { - Stack stack = new Stack(); - StringTokenizer pathParts = new StringTokenizer(returnValue.replace('\\', '/'), "/"); - - while (pathParts.hasMoreTokens()) { - String part = pathParts.nextToken(); - - if (!part.equals(".")) { - if (part.equals("..")) { - stack.pop(); - } else { - stack.push(part); - } - } - } - - StringBuffer flatPathBuffer = new StringBuffer(); - - for (int i = 0; i < stack.size(); i++) { - flatPathBuffer.append("/").append(stack.elementAt(i)); - } - - returnValue = flatPathBuffer.toString(); - } - - return returnValue; - } - - public void addParameter(String key, Object value) { - // don't use the default implementation of addParameter, - // instead, include tag requires that each parameter be a list of objects, - // just like the HTTP servlet interfaces are (String[]) - if (value != null) { - List currentValues = (List) parameters.get(key); - - if (currentValues == null) { - currentValues = new ArrayList(); - parameters.put(key, currentValues); - } - - currentValues.add(value); - } - } - - public static void include(String aResult, Writer writer, ServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String resourcePath = getContextRelativePath(request, aResult); - RequestDispatcher rd = request.getRequestDispatcher(resourcePath); - - if (rd == null) { - throw new ServletException("Not a valid resource path:" + resourcePath); - } - - PageResponse pageResponse = new PageResponse(response); - - // Include the resource - rd.include((HttpServletRequest) request, pageResponse); - - //write the response back to the JspWriter, using the correct encoding. - String encoding = getEncoding(); - - if (encoding != null) { - //use the encoding specified in the property file - pageResponse.getContent().writeTo(writer, encoding); - } else { - //use the platform specific encoding - pageResponse.getContent().writeTo(writer, null); - } - } - - /** - * Get the encoding specified by the property 'struts.i18n.encoding' in struts.properties, - * or return the default platform encoding if not specified. - *

    - * Note that if the property is not initially defined, this will return the system default, - * even if the property is later defined. This is mainly for performance reasons. Undefined - * properties throw exceptions, which are a costly operation. - *

    - * If the property is initially defined, it is read every time, until is is undefined, and then - * the system default is used. - *

    - * Why not cache it completely? Some applications will wish to be able to dynamically set the - * encoding at runtime. - * - * @return The encoding to be used. - */ - private static String getEncoding() { - if (encodingDefined) { - try { - encoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - } catch (IllegalArgumentException e) { - encoding = System.getProperty("file.encoding"); - encodingDefined = false; - } - } - - return encoding; - } - - - /** - * Implementation of ServletOutputStream that stores all data written - * to it in a temporary buffer accessible from {@link #getBuffer()} . - * - * @author Joe Walnes - * @author Scott Farquhar - */ - static final class PageOutputStream extends ServletOutputStream { - - private FastByteArrayOutputStream buffer; - - - public PageOutputStream() { - buffer = new FastByteArrayOutputStream(); - } - - - /** - * Return all data that has been written to this OutputStream. - */ - public FastByteArrayOutputStream getBuffer() throws IOException { - flush(); - - return buffer; - } - - public void close() throws IOException { - buffer.close(); - } - - public void flush() throws IOException { - buffer.flush(); - } - - public void write(byte[] b, int o, int l) throws IOException { - buffer.write(b, o, l); - } - - public void write(int i) throws IOException { - buffer.write(i); - } - - public void write(byte[] b) throws IOException { - buffer.write(b); - } - } - - - /** - * Simple wrapper to HTTPServletResponse that will allow getWriter() - * and getResponse() to be called as many times as needed without - * causing conflicts. - *

    - * The underlying outputStream is a wrapper around - * {@link PageOutputStream} which will store - * the written content to a buffer. - *

    - * This buffer can later be retrieved by calling {@link #getContent}. - * - * @author Joe Walnes - * @author Scott Farquhar - */ - static final class PageResponse extends HttpServletResponseWrapper { - - protected PrintWriter pagePrintWriter; - protected ServletOutputStream outputStream; - private PageOutputStream pageOutputStream = null; - - - /** - * Create PageResponse wrapped around an existing HttpServletResponse. - */ - public PageResponse(HttpServletResponse response) { - super(response); - } - - - /** - * Return the content buffered inside the {@link PageOutputStream}. - * - * @return - * @throws IOException - */ - public FastByteArrayOutputStream getContent() throws IOException { - //if we are using a writer, we need to flush the - //data to the underlying outputstream. - //most containers do this - but it seems Jetty 4.0.5 doesn't - if (pagePrintWriter != null) { - pagePrintWriter.flush(); - } - - return ((PageOutputStream) getOutputStream()).getBuffer(); - } - - /** - * Return instance of {@link PageOutputStream} - * allowing all data written to stream to be stored in temporary buffer. - */ - public ServletOutputStream getOutputStream() throws IOException { - if (pageOutputStream == null) { - pageOutputStream = new PageOutputStream(); - } - - return pageOutputStream; - } - - /** - * Return PrintWriter wrapper around PageOutputStream. - */ - public PrintWriter getWriter() throws IOException { - if (pagePrintWriter == null) { - pagePrintWriter = new PrintWriter(new OutputStreamWriter(getOutputStream(), getCharacterEncoding())); - } - - return pagePrintWriter; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/IteratorComponent.java b/trunk/core/src/main/java/org/apache/struts2/components/IteratorComponent.java deleted file mode 100644 index 6b50da71e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/IteratorComponent.java +++ /dev/null @@ -1,290 +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 java.io.Writer; -import java.util.Iterator; - -import org.apache.struts2.util.MakeIterator; -import org.apache.struts2.views.jsp.IteratorStatus; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - *

    Iterator will iterate over a value. An iterable value can be either of: java.util.Collection, java.util.Iterator, - * java.util.Enumeration, java.util.Map, array.

    - * - * - * - *

      - * - *
    • status (String) - if specified, an instanceof IteratorStatus will be pushed into stack upon each iteration
    • - * - *
    • value (Object) - the source to iterate over, must be iteratable, else an the object itself will be put into a - * newly created List (see MakeIterator#convert(Object)
    • - * - *
    • id (String) - if specified the current iteration object will be place with this id in Struts stack's context - * scope
    • - * - *
    - * - * - * - * - * - *

    The following example retrieves the value of the getDays() method of the current object on the value stack and - * uses it to iterate over. The <s:property/> tag prints out the current value of the iterator.

    - * - * - * - *
    - * 
    - * <s:iterator value="days">
    - *   <p>day is: <s:property/></p>
    - * </s:iterator>
    - * 
    - * 
    - * - * - * - * - *

    The following example uses a {@link Bean} tag and places it into the ActionContext. The iterator tag will retrieve - * that object from the ActionContext and then calls its getDays() method as above. The status attribute is also used to - * create a {@link IteratorStatus} object, which in this example, its odd() method is used to alternate row - * colours:

    - * - * - * - * - *
    - * 
    - * 
    - * <s:bean name="org.apache.struts2.example.IteratorExample" id="it">
    - *   <s:param name="day" value="'foo'"/>
    - *   <s:param name="day" value="'bar'"/>
    - * </s:bean>
    - * 

    - * <table border="0" cellspacing="0" cellpadding="1"> - * <tr> - * <th>Days of the week</th> - * </tr> - *

    - * <s:iterator value="#it.days" status="rowstatus"> - * <tr> - * <s:if test="#rowstatus.odd == true"> - * <td style="background: grey"><s:property/></td> - * </s:if> - * <s:else> - * <td><s:property/></td> - * </s:else> - * </tr> - * </s:iterator> - * </table> - * - * - *

    - * - * - * - *

    The next example will further demonstrate the use of the status attribute, using a DAO obtained from the action - * class through OGNL, iterating over groups and their users (in a security context). The last() method indicates if the - * current object is the last available in the iteration, and if not, we need to seperate the users using a comma:

    - * - * - * - *
    - * 
    - * 
    - * 	<s:iterator value="groupDao.groups" status="groupStatus">
    - * 		<tr class="<s:if test="#groupStatus.odd == true ">odd</s:if><s:else>even</s:else>">
    - * 			<td><s:property value="name" /></td>
    - * 			<td><s:property value="description" /></td>
    - * 			<td>
    - * 				<s:iterator value="users" status="userStatus">
    - * 					<s:property value="fullName" /><s:if test="!#userStatus.last">,</s:if>
    - * 				</s:iterator>
    - * 			</td>
    - * 		</tr>
    - * 	</s:iterator>
    - * 
    - * 
    - * 
    - *

    - * - * - * - *

    The next example iterates over a an action collection and passes every iterator value to another action. The - * trick here lies in the use of the '[0]' operator. It takes the current iterator value and passes it on to the edit - * action. Using the '[0]' operator has the same effect as using >s:property />. (The latter, however, does not - * work from inside the param tag).

    - * - * - * - *
    - * 
    - * 
    - * 		<s:action name="entries" id="entries"/>
    - * 		<s:iterator value="#entries.entries" >
    - * 			<s:property value="name" />
    - * 			<s:property />
    - * 			<s:push value="...">
    - * 				<s:action name="edit" id="edit" >
    - * 					<s:param name="entry" value="[0]" />
    - * 				</s:action>
    - * 			</push>
    - * 		</s:iterator>
    - * 
    - * 
    - * 
    - * - * - * - *

    To simulate a simple loop with iterator tag, the following could be done. - * It does the loop 5 times. - * - * - * - *
    - * 
    - * 
    - * <s:iterator status="stat" value="{1,2,3,4,5}" >
    - *    <!-- grab the index (start with 0 ... ) -->
    - *    <s:property value="#stat.index" />
    - *    
    - *    <!-- grab the top of the stack which should be the -->
    - *    <!-- current iteration value (0, 1, ... 5) -->
    - *    <s:property value="top" />
    - * </s:iterator>
    - * 
    - * 
    - * 
    - * - * @s.tag name="iterator" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.IteratorTag" - * description="Iterate over a iterable value" - */ -public class IteratorComponent extends Component { - protected Iterator iterator; - protected IteratorStatus status; - protected Object oldStatus; - protected IteratorStatus.StatusState statusState; - protected String statusAttr; - protected String value; - - public IteratorComponent(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - //Create an iterator status if the status attribute was set. - if (statusAttr != null) { - statusState = new IteratorStatus.StatusState(); - status = new IteratorStatus(statusState); - } - - ValueStack stack = getStack(); - - if (value == null) { - value = "top"; - } - iterator = MakeIterator.convert(findValue(value)); - - // get the first - if ((iterator != null) && iterator.hasNext()) { - Object currentValue = iterator.next(); - stack.push(currentValue); - - String id = getId(); - - if ((id != null) && (currentValue != null)) { - //pageContext.setAttribute(id, currentValue); - //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE); - stack.getContext().put(id, currentValue); - } - - // Status object - if (statusAttr != null) { - statusState.setLast(!iterator.hasNext()); - oldStatus = stack.getContext().get(statusAttr); - stack.getContext().put(statusAttr, status); - } - - return true; - } else { - super.end(writer, ""); - return false; - } - } - - public boolean end(Writer writer, String body) { - ValueStack stack = getStack(); - if (iterator != null) { - stack.pop(); - } - - if (iterator!=null && iterator.hasNext()) { - Object currentValue = iterator.next(); - stack.push(currentValue); - - String id = getId(); - - if ((id != null) && (currentValue != null)) { - //pageContext.setAttribute(id, currentValue); - //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE); - stack.getContext().put(id, currentValue); - } - - // Update status - if (status != null) { - statusState.next(); // Increase counter - statusState.setLast(!iterator.hasNext()); - } - - return true; - } else { - // Reset status object in case someone else uses the same name in another iterator tag instance - if (status != null) { - if (oldStatus == null) { - stack.getContext().put(statusAttr, null); - } else { - stack.getContext().put(statusAttr, oldStatus); - } - } - super.end(writer, ""); - return false; - } - } - - /** - * if specified, an instanceof IteratorStatus will be pushed into stack upon each iteration - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setStatus(String status) { - this.statusAttr = status; - } - - /** - * the iteratable source to iterate over, else an the object itself will be put into a newly created List - * @s.tagattribute required="false" - */ - public void setValue(String value) { - this.value = value; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Label.java b/trunk/core/src/main/java/org/apache/struts2/components/Label.java deleted file mode 100644 index f964e5127..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Label.java +++ /dev/null @@ -1,87 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Renders an HTML LABEL that will allow you to output label:name combination that has the same format treatment as - * the rest of your UI controls.

    - * - * - *

    Examples - *

    - * - * In this example, a label is rendered. The label is retrieved from a ResourceBundle by calling ActionSupport's - * getText() method giving you an output of 'User Name:tm_jee'. Assuming that i18n message user_name corresponds - * to 'User Name' and the action's getUserName() method returns 'tm_jee'

    - * - *

    - * 
    - * <s:label label="%{text('user_name')}" name="userName" />
    - * 
    - * 
    - * - * @s.tag name="label" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.LabelTag" - * description="Render a label that displays read-only information" - */ -public class Label extends UIBean { - final public static String TEMPLATE = "label"; - - protected String forAttr; - - public Label(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (forAttr != null) { - addParameter("for", findString(forAttr)); - } - - // try value first, then name (this overrides the default behavior in the superclass) - if (value != null) { - addParameter("nameValue", findString(value)); - } else if (name != null) { - String expr = name; - if (altSyntax()) { - expr = "%{" + expr + "}"; - } - - addParameter("nameValue", findString(expr)); - } - } - - /** - * HTML for attribute - * @s.tagattribute required="false" - */ - public void setFor(String forAttr) { - this.forAttr = forAttr; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java b/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java deleted file mode 100644 index 9497a4e36..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java +++ /dev/null @@ -1,156 +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 java.lang.reflect.Array; -import java.util.Collection; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.util.ContainUtil; -import org.apache.struts2.util.MakeIterator; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * DoubleListUIBean is the standard superclass of all Struts list handling components. - * - *

    - * - * - * - * Note that the listkey and listvalue attribute will default to "key" and "value" - * respectively only when the list attribute is evaluated to a Map or its decendant. - * Other thing else, will result in listkey and listvalue to be null and not used. - * - * - * - */ -public abstract class ListUIBean extends UIBean { - protected Object list; - protected String listKey; - protected String listValue; - - // indicate if an exception is to be thrown when value attribute is null - protected boolean throwExceptionOnNullValueAttribute = false; - - protected ListUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public void evaluateExtraParams() { - Object value = null; - - if (list == null) { - list = parameters.get("list"); - } - - if (list instanceof String) { - value = findValue((String) list); - } else if (list instanceof Collection) { - value = list; - } else if (MakeIterator.isIterable(list)) { - value = MakeIterator.convert(list); - } - if (value == null) { - if (throwExceptionOnNullValueAttribute) { - // will throw an exception if not found - value = findValue((list == null) ? (String) list : list.toString(), "list", - "The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " + - "Example: people or people.{name}"); - } - else { - // ww-1010, allows value with null value to be compatible with ww - // 2.1.7 behaviour - value = findValue((list == null)?(String) list:list.toString()); - } - } - - if (value instanceof Collection) { - addParameter("list", value); - } else { - addParameter("list", MakeIterator.convert(value)); - } - - if (value instanceof Collection) { - addParameter("listSize", new Integer(((Collection) value).size())); - } else if (value instanceof Map) { - addParameter("listSize", new Integer(((Map) value).size())); - } else if (value != null && value.getClass().isArray()) { - addParameter("listSize", new Integer(Array.getLength(value))); - } - - if (listKey != null) { - addParameter("listKey", listKey); - } else if (value instanceof Map) { - addParameter("listKey", "key"); - } - - if (listValue != null) { - if (altSyntax()) { - // the same logic as with findValue(String) - // if value start with %{ and end with }, just cut it off! - if (listValue.startsWith("%{") && listValue.endsWith("}")) { - listValue = listValue.substring(2, listValue.length() - 1); - } - } - addParameter("listValue", listValue); - } else if (value instanceof Map) { - addParameter("listValue", "value"); - } - } - - public boolean contains(Object obj1, Object obj2) { - return ContainUtil.contains(obj1, obj2); - } - - protected Class getValueClassType() { - return null; // don't convert nameValue to anything, we need the raw value - } - - /** - * Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option "value" parameter and the Map value will become the option body. - * @s.tagattribute required="true" - */ - public void setList(Object list) { - this.list = list; - } - - /** - * Property of list objects to get field value from - * @s.tagattribute required="false" - */ - public void setListKey(String listKey) { - this.listKey = listKey; - } - - /** - * Property of list objects to get field content from - * @s.tagattribute required="false" - */ - public void setListValue(String listValue) { - this.listValue = listValue; - } - - - public void setThrowExceptionOnNullValueAttribute(boolean throwExceptionOnNullValueAttribute) { - this.throwExceptionOnNullValueAttribute = throwExceptionOnNullValueAttribute; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/MergeIterator.java b/trunk/core/src/main/java/org/apache/struts2/components/MergeIterator.java deleted file mode 100644 index 1468bc21a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/MergeIterator.java +++ /dev/null @@ -1,182 +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 java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.components.Param.UnnamedParametric; -import org.apache.struts2.util.MakeIterator; -import org.apache.struts2.util.MergeIteratorFilter; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    Component for MergeIteratorTag, which job is to merge iterators and successive - * call to the merged iterator will cause each merge iterator to have a chance to - * expose its element, subsequently next call will allow the next iterator to expose - * its element. Once the last iterator is done exposing its element, the first iterator - * is allowed to do so again (unless it is exhausted of entries).

    - * - *

    Internally the task are delegated to MergeIteratorFilter

    - * - *

    Example if there are 3 lists being merged, each list have 3 entries, the following will - * be the logic.

    - *
      - *
    1. Display first element of the first list
    2. - *
    3. Display first element of the second list
    4. - *
    5. Display first element of the third list
    6. - *
    7. Display second element of the first list
    8. - *
    9. Display second element of the second list
    10. - *
    11. Display second element of the third list
    12. - *
    13. Display third element of the first list
    14. - *
    15. Display thrid element of the second list
    16. - *
    17. Display third element of the thrid list
    18. - *
    - * - * - * - *
      - *
    • id (String) - the id where the resultant merged iterator will be stored in the stack's context
    • - *
    - * - * - * - * - * public class MergeIteratorTagAction extends ActionSupport { - * - * private List myList1; - * private List myList2; - * private List myList3; - * - * public List getMyList1() { - * return myList1; - * } - * - * public List getMyList2() { - * return myList2; - * } - * - * public List getMyList3() { - * return myList3; - * } - * - * - * public String execute() throws Exception { - * - * myList1 = new ArrayList(); - * myList1.add("1"); - * myList1.add("2"); - * myList1.add("3"); - * - * myList2 = new ArrayList(); - * myList2.add("a"); - * myList2.add("b"); - * myList2.add("c"); - * - * myList3 = new ArrayList(); - * myList3.add("A"); - * myList3.add("B"); - * myList3.add("C"); - * - * return "done"; - * } - * } - * - * - * - * <s:merge id="myMergedIterator1"> - * <s:param value="%{myList1}" /> - * <s:param value="%{myList2}" /> - * <s:param value="%{myList3}" /> - * </s:merge> - * <s:iterator value="%{#myMergedIterator1}"> - * <s:property /> - * </s:iterator> - * - * - * - * This wil generate "1aA2bB3cC". - * - * - * @see org.apache.struts2.util.MergeIteratorFilter - * @see org.apache.struts2.views.jsp.iterator.MergeIteratorTag - * - * @s.tag name="merge" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.iterator.MergeIteratorTag" - * description="Merge the values of a list of iterators into one iterator" - */ -public class MergeIterator extends Component implements UnnamedParametric { - - private static final Log _log = LogFactory.getLog(MergeIterator.class); - - private MergeIteratorFilter mergeIteratorFilter = null; - private List _parameters; - - public MergeIterator(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - - mergeIteratorFilter = new MergeIteratorFilter(); - _parameters = new ArrayList(); - - return super.start(writer); - } - - public boolean end(Writer writer, String body) { - - for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) { - Object iteratorEntryObj = parametersIterator.next(); - if (! MakeIterator.isIterable(iteratorEntryObj)) { - _log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator"); - continue; - } - mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj)); - } - - mergeIteratorFilter.execute(); - - // if id exists, we put it in the stack's context - if (getId() != null && getId().length() > 0) { - getStack().getContext().put(getId(), mergeIteratorFilter); - } - - mergeIteratorFilter = null; - - return super.end(writer, body); - } - - /** - * the id where the resultant merged iterator will be stored in the stack's context - * @s.tagattribute required="false" - */ - public void setId(String id) { - super.setId(id); - } - - // == UnnamedParametric interface implementation --------------------- - public void addParameter(Object value) { - _parameters.add(value); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java b/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java deleted file mode 100644 index d16c6fe28..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java +++ /dev/null @@ -1,149 +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 java.io.Writer; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Create a optgroup component which needs to resides within a select tag. - * - * - * - *

    - * - * - * - * This component is to be used within a Select component. - * - * - * - *

    - * - *

    - * 
    - *
    - * <s:select label="My Selection"
    - *            name="mySelection"
    - *            value="%{'POPEYE'}"
    - *            list="%{#{'SUPERMAN':'Superman', 'SPIDERMAN':'spiderman'}}">
    - *    <s:optgroup label="Adult"
    - *                 list="%{#{'SOUTH_PARK':'South Park'}}" />
    - *    <s:optgroup label="Japanese"
    - *                 list="%{#{'POKEMON':'pokemon','DIGIMON':'digimon','SAILORMOON':'Sailormoon'}}" />
    - * </s:select>
    - *
    - * 
    - * 
    - * - * @s.tag name="optgroup" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.OptGroupTag" - * description="Renders a Select Tag's OptGroup Tag" - */ -public class OptGroup extends Component { - - public static final String INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY = "optGroupInternalListUiBeanList"; - - private static Log _log = LogFactory.getLog(OptGroup.class); - - protected HttpServletRequest req; - protected HttpServletResponse res; - - protected ListUIBean internalUiBean; - - public OptGroup(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack); - this.req = req; - this.res = res; - internalUiBean = new ListUIBean(stack, req, res) { - protected String getDefaultTemplate() { - return "empty"; - } - }; - } - - public boolean end(Writer writer, String body) { - Select select = (Select) findAncestor(Select.class); - if (select == null) { - _log.error("incorrect use of OptGroup component, this component must be used within a Select component", - new IllegalStateException("incorrect use of OptGroup component, this component must be used within a Select component")); - return false; - } - internalUiBean.start(writer); - internalUiBean.end(writer, body); - - List listUiBeans = (List) select.getParameters().get(INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY); - if (listUiBeans == null) { - listUiBeans = new ArrayList(); - } - listUiBeans.add(internalUiBean); - select.addParameter(INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY, listUiBeans); - - return false; - } - - /** - * Set the label attribute. - * @s.tagattribute required="false" - */ - public void setLabel(String label) { - internalUiBean.setLabel(label); - } - - /** - * Set the disable attribute. - * @s.tagattribute required="false" - */ - public void setDisabled(String disabled) { - internalUiBean.setDisabled(disabled); - } - - /** - * Set the list attribute. - * @s.tagattribute required="false" - */ - public void setList(String list) { - internalUiBean.setList(list); - } - - /** - * Set the listKey attribute. - * @s.tagattribute required="false" - */ - public void setListKey(String listKey) { - internalUiBean.setListKey(listKey); - } - - /** - * Set the listValue attribute. - * @s.tagattribute required="false" - */ - public void setListValue(String listValue) { - internalUiBean.setListValue(listValue); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java b/trunk/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java deleted file mode 100644 index 0cba4511e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java +++ /dev/null @@ -1,545 +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 java.util.LinkedHashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Create a option transfer select component which is basically two <select ...> - * tag with buttons in the middle of them allowing options in each of the - * <select ...> to be moved between themselves. Will auto-select all its - * elements upon its containing form submision. - * - * - * - *

    - * - * - * - * - * NOTE: The id and doubleId need not be supplied as they will generated provided - * that the optiontransferselect tag is being used in a form tag. The generated id - * and doubleId will be <form_id>_<optiontransferselect_doubleName> and - * <form_id>_<optiontransferselect_doubleName> respectively. - * - * - * - *

    - * - *

    - * 
    - * 
    - * <-- minimum configuration -->
    - * <s:optiontransferselect
    - *   	label="Favourite Cartoons Characters"
    - *		name="leftSideCartoonCharacters" 
    - *		list="{'Popeye', 'He-Man', 'Spiderman'}" 
    - *		doubleName="rightSideCartoonCharacters"
    - *		doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}" 
    - *	/>
    - *
    - *  <-- possible configuration -->
    - *  <s:optiontransferselect
    - *   	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"
    - *	/>
    - * 
    - * 
    - * 
    - * - * @s.tag name="optiontransferselect" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.OptionTransferSelectTag" - * description="Renders an input form" - */ -public class OptionTransferSelect extends DoubleListUIBean { - - private static final Log _log = LogFactory.getLog(OptionTransferSelect.class); - - private static final String TEMPLATE = "optiontransferselect"; - - protected String allowAddToLeft; - protected String allowAddToRight; - protected String allowAddAllToLeft; - protected String allowAddAllToRight; - protected String allowSelectAll; - protected String allowUpDownOnLeft; - protected String allowUpDownOnRight; - - protected String leftTitle; - protected String rightTitle; - - protected String buttonCssClass; - protected String buttonCssStyle; - - protected String addToLeftLabel; - protected String addToRightLabel; - protected String addAllToLeftLabel; - protected String addAllToRightLabel; - protected String selectAllLabel; - protected String leftUpLabel; - protected String leftDownlabel; - protected String rightUpLabel; - protected String rightDownLabel; - - - public OptionTransferSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - Object doubleValue = null; - - // override DoubleListUIBean's - if (doubleList != null) { - doubleValue = findValue(doubleList); - addParameter("doubleList", doubleValue); - } - if (size == null || size.trim().length() <= 0) { - addParameter("size", "15"); - } - if (doubleSize == null || doubleSize.trim().length() <= 0) { - addParameter("doubleSize", "15"); - } - if (multiple == null || multiple.trim().length() <= 0) { - addParameter("multiple", Boolean.TRUE); - } - if (doubleMultiple == null || doubleMultiple.trim().length() <= 0) { - addParameter("doubleMultiple", Boolean.TRUE); - } - - - - - - // buttonCssClass - if (buttonCssClass != null && buttonCssClass.trim().length() > 0) { - addParameter("buttonCssClass", buttonCssClass); - } - - // buttonCssStyle - if (buttonCssStyle != null && buttonCssStyle.trim().length() > 0) { - addParameter("buttonCssStyle", buttonCssStyle); - } - - - - // allowSelectAll - addParameter("allowSelectAll", - allowSelectAll != null ? findValue(allowSelectAll, Boolean.class) : Boolean.TRUE); - - // allowAddToLeft - addParameter("allowAddToLeft", - allowAddToLeft != null ? findValue(allowAddToLeft, Boolean.class) : Boolean.TRUE); - - // allowAddToRight - addParameter("allowAddToRight", - allowAddToRight != null ? findValue(allowAddToRight, Boolean.class) : Boolean.TRUE); - - // allowAddAllToLeft - addParameter("allowAddAllToLeft", - allowAddAllToLeft != null ? findValue(allowAddAllToLeft, Boolean.class) : Boolean.TRUE); - - // allowAddAllToRight - addParameter("allowAddAllToRight", - allowAddAllToRight != null ? findValue(allowAddAllToRight, Boolean.class) : Boolean.TRUE); - - // allowUpDownOnLeft - addParameter("allowUpDownOnLeft", - allowUpDownOnLeft != null ? findValue(allowUpDownOnLeft, Boolean.class) : Boolean.TRUE); - - // allowUpDownOnRight - addParameter("allowUpDownOnRight", - allowUpDownOnRight != null ? findValue(allowUpDownOnRight, Boolean.class) : Boolean.TRUE); - - - // leftTitle - if (leftTitle != null) { - addParameter("leftTitle", findValue(leftTitle, String.class)); - } - - // rightTitle - if (rightTitle != null) { - addParameter("rightTitle", findValue(rightTitle, String.class)); - } - - - // addToLeftLabel - addParameter("addToLeftLabel", - addToLeftLabel != null ? findValue(addToLeftLabel, String.class) : "<-" ); - - // addToRightLabel - addParameter("addToRightLabel", - addToRightLabel != null ? findValue(addToRightLabel, String.class) : "->"); - - // addAllToLeftLabel - addParameter("addAllToLeftLabel", - addAllToLeftLabel != null ? findValue(addAllToLeftLabel, String.class) : "<<--"); - - // addAllToRightLabel - addParameter("addAllToRightLabel", - addAllToRightLabel != null ? findValue(addAllToRightLabel, String.class) : "-->>"); - - // selectAllLabel - addParameter("selectAllLabel", - selectAllLabel != null ? findValue(selectAllLabel, String.class) : "<*>"); - - // leftUpLabel - addParameter("leftUpLabel", - leftUpLabel != null ? findValue(leftUpLabel, String.class) : "^"); - - - // leftDownLabel - addParameter("leftDownLabel", - leftDownlabel != null ? findValue(leftDownlabel, String.class) : "v"); - - - // rightUpLabel - addParameter("rightUpLabel", - rightUpLabel != null ? findValue(rightUpLabel, String.class) : "^"); - - - // rightDownlabel - addParameter("rightDownLabel", - rightDownLabel != null ? findValue(rightDownLabel, String.class) : "v"); - - - - // inform the form component our select tag infos, so they know how to select - // its elements upon onsubmit - Form formAncestor = (Form) findAncestor(Form.class); - if (formAncestor != null) { - - // inform ancestor form that we are having a customOnsubmit (see form-close.ftl [simple theme]) - enableAncestorFormCustomOnsubmit(); - - - // key -> select tag id, value -> headerKey (if exists) - Map formOptiontransferselectIds = (Map) formAncestor.getParameters().get("optiontransferselectIds"); - Map formOptiontransferselectDoubleIds = (Map) formAncestor.getParameters().get("optiontransferselectDoubleIds"); - - // init lists - if (formOptiontransferselectIds == null) { - formOptiontransferselectIds = new LinkedHashMap(); - } - if (formOptiontransferselectDoubleIds == null) { - formOptiontransferselectDoubleIds = new LinkedHashMap(); - } - - - // id - String tmpId = (String) getParameters().get("id"); - String tmpHeaderKey = (String) getParameters().get("headerKey"); - if (tmpId != null && (! formOptiontransferselectIds.containsKey(tmpId))) { - formOptiontransferselectIds.put(tmpId, tmpHeaderKey); - } - - // doubleId - String tmpDoubleId = (String) getParameters().get("doubleId"); - String tmpDoubleHeaderKey = (String) getParameters().get("doubleHeaderKey"); - if (tmpDoubleId != null && (! formOptiontransferselectDoubleIds.containsKey(tmpDoubleId))) { - formOptiontransferselectDoubleIds.put(tmpDoubleId, tmpDoubleHeaderKey); - } - - formAncestor.getParameters().put("optiontransferselectIds", formOptiontransferselectIds); - formAncestor.getParameters().put("optiontransferselectDoubleIds", formOptiontransferselectDoubleIds); - - } - else { - _log.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work"); - } - } - - - - public String getAddAllToLeftLabel() { - return addAllToLeftLabel; - } - - /** - * set Add To Left button label - * @s.tagattribute required="false" - */ - public void setAddAllToLeftLabel(String addAllToLeftLabel) { - this.addAllToLeftLabel = addAllToLeftLabel; - } - - public String getAddAllToRightLabel() { - return addAllToRightLabel; - } - - /** - * set Add All To Right button label - * @s.tagattribute required="false" - */ - public void setAddAllToRightLabel(String addAllToRightLabel) { - this.addAllToRightLabel = addAllToRightLabel; - } - - public String getAddToLeftLabel() { - return addToLeftLabel; - } - - /** - * set Add To Left button label - * @s.tagattribute required="false" - */ - public void setAddToLeftLabel(String addToLeftLabel) { - this.addToLeftLabel = addToLeftLabel; - } - - public String getAddToRightLabel() { - return addToRightLabel; - } - - /** - * set Add To Right button label - * @s.tagattribute required="false" - */ - public void setAddToRightLabel(String addToRightLabel) { - this.addToRightLabel = addToRightLabel; - } - - public String getAllowAddAllToLeft() { - return allowAddAllToLeft; - } - - /** - * enable Add All To Left button - * @s.tagattribute required="false" - */ - public void setAllowAddAllToLeft(String allowAddAllToLeft) { - this.allowAddAllToLeft = allowAddAllToLeft; - } - - public String getAllowAddAllToRight() { - return allowAddAllToRight; - } - - /** - * enable Add All To Right button - * @s.tagattribute required="false" - */ - public void setAllowAddAllToRight(String allowAddAllToRight) { - this.allowAddAllToRight = allowAddAllToRight; - } - - public String getAllowAddToLeft() { - return allowAddToLeft; - } - - /** - * enable Add To Left button - * @s.tagattribute required="false" - */ - public void setAllowAddToLeft(String allowAddToLeft) { - this.allowAddToLeft = allowAddToLeft; - } - - public String getAllowAddToRight() { - return allowAddToRight; - } - - /** - * enable Add To Right button - * @s.tagattribute required="false" - */ - public void setAllowAddToRight(String allowAddToRight) { - this.allowAddToRight = allowAddToRight; - } - - public String getLeftTitle() { - return leftTitle; - } - - - /** - * enable up / down on the left side - * @a2 tagattribute required="false" - */ - public void setAllowUpDownOnLeft(String allowUpDownOnLeft) { - this.allowUpDownOnLeft = allowUpDownOnLeft; - } - - public String getAllowUpDownOnLeft() { - return this.allowUpDownOnLeft; - } - - - /** - * enable up / down on the right side - * @a2 tagattribute required="false" - */ - public void setAllowUpDownOnRight(String allowUpDownOnRight) { - this.allowUpDownOnRight = allowUpDownOnRight; - } - - public String getAllowUpDownOnRight() { - return this.allowUpDownOnRight; - } - - - /** - * set Left title - * @s.tagattribute required="false" - */ - public void setLeftTitle(String leftTitle) { - this.leftTitle = leftTitle; - } - - public String getRightTitle() { - return rightTitle; - } - - /** - * set Right title - * @s.tagattribute required="false" - */ - public void setRightTitle(String rightTitle) { - this.rightTitle = rightTitle; - } - - - /** - * enable Select All button - * @s.tagattribute required="false" - */ - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - public String getAllowSelectAll() { - return this.allowSelectAll; - } - - - /** - * set Select All button label - * @s.tagattribute required="false" - */ - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } - - public String getSelectAllLabel() { - return this.selectAllLabel; - } - - - /** - * set buttons css class - * @s.tagattribute required="false" - */ - public void setButtonCssClass(String buttonCssClass) { - this.buttonCssClass = buttonCssClass; - } - - public String getButtonCssClass() { - return buttonCssClass; - } - - - /** - * set button css style - * @s.tagattribute required="false" - */ - public void setButtonCssStyle(String buttonCssStyle) { - this.buttonCssStyle = buttonCssStyle; - } - - public String getButtonCssStyle() { - return this.buttonCssStyle; - } - - - /** - * Up label for the left side - * @a2 tagattribute required="false" - */ - public void setLeftUpLabel(String leftUpLabel) { - this.leftUpLabel = leftUpLabel; - } - public String getLeftUpLabel() { - return this.leftUpLabel; - } - - /** - * Down label for the left side. - * @a2 tagattribute required="false" - */ - public void setLeftDownLabel(String leftDownLabel) { - this.leftDownlabel = leftDownLabel; - } - public String getLeftDownLabel() { - return this.leftDownlabel; - } - - /** - * Up label for the right side. - * @a2 tagattribute required="false" - */ - public void setRightUpLabel(String rightUpLabel) { - this.rightUpLabel = rightUpLabel; - } - public String getRightUpLabel() { - return this.rightUpLabel; - } - - - /** - * Down label for the left side. - * @a2 tagattribute required="false" - */ - public void setRightDownLabel(String rightDownlabel) { - this.rightDownLabel = rightDownlabel; - } - public String getRightDownLabel() { - return rightDownLabel; - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Panel.java b/trunk/core/src/main/java/org/apache/struts2/components/Panel.java deleted file mode 100644 index f32987738..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Panel.java +++ /dev/null @@ -1,120 +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 java.io.Writer; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render a panel for tabbedPanel.

    - * - * - *

    Examples - * See the example in {@link TabbedPanel}. - *

    - * - * @see TabbedPanel - * - * @s.tag name="panel" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.PanelTag" - * description="Render a panel for tabbedPanel" - */ -public class Panel extends Div { - - public static final String TEMPLATE = "tab"; - public static final String TEMPLATE_CLOSE = "tab-close"; - public static final String COMPONENT_NAME = Panel.class.getName(); - - protected String tabName; - protected String subscribeTopicName; - protected String remote; - - public Panel(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public String getDefaultOpenTemplate() { - return TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE_CLOSE; - } - - public boolean end(Writer writer, String body) { - TabbedPanel tabbedPanel = ((TabbedPanel) findAncestor(TabbedPanel.class)); - subscribeTopicName = tabbedPanel.getTopicName(); - tabbedPanel.addTab(this); - - return super.end(writer, body); - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (tabName != null) { - addParameter("tabName", findString(tabName)); - } - - if (subscribeTopicName != null) { - addParameter("subscribeTopicName", subscribeTopicName); - } - - if (remote != null && "true".equalsIgnoreCase(remote)) { - addParameter("remote", "true"); - } else { - addParameter("remote", "false"); - } - } - - public String getTabName() { - return findString(tabName); - } - - public String getComponentName() { - return COMPONENT_NAME; - } - - /** - * The text of the tab to display in the header tab list - * @s.tagattribute required="true" - */ - public void setTabName(String tabName) { - this.tabName = tabName; - } - - /** - * Set subscribeTopicName attribute - * @s.tagattribute required="false" - */ - public void setSubscribeTopicName(String subscribeTopicName) { - this.subscribeTopicName = subscribeTopicName; - } - - /** - * determines whether this is a remote panel (ajax) or a local panel (content loaded into visible/hidden containers) - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setRemote(String remote) { - this.remote = remote; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Param.java b/trunk/core/src/main/java/org/apache/struts2/components/Param.java deleted file mode 100644 index e48c8bf3b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Param.java +++ /dev/null @@ -1,159 +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 java.io.Writer; - -import org.apache.struts2.StrutsException; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    This tag can be used to parameterize other tags.

    - * The include tag and bean tag are examples of such tags. - *

    - * The parameters can be added with or without a name as key. - * If the tag provides a name attribute the parameters are added using the - * {@link Component#addParameter(String, Object) addParamter} method. - * For unnamed parameters the Tag must implement the {@link UnnamedParametric} interface defined in - * this class (e.g. The TextTag does this). - *

    - * This tag has the following two paramters. - * - *

      - *
    • name (String) - the name of the parameter
    • - *
    • value (Object) - the value of the parameter
    • - *
    - * - *

    - * Note: - * When you declare the param tag, the value can be defined in either a value attribute or - * as text between the start and end tag. Struts behaves a bit different according to these two situations. - * This is best illustrated using an example: - *
    <param name="color">blue</param> <-- (A) --> - *
    <param name="color" value="blue"/> <-- (B) --> - *
    In the first situation (A) the value would be evaluated to the stack as a java.lang.String object. - * And in situation (B) the value would be evaluated to the stack as a java.lang.Object object. - *
    For more information see WW-808. - * - * - *

    Examples - * - *

    - * <ui:component>
    - *  <ui:param name="key"     value="[0]"/>
    - *  <ui:param name="value"   value="[1]"/>
    - *  <ui:param name="context" value="[2]"/>
    - * </ui:component>
    - * 
    - * - *

    - * - * where the key will be the identifier and the value the result of an OGNL expression run against the current - * ValueStack. - * - *

    - * This second example demonstrates how the text tag can use parameters from this param tag. - * - *

    - * <s:text name="cart.total.cost">
    - *     <s:param value="#session.cartTotal"/>
    - * </s:text>
    - * 
    - * - *

    - * - * @see Include - * @see Bean - * @see Text - * - * @s.tag name="param" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ParamTag" - * description="Parametrize other tags" - */ -public class Param extends Component { - protected String name; - protected String value; - - public Param(ValueStack stack) { - super(stack); - } - - public boolean end(Writer writer, String body) { - Component component = findAncestor(Component.class); - if (value != null) { - if (component instanceof UnnamedParametric) { - ((UnnamedParametric) component).addParameter(findValue(value)); - } else { - String name = findString(this.name); - - if (name == null) { - throw new StrutsException("No name found for following expression: " + name); - } - - Object value = findValue(this.value); - component.addParameter(name, value); - } - } else { - if (component instanceof UnnamedParametric) { - ((UnnamedParametric) component).addParameter(body); - } else { - component.addParameter(findString(name), body); - } - } - - return super.end(writer, ""); - } - - public boolean usesBody() { - return true; - } - - /** - * Name of Parameter to set - * @s.tagattribute required="false" type="String" - */ - public void setName(String name) { - this.name = name; - } - - /** - * Value expression for Parameter to set - * @s.tagattribute required="false" default="The value of evaluating provided name against stack" - */ - public void setValue(String value) { - this.value = value; - } - - - /** - * Tags can implement this to support nested param tags without the name attribute. - *

    - * The {@link Text TextTag} uses this approach. For unnamed parameters an example is given in the class - * javadoc for {@link Param ParamTag}. - */ - public interface UnnamedParametric { - - /** - * Adds the given value as a parameter to the outer tag. - * @param value the value - */ - public void addParameter(Object value); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Password.java b/trunk/core/src/main/java/org/apache/struts2/components/Password.java deleted file mode 100644 index 3b2b92a15..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Password.java +++ /dev/null @@ -1,74 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render an HTML input tag of type password.

    - * - * - *

    Examples - *

    - * - * In this example, a password control is displayed. For the label, we are calling ActionSupport's getText() to - * retrieve password label from a resource bundle.

    - * - *

    - * 
    - * <s:password label="%{text('password')}" name="password" size="10" maxlength="15" />
    - * 
    - * 
    - * - * @s.tag name="password" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.PasswordTag" - * description="Render an HTML input tag of type password" - */ -public class Password extends TextField { - final public static String TEMPLATE = "password"; - - protected String showPassword; - - public Password(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (showPassword != null) { - addParameter("showPassword", findValue(showPassword, Boolean.class)); - } - } - - /** - * Whether to show input - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setShowPassword(String showPassword) { - this.showPassword = showPassword; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Property.java b/trunk/core/src/main/java/org/apache/struts2/components/Property.java deleted file mode 100644 index 56b413f51..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Property.java +++ /dev/null @@ -1,162 +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 java.io.IOException; -import java.io.Writer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.TextUtils; - -/** - * - * - * Used to get the property of a value, which will default to the top of - * the stack if none is specified. - * - * - * - *

    - * - * - * - * - *

      - *
    • default (String) - The default value to be used if value attribute is null
    • - *
    • escape (Boolean) - Escape HTML. Default to true
    • - *
    • value (Object) - value to be displayed
    • - *
    - * - * - * - * - *
    - * 
    - * 
    - * 
    - *     
    - *     
    - *
    - *     TextUtils
    - *     
    - * 
    - * 
    - * 
    - * 
    - * - *
    - * 
    - * 
    - * Example 1 prints the result of myBean's getMyBeanProperty() method.
    - * Example 2 prints the result of myBean's getMyBeanProperty() method and if it is null, print 'a default value' instead.
    - * 
    - * 
    - * 
    - * - * - *
    - * 
    - * 
    - * <s:property value="getText('some.key')" />
    - * 
    - * 
    - * 
    - * - * @s.tag name="property" tld-body-content="empty" tld-tag-class="org.apache.struts2.views.jsp.PropertyTag" - * description="Print out expression which evaluates against the stack" - */ -public class Property extends Component { - private static final Log LOG = LogFactory.getLog(Property.class); - - public Property(ValueStack stack) { - super(stack); - } - - private String defaultValue; - private String value; - private boolean escape = true; - - /** - * The default value to be used if value attribute is null - * @s.tagattribute required="false" type="String" - */ - public void setDefault(String defaultValue) { - this.defaultValue = defaultValue; - } - - /** - * Whether to escape HTML - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setEscape(boolean escape) { - this.escape = escape; - } - - /** - * value to be displayed - * @s.tagattribute required="false" type="Object" default="<top of stack>" - */ - public void setValue(String value) { - this.value = value; - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - String actualValue = null; - - if (value == null) { - value = "top"; - } - else if (altSyntax()) { - // the same logic as with findValue(String) - // if value start with %{ and end with }, just cut it off! - if (value.startsWith("%{") && value.endsWith("}")) { - value = value.substring(2, value.length() - 1); - } - } - - // exception: don't call findString(), since we don't want the - // expression parsed in this one case. it really - // doesn't make sense, in fact. - actualValue = (String) getStack().findValue(value, String.class); - - try { - if (actualValue != null) { - writer.write(prepare(actualValue)); - } else if (defaultValue != null) { - writer.write(prepare(defaultValue)); - } - } catch (IOException e) { - LOG.info("Could not print out value '" + value + "'", e); - } - - return result; - } - - private String prepare(String value) { - if (escape) { - return TextUtils.htmlEncode(value); - } else { - return value; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Push.java b/trunk/core/src/main/java/org/apache/struts2/components/Push.java deleted file mode 100644 index 378baeee2..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Push.java +++ /dev/null @@ -1,148 +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 java.io.Writer; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    Push value on stack for simplified usage.

    - * - * - * - *
      - *
    • value* (Object) - value to be pushed into the top of the stack
    • - *
    - * - * - * - *

    Examples - *

    - * 
    - * <s:push value="user">
    - *     <s:propery value="firstName" />
    - *     <s:propery value="lastName" />
    - * </s:push>
    - * 
    - * 
    - * - * - * Pushed user into the stack, and hence property tag could access user's properties - * (firstName, lastName etc) since user is not at the top of the stack - * - * - *
    - * 
    - *  <s:push value="myObject">                              ----- (1)
    - *       <s:bean name="jp.SomeBean" id="myBean"/>        ----- (2)
    - * 		    <s:param name="myParam" value="top"/>        ----- (3)
    - *       </s:bean>
    - *   </s:push>
    - * 
    - * 
    - * - *
    - * 
    - * when in (1), myObject is at the top of the stack
    - * when in (2), jp.SomeBean is in the top of stack, also in stack's context with key myBean
    - * when in (3), top will get the jp.SomeBean instance
    - * 
    - * 
    - * - *
    - * 
    - * <s:push value="myObject">                                       ---(A)
    - *    <s:bean name="jp.SomeBean" id="myBean"/>                   ---(B)
    - *       <s:param name="myParam" value="top.mySomeOtherValue"/>  ---(C)
    - *    </s:bean>
    - * </s:push>
    - * 
    - * 
    - * - *
    - * 
    - * when in (A), myObject is at the top of the stack
    - * when in (B), jp.SomeBean is at the top of the stack, also in context with key myBean
    - * when in (C), top refers to jp.SomeBean instance. so top.mySomeOtherValue would invoke SomeBean's mySomeOtherValue() method
    - * 
    - * 
    - * - *
    - *        
    - * <s:push value="myObject">                                 ---- (i)
    - *    <s:bean name="jp.SomeBean" id="myBean"/>             ---- (ii)
    - *       <s:param name="myParam" value="[1].top"/>         -----(iii)
    - *    </s:bean>
    - * </s:push>
    - * 
    - * 
    - * - *
    - * 
    - * when in (i), myObject is at the top of the stack
    - * when in (ii), jp.SomeBean is at the top of the stack, followed by myObject
    - * when in (iii), [1].top will returned top of the cut of stack starting from myObject, namely myObject itself 
    - * 
    - * 
    - * - * @s.tag name="push" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.PushTag" - * description="Push value on stack for simplified usage." - */ -public class Push extends Component { - protected String value; - protected boolean pushed; - - public Push(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - ValueStack stack = getStack(); - - if (stack != null) { - stack.push(findValue(value, "value", "You must specify a value to push on the stack. Example: person")); - pushed = true; - } else { - pushed = false; // need to ensure push is assigned, otherwise we may have a leftover value - } - - return result; - } - - public boolean end(Writer writer, String body) { - ValueStack stack = getStack(); - - if (pushed && (stack != null)) { - stack.pop(); - } - - return super.end(writer, body); - } - - /** - * Value to push on stack - * @s.tagattribute required="true" - */ - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Radio.java b/trunk/core/src/main/java/org/apache/struts2/components/Radio.java deleted file mode 100644 index f48e2527e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Radio.java +++ /dev/null @@ -1,59 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render a radio button input field.

    - * - * - *

    Examples - *

    - * - * In this example, a radio control is displayed with a list of genders. The gender list is built from attribute - * id=genders. The framework calls getGenders() which will return a Map. For examples using listKey and listValue attributes, - * see the section select tag. The default selected one will be determined (in this case) by the getMale() method - * in the action class which should retun a value similar to the key of the getGenters() map if that particular - * gender is to be selected.

    - * - *

    - * 
    - * <s:action name="GenderMap" id="genders"/>
    - * <s:radio label="Gender" name="male" list="#genders.genders"/>
    - * 
    - * 
    - * - * @s.tag name="radio" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.RadioTag" - * description="Renders a radio button input field" - */ -public class Radio extends ListUIBean { - final public static String TEMPLATE = "radiomap"; - - public Radio(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java b/trunk/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java deleted file mode 100644 index 5d5f85875..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java +++ /dev/null @@ -1,99 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * RemoteCallUIBean is superclass for all components dealing with remote calls. - * - */ -public abstract class RemoteCallUIBean extends ClosingUIBean { - - protected String href; - protected String errorText; - protected String showErrorTransportText; - protected String afterLoading; - - public RemoteCallUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (href != null) { - addParameter("href", findString(href)); - } - - if (showErrorTransportText != null) { - addParameter("showErrorTransportText", findValue(showErrorTransportText, Boolean.class)); - } - - if (errorText != null) { - addParameter("errorText", findString(errorText)); - } - - if (afterLoading != null) { - addParameter("afterLoading", findString(afterLoading)); - } - } - - /** - * The theme to use for the element. This tag will usually use the ajax theme. - * @s.tagattribute required="false" type="String" - */ - public void setTheme(String theme) { - super.setTheme(theme); - } - - /** - * The URL to call to obtain the content - * @s.tagattribute required="false" type="String" - */ - public void setHref(String href) { - this.href = href; - } - - /** - * The text to display to the user if the is an error fetching the content - * @s.tagattribute required="false" type="String" - */ - public void setErrorText(String errorText) { - this.errorText = errorText; - } - - /** - * when to show the error message as content when the URL had problems - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setShowErrorTransportText(String showErrorTransportText) { - this.showErrorTransportText = showErrorTransportText; - } - - /** - * Javascript code that will be executed after the content has been fetched - * @s.tagattribute required="false" type="String" - */ - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Reset.java b/trunk/core/src/main/java/org/apache/struts2/components/Reset.java deleted file mode 100644 index db96b85e9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Reset.java +++ /dev/null @@ -1,99 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render a reset button. The reset tag is used together with the form tag to provide form resetting. - * The reset can have two different types of rendering: - *
      - *
    • input: renders as html <input type="reset"...>
    • - *
    • button: renders as html <button type="reset"...>
    • - *
    - * Please note that the button type has advantages by adding the possibility to seperate the submitted value from the - * text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0 - * - * - *

    Examples - * - *

    - * 
    - * <s:reset value="%{'Reset'}" />
    - * 
    - * 
    - * - *
    - * 
    - * Render an button reset:
    - * <s:reset type="button" value="%{'Reset'}" label="Reset the form"/>
    - * 
    - * 
    - * - * @s.tag name="reset" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.ResetTag" - * description="Render a reset button" - */ -public class Reset extends FormButton { - final public static String TEMPLATE = "reset"; - - protected String action; - protected String method; - protected String align; - protected String type; - - public Reset(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return Reset.TEMPLATE; - } - - public void evaluateParams() { - - if (value == null) { - value = "Reset"; - } - - super.evaluateParams(); - } - - /** - * Indicate whether the concrete button supports the type "image". - * - * @return false to indicate type image is supported. - */ - protected boolean supportsImageType() { - return false; - } - - /** - * Supply a reset button text apart from reset value. Will have no effect for input type reset, since button - * text will always be the value parameter. - * - * @s.tagattribute required="false" - */ - public void setLabel(String label) { - super.setLabel(label); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Select.java b/trunk/core/src/main/java/org/apache/struts2/components/Select.java deleted file mode 100644 index 0335b6ffb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Select.java +++ /dev/null @@ -1,153 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Render an HTML input tag of type select. - * - * - * - *

    Examples - *

    - * 
    - * 
    - * <s:select label="Pets"
    - *        name="petIds"
    - *        list="petDao.pets"
    - *        listKey="id"
    - *        listValue="name"
    - *        multiple="true"
    - *        size="3"
    - *        required="true"
    - * />
    - *
    - * <s:select label="Months"
    - *        name="months"
    - *        headerKey="-1" headerValue="Select Month"
    - *        list="#{'01':'Jan', '02':'Feb', [...]}"
    - *        value="selectedMonth"
    - *        required="true"
    - * />
    - *
    - * // The month id (01, 02, ...) returned by the getSelectedMonth() call
    - * // against the stack will be auto-selected
    - * 
    - * 
    - * 
    - * - *

    - * - * - * - * Note: For any of the tags that use lists (select probably being the most ubiquitous), which uses the OGNL list - * notation (see the "months" example above), it should be noted that the map key created (in the months example, - * the '01', '02', etc.) is typed. '1' is a char, '01' is a String, "1" is a String. This is important since if - * the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they - * WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list - * will be auto-selected.

    - * - * - * - * @s.tag name="select" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.SelectTag" - * description="Render a select element" - */ -public class Select extends ListUIBean { - final public static String TEMPLATE = "select"; - - protected String emptyOption; - protected String headerKey; - protected String headerValue; - protected String multiple; - protected String size; - - public Select(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (emptyOption != null) { - addParameter("emptyOption", findValue(emptyOption, Boolean.class)); - } - - if (multiple != null) { - addParameter("multiple", findValue(multiple, Boolean.class)); - } - - if (size != null) { - addParameter("size", findString(size)); - } - - if ((headerKey != null) && (headerValue != null)) { - addParameter("headerKey", findString(headerKey)); - addParameter("headerValue", findString(headerValue)); - } - } - - /** - * Whether or not to add an empty (--) option after the header option - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } - - /** - * Key for first item in list. Must not be empty! "'-1'" and "''" is correct, "" is bad. - * @s.tagattribute required="false" - */ - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } - - /** - * Value expression for first item in list - * @s.tagattribute required="false" - */ - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } - - /** - * Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this. - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setMultiple(String multiple) { - this.multiple = multiple; - } - - /** - * Size of the element box (# of elements to show) - * @s.tagattribute required="false" type="Integer" - */ - public void setSize(String size) { - this.size = size; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Set.java b/trunk/core/src/main/java/org/apache/struts2/components/Set.java deleted file mode 100644 index a8c8c3e14..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Set.java +++ /dev/null @@ -1,142 +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 java.io.Writer; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

    The set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a - * complex expression and then simply reference that variable each time rather than the complex expression. This is - * useful in both cases: when the complex expression takes time (performance improvement) or is hard to read (code - * readability improvement).

    - * - * The scopes available are as follows :- - *
      - *
    • application - the value will be set in application scope according to servlet spec. using the name as its key
    • - *
    • session - the value will be set in session scope according to servlet spec. using the name as key
    • - *
    • request - the value will be set in request scope according to servlet spec. using the name as key
    • - *
    • page - the value will be set in request scope according to servlet sepc. using the name as key
    • - *
    • action - the value will be set in the request scope and Struts' action context using the name as key
    • - *
    - * - * NOTE:

    - * If no scope is specified, it will default to action scope. - * - * - * - *

    Parameters - * - * - * - *

      - * - *
    • name* (String): The name of the new variable that is assigned the value of value
    • - * - *
    • value (Object): The value that is assigned to the variable named name
    • - * - *
    • scope (String): The scope in which to assign the variable. Can be application, session, - * request, page, or action. By default it is action.
    • - * - *
    - * - * - * - *

    Examples - * - *

    - * 
    - * <s:set name="personName" value="person.name"/>
    - * Hello, <s:property value="#personName"/>. How are you?
    - * 
    - * 
    - * - * @s.tag name="set" tld-body-content="empty" tld-tag-class="org.apache.struts2.views.jsp.SetTag" - * description="Assigns a value to a variable in a specified scope" - */ -public class Set extends Component { - protected String name; - protected String scope; - protected String value; - - public Set(ValueStack stack) { - super(stack); - } - - public boolean end(Writer writer, String body) { - ValueStack stack = getStack(); - - if (value == null) { - value = "top"; - } - - Object o = findValue(value); - - String name; - if (altSyntax()) { - name = findString(this.name, "name", "Name is required"); - } else { - name = this.name; - - if (this.name == null) { - throw fieldError("name", "Name is required", null); - } - } - - if ("application".equalsIgnoreCase(scope)) { - stack.setValue("#application['" + name + "']", o); - } else if ("session".equalsIgnoreCase(scope)) { - stack.setValue("#session['" + name + "']", o); - } else if ("request".equalsIgnoreCase(scope)) { - stack.setValue("#request['" + name + "']", o); - } else if ("page".equalsIgnoreCase(scope)) { - stack.setValue("#attr['" + name + "']", o, false); - } else { - stack.getContext().put(name, o); - stack.setValue("#attr['" + name + "']", o, false); - } - - return super.end(writer, body); - } - - /** - * The name of the new variable that is assigned the value of value - * @s.tagattribute required="true" type="String" - */ - public void setName(String name) { - this.name = name; - } - - /** - * The scope in which to assign the variable. Can be application, session, request, page, or action. - * @s.tagattribute required="false" type="String" default="action" - */ - public void setScope(String scope) { - this.scope = scope; - } - - /** - * The value that is assigned to the variable named name - * @s.tagattribute required="false" - */ - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Submit.java b/trunk/core/src/main/java/org/apache/struts2/components/Submit.java deleted file mode 100644 index f173caf43..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Submit.java +++ /dev/null @@ -1,287 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render a submit button. The submit tag is used together with the form tag to provide asynchronous form submissions. - * The submit can have three different types of rendering: - *
      - *
    • input: renders as html <input type="submit"...>
    • - *
    • image: renders as html <input type="image"...>
    • - *
    • button: renders as html <button type="submit"...>
    • - *
    - * Please note that the button type has advantages by adding the possibility to seperate the submitted value from the - * text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0 - * - * - *

    Examples - * - *

    - * 
    - * <s:submit value="%{'Submit'}" />
    - * 
    - * 
    - * - *
    - * 
    - * Render an image submit:
    - * <s:submit type="image" value="%{'Submit'}" label="Submit the form" src="submit.gif"/>
    - * 
    - * 
    - * - *
    - * 
    - * Render an button submit:
    - * <s:submit type="button" value="%{'Submit'}" label="Submit the form"/>
    - * 
    - * 
    - * - * - * THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED - *
      - *
    • resultDivId
    • - *
    • notifyTopics
    • - *
    • onLoadJS
    • - *
    • preInvokeJS
    • - *
    - * The remote form has three basic modes of use, using the resultDivId, - * the notifyTopics, or the onLoadJS. You can mix and match any combination of - * them to get your desired result. All of these examples are contained in the - * Ajax example webapp. Lets go through some scenarios to see how you might use it: - * - * - * - * Show the results in another div. If you want your results to be shown in - * a div, use the resultDivId where the id is the id of the div you want them - * shown in. This is an inner HTML approah. Your results get jammed into - * the div for you. Here is a sample of this approach: - * - * - *
    - * 
    - * Remote form replacing another div:
    - * <div id='two' style="border: 1px solid yellow;">Initial content</div>
    - * <s:form
    - *       id='theForm2'
    - *       cssStyle="border: 1px solid green;"
    - *       action='/AjaxRemoteForm.action'
    - *       method='post'
    - *       theme="ajax">
    - *
    - *   <input type='text' name='data' value='Struts User' />
    - *   <s:submit value="GO2" theme="ajax" resultDivId="two" />
    - *
    - * </s:form >
    - * 
    - * 
    - * - * - * - * Notify other controls(divs) of a change. Using an pub-sub model you can - * notify others that your control changed and they can take the appropriate action. - * Most likely they will execute some action to refresh. The notifyTopics does this - * for you. You can have many topic names in a comma delimited list. - * eg: notifyTopics="newPerson, dataChanged" . - * Here is an example of this approach: - * - * - *
    - * 
    - * <s:form id="frm1" action="newPersonWithXMLResult" theme="ajax"  >
    - *     <s:textfield label="Name" name="person.name" value="person.name" size="20" required="true" />
    - *     <s:submit id="submitBtn" value="Save" theme="ajax"  cssClass="primary"  notifyTopics="personUpdated, systemWorking" />
    - * </s:form >
    - * 
    - * <s:div href="/listPeople.action" theme="ajax" errorText="error opps"
    - *         loadingText="loading..." id="cart-body" >
    - *     <s:action namespace="" name="listPeople" executeResult="true" />
    - * </s:div>
    - * 
    - * 
    - * - * - * Massage the results with JavaScript. Say that your result returns some h - * appy XML and you want to parse it and do lots of cool things with it. - * The way to do this is with a onLoadJS handler. Here you provide the name of - * a JavaScript function to be called back with the result and the event type. - * The only key is that you must use the variable names 'data' and 'type' when - * defining the callback. For example: onLoadJS="myFancyDancyFunction(data, type)". - * While I talked about XML in this example, your not limited to XML, the data in - * the callback will be exactly whats returned as your result. - * Here is an example of this approach: - * - * - *
    - * 
    - * <script language="JavaScript" type="text/javascript">
    - *     function doGreatThings(data, type) {
    - *         //Do whatever with your returned fragment... 
    - *         //Perhapps.... if xml...
    - *               var xml = dojo.xml.domUtil.createDocumentFromText(data);
    - *               var people = xml.getElementsByTagName("person");
    - *               for(var i = 0;i < people.length; i ++){
    - *                   var person = people[i];
    - *                   var name = person.getAttribute("name")
    - *                   var id = person.getAttribute("id")
    - *                   alert('Thanks dude. Person: ' + name + ' saved great!!!');
    - *               }
    - *
    - *     }
    - * </script>
    - *
    - * <s:form id="frm1" action="newPersonWithXMLResult" theme="ajax"  >
    - *     <s:textfield label="Name" name="person.name" value="person.name" size="20" required="true" />
    - *     <s:submit id="submitBtn" value="Save" theme="ajax"  cssClass="primary"  onLoadJS="doGreatThings(data, type)" />
    - * </s:form>
    - * 
    - * 
    - * - * @s.tag name="submit" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.SubmitTag" - * description="Render a submit button" - */ -public class Submit extends FormButton { - final public static String TEMPLATE = "submit"; - - protected String resultDivId; - protected String onLoadJS; - protected String notifyTopics; - protected String listenTopics; - protected String preInvokeJS; - protected String src; - - public Submit(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateParams() { - if (value == null) { - value = "Submit"; - } - super.evaluateParams(); - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - /* if (value == null) { - value = "Submit"; - }*/ - - //super.evaluateParams(); - - if (null != src) { - addParameter("src", findString(src)); - } - - if (null != resultDivId) { - addParameter("resultDivId", findString(resultDivId)); - } - - if (null != onLoadJS) { - addParameter("onLoadJS", findString(onLoadJS)); - } - - if (null != notifyTopics) { - addParameter("notifyTopics", findString(notifyTopics)); - } - - if (null != listenTopics) { - addParameter("listenTopics", findString(listenTopics)); - } - - if (preInvokeJS != null) { - addParameter("preInvokeJS", findString(preInvokeJS)); - } - - } - - /** - * Indicate whether the concrete button supports the type "image". - * - * @return true to indicate type image is supported. - */ - protected boolean supportsImageType() { - return true; - } - - /** - * The id of the HTML element to place the result (this can the the form's id or any id on the page. - * @s.tagattribute required="false" type="String" - */ - public void setResultDivId(String resultDivId) { - this.resultDivId = resultDivId; - } - - /** - * Javascript code that will be executed after the form has been submitted. The format is onLoadJS='yourMethodName(data,type)'. NOTE: the words data and type must be left like that if you want the event type and the returned data. - * @s.tagattribute required="false" type="String" - */ - public void setOnLoadJS(String onLoadJS) { - this.onLoadJS = onLoadJS; - } - - /** - * Topic names to post an event to after the form has been submitted. - * @s.tagattribute required="false" type="String" - */ - public void setNotifyTopics(String notifyTopics) { - this.notifyTopics = notifyTopics; - } - - /** - * Set listenTopics attribute. - * @s.tagattribute required="false" type="String" - */ - public void setListenTopics(String listenTopics) { - this.listenTopics = listenTopics; - } - - /** - * Javascript code that will be executed before invokation. The format is preInvokeJS='yourMethodName(data,type)'. - * @s.tagattribute required="false" type="String" - */ - public void setPreInvokeJS(String preInvokeJS) { - this.preInvokeJS = preInvokeJS; - } - - /** - * Supply a submit button text apart from submit value. Will have no effect for input type submit, since button text will always be the value parameter. For the type image, alt parameter will be set to this value. - * @s.tagattribute required="false" - */ - public void setLabel(String label) { - super.setLabel(label); - } - - /** - * Supply an image src for image type submit button. Will have no effect for types input and button. - * @s.tagattribute required="false" - */ - public void setSrc(String src) { - this.src = src; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/TabbedPanel.java b/trunk/core/src/main/java/org/apache/struts2/components/TabbedPanel.java deleted file mode 100644 index 750c3f599..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/TabbedPanel.java +++ /dev/null @@ -1,156 +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 java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * The tabbedpanel widget is primarily an AJAX component, where each tab can either be local content or remote - * content (refreshed each time the user selects that tab).

    - * - * - *

    Examples - *

    - * - * The following is an example of a tabbedpanel and panel tag utilizing local and remote content.

    - * - *

    - * 
    - * <s:tabbedPanel id="test2" theme="simple" >
    - *     <s:panel id="left" tabName="left" theme="ajax">
    - *         This is the left pane<br/>
    - *         <s:form >
    - *             <s:textfield name="tt" label="Test Text" />  <br/>
    - *             <s:textfield name="tt2" label="Test Text2" />
    - *         </s:form>
    - *     </s:panel>
    - *     <s:panel remote="true" href="/AjaxTest.action" id="ryh1" theme="ajax" tabName="remote one" />
    - *     <s:panel id="middle" tabName="middle" theme="ajax">
    - *         middle tab<br/>
    - *         <s:form >
    - *             <s:textfield name="tt" label="Test Text44" />  <br/>
    - *             <s:textfield name="tt2" label="Test Text442" />
    - *         </s:form>
    - *     </s:panel>
    - *     <s:panel remote="true" href="/AjaxTest.action"  id="ryh21" theme="ajax" tabName="remote right" />
    - * </s:tabbedPanel>
    - * 
    - * 
    - * - *

    Additional Configuration - * - * - * If you are looking for the "nifty" rounded corner look, there is additional configuration. This assumes - * that the background color of the tabs is white. If you are using a different color, please modify the - * parameter in the Rounded() method.

    - * - * - *

    - * 
    - * <link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
    - * <link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyCorners.css"/>">
    - * <link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyPrint.css"/>" media="print">
    - * <script type="text/javascript" src="<s:url value="/struts/niftycorners/nifty.js"/>"></script>
    - * <script type="text/javascript">
    - *     dojo.event.connect(window, "onload", function() {
    - *         if (!NiftyCheck())
    - *             return;
    - *         Rounded("li.tab_selected", "top", "white", "transparent", "border #ffffffS");
    - *         Rounded("li.tab_unselected", "top", "white", "transparent", "border #ffffffS");
    - *         // "white" needs to be replaced with the background color
    - *     });
    - * </script>
    - * 
    - * 
    - * - * Important: Be sure to setup the page containing this tag to be Configured for AJAX - * - * @see Panel - * - * @s.tag name="tabbedPanel" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TabbedPanelTag" - * description="Render a tabbedPanel widget." - */ -public class TabbedPanel extends ClosingUIBean { - public static final String TEMPLATE = "tabbedpanel"; - public static final String TEMPLATE_CLOSE = "tabbedpanel-close"; - final private static String COMPONENT_NAME = TabbedPanel.class.getName(); - - protected List tabs = new ArrayList(); - - public TabbedPanel(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - /** - * Add a new panel to be rendered. - * - * @param pane a new panel to be rendered - */ - public void addTab(Panel pane) { - tabs.add(pane); - } - - /** - * Get the list of panel tabs for this tab panel. - * - * @return the list of panel tabs for this tab panel - */ - public List getTabs() { - return tabs; - } - - public String getTopicName() { - return "topic_tab_" + id + "_selected"; - } - - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - addParameter("topicName", "topic_tab_" + id + "_selected"); - addParameter("tabs", tabs); - - } - - public String getDefaultOpenTemplate() { - return TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE_CLOSE; - } - - public String getComponentName() { - return COMPONENT_NAME; - } - - /** - * The id to assign to the component. - * @s.tagattribute required="true" type="String" - */ - public void setId(String id) { - // This is required to override tld generation attributes to required=true - super.setId(id); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Text.java b/trunk/core/src/main/java/org/apache/struts2/components/Text.java deleted file mode 100644 index 7485b4676..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Text.java +++ /dev/null @@ -1,189 +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 java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.TextUtils; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.TextProvider; - -/** - * - * Render a I18n text message. - * - *

    - * - * The message must be in a resource bundle - * with the same name as the action that it is associated with. In practice - * this means that you should create a properties file in the same package - * as your Java class with the same name as your class, but with .properties - * extension. - * - *

    - * - * If the named message is not found, then the body of the tag will be used as default message. - * If no body is used, then the name of the message will be used. - * - * - * - * - * - * - * - *

      - *
    • name* (String) - the i18n message key
    • - *
    - * - * - * - *

    - * - * Example: - *

    - * 
    - * 
    - * Accessing messages from a given bundle (the i18n Shop example bundle in the first example) and using bundle defined through the framework in the second example.

    - * - * - *
    - * - *
    - * 
    - * 
    - * <!-- First Example -->
    - * <s:i18n name="struts.action.test.i18n.Shop">
    - *     <s:text name="main.title"/>
    - * </s:i18n>
    - *
    - * <!-- Second Example -->
    - * <s:text name="main.title" />
    - * 
    - * <!-- Third Examlpe -->
    - * <s:text name="i18n.label.greetings">
    - *    <s:param >Mr Smith</s:param>
    - * </s:text>
    - * 
    - * 
    - * 
    - * - * - *
    - * 
    - * 
    - * <-- Fourth Example -->
    - * <s:text name="some.key" />
    - * 
    - * <-- Fifth Example -->
    - * <s:text name="some.invalid.key" >
    - *    The Default Message That Will Be Displayed
    - * </s:text>
    - * 
    - * 
    - * 
    - * - * @see Param - * - * @s.tag name="text" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.TextTag" - * description="Render a I18n text message." - */ -public class Text extends Component implements Param.UnnamedParametric { - private static final Log LOG = LogFactory.getLog(Text.class); - - protected List values = Collections.EMPTY_LIST; - protected String actualName; - protected String name; - - public Text(ValueStack stack) { - super(stack); - } - - /** - * Name of resource property to fetch - * @s.tagattribute required="true" - */ - public void setName(String name) { - this.name = name; - } - - - public boolean usesBody() { - // overriding this to true such that EVAL_BODY_BUFFERED is return and - // bodyContent will be valid hence, text between start & end tag will - // be honoured as default message (WW-1268) - return true; - } - - public boolean end(Writer writer, String body) { - actualName = findString(name, "name", "You must specify the i18n key. Example: welcome.header"); - String defaultMessage; - if (TextUtils.stringSet(body)) { - defaultMessage = body; - } else { - defaultMessage = actualName; - } - String msg = null; - ValueStack stack = getStack(); - - for (Iterator iterator = getStack().getRoot().iterator(); - iterator.hasNext();) { - Object o = iterator.next(); - - if (o instanceof TextProvider) { - TextProvider tp = (TextProvider) o; - msg = tp.getText(actualName, defaultMessage, values, stack); - - break; - } - } - - if (msg != null) { - try { - if (getId() == null) { - writer.write(msg); - } else { - stack.getContext().put(getId(), msg); - } - } catch (IOException e) { - LOG.error("Could not write out Text tag", e); - } - } - - return super.end(writer, ""); - } - - public void addParameter(String key, Object value) { - addParameter(value); - } - - public void addParameter(Object value) { - if (values.isEmpty()) { - values = new ArrayList(4); - } - - values.add(value); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java b/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java deleted file mode 100644 index 6d8e49446..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java +++ /dev/null @@ -1,110 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render HTML textarea tag.

    - * - * - *

    Examples - * - *

    - * 
    - * <s:textarea label="Comments" name="comments" cols="30" rows="8"/>
    - * 
    - * 
    - * - * @see TabbedPanel - * - * @s.tag name="textarea" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TextareaTag" - * description="Render HTML textarea tag." - */ -public class TextArea extends UIBean { - final public static String TEMPLATE = "textarea"; - - protected String cols; - protected String readonly; - protected String rows; - protected String wrap; - - public TextArea(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (readonly != null) { - addParameter("readonly", findValue(readonly, Boolean.class)); - } - - if (cols != null) { - addParameter("cols", findString(cols)); - } - - if (rows != null) { - addParameter("rows", findString(rows)); - } - - if (wrap != null) { - addParameter("wrap", findString(wrap)); - } - } - - /** - * HTML cols attribute - * @s.tagattribute required="false" type="Integer" - */ - public void setCols(String cols) { - this.cols = cols; - } - - /** - * Whether the textarea is readonly - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setReadonly(String readonly) { - this.readonly = readonly; - } - - /** - * HTML rows attribute - * @s.tagattribute required="false" type="Integer" - */ - public void setRows(String rows) { - this.rows = rows; - } - - /** - * HTML wrap attribute - * @s.tagattribute required="false" type="String" - */ - public void setWrap(String wrap) { - this.wrap = wrap; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/TextField.java b/trunk/core/src/main/java/org/apache/struts2/components/TextField.java deleted file mode 100644 index d724983b0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/TextField.java +++ /dev/null @@ -1,111 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Render an HTML input field of type text

    - * - * - *

    Examples - *

    - * - * In this example, a text control is rendered. The label is retrieved from a ResourceBundle by calling - * ActionSupport's getText() method.

    - * - *

    - * 
    - * <s:textfield label="%{text('user_name')}" name="user" />
    - * 
    - * 
    - * - * @s.tag name="textfield" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TextFieldTag" - * description="Render an HTML input field of type text" - */ -public class TextField extends UIBean { - /** - * The name of the default template for the TextFieldTag - */ - final public static String TEMPLATE = "text"; - - - protected String maxlength; - protected String readonly; - protected String size; - - public TextField(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (size != null) { - addParameter("size", findString(size)); - } - - if (maxlength != null) { - addParameter("maxlength", findString(maxlength)); - } - - if (readonly != null) { - addParameter("readonly", findValue(readonly, Boolean.class)); - } - } - - /** - * HTML maxlength attribute - * @s.tagattribute required="false" type="Integer" - */ - public void setMaxlength(String maxlength) { - this.maxlength = maxlength; - } - - /** - * Deprecated. Use maxlength instead. - * @s.tagattribute required="false" - */ - public void setMaxLength(String maxlength) { - this.maxlength = maxlength; - } - - /** - * Whether the input is readonly - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setReadonly(String readonly) { - this.readonly = readonly; - } - - /** - * HTML size attribute - * @s.tagattribute required="false" type="Integer" - */ - public void setSize(String size) { - this.size = size; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java b/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java deleted file mode 100644 index edc995bfb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java +++ /dev/null @@ -1,153 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Renders timepicker element.

    - * Format supported by this component are:- - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    FormatDescription
    #HHDisplay hour in two digit format
    #HTry to display hour in one digit format, if cannot use 2 digits
    #hhDisplay hour in two digit format
    #hTry to display hour in one digit format, if cannot use 2 digits
    #mmDisplay minutes in 2 digits format
    #mTry to display minutes in 2 digits fomrat, if cannot use 2 digits
    - * - * - * - * - *
    - * 
    - * 
    - * <s:timepicker label="Show Time" name="showTime" value="05:00" format="#hh:#mm" />
    - * 
    - * <s:timepicker label="Dinner Time" name="dinnerTime" format="#hh-#mm" />
    - * 
    - * 
    - * 
    - * - * @version $Date$ $Id$ - */ -public class TimePicker extends TextField { - - final public static String TEMPLATE = "timepicker"; - - protected String format; - protected String templatePath; - protected String templateCssPath; - protected String timeIconPath; - protected String size; - - public TimePicker(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (format != null) { - addParameter("format", findString(format)); - } - if (timeIconPath != null) { - addParameter("timeIconPath", timeIconPath); - } - if (templatePath != null) { - addParameter("templatePath", templatePath); - } - if (templateCssPath != null) { - addParameter("templateCssPath", templateCssPath); - } - if (size != null) { - addParameter("size", findValue(size, Integer.class)); - } - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - /** - * The format to use for time field. - * @s.tagattribute required="false" type="String" default="Dateformat specified by language preset (%Y/%m/%d for en)" - */ - public void setFormat(String format) { - this.format = format; - } - - /** - * The time picker icon path - * @s.tagattribute required="false" type="String" default="/struts/dojo/struts/widgets/dateIcon.gif" - */ - public void setTimeIconPath(String timeIconPath) { - this.timeIconPath = timeIconPath; - } - - /** - * The time picker template path. - * @s.tagattribute required="false" type="String" - */ - public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; - } - - /** - * The time picker template css path. - * @s.tagattribute required="false" type="String" - */ - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } - - /** - * The time picker text field size. - * @s.tagattribute required="false" type="String" - */ - public void setSize(String size) { - this.size = size; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Token.java b/trunk/core/src/main/java/org/apache/struts2/components/Token.java deleted file mode 100644 index 1b33f6ed9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Token.java +++ /dev/null @@ -1,116 +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 java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.util.TokenHelper; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * Stop double-submission of forms.

    - * - * The token tag is used to help with the "double click" submission problem. It is needed if you are using the - * TokenInterceptor or the TokenSessionInterceptor. The s:token tag merely places a hidden element that contains - * the unique token.

    - * - * - *

    Examples - * - *

    - * 
    - * <s:token />
    - * 
    - * 
    - * - * @see org.apache.struts2.interceptor.TokenInterceptor - * @see org.apache.struts2.interceptor.TokenSessionStoreInterceptor - * - * @s.tag name="token" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TokenTag" - * description="Stop double-submission of forms" - */ -public class Token extends UIBean { - - public static final String TEMPLATE = "token"; - - public Token(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - /** - * First looks for the token in the PageContext using the supplied name (or {@link org.apache.struts2.util.TokenHelper#DEFAULT_TOKEN_NAME} - * if no name is provided) so that the same token can be re-used for the scope of a request for the same name. If - * the token is not in the PageContext, a new Token is created and set into the Session and the PageContext with - * the name. - */ - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - String tokenName; - Map parameters = getParameters(); - - if (parameters.containsKey("name")) { - tokenName = (String) parameters.get("name"); - } else { - if (name == null) { - tokenName = TokenHelper.DEFAULT_TOKEN_NAME; - } else { - tokenName = findString(name); - - if (tokenName == null) { - tokenName = name; - } - } - - addParameter("name", tokenName); - } - - String token = buildToken(tokenName); - addParameter("token", token); - addParameter("tokenNameField", TokenHelper.TOKEN_NAME_FIELD); - } - - /** - * This will be removed in a future version of Struts. - * @deprecated Templates should use $parameters from now on, not $tag. - */ - public String getTokenNameField() { - return TokenHelper.TOKEN_NAME_FIELD; - } - - private String buildToken(String name) { - Map context = stack.getContext(); - Object myToken = context.get(name); - - if (myToken == null) { - myToken = TokenHelper.setToken(name); - context.put(name, myToken); - } - - return myToken.toString(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/Tree.java b/trunk/core/src/main/java/org/apache/struts2/components/Tree.java deleted file mode 100644 index e76f16253..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/Tree.java +++ /dev/null @@ -1,498 +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 java.io.Writer; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Renders a tree widget with AJAX support.

    - * - * The id attribute is normally specified, such that it could be looked up using - * javascript if necessary.

    - * - * - * - *

    Examples - * - *

    - * 
    - * 
    - * <-- statically -->
    - * <s:tree id="..." label="...">
    - *    <s:treenode id="..." label="..." />
    - *    <s:treenode id="..." label="...">
    - *        <s:treenode id="..." label="..." />
    - *        <s:treenode id="..." label="..." />
    - *    &;lt;/s:treenode>
    - *    <s:treenode id="..." label="..." />
    - * </s:tree>
    - * 
    - * <-- dynamically -->
    - * <s:tree
    - * 			id="..."
    - *          rootNode="..."
    - *          nodeIdProperty="..."
    - *          nodeTitleProperty="..."
    - *          childCollectionProperty="..." />
    - * 
    - * 
    - * 
    - * - * - * @s.tag name="tree" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TreeTag" - * description="Render a tree widget." - */ -public class Tree extends ClosingUIBean { - - private static final String TEMPLATE = "tree-close"; - private static final String OPEN_TEMPLATE = "tree"; - - private String toggle = "fade"; - private String treeSelectedTopic; - private String treeExpandedTopic; - private String treeCollapsedTopic; - protected String rootNodeAttr; - protected String childCollectionProperty; - protected String nodeTitleProperty; - protected String nodeIdProperty; - private String showRootGrid; - - private String showGrid; - private String blankIconSrc; - private String gridIconSrcL; - private String gridIconSrcV; - private String gridIconSrcP; - private String gridIconSrcC; - private String gridIconSrcX; - private String gridIconSrcY; - private String expandIconSrcPlus; - private String expandIconSrcMinus; - private String iconWidth; - private String iconHeight; - private String toggleDuration; - private String templateCssPath; - - public Tree(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - if (this.label == null) { - if ((rootNodeAttr == null) - || (childCollectionProperty == null) - || (nodeTitleProperty == null) - || (nodeIdProperty == null)) { - fieldError("label","The TreeTag requires either a value for 'label' or ALL of 'rootNode', " + - "'childCollectionProperty', 'nodeTitleProperty', and 'nodeIdProperty'", null); - } - } - return result; - } - - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (toggle != null) { - addParameter("toggle", findString(toggle)); - } - - if (treeSelectedTopic != null) { - addParameter("treeSelectedTopic", findString(treeSelectedTopic)); - } - - if (treeExpandedTopic != null) { - addParameter("treeExpandedTopic", findString(treeExpandedTopic)); - } - - if (treeCollapsedTopic != null) { - addParameter("treeCollapsedTopic", findString(treeCollapsedTopic)); - } - - if (rootNodeAttr != null) { - addParameter("rootNode", findValue(rootNodeAttr)); - } - - if (childCollectionProperty != null) { - addParameter("childCollectionProperty", findString(childCollectionProperty)); - } - - if (nodeTitleProperty != null) { - addParameter("nodeTitleProperty", findString(nodeTitleProperty)); - } - - if (nodeIdProperty != null) { - addParameter("nodeIdProperty", findString(nodeIdProperty)); - } - - if (showRootGrid != null) { - addParameter("showRootGrid", findValue(showRootGrid, Boolean.class)); - } - - - if (showGrid != null) { - addParameter("showGrid", findValue(showGrid, Boolean.class)); - } - - if (blankIconSrc != null) { - addParameter("blankIconSrc", findString(blankIconSrc)); - } - - if (gridIconSrcL != null) { - addParameter("gridIconSrcL", findString(gridIconSrcL)); - } - - if (gridIconSrcV != null) { - addParameter("gridIconSrcV", findString(gridIconSrcV)); - } - - if (gridIconSrcP != null) { - addParameter("gridIconSrcP", findString(gridIconSrcP)); - } - - if (gridIconSrcC != null) { - addParameter("gridIconSrcC", findString(gridIconSrcC)); - } - - if (gridIconSrcX != null) { - addParameter("gridIconSrcX", findString(gridIconSrcX)); - } - - if (gridIconSrcY != null) { - addParameter("gridIconSrcY", findString(gridIconSrcY)); - } - - if (expandIconSrcPlus != null) { - addParameter("expandIconSrcPlus", findString(expandIconSrcPlus)); - } - - if (expandIconSrcMinus != null) { - addParameter("expandIconSrcMinus", findString(expandIconSrcMinus)); - } - - if (iconWidth != null) { - addParameter("iconWidth", findValue(iconWidth, Integer.class)); - } - if (iconHeight != null) { - addParameter("iconHeight", findValue(iconHeight, Integer.class)); - } - if (toggleDuration != null) { - addParameter("toggleDuration", findValue(toggleDuration, Integer.class)); - } - if (templateCssPath != null) { - addParameter("templateCssPath", findString(templateCssPath)); - } - } - - public String getDefaultOpenTemplate() { - return OPEN_TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public String getToggle() { - return toggle; - } - - /** - * The toggle property (either 'explode' or 'fade'). Default is 'fade'. - * @s.tagattribute required="false" - */ - public void setToggle(String toggle) { - this.toggle = toggle; - } - - public String getTreeSelectedTopic() { - return treeSelectedTopic; - } - - /** - * The treeSelectedTopic property. - * @s.tagattribute required="false" - */ - public void setTreeSelectedTopic(String treeSelectedTopic) { - this.treeSelectedTopic = treeSelectedTopic; - } - - public String getTreeExpandedTopic() { - return treeExpandedTopic; - } - - /** - * The treeExpandedTopic property. - * @s.tagattribute required="false" - */ - public void setTreeExpandedTopic(String treeExpandedTopic) { - this.treeExpandedTopic = treeExpandedTopic; - } - - public String getTreeCollapsedTopic() { - return treeCollapsedTopic; - } - - /** - * The treeCollapsedTopic property. - * @s.tagattribute required="false" - */ - public void setTreeCollapsedTopic(String treeCollapsedTopic) { - this.treeCollapsedTopic = treeCollapsedTopic; - } - - public String getRootNode() { - return rootNodeAttr; - } - - /** - * The rootNode property. - * @s.tagattribute required="false" - */ - public void setRootNode(String rootNode) { - this.rootNodeAttr = rootNode; - } - - public String getChildCollectionProperty() { - return childCollectionProperty; - } - - /** - * The childCollectionProperty property. - * @s.tagattribute required="false" - */ - public void setChildCollectionProperty(String childCollectionProperty) { - this.childCollectionProperty = childCollectionProperty; - } - - public String getNodeTitleProperty() { - return nodeTitleProperty; - } - - /** - * The nodeTitleProperty property. - * @s.tagattribute required="false" - */ - public void setNodeTitleProperty(String nodeTitleProperty) { - this.nodeTitleProperty = nodeTitleProperty; - } - - public String getNodeIdProperty() { - return nodeIdProperty; - } - - /** - * The nodeIdProperty property. - * @s.tagattribute required="false" - */ - public void setNodeIdProperty(String nodeIdProperty) { - this.nodeIdProperty = nodeIdProperty; - } - - /** - * The showRootGrid property (default true). - * @s.tagattribute required="false" - */ - public void setShowRootGrid(String showRootGrid) { - this.showRootGrid = showRootGrid; - } - - public String getShowRootGrid() { - return showRootGrid; - } - - public String getBlankIconSrc() { - return blankIconSrc; - } - - /** - * Blank icon image source. - * @s.tagattribute required="false" - */ - public void setBlankIconSrc(String blankIconSrc) { - this.blankIconSrc = blankIconSrc; - } - - public String getExpandIconSrcMinus() { - return expandIconSrcMinus; - } - - /** - * Expand icon (-) image source. - * @s.tagattribute required="false" - */ - public void setExpandIconSrcMinus(String expandIconSrcMinus) { - this.expandIconSrcMinus = expandIconSrcMinus; - } - - public String getExpandIconSrcPlus() { - return expandIconSrcPlus; - } - - /** - * Expand Icon (+) image source. - * @s.tagattribute required="false" - */ - public void setExpandIconSrcPlus(String expandIconSrcPlus) { - this.expandIconSrcPlus = expandIconSrcPlus; - } - - public String getGridIconSrcC() { - return gridIconSrcC; - } - - /** - * Image source for under child item child icons. - * @s.tagattribute required="false" - */ - public void setGridIconSrcC(String gridIconSrcC) { - this.gridIconSrcC = gridIconSrcC; - } - - public String getGridIconSrcL() { - return gridIconSrcL; - } - - - /** - * Image source for last child grid. - * @s.tagattribute required="false" - */ - public void setGridIconSrcL(String gridIconSrcL) { - this.gridIconSrcL = gridIconSrcL; - } - - public String getGridIconSrcP() { - return gridIconSrcP; - } - - /** - * Image source for under parent item child icons. - * @s.tagattribute required="false" - */ - public void setGridIconSrcP(String gridIconSrcP) { - this.gridIconSrcP = gridIconSrcP; - } - - public String getGridIconSrcV() { - return gridIconSrcV; - } - - /** - * Image source for vertical line. - * @s.tagattribute required="false" - */ - public void setGridIconSrcV(String gridIconSrcV) { - this.gridIconSrcV = gridIconSrcV; - } - - public String getGridIconSrcX() { - return gridIconSrcX; - } - - /** - * Image source for grid for sole root item. - * @s.tagattribute required="false" - */ - public void setGridIconSrcX(String gridIconSrcX) { - this.gridIconSrcX = gridIconSrcX; - } - - public String getGridIconSrcY() { - return gridIconSrcY; - } - - /** - * Image source for grid for last root item. - * @s.tagattribute required="false" - */ - public void setGridIconSrcY(String gridIconSrcY) { - this.gridIconSrcY = gridIconSrcY; - } - - public String getIconHeight() { - return iconHeight; - } - - - /** - * Icon height (default 18 pixels). - * @s.tagattribute required="false" - */ - public void setIconHeight(String iconHeight) { - this.iconHeight = iconHeight; - } - - public String getIconWidth() { - return iconWidth; - } - - /** - * Icon width (default 19 pixels). - * @s.tagattribute required="false" - */ - public void setIconWidth(String iconWidth) { - this.iconWidth = iconWidth; - } - - - - public String getTemplateCssPath() { - return templateCssPath; - } - - /** - * Template css path (default {contextPath}/struts/tree.css. - * @s.tagattribute required="false" - */ - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } - - public String getToggleDuration() { - return toggleDuration; - } - - /** - * Toggle duration (default 150 ms) - * @s.tagattribute required="false" - */ - public void setToggleDuration(String toggleDuration) { - this.toggleDuration = toggleDuration; - } - - public String getShowGrid() { - return showGrid; - } - - /** - * Show grid (default true). - * @s.tagattribute required="false" - */ - public void setShowGrid(String showGrid) { - this.showGrid = showGrid; - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/components/TreeNode.java b/trunk/core/src/main/java/org/apache/struts2/components/TreeNode.java deleted file mode 100644 index a4ad9bca7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/TreeNode.java +++ /dev/null @@ -1,102 +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 com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Renders a tree node within a tree widget with AJAX support.

    - * - * Either of the following combinations should be used depending on if the tree - * is to be constrcted dynamically or statically.

    - * - * Dynamically - *

      - *
    • id - id of this tree node
    • - *
    • title - label to be displayed for this tree node
    • - *
    - * - * Statically - *
      - *
    • rootNode - the parent node of which this tree is derived from
    • - *
    • nodeIdProperty - property to obtained this current tree node's id
    • - *
    • nodeTitleProperty - property to obtained this current tree node's title
    • - *
    • childCollectionProperty - property that returnds this current tree node's children
    • - *
    - * - * - * - *

    Examples - * - *

    - * 
    - * 
    - * <-- statically -->
    - * <s:tree id="..." label="...">
    - *    <s:treenode id="..." label="..." />
    - *    <s:treenode id="..." label="...">
    - *        <s:treenode id="..." label="..." />
    - *        <s:treenode id="..." label="..." />
    - *    &;lt;/s:treenode>
    - *    <s:treenode id="..." label="..." />
    - * </s:tree>
    - * 
    - * <-- dynamically -->
    - * <s:tree
    - *          id="..."
    - *          rootNode="..."
    - *          nodeIdProperty="..."
    - *          nodeTitleProperty="..."
    - *          childCollectionProperty="..." />
    - * 
    - * 
    - * 
    - * - * - * @s.tag name="treenode" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TreeNodeTag" - * description="Render a tree node within a tree widget." - */ -public class TreeNode extends ClosingUIBean { - private static final String TEMPLATE = "treenode-close"; - private static final String OPEN_TEMPLATE = "treenode"; - - public TreeNode(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public String getDefaultOpenTemplate() { - return OPEN_TEMPLATE; - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - /** - * Label expression used for rendering tree node label. - * @s.tagattribute required="true" - */ - public void setLabel(String label) { - super.setLabel(label); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java b/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java deleted file mode 100644 index 1e34ed3e7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java +++ /dev/null @@ -1,1090 +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 java.io.Writer; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.components.template.Template; -import org.apache.struts2.components.template.TemplateEngine; -import org.apache.struts2.components.template.TemplateEngineManager; -import org.apache.struts2.components.template.TemplateRenderingContext; -import org.apache.struts2.config.Settings; -import org.apache.struts2.views.util.ContextUtil; - -import com.opensymphony.xwork2.config.ConfigurationException; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * UIBean is the standard superclass of all Struts UI componentns. - * It defines common Struts and html properties all UI components should present for usage. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    AttributeThemeData TypesDescription
    templateDirn/aStringdefine the template directory
    themen/aStringdefine the theme name
    templaten/aStringdefine the template name
    - * - * - * - *

    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    AttributeThemeData TypesDescription
    cssClasssimpleStringdefine html class attribute
    cssStylesimpleStringdefine html style attribute
    titlesimpleStringdefine html title attribute
    disabledsimpleStringdefine html disabled attribute
    labelxhtmlStringdefine label of form element
    labelPositionxhtmlStringdefine label position of form element (top/left), default to left
    requiredpositionxhtmlStringdefine required label position of form element (left/right), default to right
    namesimpleStringForm Element's field name mapping
    requiredxhtmlBooleanadd * to label (true to add false otherwise)
    tabIndexsimpleStringdefine html tabindex attribute
    valuesimpleObjectdefine value of form element
    - * - * - * - *

    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    AttributeThemeData TypesDescription
    onclicksimpleStringhtml javascript onclick attribute
    ondbclicksimpleStringhtml javascript ondbclick attribute
    onmousedownsimpleStringhtml javascript onmousedown attribute
    onmouseupsimpleStringhtml javascript onmouseup attribute
    onmouseoversimpleStringhtml javascript onmouseover attribute
    onmouseoutsimpleStringhtml javascript onmouseout attribute
    onfocussimpleStringhtml javascript onfocus attribute
    onblursimpleStringhtml javascript onblur attribute
    onkeypresssimpleStringhtml javascript onkeypress attribute
    onkeyupsimpleStringhtml javascript onkeyup attribute
    onkeydownsimpleStringhtml javascript onkeydown attribute
    onselectsimpleStringhtml javascript onselect attribute
    onchangesimpleStringhtml javascript onchange attribute
    - * - * - * - *

    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    AttributeData TypeDefaultDescription
    tooltipStringnoneSet the tooltip of this particular component
    jsTooltipEnabledStringfalseEnable js tooltip rendering
    tooltipIconString/struts/static/tooltip/tooltip.gifThe url to the tooltip icon
    tooltipDelayString500Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips.
    - * - * - * - * - * - * - * Every Form UI component (in xhtml / css_xhtml or any others that extends of them) could - * have tooltip assigned to a them. The Form component's tooltip related attribute once - * defined will be applicable to all form UI component that is created under it unless - * explicitly overriden by having the Form UI component itself defined that tooltip attribute. - * - *

    - * - * In Example 1, the textfield will inherit the tooltipDelay adn tooltipIcon attribte from - * its containing form. In other words, although it doesn't defined a tooltipAboveMousePointer - * attribute, it will have that attributes inherited from its containing form. - * - *

    - * - * In Example 2, the the textfield will inherite both the tooltipDelay and - * tooltipIcon attribute from its containing form but tooltipDelay - * attribute is overriden at the textfield itself. Hence, the textfield actually will - * have tooltipIcon defined as /myImages/myIcon.gif, inherited from its containing form and - * tooltipDelay defined as 5000, due to overriden at the textfield itself. - * - *

    - * - * Example 3, 4 and 5 shows different way of setting the tooltipConfig attribute.
    - * Example 3:Set tooltip config through body of param tag
    - * Example 4:Set tooltip config through value attribute of param tag
    - * Example 5:Set tooltip config through tooltipConfig attribute of component tag
    - * - * - * - * - *

    - * 
    - *
    - * <!-- Example 1: -->
    - * <s:form
    - * 			tooltipConfig="#{'tooltipDelay':'500',
    - *                           'tooltipIcon='/myImages/myIcon.gif'}" .... >
    - *   ....
    - *     <s:textfield label="Customer Name" tooltip="Enter the customer name" .... />
    - *   ....
    - * </s:form>
    - *
    - * <!-- Example 2: -->
    - * <s:form
    - *         tooltipConfig="#{'tooltipDelay':'500',
    - *          				'tooltipIcon':'/myImages/myIcon.gif'}" ... >
    - *   ....
    - *     <s:textfield label="Address"
    - *          tooltip="Enter your address"
    - *          tooltipConfig="#{'tooltipDelay':'5000'}" />
    - *   ....
    - * </s:form>
    - *
    - *
    - * <-- Example 3: -->
    - * <s:textfield
    - *        label="Customer Name"
    - *	      tooltip="One of our customer Details'">
    - *        <s:param name="tooltipConfig">
    - *             tooltipDelay = 500 |
    - *             tooltipIcon = /myImages/myIcon.gif 
    - *        </s:param>
    - * </s:textfield>
    - *
    - *
    - * <-- Example 4: -->
    - * <s:textfield
    - *	        label="Customer Address"
    - *	        tooltip="Enter The Customer Address" >
    - *	        <s:param
    - *              name="tooltipConfig"
    - *              value="#{'tooltipDelay':'500',
    - *                       'tooltipIcon':'/myImages/myIcon.gif'}" />
    - * </s:textfield>
    - *
    - *
    - * <-- Example 5: -->
    - * <s:textfield
    - *          label="Customer Telephone Number"
    - *          tooltip="Enter customer Telephone Number"
    - *          tooltipConfig="#{'tooltipDelay':'500',
    - *                           'tooltipIcon':'/myImages/myIcon.gif'}" />
    - *
    - * 
    - * 
    - * - */ -public abstract class UIBean extends Component { - private static final Log LOG = LogFactory.getLog(UIBean.class); - - protected HttpServletRequest request; - protected HttpServletResponse response; - - public UIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack); - this.request = request; - this.response = response; - this.templateSuffix = ContextUtil.getTemplateSuffix(stack.getContext()); - } - - // The templateSuffic to use, overrides the default one if not null. - protected String templateSuffix; - - // The template to use, overrides the default one. - protected String template; - - // templateDir and theme attributes - protected String templateDir; - protected String theme; - - protected String cssClass; - protected String cssStyle; - protected String disabled; - protected String label; - protected String labelPosition; - protected String requiredposition; - protected String name; - protected String required; - protected String tabindex; - protected String value; - protected String title; - - // HTML scripting events attributes - protected String onclick; - protected String ondblclick; - protected String onmousedown; - protected String onmouseup; - protected String onmouseover; - protected String onmousemove; - protected String onmouseout; - protected String onfocus; - protected String onblur; - protected String onkeypress; - protected String onkeydown; - protected String onkeyup; - protected String onselect; - protected String onchange; - - // common html attributes - protected String accesskey; - - // javascript tooltip attribute - protected String tooltip; - protected String tooltipConfig; - - - public boolean end(Writer writer, String body) { - evaluateParams(); - try { - super.end(writer, body, false); - mergeTemplate(writer, buildTemplateName(template, getDefaultTemplate())); - } catch (Exception e) { - LOG.error("error when rendering", e); - } - finally { - popComponentStack(); - } - - return false; - } - - /** - * A contract that requires each concrete UI Tag to specify which template should be used as a default. For - * example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value - * not begin with a '/' unless you intend to make the path absolute rather than relative to the - * current theme. - * - * @return The name of the template to be used as the default. - */ - protected abstract String getDefaultTemplate(); - - protected Template buildTemplateName(String myTemplate, String myDefaultTemplate) { - String template = myDefaultTemplate; - - if (myTemplate != null) { - template = findString(myTemplate); - } - - String templateDir = getTemplateDir(); - String theme = getTheme(); - - return new Template(templateDir, theme, template); - - } - - protected void mergeTemplate(Writer writer, Template template) throws Exception { - final TemplateEngine engine = TemplateEngineManager.getTemplateEngine(template, templateSuffix); - if (engine == null) { - throw new ConfigurationException("Unable to find a TemplateEngine for template " + template); - } - - if (LOG.isDebugEnabled()) { - LOG.debug("Rendering template " + template); - } - - final TemplateRenderingContext context = new TemplateRenderingContext(template, writer, getStack(), getParameters(), this); - engine.renderTemplate(context); - } - - public String getTemplateDir() { - String templateDir = null; - - if (this.templateDir != null) { - templateDir = findString(this.templateDir); - } - - // If templateDir is not explicitly given, - // try to find attribute which states the dir set to use - if ((templateDir == null) || (templateDir.equals(""))) { - templateDir = (String) stack.findValue("#attr.templateDir"); - } - - // Default template set - if ((templateDir == null) || (templateDir.equals(""))) { - templateDir = Settings.get(StrutsConstants.STRUTS_UI_TEMPLATEDIR); - } - - // Defaults to 'template' - if ((templateDir == null) || (templateDir.equals(""))) { - templateDir = "template"; - } - - return templateDir; - } - - public String getTheme() { - String theme = null; - - if (this.theme != null) { - theme = findString(this.theme); - } - - if ( theme == null || theme.equals("") ) { - Form form = (Form) findAncestor(Form.class); - if (form != null) { - theme = form.getTheme(); - } - } - - // If theme set is not explicitly given, - // try to find attribute which states the theme set to use - if ((theme == null) || (theme.equals(""))) { - theme = (String) stack.findValue("#attr.theme"); - } - - // Default theme set - if ((theme == null) || (theme.equals(""))) { - theme = Settings.get(StrutsConstants.STRUTS_UI_THEME); - } - - return theme; - } - - public void evaluateParams() { - addParameter("templateDir", getTemplateDir()); - addParameter("theme", getTheme()); - - String name = null; - - if (this.name != null) { - name = findString(this.name); - addParameter("name", name); - } - - if (label != null) { - addParameter("label", findString(label)); - } - - if (labelPosition != null) { - addParameter("labelposition", findString(labelPosition)); - } - - if (requiredposition != null) { - addParameter("requiredposition", findString(requiredposition)); - } - - if (required != null) { - addParameter("required", findValue(required, Boolean.class)); - } - - if (disabled != null) { - addParameter("disabled", findValue(disabled, Boolean.class)); - } - - if (tabindex != null) { - addParameter("tabindex", findString(tabindex)); - } - - if (onclick != null) { - addParameter("onclick", findString(onclick)); - } - - if (ondblclick != null) { - addParameter("ondblclick", findString(ondblclick)); - } - - if (onmousedown != null) { - addParameter("onmousedown", findString(onmousedown)); - } - - if (onmouseup != null) { - addParameter("onmouseup", findString(onmouseup)); - } - - if (onmouseover != null) { - addParameter("onmouseover", findString(onmouseover)); - } - - if (onmousemove != null) { - addParameter("onmousemove", findString(onmousemove)); - } - - if (onmouseout != null) { - addParameter("onmouseout", findString(onmouseout)); - } - - if (onfocus != null) { - addParameter("onfocus", findString(onfocus)); - } - - if (onblur != null) { - addParameter("onblur", findString(onblur)); - } - - if (onkeypress != null) { - addParameter("onkeypress", findString(onkeypress)); - } - - if (onkeydown != null) { - addParameter("onkeydown", findString(onkeydown)); - } - - if (onkeyup != null) { - addParameter("onkeyup", findString(onkeyup)); - } - - if (onselect != null) { - addParameter("onselect", findString(onselect)); - } - - if (onchange != null) { - addParameter("onchange", findString(onchange)); - } - - if (accesskey != null) { - addParameter("accesskey", findString(accesskey)); - } - - if (cssClass != null) { - addParameter("cssClass", findString(cssClass)); - } - - if (cssStyle != null) { - addParameter("cssStyle", findString(cssStyle)); - } - - if (title != null) { - addParameter("title", findString(title)); - } - - - // see if the value was specified as a parameter already - if (parameters.containsKey("value")) { - parameters.put("nameValue", parameters.get("value")); - } else { - if (evaluateNameValue()) { - final Class valueClazz = getValueClassType(); - - if (valueClazz != null) { - if (value != null) { - addParameter("nameValue", findValue(value, valueClazz)); - } else if (name != null) { - String expr = name; - if (altSyntax()) { - expr = "%{" + expr + "}"; - } - - addParameter("nameValue", findValue(expr, valueClazz)); - } - } else { - if (value != null) { - addParameter("nameValue", findValue(value)); - } else if (name != null) { - addParameter("nameValue", findValue(name)); - } - } - } - } - - final Form form = (Form) findAncestor(Form.class); - - // create HTML id element - populateComponentHtmlId(form); - - if (form != null ) { - addParameter("form", form.getParameters()); - - if ( name != null ) { - // list should have been created by the form component - List tags = (List) form.getParameters().get("tagNames"); - tags.add(name); - } - } - - - - - - // tooltip & tooltipConfig - if (tooltipConfig != null) { - addParameter("tooltipConfig", findValue(tooltipConfig)); - } - if (tooltip != null) { - addParameter("tooltip", findString(tooltip)); - - Map tooltipConfigMap = getTooltipConfig(this); - - if (form != null) { // inform the containing form that we need tooltip javascript included - form.addParameter("hasTooltip", Boolean.TRUE); - - // tooltipConfig defined in component itseilf will take precedence - // over those defined in the containing form - Map overallTooltipConfigMap = getTooltipConfig(form); - overallTooltipConfigMap.putAll(tooltipConfigMap); // override parent form's tooltip config - - for (Iterator i = overallTooltipConfigMap.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry) i.next(); - addParameter((String) entry.getKey(), entry.getValue()); - } - } - else { - LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work "); - } - } - evaluateExtraParams(); - - } - - protected String escape(String name) { - // escape any possible values that can make the ID painful to work with in JavaScript - if (name != null) { - return name.replaceAll("[\\.\\[\\]]", "_"); - } else { - return ""; - } - } - - protected void evaluateExtraParams() { - } - - protected boolean evaluateNameValue() { - return true; - } - - protected Class getValueClassType() { - return String.class; - } - - public void addFormParameter(String key, Object value) { - Form form = (Form) findAncestor(Form.class); - if (form != null) { - form.addParameter(key, value); - } - } - - protected void enableAncestorFormCustomOnsubmit() { - Form form = (Form) findAncestor(Form.class); - if (form != null) { - form.addParameter("customOnsubmitEnabled", Boolean.TRUE); - } else { - LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled"); - } - } - - protected Map getTooltipConfig(UIBean component) { - Object tooltipConfigObj = component.getParameters().get("tooltipConfig"); - Map tooltipConfig = new LinkedHashMap(); - - if (tooltipConfigObj instanceof Map) { - // we get this if its configured using - // 1] UI component's tooltipConfig attribute OR - // 2] param tag value attribute - - tooltipConfig = new LinkedHashMap((Map)tooltipConfigObj); - } else if (tooltipConfigObj instanceof String) { - - // we get this if its configured using - // ... tag's body - String tooltipConfigStr = (String) tooltipConfigObj; - String[] tooltipConfigArray = tooltipConfigStr.split("\\|"); - - for (int a=0; a 1) { - value = configEntry[1].trim(); - tooltipConfig.put(key, value.toString()); - } - else { - LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped"); - } - } - } - return tooltipConfig; - } - - /** - * Create HTML id element for the component and populate this component parmaeter - * map. - * - * The order is as follows :- - *
      - *
    1. This component id attribute
    2. - *
    3. [containing_form_id]_[this_component_name]
    4. - *
    5. [this_component_name]
    6. - *
    - * - * @param form - */ - protected void populateComponentHtmlId(Form form) { - if (id != null) { - // this check is needed for backwards compatibility with 2.1.x - if (altSyntax()) { - addParameter("id", findString(id)); - } else { - addParameter("id", id); - } - } else if (form != null) { - addParameter("id", form.getParameters().get("id") + "_" + escape(name)); - } else { - addParameter("id", escape(name)); - } - } - - - /** - * The template directory. - * @s.tagattribute required="false" - */ - public void setTemplateDir(String templateDir) { - this.templateDir = templateDir; - } - - /** - * The theme (other than default) to use for rendering the element - * @s.tagattribute required="false" - */ - public void setTheme(String theme) { - this.theme = theme; - } - - public String getTemplate() { - return template; - } - - /** - * The template (other than default) to use for rendering the element - * @s.tagattribute required="false" - */ - public void setTemplate(String template) { - this.template = template; - } - - /** - * The css class to use for element - * @s.tagattribute required="false" - */ - public void setCssClass(String cssClass) { - this.cssClass = cssClass; - } - - /** - * The css style definitions for element ro use - * @s.tagattribute required="false" - */ - public void setCssStyle(String cssStyle) { - this.cssStyle = cssStyle; - } - - /** - * Set the html title attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Set the html disabled attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setDisabled(String disabled) { - this.disabled = disabled; - } - - /** - * Label expression used for rendering a element specific label - * @s.tagattribute required="false" - */ - public void setLabel(String label) { - this.label = label; - } - - /** - * define label position of form element (top/left) - * @s.tagattribute required="false" - */ - public void setLabelposition(String labelPosition) { - this.labelPosition = labelPosition; - } - - /** - * define required position of required form element (left|right) - * @s.tagattribute required="false" - */ - public void setRequiredposition(String requiredposition) { - this.requiredposition = requiredposition; - } - - /** - * The name to set for element - * @s.tagattribute required="false" - */ - public void setName(String name) { - this.name = name; - } - - /** - * If set to true, the rendered element will indicate that input is required - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setRequired(String required) { - this.required = required; - } - - /** - * Set the html tabindex attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setTabindex(String tabindex) { - this.tabindex = tabindex; - } - - /** - * Preset the value of input element. - * @s.tagattribute required="false" - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Set the html onclick attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnclick(String onclick) { - this.onclick = onclick; - } - - /** - * Set the html ondblclick attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOndblclick(String ondblclick) { - this.ondblclick = ondblclick; - } - - /** - * Set the html onmousedown attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnmousedown(String onmousedown) { - this.onmousedown = onmousedown; - } - - /** - * Set the html onmouseup attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnmouseup(String onmouseup) { - this.onmouseup = onmouseup; - } - - /** - * Set the html onmouseover attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnmouseover(String onmouseover) { - this.onmouseover = onmouseover; - } - - /** - * Set the html onmousemove attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnmousemove(String onmousemove) { - this.onmousemove = onmousemove; - } - - /** - * Set the html onmouseout attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnmouseout(String onmouseout) { - this.onmouseout = onmouseout; - } - - /** - * Set the html onfocus attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnfocus(String onfocus) { - this.onfocus = onfocus; - } - - /** - * Set the html onblur attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnblur(String onblur) { - this.onblur = onblur; - } - - /** - * Set the html onkeypress attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnkeypress(String onkeypress) { - this.onkeypress = onkeypress; - } - - /** - * Set the html onkeydown attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnkeydown(String onkeydown) { - this.onkeydown = onkeydown; - } - - /** - * Set the html onkeyup attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnkeyup(String onkeyup) { - this.onkeyup = onkeyup; - } - - /** - * Set the html onselect attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnselect(String onselect) { - this.onselect = onselect; - } - - /** - * Set the html onchange attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setOnchange(String onchange) { - this.onchange = onchange; - } - - /** - * Set the html accesskey attribute on rendered html element - * @s.tagattribute required="false" - */ - public void setAccesskey(String accesskey) { - this.accesskey = accesskey; - } - - /** - * Set the tooltip of this particular component - * @s.tagattribute required="false" type="String" default="" - */ - public void setTooltip(String tooltip) { - this.tooltip = tooltip; - } - - /** - * Set the tooltip configuration - * @s.tagattribute required="false" type="String" default="" - */ - public void setTooltipConfig(String tooltipConfig) { - this.tooltipConfig = tooltipConfig; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/URL.java b/trunk/core/src/main/java/org/apache/struts2/components/URL.java deleted file mode 100644 index 7a2e67b47..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/URL.java +++ /dev/null @@ -1,414 +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 java.io.IOException; -import java.io.Writer; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsException; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.portlet.context.PortletActionContext; -import org.apache.struts2.portlet.util.PortletUrlHelper; -import org.apache.struts2.views.util.UrlHelper; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.XWorkContinuationConfig; - -/** - * - * - *

    This tag is used to create a URL.

    - * - *

    You can use the "param" tag inside the body to provide - * additional request parameters.

    - * - * NOTE: - *

    When includeParams is 'all' or 'get', the parameter defined in param tag will take - * precedence and will not be overriden if they exists in the parameter submitted. For - * example, in Example 3 below, if there is a id parameter in the url where the page this - * tag is included like http://://editUser.action?id=3333&name=John - * the generated url will be http://:/context>/editUser.action?id=22&name=John - * cause the parameter defined in the param tag will take precedence.

    - * - * - * - * - * - * - *
      - *
    • action (String) - (value or action choose either one, if both exist value takes precedence) action's name (alias)
    • - *
    • value (String) - (value or action choose either one, if both exist value takes precedence) the url itself
    • - *
    • scheme (String) - http scheme (http, https) default to the scheme this request is in
    • - *
    • namespace - action's namespace
    • - *
    • method (String) - action's method, default to execute()
    • - *
    • encode (Boolean) - url encode the generated url. Default is true
    • - *
    • includeParams (String) - The includeParams attribute may have the value 'none', 'get' or 'all'. Default is 'get'. - * none - include no parameters in the URL - * get - include only GET parameters in the URL (default) - * all - include both GET and POST parameters in the URL - *
    • - *
    • includeContext (Boolean) - determine wheather to include the web app context path. Default is true.
    • - *
    - * - * - * - *

    Examples - *

    - * 
    - * 
    - * <-- Example 1 -->
    - * <s:url value="editGadget.action">
    - *     <s:param name="id" value="%{selected}" />
    - * </s:url>
    - *
    - * <-- Example 2 -->
    - * <s:url action="editGadget">
    - *     <s:param name="id" value="%{selected}" />
    - * </s:url>
    - * 
    - * <-- Example 3-->
    - * <s:url includeParams="get"  >
    - *     <:param name="id" value="%{'22'}" />
    - * </s:url>
    - * 
    - * 
    - * 
    - * - * @see Param - * - * @s.tag name="url" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.URLTag" - * description="This tag is used to create a URL" - */ -public class URL extends Component { - private static final Log LOG = LogFactory.getLog(URL.class); - - /** - * The includeParams attribute may have the value 'none', 'get' or 'all'. - * It is used when the url tag is used without a value attribute. - * Its value is looked up on the ValueStack - * If no includeParams is specified then 'get' is used. - * none - include no parameters in the URL - * get - include only GET parameters in the URL (default) - * all - include both GET and POST parameters in the URL - */ - public static final String NONE = "none"; - public static final String GET = "get"; - public static final String ALL = "all"; - - private HttpServletRequest req; - private HttpServletResponse res; - - protected String includeParams; - protected String scheme; - protected String value; - protected String action; - protected String namespace; - protected String method; - protected boolean encode = true; - protected boolean includeContext = true; - protected String portletMode; - protected String windowState; - protected String portletUrlType; - protected String anchor; - - public URL(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack); - this.req = req; - this.res = res; - } - - public boolean start(Writer writer) { - boolean result = super.start(writer); - - if (value != null) { - value = findString(value); - } - - // no explicit url set so attach params from current url, do - // this at start so body params can override any of these they wish. - try { - // ww-1266 - String includeParams = - Settings.isSet(StrutsConstants.STRUTS_URL_INCLUDEPARAMS) ? - Settings.get(StrutsConstants.STRUTS_URL_INCLUDEPARAMS).toLowerCase() : GET; - - - if (this.includeParams != null) { - includeParams = findString(this.includeParams); - } - - if (NONE.equalsIgnoreCase(includeParams)) { - mergeRequestParameters(value, parameters, Collections.EMPTY_MAP); - ActionContext.getContext().put(XWorkContinuationConfig.CONTINUE_KEY, null); - } else if (ALL.equalsIgnoreCase(includeParams)) { - mergeRequestParameters(value, parameters, req.getParameterMap()); - - // for ALL also include GET parameters - includeGetParameters(); - } else if (GET.equalsIgnoreCase(includeParams) || (includeParams == null && value == null && action == null)) { - includeGetParameters(); - } else if (includeParams != null) { - LOG.warn("Unknown value for includeParams parameter to URL tag: " + includeParams); - } - } catch (Exception e) { - LOG.warn("Unable to put request parameters (" + req.getQueryString() + ") into parameter map.", e); - } - - - return result; - } - - private void includeGetParameters() { - if(!(Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest())) { - String query = extractQueryString(); - mergeRequestParameters(value, parameters, UrlHelper.parseQueryString(query)); - } - } - - private String extractQueryString() { - // Parse the query string to make sure that the parameters come from the query, and not some posted data - String query = req.getQueryString(); - - if (query != null) { - // Remove possible #foobar suffix - int idx = query.lastIndexOf('#'); - - if (idx != -1) { - query = query.substring(0, idx); - } - } - return query; - } - - public boolean end(Writer writer, String body) { - String scheme = req.getScheme(); - - if (this.scheme != null) { - scheme = this.scheme; - } - - String result; - if (value == null && action != null) { - if(Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) { - result = PortletUrlHelper.buildUrl(action, namespace, parameters, portletUrlType, portletMode, windowState); - } - else { - result = determineActionURL(action, namespace, method, req, res, parameters, scheme, includeContext, encode); - } - } else { - if(Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) { - result = PortletUrlHelper.buildResourceUrl(value, parameters); - } - else { - String _value = value; - - // We don't include the request parameters cause they would have been - // prioritised before this [in start(Writer) method] - if (_value != null && _value.indexOf("?") > 0) { - _value = _value.substring(0, _value.indexOf("?")); - } - result = UrlHelper.buildUrl(_value, req, res, parameters, scheme, includeContext, encode); - } - } - if ( anchor != null && anchor.length() > 0 ) { - result += '#' + anchor; - } - - String id = getId(); - - if (id != null) { - getStack().getContext().put(id, result); - - // add to the request and page scopes as well - req.setAttribute(id, result); - } else { - try { - writer.write(result); - } catch (IOException e) { - throw new StrutsException("IOError: " + e.getMessage(), e); - } - } - return super.end(writer, body); - } - - /** - * The includeParams attribute may have the value 'none', 'get' or 'all'. - * @s.tagattribute required="false" default="get" - */ - public void setIncludeParams(String includeParams) { - this.includeParams = includeParams; - } - - /** - * Set scheme attribute - * @s.tagattribute required="false" - */ - public void setScheme(String scheme) { - this.scheme = scheme; - } - - /** - * The target value to use, if not using action - * @s.tagattribute required="false" - */ - public void setValue(String value) { - this.value = value; - } - - /** - * The action generate url for, if not using value - * @s.tagattribute required="false" - */ - public void setAction(String action) { - this.action = action; - } - - /** - * The namespace to use - * @s.tagattribute required="false" - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * The method of action to use - * @s.tagattribute required="false" - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * whether to encode parameters - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setEncode(boolean encode) { - this.encode = encode; - } - - /** - * whether actual context should be included in url - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setIncludeContext(boolean includeContext) { - this.includeContext = includeContext; - } - - /** - * The resulting portlet mode - * @s.tagattribute required="false" - */ - public void setPortletMode(String portletMode) { - this.portletMode = portletMode; - } - - /** - * The resulting portlet window state - * @s.tagattribute required="false" - */ - public void setWindowState(String windowState) { - this.windowState = windowState; - } - - /** - * Specifies if this should be a portlet render or action url - * @s.tagattribute required="false" - */ - public void setPortletUrlType(String portletUrlType) { - this.portletUrlType = portletUrlType; - } - - /** - * The anchor for this URL - * @s.tagattribute required="false" - */ - public void setAnchor(String anchor) { - this.anchor = anchor; - } - - - /** - * Merge request parameters into current parameters. If a parameter is - * already present, than the request parameter in the current request and value atrribute - * will not override its value. - * - * The priority is as follows:- - *
      - *
    • parameter from the current request (least priority)
    • - *
    • parameter form the value attribute (more priority)
    • - *
    • parameter from the param tag (most priority)
    • - *
    - * - * @param value the value attribute (url to be generated by this component) - * @param parameters component parameters - * @param contextParameters request parameters - */ - protected void mergeRequestParameters(String value, Map parameters, Map contextParameters){ - - Map mergedParams = new LinkedHashMap(contextParameters); - - // Merge contextParameters (from current request) with parameters specified in value attribute - // eg. value="someAction.action?id=someId&venue=someVenue" - // where the parameters specified in value attribute takes priority. - - if (value != null && value.trim().length() > 0 && value.indexOf("?") > 0) { - mergedParams = new LinkedHashMap(); - - String queryString = value.substring(value.indexOf("?")+1); - - mergedParams = UrlHelper.parseQueryString(queryString); - for (Iterator iterator = contextParameters.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - Object key = entry.getKey(); - - if (!mergedParams.containsKey(key)) { - mergedParams.put(key, entry.getValue()); - } - } - } - - - // Merge parameters specified in value attribute - // eg. value="someAction.action?id=someId&venue=someVenue" - // with parameters specified though param tag - // eg. - // where parameters specified through param tag takes priority. - - for (Iterator iterator = mergedParams.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - Object key = entry.getKey(); - - if (!parameters.containsKey(key)) { - parameters.put(key, entry.getValue()); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java b/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java deleted file mode 100644 index 8ece3cda9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java +++ /dev/null @@ -1,230 +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 java.util.LinkedHashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Create a Select component with buttons to move the elements in the select component - * up and down. When the containing form is submited, its elements will be submitted in - * the order they are arranged (top to bottom). - * - * - * - *

    - * - *

    - * 
    - * 
    - * <!-- Example 1: simple example -->
    - * <s:updownselect
    - * list="#{'england':'England', 'america':'America', 'germany':'Germany'}" 
    - * name="prioritisedFavouriteCountries" 
    - * headerKey="-1" 
    - * headerValue="--- Please Order Them Accordingly ---" 
    - * emptyOption="true" />
    - *
    - * <!-- Example 2: more complex example -->
    - * <s:updownselect
    - * list="defaultFavouriteCartoonCharacters" 
    - * name="prioritisedFavouriteCartoonCharacters" 
    - * headerKey="-1" 
    - * headerValue="--- Please Order ---" 
    - * emptyOption="true" 
    - * allowMoveUp="true" 
    - * allowMoveDown="true" 
    - * allowSelectAll="true" 
    - * moveUpLabel="Move Up"
    - * moveDownLabel="Move Down" 
    - * selectAllLabel="Select All" />
    - * 
    - * 
    - * 
    - * - * @version $Date$ $Id$ - * - * @s.tag name="updownselect" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.UpDownSelectTag" - * description="Render a up down select element" - */ -public class UpDownSelect extends Select { - - private static final Log _log = LogFactory.getLog(UpDownSelect.class); - - - final public static String TEMPLATE = "updownselect"; - - protected String allowMoveUp; - protected String allowMoveDown; - protected String allowSelectAll; - - protected String moveUpLabel; - protected String moveDownLabel; - protected String selectAllLabel; - - - public String getDefaultTemplate() { - return TEMPLATE; - } - - public UpDownSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public void evaluateParams() { - super.evaluateParams(); - - - // override Select's default - if (size == null || size.trim().length() <= 0) { - addParameter("size", "5"); - } - if (multiple == null || multiple.trim().length() <= 0) { - addParameter("multiple", Boolean.TRUE); - } - - - - if (allowMoveUp != null) { - addParameter("allowMoveUp", findValue(allowMoveUp, Boolean.class)); - } - if (allowMoveDown != null) { - addParameter("allowMoveDown", findValue(allowMoveDown, Boolean.class)); - } - if (allowSelectAll != null) { - addParameter("allowSelectAll", findValue(allowSelectAll, Boolean.class)); - } - - if (moveUpLabel != null) { - addParameter("moveUpLabel", findString(moveUpLabel)); - } - if (moveDownLabel != null) { - addParameter("moveDownLabel", findString(moveDownLabel)); - } - if (selectAllLabel != null) { - addParameter("selectAllLabel", findString(selectAllLabel)); - } - - - // inform our form ancestor about this UpDownSelect so the form knows how to - // auto select all options upon it submission - Form ancestorForm = (Form) findAncestor(Form.class); - if (ancestorForm != null) { - - // inform form ancestor that we are using a custom onsubmit - enableAncestorFormCustomOnsubmit(); - - Map m = (Map) ancestorForm.getParameters().get("updownselectIds"); - if (m == null) { - // map with key -> id , value -> headerKey - m = new LinkedHashMap(); - } - m.put(getParameters().get("id"), getParameters().get("headerKey")); - ancestorForm.getParameters().put("updownselectIds", m); - } - else { - _log.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work "); - } - } - - - public String getAllowMoveUp() { - return allowMoveUp; - } - /** - * Whether move up button should be displayed - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setAllowMoveUp(String allowMoveUp) { - this.allowMoveUp = allowMoveUp; - } - - - - public String getAllowMoveDown() { - return allowMoveDown; - } - /** - * Whether move down button should be displayed - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setAllowMoveDown(String allowMoveDown) { - this.allowMoveDown = allowMoveDown; - } - - - - public String getAllowSelectAll() { - return allowSelectAll; - } - /** - * Whether or not select all button should be displayed - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - - public String getMoveUpLabel() { - return moveUpLabel; - } - /** - * Text to display on the move up button - * @s.tagattribute required="false" type="String" default="^" - */ - public void setMoveUpLabel(String moveUpLabel) { - this.moveUpLabel = moveUpLabel; - } - - - - public String getMoveDownLabel() { - return moveDownLabel; - } - /** - * Text to display on the move down button - * @s.tagattribute required="false" type="String" default="v" - */ - public void setMoveDownLabel(String moveDownLabel) { - this.moveDownLabel = moveDownLabel; - } - - - - public String getSelectAllLabel() { - return selectAllLabel; - } - /** - * Text to display on the select all button - * @s.tagattribute required="false" type="String" default="*" - */ - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java b/trunk/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java deleted file mode 100644 index e0fc5cbc9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java +++ /dev/null @@ -1,101 +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.table; - -import java.util.Vector; - -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; - - -/** - */ -abstract public class AbstractFilterModel extends AbstractTableModel { - - protected TableModel model; - - - public AbstractFilterModel(TableModel tm) { - model = tm; - } - - - public boolean isCellEditable(int par1, int par2) { - return model.isCellEditable(par1, par2); - } - - public Class getColumnClass(int par1) { - return model.getColumnClass(par1); - } - - public int getColumnCount() { - return model.getColumnCount(); - } - - public String getColumnName(int par1) { - return model.getColumnName(par1); - } - - public void setModel(TableModel model) { - this.model = model; - this.fireTableDataChanged(); - } - - public TableModel getModel() { - return model; - } - - public int getRowCount() { - return model.getRowCount(); - } - - public void setValueAt(Object par1, int par2, int par3) { - model.setValueAt(par1, par2, par3); - } - - public Object getValueAt(int par1, int par2) { - return model.getValueAt(par1, par2); - } - - public void addRow(Vector data) throws IllegalStateException { - if (model instanceof DefaultTableModel) { - ((DefaultTableModel) model).addRow(data); - } else if (model instanceof AbstractFilterModel) { - ((AbstractFilterModel) model).addRow(data); - } else { - throw (new IllegalStateException("Error attempting to add a row to an underlying model that is not a DefaultTableModel.")); - } - } - - public void removeAllRows() throws ArrayIndexOutOfBoundsException, IllegalStateException { - while (this.getRowCount() > 0) { - this.removeRow(0); - } - } - - public void removeRow(int rowNum) throws ArrayIndexOutOfBoundsException, IllegalStateException { - if (model instanceof DefaultTableModel) { - ((DefaultTableModel) model).removeRow(rowNum); - } else if (model instanceof AbstractFilterModel) { - ((AbstractFilterModel) model).removeRow(rowNum); - } else { - throw (new IllegalStateException("Error attempting to remove a row from an underlying model that is not a DefaultTableModel.")); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java b/trunk/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java deleted file mode 100644 index c9b5469b6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java +++ /dev/null @@ -1,44 +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.table; - -import javax.swing.table.TableModel; - - -/** - */ -public class RenderFilterModel extends AbstractFilterModel { - - private static final long serialVersionUID = -2501708467650344057L; - - private boolean rendered; - - - public RenderFilterModel(TableModel tm) { - super(tm); - } - - - public void setRendered(boolean rendered) { - this.rendered = rendered; - } - - public boolean isRendered() { - return rendered; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java b/trunk/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java deleted file mode 100644 index 235d43cb7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java +++ /dev/null @@ -1,196 +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.table; - -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.Collections; - -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; - - -/** - */ -public class SortFilterModel extends AbstractFilterModel implements TableModelListener, SortableTableModel { - - private static final long serialVersionUID = 2214225803442793597L; - - private ArrayList rows = new ArrayList(); - - /** - * These are just here to implement the interface - */ - private String _sortDirection = NONE; - private boolean dirty = true; - private int sortColumn = -1; - - - public SortFilterModel(TableModel tm) { - super(tm); - setModel(tm); - } - - - public boolean isCellEditable(int r, int c) { - if ((rows.size() > 0) && (r < rows.size())) { - return model.isCellEditable(((Row) rows.get(r)).index, c); - } - - return false; - } - - public void setModel(TableModel tm) { - super.setModel(tm); - rows.ensureCapacity(model.getRowCount()); - model.addTableModelListener(this); - sortColumn = -1; - dirty = true; - refresh(); - } - - public int getSortedColumnNumber() { - return sortColumn; - } - - public String getSortedDirection(int columnNumber) { - if (getSortedColumnNumber() < 0) { - return NONE; - } - - return _sortDirection; - } - - public void setValueAt(Object aValue, int r, int c) { - if ((rows.size() > 0) && (r < rows.size())) { - model.setValueAt(aValue, ((Row) rows.get(r)).index, c); - } - } - - /* compute the moved row for the three methods that access - model elements - */ - public Object getValueAt(int r, int c) { - if ((rows.size() > 0) && (r < rows.size())) { - return model.getValueAt(((Row) rows.get(r)).index, c); - } - - return null; - } - - public void addMouseListener(final JTable table) { - table.getTableHeader().addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent event) { - // check for double click - if (event.getClickCount() < 2) { - return; - } - - // find column of click and - int tableColumn = table.columnAtPoint(event.getPoint()); - - // translate to table model index and sort - int modelColumn = table.convertColumnIndexToModel(tableColumn); - sort(modelColumn); - } - }); - } - - public void removeRow(int rowNum) throws ArrayIndexOutOfBoundsException, IllegalStateException { - int mappedRow = ((Row) rows.get(rowNum)).index; - super.removeRow(mappedRow); - } - - public void sort(int columnNumber, String direction) { - _sortDirection = ASC; - dirty = true; - sort(columnNumber); - - if (DESC.equals(direction)) { - sort(columnNumber); - _sortDirection = DESC; - } - } - - /** - * Implements the TableModelListener interface to receive - * notifications of * changes to the table model. SortFilterModel needs - * to receive events for adding and removing rows. - */ - public void tableChanged(TableModelEvent e) { - dirty = true; - refresh(); - fireTableChanged(e); - } - - protected void refresh() { - rows.clear(); - - for (int i = 0; i < model.getRowCount(); i++) { - rows.add(new Row(i)); - } - - if (dirty && (sortColumn > -1)) { - sort(sortColumn); - } - } - - protected void sort(int c) { - boolean sorted = (sortColumn == c); - sortColumn = c; - - if (dirty || !sorted) { - Collections.sort(rows); - dirty = false; - } else { - Collections.reverse(rows); - } - - fireTableDataChanged(); - } - - - /* this inner class holds the index of the model row - * Rows are compared by looking at the model row entries - * in the sort column - */ - private class Row implements Comparable { - public int index; - - public Row(int index) { - this.index = index; - } - - public int compareTo(Object other) { - Row otherRow = (Row) other; - Object a = model.getValueAt(index, sortColumn); - Object b = model.getValueAt(otherRow.index, sortColumn); - - boolean areTheyCompareable = (a instanceof Comparable && b instanceof Comparable && (a.getClass() == b.getClass())); - - if (areTheyCompareable) { - return ((Comparable) a).compareTo((Comparable) b); - } else { - return a.toString().compareTo(b.toString()); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java b/trunk/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java deleted file mode 100644 index fbbdf7d6d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java +++ /dev/null @@ -1,37 +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.table; - -import javax.swing.table.TableModel; - - -/** - */ -public interface SortableTableModel extends TableModel { - - final static public String NONE = "NONE"; - final static public String ASC = "ASC"; - final static public String DESC = "DESC"; - - - public int getSortedColumnNumber(); - - public String getSortedDirection(int columnNumber); - - public void sort(int columnNumber, String direction); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java b/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java deleted file mode 100644 index ea13cc01d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java +++ /dev/null @@ -1,360 +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.table; - -import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.swing.table.TableModel; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsException; -import org.apache.struts2.components.GenericUIBean; -import org.apache.struts2.components.table.renderer.CellRenderer; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @s.tag name="table" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.table.WebTableTag" - * description="Instantiate a JavaBean and place it in the context." - */ -public class WebTable extends GenericUIBean { - private static final Log LOG = LogFactory.getLog(WebTable.class); - - final public static String TEMPLATE = "table"; - - protected String sortOrder = SortableTableModel.NONE; - protected String modelName = null; - protected TableModel model = null; - protected WebTableColumn[] columns = null; - protected boolean sortableAttr = false; - protected int sortColumn = -1; - protected int curRow = 0; - - public WebTable(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - protected String getDefaultTemplate() { - return TEMPLATE; - } - - public boolean end(Writer writer, String body) { - if (sortableAttr && model instanceof SortableTableModel) { - LOG.debug("we are looking for " + getSortColumnLinkName()); - - String sortColumn = request.getParameter(getSortColumnLinkName()); - String sortOrder = request.getParameter(getSortOrderLinkName()); - - try { - if ((sortColumn != null) || (sortOrder != null)) { - if (sortColumn != null) { - try { - this.sortColumn = Integer.parseInt(sortColumn); - } catch (Exception ex) { - if (LOG.isDebugEnabled()) { - LOG.debug("coudn't convert column, take default"); - } - } - } - - if (sortOrder != null) { - this.sortOrder = sortOrder; - } - } else { - LOG.debug("no sorting info in the request"); - } - - if (this.sortColumn >= 0) { - LOG.debug("we have the sortColumn " + Integer.toString(this.sortColumn)); - LOG.debug("we have the sortOrder " + this.sortOrder); - - try { - ((SortableTableModel) model).sort(this.sortColumn, this.sortOrder); - } catch (Exception ex) { - if (LOG.isDebugEnabled()) { - LOG.debug("couldn't sort the data"); - } - } - - LOG.debug("we just sorted the data"); - } - } catch (Exception e) { - throw new StrutsException("Error with WebTable: " + toString(e), e); - } - } - - return super.end(writer, body); - } - - public WebTableColumn getColumn(int index) { - try { - return (columns[index]); - } catch (Exception E) { - //blank - } - - return null; - } - - protected void evaluateExtraParams() { - if (modelName != null) { - modelName = findString(modelName); - - Object obj = stack.findValue(this.modelName); - - if (obj instanceof TableModel) { - setModel((TableModel) obj); - } - } - - super.evaluateExtraParams(); - } - - protected int getNumberOfVisibleColumns() { - int count = 0; - - for (int i = 0; i < columns.length; ++i) { - if (!columns[i].isHidden()) { - ++count; - } - } - - return count; - } - - public int getColumnCount() { - return (columns.length); - } - - public void setColumnDisplayName(int column, String displayName) { - columns[column].setDisplayName(displayName); - } - - public void getColumnDisplayName(int column) { - columns[column].getDisplayName(); - } - - public void setColumnHidden(int column, boolean hide) { - columns[column].setHidden(hide); - } - - public boolean isColumnHidden(int column) { - return columns[column].isHidden(); - } - - public void setColumnRenderer(int column, CellRenderer renderer) { - columns[column].setRenderer(renderer); - } - - public CellRenderer getColumnRenderer(int column) { - return columns[column].getRenderer(); - } - - public WebTableColumn[] getColumns() { - return columns; - } - - public String[] getFormattedRow(int row) { - ArrayList data = new ArrayList(getNumberOfVisibleColumns()); - - for (int i = 0; i < getColumnCount(); ++i) { - if (columns[i].isVisible()) { - data.add(columns[i].getRenderer().renderCell(this, model.getValueAt(row, i), row, i)); - } - } - - return (String[]) data.toArray(new String[0]); - } - - public void setModel(TableModel model) { - this.model = model; - columns = new WebTableColumn[this.model.getColumnCount()]; - - for (int i = 0; i < columns.length; ++i) { - columns[i] = new WebTableColumn(this.model.getColumnName(i), i); - } - - if ((sortableAttr) && !(this.model instanceof SortableTableModel)) { - this.model = new SortFilterModel(this.model); - } - } - - public TableModel getModel() { - return (model); - } - - /** - * The name of model to use - * @s.tagattribute required="true" type="String" - */ - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public String getModelName() { - return modelName; - } - - public Object getRawData(int row, int column) { - return model.getValueAt(row, column); - } - - public Iterator getRawDataRowIterator() { - return new WebTableRowIterator(this, WebTableRowIterator.RAW_DATA); - } - - public Object[] getRow(int row) { - ArrayList data = new ArrayList(getNumberOfVisibleColumns()); - - for (int i = 0; i < getColumnCount(); ++i) { - if (columns[i].isVisible()) { - data.add(model.getValueAt(row, i)); - } - } - - return data.toArray(new Object[0]); - } - - public int getRowCount() { - return model.getRowCount(); - } - - public Iterator getRowIterator() { - return new WebTableRowIterator(this); - } - - /** - * Index of column to sort data by - * @s.tagattribute required="false" type="Integer" - */ - public void setSortColumn(int sortColumn) { - this.sortColumn = sortColumn; - } - - public int getSortColumn() { - if (model instanceof SortableTableModel) { - return ((SortableTableModel) model).getSortedColumnNumber(); - } - - return -1; - } - - public String getSortColumnLinkName() { - return "WEBTABLE_" + modelName + "_SORT_COLUMN"; - } - - /** - * Set sort order. Allowed values are NONE, ASC and DESC - * @s.tagattribute required="false" type="String" default="NONE" - */ - public void setSortOrder(String sortOrder) { - if (sortOrder.equals(SortableTableModel.NONE)) { - this.sortOrder = SortableTableModel.NONE; - } else if (sortOrder.equals(SortableTableModel.DESC)) { - this.sortOrder = SortableTableModel.DESC; - } else if (sortOrder.equals(SortableTableModel.ASC)) { - this.sortOrder = SortableTableModel.ASC; - } else { - this.sortOrder = SortableTableModel.NONE; - } - } - - public String getSortOrder() { - if ((model instanceof SortableTableModel) && (getSortColumn() >= 0)) { - return ((SortableTableModel) model).getSortedDirection(getSortColumn()); - } - - return SortableTableModel.NONE; - } - - public String getSortOrderLinkName() { - return "WEBTABLE_" + modelName + "_SORT_ORDER"; - } - - /** - * Whether the table should be sortable. Requires that model implements org.apache.struts2.components.table.SortableTableModel if set to true. - * @s.tagattribute required="false" type="Boolean" default="false" - */ - public void setSortable(boolean sortable) { - sortableAttr = sortable; - - if ((sortableAttr) && (model != null) && !(model instanceof SortableTableModel)) { - model = new SortFilterModel(model); - } - } - - public boolean isSortable() { - return sortableAttr; - } - - /** - * inner class to iteratoe over a row of the table. - * It can return formatted data, using the columnRenderer - * for the column or it can return the raw data. - */ - public class WebTableRowIterator implements Iterator { - public static final int FORMATTED_DATA = 0; - public static final int RAW_DATA = 1; - protected WebTable _table; - protected int _curRow = 0; - protected int _mode = 0; - - protected WebTableRowIterator(WebTable table) { - this(table, FORMATTED_DATA); - } - - protected WebTableRowIterator(WebTable table, int mode) { - _table = table; - _mode = mode; - } - - public boolean hasNext() { - if (_table == null) { - return false; - } - - return (_table.getRowCount() > _curRow); - } - - public Object next() throws NoSuchElementException { - if (_table == null) { - throw new NoSuchElementException("WebTable is null"); - } - - if (!hasNext()) { - throw new NoSuchElementException("Beyond end of WebTable"); - } - - if (_mode == RAW_DATA) { - return _table.getRow(_curRow++); - } - - return _table.getFormattedRow(_curRow++); - } - - public void remove() throws UnsupportedOperationException, IllegalStateException { - throw new UnsupportedOperationException("Remove not supported in WebTable"); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java b/trunk/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java deleted file mode 100644 index 04069599c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java +++ /dev/null @@ -1,81 +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.table; - -import org.apache.struts2.components.table.renderer.CellRenderer; -import org.apache.struts2.components.table.renderer.DefaultCellRenderer; - - -/** - */ -public class WebTableColumn { - - static final private CellRenderer DEFAULT_RENDERER = new DefaultCellRenderer(); - - - CellRenderer _renderer = null; - String _displayName = null; - String _name = null; - boolean _hidden = false; - int _offset = -1; - - - public WebTableColumn(String name, int offset) { - _name = name; - _offset = offset; - _displayName = name; - _renderer = DEFAULT_RENDERER; - } - - - public void setDisplayName(String displayName) { - _displayName = displayName; - } - - public String getDisplayName() { - return (_displayName); - } - - public void setHidden(boolean hidden) { - _hidden = hidden; - } - - public boolean isHidden() { - return _hidden; - } - - public String getName() { - return (_name); - } - - public int getOffset() { - return (_offset); - } - - public void setRenderer(CellRenderer renderer) { - _renderer = renderer; - } - - public CellRenderer getRenderer() { - return (_renderer); - } - - public boolean isVisible() { - return !isHidden(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java deleted file mode 100644 index 4e901e695..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java +++ /dev/null @@ -1,71 +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.table.renderer; - -import org.apache.struts2.components.table.WebTable; - - -/** - * this is the base class that most renderers will be derived from. - * It allows setting the alignment. Subclasses should set there actuall - * content by implementing getCellValue - */ -abstract public class AbstractCellRenderer implements CellRenderer { - - /** - * used for horizontal cell alignmnet - */ - protected String _alignment = null; - - - public void setAlignment(String alignment) { - _alignment = alignment; - } - - public String getAlignment() { - return _alignment; - } - - /** - * implememnts CellRenderer renderCell. It sets the alignment. gets the actual - * data from getCellValue - */ - public String renderCell(WebTable table, Object data, int row, int col) { - if (isAligned()) { - StringBuffer buf = new StringBuffer(256); - buf.append("
    "); - buf.append(getCellValue(table, data, row, col)); - buf.append("
    "); - - return buf.toString(); - } - - return getCellValue(table, data, row, col); - } - - protected boolean isAligned() { - return _alignment != null; - } - - /** - * this is the method that subclasses need to implement to set their value. - * they should not override renderCell unless they want to change the alignmnent - * renderering - */ - abstract protected String getCellValue(WebTable table, Object data, int row, int col); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java deleted file mode 100644 index 44e228fb3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java +++ /dev/null @@ -1,62 +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.table.renderer; - -import org.apache.struts2.components.table.WebTable; - - -/** - */ -public class BooleanCellRenderer extends AbstractCellRenderer { - - /** - * value used if the boolean object is false - */ - protected String _falseValue = "false"; - - /** - * value used if the boolean object is true - */ - protected String _trueValue = "true"; - - - public BooleanCellRenderer() { - super(); - } - - - public String getCellValue(WebTable table, Object data, int row, int col) { - if (data == null) { - return ""; - } - - if (data instanceof Boolean) { - return ((Boolean) data).booleanValue() ? _trueValue : _falseValue; - } - - return data.toString(); //if here then not a boolean - } - - public void setFalseValue(String falseValue) { - _falseValue = falseValue; - } - - public void setTrueValue(String trueValue) { - _trueValue = trueValue; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java deleted file mode 100644 index 40ccd103a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java +++ /dev/null @@ -1,27 +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.table.renderer; - -import org.apache.struts2.components.table.WebTable; - -/** - */ -public interface CellRenderer { - - public String renderCell(WebTable table, Object data, int row, int col); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java deleted file mode 100644 index ee7d3ca0e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java +++ /dev/null @@ -1,61 +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.table.renderer; - -import java.text.SimpleDateFormat; - -import org.apache.struts2.components.table.WebTable; - - -/** - */ -public class DateCellRenderer extends AbstractCellRenderer { - - SimpleDateFormat _formater = new SimpleDateFormat(); - - /** - * this is the string that SimpleDateFormat needs to display the date - * - * @see SimpleDateFormat - */ - String _formatString = null; - - - public DateCellRenderer() { - super(); - } - - - public String getCellValue(WebTable table, Object data, int row, int col) { - - if (data == null) { - return ""; - } - - if (data instanceof java.util.Date) { - return _formater.format((java.util.Date) data); - } - - return data.toString(); - } - - public void setFormatString(String format) { - _formatString = format; - _formater.applyPattern(_formatString); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java deleted file mode 100644 index 032a5082f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java +++ /dev/null @@ -1,39 +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.table.renderer; - -import org.apache.struts2.components.table.WebTable; - - -/** - */ -public class DefaultCellRenderer extends AbstractCellRenderer { - - public DefaultCellRenderer() { - super(); - } - - - public String getCellValue(WebTable table, Object data, int row, int col) { - if (data != null) { - return data.toString(); - } - - return "null"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java deleted file mode 100644 index 71e2a0870..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java +++ /dev/null @@ -1,46 +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.table.renderer; - -import org.apache.struts2.components.table.WebTable; - - -/** - * usefull if a column has an embeded ID number needed for a link but you want it to - * say something else. - */ -public class FixedTextCellRenderer extends AbstractCellRenderer { - - /** - * this is the text that will be shown in the column - */ - protected String _text = ""; - - - public String getCellValue(WebTable table, Object data, int row, int col) { - return _text; - } - - public void setText(String text) { - _text = text; - } - - public String getText() { - return _text; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java deleted file mode 100644 index 67e97be13..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java +++ /dev/null @@ -1,240 +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.table.renderer; - -import org.apache.struts2.components.table.WebTable; - - -/** - */ -public class LinkCellRenderer extends AbstractCellRenderer { - - /** - * this is the actual renderer tha will be used to display the text - */ - protected CellRenderer _delegateRenderer = new DefaultCellRenderer(); - - /** - * the CSS class this link belongs to. Optional - */ - protected String _cssClass = null; - - /** - * the id attribute this link belongs to. Optional - */ - protected String _cssId = null; - - /** - * this is the link we are setting (required) - */ - protected String _link = null; - - /** - * the (Java)script/ function to execute when the link is clicked. Optional - */ - protected String _onclick = null; - - /** - * the (Java)script/ function to execute when the link is clicked twice. Optional - */ - protected String _ondblclick = null; - - /** - * the (Java)script/ function to execute when cursor is away from the link. Optional - */ - protected String _onmouseout = null; - - /** - * the (Java)script/ function to execute when cursor is over the link. Optional - */ - protected String _onmouseover = null; - - /** - * if set there will be a parameter attached to link. (optional) - * This should be extended to allow multiple parameters - */ - protected String _param = null; - - /** - * directly set the value for the param. Will overide paramColumn if set. - * optional. Either this or paramColumn must be set if param is used. - * Will be ignored if param not used - */ - protected String _paramValue = null; - - /** - * the target frame to open in. Optional - */ - protected String _target = null; - - /** - * the title attribute this link belongs to. Optional - */ - protected String _title = null; - - /** - * additional parameters after the above parameter is generated. Optional - */ - protected String _trailParams = null; - - /** - * if used the param value will be taken from another column in the table. Useful if each row - * needs a different paramter. The paramter can be taken from a hidden cell. - * if paramValue is also set it will overrid this. (option either this or paramValue must be set - * if param is used. Will be ignored if param not used - */ - protected int _paramColumn = -1; - - - public LinkCellRenderer() { - } - - - /** - * should the link data be encodeed? - */ - public String getCellValue(WebTable table, Object data, int row, int col) { - String value = _delegateRenderer.renderCell(table, data, row, col); - - StringBuffer cell = new StringBuffer(256); - cell.append("").append(value).append(""); - - return cell.toString(); - } - - public void setCssClass(String cssClass) { - _cssClass = cssClass; - } - - public void setCssId(String cssId) { - _cssId = cssId; - } - - public void setLink(String link) { - _link = link; - } - - public void setOnclick(String onclick) { - _onclick = onclick; - } - - public void setOndblclick(String ondblclick) { - _ondblclick = ondblclick; - } - - public void setOnmouseout(String onmouseout) { - _onmouseout = onmouseout; - } - - public void setOnmouseover(String onmouseover) { - _onmouseover = onmouseover; - } - - public void setParam(String param) { - _param = param; - } - - public void setParamColumn(int paramColumn) { - _paramColumn = paramColumn; - } - - public void setParamValue(String paramValue) { - _paramValue = paramValue; - } - - /** - * used to set the renderer to delgate to. - * if the render is an AbstractCellRenderer then it will take the alignment from - * the delegate renderer and set it that way. - */ - public void setRenderer(CellRenderer delegateRenderer) { - _delegateRenderer = delegateRenderer; - - if (_delegateRenderer instanceof AbstractCellRenderer) { - setAlignment(((AbstractCellRenderer) _delegateRenderer).getAlignment()); - } - } - - public void setTarget(String target) { - _target = target; - } - - public void setTitle(String title) { - _title = title; - } - - public void setTrailParams(String trailParams) { - _trailParams = trailParams; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java deleted file mode 100644 index 420004b35..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java +++ /dev/null @@ -1,100 +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.table.renderer; - -import java.text.DecimalFormat; - -import org.apache.struts2.components.table.WebTable; - - -/** - */ -public class NumericCellRenderer extends AbstractCellRenderer { - - DecimalFormat _formater = new DecimalFormat(); - - /** - * this is the format string that DecimalFormat would use. - * - * @see DecimalFormat - */ - String _formatString = null; - - /** - * if set the is the color to use if Number is negative. - */ - String _negativeColor = null; - - /** - * if set this is the color to render if number is positive - */ - String _positiveColor = null; - - - public NumericCellRenderer() { - super(); - } - - - public String getCellValue(WebTable table, Object data, int row, int col) { - StringBuffer retVal = new StringBuffer(128); - - if (data == null) { - return ""; - } - - if (data instanceof Number) { - double cellValue = ((Number) data).doubleValue(); - - if (cellValue >= 0) { - processNumber(retVal, _positiveColor, cellValue); - } else { - processNumber(retVal, _negativeColor, cellValue); - } - - return retVal.toString(); - } - - return data.toString(); - } - - public void setFormatString(String format) { - _formatString = format; - _formater.applyPattern(_formatString); - } - - public void setNegativeColor(String color) { - _negativeColor = color; - } - - public void setPositiveColor(String color) { - _positiveColor = color; - } - - protected void processNumber(StringBuffer buf, String color, double cellValue) { - if (color != null) { - buf.append(" "); - } - - buf.append(_formater.format(cellValue)); - - if (color != null) { - buf.append(""); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/package.html b/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/package.html deleted file mode 100644 index 403e3624d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/table/renderer/package.html +++ /dev/null @@ -1 +0,0 @@ -JSP UI tags for rendering table output in HTML. diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java b/trunk/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java deleted file mode 100644 index a5cf580ee..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java +++ /dev/null @@ -1,101 +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.template; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; - -/** - * Base class for template engines. - */ -public abstract class BaseTemplateEngine implements TemplateEngine { - - private static final Log LOG = LogFactory.getLog(BaseTemplateEngine.class); - - /** The default theme properties file name. Default is 'theme.properties' */ - public static final String DEFAULT_THEME_PROPERTIES_FILE_NAME = "theme.properties"; - - final Map themeProps = new HashMap(); - - public Map getThemeProps(Template template) { - synchronized (themeProps) { - Properties props = (Properties) themeProps.get(template.getTheme()); - if (props == null) { - String propName = template.getDir() + "/" + template.getTheme() + "/"+getThemePropertiesFileName(); - -// WW-1292 - // let's try getting it from the filesystem - File propFile = new File(propName); - InputStream is = null; - try { - if (propFile.exists()) { - is = new FileInputStream(propFile); - } - } - catch(FileNotFoundException e) { - LOG.warn("Unable to find file in filesystem ["+propFile.getAbsolutePath()+"]"); - } - - if (is == null) { - // if its not in filesystem. let's try the classpath - is = ClassLoaderUtil.getResourceAsStream(propName, getClass()); - } - - props = new Properties(); - - if (is != null) { - try { - props.load(is); - } catch (IOException e) { - LOG.error("Could not load " + propName, e); - } - } - - themeProps.put(template.getTheme(), props); - } - - return props; - } - } - - protected String getFinalTemplateName(Template template) { - String t = template.toString(); - if (t.indexOf(".") <= 0) { - return t + "." + getSuffix(); - } - - return t; - } - - protected String getThemePropertiesFileName() { - return DEFAULT_THEME_PROPERTIES_FILE_NAME; - } - - protected abstract String getSuffix(); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java b/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java deleted file mode 100644 index 8e09ca6ab..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java +++ /dev/null @@ -1,148 +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.template; - -import java.io.IOException; -import java.io.Writer; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.views.freemarker.FreemarkerManager; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - -import freemarker.template.Configuration; -import freemarker.template.SimpleHash; - -/** - * Freemarker based template engine. - */ -public class FreemarkerTemplateEngine extends BaseTemplateEngine { - static Class bodyContent = null; - - static { - try { - bodyContent = ClassLoaderUtil.loadClass("javax.servlet.jsp.tagext.BodyContent", - FreemarkerTemplateEngine.class); - } catch (ClassNotFoundException e) { - // this is OK -- this just means JSP isn't even being used here, which is perfectly fine. - // we need this class in environments that use JSP to know when to wrap the writer - // and ignore flush() calls. In JSP, it is illegal for a BodyContent writer to be flushed(), - // so we have to take caution here. - } - } - - private static final Log LOG = LogFactory.getLog(FreemarkerTemplateEngine.class); - - public void renderTemplate(TemplateRenderingContext templateContext) throws Exception { - // get the various items required from the stack - ValueStack stack = templateContext.getStack(); - Map context = stack.getContext(); - ServletContext servletContext = (ServletContext) context.get(ServletActionContext.SERVLET_CONTEXT); - HttpServletRequest req = (HttpServletRequest) context.get(ServletActionContext.HTTP_REQUEST); - HttpServletResponse res = (HttpServletResponse) context.get(ServletActionContext.HTTP_RESPONSE); - - // prepare freemarker - FreemarkerManager freemarkerManager = FreemarkerManager.getInstance(); - Configuration config = freemarkerManager.getConfiguration(servletContext); - - // get the list of templates we can use - List templates = templateContext.getTemplate().getPossibleTemplates(this); - - // find the right template - freemarker.template.Template template = null; - String templateName = null; - Exception exception = null; - for (Iterator iterator = templates.iterator(); iterator.hasNext();) { - Template t = (Template) iterator.next(); - templateName = getFinalTemplateName(t); - try { - // try to load, and if it works, stop at the first one - template = config.getTemplate(templateName); - break; - } catch (IOException e) { - if (exception == null) { - exception = e; - } - } - } - - if (template == null) { - LOG.error("Could not load template " + templateContext.getTemplate()); - if (exception != null) { - throw exception; - } else { - return; - } - } - - if (LOG.isDebugEnabled()) { - LOG.debug("Rendering template " + templateName); - } - - ActionInvocation ai = ActionContext.getContext().getActionInvocation(); - - Object action = (ai == null) ? null : ai.getAction(); - SimpleHash model = freemarkerManager.buildTemplateModel(stack, action, servletContext, req, res, config.getObjectWrapper()); - - model.put("tag", templateContext.getTag()); - model.put("themeProperties", getThemeProps(templateContext.getTemplate())); - - // the BodyContent JSP writer doesn't like it when FM flushes automatically -- - // so let's just not do it (it will be flushed eventually anyway) - Writer writer = templateContext.getWriter(); - if (bodyContent != null && bodyContent.isAssignableFrom(writer.getClass())) { - final Writer wrapped = writer; - writer = new Writer() { - public void write(char cbuf[], int off, int len) throws IOException { - wrapped.write(cbuf, off, len); - } - - public void flush() throws IOException { - // nothing! - } - - public void close() throws IOException { - wrapped.close(); - } - }; - } - - try { - stack.push(templateContext.getTag()); - template.process(model, writer); - } finally { - stack.pop(); - } - } - - protected String getSuffix() { - return "ftl"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java b/trunk/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java deleted file mode 100644 index a0b21d039..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java +++ /dev/null @@ -1,83 +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.template; - -import java.util.Iterator; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.PageContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.components.Include; -import org.apache.struts2.components.UIBean; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * JSP based template engine. - */ -public class JspTemplateEngine extends BaseTemplateEngine { - private static final Log LOG = LogFactory.getLog(JspTemplateEngine.class); - - public void renderTemplate(TemplateRenderingContext templateContext) throws Exception { - Template template = templateContext.getTemplate(); - - if (LOG.isDebugEnabled()) { - LOG.debug("Trying to render template " + template + ", repeating through parents until we succeed"); - } - UIBean tag = templateContext.getTag(); - ValueStack stack = templateContext.getStack(); - stack.push(tag); - PageContext pageContext = (PageContext) stack.getContext().get(ServletActionContext.PAGE_CONTEXT); - List templates = template.getPossibleTemplates(this); - Exception exception = null; - boolean success = false; - for (Iterator iterator = templates.iterator(); iterator.hasNext();) { - Template t = (Template) iterator.next(); - try { - Include.include(getFinalTemplateName(t), pageContext.getOut(), - pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse()); - success = true; - break; - } catch (Exception e) { - if (exception == null) { - exception = e; - } - } - } - - if (!success) { - LOG.error("Could not render JSP template " + templateContext.getTemplate()); - - if (exception != null) { - throw exception; - } else { - return; - } - } - - stack.pop(); - } - - protected String getSuffix() { - return "jsp"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/Template.java b/trunk/core/src/main/java/org/apache/struts2/components/template/Template.java deleted file mode 100644 index f0bf1c4b7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/Template.java +++ /dev/null @@ -1,88 +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.template; - -import java.util.ArrayList; -import java.util.List; - -/** - * A template. - *

    - * A template is used as a model for rendering output. - * This object contains basic common template information - */ -public class Template implements Cloneable { - String dir; - String theme; - String name; - - /** - * Constructor. - * - * @param dir base folder where the template is stored. - * @param theme the theme of the template - * @param name the name of the template. - */ - public Template(String dir, String theme, String name) { - this.dir = dir; - this.theme = theme; - this.name = name; - } - - public String getDir() { - return dir; - } - - public String getTheme() { - return theme; - } - - public String getName() { - return name; - } - - public List getPossibleTemplates(TemplateEngine engine) { - List list = new ArrayList(3); - Template template = this; - String parentTheme; - list.add(template); - while ((parentTheme = (String) engine.getThemeProps(template).get("parent")) != null) { - try { - template = (Template) template.clone(); - template.theme = parentTheme; - list.add(template); - } catch (CloneNotSupportedException e) { - // do nothing - } - } - - return list; - } - - /** - * Constructs a string in the format /dir/theme/name. - * @return a string in the format /dir/theme/name. - */ - public String toString() { - return "/" + dir + "/" + theme + "/" + name; - } - - protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java b/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java deleted file mode 100644 index 83f66e1f0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java +++ /dev/null @@ -1,43 +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.template; - -import java.util.Map; - -/** - * Any template language which wants to support UI tag templating needs to provide an implementation of this interface - * to handle rendering the template - */ -public interface TemplateEngine { - - /** - * Renders the template - * @param templateContext context for the given template. - * @throws Exception is thrown if there is a failure when rendering. - */ - void renderTemplate(TemplateRenderingContext templateContext) throws Exception; - - /** - * Get's the properties for the given template. - * - * @param template the template. - * @return the properties as key value pairs. - */ - Map getThemeProps(Template template); - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java b/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java deleted file mode 100644 index e4cf9e0d6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java +++ /dev/null @@ -1,79 +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.template; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.struts2.config.Settings; - -/** - * The TemplateEngineManager will return a template engine for the template - */ -public class TemplateEngineManager { - public static final String DEFAULT_TEMPLATE_TYPE_CONFIG_KEY = "struts.ui.templateSuffix"; - - private static final TemplateEngineManager MANAGER = new TemplateEngineManager(); - - /** The default template extenstion is ftl. */ - public static final String DEFAULT_TEMPLATE_TYPE = "ftl"; - - Map templateEngines = new HashMap(); - - private TemplateEngineManager() { - templateEngines.put("ftl", new FreemarkerTemplateEngine()); - templateEngines.put("vm", new VelocityTemplateEngine()); - templateEngines.put("jsp", new JspTemplateEngine()); - } - - /** - * Registers the given template engine. - *

    - * Will add the engine to the existing list of known engines. - * @param templateExtension filename extension (eg. .jsp, .ftl, .vm). - * @param templateEngine the engine. - */ - public static void registerTemplateEngine(String templateExtension, TemplateEngine templateEngine) { - MANAGER.templateEngines.put(templateExtension, templateEngine); - } - - /** - * Gets the TemplateEngine for the template name. If the template name has an extension (for instance foo.jsp), then - * this extension will be used to look up the appropriate TemplateEngine. If it does not have an extension, it will - * look for a Configuration setting "struts.ui.templateSuffix" for the extension, and if that is not set, it - * will fall back to "ftl" as the default. - * - * @param template Template used to determine which TemplateEngine to return - * @param templateTypeOverride Overrides the default template type - * @return the engine. - */ - public static TemplateEngine getTemplateEngine(Template template, String templateTypeOverride) { - String templateType = DEFAULT_TEMPLATE_TYPE; - String templateName = template.toString(); - if (templateName.indexOf(".") > 0) { - templateType = templateName.substring(templateName.indexOf(".") + 1); - } else if (templateTypeOverride !=null && templateTypeOverride.length() > 0) { - templateType = templateTypeOverride; - } else if (Settings.isSet(DEFAULT_TEMPLATE_TYPE_CONFIG_KEY)) { - templateType = (String) Settings.get(DEFAULT_TEMPLATE_TYPE_CONFIG_KEY); - } - return (TemplateEngine) MANAGER.templateEngines.get(templateType); - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java b/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java deleted file mode 100644 index df0809e73..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java +++ /dev/null @@ -1,73 +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.template; - -import java.io.Writer; -import java.util.Map; - -import org.apache.struts2.components.UIBean; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * Context used when rendering templates. - */ -public class TemplateRenderingContext { - Template template; - ValueStack stack; - Map parameters; - UIBean tag; - Writer writer; - - /** - * Constructor - * - * @param template the template. - * @param writer the writer. - * @param stack OGNL value stack. - * @param params parameters to this template. - * @param tag the tag UI component. - */ - public TemplateRenderingContext(Template template, Writer writer, ValueStack stack, Map params, UIBean tag) { - this.template = template; - this.writer = writer; - this.stack = stack; - this.parameters = params; - this.tag = tag; - } - - public Template getTemplate() { - return template; - } - - public ValueStack getStack() { - return stack; - } - - public Map getParameters() { - return parameters; - } - - public UIBean getTag() { - return tag; - } - - public Writer getWriter() { - return writer; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java b/trunk/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java deleted file mode 100644 index c9d0ae531..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java +++ /dev/null @@ -1,101 +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.template; - -import java.io.IOException; -import java.io.Writer; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.views.velocity.VelocityManager; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.context.Context; - -/** - * Velocity based template engine. - */ -public class VelocityTemplateEngine extends BaseTemplateEngine { - private static final Log LOG = LogFactory.getLog(VelocityTemplateEngine.class); - - public void renderTemplate(TemplateRenderingContext templateContext) throws Exception { - // get the various items required from the stack - Map actionContext = templateContext.getStack().getContext(); - ServletContext servletContext = (ServletContext) actionContext.get(ServletActionContext.SERVLET_CONTEXT); - HttpServletRequest req = (HttpServletRequest) actionContext.get(ServletActionContext.HTTP_REQUEST); - HttpServletResponse res = (HttpServletResponse) actionContext.get(ServletActionContext.HTTP_RESPONSE); - - // prepare velocity - VelocityManager velocityManager = VelocityManager.getInstance(); - velocityManager.init(servletContext); - VelocityEngine velocityEngine = velocityManager.getVelocityEngine(); - - // get the list of templates we can use - List templates = templateContext.getTemplate().getPossibleTemplates(this); - - // find the right template - org.apache.velocity.Template template = null; - String templateName = null; - Exception exception = null; - for (Iterator iterator = templates.iterator(); iterator.hasNext();) { - Template t = (Template) iterator.next(); - templateName = getFinalTemplateName(t); - try { - // try to load, and if it works, stop at the first one - template = velocityEngine.getTemplate(templateName); - break; - } catch (IOException e) { - if (exception == null) { - exception = e; - } - } - } - - if (template == null) { - LOG.error("Could not load template " + templateContext.getTemplate()); - if (exception != null) { - throw exception; - } else { - return; - } - } - - if (LOG.isDebugEnabled()) { - LOG.debug("Rendering template " + templateName); - } - - Context context = velocityManager.createContext(templateContext.getStack(), req, res); - - Writer outputWriter = templateContext.getWriter(); - context.put("tag", templateContext.getTag()); - context.put("parameters", templateContext.getParameters()); - - template.merge(context, outputWriter); - } - - protected String getSuffix() { - return "vm"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/DefaultSettings.java b/trunk/core/src/main/java/org/apache/struts2/config/DefaultSettings.java deleted file mode 100644 index dacb970be..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/DefaultSettings.java +++ /dev/null @@ -1,145 +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.config; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.StringTokenizer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; - -import com.opensymphony.xwork2.util.LocalizedTextUtil; - - -/** - * Default implementation of Settings - creates and delegates to other settingss by using an internal - * {@link DelegatingSettings}. - */ -public class DefaultSettings extends Settings { - - protected Log log = LogFactory.getLog(this.getClass()); - Settings config; - - - /** - * Creates a new DefaultSettings object by loading all property files - * and creating an internal {@link DelegatingSettings} object. All calls to get and set - * in this class will call that settings object. - */ - public DefaultSettings() { - // Create default implementations - // Use default properties and struts.properties - ArrayList list = new ArrayList(); - - try { - list.add(new PropertiesSettings("struts")); - } catch (Exception e) { - log.warn("Could not find or error in struts.properties", e); - } - - try { - list.add(new PropertiesSettings("org/apache/struts2/default")); - } catch (Exception e) { - log.error("Could not find org/apache/struts2/default.properties", e); - } - - Settings[] configList = new Settings[list.size()]; - config = new DelegatingSettings((Settings[]) list.toArray(configList)); - - // Add list of additional properties settingss - try { - StringTokenizer configFiles = new StringTokenizer((String) config.getImpl(StrutsConstants.STRUTS_CUSTOM_PROPERTIES), ","); - - while (configFiles.hasMoreTokens()) { - String name = configFiles.nextToken(); - - try { - list.add(new PropertiesSettings(name)); - } catch (Exception e) { - log.error("Could not find " + name + ".properties. Skipping"); - } - } - - configList = new Settings[list.size()]; - config = new DelegatingSettings((Settings[]) list.toArray(configList)); - } catch (IllegalArgumentException e) { - // thrown when Settings is unable to find a certain property - // eg. struts.custom.properties in default.properties which is commented - // out - } - - // Add additional list of i18n global resource bundles - try { - - LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages"); - StringTokenizer bundleFiles = new StringTokenizer((String) config.getImpl(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES), ", "); - - while (bundleFiles.hasMoreTokens()) { - String name = bundleFiles.nextToken(); - try { - log.info("Loading global messages from " + name); - LocalizedTextUtil.addDefaultResourceBundle(name); - } catch (Exception e) { - log.error("Could not find " + name + ".properties. Skipping"); - } - } - } catch (IllegalArgumentException e) { - // struts.custom.i18n.resources wasn't provided - } - } - - - /** - * Sets the given property - delegates to the internal config implementation. - * - * @see #set(String, String) - */ - public void setImpl(String aName, String aValue) throws IllegalArgumentException, UnsupportedOperationException { - config.setImpl(aName, aValue); - } - - /** - * Gets the specified property - delegates to the internal config implementation. - * - * @see #get(String) - */ - public String getImpl(String aName) throws IllegalArgumentException { - // Delegate - return config.getImpl(aName); - } - - /** - * Determines whether or not a value has been set - delegates to the internal config implementation. - * - * @see #isSet(String) - */ - public boolean isSetImpl(String aName) { - return config.isSetImpl(aName); - } - - /** - * Returns a list of all property names - delegates to the internal config implementation. - * - * @see #list() - */ - public Iterator listImpl() { - return config.listImpl(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java b/trunk/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java deleted file mode 100644 index 6580686dd..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java +++ /dev/null @@ -1,150 +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.config; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - - -/** - * A Settings implementation which stores an internal list of settings objects. Each time - * a config method is called (get, set, list, etc..) this class will go through the list of settingss - * and call the method until successful. - * - */ -public class DelegatingSettings extends Settings { - - Settings[] configList; - - - /** - * Creates a new DelegatingSettings object given a list of {@link Settings} implementations. - * - * @param aConfigList a list of Settings implementations. - */ - public DelegatingSettings(Settings[] aConfigList) { - configList = aConfigList; - } - - - /** - * Sets the given property - calls setImpl(String, Object) method on config objects in the config - * list until successful. - * - * @see #set(String, String) - */ - public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException { - // Determine which config to use by using get - // Delegate to the other settingss - IllegalArgumentException e = null; - - for (int i = 0; i < configList.length; i++) { - try { - configList[i].getImpl(name); - - // Found it, now try setting - configList[i].setImpl(name, value); - - // Worked, now return - return; - } catch (IllegalArgumentException ex) { - e = ex; - - // Try next config - } - } - - throw e; - } - - /** - * Gets the specified property - calls getImpl(String) method on config objects in config list - * until successful. - * - * @see #get(String) - */ - public String getImpl(String name) throws IllegalArgumentException { - // Delegate to the other settings - IllegalArgumentException e = null; - - for (int i = 0; i < configList.length; i++) { - try { - return configList[i].getImpl(name); - } catch (IllegalArgumentException ex) { - e = ex; - - // Try next config - } - } - - throw e; - } - - /** - * Determines if a paramter has been set - calls the isSetImpl(String) method on each config object - * in config list. Returns true when one of the config implementations returns true. Returns - * false otherwise. - * - * @see #isSet(String) - */ - public boolean isSetImpl(String aName) { - for (int i = 0; i < configList.length; i++) { - if (configList[i].isSetImpl(aName)) { - return true; - } - } - - return false; - } - - /** - * Returns a list of all property names - returns a list of all property names in all config - * objects in config list. - * - * @see #list() - */ - public Iterator listImpl() { - boolean workedAtAll = false; - - Set settingList = new HashSet(); - UnsupportedOperationException e = null; - - for (int i = 0; i < configList.length; i++) { - try { - Iterator list = configList[i].listImpl(); - - while (list.hasNext()) { - settingList.add(list.next()); - } - - workedAtAll = true; - } catch (UnsupportedOperationException ex) { - e = ex; - - // Try next config - } - } - - if (!workedAtAll) { - throw (e == null) ? new UnsupportedOperationException() : e; - } else { - return settingList.iterator(); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java b/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java deleted file mode 100644 index dc2420810..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java +++ /dev/null @@ -1,106 +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.config; - -import java.io.IOException; -import java.net.URL; -import java.util.Iterator; -import java.util.Properties; - -import org.apache.struts2.StrutsException; - - -/** - * A class to handle settings via a properties file. - */ -public class PropertiesSettings extends Settings { - - Properties settings; - - - /** - * Creates a new properties config given the name of a properties file. The name is expected to NOT have - * the ".properties" file extension. So when new PropertiesSettings("foo") is called - * this class will look in the classpath for the foo.properties file. - * - * @param name the name of the properties file, excluding the ".properties" extension. - */ - public PropertiesSettings(String name) { - settings = new Properties(); - - URL settingsUrl = Thread.currentThread().getContextClassLoader().getResource(name + ".properties"); - - if (settingsUrl == null) { - throw new IllegalStateException(name + ".properties missing"); - } - - // Load settings - try { - settings.load(settingsUrl.openStream()); - } catch (IOException e) { - throw new StrutsException("Could not load " + name + ".properties:" + e, e); - } - } - - - /** - * Sets a property in the properties file. - * - * @see #set(String, String) - */ - public void setImpl(String aName, String aValue) { - settings.setProperty(aName, aValue); - } - - /** - * Gets a property from the properties file. - * - * @see #get(String) - */ - public String getImpl(String aName) throws IllegalArgumentException { - String setting = settings.getProperty(aName); - - if (setting == null) { - throw new IllegalArgumentException("No such setting:" + aName); - } - - return setting; - } - - /** - * Tests to see if a property exists in the properties file. - * - * @see #isSet(String) - */ - public boolean isSetImpl(String aName) { - if (settings.get(aName) != null) { - return true; - } else { - return false; - } - } - - /** - * Lists all keys in the properties file. - * - * @see #list() - */ - public Iterator listImpl() { - return settings.keySet().iterator(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java b/trunk/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java deleted file mode 100644 index 42ce49a1a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java +++ /dev/null @@ -1,88 +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.config; - -import javax.servlet.ServletContext; - -/** - * This singleton holds an instance of the web servlet context. - *

    - * This is needed for running Struts on Weblogic Server 6.1 - * because there is no provision to retrieve the servlet context - * from the web session object. - *

    - * This class is created to bet that this singleton can be set by - * {@link org.apache.struts2.dispatcher.FilterDispatcherCompatWeblogic61} - * before the servlet context is needed by - * {@link org.apache.struts2.lifecycle.SessionLifecycleListener} - * which will use this object to get it. - * - */ -public class ServletContextSingleton { - /** - * The web servlet context. Holding this is the - * purpose of this singleton. - */ - private ServletContext servletContext; - - /** - * The sole instance of this class. - */ - private static ServletContextSingleton singleton; - - /** - * Constructor which cannot be called - * publicly. - */ - private ServletContextSingleton() { - } - - /** - * Answers the singleton. - *

    - * At some point, the caller must populate the web servlet - * context. - * - * @return Answers the singleton instance of this class - */ - public static ServletContextSingleton getInstance() { - if (singleton == null) { - singleton = new ServletContextSingleton(); - } - return singleton; - } - - /** - * Gets the servlet context - * - * @return The web servlet context - */ - public ServletContext getServletContext() { - return servletContext; - } - - /** - * Sets the servlet context - * - * @param context The web servlet context - */ - public void setServletContext(ServletContext context) { - servletContext = context; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/Settings.java b/trunk/core/src/main/java/org/apache/struts2/config/Settings.java deleted file mode 100644 index 69f63df41..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/Settings.java +++ /dev/null @@ -1,228 +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.config; - -import java.util.Iterator; -import java.util.Locale; -import java.util.StringTokenizer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; - -import com.opensymphony.xwork2.ObjectFactory; - - -/** - * Handles all Struts config properties. Implementation of this class is pluggable (the - * default implementation is {@link DefaultSettings}). This gives developers to ability to customize how - * Struts properties are set and retrieved. As an example, a developer may wish to check a separate property - * store before delegating to the Struts one.

    - *

    - * Key methods:

      - *

      - *

    • {@link #getLocale()}
    • - *
    • {@link #get(String)}
    • - *
    • {@link #set(String, String)}
    • - *
    • {@link #list()}
    - *

    - * Key methods for subclassers:

      - *

      - *

    • {@link #getImpl(String)}
    • - *
    • {@link #setImpl(String, String)}
    • - *
    • {@link #listImpl()}
    • - *
    • {@link #isSetImpl(String)}
    - */ -public class Settings { - - static Settings settingsImpl; - static Settings defaultImpl; - static Locale locale; // Cached locale - private static final Log LOG = LogFactory.getLog(Settings.class); - - - /** - * Sets the current settings implementation. Can only be called once. - * - * @param config a Settings implementation - * @throws IllegalStateException if an error occurs when setting the settings implementation. - */ - public static void setInstance(Settings config) throws IllegalStateException { - settingsImpl = config; - locale = null; // Reset cached locale - } - - /** - * Gets the current settings implementation. - * - * @return the current settings implementation. - */ - public static Settings getInstance() { - return (settingsImpl == null) ? getDefaultInstance() : settingsImpl; - } - - /** - * Returns the Struts locale. Keys off the property struts.locale which should be set - * as the Java {@link java.util.Locale#toString() toString()} representation of a Locale object (i.e., - * "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr_MAC", etc).

    - *

    - * If no locale is specified then the default VM locale is used ({@link java.util.Locale#getDefault()}). - * - * @return the Struts locale if specified or the VM default locale. - */ - public static Locale getLocale() { - if (locale == null) { - try { - StringTokenizer localeTokens = new StringTokenizer(get(StrutsConstants.STRUTS_LOCALE), "_"); - String lang = null; - String country = null; - - if (localeTokens.hasMoreTokens()) { - lang = localeTokens.nextToken(); - } - - if (localeTokens.hasMoreTokens()) { - country = localeTokens.nextToken(); - } - - locale = new Locale(lang, country); - } catch (Throwable t) { - // Default - LOG.warn("Setting locale to the default locale"); - locale = Locale.getDefault(); - } - } - - return locale; - } - - /** - * Determines whether or not a value has been set. Useful for testing for the existance of parameter without - * throwing an IllegalArgumentException. - * - * @param name the name of the property to test. - * @return true if the property exists and has a value, false otherwise. - */ - public static boolean isSet(String name) { - return getInstance().isSetImpl(name); - } - - /** - * Returns a property as an Object. This will throw an IllegalArgumentException if an error occurs - * while retrieveing the property or if the property doesn't exist. - * - * @param name the name of the property to get. - * @return the property as an Object. - * @throws IllegalArgumentException if an error occurs retrieveing the property or the property does not exist. - */ - public static String get(String name) throws IllegalArgumentException { - String val = getInstance().getImpl(name); - - return val; - } - - /** - * Returns an Iterator of all properties names. - * - * @return an Iterator of all properties names. - */ - public static Iterator list() { - return getInstance().listImpl(); - } - - /** - * Implementation of the {@link #isSet(String)} method. - * - * @see #isSet(String) - */ - public boolean isSetImpl(String name) { - // this is dumb.. maybe it should just throw an unsupported op like the rest of the *Impl - // methods in this class. - return false; - } - - /** - * Sets a property. Throws an exception if an error occurs when setting the property or if the - * Settings implementation does not support setting properties. - * - * @param name the name of the property to set. - * @param value the property to set. - * @throws IllegalArgumentException if an error occurs when setting the property. - * @throws UnsupportedOperationException if the config implementation does not support setting properties. - */ - public static void set(String name, String value) throws IllegalArgumentException, UnsupportedOperationException { - getInstance().setImpl(name, value); - } - - /** - * Implementation of the {@link #set(String, String)} method. - * - * @see #set(String, String) - */ - public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException { - throw new UnsupportedOperationException("This settings does not support updating a setting"); - } - - /** - * Implementation of the {@link #get(String)} method. - * - * @see #get(String) - */ - public String getImpl(String aName) throws IllegalArgumentException { - return null; - } - - /** - * Implementation of the {@link #list()} method. - * - * @see #list() - */ - public Iterator listImpl() { - throw new UnsupportedOperationException("This settings does not support listing the settings"); - } - - private static Settings getDefaultInstance() { - if (defaultImpl == null) { - // Create bootstrap implementation - defaultImpl = new DefaultSettings(); - - // Create default implementation - try { - String className = get(StrutsConstants.STRUTS_CONFIGURATION); - - if (!className.equals(defaultImpl.getClass().getName())) { - try { - // singleton instances shouldn't be built accessing request or session-specific context data - defaultImpl = (Settings) ObjectFactory.getObjectFactory().buildBean(Thread.currentThread().getContextClassLoader().loadClass(className), null); - } catch (Exception e) { - LOG.error("Could not instantiate settings", e); - } - } - } catch (IllegalArgumentException ex) { - // ignore - } - } - - return defaultImpl; - } - - public static void reset() { - defaultImpl = null; - settingsImpl = null; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java b/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java deleted file mode 100644 index 021bbd6a2..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Created on Aug 12, 2004 by mgreer - */ -package org.apache.struts2.config; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; - -/** - * Override Xwork class so we can use an arbitrary config file - */ -public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { - - private static final Log LOG = LogFactory.getLog(StrutsXmlConfigurationProvider.class); - private File baseDir = null; - private String filename; - - /** - * Constructs the configuration provider - * - * @param errorIfMissing If we should throw an exception if the file can't be found - */ - public StrutsXmlConfigurationProvider(boolean errorIfMissing) { - this("struts.xml", errorIfMissing); - } - - /** - * Constructs the configuration provider - * - * @param filename The filename to look for - * @param errorIfMissing If we should throw an exception if the file can't be found - */ - public StrutsXmlConfigurationProvider(String filename, boolean errorIfMissing) { - super(filename, errorIfMissing); - this.filename = filename; - Map dtdMappings = new HashMap(getDtdMappings()); - dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.0//EN", "struts-2.0.dtd"); - setDtdMappings(dtdMappings); - File file = new File(filename); - if (file.getParent() != null) { - this.baseDir = file.getParentFile(); - } - } - - /** - * Look for the configuration file on the classpath and in the file system - * - * @param fileName The file name to retrieve - * @see com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#getInputStream(java.lang.String) - */ - @Override - protected Iterator getConfigurationUrls(String fileName) throws IOException { - URL url = null; - if (baseDir != null) { - url = findInFileSystem(fileName); - if (url == null) { - return super.getConfigurationUrls(fileName); - } - } - if (url != null) { - List list = new ArrayList(); - list.add(url); - return list.iterator(); - } else { - return super.getConfigurationUrls(fileName); - } - } - - protected URL findInFileSystem(String fileName) throws IOException { - URL url = null; - File file = new File(fileName); - if (LOG.isDebugEnabled()) { - LOG.debug("Trying to load file " + file); - } - - // Trying relative path to original file - if (!file.exists()) { - file = new File(baseDir, fileName); - } - if (file.exists()) { - try { - url = file.toURL(); - } catch (MalformedURLException e) { - throw new IOException("Unable to convert "+file+" to a URL"); - } - } - return url; - } - - /** - * Overrides needs reload to ensure it is only checked once per request - */ - @Override - public boolean needsReload() { - ActionContext ctx = ActionContext.getContext(); - String key = "configurationReload-"+filename; - if (ctx.get(key) == null) { - ctx.put(key, Boolean.TRUE); - return super.needsReload(); - } - return false; - - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/config/package.html b/trunk/core/src/main/java/org/apache/struts2/config/package.html deleted file mode 100644 index decba7738..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/config/package.html +++ /dev/null @@ -1 +0,0 @@ -Classes for Struts configuration and property handling. diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java deleted file mode 100644 index e1c37749b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java +++ /dev/null @@ -1,155 +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.dispatcher; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.profiling.UtilTimerStack; - -/** - * - * Special filter designed to work with the {@link FilterDispatcher} and allow - * for easier integration with SiteMesh. Normally, ordering your filters to have - * SiteMesh go first, and then {@link FilterDispatcher} go second is perfectly fine. - * However, sometimes you may wish to access Struts features, including the - * value stack, from within your SiteMesh decorators. Because {@link FilterDispatcher} - * cleans up the {@link ActionContext}, your decorator won't have access to the - * date you want. - *

    - *

    - * By adding this filter, the {@link FilterDispatcher} will know to not clean up and - * instead defer cleanup to this filter. The ordering of the filters should then be: - *

    - *

      - *
    • this filter
    • - *
    • SiteMesh filter
    • - *
    • {@link FilterDispatcher}
    • - *
    - * - * - * @version $Date$ $Id$ - * - * @see FilterDispatcher - */ -public class ActionContextCleanUp implements Filter { - - private static final Log LOG = LogFactory.getLog(ActionContextCleanUp.class); - - private static final String COUNTER = "__cleanup_recursion_counter"; - - protected FilterConfig filterConfig; - protected Dispatcher dispatcher; - - /** - * Initializes the filter - * - * @param filterConfig The filter configuration - */ - public void init(FilterConfig filterConfig) throws ServletException { - this.filterConfig = filterConfig; - dispatcher = new Dispatcher(filterConfig.getServletContext()); - } - - - /** - * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) - */ - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { - - HttpServletRequest request = (HttpServletRequest) req; - HttpServletResponse response = (HttpServletResponse) res; - - String timerKey = "ActionContextCleanUp_doFilter: "; - try { - UtilTimerStack.push(timerKey); - - // prepare the request no matter what - this ensures that the proper character encoding - // is used before invoking the mapper (see WW-9127) - Dispatcher.setInstance(dispatcher); - dispatcher.prepare(request, response); - - ServletContext servletContext = filterConfig.getServletContext(); - try { - request = dispatcher.wrapRequest(request, servletContext); - } catch (IOException e) { - String message = "Could not wrap servlet request with MultipartRequestWrapper!"; - LOG.error(message, e); - throw new ServletException(message, e); - } - - try { - Integer count = (Integer)request.getAttribute(COUNTER); - if (count == null) { - count = new Integer(1); - } - else { - count = new Integer(count.intValue()+1); - } - request.setAttribute(COUNTER, count); - chain.doFilter(request, response); - } finally { - int counterVal = ((Integer)request.getAttribute(COUNTER)).intValue(); - counterVal -= 1; - request.setAttribute(COUNTER, new Integer(counterVal)); - cleanUp(request); - } - } - finally { - UtilTimerStack.pop(timerKey); - } - } - - /** - * Clean up the request of threadlocals if this is the last execution - * - * @param req The servlet request - */ - protected static void cleanUp(ServletRequest req) { - // should we clean up yet? - if (req.getAttribute(COUNTER) != null && - ((Integer)req.getAttribute(COUNTER)).intValue() > 0 ) { - return; - } - - // always dontClean up the thread request, even if an action hasn't been executed - ActionContext.setContext(null); - - Dispatcher.setInstance(null); - } - - - /* (non-Javadoc) - * @see javax.servlet.Filter#destroy() - */ - public void destroy() { - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java deleted file mode 100644 index 79e782f39..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java +++ /dev/null @@ -1,191 +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.dispatcher; - -import java.io.Serializable; -import java.util.AbstractMap; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletContext; - - -/** - * A simple implementation of the {@link java.util.Map} interface to handle a collection of attributes and - * init parameters in a {@link javax.servlet.ServletContext} object. The {@link #entrySet()} method - * enumerates over all servlet context attributes and init parameters and returns a collection of both. - * Note, this will occur lazily - only when the entry set is asked for. - * - */ -public class ApplicationMap extends AbstractMap implements Serializable { - - private static final long serialVersionUID = 9136809763083228202L; - - private ServletContext context; - private Set entries; - - - /** - * Creates a new map object given the servlet context. - * - * @param ctx the servlet context - */ - public ApplicationMap(ServletContext ctx) { - this.context = ctx; - } - - - /** - * Removes all entries from the Map and removes all attributes from the servlet context. - */ - public void clear() { - entries = null; - - Enumeration e = context.getAttributeNames(); - - while (e.hasMoreElements()) { - context.removeAttribute(e.nextElement().toString()); - } - } - - /** - * Creates a Set of all servlet context attributes as well as context init parameters. - * - * @return a Set of all servlet context attributes as well as context init parameters. - */ - public Set entrySet() { - if (entries == null) { - entries = new HashSet(); - - // Add servlet context attributes - Enumeration enumeration = context.getAttributeNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = context.getAttribute(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - context.setAttribute(key.toString(), obj); - - return value; - } - }); - } - - // Add servlet context init params - enumeration = context.getInitParameterNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = context.getInitParameter(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - context.setAttribute(key.toString(), obj); - - return value; - } - }); - } - } - - return entries; - } - - /** - * Returns the servlet context attribute or init parameter based on the given key. If the - * entry is not found, null is returned. - * - * @param key the entry key. - * @return the servlet context attribute or init parameter or null if the entry is not found. - */ - public Object get(Object key) { - // Try context attributes first, then init params - // This gives the proper shadowing effects - String keyString = key.toString(); - Object value = context.getAttribute(keyString); - - return (value == null) ? context.getInitParameter(keyString) : value; - } - - /** - * Sets a servlet context attribute given a attribute name and value. - * - * @param key the name of the attribute. - * @param value the value to set. - * @return the attribute that was just set. - */ - public Object put(Object key, Object value) { - entries = null; - context.setAttribute(key.toString(), value); - - return get(key); - } - - /** - * Removes the specified servlet context attribute. - * - * @param key the attribute to remove. - * @return the entry that was just removed. - */ - public Object remove(Object key) { - entries = null; - - Object value = get(key); - context.removeAttribute(key.toString()); - - return value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java deleted file mode 100644 index 91164aa29..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java +++ /dev/null @@ -1,69 +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.dispatcher; - - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts2.ServletActionContext; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * A simple action support class that sets properties to be able to serve - */ -public class DefaultActionSupport extends ActionSupport { - - private static final long serialVersionUID = -2426166391283746095L; - - private String successResultValue; - - - /** - * Constructor - */ - public DefaultActionSupport() { - super(); - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.ActionSupport#execute() - */ - public String execute() throws Exception { - HttpServletRequest request = ServletActionContext.getRequest(); - String requestedUrl = request.getPathInfo(); - if (successResultValue == null) successResultValue = requestedUrl; - return SUCCESS; - } - - /** - * @return Returns the successResultValue. - */ - public String getSuccessResultValue() { - return successResultValue; - } - - /** - * @param successResultValue The successResultValue to set. - */ - public void setSuccessResultValue(String successResultValue) { - this.successResultValue = successResultValue; - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java deleted file mode 100644 index 64884216a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ /dev/null @@ -1,670 +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.dispatcher; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.StrutsStatics; -import org.apache.struts2.config.Settings; -import org.apache.struts2.config.StrutsXmlConfigurationProvider; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.dispatcher.multipart.MultiPartRequest; -import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper; -import org.apache.struts2.impl.StrutsActionProxyFactory; -import org.apache.struts2.impl.StrutsObjectFactory; -import org.apache.struts2.util.AttributeMap; -import org.apache.struts2.util.ObjectFactoryDestroyable; -import org.apache.struts2.util.ObjectFactoryInitializable; -import org.apache.struts2.views.freemarker.FreemarkerManager; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; -import com.opensymphony.xwork2.util.FileManager; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.ActionProxyFactory; -import com.opensymphony.xwork2.ObjectFactory; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.config.ConfigurationException; -import com.opensymphony.xwork2.config.ConfigurationManager; -import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; -import com.opensymphony.xwork2.util.LocalizedTextUtil; -import com.opensymphony.xwork2.util.ObjectTypeDeterminer; -import com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.ValueStackFactory; -import com.opensymphony.xwork2.util.XWorkContinuationConfig; -import com.opensymphony.xwork2.util.location.Location; -import com.opensymphony.xwork2.util.location.LocationUtils; -import com.opensymphony.xwork2.util.profiling.UtilTimerStack; - -import freemarker.template.Template; - -/** - * A utility class the actual dispatcher delegates most of its tasks to. Each instance - * of the primary dispatcher holds an instance of this dispatcher to be shared for - * all requests. - * - * @see org.apache.struts2.dispatcher.FilterDispatcher - * @see org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher - */ -public class Dispatcher { - - // Set Struts-specific factories. - static { - ObjectFactory.setObjectFactory(new StrutsObjectFactory()); - ActionProxyFactory.setFactory(new StrutsActionProxyFactory()); - } - - private static final Log LOG = LogFactory.getLog(Dispatcher.class); - - private static ThreadLocal instance = new ThreadLocal(); - private static List dispatcherListeners = - new ArrayList(); - - private ConfigurationManager configurationManager; - private static boolean portletSupportActive; - private boolean devMode = false; - - // used to get WebLogic to play nice - private boolean paramsWorkaroundEnabled = false; - - /** - * Gets the current instance for this thread - * - * @return The dispatcher instance - */ - public static Dispatcher getInstance() { - return (Dispatcher) instance.get(); - } - - /** - * Sets the dispatcher instance for this thread - * - * @param instance The instance - */ - public static void setInstance(Dispatcher instance) { - Dispatcher.instance.set(instance); - } - - /** - * Adds a dispatcher lifecycle listener - * - * @param l The listener - */ - public static synchronized void addDispatcherListener(DispatcherListener l) { - dispatcherListeners.add(l); - } - - /** - * Removes a dispatcher lifecycle listener - * - * @param l The listener - */ - public static synchronized void removeDispatcherListener(DispatcherListener l) { - dispatcherListeners.remove(l); - } - - /** - * The constructor with its servlet context instance (optional) - * - * @param servletContext The servlet context - */ - public Dispatcher(ServletContext servletContext) { - init(servletContext); - } - - /** - * Cleans up thread local variables - */ - public void cleanup() { - ObjectFactory objectFactory = ObjectFactory.getObjectFactory(); - if (objectFactory == null) { - LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed"); - } - if (objectFactory instanceof ObjectFactoryDestroyable) { - try { - ((ObjectFactoryDestroyable)objectFactory).destroy(); - } - catch(Exception e) { - // catch any exception that may occured during destroy() and log it - LOG.error("exception occurred while destroying ObjectFactory ["+objectFactory+"]", e); - } - } - instance.set(null); - synchronized(Dispatcher.class) { - if (dispatcherListeners.size() > 0) { - for (DispatcherListener l : dispatcherListeners) { - l.dispatcherDestroyed(this); - } - } - } - } - - /** - * Initializes the instance - * - * @param servletContext The servlet context - */ - private void init(ServletContext servletContext) { - boolean reloadi18n = Boolean.valueOf((String) Settings.get(StrutsConstants.STRUTS_I18N_RELOAD)).booleanValue(); - LocalizedTextUtil.setReloadBundles(reloadi18n); - - if (Settings.isSet(StrutsConstants.STRUTS_OBJECTFACTORY)) { - String className = (String) Settings.get(StrutsConstants.STRUTS_OBJECTFACTORY); - if (className.equals("spring")) { - // note: this class name needs to be in string form so we don't put hard - // dependencies on spring, since it isn't technically required. - className = "org.apache.struts2.spring.StrutsSpringObjectFactory"; - } else if (className.equals("plexus")) { - className = "org.apache.struts2.plexus.PlexusObjectFactory"; - LOG.warn("The 'plexus' shorthand for the Plexus ObjectFactory is deprecated. Please " - +"use the full class name: "+className); - } - - try { - Class clazz = ClassLoaderUtil.loadClass(className, Dispatcher.class); - ObjectFactory objectFactory = (ObjectFactory) clazz.newInstance(); - if (servletContext != null) { - if (objectFactory instanceof ObjectFactoryInitializable) { - ((ObjectFactoryInitializable) objectFactory).init(servletContext); - } - } - ObjectFactory.setObjectFactory(objectFactory); - } catch (Exception e) { - LOG.error("Could not load ObjectFactory named " + className + ". Using default ObjectFactory.", e); - } - } - - if (Settings.isSet(StrutsConstants.STRUTS_OBJECTTYPEDETERMINER)) { - String className = (String) Settings.get(StrutsConstants.STRUTS_OBJECTTYPEDETERMINER); - if (className.equals("tiger")) { - // note: this class name needs to be in string form so we don't put hard - // dependencies on xwork-tiger, since it isn't technically required. - className = "com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer"; - } - else if (className.equals("notiger")) { - className = "com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"; - } - - try { - Class clazz = ClassLoaderUtil.loadClass(className, Dispatcher.class); - ObjectTypeDeterminer objectTypeDeterminer = (ObjectTypeDeterminer) clazz.newInstance(); - ObjectTypeDeterminerFactory.setInstance(objectTypeDeterminer); - } catch (Exception e) { - LOG.error("Could not load ObjectTypeDeterminer named " + className + ". Using default DefaultObjectTypeDeterminer.", e); - } - } - - if ("true".equals(Settings.get(StrutsConstants.STRUTS_DEVMODE))) { - devMode = true; - Settings.set(StrutsConstants.STRUTS_I18N_RELOAD, "true"); - Settings.set(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, "true"); - } - - //check for configuration reloading - if ("true".equalsIgnoreCase(Settings.get(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD))) { - FileManager.setReloadingConfigs(true); - } - - if (Settings.isSet(StrutsConstants.STRUTS_CONTINUATIONS_PACKAGE)) { - String pkg = Settings.get(StrutsConstants.STRUTS_CONTINUATIONS_PACKAGE); - ObjectFactory.setContinuationPackage(pkg); - } - - // test wether param-access workaround needs to be enabled - if (servletContext != null && servletContext.getServerInfo() != null - && servletContext.getServerInfo().indexOf("WebLogic") >= 0) { - LOG.info("WebLogic server detected. Enabling Struts parameter access work-around."); - paramsWorkaroundEnabled = true; - } else if (Settings.isSet(StrutsConstants.STRUTS_DISPATCHER_PARAMETERSWORKAROUND)) { - paramsWorkaroundEnabled = "true".equals(Settings.get(StrutsConstants.STRUTS_DISPATCHER_PARAMETERSWORKAROUND)); - } else { - LOG.debug("Parameter access work-around disabled."); - } - - configurationManager = new ConfigurationManager(); - String configFiles = null; - if (Settings.isSet(StrutsConstants.STRUTS_CONFIGURATION_FILES)) { - configFiles = Settings.get(StrutsConstants.STRUTS_CONFIGURATION_FILES); - } - if (configFiles != null) { - String[] files = configFiles.split("\\s*[,]\\s*"); - for (String file : files) { - if ("xwork.xml".equals(file)) { - configurationManager.addConfigurationProvider(new XmlConfigurationProvider(file, false)); - } else { - configurationManager.addConfigurationProvider(new StrutsXmlConfigurationProvider(file, false)); - } - } - } - - synchronized(Dispatcher.class) { - if (dispatcherListeners.size() > 0) { - for (DispatcherListener l : dispatcherListeners) { - l.dispatcherInitialized(this); - } - } - } - } - - /** - * Loads the action and executes it. This method first creates the action context from the given - * parameters then loads an ActionProxy from the given action name and namespace. After that, - * the action is executed and output channels throught the response object. Actions not found are - * sent back to the user via the {@link Dispatcher#sendError} method, using the 404 return code. - * All other errors are reported by throwing a ServletException. - * - * @param request the HttpServletRequest object - * @param response the HttpServletResponse object - * @param mapping the action mapping object - * @throws ServletException when an unknown error occurs (not a 404, but typically something that - * would end up as a 5xx by the servlet container) - */ - public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { - Map extraContext = createContextMap(request, response, mapping, context); - - // If there was a previous value stack, then create a new copy and pass it in to be used by the new Action - ValueStack stack = (ValueStack) request.getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY); - if (stack != null) { - extraContext.put(ActionContext.VALUE_STACK, ValueStackFactory.getFactory().createValueStack(stack)); - } - - String timerKey = "Handling request from Dispatcher"; - try { - UtilTimerStack.push(timerKey); - String namespace = mapping.getNamespace(); - String name = mapping.getName(); - String method = mapping.getMethod(); - - String id = request.getParameter(XWorkContinuationConfig.CONTINUE_PARAM); - if (id != null) { - // remove the continue key from the params - we don't want to bother setting - // on the value stack since we know it won't work. Besides, this breaks devMode! - Map params = (Map) extraContext.get(ActionContext.PARAMETERS); - params.remove(XWorkContinuationConfig.CONTINUE_PARAM); - - // and now put the key in the context to be picked up later by XWork - extraContext.put(XWorkContinuationConfig.CONTINUE_KEY, id); - } - - ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy( - configurationManager.getConfiguration(), namespace, name, extraContext, true, false); - proxy.setMethod(method); - request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack()); - - // if the ActionMapping says to go straight to a result, do it! - if (mapping.getResult() != null) { - Result result = mapping.getResult(); - result.execute(proxy.getInvocation()); - } else { - proxy.execute(); - } - - // If there was a previous value stack then set it back onto the request - if (stack != null) { - request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); - } - } catch (ConfigurationException e) { - LOG.error("Could not find action or result", e); - sendError(request, response, context, HttpServletResponse.SC_NOT_FOUND, e); - } catch (Exception e) { - LOG.error("Could not execute action", e); - sendError(request, response, context, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e); - } finally { - UtilTimerStack.pop(timerKey); - } - } - - /** - * Creates a context map containing all the wrapped request objects - * - * @param request The servlet request - * @param response The servlet response - * @param mapping The action mapping - * @param context The servlet context - * @return A map of context objects - */ - public Map createContextMap(HttpServletRequest request, HttpServletResponse response, - ActionMapping mapping, ServletContext context) { - // request map wrapping the http request objects - Map requestMap = new RequestMap(request); - - // parameters map wrapping the http paraneters. - Map params = null; - if (mapping != null) { - params = mapping.getParams(); - } - Map requestParams = new HashMap(request.getParameterMap()); - if (params != null) { - params.putAll(requestParams); - } else { - params = requestParams; - } - - // session map wrapping the http session - Map session = new SessionMap(request); - - // application map wrapping the ServletContext - Map application = new ApplicationMap(context); - - Map extraContext = createContextMap(requestMap, params, session, application, request, response, context); - extraContext.put(ServletActionContext.ACTION_MAPPING, mapping); - return extraContext; - } - - /** - * Merges all application and servlet attributes into a single HashMap to represent the entire - * Action context. - * - * @param requestMap a Map of all request attributes. - * @param parameterMap a Map of all request parameters. - * @param sessionMap a Map of all session attributes. - * @param applicationMap a Map of all servlet context attributes. - * @param request the HttpServletRequest object. - * @param response the HttpServletResponse object. - * @param servletContext the ServletContextmapping object. - * @return a HashMap representing the Action context. - */ - public HashMap createContextMap(Map requestMap, - Map parameterMap, - Map sessionMap, - Map applicationMap, - HttpServletRequest request, - HttpServletResponse response, - ServletContext servletContext) { - HashMap extraContext = new HashMap(); - extraContext.put(ActionContext.PARAMETERS, new HashMap(parameterMap)); - extraContext.put(ActionContext.SESSION, sessionMap); - extraContext.put(ActionContext.APPLICATION, applicationMap); - - Locale locale = null; - if (Settings.isSet(StrutsConstants.STRUTS_LOCALE)) { - locale = LocalizedTextUtil.localeFromString(Settings.get(StrutsConstants.STRUTS_LOCALE), request.getLocale()); - } else { - locale = request.getLocale(); - } - - extraContext.put(ActionContext.LOCALE, locale); - extraContext.put(ActionContext.DEV_MODE, Boolean.valueOf(devMode)); - - extraContext.put(StrutsStatics.HTTP_REQUEST, request); - extraContext.put(StrutsStatics.HTTP_RESPONSE, response); - extraContext.put(StrutsStatics.SERVLET_CONTEXT, servletContext); - - // helpers to get access to request/session/application scope - extraContext.put("request", requestMap); - extraContext.put("session", sessionMap); - extraContext.put("application", applicationMap); - extraContext.put("parameters", parameterMap); - - AttributeMap attrMap = new AttributeMap(extraContext); - extraContext.put("attr", attrMap); - - return extraContext; - } - - /** - * Returns the maximum upload size allowed for multipart requests (this is configurable). - * - * @return the maximum upload size allowed for multipart requests - */ - private static int getMaxSize() { - Integer maxSize = new Integer(Integer.MAX_VALUE); - try { - String maxSizeStr = Settings.get(StrutsConstants.STRUTS_MULTIPART_MAXSIZE); - - if (maxSizeStr != null) { - try { - maxSize = new Integer(maxSizeStr); - } catch (NumberFormatException e) { - LOG.warn("Unable to format 'struts.multipart.maxSize' property setting. Defaulting to Integer.MAX_VALUE"); - } - } else { - LOG.warn("Unable to format 'struts.multipart.maxSize' property setting. Defaulting to Integer.MAX_VALUE"); - } - } catch (IllegalArgumentException e1) { - LOG.warn("Unable to format 'struts.multipart.maxSize' property setting. Defaulting to Integer.MAX_VALUE"); - } - - if (LOG.isDebugEnabled()) { - LOG.debug("maxSize=" + maxSize); - } - - return maxSize.intValue(); - } - - /** - * Returns the path to save uploaded files to (this is configurable). - * - * @return the path to save uploaded files to - */ - private String getSaveDir(ServletContext servletContext) { - String saveDir = Settings.get(StrutsConstants.STRUTS_MULTIPART_SAVEDIR).trim(); - - if (saveDir.equals("")) { - File tempdir = (File) servletContext.getAttribute("javax.servlet.context.tempdir"); - LOG.info("Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir"); - - if (tempdir != null) { - saveDir = tempdir.toString(); - } - } else { - File multipartSaveDir = new File(saveDir); - - if (!multipartSaveDir.exists()) { - multipartSaveDir.mkdir(); - } - } - - if (LOG.isDebugEnabled()) { - LOG.debug("saveDir=" + saveDir); - } - - return saveDir; - } - - /** - * Prepares a request, including setting the encoding and locale - * - * @param request The request - * @param response The response - */ - public void prepare(HttpServletRequest request, HttpServletResponse response) { - String encoding = null; - if (Settings.isSet(StrutsConstants.STRUTS_I18N_ENCODING)) { - encoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - } - - Locale locale = null; - if (Settings.isSet(StrutsConstants.STRUTS_LOCALE)) { - locale = LocalizedTextUtil.localeFromString(Settings.get(StrutsConstants.STRUTS_LOCALE), request.getLocale()); - } - - if (encoding != null) { - try { - request.setCharacterEncoding(encoding); - } catch (Exception e) { - LOG.error("Error setting character encoding to '" + encoding + "' - ignoring.", e); - } - } - - if (locale != null) { - response.setLocale(locale); - } - - if (paramsWorkaroundEnabled) { - request.getParameter("foo"); // simply read any parameter (existing or not) to "prime" the request - } - } - - /** - * Wraps and returns the given response or returns the original response object. This is used to transparently - * handle multipart data as a wrapped class around the given request. Override this method to handle multipart - * requests in a special way or to handle other types of requests. Note, {@link org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper} is - * flexible - you should look to that first before overriding this method to handle multipart data. - * - * @param request the HttpServletRequest object. - * @return a wrapped request or original request. - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper - */ - public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { - // don't wrap more than once - if (request instanceof StrutsRequestWrapper) { - return request; - } - - if (MultiPartRequest.isMultiPart(request)) { - request = new MultiPartRequestWrapper(request, getSaveDir(servletContext), getMaxSize()); - } else { - request = new StrutsRequestWrapper(request); - } - - return request; - } - - /** - * Sends an HTTP error response code. - * - * @param request the HttpServletRequest object. - * @param response the HttpServletResponse object. - * @param code the HttpServletResponse error code (see {@link javax.servlet.http.HttpServletResponse} for possible error codes). - * @param e the Exception that is reported. - */ - public void sendError(HttpServletRequest request, HttpServletResponse response, - ServletContext ctx, int code, Exception e) { - if (devMode) { - response.setContentType("text/html"); - - try { - freemarker.template.Configuration config = FreemarkerManager.getInstance().getConfiguration(ctx); - Template template = config.getTemplate("/org/apache/struts2/dispatcher/error.ftl"); - - List chain = new ArrayList(); - Throwable cur = e; - chain.add(cur); - while ((cur = cur.getCause()) != null) { - chain.add(cur); - } - - HashMap data = new HashMap(); - data.put("exception", e); - data.put("unknown", Location.UNKNOWN); - data.put("chain", chain); - data.put("locator", new Locator()); - template.process(data, response.getWriter()); - response.getWriter().close(); - } catch (Exception exp) { - try { - response.sendError(code, "Unable to show problem report: " + exp); - } catch (IOException ex) { - // we're already sending an error, not much else we can do if more stuff breaks - } - } - } else { - try { - // send a http error response to use the servlet defined error handler - // make the exception availible to the web.xml defined error page - request.setAttribute("javax.servlet.error.exception", e); - - // for compatibility - request.setAttribute("javax.servlet.jsp.jspException", e); - - // send the error response - response.sendError(code, e.getMessage()); - } catch (IOException e1) { - // we're already sending an error, not much else we can do if more stuff breaks - } - } - } - - /** - * Returns true, if portlet support is active, false otherwise. - * - * @return true, if portlet support is active, false otherwise. - */ - public boolean isPortletSupportActive() { - return portletSupportActive; - } - - /** - * Set the flag that portlet support is active or not. - * @param portletSupportActive true or false - */ - public static void setPortletSupportActive(boolean portletSupportActive) { - Dispatcher.portletSupportActive = portletSupportActive; - } - - /** Simple accessor for a static method */ - public class Locator { - public Location getLocation(Object obj) { - Location loc = LocationUtils.getLocation(obj); - if (loc == null) { - return Location.UNKNOWN; - } - return loc; - } - } - - /** - * Gets the current configuration manager instance - * - * @return The instance - */ - public ConfigurationManager getConfigurationManager() { - return configurationManager; - } - - /** - * Sets the current configuration manager instance - * - * @param mgr The configuration manager - */ - public void setConfigurationManager(ConfigurationManager mgr) { - this.configurationManager = mgr; - } - - /** - * @return the devMode - */ - public boolean isDevMode() { - return devMode; - } - - /** - * @param devMode the devMode to set - */ - public void setDevMode(boolean devMode) { - this.devMode = devMode; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java deleted file mode 100644 index 1030cef47..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java +++ /dev/null @@ -1,39 +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.dispatcher; - -/** - * A interface to tag those that want to execute code on the init and - * destory of a Dispatcher. - */ -public interface DispatcherListener { - - /** - * Called when the dispatcher is initialized - * - * @param du The dispatcher instance - */ - public void dispatcherInitialized(Dispatcher du); - - /** - * Called when the dispatcher is destroyed - * - * @param du The dispatcher instance - */ - public void dispatcherDestroyed(Dispatcher du); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java deleted file mode 100644 index 5ce84e727..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java +++ /dev/null @@ -1,399 +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.dispatcher; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URLDecoder; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.StringTokenizer; -import java.util.TimeZone; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.RequestUtils; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.StrutsStatics; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.mapper.ActionMapper; -import org.apache.struts2.dispatcher.mapper.ActionMapperFactory; -import org.apache.struts2.dispatcher.mapper.ActionMapping; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; -import com.opensymphony.xwork2.util.profiling.UtilTimerStack; -import com.opensymphony.xwork2.ActionContext; - -/** - * Master filter for Struts that handles four distinct - * responsibilities: - * - *
      - * - *
    • Executing actions
    • - * - *
    • Cleaning up the {@link ActionContext} (see note)
    • - * - *
    • Serving static content
    • - * - *
    • Kicking off XWork's interceptor chain for the request lifecycle
    • - * - *
    - * - *

    IMPORTANT: this filter must be mapped to all requests. Unless you know exactly what you are doing, always - * map to this URL pattern: /* - * - *

    Executing actions - * - *

    This filter executes actions by consulting the {@link ActionMapper} and determining if the requested URL should - * invoke an action. If the mapper indicates it should, the rest of the filter chain is stopped and the action is - * invoked. This is important, as it means that filters like the SiteMesh filter must be placed before this - * filter or they will not be able to decorate the output of actions. - * - *

    Cleaning up the {@link ActionContext} - * - *

    This filter will also automatically clean up the {@link ActionContext} for you, ensuring that no memory leaks - * take place. However, this can sometimes cause problems integrating with other products like SiteMesh. See {@link - * ActionContextCleanUp} for more information on how to deal with this. - * - *

    Serving static content - * - *

    This filter also serves common static content needed when using various parts of Struts, such as JavaScript - * files, CSS files, etc. It works by looking for requests to /struts/*, and then mapping the value after "/struts/" - * to common packages in Struts and, optionally, in your class path. By default, the following packages are - * automatically searched: - * - *

      - * - *
    • org.apache.struts2.static
    • - * - *
    • template
    • - * - *
    - * - *

    This means that you can simply request /struts/xhtml/styles.css and the XHTML UI theme's default stylesheet - * will be returned. Likewise, many of the AJAX UI components require various JavaScript files, which are found in the - * org.apache.struts2.static package. If you wish to add additional packages to be searched, you can add a comma - * separated (space, tab and new line will do as well) list in the filter init parameter named "packages". Be - * careful, however, to expose any packages that may have sensitive information, such as properties file with - * database access credentials. - * - *

    - * - * To use a custom {@link Dispatcher}, the createDispatcher() method could be overriden by - * the subclass. - * - * @see org.apache.struts2.lifecycle.LifecycleListener - * @see ActionMapper - * @see ActionContextCleanUp - * - * @version $Date$ $Id$ - */ -public class FilterDispatcher implements Filter, StrutsStatics { - private static final Log LOG = LogFactory.getLog(FilterDispatcher.class); - - private FilterConfig filterConfig; - private String[] pathPrefixes; - private Dispatcher dispatcher; - - private SimpleDateFormat df = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss"); - private final Calendar lastModifiedCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - private final String lastModified = df.format(lastModifiedCal.getTime()); - - /** - * Gets this filter's configuration - * - * @return The filter config - */ - protected FilterConfig getFilterConfig() { - return filterConfig; - } - - /** - * Cleans up the dispatcher - */ - public void destroy() { - if (dispatcher == null) { - LOG.warn("something is seriously wrong, DispatcherUtil is not initialized (null) "); - } else { - dispatcher.cleanup(); - } - } - - /** - * Initializes the dispatcher and filter - */ - public void init(FilterConfig filterConfig) throws ServletException { - this.filterConfig = filterConfig; - String param = filterConfig.getInitParameter("packages"); - String packages = "org.apache.struts2.static template org.apache.struts2.interceptor.debugging"; - if (param != null) { - packages = param + " " + packages; - } - this.pathPrefixes = parse(packages); - dispatcher = createDispatcher(); - } - - /** - * Parses the list of packages - * - * @param packages A comma-delimited String - * @return A string array of packages - */ - protected String[] parse(String packages) { - if (packages == null) { - return null; - } - List pathPrefixes = new ArrayList(); - - StringTokenizer st = new StringTokenizer(packages, ", \n\t"); - while (st.hasMoreTokens()) { - String pathPrefix = st.nextToken().replace('.', '/'); - if (!pathPrefix.endsWith("/")) { - pathPrefix += "/"; - } - pathPrefixes.add(pathPrefix); - } - - return (String[]) pathPrefixes.toArray(new String[pathPrefixes.size()]); - } - - - /* (non-Javadoc) - * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) - */ - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { - HttpServletRequest request = (HttpServletRequest) req; - HttpServletResponse response = (HttpServletResponse) res; - ServletContext servletContext = filterConfig.getServletContext(); - - String timerKey = "FilterDispatcher_doFilter: "; - try { - UtilTimerStack.push(timerKey); - Dispatcher du = Dispatcher.getInstance(); - - // Prepare and wrap the request if the cleanup filter hasn't already - if (du == null) { - du = dispatcher; - // prepare the request no matter what - this ensures that the proper character encoding - // is used before invoking the mapper (see WW-9127) - du.prepare(request, response); - - try { - // Wrap request first, just in case it is multipart/form-data - // parameters might not be accessible through before encoding (ww-1278) - request = du.wrapRequest(request, servletContext); - } catch (IOException e) { - String message = "Could not wrap servlet request with MultipartRequestWrapper!"; - LOG.error(message, e); - throw new ServletException(message, e); - } - Dispatcher.setInstance(du); - } - - ActionMapper mapper = null; - ActionMapping mapping = null; - try { - mapper = ActionMapperFactory.getMapper(); - mapping = mapper.getMapping(request, du.getConfigurationManager()); - } catch (Exception ex) { - du.sendError(request, response, servletContext, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex); - ActionContextCleanUp.cleanUp(req); - return; - } - - if (mapping == null) { - // there is no action in this request, should we look for a static resource? - String resourcePath = RequestUtils.getServletPath(request); - - if ("".equals(resourcePath) && null != request.getPathInfo()) { - resourcePath = request.getPathInfo(); - } - - if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)) - && resourcePath.startsWith("/struts")) { - String name = resourcePath.substring("/struts".length()); - findStaticResource(name, response); - } else { - // this is a normal request, let it pass through - chain.doFilter(request, response); - } - // The framework did its job here - return; - } - - - try { - dispatcher.serviceAction(request, response, servletContext, mapping); - } finally { - ActionContextCleanUp.cleanUp(req); - } - } - finally { - UtilTimerStack.pop(timerKey); - } - } - - /** - * Servlet 2.3 specifies that the servlet context can be retrieved from the session. Unfortunately, some versions of - * WebLogic can only retrieve the servlet context from the filter config. Hence, this method enables subclasses to - * retrieve the servlet context from other sources. - * - * @param session the HTTP session where, in Servlet 2.3, the servlet context can be retrieved - * @return the servlet context. - */ - protected ServletContext getServletContext(HttpSession session) { - return filterConfig.getServletContext(); - } - - /** - * Fins a static resource - * - * @param name The resource name - * @param response The request - * @throws IOException If anything goes wrong - */ - protected void findStaticResource(String name, HttpServletResponse response) throws IOException { - if (!name.endsWith(".class")) { - for (int i = 0; i < pathPrefixes.length; i++) { - InputStream is = findInputStream(name, pathPrefixes[i]); - if (is != null) { - // set the content-type header - String contentType = getContentType(name); - if (contentType != null) { - response.setContentType(contentType); - } - - if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE))) { - // set heading information for caching static content - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - response.setHeader("Date",df.format(cal.getTime())+" GMT"); - cal.add(Calendar.DAY_OF_MONTH,1); - response.setHeader("Expires",df.format(cal.getTime())+" GMT"); - response.setHeader("Retry-After",df.format(cal.getTime())+" GMT"); - response.setHeader("Cache-Control","public"); - response.setHeader("Last-Modified",lastModified+" GMT"); - } - else { - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setHeader("Expires","-1"); - } - - try { - copy(is, response.getOutputStream()); - } finally { - is.close(); - } - return; - } - } - } - - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - - /** - * Determines the content type for the resource name - * - * @param name The resource name - * @return The mime type - */ - protected String getContentType(String name) { - // NOT using the code provided activation.jar to avoid adding yet another dependency - // this is generally OK, since these are the main files we server up - if (name.endsWith(".js")) { - return "text/javascript"; - } else if (name.endsWith(".css")) { - return "text/css"; - } else if (name.endsWith(".html")) { - return "text/html"; - } else if (name.endsWith(".txt")) { - return "text/plain"; - } else if (name.endsWith(".gif")) { - return "image/gif"; - } else if (name.endsWith(".jpg") || name.endsWith(".jpeg")) { - return "image/jpeg"; - } else if (name.endsWith(".png")) { - return "image/png"; - } else { - return null; - } - } - - /** - * Copies the from the input stream to the output stream - * - * @param input The input stream - * @param output The output stream - * @throws IOException If anything goes wrong - */ - protected void copy(InputStream input, OutputStream output) throws IOException { - final byte[] buffer = new byte[4096]; - int n; - while (-1 != (n = input.read(buffer))) { - output.write(buffer, 0, n); - } - } - - /** - * Looks for a static resource in the classpath - * - * @param name The resource name - * @param packagePrefix The package prefix to use to locate the resource - * @return The inputstream of the resource - * @throws IOException If there is a problem locating the resource - */ - protected InputStream findInputStream(String name, String packagePrefix) throws IOException { - String resourcePath; - if (packagePrefix.endsWith("/") && name.startsWith("/")) { - resourcePath = packagePrefix + name.substring(1); - } else { - resourcePath = packagePrefix + name; - } - - String enc = (String) Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - resourcePath = URLDecoder.decode(resourcePath, enc); - - return ClassLoaderUtil.getResourceAsStream(resourcePath, getClass()); - } - - /** - * Create a {@link Dispatcher}, this serves as a hook for subclass to overried - * such that a custom {@link Dispatcher} could be created. - * - * @return Dispatcher - */ - protected Dispatcher createDispatcher() { - return new Dispatcher(filterConfig.getServletContext()); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java deleted file mode 100644 index 9063bb903..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java +++ /dev/null @@ -1,104 +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.dispatcher; - -import javax.servlet.Filter; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.config.ServletContextSingleton; - - -/** - * When running Weblogic Server 6.1, this class should be - * specified in web.xml instead of {@link FilterDispatcher}. - *

    - * This class properly handles the weblogic.jar handling - * of servlet filters. There is one serious incompatibility, and - * that is that while {@link FilterDispatcher#init(FilterConfig)} - * throws a {@link ServletException}, this class's method - * {@link #setFilterConfig(FilterConfig)} does not throw - * the exception. Since {@link #setFilterConfig(FilterConfig)} - * invokes {@link FilterDispatcher#init(FilterConfig)}, the setter - * must "swallow" the exception. This it does by logging the - * exception as an error. - * - */ -public class FilterDispatcherCompatWeblogic61 - extends FilterDispatcher - implements Filter { - - private static Log log = - LogFactory.getLog(FilterDispatcherCompatWeblogic61.class); - - /** - * dummy setter for {@link #filterConfig}; this method - * sets up the {@link org.apache.struts2.config.ServletContextSingleton} with - * the servlet context from the filter configuration. - *

    - * This is needed by Weblogic Server 6.1 because it - * uses a slightly obsolete Servlet 2.3-minus spec - * whose {@link Filter} interface requires this method. - *

    - * - * @param filterConfig the filter configuration. - */ - public void setFilterConfig(FilterConfig filterConfig) { - try { - init(filterConfig); - } catch (ServletException se) { - log.error("Couldn't set the filter configuration in this filter", se); - } - - ServletContextSingleton singleton = ServletContextSingleton.getInstance(); - singleton.setServletContext(filterConfig.getServletContext()); - } - - /** - * answers the servlet context. - *

    - * Servlet 2.3 specifies that this can be retrieved from - * the session. Unfortunately, weblogic.jar can only retrieve - * the servlet context from the filter config. Hence, this - * returns the servlet context from the singleton that was - * setup by {@link #setFilterConfig(FilterConfig)}. - * - * @param session the HTTP session. Not used - * @return the servlet context. - */ - protected ServletContext getServletContext(HttpSession session) { - ServletContextSingleton singleton = - ServletContextSingleton.getInstance(); - return singleton.getServletContext(); - } - - /** - * This method is required by Weblogic 6.1 SP4 because - * they defined this as a required method just before - * the Servlet 2.3 specification was finalized. - * - * @return the filter's filter configuration - */ - public FilterConfig getFilterConfig() { - return super.getFilterConfig(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java deleted file mode 100644 index 4c4540920..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java +++ /dev/null @@ -1,157 +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.dispatcher; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.ServletActionContext; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.util.TextParseUtil; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * - * - * A custom Result type for setting HTTP headers and status by optionally evaluating against the ValueStack. - * - * - *

    - * This result type takes the following parameters: - * - * - * - *

      - * - *
    • status - the http servlet response status code that should be set on a response.
    • - * - *
    • parse - true by default. If set to false, the headers param will not be parsed for Ognl expressions.
    • - * - *
    • headers - header values.
    • - * - *
    - * - * - * - * Example: - * - *
    
    - * <result name="success" type="httpheader">
    - *   <param name="status">204</param>
    - *   <param name="headers.a">a custom header value</param>
    - *   <param name="headers.b">another custom header value</param>
    - * </result>
    - * 
    - * - */ -public class HttpHeaderResult implements Result { - - private static final long serialVersionUID = 195648957144219214L; - - /** The default parameter */ - public static final String DEFAULT_PARAM = "status"; - - - private boolean parse = true; - private Map headers; - private int status = -1; - - public HttpHeaderResult() { - super(); - headers = new HashMap(); - } - - public HttpHeaderResult(int status) { - this(); - this.status = status; - this.parse = false; - } - - - /** - * Returns a Map of all HTTP headers. - * - * @return a Map of all HTTP headers. - */ - public Map getHeaders() { - return headers; - } - - /** - * Sets whether or not the HTTP header values should be evaluated against the ValueStack (by default they are). - * - * @param parse true if HTTP header values should be evaluated agains the ValueStack, false - * otherwise. - */ - public void setParse(boolean parse) { - this.parse = parse; - } - - /** - * Sets the http servlet response status code that should be set on a response. - * - * @param status the Http status code - * @see javax.servlet.http.HttpServletResponse#setStatus(int) - */ - public void setStatus(int status) { - this.status = status; - } - - /** - * Adds an HTTP header to the response - * @param name - * @param value - */ - public void addHeader(String name, String value) { - headers.put(name, value); - } - - /** - * Sets the optional HTTP response status code and also re-sets HTTP headers after they've - * been optionally evaluated against the ValueStack. - * - * @param invocation an encapsulation of the action execution state. - * @throws Exception if an error occurs when re-setting the headers. - */ - public void execute(ActionInvocation invocation) throws Exception { - HttpServletResponse response = ServletActionContext.getResponse(); - - if (status != -1) { - response.setStatus(status); - } - - if (headers != null) { - ValueStack stack = ActionContext.getContext().getValueStack(); - - for (Iterator iterator = headers.entrySet().iterator(); - iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - String value = (String) entry.getValue(); - String finalValue = parse ? TextParseUtil.translateVariables(value, stack) : value; - response.addHeader((String) entry.getKey(), finalValue); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java deleted file mode 100644 index 62490a4f0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java +++ /dev/null @@ -1,167 +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.dispatcher; - -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.nio.charset.Charset; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionInvocation; - -/** - * - * - * A result that send the content out as plain text. Usefull typically when needed - * to display the raw content of a JSP or Html file for example. - * - * - * - * - * - * - *
      - *
    • location (default) = location of the file (jsp/html) to be displayed as plain text.
    • - *
    • charSet (optional) = character set to be used. This character set will be used to set the - * response type (eg. Content-Type=text/plain; charset=UTF-8) and when reading - * using a Reader. Some example of charSet would be UTF-8, ISO-8859-1 etc. - *
    - * - * - * - * - *
    - * 
    - * 
    - * <action name="displayJspRawContent" >
    - *   <result type="plaintext">/myJspFile.jsp</result>
    - * </action>
    - * 
    - * 
    - * <action name="displayJspRawContent" >
    - *   <result type="plaintext">
    - *      <param name="location">/myJspFile.jsp</param>
    - *      <param name="charSet">UTF-8</param>
    - *   </result>
    - * </action>
    - * 
    - * 
    - * 
    - * - */ -public class PlainTextResult extends StrutsResultSupport { - - public static final int BUFFER_SIZE = 1024; - - private static final Log _log = LogFactory.getLog(PlainTextResult.class); - - private static final long serialVersionUID = 3633371605905583950L; - - private String charSet; - - public PlainTextResult() { - super(); - } - - public PlainTextResult(String location) { - super(location); - } - - /** - * Set the character set - * - * @return The character set - */ - public String getCharSet() { - return charSet; - } - - /** - * Set the character set - * - * @param charSet The character set - */ - public void setCharSet(String charSet) { - this.charSet = charSet; - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation) - */ - protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - - // verify charset - Charset charset = null; - if (charSet != null) { - if (Charset.isSupported(charSet)) { - charset = Charset.forName(charSet); - } - else { - _log.warn("charset ["+charSet+"] is not recognized "); - charset = null; - } - } - - HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE); - ServletContext servletContext = (ServletContext) invocation.getInvocationContext().get(SERVLET_CONTEXT); - - - if (charset != null) { - response.setContentType("text/plain; charset="+charSet); - } - else { - response.setContentType("text/plain"); - } - response.setHeader("Content-Disposition", "inline"); - - - PrintWriter writer = response.getWriter(); - InputStreamReader reader = null; - try { - if (charset != null) { - reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation), charset); - } - else { - reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation)); - } - if (reader == null) { - _log.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! "); - } - else { - char[] buffer = new char[BUFFER_SIZE]; - int charRead = 0; - while((charRead = reader.read(buffer)) != -1) { - writer.write(buffer, 0, charRead); - } - } - } - finally { - if (reader != null) - reader.close(); - if (writer != null) { - writer.flush(); - writer.close(); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java deleted file mode 100644 index a4183b52b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java +++ /dev/null @@ -1,146 +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.dispatcher; - -import java.io.Serializable; -import java.util.AbstractMap; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; - - -/** - * A simple implementation of the {@link java.util.Map} interface to handle a collection of request attributes. - */ -public class RequestMap extends AbstractMap implements Serializable { - - private static final long serialVersionUID = -7675640869293787926L; - - private Set entries; - private HttpServletRequest request; - - - /** - * Saves the request to use as the backing for getting and setting values - * - * @param request the http servlet request. - */ - public RequestMap(final HttpServletRequest request) { - this.request = request; - } - - - /** - * Removes all attributes from the request as well as clears entries in this map. - */ - public void clear() { - entries = null; - Enumeration keys = request.getAttributeNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - request.removeAttribute(key); - } - } - - /** - * Returns a Set of attributes from the http request. - * - * @return a Set of attributes from the http request. - */ - public Set entrySet() { - if (entries == null) { - entries = new HashSet(); - - Enumeration enumeration = request.getAttributeNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = request.getAttribute(key); - entries.add(new Entry() { - public boolean equals(Object obj) { - Entry entry = (Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - request.setAttribute(key.toString(), obj); - - return value; - } - }); - } - } - - return entries; - } - - /** - * Returns the request attribute associated with the given key or null if it doesn't exist. - * - * @param key the name of the request attribute. - * @return the request attribute or null if it doesn't exist. - */ - public Object get(Object key) { - return request.getAttribute(key.toString()); - } - - /** - * Saves an attribute in the request. - * - * @param key the name of the request attribute. - * @param value the value to set. - * @return the object that was just set. - */ - public Object put(Object key, Object value) { - entries = null; - request.setAttribute(key.toString(), value); - - return get(key); - } - - /** - * Removes the specified request attribute. - * - * @param key the name of the attribute to remove. - * @return the value that was removed or null if the value was not found (and hence, not removed). - */ - public Object remove(Object key) { - entries = null; - - Object value = get(key); - request.removeAttribute(key.toString()); - - return value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java deleted file mode 100644 index 33222a810..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java +++ /dev/null @@ -1,240 +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.dispatcher; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.struts2.dispatcher.mapper.ActionMapper; -import org.apache.struts2.dispatcher.mapper.ActionMapperFactory; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.views.util.UrlHelper; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.config.entities.ResultConfig; - -/** - * - * - * This result uses the {@link ActionMapper} provided by the {@link ActionMapperFactory} to redirect the browser to a - * URL that invokes the specified action and (optional) namespace. This is better than the {@link ServletRedirectResult} - * because it does not require you to encode the URL patterns processed by the {@link ActionMapper} in to your struts.xml - * configuration files. This means you can change your URL patterns at any point and your application will still work. - * It is strongly recommended that if you are redirecting to another action, you use this result rather than the - * standard redirect result. - * - *

    - * - * To pass parameters, the <param> ... </param> tag. The following parameters will not be - * passable becuase they are part of the config param for this particular result. - * - *

      - *
    • actionName
    • - *
    • namespace
    • - *
    • method
    • - *
    • encode
    • - *
    • parse
    • - *
    • location
    • - *
    • prependServletContext
    • - *
    - * - * See examples below for an example of how request parameters could be passed in. - * - * - * - * This result type takes the following parameters: - * - * - * - *
      - * - *
    • actionName (default) - the name of the action that will be redirect to
    • - * - *
    • namespace - used to determine which namespace the action is in that we're redirecting to . If namespace is - * null, this defaults to the current namespace
    • - * - *
    - * - * - * - * Example: - * - *
    
    - * <package name="public" extends="struts-default">
    - *     <action name="login" class="...">
    - *         <!-- Redirect to another namespace -->
    - *         <result type="redirect-action">
    - *             <param name="actionName">dashboard</param>
    - *             <param name="namespace">/secure</param>
    - *         </result>
    - *     </action>
    - * </package>
    - *
    - * <package name="secure" extends="struts-default" namespace="/secure">
    - *     <-- Redirect to an action in the same namespace -->
    - *     <action name="dashboard" class="...">
    - *         <result>dashboard.jsp</result>
    - *         <result name="error" type="redirect-action>error</result>
    - *     </action>
    - *
    - *     <action name="error" class="...">
    - *         <result>error.jsp</result>
    - *     </action>
    - * </package>
    - *
    - * <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
    - * 	  <-- Pass parameters (reportType, width and height) -->
    - *    <!--
    - *    The redirect-action url generated will be :
    - *    /genReport/generateReport.action?reportType=pie&width=100&height=100
    - *    -->
    - *    <action name="gatherReportInfo" class="...">
    - *       <result name="showReportResult" type="redirect-action">
    - *       	<param name="actionName">generateReport</param>
    - *          <param name="namespace=">/genReport</param>
    - *          <param name="reportType">pie</param>
    - *          <param name="width">100</param>
    - *          <param name="height">100</param>
    - *       </result>
    - *    </action>
    - * </package>
    - *
    - *
    - * 
    - * - * @see ActionMapper - */ -public class ServletActionRedirectResult extends ServletRedirectResult { - - private static final long serialVersionUID = -9042425229314584066L; - - /** The default parameter */ - public static final String DEFAULT_PARAM = "actionName"; - - protected String actionName; - protected String namespace; - protected String method; - - private Map requestParameters = new HashMap(); - - public ServletActionRedirectResult() { - super(); - } - - public ServletActionRedirectResult(String actionName) { - this(null, actionName, null); - } - - public ServletActionRedirectResult(String actionName, String method) { - this(null, actionName, method); - } - - public ServletActionRedirectResult(String namespace, String actionName, String method) { - super(null); - this.namespace = namespace; - this.actionName = actionName; - this.method = method; - } - - protected List prohibitedResultParam = Arrays.asList(new String[] { - DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", - "prependServletContext" }); - - /** - * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation) - */ - public void execute(ActionInvocation invocation) throws Exception { - actionName = conditionalParse(actionName, invocation); - if (namespace == null) { - namespace = invocation.getProxy().getNamespace(); - } else { - namespace = conditionalParse(namespace, invocation); - } - if (method == null) { - method = ""; - } - else { - method = conditionalParse(method, invocation); - } - - String resultCode = invocation.getResultCode(); - if (resultCode != null) { - ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get( - resultCode); - Map resultConfigParams = resultConfig.getParams(); - for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext(); ) { - Map.Entry e = (Map.Entry) i.next(); - if (! prohibitedResultParam.contains(e.getKey())) { - requestParameters.put(e.getKey().toString(), - e.getValue() == null ? "": - conditionalParse(e.getValue().toString(), invocation)); - } - } - } - - ActionMapper mapper = ActionMapperFactory.getMapper(); - StringBuffer tmpLocation = new StringBuffer(mapper.getUriFromActionMapping(new ActionMapping(actionName, namespace, method, null))); - UrlHelper.buildParametersString(requestParameters, tmpLocation, "&"); - - setLocation(tmpLocation.toString()); - - super.execute(invocation); - } - - /** - * Sets the action name - * - * @param actionName The name - */ - public void setActionName(String actionName) { - this.actionName = actionName; - } - - /** - * Sets the namespace - * - * @param namespace The namespace - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * Sets the method - * - * @param method The method - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * Adds a request parameter to be added to the redirect url - * - * @param key The parameter name - * @param value The parameter value - */ - public ServletActionRedirectResult addParameter(String key, Object value) { - requestParameters.put(key, String.valueOf(value)); - return this; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java deleted file mode 100644 index 4efd35227..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java +++ /dev/null @@ -1,142 +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.dispatcher; - -import javax.servlet.RequestDispatcher; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.PageContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; - -import com.opensymphony.xwork2.ActionInvocation; - - -/** - * - * - * Includes or forwards to a view (usually a jsp). Behind the scenes Struts - * will use a RequestDispatcher, where the target servlet/JSP receives the same - * request/response objects as the original servlet/JSP. Therefore, you can pass - * data between them using request.setAttribute() - the Struts action is - * available. - *

    - * There are three possible ways the result can be executed: - * - *

      - * - *
    • If we are in the scope of a JSP (a PageContext is available), PageContext's - * {@link PageContext#include(String) include} method is called.
    • - * - *
    • If there is no PageContext and we're not in any sort of include (there is no - * "javax.servlet.include.servlet_path" in the request attributes), then a call to - * {@link RequestDispatcher#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) forward} - * is made.
    • - * - *
    • Otherwise, {@link RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) include} - * is called.
    • - * - *
    - * - * - * This result type takes the following parameters: - * - * - * - *
      - * - *
    • location (default) - the location to go to after execution (ex. jsp).
    • - * - *
    • parse - true by default. If set to false, the location param will not be parsed for Ognl expressions.
    • - * - *
    - * - * - * - * Example: - * - *
    
    - * <result name="success" type="dispatcher">
    - *   <param name="location">foo.jsp</param>
    - * </result>
    - * 
    - * - * This result follows the same rules from {@link StrutsResultSupport}. - * - * @see javax.servlet.RequestDispatcher - */ -public class ServletDispatcherResult extends StrutsResultSupport { - - private static final long serialVersionUID = -1970659272360685627L; - - private static final Log log = LogFactory.getLog(ServletDispatcherResult.class); - - public ServletDispatcherResult() { - super(); - } - - public ServletDispatcherResult(String location) { - super(location); - } - - /** - * Dispatches to the given location. Does its forward via a RequestDispatcher. If the - * dispatch fails a 404 error will be sent back in the http response. - * - * @param finalLocation the location to dispatch to. - * @param invocation the execution state of the action - * @throws Exception if an error occurs. If the dispatch fails the error will go back via the - * HTTP request. - */ - public void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - if (log.isDebugEnabled()) { - log.debug("Forwarding to location " + finalLocation); - } - - PageContext pageContext = ServletActionContext.getPageContext(); - - if (pageContext != null) { - pageContext.include(finalLocation); - } else { - HttpServletRequest request = ServletActionContext.getRequest(); - HttpServletResponse response = ServletActionContext.getResponse(); - RequestDispatcher dispatcher = request.getRequestDispatcher(finalLocation); - - // if the view doesn't exist, let's do a 404 - if (dispatcher == null) { - response.sendError(404, "result '" + finalLocation + "' not found"); - - return; - } - - // If we're included, then include the view - // Otherwise do forward - // This allow the page to, for example, set content type - if (!response.isCommitted() && (request.getAttribute("javax.servlet.include.servlet_path") == null)) { - request.setAttribute("struts.view_uri", finalLocation); - request.setAttribute("struts.request_uri", request.getRequestURI()); - - dispatcher.forward(request, response); - } else { - dispatcher.include(request, response); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java deleted file mode 100644 index 5eee5b9b3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ /dev/null @@ -1,146 +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.dispatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.mapper.ActionMapperFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; - - -/** - * - * - * Calls the {@link HttpServletResponse#sendRedirect(String) sendRedirect} - * method to the location specified. The response is told to redirect the - * browser to the specified location (a new request from the client). The - * consequence of doing this means that the action (action instance, action - * errors, field errors, etc) that was just executed is lost and no longer - * available. This is because actions are built on a single-thread model. The - * only way to pass data is through the session or with web parameters - * (url?name=value) which can be OGNL expressions. - * - * - *

    - * This result type takes the following parameters: - * - * - * - *

      - * - *
    • location (default) - the location to go to after execution.
    • - * - *
    • parse - true by default. If set to false, the location param will - * not be parsed for Ognl expressions.
    • - * - *
    - * - *

    - * This result follows the same rules from {@link StrutsResultSupport}. - *

    - * - * - * - * Example: - * - *
    
    - * <result name="success" type="redirect">
    - *   <param name="location">foo.jsp</param>
    - *   <param name="parse">false</param>
    - * </result>
    - * 
    - * - */ -public class ServletRedirectResult extends StrutsResultSupport { - - private static final long serialVersionUID = 6316947346435301270L; - - private static final Log log = LogFactory.getLog(ServletRedirectResult.class); - - protected boolean prependServletContext = true; - - public ServletRedirectResult() { - super(); - } - - public ServletRedirectResult(String location) { - super(location); - } - - /** - * Sets whether or not to prepend the servlet context path to the redirected URL. - * - * @param prependServletContext true to prepend the location with the servlet context path, - * false otherwise. - */ - public void setPrependServletContext(boolean prependServletContext) { - this.prependServletContext = prependServletContext; - } - - /** - * Redirects to the location specified by calling {@link HttpServletResponse#sendRedirect(String)}. - * - * @param finalLocation the location to redirect to. - * @param invocation an encapsulation of the action execution state. - * @throws Exception if an error occurs when redirecting. - */ - protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - ActionContext ctx = invocation.getInvocationContext(); - HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST); - HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE); - - if (isPathUrl(finalLocation)) { - if (!finalLocation.startsWith("/")) { - String namespace = ActionMapperFactory.getMapper().getMapping( - request, Dispatcher.getInstance().getConfigurationManager()).getNamespace(); - - if ((namespace != null) && (namespace.length() > 0) && (!"/".equals(namespace))) { - finalLocation = namespace + "/" + finalLocation; - } else { - finalLocation = "/" + finalLocation; - } - } - - // if the URL's are relative to the servlet context, append the servlet context path - if (prependServletContext && (request.getContextPath() != null) && (request.getContextPath().length() > 0)) { - finalLocation = request.getContextPath() + finalLocation; - } - - finalLocation = response.encodeRedirectURL(finalLocation); - } - - if (log.isDebugEnabled()) { - log.debug("Redirecting to finalLocation " + finalLocation); - } - - response.sendRedirect(finalLocation); - } - - private static boolean isPathUrl(String url) { - // filter out "http:", "https:", "mailto:", "file:", "ftp:" - // since the only valid places for : in URL's is before the path specification - // either before the port, or after the protocol - return (url.indexOf(':') == -1); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java deleted file mode 100644 index 81fa69d29..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java +++ /dev/null @@ -1,204 +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.dispatcher; - -import java.io.Serializable; -import java.util.AbstractMap; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - - -/** - * A simple implementation of the {@link java.util.Map} interface to handle a collection of HTTP session - * attributes. The {@link #entrySet()} method enumerates over all session attributes and creates a Set of entries. - * Note, this will occur lazily - only when the entry set is asked for. - * - */ -public class SessionMap extends AbstractMap implements Serializable { - - private static final long serialVersionUID = 4678843241638046854L; - - protected HttpSession session; - protected Set entries; - protected HttpServletRequest request; - - - /** - * Creates a new session map given a http servlet request. Note, ths enumeration of request - * attributes will occur when the map entries are asked for. - * - * @param request the http servlet request object. - */ - public SessionMap(HttpServletRequest request) { - // note, holding on to this request and relying on lazy session initalization will not work - // if you are running your action invocation in a background task, such as using the - // "exec-and-wait" interceptor - this.request = request; - this.session = request.getSession(false); - } - - /** - * Invalidate the http session. - */ - public void invalidate() { - if (session == null) { - return; - } - - synchronized (session) { - session.invalidate(); - session = null; - entries = null; - } - } - - /** - * Removes all attributes from the session as well as clears entries in this - * map. - */ - public void clear() { - if (session == null ) { - return; - } - - synchronized (session) { - entries = null; - Enumeration attributeNamesEnum = session.getAttributeNames(); - while(attributeNamesEnum.hasMoreElements()) { - session.removeAttribute(attributeNamesEnum.nextElement()); - } - } - - } - - /** - * Returns a Set of attributes from the http session. - * - * @return a Set of attributes from the http session. - */ - public Set entrySet() { - if (session == null) { - return Collections.EMPTY_SET; - } - - synchronized (session) { - if (entries == null) { - entries = new HashSet(); - - Enumeration enumeration = session.getAttributeNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = session.getAttribute(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - session.setAttribute(key.toString(), obj); - - return value; - } - }); - } - } - } - - return entries; - } - - /** - * Returns the session attribute associated with the given key or null if it doesn't exist. - * - * @param key the name of the session attribute. - * @return the session attribute or null if it doesn't exist. - */ - public Object get(Object key) { - if (session == null) { - return null; - } - - synchronized (session) { - return session.getAttribute(key.toString()); - } - } - - /** - * Saves an attribute in the session. - * - * @param key the name of the session attribute. - * @param value the value to set. - * @return the object that was just set. - */ - public Object put(Object key, Object value) { - synchronized (this) { - if (session == null) { - session = request.getSession(true); - } - } - - synchronized (session) { - entries = null; - session.setAttribute(key.toString(), value); - - return get(key); - } - } - - /** - * Removes the specified session attribute. - * - * @param key the name of the attribute to remove. - * @return the value that was removed or null if the value was not found (and hence, not removed). - */ - public Object remove(Object key) { - if (session == null) { - return null; - } - - synchronized (session) { - entries = null; - - Object value = get(key); - session.removeAttribute(key.toString()); - - return value; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java deleted file mode 100644 index 6f4f0a044..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java +++ /dev/null @@ -1,239 +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.dispatcher; - -import java.io.InputStream; -import java.io.OutputStream; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionInvocation; - -/** - * - * - * A custom Result type for send raw data (via an InputStream) directly to the - * HttpServletResponse. Very useful for allowing users to download content. - * - * - *

    - * This result type takes the following parameters: - * - * - * - *

      - * - *
    • contentType - the stream mime-type as sent to the web browser - * (default = text/plain).
    • - * - *
    • contentLength - the stream length in bytes (the browser displays a - * progress bar).
    • - * - *
    • contentDispostion - the content disposition header value for - * specifing the file name (default = inline, values are typically - * filename="document.pdf".
    • - * - *
    • inputName - the name of the InputStream property from the chained - * action (default = inputStream).
    • - * - *
    • bufferSize - the size of the buffer to copy from input to output - * (default = 1024).
    • - * - *
    - * - * - * - * Example: - * - *
    
    - * <result name="success" type="stream">
    - *   <param name="contentType">image/jpeg</param>
    - *   <param name="inputName">imageStream</param>
    - *   <param name="contentDisposition">filename="document.pdf"</param>
    - *   <param name="bufferSize">1024</param>
    - * </result>
    - * 
    - * - */ -public class StreamResult extends StrutsResultSupport { - - private static final long serialVersionUID = -1468409635999059850L; - - protected static final Log log = LogFactory.getLog(StreamResult.class); - - protected String contentType = "text/plain"; - protected String contentLength; - protected String contentDisposition = "inline"; - protected String inputName = "inputStream"; - protected InputStream inputStream; - protected int bufferSize = 1024; - - public StreamResult() { - super(); - } - - public StreamResult(InputStream in) { - this.inputStream = in; - } - - /** - * @return Returns the bufferSize. - */ - public int getBufferSize() { - return (bufferSize); - } - - /** - * @param bufferSize The bufferSize to set. - */ - public void setBufferSize(int bufferSize) { - this.bufferSize = bufferSize; - } - - /** - * @return Returns the contentType. - */ - public String getContentType() { - return (contentType); - } - - /** - * @param contentType The contentType to set. - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * @return Returns the contentLength. - */ - public String getContentLength() { - return contentLength; - } - - /** - * @param contentLength The contentLength to set. - */ - public void setContentLength(String contentLength) { - this.contentLength = contentLength; - } - - /** - * @return Returns the Content-disposition header value. - */ - public String getContentDisposition() { - return contentDisposition; - } - - /** - * @param contentDisposition the Content-disposition header value to use. - */ - public void setContentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - } - - /** - * @return Returns the inputName. - */ - public String getInputName() { - return (inputName); - } - - /** - * @param inputName The inputName to set. - */ - public void setInputName(String inputName) { - this.inputName = inputName; - } - - /** - * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation) - */ - protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - - OutputStream oOutput = null; - - try { - if (inputStream == null) { - // Find the inputstream from the invocation variable stack - inputStream = (InputStream) invocation.getStack().findValue(conditionalParse(inputName, invocation)); - } - - if (inputStream == null) { - String msg = ("Can not find a java.io.InputStream with the name [" + inputName + "] in the invocation stack. " + - "Check the tag specified for this action."); - log.error(msg); - throw new IllegalArgumentException(msg); - } - - // Find the Response in context - HttpServletResponse oResponse = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE); - - // Set the content type - oResponse.setContentType(conditionalParse(contentType, invocation)); - - // Set the content length - if (contentLength != null) { - String _contentLength = conditionalParse(contentLength, invocation); - int _contentLengthAsInt = -1; - try { - _contentLengthAsInt = Integer.parseInt(_contentLength); - if (_contentLengthAsInt >= 0) { - oResponse.setContentLength(_contentLengthAsInt); - } - } - catch(NumberFormatException e) { - log.warn("failed to recongnize "+_contentLength+" as a number, contentLength header will not be set", e); - } - } - - // Set the content-disposition - if (contentDisposition != null) { - oResponse.addHeader("Content-disposition", conditionalParse(contentDisposition, invocation)); - } - - // Get the outputstream - oOutput = oResponse.getOutputStream(); - - if (log.isDebugEnabled()) { - log.debug("Streaming result [" + inputName + "] type=[" + contentType + "] length=[" + contentLength + - "] content-disposition=[" + contentDisposition + "]"); - } - - // Copy input to output - log.debug("Streaming to output buffer +++ START +++"); - byte[] oBuff = new byte[bufferSize]; - int iSize; - while (-1 != (iSize = inputStream.read(oBuff))) { - oOutput.write(oBuff, 0, iSize); - } - log.debug("Streaming to output buffer +++ END +++"); - - // Flush - oOutput.flush(); - } - finally { - if (inputStream != null) inputStream.close(); - if (oOutput != null) oOutput.close(); - } - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java deleted file mode 100644 index 7d002afdc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java +++ /dev/null @@ -1,85 +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.dispatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * All Struts requests are wrapped with this class, which provides simple JSTL accessibility. This is because JSTL - * works with request attributes, so this class delegates to the value stack except for a few cases where required to - * prevent infinite loops. Namely, we don't let any attribute name with "#" in it delegate out to the value stack, as it - * could potentially cause an infinite loop. For example, an infinite loop would take place if you called: - * request.getAttribute("#attr.foo"). - * - * - * - */ -public class StrutsRequestWrapper extends HttpServletRequestWrapper { - - /** - * The constructor - * @param req The request - */ - public StrutsRequestWrapper(HttpServletRequest req) { - super(req); - } - - /** - * Gets the object, looking in the value stack if not found - * - * @param s The attribute key - */ - public Object getAttribute(String s) { - if (s != null && s.startsWith("javax.servlet")) { - // don't bother with the standard javax.servlet attributes, we can short-circuit this - // see WW-953 and the forums post linked in that issue for more info - return super.getAttribute(s); - } - - ActionContext ctx = ActionContext.getContext(); - Object attribute = super.getAttribute(s); - - boolean alreadyIn = false; - Boolean b = (Boolean) ctx.get("__requestWrapper.getAttribute"); - if (b != null) { - alreadyIn = b.booleanValue(); - } - - // note: we don't let # come through or else a request for - // #attr.foo or #request.foo could cause an endless loop - if (!alreadyIn && attribute == null && s.indexOf("#") == -1) { - try { - // If not found, then try the ValueStack - ctx.put("__requestWrapper.getAttribute", Boolean.TRUE); - ValueStack stack = ctx.getValueStack(); - if (stack != null) { - attribute = stack.findValue(s); - } - } finally { - ctx.put("__requestWrapper.getAttribute", Boolean.FALSE); - } - } - return attribute; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java deleted file mode 100644 index ac1685f4d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java +++ /dev/null @@ -1,220 +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.dispatcher; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsStatics; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.util.TextParseUtil; - - -/** - * - * - * A base class for all Struts action execution results. - * The "location" param is the default parameter, meaning the most common usage of this result would be: - *

    - * This class provides two common parameters for any subclass: - *

      - *
    • location - the location to go to after execution (could be a jsp page or another action). - * It can be parsed as per the rules definied in the - * {@link TextParseUtil#translateVariables(java.lang.String, com.opensymphony.xwork2.util.ValueStack) translateVariables} - * method
    • - *
    • parse - true by default. If set to false, the location param will not be parsed for expressions
    • - *
    • encode - false by default. If set to false, the location param will not be url encoded. This only have effect when parse is true
    • - *
    - * - * NOTE: - * The encode param will only have effect when parse is true - * - * - * - *

    - * - * - * - *

    - * In the struts.xml configuration file, these would be included as: - *

    - *

    - *  <result name="success" type="redirect">
    - *      <param name="location">foo.jsp</param>
    - *  </result>
    - *

    - * or - *

    - *

    - *  <result name="success" type="redirect" >
    - *      <param name="location">foo.jsp?url=${myUrl}</param>
    - *      <param name="parse">true</param>
    - *      <param name="encode">true</param>
    - *  </result>
    - *

    - * In the above case, myUrl will be parsed against Ognl Value Stack and then - * URL encoded. - *

    - * or when using the default parameter feature - *

    - *

    - *  <result name="success" type="redirect">foo.jsp</result>
    - *

    - * You should subclass this class if you're interested in adding more parameters or functionality - * to your Result. If you do subclass this class you will need to - * override {@link #doExecute(String, ActionInvocation)}.

    - *

    - * Any custom result can be defined in struts.xml as: - *

    - *

    - *  <result-types>
    - *      ...
    - *      <result-type name="myresult" class="com.foo.MyResult" />
    - *  </result-types>
    - *

    - * Please see the {@link com.opensymphony.xwork2.Result} class for more info on Results in general. - * - * - * - * @see com.opensymphony.xwork2.Result - */ -public abstract class StrutsResultSupport implements Result, StrutsStatics { - - private static final Log _log = LogFactory.getLog(StrutsResultSupport.class); - - /** The default parameter */ - public static final String DEFAULT_PARAM = "location"; - - private boolean parse; - private boolean encode; - private String location; - private String lastFinalLocation; - - public StrutsResultSupport() { - this(null, true, false); - } - - public StrutsResultSupport(String location) { - this(location, false, false); - } - - public StrutsResultSupport(String location, boolean parse, boolean encode) { - this.location = location; - this.parse = parse; - this.encode = encode; - } - - /** - * The location to go to after action execution. This could be a JSP page or another action. - * The location can contain OGNL expressions which will be evaulated if the parse - * parameter is set to true. - * - * @param location the location to go to after action execution. - * @see #setParse(boolean) - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * Returns the last parsed and encoded location value - */ - public String getLastFinalLocation() { - return lastFinalLocation; - } - - /** - * Set parse to true to indicate that the location should be parsed as an OGNL expression. This - * is set to true by default. - * - * @param parse true if the location parameter is an OGNL expression, false otherwise. - */ - public void setParse(boolean parse) { - this.parse = parse; - } - - /** - * Set encode to true to indicate that the location should be url encoded. This is set to - * true by default - * - * @param encode true if the location parameter should be url encode, false otherwise. - */ - public void setEncode(boolean encode) { - this.encode = encode; - } - - /** - * Implementation of the execute method from the Result interface. This will call - * the abstract method {@link #doExecute(String, ActionInvocation)} after optionally evaluating the - * location as an OGNL evaluation. - * - * @param invocation the execution state of the action. - * @throws Exception if an error occurs while executing the result. - */ - public void execute(ActionInvocation invocation) throws Exception { - lastFinalLocation = conditionalParse(location, invocation); - doExecute(lastFinalLocation, invocation); - } - - /** - * Parses the parameter for OGNL expressions against the valuestack - * - * @param param The parameter value - * @param invocation The action invocation instance - * @return The resulting string - */ - protected String conditionalParse(String param, ActionInvocation invocation) { - if (parse && param != null && invocation != null) { - return TextParseUtil.translateVariables(param, invocation.getStack(), - new TextParseUtil.ParsedValueEvaluator() { - public Object evaluate(Object parsedValue) { - if (encode) { - if (parsedValue != null) { - try { - // use UTF-8 as this is the recommended encoding by W3C to - // avoid incompatibilities. - return URLEncoder.encode(parsedValue.toString(), "UTF-8"); - } - catch(UnsupportedEncodingException e) { - _log.warn("error while trying to encode ["+parsedValue+"]", e); - } - } - } - return parsedValue; - } - }); - } else { - return param; - } - } - - /** - * Executes the result given a final location (jsp page, action, etc) and the action invocation - * (the state in which the action was executed). Subclasses must implement this class to handle - * custom logic for result handling. - * - * @param finalLocation the location (jsp page, action, etc) to go to. - * @param invocation the execution state of the action. - * @throws Exception if an error occurs while executing the result. - */ - protected abstract void doExecute(String finalLocation, ActionInvocation invocation) throws Exception; -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java deleted file mode 100644 index b4a4dd246..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java +++ /dev/null @@ -1,222 +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.dispatcher; - -import java.io.OutputStreamWriter; -import java.io.Writer; - -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspFactory; -import javax.servlet.jsp.PageContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.views.JspSupportServlet; -import org.apache.struts2.views.velocity.VelocityManager; -import org.apache.velocity.Template; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.context.Context; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * - * - * Using the Servlet container's {@link JspFactory}, this result mocks a JSP - * execution environment and then displays a Velocity template that will be - * streamed directly to the servlet output. - * - * - *

    - * This result type takes the following parameters: - * - * - * - *

      - * - *
    • location (default) - the location of the template to process.
    • - * - *
    • parse - true by default. If set to false, the location param will - * not be parsed for Ognl expressions.
    • - * - *
    - *

    - * This result follows the same rules from {@link StrutsResultSupport}. - *

    - * - * - * - * Example: - * - *
    
    - * <result name="success" type="velocity">
    - *   <param name="location">foo.vm</param>
    - * </result>
    - * 
    - * - */ -public class VelocityResult extends StrutsResultSupport { - - private static final long serialVersionUID = 7268830767762559424L; - - private static final Log log = LogFactory.getLog(VelocityResult.class); - - public VelocityResult() { - super(); - } - - public VelocityResult(String location) { - super(location); - } - - /** - * Creates a Velocity context from the action, loads a Velocity template and executes the - * template. Output is written to the servlet output stream. - * - * @param finalLocation the location of the Velocity template - * @param invocation an encapsulation of the action execution state. - * @throws Exception if an error occurs when creating the Velocity context, loading or executing - * the template or writing output to the servlet response stream. - */ - public void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - ValueStack stack = ActionContext.getContext().getValueStack(); - - HttpServletRequest request = ServletActionContext.getRequest(); - HttpServletResponse response = ServletActionContext.getResponse(); - JspFactory jspFactory = null; - ServletContext servletContext = ServletActionContext.getServletContext(); - Servlet servlet = JspSupportServlet.jspSupportServlet; - - VelocityManager.getInstance().init(servletContext); - - boolean usedJspFactory = false; - PageContext pageContext = (PageContext) ActionContext.getContext().get(ServletActionContext.PAGE_CONTEXT); - - if (pageContext == null && servlet != null) { - jspFactory = JspFactory.getDefaultFactory(); - pageContext = jspFactory.getPageContext(servlet, request, response, null, true, 8192, true); - ActionContext.getContext().put(ServletActionContext.PAGE_CONTEXT, pageContext); - usedJspFactory = true; - } - - try { - String encoding = getEncoding(finalLocation); - String contentType = getContentType(finalLocation); - - if (encoding != null) { - contentType = contentType + ";charset=" + encoding; - } - - VelocityManager velocityManager = VelocityManager.getInstance(); - Template t = getTemplate(stack, velocityManager.getVelocityEngine(), invocation, finalLocation, encoding); - - Context context = createContext(velocityManager, stack, request, response, finalLocation); - Writer writer = new OutputStreamWriter(response.getOutputStream(), encoding); - - - response.setContentType(contentType); - - t.merge(context, writer); - - // always flush the writer (we used to only flush it if this was a jspWriter, but someone asked - // to do it all the time (WW-829). Since Velocity support is being deprecated, we'll oblige :) - writer.flush(); - } catch (Exception e) { - log.error("Unable to render Velocity Template, '" + finalLocation + "'", e); - throw e; - } finally { - if (usedJspFactory) { - jspFactory.releasePageContext(pageContext); - } - } - - return; - } - - /** - * Retrieve the content type for this template. - *

    - * People can override this method if they want to provide specific content types for specific templates (eg text/xml). - * - * @return The content type associated with this template (default "text/html") - */ - protected String getContentType(String templateLocation) { - return "text/html"; - } - - /** - * Retrieve the encoding for this template. - *

    - * People can override this method if they want to provide specific encodings for specific templates. - * - * @return The encoding associated with this template (defaults to the value of 'struts.i18n.encoding' property) - */ - protected String getEncoding(String templateLocation) { - String encoding = (String) Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - if (encoding == null) { - encoding = System.getProperty("file.encoding"); - } - if (encoding == null) { - encoding = "UTF-8"; - } - return encoding; - } - - /** - * Given a value stack, a Velocity engine, and an action invocation, this method returns the appropriate - * Velocity template to render. - * - * @param stack the value stack to resolve the location again (when parse equals true) - * @param velocity the velocity engine to process the request against - * @param invocation an encapsulation of the action execution state. - * @param location the location of the template - * @param encoding the charset encoding of the template - * @return the template to render - * @throws Exception when the requested template could not be found - */ - protected Template getTemplate(ValueStack stack, VelocityEngine velocity, ActionInvocation invocation, String location, String encoding) throws Exception { - if (!location.startsWith("/")) { - location = invocation.getProxy().getNamespace() + "/" + location; - } - - Template template = velocity.getTemplate(location, encoding); - - return template; - } - - /** - * Creates the VelocityContext that we'll use to render this page. - * - * @param velocityManager a reference to the velocityManager to use - * @param stack the value stack to resolve the location against (when parse equals true) - * @param location the name of the template that is being used - * @return the a minted Velocity context. - */ - protected Context createContext(VelocityManager velocityManager, ValueStack stack, HttpServletRequest request, HttpServletResponse response, String location) { - return velocityManager.createContext(stack, request, response); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java deleted file mode 100644 index c3447938b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java +++ /dev/null @@ -1,59 +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.dispatcher.mapper; - -import javax.servlet.http.HttpServletRequest; - -import com.opensymphony.xwork2.config.ConfigurationManager; - - -/** - * - * - * The ActionMapper is responsible for providing a mapping between HTTP requests and action invocation requests and - * vice-versa. When given an HttpServletRequest, the ActionMapper may return null if no action invocation request maps, - * or it may return an {@link ActionMapping} that describes an action invocation that Struts should attempt to try. The - * ActionMapper is not required to guarantee that the {@link ActionMapping} returned be a real action or otherwise - * ensure a valid request. This means that most ActionMappers do not need to consult the Struts configuration to - * determine if a request should be mapped. - * - *

    Just as requests can be mapped from HTTP to an action invocation, the opposite is true as well. However, because - * HTTP requests (when shown in HTTP responses) must be in String form, a String is returned rather than an actual - * request object. - * - * - */ -public interface ActionMapper { - - /** - * Gets an action mapping for the current request - * - * @param request The servlet request - * @param config The current configuration manager - * @return The appropriate action mapping - */ - ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager); - - /** - * Converts an ActionMapping into a URI string - * - * @param mapping The action mapping - * @return The URI string that represents this mapping - */ - String getUriFromActionMapping(ActionMapping mapping); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java deleted file mode 100644 index ad3ce291e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java +++ /dev/null @@ -1,66 +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.dispatcher.mapper; - -import java.util.HashMap; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.StrutsException; -import org.apache.struts2.config.Settings; - -import com.opensymphony.xwork2.ObjectFactory; - -/** - * - * - * Factory that creates {@link ActionMapper}s. This factory looks up the class name of the {@link ActionMapper} from - * Struts's configuration using the key struts.mapper.class. - * - * - * - */ -public class ActionMapperFactory { - protected static final Log LOG = LogFactory.getLog(ActionMapperFactory.class); - - private static final HashMap classMap = new HashMap(); - - /** - * Gets an instance of the ActionMapper - * - * @return The action mapper - */ - public static ActionMapper getMapper() { - synchronized (classMap) { - String clazz = (String) Settings.get(StrutsConstants.STRUTS_MAPPER_CLASS); - try { - ActionMapper mapper = (ActionMapper) classMap.get(clazz); - if (mapper == null) { - mapper = (ActionMapper) ObjectFactory.getObjectFactory().buildBean(clazz, null); - classMap.put(clazz, mapper); - } - - return mapper; - } catch (Exception e) { - String msg = "Could not create ActionMapper: Struts will *not* work!"; - throw new StrutsException(msg, e); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java deleted file mode 100644 index 3680ddff0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java +++ /dev/null @@ -1,141 +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.dispatcher.mapper; - -import java.util.Map; - -import com.opensymphony.xwork2.Result; - -/** - * Simple class that holds the action mapping information used to invoke a - * Struts action. The name and namespace are required, but the params map - * is optional, and as such may be null. If a params map is supplied, - * it must be a mutable map, such as a HashMap. - * - */ -public class ActionMapping { - - private String name; - private String namespace; - private String method; - private Map params; - private Result result; - - /** - * Constructs an ActionMapping - */ - public ActionMapping() {} - - /** - * Constructs an ActionMapping with a default result - * - * @param result The default result - */ - public ActionMapping(Result result) { - this.result = result; - } - - /** - * Constructs an ActionMapping with its values - * - * @param name The action name - * @param namespace The action namespace - * @param method The method - * @param params The extra parameters - */ - public ActionMapping(String name, String namespace, String method, Map params) { - this.name = name; - this.namespace = namespace; - this.method = method; - this.params = params; - } - - /** - * @return The action name - */ - public String getName() { - return name; - } - - /** - * @return The action namespace - */ - public String getNamespace() { - return namespace; - } - - /** - * @return The extra parameters - */ - public Map getParams() { - return params; - } - - /** - * @return The method - */ - public String getMethod() { - if (null != method && "".equals(method)) { - return null; - } else { - return method; - } - } - - /** - * @return The default result - */ - public Result getResult() { - return result; - } - - /** - * @param result The result - */ - public void setResult(Result result) { - this.result = result; - } - - /** - * @param name The action name - */ - public void setName(String name) { - this.name = name; - } - - /** - * @param namespace The action namespace - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * @param method The method name to call on the action - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * @param params The extra parameters for this mapping - */ - public void setParams(Map params) { - this.params = params; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java deleted file mode 100644 index 5f3e98215..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java +++ /dev/null @@ -1,441 +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.dispatcher.mapper; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts2.RequestUtils; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.ServletRedirectResult; -import org.apache.struts2.util.PrefixTrie; - -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.config.ConfigurationManager; -import com.opensymphony.xwork2.config.entities.PackageConfig; - -/** - * - * - * Default action mapper implementation, using the standard *.[ext] (where ext - * usually "action") pattern. The extension is looked up from the Struts - * configuration key struts.action.exection. - * - *

    To help with dealing with buttons and other related requirements, this - * mapper (and other {@link ActionMapper}s, we hope) has the ability to name a - * button with some predefined prefix and have that button name alter the - * execution behaviour. The four prefixes are: - * - *

      - * - *
    • Method prefix - method:default
    • - * - *
    • Action prefix - action:dashboard
    • - * - *
    • Redirect prefix - redirect:cancel.jsp
    • - * - *
    • Redirect-action prefix - redirect-action:cancel
    • - * - *
    - * - *

    In addition to these four prefixes, this mapper also understands the - * action naming pattern of foo!bar in either the extension form (eg: - * foo!bar.action) or in the prefix form (eg: action:foo!bar). This syntax tells - * this mapper to map to the action named foo and the method bar. - * - * - * - *

    Method Prefix

    - * - * - * - * With method-prefix, instead of calling baz action's execute() method (by - * default if it isn't overriden in struts.xml to be something else), the baz - * action's anotherMethod() will be called. A very elegant way determine which - * button is clicked. Alternatively, one would have submit button set a - * particular value on the action when clicked, and the execute() method decides - * on what to do with the setted value depending on which button is clicked. - * - * - * - *

    - *  <!-- START SNIPPET: method-example -->
    - *  <a:form action="baz">
    - *      <a:textfield label="Enter your name" name="person.name"/>
    - *      <a:submit value="Create person"/>
    - *      <a:submit name="method:anotherMethod" value="Cancel"/>
    - *  </a:form>
    - *  <!-- END SNIPPET: method-example -->
    - * 
    - * - *

    Action prefix

    - * - * - * - * With action-prefix, instead of executing baz action's execute() method (by - * default if it isn't overriden in struts.xml to be something else), the - * anotherAction action's execute() method (assuming again if it isn't overriden - * with something else in struts.xml) will be executed. - * - * - * - *

    - *  <!-- START SNIPPET: action-example -->
    - *  <a:form action="baz">
    - *      <a:textfield label="Enter your name" name="person.name"/>
    - *      <a:submit value="Create person"/>
    - *      <a:submit name="action:anotherAction" value="Cancel"/>
    - *  </a:form>
    - *  <!-- END SNIPPET: action-example -->
    - * 
    - * - *

    Redirect prefix

    - * - * - * - * With redirect-prefix, instead of executing baz action's execute() method (by - * default it isn't overriden in struts.xml to be something else), it will get - * redirected to, in this case to www.google.com. Internally it uses - * ServletRedirectResult to do the task. - * - * - * - *

    - *  <!-- START SNIPPET: redirect-example -->
    - *  <a:form action="baz">
    - *      <a:textfield label="Enter your name" name="person.name"/>
    - *      <a:submit value="Create person"/>
    - *      <a:submit name="redirect:www.google.com" value="Cancel"/>
    - *  </a:form>
    - *  <!-- END SNIPPET: redirect-example -->
    - * 
    - * - *

    Redirect-action prefix

    - * - * - * - * With redirect-action-prefix, instead of executing baz action's execute() - * method (by default it isn't overriden in struts.xml to be something else), it - * will get redirected to, in this case 'dashboard.action'. Internally it uses - * ServletRedirectResult to do the task and read off the extension from the - * struts.properties. - * - * - * - *

    - *  <!-- START SNIPPET: redirect-action-example -->
    - *  <a:form action="baz">
    - *      <a:textfield label="Enter your name" name="person.name"/>
    - *      <a:submit value="Create person"/>
    - *      <a:submit name="redirect-action:dashboard" value="Cancel"/>
    - *  </a:form>
    - *  <!-- END SNIPPET: redirect-action-example -->
    - * 
    - * - */ -public class DefaultActionMapper implements ActionMapper { - - static final String METHOD_PREFIX = "method:"; - - static final String ACTION_PREFIX = "action:"; - - static final String REDIRECT_PREFIX = "redirect:"; - - static final String REDIRECT_ACTION_PREFIX = "redirect-action:"; - - private static boolean allowDynamicMethodCalls = "true".equals(Settings - .get(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)); - - private PrefixTrie prefixTrie = null; - - public DefaultActionMapper() { - prefixTrie = new PrefixTrie() { - { - put(METHOD_PREFIX, new ParameterAction() { - public void execute(String key, ActionMapping mapping) { - mapping - .setMethod(key - .substring(METHOD_PREFIX.length())); - } - }); - - put(ACTION_PREFIX, new ParameterAction() { - public void execute(String key, ActionMapping mapping) { - String name = key.substring(ACTION_PREFIX.length()); - if (allowDynamicMethodCalls) { - int bang = name.indexOf('!'); - if (bang != -1) { - String method = name.substring(bang + 1); - mapping.setMethod(method); - name = name.substring(0, bang); - } - } - mapping.setName(name); - } - }); - - put(REDIRECT_PREFIX, new ParameterAction() { - public void execute(String key, ActionMapping mapping) { - ServletRedirectResult redirect = new ServletRedirectResult(); - redirect.setLocation(key.substring(REDIRECT_PREFIX - .length())); - mapping.setResult(redirect); - } - }); - - put(REDIRECT_ACTION_PREFIX, new ParameterAction() { - public void execute(String key, ActionMapping mapping) { - String location = key.substring(REDIRECT_ACTION_PREFIX - .length()); - ServletRedirectResult redirect = new ServletRedirectResult(); - String extension = getDefaultExtension(); - if (extension != null) { - location += "." + extension; - } - redirect.setLocation(location); - mapping.setResult(redirect); - } - }); - } - }; - } - - /* - * (non-Javadoc) - * - * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest) - */ - public ActionMapping getMapping(HttpServletRequest request, - ConfigurationManager configManager) { - ActionMapping mapping = new ActionMapping(); - String uri = getUri(request); - - uri = dropExtension(uri); - if (uri == null) { - return null; - } - - parseNameAndNamespace(uri, mapping, configManager.getConfiguration()); - - handleSpecialParameters(request, mapping); - - if (mapping.getName() == null) { - return null; - } - - if (allowDynamicMethodCalls) { - // handle "name!method" convention. - String name = mapping.getName(); - int exclamation = name.lastIndexOf("!"); - if (exclamation != -1) { - mapping.setName(name.substring(0, exclamation)); - mapping.setMethod(name.substring(exclamation + 1)); - } - } - - return mapping; - } - - /** - * Special parameters, as described in the class-level comment, are searched - * for and handled. - * - * @param request - * The request - * @param mapping - * The action mapping - */ - public void handleSpecialParameters(HttpServletRequest request, - ActionMapping mapping) { - // handle special parameter prefixes. - Map parameterMap = request.getParameterMap(); - for (Iterator iterator = parameterMap.keySet().iterator(); iterator - .hasNext();) { - String key = (String) iterator.next(); - ParameterAction parameterAction = (ParameterAction) prefixTrie - .get(key); - if (parameterAction != null) { - parameterAction.execute(key, mapping); - break; - } - } - } - - /** - * Parses the name and namespace from the uri - * - * @param uri - * The uri - * @param mapping - * The action mapping to populate - */ - void parseNameAndNamespace(String uri, ActionMapping mapping, - Configuration config) { - String namespace, name; - int lastSlash = uri.lastIndexOf("/"); - if (lastSlash == -1) { - namespace = ""; - name = uri; - } else if (lastSlash == 0) { - // ww-1046, assume it is the root namespace, it will fallback to - // default - // namespace anyway if not found in root namespace. - namespace = "/"; - name = uri.substring(lastSlash + 1); - } else { - String prefix = uri.substring(0, lastSlash); - namespace = ""; - // Find the longest matching namespace, defaulting to the default - for (Iterator i = config.getPackageConfigs().values().iterator(); i - .hasNext();) { - String ns = ((PackageConfig) i.next()).getNamespace(); - if (ns != null && prefix.startsWith(ns)) { - if (ns.length() > namespace.length()) { - namespace = ns; - } - } - } - - name = uri.substring(namespace.length() + 1); - } - mapping.setNamespace(namespace); - mapping.setName(name); - } - - /** - * Drops the extension from the action name - * - * @param name - * The action name - * @return The action name without its extension - */ - String dropExtension(String name) { - List extensions = getExtensions(); - if (extensions == null) { - return name; - } - Iterator it = extensions.iterator(); - while (it.hasNext()) { - String extension = "." + (String) it.next(); - if (name.endsWith(extension)) { - name = name.substring(0, name.length() - extension.length()); - return name; - } - } - return null; - } - - /** - * Returns null if no extension is specified. - */ - static String getDefaultExtension() { - List extensions = getExtensions(); - if (extensions == null) { - return null; - } else { - return (String) extensions.get(0); - } - } - - /** - * Returns null if no extension is specified. - */ - static List getExtensions() { - String extensions = (String) org.apache.struts2.config.Settings - .get(StrutsConstants.STRUTS_ACTION_EXTENSION); - - if ("".equals(extensions)) { - return null; - } else { - return Arrays.asList(extensions.split(",")); - } - } - - /** - * Gets the uri from the request - * - * @param request - * The request - * @return The uri - */ - String getUri(HttpServletRequest request) { - // handle http dispatcher includes. - String uri = (String) request - .getAttribute("javax.servlet.include.servlet_path"); - if (uri != null) { - return uri; - } - - uri = RequestUtils.getServletPath(request); - if (uri != null && !"".equals(uri)) { - return uri; - } - - uri = request.getRequestURI(); - return uri.substring(request.getContextPath().length()); - } - - /* - * (non-Javadoc) - * - * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getUriFromActionMapping(org.apache.struts2.dispatcher.mapper.ActionMapping) - */ - public String getUriFromActionMapping(ActionMapping mapping) { - StringBuffer uri = new StringBuffer(); - - uri.append(mapping.getNamespace()); - if (!"/".equals(mapping.getNamespace())) { - uri.append("/"); - } - String name = mapping.getName(); - String params = ""; - if (name.indexOf('?') != -1) { - params = name.substring(name.indexOf('?')); - name = name.substring(0, name.indexOf('?')); - } - uri.append(name); - - if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) { - uri.append("!").append(mapping.getMethod()); - } - - String extension = getDefaultExtension(); - if (extension != null) { - if (uri.indexOf('.' + extension) == -1) { - uri.append(".").append(extension); - if (params.length() > 0) { - uri.append(params); - } - } - } - - return uri.toString(); - } - - /** - * Defines a parameter action prefix - */ - interface ParameterAction { - void execute(String key, ActionMapping mapping); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java deleted file mode 100644 index 9b1889e79..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java +++ /dev/null @@ -1,123 +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.dispatcher.mapper; - -import java.net.URLDecoder; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.RequestUtils; - -import com.opensymphony.xwork2.config.ConfigurationManager; - - -/** - * A custom action mapper using the following format: - *

    - *

    - *

      http://HOST/ACTION_NAME/PARAM_NAME1/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
    - *

    - * You can have as many parameters you'd like to use. Alternatively the URL can be shortened to the following: - *

    - *

      http://HOST/ACTION_NAME/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
    - *

    - * This is the same as: - *

    - *

      http://HOST/ACTION_NAME/ACTION_NAME + "Id"/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
    - *

    - * Suppose for example we would like to display some articles by id at using the following URL sheme: - *

    - *

      http://HOST/article/Id
    - *

    - *

    - * Your action just needs a setArticleId() method, and requests such as /article/1, /article/2, etc will all map - * to that URL pattern. - * - */ -public class RestfulActionMapper implements ActionMapper { - protected static final Log LOG = LogFactory.getLog(RestfulActionMapper.class); - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest) - */ - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - String uri = RequestUtils.getServletPath(request); - - int nextSlash = uri.indexOf('/', 1); - if (nextSlash == -1) { - return null; - } - - String actionName = uri.substring(1, nextSlash); - HashMap parameters = new HashMap(); - try { - StringTokenizer st = new StringTokenizer(uri.substring(nextSlash), "/"); - boolean isNameTok = true; - String paramName = null; - String paramValue; - - // check if we have the first parameter name - if ((st.countTokens() % 2) != 0) { - isNameTok = false; - paramName = actionName + "Id"; - } - - while (st.hasMoreTokens()) { - if (isNameTok) { - paramName = URLDecoder.decode(st.nextToken(), "UTF-8"); - isNameTok = false; - } else { - paramValue = URLDecoder.decode(st.nextToken(), "UTF-8"); - - if ((paramName != null) && (paramName.length() > 0)) { - parameters.put(paramName, paramValue); - } - - isNameTok = true; - } - } - } catch (Exception e) { - LOG.warn(e); - } - - return new ActionMapping(actionName, "", "", parameters); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getUriFromActionMapping(org.apache.struts2.dispatcher.mapper.ActionMapping) - */ - public String getUriFromActionMapping(ActionMapping mapping) { - String base = mapping.getNamespace() + mapping.getName(); - for (Iterator iterator = mapping.getParams().entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - String name = (String) entry.getKey(); - if (name.equals(mapping.getName() + "Id")) { - base = base + "/" + entry.getValue(); - break; - } - } - - return base; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java deleted file mode 100644 index 4cb541e6d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java +++ /dev/null @@ -1,281 +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.dispatcher.multipart; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileUploadException; -import org.apache.commons.fileupload.RequestContext; -import org.apache.commons.fileupload.disk.DiskFileItem; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.servlet.ServletFileUpload; - -/** - * Multipart form data request adapter for Jakarta Commons Fileupload package. - * - */ -public class JakartaMultiPartRequest extends MultiPartRequest { - // maps parameter name -> List of FileItem objects - private Map> files = new HashMap>(); - // maps parameter name -> List of param values - private Map> params = new HashMap>(); - // any errors while processing this request - private List errors = new ArrayList(); - - /** - * Creates a new request wrapper to handle multi-part data using methods adapted from Jason Pell's - * multipart classes (see class description). - * - * @param maxSize maximum size post allowed - * @param saveDir the directory to save off the file - * @param servletRequest the request containing the multipart - * @throws java.io.IOException is thrown if encoding fails. - */ - public JakartaMultiPartRequest(HttpServletRequest servletRequest, String saveDir, int maxSize) - throws IOException { - DiskFileItemFactory fac = new DiskFileItemFactory(); - fac.setSizeThreshold(0); - if (saveDir != null) { - fac.setRepository(new File(saveDir)); - } - - // Parse the request - try { - ServletFileUpload upload = new ServletFileUpload(fac); - List items = upload.parseRequest(createRequestContext(servletRequest)); - - for (int i = 0; i < items.size(); i++) { - FileItem item = (FileItem) items.get(i); - if (log.isDebugEnabled()) log.debug("Found item " + item.getFieldName()); - if (item.isFormField()) { - log.debug("Item is a normal form field"); - List values; - if (params.get(item.getFieldName()) != null) { - values = params.get(item.getFieldName()); - } else { - values = new ArrayList(); - } - - // note: see http://jira.opensymphony.com/browse/WW-633 - // basically, in some cases the charset may be null, so - // we're just going to try to "other" method (no idea if this - // will work) - String charset = servletRequest.getCharacterEncoding(); - if (charset != null) { - values.add(item.getString(charset)); - } else { - values.add(item.getString()); - } - params.put(item.getFieldName(), values); - } else { - log.debug("Item is a file upload"); - - List values; - if (files.get(item.getFieldName()) != null) { - values = files.get(item.getFieldName()); - } else { - values = new ArrayList(); - } - - values.add(item); - files.put(item.getFieldName(), values); - } - } - } catch (FileUploadException e) { - log.error(e); - errors.add(e.getMessage()); - } - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getFileParameterNames() - */ - public Enumeration getFileParameterNames() { - return Collections.enumeration(files.keySet()); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getContentType(java.lang.String) - */ - public String[] getContentType(String fieldName) { - List items = (List) files.get(fieldName); - - if (items == null) { - return null; - } - - List contentTypes = new ArrayList(items.size()); - for (int i = 0; i < items.size(); i++) { - FileItem fileItem = (FileItem) items.get(i); - contentTypes.add(fileItem.getContentType()); - } - - return (String[]) contentTypes.toArray(new String[contentTypes.size()]); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getFile(java.lang.String) - */ - public File[] getFile(String fieldName) { - List items = (List) files.get(fieldName); - - if (items == null) { - return null; - } - - List fileList = new ArrayList(items.size()); - for (int i = 0; i < items.size(); i++) { - DiskFileItem fileItem = (DiskFileItem) items.get(i); - fileList.add(fileItem.getStoreLocation()); - } - - return (File[]) fileList.toArray(new File[fileList.size()]); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getFileNames(java.lang.String) - */ - public String[] getFileNames(String fieldName) { - List items = files.get(fieldName); - - if (items == null) { - return null; - } - - List fileNames = new ArrayList(items.size()); - for (int i = 0; i < items.size(); i++) { - DiskFileItem fileItem = (DiskFileItem) items.get(i); - fileNames.add(getCanonicalName(fileItem.getName())); - } - - return (String[]) fileNames.toArray(new String[fileNames.size()]); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getFilesystemName(java.lang.String) - */ - public String[] getFilesystemName(String fieldName) { - List items = (List) files.get(fieldName); - - if (items == null) { - return null; - } - - List fileNames = new ArrayList(items.size()); - for (int i = 0; i < items.size(); i++) { - DiskFileItem fileItem = (DiskFileItem) items.get(i); - fileNames.add(fileItem.getStoreLocation().getName()); - } - - return (String[]) fileNames.toArray(new String[fileNames.size()]); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getParameter(java.lang.String) - */ - public String getParameter(String name) { - List v = (List) params.get(name); - if (v != null && v.size() > 0) { - return (String) v.get(0); - } - - return null; - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getParameterNames() - */ - public Enumeration getParameterNames() { - return Collections.enumeration(params.keySet()); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getParameterValues(java.lang.String) - */ - public String[] getParameterValues(String name) { - List v = params.get(name); - if (v != null && v.size() > 0) { - return (String[]) v.toArray(new String[v.size()]); - } - - return null; - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getErrors() - */ - public List getErrors() { - return errors; - } - - /** - * Returns the canonical name of the given file. - * - * @param filename the given file - * @return the canonical name of the given file - */ - private String getCanonicalName(String filename) { - int forwardSlash = filename.lastIndexOf("/"); - int backwardSlash = filename.lastIndexOf("\\"); - if (forwardSlash != -1 && forwardSlash > backwardSlash) { - filename = filename.substring(forwardSlash + 1, filename.length()); - } else if (backwardSlash != -1 && backwardSlash >= forwardSlash) { - filename = filename.substring(backwardSlash + 1, filename.length()); - } - - return filename; - } - - /** - * Creates a RequestContext needed by Jakarta Commons Upload. - * - * @param req the request. - * @return a new request context. - */ - private RequestContext createRequestContext(final HttpServletRequest req) { - return new RequestContext() { - public String getCharacterEncoding() { - return req.getCharacterEncoding(); - } - - public String getContentType() { - return req.getContentType(); - } - - public int getContentLength() { - return req.getContentLength(); - } - - public InputStream getInputStream() throws IOException { - return req.getInputStream(); - } - }; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java deleted file mode 100644 index 35fc41da0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java +++ /dev/null @@ -1,128 +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.dispatcher.multipart; - -import java.io.File; -import java.util.Enumeration; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Abstract wrapper class HTTP requests to handle multi-part data.

    - * - */ -public abstract class MultiPartRequest { - - protected static Log log = LogFactory.getLog(MultiPartRequest.class); - - - /** - * Returns true if the request is multipart form data, false otherwise. - * - * @param request the http servlet request. - * @return true if the request is multipart form data, false otherwise. - */ - public static boolean isMultiPart(HttpServletRequest request) { - String content_type = request.getContentType(); - return content_type != null && content_type.indexOf("multipart/form-data") != -1; - } - - /** - * Returns an enumeration of the parameter names for uploaded files - * - * @return an enumeration of the parameter names for uploaded files - */ - public abstract Enumeration getFileParameterNames(); - - /** - * Returns the content type(s) of the file(s) associated with the specified field name - * (as supplied by the client browser), or null if no files are associated with the - * given field name. - * - * @param fieldName input field name - * @return an array of content encoding for the specified input field name or null if - * no content type was specified. - */ - public abstract String[] getContentType(String fieldName); - - /** - * Returns a {@link java.io.File} object for the filename specified or null if no files - * are associated with the given field name. - * - * @param fieldName input field name - * @return a File[] object for files associated with the specified input field name - */ - public abstract File[] getFile(String fieldName); - - /** - * Returns a String[] of file names for files associated with the specified input field name - * - * @param fieldName input field name - * @return a String[] of file names for files associated with the specified input field name - */ - public abstract String[] getFileNames(String fieldName); - - /** - * Returns the file system name(s) of files associated with the given field name or - * null if no files are associated with the given field name. - * - * @param fieldName input field name - * @return the file system name(s) of files associated with the given field name - */ - public abstract String[] getFilesystemName(String fieldName); - - /** - * Returns the specified request parameter. - * - * @param name the name of the parameter to get - * @return the parameter or null if it was not found. - */ - public abstract String getParameter(String name); - - /** - * Returns an enumeration of String parameter names. - * - * @return an enumeration of String parameter names. - */ - public abstract Enumeration getParameterNames(); - - /** - * Returns a list of all parameter values associated with a parameter name. If there is only - * one parameter value per name the resulting array will be of length 1. - * - * @param name the name of the parameter. - * @return an array of all values associated with the parameter name. - */ - public abstract String[] getParameterValues(String name); - - /** - * Returns a list of error messages that may have occurred while processing the request. - * If there are no errors, an empty list is returned. If the underlying implementation - * (ie: pell, cos, jakarta, etc) cannot support providing these errors, an empty list is - * also returned. This list of errors is repoted back to the - * {@link MultiPartRequestWrapper}'s errors field. - * - * @return a list of Strings that represent various errors during parsing - */ - public abstract List getErrors(); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java deleted file mode 100644 index 3b754cb51..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java +++ /dev/null @@ -1,305 +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.dispatcher.multipart; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Vector; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.StrutsRequestWrapper; -import org.apache.struts2.util.ClassLoaderUtils; - - -/** - * Parses a multipart request and provides a wrapper around the request. The parsing implementation used - * depends on the struts.multipart.parser setting. It should be set to a class which - * extends {@link org.apache.struts2.dispatcher.multipart.MultiPartRequest}.

    - *

    - * Struts ships with three implementations, - * {@link org.apache.struts2.dispatcher.multipart.PellMultiPartRequest}, and - * {@link org.apache.struts2.dispatcher.multipart.CosMultiPartRequest} and - * {@link org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest}. The Jakarta implementation - * is the default. The struts.multipart.parser property should be set to jakarta for the - * Jakarta implementation, pell for the Pell implementation and cos for the Jason Hunter - * implementation.

    - *

    - * The files are uploaded when the object is instantiated. If there are any errors they are logged using - * {@link #addError(String)}. An action handling a multipart form should first check {@link #hasErrors()} - * before doing any other processing.

    - * - */ -public class MultiPartRequestWrapper extends StrutsRequestWrapper { - protected static final Log log = LogFactory.getLog(MultiPartRequestWrapper.class); - - Collection errors; - MultiPartRequest multi; - - /** - * Instantiates the appropriate MultiPartRequest parser implementation and processes the data. - * - * @param request the servlet request object - * @param saveDir directory to save the file(s) to - * @param maxSize maximum file size allowed - */ - public MultiPartRequestWrapper(HttpServletRequest request, String saveDir, int maxSize) { - super(request); - - if (request instanceof MultiPartRequest) { - multi = (MultiPartRequest) request; - } else { - String parser = Settings.get(StrutsConstants.STRUTS_MULTIPART_PARSER); - - // If it's not set, use Jakarta - if (parser.equals("")) { - log.warn("Property struts.multipart.parser not set." + - " Using org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest"); - parser = "org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest"; - } - // legacy support for old style property values - else if (parser.equals("pell")) { - parser = "org.apache.struts2.dispatcher.multipart.PellMultiPartRequest"; - } else if (parser.equals("cos")) { - parser = "org.apache.struts2.dispatcher.multipart.CosMultiPartRequest"; - } else if (parser.equals("jakarta")) { - parser = "org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest"; - } - - try { - Class baseClazz = org.apache.struts2.dispatcher.multipart.MultiPartRequest.class; - - Class clazz = ClassLoaderUtils.loadClass(parser, MultiPartRequestWrapper.class); - - // make sure it extends MultiPartRequest - if (!baseClazz.isAssignableFrom(clazz)) { - addError("Class '" + parser + "' does not extend MultiPartRequest"); - - return; - } - - // get the constructor - Constructor ctor = clazz.getDeclaredConstructor(new Class[]{ - ClassLoaderUtils.loadClass("javax.servlet.http.HttpServletRequest", MultiPartRequestWrapper.class), - java.lang.String.class, int.class - }); - - // build the parameter list - Object[] parms = new Object[]{ - request, saveDir, new Integer(maxSize) - }; - - // instantiate it - multi = (MultiPartRequest) ctor.newInstance(parms); - for (Iterator iter = multi.getErrors().iterator(); iter.hasNext();) { - String error = (String) iter.next(); - addError(error); - } - } catch (ClassNotFoundException e) { - addError("Class: " + parser + " not found."); - } catch (NoSuchMethodException e) { - addError("Constructor error for " + parser + ": " + e); - } catch (InstantiationException e) { - addError("Error instantiating " + parser + ": " + e); - } catch (IllegalAccessException e) { - addError("Access errror for " + parser + ": " + e); - } catch (InvocationTargetException e) { - // This is a wrapper for any exceptions thrown by the constructor called from newInstance - addError(e.getTargetException().toString()); - } - } - } - - /** - * Get an enumeration of the parameter names for uploaded files - * - * @return enumeration of parameter names for uploaded files - */ - public Enumeration getFileParameterNames() { - if (multi == null) { - return null; - } - - return multi.getFileParameterNames(); - } - - /** - * Get an array of content encoding for the specified input field name or null if - * no content type was specified. - * - * @param name input field name - * @return an array of content encoding for the specified input field name - */ - public String[] getContentTypes(String name) { - if (multi == null) { - return null; - } - - return multi.getContentType(name); - } - - /** - * Get a {@link java.io.File[]} for the given input field name. - * - * @param fieldName input field name - * @return a File[] object for files associated with the specified input field name - */ - public File[] getFiles(String fieldName) { - if (multi == null) { - return null; - } - - return multi.getFile(fieldName); - } - - /** - * Get a String array of the file names for uploaded files - * - * @return a String[] of file names for uploaded files - */ - public String[] getFileNames(String fieldName) { - if (multi == null) { - return null; - } - - return multi.getFileNames(fieldName); - } - - /** - * Get the filename(s) of the file(s) uploaded for the given input field name. - * Returns null if the file is not found. - * - * @param fieldName input field name - * @return the filename(s) of the file(s) uploaded for the given input field name or - * null if name not found. - */ - public String[] getFileSystemNames(String fieldName) { - if (multi == null) { - return null; - } - - return multi.getFilesystemName(fieldName); - } - - /** - * @see javax.servlet.http.HttpServletRequest#getParameter(String) - */ - public String getParameter(String name) { - return ((multi == null) || (multi.getParameter(name) == null)) ? super.getParameter(name) : multi.getParameter(name); - } - - /** - * @see javax.servlet.http.HttpServletRequest#getParameterMap() - */ - public Map getParameterMap() { - Map map = new HashMap(); - Enumeration enumeration = getParameterNames(); - - while (enumeration.hasMoreElements()) { - String name = (String) enumeration.nextElement(); - map.put(name, this.getParameterValues(name)); - } - - return map; - } - - /** - * @see javax.servlet.http.HttpServletRequest#getParameterNames() - */ - public Enumeration getParameterNames() { - if (multi == null) { - return super.getParameterNames(); - } else { - return mergeParams(multi.getParameterNames(), super.getParameterNames()); - } - } - - /** - * @see javax.servlet.http.HttpServletRequest#getParameterValues(String) - */ - public String[] getParameterValues(String name) { - return ((multi == null) || (multi.getParameterValues(name) == null)) ? super.getParameterValues(name) : multi.getParameterValues(name); - } - - /** - * Returns true if any errors occured when parsing the HTTP multipart request, false otherwise. - * - * @return true if any errors occured when parsing the HTTP multipart request, false otherwise. - */ - public boolean hasErrors() { - if ((errors == null) || errors.isEmpty()) { - return false; - } else { - return true; - } - } - - /** - * Returns a collection of any errors generated when parsing the multipart request. - * - * @return the error Collection. - */ - public Collection getErrors() { - return errors; - } - - /** - * Adds an error message. - * - * @param anErrorMessage the error message to report. - */ - protected void addError(String anErrorMessage) { - if (errors == null) { - errors = new ArrayList(); - } - - errors.add(anErrorMessage); - } - - /** - * Merges 2 enumeration of parameters as one. - * - * @param params1 the first enumeration. - * @param params2 the second enumeration. - * @return a single Enumeration of all elements from both Enumerations. - */ - protected Enumeration mergeParams(Enumeration params1, Enumeration params2) { - Vector temp = new Vector(); - - while (params1.hasMoreElements()) { - temp.add(params1.nextElement()); - } - - while (params2.hasMoreElements()) { - temp.add(params2.nextElement()); - } - - return temp.elements(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/package.html b/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/package.html deleted file mode 100644 index 6f5f810d1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/package.html +++ /dev/null @@ -1 +0,0 @@ -Classes to help dispatch multipart HTTP requests. diff --git a/trunk/core/src/main/java/org/apache/struts2/dispatcher/package.html b/trunk/core/src/main/java/org/apache/struts2/dispatcher/package.html deleted file mode 100644 index 588e5d0d4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/dispatcher/package.html +++ /dev/null @@ -1 +0,0 @@ -Classes for action dispatching in Struts (the Controller part of MVC). diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java b/trunk/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java deleted file mode 100644 index bc61e0414..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import org.apache.struts2.spi.ActionContext; -import org.apache.struts2.spi.Result; - -import com.opensymphony.xwork2.ActionInvocation; - -public class ActionContextImpl implements ActionContext { - - final ActionInvocation invocation; - - public ActionContextImpl(ActionInvocation invocation) { - this.invocation = invocation; - } - - public Object getAction() { - return invocation.getAction(); - } - - public Method getMethod() { - String methodName = invocation.getProxy().getMethod(); - try { - return getAction().getClass().getMethod(methodName); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } - } - - public String getActionName() { - return invocation.getProxy().getActionName(); - } - - public String getNamespacePath() { - return invocation.getProxy().getNamespace(); - } - - // TODO: Do something with these. - List resultInterceptors = new ArrayList(); - - public void addResultInterceptor(Result interceptor) { - resultInterceptors.add(interceptor); - } - - public Result getResult() { - // TODO - throw new UnsupportedOperationException(); - } - - public ActionContext getPrevious() { - // TODO - throw new UnsupportedOperationException(); - } - - public ActionContext getNext() { - // TODO - throw new UnsupportedOperationException(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java b/trunk/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java deleted file mode 100644 index 68e3d57ec..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import static org.apache.struts2.impl.RequestContextImpl.ILLEGAL_PROCEED; - -import java.util.concurrent.Callable; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; - -public class InterceptorAdapter implements Interceptor { - - private static final long serialVersionUID = 8020658947818231684L; - final org.apache.struts2.spi.Interceptor delegate; - - public InterceptorAdapter(org.apache.struts2.spi.Interceptor delegate) { - this.delegate = delegate; - } - - public String intercept(final ActionInvocation invocation) throws Exception { - final RequestContextImpl requestContext = RequestContextImpl.get(); - - // Save the existing proceed implementation so we can restore it later. - Callable previous = requestContext.getProceed(); - - requestContext.setProceed(new Callable() { - public String call() throws Exception { - // This proceed implementation is no longer valid past this point. - requestContext.setProceed(ILLEGAL_PROCEED); - try { - return invocation.invoke(); - } finally { - // We're valid again. - requestContext.setProceed(this); - } - } - }); - - try { - return delegate.intercept(requestContext); - } finally { - requestContext.setProceed(previous); - } - } - - public void destroy() {} - public void init() {} -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java b/trunk/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java deleted file mode 100644 index 32a759e37..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.struts2.Messages; - -import com.opensymphony.xwork2.DefaultTextProvider; -import com.opensymphony.xwork2.TextProvider; - -public class MessagesImpl implements Messages { - - final TextProvider textProvider = DefaultTextProvider.INSTANCE; - Map fieldMap = new HashMap(); - Map> severityMap = new EnumMap>(Severity.class); - - public Messages forField(String fieldName) { - Messages forField = fieldMap.get(fieldName); - if (forField == null) { - forField = new MessagesImpl(); - fieldMap.put(fieldName, forField); - } - return forField; - } - - public Map forFields() { - return fieldMap; - } - - public void addInformation(String key) { - forSeverity(Severity.INFO).add(textProvider.getText(key)); - } - - public void addInformation(String key, String... arguments) { - forSeverity(Severity.INFO).add(textProvider.getText(key, arguments)); - } - - public void addWarning(String key) { - forSeverity(Severity.WARN).add(textProvider.getText(key)); - } - - public void addWarning(String key, String... arguments) { - forSeverity(Severity.WARN).add(textProvider.getText(key, arguments)); - } - - public void addError(String key) { - forSeverity(Severity.ERROR).add(textProvider.getText(key)); - } - - public void addError(String key, String... arguments) { - forSeverity(Severity.ERROR).add(textProvider.getText(key, arguments)); - } - - public void add(Severity severity, String key) { - forSeverity(severity).add(textProvider.getText(key)); - } - - public void add(Severity severity, String key, String... arguments) { - forSeverity(severity).add(textProvider.getText(key, arguments)); - } - - public Set getSeverities() { - Set severities = EnumSet.noneOf(Severity.class); - for (Severity severity : Severity.values()) { - List messages = severityMap.get(severity); - if (messages != null && !messages.isEmpty()) { - severities.add(severity); - } - } - return Collections.unmodifiableSet(severities); - } - - public List forSeverity(Severity severity) { - List messages = severityMap.get(severity); - if (messages == null) { - messages = new ArrayList(); - severityMap.put(severity, messages); - } - return messages; - } - - public List getErrors() { - return forSeverity(Severity.ERROR); - } - - public List getWarnings() { - return forSeverity(Severity.WARN); - } - - public List getInformation() { - return forSeverity(Severity.INFO); - } - - public boolean hasErrors() { - return !isEmpty(Severity.ERROR); - } - - public boolean hasWarnings() { - return !isEmpty(Severity.WARN); - } - - public boolean hasInformation() { - return !isEmpty(Severity.INFO); - } - - public boolean isEmpty() { - for (Severity severity : Severity.values()) - if (!isEmpty(severity)) - return false; - - return true; - } - - public boolean isEmpty(Severity severity) { - List messages = severityMap.get(severity); - if (messages != null && !messages.isEmpty()) { - return false; - } - - for (Messages fieldMessages : fieldMap.values()) - if (!fieldMessages.isEmpty(severity)) - return false; - - return true; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java b/trunk/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java deleted file mode 100644 index 1d853806e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import static org.apache.struts2.StrutsStatics.HTTP_REQUEST; -import static org.apache.struts2.StrutsStatics.HTTP_RESPONSE; -import static org.apache.struts2.StrutsStatics.SERVLET_CONTEXT; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.Callable; - -import javax.servlet.ServletContext; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.Messages; -import org.apache.struts2.dispatcher.RequestMap; -import org.apache.struts2.spi.ActionContext; -import org.apache.struts2.spi.RequestContext; -import org.apache.struts2.spi.ValueStack; - -import com.opensymphony.xwork2.ActionInvocation; - -public class RequestContextImpl implements RequestContext { - - com.opensymphony.xwork2.ActionContext xworkContext; - ActionContext actionContext; - Messages messages = new MessagesImpl(); - - public static final Callable ILLEGAL_PROCEED = new Callable() { - public String call() throws Exception { - throw new IllegalStateException(); - } - }; - - public RequestContextImpl(com.opensymphony.xwork2.ActionContext xworkContext) { - this.xworkContext = xworkContext; - } - - public ActionContext getActionContext() { - return actionContext; - } - - public Object getAction() { - return getActionContext().getAction(); - } - - void setActionContext(ActionContext actionContext) { - this.actionContext = actionContext; - } - - public Map getParameterMap() { - return xworkContext.getParameters(); - } - - Map attributeMap; - - public Map getAttributeMap() { - if (attributeMap == null) { - attributeMap = new RequestMap(getServletRequest()); - } - return attributeMap; - } - - public Map getSessionMap() { - return xworkContext.getSession(); - } - - public Map getApplicationMap() { - return xworkContext.getApplication(); - } - - public List findCookiesForName(String name) { - List cookies = new ArrayList(); - for (Cookie cookie : getServletRequest().getCookies()) - if (name.equals(cookie.getName())) - cookies.add(cookie); - - return cookies; - } - - public Locale getLocale() { - return xworkContext.getLocale(); - } - - public void setLocale(Locale locale) { - xworkContext.setLocale(locale); - } - - public Messages getMessages() { - return messages; - } - - public HttpServletRequest getServletRequest() { - return (HttpServletRequest) xworkContext.get(HTTP_REQUEST); - } - - public HttpServletResponse getServletResponse() { - return (HttpServletResponse) xworkContext.get(HTTP_RESPONSE); - } - - public ServletContext getServletContext() { - return (ServletContext) xworkContext.get(SERVLET_CONTEXT); - } - - ValueStack valueStack; - - public ValueStack getValueStack() { - if (valueStack == null) { - valueStack = new ValueStackAdapter(xworkContext.getValueStack()); - } - return valueStack; - } - - Callable proceed = ILLEGAL_PROCEED; - - public String proceed() throws Exception { - return proceed.call(); - } - - public void setProceed(Callable proceed) { - this.proceed = proceed; - } - - public Callable getProceed() { - return proceed; - } - - static ThreadLocal threadLocalRequestContext = new ThreadLocal() { - protected RequestContextImpl[] initialValue() { - return new RequestContextImpl[1]; - } - }; - - /** - * Creates RequestContext if necessary. Always creates a new ActionContext and restores an existing ActionContext - * when finished. - */ - public static String callInContext(ActionInvocation invocation, Callable callable) - throws Exception { - RequestContextImpl[] reference = threadLocalRequestContext.get(); - - if (reference[0] == null) { - // Initial invocation. - reference[0] = new RequestContextImpl(invocation.getInvocationContext()); - reference[0].setActionContext(new ActionContextImpl(invocation)); - try { - return callable.call(); - } finally { - reference[0] = null; - } - } else { - // Nested invocation. - RequestContextImpl requestContext = reference[0]; - ActionContext previous = requestContext.getActionContext(); - requestContext.setActionContext(new ActionContextImpl(invocation)); - try { - return callable.call(); - } finally { - requestContext.setActionContext(previous); - } - } - } - - public static RequestContextImpl get() { - RequestContextImpl requestContext = threadLocalRequestContext.get()[0]; - - if (requestContext == null) - throw new IllegalStateException("RequestContext has not been created."); - - return requestContext; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java b/trunk/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java deleted file mode 100644 index f71c8f32f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.Result; - -public class ResultAdapter implements Result { - - private static final long serialVersionUID = -5107033078266553554L; - final org.apache.struts2.spi.Result delegate; - - public ResultAdapter(org.apache.struts2.spi.Result delegate) { - this.delegate = delegate; - } - - public void execute(ActionInvocation invocation) throws Exception { - delegate.execute(RequestContextImpl.get()); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java b/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java deleted file mode 100644 index f13340531..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import java.util.Map; -import java.util.concurrent.Callable; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.DefaultActionProxy; -import com.opensymphony.xwork2.config.Configuration; - -public class StrutsActionProxy extends DefaultActionProxy { - - private static final long serialVersionUID = -2434901249671934080L; - - public StrutsActionProxy(Configuration cfg, String namespace, String actionName, Map extraContext, - boolean executeResult, boolean cleanupContext) throws Exception { - super(cfg, namespace, actionName, extraContext, executeResult, cleanupContext); - } - - public String execute() throws Exception { - ActionContext previous = ActionContext.getContext(); - ActionContext.setContext(invocation.getInvocationContext()); - try { - return RequestContextImpl.callInContext(invocation, new Callable() { - public String call() throws Exception { - return invocation.invoke(); - } - }); - } finally { - if (cleanupContext) - ActionContext.setContext(previous); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java b/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java deleted file mode 100644 index c55e5fd14..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import java.util.Map; - -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.DefaultActionProxyFactory; -import com.opensymphony.xwork2.config.Configuration; - -public class StrutsActionProxyFactory extends DefaultActionProxyFactory { - - public ActionProxy createActionProxy(Configuration config, String namespace, String actionName, Map extraContext) - throws Exception { - return new StrutsActionProxy(config, namespace, actionName, extraContext, true, true); - } - - public ActionProxy createActionProxy(Configuration config, String namespace, String actionName, Map extraContext, - boolean executeResult, boolean cleanupContext) throws Exception { - return new StrutsActionProxy(config, namespace, actionName, extraContext, executeResult, cleanupContext); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java b/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java deleted file mode 100644 index dda52dfd6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import java.util.HashMap; -import java.util.Map; - -import com.opensymphony.xwork2.ObjectFactory; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.config.ConfigurationException; -import com.opensymphony.xwork2.config.entities.InterceptorConfig; -import com.opensymphony.xwork2.config.entities.ResultConfig; -import com.opensymphony.xwork2.interceptor.Interceptor; -import com.opensymphony.xwork2.util.OgnlUtil; - -public class StrutsObjectFactory extends ObjectFactory { - - public Interceptor buildInterceptor(InterceptorConfig interceptorConfig, Map refParams) - throws ConfigurationException { - String className = interceptorConfig.getClassName(); - - Map params = new HashMap(); - Map typeParams = interceptorConfig.getParams(); - if (typeParams != null && !typeParams.isEmpty()) - params.putAll(typeParams); - if (refParams != null && !refParams.isEmpty()) - params.putAll(refParams); - params.putAll(refParams); - - try { - // interceptor instances are long-lived and used across user sessions, so don't try to pass in any extra - // context - Object o = buildBean(className, null); - OgnlUtil.setProperties(params, o); - - if (o instanceof Interceptor) { - Interceptor interceptor = (Interceptor) o; - interceptor.init(); - return interceptor; - } - - if (o instanceof org.apache.struts2.spi.Interceptor) - return new InterceptorAdapter((org.apache.struts2.spi.Interceptor) o); - - throw new ConfigurationException( - "Class [" + className + "] does not implement Interceptor", interceptorConfig); - } catch (InstantiationException e) { - throw new ConfigurationException( - "Unable to instantiate an instance of Interceptor class [" + className + "].", - e, interceptorConfig); - } catch (IllegalAccessException e) { - throw new ConfigurationException( - "IllegalAccessException while attempting to instantiate an instance of Interceptor class [" - + className + "].", - e, interceptorConfig); - } catch (Exception e) { - throw new ConfigurationException( - "Caught Exception while registering Interceptor class " + className, - e, interceptorConfig); - } catch (NoClassDefFoundError e) { - throw new ConfigurationException( - "Could not load class " + className - + ". Perhaps it exists but certain dependencies are not available?", - e, interceptorConfig); - } - } - - public Result buildResult(ResultConfig resultConfig, Map extraContext) throws Exception { - String resultClassName = resultConfig.getClassName(); - if (resultClassName == null) - return null; - - Object result = buildBean(resultClassName, extraContext); - OgnlUtil.setProperties(resultConfig.getParams(), result, extraContext); - - if (result instanceof Result) - return (Result) result; - - if (result instanceof org.apache.struts2.spi.Result) - return new ResultAdapter((org.apache.struts2.spi.Result) result); - - throw new ConfigurationException(result.getClass().getName() + " does not implement Result."); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java b/trunk/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java deleted file mode 100644 index 652a4fcdd..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. - -package org.apache.struts2.impl; - -import java.util.Iterator; - -import org.apache.struts2.spi.ValueStack; - -import com.opensymphony.xwork2.util.ValueStackFactory; - -public class ValueStackAdapter implements ValueStack { - - final com.opensymphony.xwork2.util.ValueStack delegate; - - public ValueStackAdapter(com.opensymphony.xwork2.util.ValueStack delegate) { - this.delegate = delegate; - } - - public Object peek() { - return delegate.peek(); - } - - public Object pop() { - return delegate.pop(); - } - - public void push(Object o) { - delegate.push(o); - } - - public ValueStack clone() { - return new ValueStackAdapter(ValueStackFactory.getFactory().createValueStack(delegate)); - } - - public Object get(String expr) { - return delegate.findValue(expr); - } - - public T get(String expr, Class requiredType) { - return (T) delegate.findValue(expr, requiredType); - } - - public String getString(String expr) { - return delegate.findString(expr); - } - - public void set(String expr, Object o) { - delegate.set(expr, o); - } - - public int size() { - return delegate.size(); - } - - public Iterator iterator() { - return delegate.getRoot().iterator(); - } -} \ No newline at end of file diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java deleted file mode 100644 index 7c173c1e1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java +++ /dev/null @@ -1,39 +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.interceptor; - -import java.util.Map; - - -/** - * Actions that want to be aware of the application Map object should implement this interface. - * This will give them access to a Map where they can put objects that should be available - * to other parts of the application.

    - *

    - * Typical uses are configuration objects and caches. - * - */ -public interface ApplicationAware { - - /** - * Sets the map of application properties in the implementing class. - * - * @param application a Map of application properties. - */ - public void setApplication(Map application); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java deleted file mode 100644 index ba82b1719..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java +++ /dev/null @@ -1,133 +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.interceptor; - -import java.io.Serializable; - -import com.opensymphony.xwork2.ActionInvocation; - -/** - * Background thread to be executed by the ExecuteAndWaitInterceptor. - * - */ -public class BackgroundProcess implements Serializable { - - private static final long serialVersionUID = 3884464776311686443L; - - protected Object action; - protected ActionInvocation invocation; - protected String result; - protected Exception exception; - protected boolean done; - - /** - * Constructs a background process - * - * @param threadName The thread name - * @param invocation The action invocation - * @param threadPriority The thread priority - */ - public BackgroundProcess(String threadName, final ActionInvocation invocation, int threadPriority) { - this.invocation = invocation; - this.action = invocation.getAction(); - try { - final Thread t = new Thread(new Runnable() { - public void run() { - try { - beforeInvocation(); - result = invocation.invokeActionOnly(); - afterInvocation(); - } catch (Exception e) { - exception = e; - } - - done = true; - } - }); - t.setName(threadName); - t.setPriority(threadPriority); - t.start(); - } catch (Exception e) { - exception = e; - } - } - - /** - * Called before the background thread determines the result code - * from the ActionInvocation. - * - * @throws Exception any exception thrown will be thrown, in turn, by the ExecuteAndWaitInterceptor - */ - protected void beforeInvocation() throws Exception { - } - - /** - * Called after the background thread determines the result code - * from the ActionInvocation, but before the background thread is - * marked as done. - * - * @throws Exception any exception thrown will be thrown, in turn, by the ExecuteAndWaitInterceptor - */ - protected void afterInvocation() throws Exception { - } - - /** - * Retrieves the action. - * - * @return the action. - */ - public Object getAction() { - return action; - } - - /** - * Retrieves the action invocation. - * - * @return the action invocation - */ - public ActionInvocation getInvocation() { - return invocation; - } - - /** - * Gets the result of the background process. - * - * @return the result; null if not done. - */ - public String getResult() { - return result; - } - - /** - * Gets the exception if any was thrown during the execution of the background process. - * - * @return the exception or null if no exception was thrown. - */ - public Exception getException() { - return exception; - } - - /** - * Returns the status of the background process. - * - * @return true if finished, false otherwise - */ - public boolean isDone() { - return done; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java deleted file mode 100644 index b441dbb97..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: CheckboxListTest.java 439747 2006-09-03 09:22:46Z mrdon $ - * - * 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.interceptor; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; - -import java.util.Map; -import java.util.Set; -import java.util.HashMap; -import java.util.Iterator; - -/** - * - * Looks for a hidden identification field that specifies the original value of the checkbox. - * If the checkbox isn't submitted, insert it into the parameters as if it was with the value - * of 'false'. - * - *

    - * - *

    • setUncheckedValue - - * The default value of an unchecked box can be overridden by setting the 'uncheckedValue' property. - *
    - * - *

    - * - *

    - * - */ -public class CheckboxInterceptor implements Interceptor { - - /** Auto-generated serialization id */ - private static final long serialVersionUID = -586878104807229585L; - - private String uncheckedValue = Boolean.FALSE.toString(); - - public void destroy() { - } - - public void init() { - } - - public String intercept(ActionInvocation ai) throws Exception { - Map parameters = ai.getInvocationContext().getParameters(); - Map newParams = new HashMap(); - Set keys = parameters.keySet(); - for (Iterator iterator = keys.iterator(); iterator.hasNext();) { - String key = iterator.next(); - - if (key.startsWith("__checkbox_")) { - String name = key.substring("__checkbox_".length()); - - iterator.remove(); - - // is this checkbox checked/submitted? - if (!parameters.containsKey(name)) { - // if not, let's be sure to default the value to false - newParams.put(name, uncheckedValue); - } - } - } - - parameters.putAll(newParams); - - return ai.invoke(); - } - - /** - * Overrides the default value for an unchecked checkbox - * - * @param uncheckedValue The uncheckedValue to set - */ - public void setUncheckedValue(String uncheckedValue) { - this.uncheckedValue = uncheckedValue; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java deleted file mode 100644 index a81dcd4f2..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java +++ /dev/null @@ -1,92 +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.interceptor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; - -/** - * - * - * This interceptor creates the HttpSession. - *

    - * This is particular usefull when using the <@s.token> tag in freemarker templates. - * The tag do require that a HttpSession is already created since freemarker commits - * the response to the client immediately. - * - * - * - *

    Interceptor parameters: - * - * - * - * - *

      - *
    • none
    • - *
    - * - * - * - * - * - * - *
      - * - *
    • None
    • - * - *
    - * - * - * - * Example: - * - *
    - * 
    - * 
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="create-session"/>
    - *     <interceptor-ref name="defaultStack"/>
    - *     <result name="input">input_with_token_tag.ftl</result>
    - * </action>
    - * 
    - * 
    - * 
    - * - * @version $Date$ $Id$ - */ -public class CreateSessionInterceptor extends AbstractInterceptor { - - private static final long serialVersionUID = -4590322556118858869L; - - private static final Log _log = LogFactory.getLog(CreateSessionInterceptor.class); - - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation) - */ - public String intercept(ActionInvocation invocation) throws Exception { - _log.debug("Creating HttpSession"); - ServletActionContext.getRequest().getSession(true); - return invocation.invoke(); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java deleted file mode 100644 index 0e821df7d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java +++ /dev/null @@ -1,333 +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.interceptor; - -import java.util.Collections; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.config.entities.ResultConfig; -import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor; - - -/** - * - * - * The ExecuteAndWaitInterceptor is great for running long-lived actions in the background while showing the user a nice - * progress meter. This also prevents the HTTP request from timing out when the action takes more than 5 or 10 minutes. - * - *

    Using this interceptor is pretty straight forward. Assuming that you are including struts-default.xml, this - * interceptor is already configured but is not part of any of the default stacks. Because of the nature of this - * interceptor, it must be the last interceptor in the stack. - * - *

    This interceptor works on a per-session basis. That means that the same action name (myLongRunningAction, in the - * above example) cannot be run more than once at a time in a given session. On the initial request or any subsequent - * requests (before the action has completed), the wait result will be returned. The wait result is - * responsible for issuing a subsequent request back to the action, giving the effect of a self-updating progress - * meter. - * - *

    If no "wait" result is found, Struts will automatically generate a wait result on the fly. This result is - * written in FreeMarker and cannot run unless FreeMarker is installed. If you don't wish to deploy with FreeMarker, you - * must provide your own wait result. This is generally a good thing to do anyway, as the default wait page is very - * plain. - * - *

    Whenever the wait result is returned, the action that is currently running in the background will be placed on - * top of the stack. This allows you to display progress data, such as a count, in the wait page. By making the wait - * page automatically reload the request to the action (which will be short-circuited by the interceptor), you can give - * the appearance of an automatic progress meter. - * - *

    This interceptor also supports using an initial wait delay. An initial delay is a time in milliseconds we let the - * server wait before the wait page is shown to the user. During the wait this interceptor will wake every 100 millis - * to check if the background process is done premature, thus if the job for some reason doesn't take to long the wait - * page is not shown to the user. - *
    This is useful for e.g. search actions that have a wide span of execution time. Using a delay time of 2000 - * millis we ensure the user is presented fast search results immediately and for the slow results a wait page is used. - * - *

    Important: Because the action will be running in a seperate thread, you can't use ActionContext because it - * is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware - * rather than calling ActionContext.getSesion(). - * - *

    The thread kicked off by this interceptor will be named in the form actionNameBrackgroundProcess. - * For example, the search action would run as a thread named searchBackgroundProcess. - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • threadPriority (optional) - the priority to assign the thread. Default is Thread.NORM_PRIORITY.
    • - *
    • delay (optional) - an initial delay in millis to wait before the wait page is shown (returning wait as result code). Default is no initial delay.
    • - *
    • delaySleepInterval (optional) - only used with delay. Used for waking up at certain intervals to check if the background process is already done. Default is 100 millis.
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * If you wish to make special preparations before and/or after the invocation of the background thread, you can extend - * the BackgroundProcess class and implement the beforeInvocation() and afterInvocation() methods. This may be useful - * for obtaining and releasing resources that the background process will need to execute successfully. To use your - * background process extension, extend ExecuteAndWaitInterceptor and implement the getNewBackgroundProcess() method. - * - * - * - *

    Example code: - * - *

    - * 
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="completeStack"/>
    - *     <interceptor-ref name="execAndWait"/>
    - *     <result name="wait">longRunningAction-wait.jsp</result>
    - *     <result name="success">longRunningAction-success.jsp</result>
    - * </action>
    - *
    - * <%@ taglib prefix="s" uri="/struts" %>
    - * <html>
    - *   <head>
    - *     <title>Please wait</title>
    - *     <meta http-equiv="refresh" content="5;url=<a:url includeParams="all" />"/>
    - *   </head>
    - *   <body>
    - *     Please wait while we process your request.
    - *     Click <a href="<a:url includeParams="all" />"></a> if this page does not reload automatically.
    - *   </body>
    - * </html>
    - * 
    - * - *

    Example code2: - * This example will wait 2 second (2000 millis) before the wait page is shown to the user. Therefore - * if the long process didn't last long anyway the user isn't shown a wait page. - * - *

    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="completeStack"/>
    - *     <interceptor-ref name="execAndWait">
    - *         <param name="delay">2000<param>
    - *     <interceptor-ref>
    - *     <result name="wait">longRunningAction-wait.jsp</result>
    - *     <result name="success">longRunningAction-success.jsp</result>
    - * </action>
    - * 
    - * - *

    Example code3: - * This example will wait 1 second (1000 millis) before the wait page is shown to the user. - * And at every 50 millis this interceptor will check if the background process is done, if so - * it will return before the 1 second has elapsed, and the user isn't shown a wait page. - * - *

    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="completeStack"/>
    - *     <interceptor-ref name="execAndWait">
    - *         <param name="delay">1000<param>
    - *         <param name="delaySleepInterval">50<param>
    - *     <interceptor-ref>
    - *     <result name="wait">longRunningAction-wait.jsp</result>
    - *     <result name="success">longRunningAction-success.jsp</result>
    - * </action>
    - * 
    - * - * - * - */ -public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor { - - private static final long serialVersionUID = -2754639196749652512L; - - private static final Log LOG = LogFactory.getLog(ExecuteAndWaitInterceptor.class); - - public static final String KEY = "__execWait"; - public static final String WAIT = "wait"; - protected int delay; - protected int delaySleepInterval = 100; // default sleep 100 millis before checking if background process is done - protected boolean executeAfterValidationPass = false; - - private int threadPriority = Thread.NORM_PRIORITY; - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#init() - */ - public void init() { - } - - /** - * Creates a new background process - * - * @param name The process name - * @param actionInvocation The action invocation - * @param threadPriority The thread priority - * @return The new process - */ - protected BackgroundProcess getNewBackgroundProcess(String name, ActionInvocation actionInvocation, int threadPriority) { - return new BackgroundProcess(name + "BackgroundThread", actionInvocation, threadPriority); - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork2.ActionInvocation) - */ - protected String doIntercept(ActionInvocation actionInvocation) throws Exception { - ActionProxy proxy = actionInvocation.getProxy(); - String name = proxy.getActionName(); - ActionContext context = actionInvocation.getInvocationContext(); - Map session = context.getSession(); - - Boolean secondTime = true; - if (executeAfterValidationPass) { - secondTime = (Boolean) context.get(KEY); - if (secondTime == null) { - context.put(KEY, true); - secondTime = false; - } else { - secondTime = true; - } - } - - synchronized (session) { - BackgroundProcess bp = (BackgroundProcess) session.get(KEY + name); - - if (secondTime && bp == null) { - bp = getNewBackgroundProcess(name, actionInvocation, threadPriority); - session.put(KEY + name, bp); - performInitialDelay(bp); // first time let some time pass before showing wait page - secondTime = false; - } - - if (!secondTime && bp != null && !bp.isDone()) { - actionInvocation.getStack().push(bp.getAction()); - Map results = proxy.getConfig().getResults(); - if (!results.containsKey(WAIT)) { - LOG.warn("ExecuteAndWait interceptor has detected that no result named 'wait' is available. " + - "Defaulting to a plain built-in wait page. It is highly recommend you " + - "provide an action-specific or global result named '" + WAIT + - "'! This requires FreeMarker support and won't work if you don't have it installed"); - // no wait result? hmm -- let's try to do dynamically put it in for you! - ResultConfig rc = new ResultConfig(WAIT, "org.apache.struts2.views.freemarker.FreemarkerResult", - Collections.singletonMap("location", "/org/apache/struts2/interceptor/wait.ftl")); - results.put(WAIT, rc); - } - - return WAIT; - } else if (!secondTime && bp != null && bp.isDone()) { - session.remove(KEY + name); - actionInvocation.getStack().push(bp.getAction()); - - // if an exception occured during action execution, throw it here - if (bp.getException() != null) { - throw bp.getException(); - } - - return bp.getResult(); - } else { - // this is the first instance of the interceptor and there is no existing action - // already run in the background, so let's just let this pass through. We assume - // the action invocation will be run in the background on the subsequent pass through - // this interceptor - return actionInvocation.invoke(); - } - } - } - - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy() - */ - public void destroy() { - } - - /** - * Performs the initial delay. - *

    - * When this interceptor is executed for the first time this methods handles any provided initial delay. - * An initial delay is a time in miliseconds we let the server wait before we continue. - *
    During the wait this interceptor will wake every 100 millis to check if the background - * process is done premature, thus if the job for some reason doesn't take to long the wait - * page is not shown to the user. - * - * @param bp the background process - * @throws InterruptedException is thrown by Thread.sleep - */ - protected void performInitialDelay(BackgroundProcess bp) throws InterruptedException { - if (delay <= 0 || delaySleepInterval <= 0) { - return; - } - - int steps = delay / delaySleepInterval; - if (LOG.isDebugEnabled()) { - LOG.debug("Delaying for " + delay + " millis. (using " + steps + " steps)"); - } - int step; - for (step = 0; step < steps && !bp.isDone(); step++) { - Thread.sleep(delaySleepInterval); - } - if (LOG.isDebugEnabled()) { - LOG.debug("Sleeping ended after " + step + " steps and the background process is " + (bp.isDone() ? " done" : " not done")); - } - } - - /** - * Sets the thread priority of the background process. - * - * @param threadPriority the priority from Thread.XXX - */ - public void setThreadPriority(int threadPriority) { - this.threadPriority = threadPriority; - } - - /** - * Sets the initial delay in millis (msec). - * - * @param delay in millis. (0 for not used) - */ - public void setDelay(int delay) { - this.delay = delay; - } - - /** - * Sets the sleep interval in millis (msec) when performing the initial delay. - * - * @param delaySleepInterval in millis (0 for not used) - */ - public void setDelaySleepInterval(int delaySleepInterval) { - this.delaySleepInterval = delaySleepInterval; - } - - /** - * Whether to start the background process after the second pass (first being validation) - * or not - * - * @param executeAfterValidationPass the executeAfterValidationPass to set - */ - public void setExecuteAfterValidationPass(boolean executeAfterValidationPass) { - this.executeAfterValidationPass = executeAfterValidationPass; - } - - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java deleted file mode 100644 index 11c2a4abc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java +++ /dev/null @@ -1,369 +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.interceptor; - -import java.io.File; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.ValidationAware; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; -import com.opensymphony.xwork2.util.LocalizedTextUtil; - -/** - * - * - * Interceptor that is based off of {@link MultiPartRequestWrapper}, which is automatically applied for any request that - * includes a file. It adds the following parameters, where [File Name] is the name given to the file uploaded by the - * HTML form: - * - *

      - * - *
    • [File Name] : File - the actual File
    • - * - *
    • [File Name]ContentType : String - the content type of the file
    • - * - *
    • [File Name]FileName : String - the actual name of the file uploaded (not the HTML name)
    • - * - *
    - * - *

    You can get access to these files by merely providing setters in your action that correspond to any of the three - * patterns above, such as setDocument(File document), setDocumentContentType(String contentType), etc. - *
    See the example code section. - * - *

    This interceptor will add several field errors, assuming that the action implements {@link ValidationAware}. - * These error messages are based on several i18n values stored in struts-messages.properties, a default i18n file - * processed for all i18n requests. You can override the text of these messages by providing text for the following - * keys: - * - *

      - * - *
    • struts.messages.error.uploading - a general error that occurs when the file could not be uploaded
    • - * - *
    • struts.messages.error.file.too.large - occurs when the uploaded file is too large
    • - * - *
    • struts.messages.error.content.type.not.allowed - occurs when the uploaded file does not match the expected - * content types specified
    • - * - *
    - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • maximumSize (optional) - the maximum size (in bytes) that the interceptor will allow a file reference to be set - * on the action. Note, this is not related to the various properties found in struts.properties. - * Default to approximately 2MB.
    • - * - *
    • allowedTypes (optional) - a comma separated list of content types (ie: text/html) that the interceptor will allow - * a file reference to be set on the action. If none is specified allow all types to be uploaded.
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * You can extend this interceptor and override the {@link #acceptFile} method to provide more control over which files - * are supported and which are not. - * - * - * - *

    Example code: - * - *

    - * 
    - * <action name="doUpload" class="com.examples.UploadAction">
    - *     <interceptor-ref name="fileUpload"/>
    - *     <interceptor-ref name="basicStack"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * - * And then you need to set encoding multipart/form-data in the form where the user selects the file to upload. - *
    - *   <a:form action="doUpload" method="post" enctype="multipart/form-data">
    - *       <a:file name="upload" label="File"/>
    - *       <a:submit/>
    - *   </a:form>
    - * 
    - * - * And then in your action code you'll have access to the File object if you provide setters according to the - * naming convention documented in the start. - * - *
    - *    public com.examples.UploadAction implemements Action {
    - *       private File file;
    - *       private String contentType;
    - *       private String filename;
    - *
    - *       public void setUpload(File file) {
    - *          this.file = file;
    - *       }
    - *
    - *       public void setUploadContentType(String contentType) {
    - *          this.contentType = contentType;
    - *       }
    - *
    - *       public void setUploadFileName(String filename) {
    - *          this.filename = filename;
    - *       }
    - *
    - *       ...
    - *  }
    - * 
    - * - * - */ -public class FileUploadInterceptor extends AbstractInterceptor { - - private static final long serialVersionUID = -4764627478894962478L; - - protected static final Log log = LogFactory.getLog(FileUploadInterceptor.class); - private static final String DEFAULT_DELIMITER = ","; - private static final String DEFAULT_MESSAGE = "no.message.found"; - - protected Long maximumSize; - protected String allowedTypes; - protected Set allowedTypesSet = Collections.EMPTY_SET; - - /** - * Sets the allowed mimetypes - * - * @param allowedTypes A comma-delimited list of types - */ - public void setAllowedTypes(String allowedTypes) { - this.allowedTypes = allowedTypes; - - // set the allowedTypes as a collection for easier access later - allowedTypesSet = getDelimitedValues(allowedTypes); - } - - /** - * Sets the maximum size of an uploaded file - * - * @param maximumSize The maximum size in bytes - */ - public void setMaximumSize(Long maximumSize) { - this.maximumSize = maximumSize; - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation) - */ - public String intercept(ActionInvocation invocation) throws Exception { - ActionContext ac = invocation.getInvocationContext(); - HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST); - - if (!(request instanceof MultiPartRequestWrapper)) { - if (log.isDebugEnabled()) { - ActionProxy proxy = invocation.getProxy(); - log.debug(getTextMessage("struts.messages.bypass.request", new Object[]{proxy.getNamespace(), proxy.getActionName()}, ActionContext.getContext().getLocale())); - } - - return invocation.invoke(); - } - - final Object action = invocation.getAction(); - ValidationAware validation = null; - - if (action instanceof ValidationAware) { - validation = (ValidationAware) action; - } - - MultiPartRequestWrapper multiWrapper = (MultiPartRequestWrapper) request; - - if (multiWrapper.hasErrors()) { - for (Iterator errorIter = multiWrapper.getErrors().iterator(); errorIter.hasNext();) { - String error = (String) errorIter.next(); - - if (validation != null) { - validation.addActionError(error); - } - - log.error(error); - } - } - - Map parameters = ac.getParameters(); - - // Bind allowed Files - Enumeration fileParameterNames = multiWrapper.getFileParameterNames(); - while (fileParameterNames != null && fileParameterNames.hasMoreElements()) { - // get the value of this input tag - String inputName = (String) fileParameterNames.nextElement(); - - // get the content type - String[] contentType = multiWrapper.getContentTypes(inputName); - - if (isNonEmpty(contentType)) { - // get the name of the file from the input tag - String[] fileName = multiWrapper.getFileNames(inputName); - - if (isNonEmpty(fileName)) { - // Get a File object for the uploaded File - File[] files = multiWrapper.getFiles(inputName); - if (files != null) { - for (int index = 0; index < files.length; index++) { - getTextMessage("struts.messages.current.file", new Object[]{inputName, contentType[index], fileName[index], files[index]}, ActionContext.getContext().getLocale()); - - if (acceptFile(files[0], contentType[0], inputName, validation, ac.getLocale())) { - parameters.put(inputName, files); - parameters.put(inputName + "ContentType", contentType); - parameters.put(inputName + "FileName", fileName); - } - } - } - } else { - log.error(getTextMessage("struts.messages.invalid.file", new Object[]{inputName}, ActionContext.getContext().getLocale())); - } - } else { - log.error(getTextMessage("struts.messages.invalid.content.type", new Object[]{inputName}, ActionContext.getContext().getLocale())); - } - } - - // invoke action - String result = invocation.invoke(); - - // cleanup - fileParameterNames = multiWrapper.getFileParameterNames(); - while (fileParameterNames != null && fileParameterNames.hasMoreElements()) { - String inputValue = (String) fileParameterNames.nextElement(); - File[] file = multiWrapper.getFiles(inputValue); - for (int index = 0; index < file.length; index++) { - File currentFile = file[index]; - log.info(getTextMessage("struts.messages.removing.file", new Object[]{inputValue, currentFile}, ActionContext.getContext().getLocale())); - - if ((currentFile != null) && currentFile.isFile()) { - currentFile.delete(); - } - } - } - - return result; - } - - /** - * Override for added functionality. Checks if the proposed file is acceptable based on contentType and size. - * - * @param file - proposed upload file. - * @param contentType - contentType of the file. - * @param inputName - inputName of the file. - * @param validation - Non-null ValidationAware if the action implements ValidationAware, allowing for better - * logging. - * @param locale - * @return true if the proposed file is acceptable by contentType and size. - */ - protected boolean acceptFile(File file, String contentType, String inputName, ValidationAware validation, Locale locale) { - boolean fileIsAcceptable = false; - - // If it's null the upload failed - if (file == null) { - String errMsg = getTextMessage("struts.messages.error.uploading", new Object[]{inputName}, locale); - if (validation != null) { - validation.addFieldError(inputName, errMsg); - } - - log.error(errMsg); - } else if (maximumSize != null && maximumSize.longValue() < file.length()) { - String errMsg = getTextMessage("struts.messages.error.file.too.large", new Object[]{inputName, file.getName(), "" + file.length()}, locale); - if (validation != null) { - validation.addFieldError(inputName, errMsg); - } - - log.error(errMsg); - } else if ((! allowedTypesSet.isEmpty()) && (!containsItem(allowedTypesSet, contentType))) { - String errMsg = getTextMessage("struts.messages.error.content.type.not.allowed", new Object[]{inputName, file.getName(), contentType}, locale); - if (validation != null) { - validation.addFieldError(inputName, errMsg); - } - - log.error(errMsg); - } else { - fileIsAcceptable = true; - } - - return fileIsAcceptable; - } - - /** - * @param itemCollection - Collection of string items (all lowercase). - * @param key - Key to search for. - * @return true if itemCollection contains the key, false otherwise. - */ - private static boolean containsItem(Collection itemCollection, String key) { - return itemCollection.contains(key.toLowerCase()); - } - - private static Set getDelimitedValues(String delimitedString) { - Set delimitedValues = new HashSet(); - if (delimitedString != null) { - StringTokenizer stringTokenizer = new StringTokenizer(delimitedString, DEFAULT_DELIMITER); - while (stringTokenizer.hasMoreTokens()) { - String nextToken = stringTokenizer.nextToken().toLowerCase().trim(); - if (nextToken.length() > 0) { - delimitedValues.add(nextToken); - } - } - } - return delimitedValues; - } - - private static boolean isNonEmpty(Object[] objArray) { - boolean result = false; - for (int index = 0; index < objArray.length && !result; index++) { - if (objArray[index] != null) { - result = true; - } - } - return result; - } - - private String getTextMessage(String messageKey, Object[] args, Locale locale) { - if (args == null || args.length == 0) { - return LocalizedTextUtil.findText(this.getClass(), messageKey, locale); - } else { - return LocalizedTextUtil.findText(this.getClass(), messageKey, locale, DEFAULT_MESSAGE, args); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java deleted file mode 100644 index 5fecf94ad..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java +++ /dev/null @@ -1,330 +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.interceptor; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ValidationAware; -import com.opensymphony.xwork2.interceptor.Interceptor; - -/** - * - * - * An interceptor to store {@link ValidationAware} action's messages / errors and field errors into - * Http Session, such that it will be retrieveable at a later stage. This allows the action's message / - * errors and field errors to be available longer that just the particular http request. - * - *

    - * - * In the 'STORE' mode, the interceptor will store the {@link ValidationAware} action's message / errors - * and field errors into Http session. - * - *

    - * - * In the 'RETRIEVE' mode, the interceptor will retrieve the stored action's message / errors and field - * errors and put them back into the {@link ValidationAware} action. - * - *

    - * - * The interceptor does nothing in the 'NONE' mode, which is the default. - * - *

    - * - * The operation mode could be switched using :-

    - * 1] Setting the iterceptor parameter eg. - *

    - *   <action name="submitApplication" ...>
    - *      <interceptor-ref name="store">
    - *         <param name="operationMode">l;STORE</param>
    - *      </interceptor-ref>
    - *      <interceptor-ref name="defaultStack" />
    - *      ....
    - *   </action>
    - * 
    - * - * 2] Through request parameter (allowRequestParameterSwitch must be 'true' which is the default) - *
    - *   // the request will have the operation mode in 'STORE'
    - *   http://localhost:8080/context/submitApplication.action?operationMode=STORE
    - * 
    - * - * - * - * - * - * - *
      - *
    • allowRequestParameterSwitch - To enable request parameter that could switch the operation mode - * of this interceptor.
    • - *
    • requestParameterSwitch - The request parameter that will indicate what mode this - * interceptor is in.
    • - *
    • operationMode - The operation mode this interceptor should be in - * (either 'STORE', 'RETRIEVE' or 'NONE'). 'NONE' being the default.
    • - *
    - * - * - * - *

    - * - * - * - * The following method could be overriden :- - *

      - *
    • getRequestOperationMode - get the operation mode of this interceptor based on the request parameters
    • - *
    • mergeCollection - merge two collections
    • - *
    • mergeMap - merge two map
    • - *
    - * - * - * - *
    - * 
    - * 
    - * <action name="submitApplication" ....>
    - *    <interceptor-ref name="store">
    - *    	<param name="operationMode">STORE</param>
    - *    </interceptor-ref>
    - *    <interceptor-ref name="defaultStack" />
    - *    <result name="input" type="redirect">applicationFailed.action</result>
    - *    <result type="dispatcher">applicationSuccess.jsp</result>
    - * </action>
    - * 
    - * <action name="applicationFailed" ....>
    - *    <interceptor-ref name="store">
    - *       <param name="operationMode">RETRIEVE</param>
    - *    </interceptor-ref>
    - *    <result>applicationFailed.jsp</result>
    - * </action>
    - * 
    - * 
    - * 
    - * - * - * - * With the example above, 'submitApplication.action' will have the action messages / errors / field errors stored - * in the Http Session. Later when needed, (in this case, when 'applicationFailed.action' is fired, it - * will get the action messages / errors / field errors stored in the Http Session and put them back into - * the action. - * - * - * - * @version $Date$ $Id$ - */ -public class MessageStoreInterceptor implements Interceptor { - - private static final long serialVersionUID = 4491997514314242420L; - - private static final Log _log = LogFactory.getLog(MessageStoreInterceptor.class); - - - public static final String STORE_MODE = "STORE"; - public static final String RETRIEVE_MODE = "RETRIEVE"; - public static final String NONE = "NONE"; - - private boolean allowRequestParameterSwitch = true; - private String requestParameterSwitch = "operationMode"; - private String operationMode = NONE; - - public static String fieldErrorsSessionKey = "__MessageStoreInterceptor_FieldErrors_SessionKey"; - public static String actionErrorsSessionKey = "__MessageStoreInterceptor_ActionErrors_SessionKey"; - public static String actionMessagesSessionKey = "__MessageStoreInterceptor_ActionMessages_SessionKey"; - - - - public void setAllowRequestParameterSwitch(boolean allowRequestParameterSwitch) { - this.allowRequestParameterSwitch = allowRequestParameterSwitch; - } - public boolean getAllowRequestParameterSwitch() { - return this.allowRequestParameterSwitch; - } - - - public void setRequestParameterSwitch(String requestParameterSwitch) { - this.requestParameterSwitch = requestParameterSwitch; - } - public String getRequestParameterSwitch() { - return this.requestParameterSwitch; - } - - - - public void setOperationMode(String operationMode) { - this.operationMode = operationMode; - } - public String getOperationModel() { - return this.operationMode; - } - - - public void destroy() { - } - - public void init() { - } - - public String intercept(ActionInvocation invocation) throws Exception { - _log.debug("entering MessageStoreInterceptor ..."); - - before(invocation); - String result = invocation.invoke(); - after(invocation, result); - - _log.debug("exit executing MessageStoreInterceptor"); - return result; - } - - /** - * Handle the retrieving of field errors / action messages / field errors, which is - * done before action invocation, and the operationMode is 'RETRIEVE'. - * - * @param invocation - * @throws Exception - */ - protected void before(ActionInvocation invocation) throws Exception { - String reqOperationMode = getRequestOperationMode(invocation); - - if (RETRIEVE_MODE.equalsIgnoreCase(reqOperationMode) || - RETRIEVE_MODE.equalsIgnoreCase(operationMode)) { - - Object action = invocation.getAction(); - if (action instanceof ValidationAware) { - // retrieve error / message from session - Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); - ValidationAware validationAwareAction = (ValidationAware) action; - - _log.debug("retrieve error / message from session to populate into action ["+action+"]"); - - Collection actionErrors = (Collection) session.get(actionErrorsSessionKey); - Collection actionMessages = (Collection) session.get(actionMessagesSessionKey); - Map fieldErrors = (Map) session.get(fieldErrorsSessionKey); - - if (actionErrors != null && actionErrors.size() > 0) { - Collection mergedActionErrors = mergeCollection(validationAwareAction.getActionErrors(), actionErrors); - validationAwareAction.setActionErrors(mergedActionErrors); - } - - if (actionMessages != null && actionMessages.size() > 0) { - Collection mergedActionMessages = mergeCollection(validationAwareAction.getActionMessages(), actionMessages); - validationAwareAction.setActionMessages(mergedActionMessages); - } - - if (fieldErrors != null && fieldErrors.size() > 0) { - Map mergedFieldErrors = mergeMap(validationAwareAction.getFieldErrors(), fieldErrors); - validationAwareAction.setFieldErrors(mergedFieldErrors); - } - session.remove(actionErrorsSessionKey); - session.remove(actionMessagesSessionKey); - session.remove(fieldErrorsSessionKey); - } - } - } - - /** - * Handle the storing of field errors / action messages / field errors, which is - * done after action invocation, and the operationMode is in 'STORE'. - * - * @param invocation - * @param result - * @throws Exception - */ - protected void after(ActionInvocation invocation, String result) throws Exception { - - String reqOperationMode = getRequestOperationMode(invocation); - if (STORE_MODE.equalsIgnoreCase(reqOperationMode) || - STORE_MODE.equalsIgnoreCase(operationMode)) { - - Object action = invocation.getAction(); - if (action instanceof ValidationAware) { - // store error / messages into session - Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); - - _log.debug("store action ["+action+"] error/messages into session "); - - ValidationAware validationAwareAction = (ValidationAware) action; - session.put(actionErrorsSessionKey, validationAwareAction.getActionErrors()); - session.put(actionMessagesSessionKey, validationAwareAction.getActionMessages()); - session.put(fieldErrorsSessionKey, validationAwareAction.getFieldErrors()); - } - else { - _log.debug("Action ["+action+"] is not ValidationAware, no message / error that are storeable"); - } - } - } - - - /** - * Get the operationMode through request paramter, if allowRequestParameterSwitch - * is 'true', else it simply returns 'NONE', meaning its neither in the 'STORE_MODE' nor - * 'RETRIEVE_MODE'. - * - * @return String - */ - protected String getRequestOperationMode(ActionInvocation invocation) { - String reqOperationMode = NONE; - if (allowRequestParameterSwitch) { - Map reqParams = (Map) invocation.getInvocationContext().get(ActionContext.PARAMETERS); - boolean containsParameter = reqParams.containsKey(requestParameterSwitch); - if (containsParameter) { - String[] reqParamsArr = (String[]) reqParams.get(requestParameterSwitch); - if (reqParamsArr != null && reqParamsArr.length > 0) { - reqOperationMode = reqParamsArr[0]; - } - } - } - return reqOperationMode; - } - - /** - * Merge col1 and col2 and return the composite - * Collection. - * - * @param col1 - * @param col2 - * @return Collection - */ - protected Collection mergeCollection(Collection col1, Collection col2) { - Collection _col1 = (col1 == null ? new ArrayList() : col1); - Collection _col2 = (col2 == null ? new ArrayList() : col2); - _col1.addAll(_col2); - return _col1; - } - - /** - * Merge map1 and map2 and return the composite - * Map - * - * @param map1 - * @param map2 - * @return Map - */ - protected Map mergeMap(Map map1, Map map2) { - Map _map1 = (map1 == null ? new LinkedHashMap() : map1); - Map _map2 = (map2 == null ? new LinkedHashMap() : map2); - _map1.putAll(_map2); - return _map1; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java deleted file mode 100644 index 5fb3eb877..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java +++ /dev/null @@ -1,29 +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.interceptor; - - -/** - * This marker interface should be implemented by actions that do not want any parameters set on - * them automatically. This may be useful if one is using the action tag and want to supply - * the parameters to the action manually using the param tag. It may also be useful if one for - * security reasons wants to make sure that parameters cannot be set by malicious users. - * - */ -public interface NoParameters extends com.opensymphony.xwork2.interceptor.NoParameters { -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java deleted file mode 100644 index a1071c48a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java +++ /dev/null @@ -1,42 +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.interceptor; - -import java.util.Map; - - -/** - * This interface gives actions an alternative way of receiving input parameters. The map will - * contain all input parameters as name/value entries. Actions that need this should simply implement it.

    - *

    - * One common use for this is to have the action propagate parameters to internally instantiated data - * objects.

    - *

    - * Note that all parameter values for a given name will be returned, so the type of the objects in - * the map is java.lang.String[]. - * - */ -public interface ParameterAware { - - /** - * Sets the map of input parameters in the implementing class. - * - * @param parameters a Map of parameters (name/value Strings). - */ - public void setParameters(Map parameters); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java deleted file mode 100644 index 891a86092..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java +++ /dev/null @@ -1,30 +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.interceptor; - -/** - * Actions that want access to the Principal information from HttpServletRequest object - * should implement this interface. - * - *

    This interface is only relevant if the Action is used in a servlet environment. - * By using this interface you will not become tied to servlet environment.

    - * - */ -public interface PrincipalAware { - void setPrincipalProxy(PrincipalProxy principalProxy); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java deleted file mode 100644 index e513071be..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java +++ /dev/null @@ -1,86 +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.interceptor; - -import java.security.Principal; - -import javax.servlet.http.HttpServletRequest; - -/** - * Proxy class used together with PrincipalAware interface. It allows to get indirect access to - * HttpServletRequest Principal related methods. - * - */ -public class PrincipalProxy { - private HttpServletRequest request; - - /** - * Constructs a proxy - * - * @param request The underlying request - */ - public PrincipalProxy(HttpServletRequest request) { - this.request = request; - } - - /** - * True if the user is in the given role - * - * @param role The role - * @return True if the user is in that role - */ - public boolean isUserInRole(String role) { - return request.isUserInRole(role); - } - - /** - * Gets the user principal - * - * @return The principal - */ - public Principal getUserPrincipal() { - return request.getUserPrincipal(); - } - - /** - * Gets the user id - * - * @return The user id - */ - public String getRemoteUser() { - return request.getRemoteUser(); - } - - /** - * Is the request using https? - * - * @return True if using https - */ - public boolean isRequestSecure() { - return request.isSecure(); - } - - /** - * Gets the request - * - * @return The request - */ - public HttpServletRequest getRequest() { - return request; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java deleted file mode 100644 index 1e619cf05..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: CreateSessionInterceptor.java 439747 2006-09-03 09:22:46Z mrdon $ - * - * 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.interceptor; - -import org.apache.struts2.dispatcher.Dispatcher; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; -import com.opensymphony.xwork2.util.profiling.UtilTimerStack; - -/** - * Allows profiling to be enabled or disabled via request parameters, when - * devMode is enabled. - */ -public class ProfilingActivationInterceptor extends AbstractInterceptor { - - private String profilingKey = "profiling"; - - /** - * @return the profilingKey - */ - public String getProfilingKey() { - return profilingKey; - } - - /** - * @param profilingKey the profilingKey to set - */ - public void setProfilingKey(String profilingKey) { - this.profilingKey = profilingKey; - } - - @Override - public String intercept(ActionInvocation invocation) throws Exception { - if (Dispatcher.getInstance().isDevMode()) { - Object val = invocation.getInvocationContext().getParameters().get(profilingKey); - if (val != null) { - String sval = (val instanceof String ? (String)val : ((String[])val)[0]); - boolean enable = "yes".equalsIgnoreCase(sval) || "true".equalsIgnoreCase(sval); - UtilTimerStack.setActive(enable); - invocation.getInvocationContext().getParameters().remove(profilingKey); - } - } - return invocation.invoke(); - - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java deleted file mode 100644 index 77b42d46b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java +++ /dev/null @@ -1,38 +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.interceptor; - -import java.util.Map; - -/** - * Actions that want access to the current serlvet request attributes should implement this interface.

    - * - * This interface is only relevant if the Action is used in a servlet environment.

    - * - * Note that using this interface makes the Action tied to a servlet environment, so it should be - * avoided if possible since things like unit testing will become more difficult. - */ -public interface RequestAware { - - /** - * Sets the Map of request attributes in the implementing class. - * - * @param request a Map of HTTP request attribute name/value pairs. - */ - public void setRequest(Map request); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java deleted file mode 100644 index bcf63ab89..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java +++ /dev/null @@ -1,441 +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.interceptor; - -import java.util.IdentityHashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsException; -import org.apache.struts2.dispatcher.SessionMap; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; -import com.opensymphony.xwork2.interceptor.PreResultListener; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * This is designed to solve a few simple issues related to wizard-like functionality in Struts. One of those issues is - * that some applications have a application-wide parameters commonly used, such pageLen (used for records per - * page). Rather than requiring that each action check if such parameters are supplied, this interceptor can look for - * specified parameters and pull them out of the session. - * - *

    This works by setting listed properties at action start with values from session/application attributes keyed - * after the action's class, the action's name, or any supplied key. After action is executed all the listed properties - * are taken back and put in session or application context. - * - *

    To make sure that each execution of the action is consistent it makes use of session-level locking. This way it - * guarantees that each action execution is atomic at the session level. It doesn't guarantee application level - * consistency however there has yet to be enough reasons to do so. Application level consistency would also be a big - * performance overkill. - * - *

    Note that this interceptor takes a snapshot of action properties just before result is presented (using a {@link - * PreResultListener}), rather than after action is invoked. There is a reason for that: At this moment we know that - * action's state is "complete" as it's values may depend on the rest of the stack and specifically - on the values of - * nested interceptors. - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • session - a list of action properties to be bound to session scope
    • - * - *
    • application - a list of action properties to be bound to application scope
    • - * - *
    • key - a session/application attribute key prefix, can contain following values:
    • - * - *
        - * - *
      • CLASS - that creates a unique key prefix based on action namespace and action class, it's a default value
      • - * - *
      • ACTION - creates a unique key prefix based on action namespace and action name
      • - * - *
      • any other value is taken literally as key prefix
      • - * - *
      - * - *
    • type - with one of the following
    • - * - *
        - * - *
      • start - means it's a start action of the wizard-like action sequence and all session scoped properties are reset - * to their defaults
      • - * - *
      • end - means that session scoped properties are removed from session after action is run
      • - * - *
      • any other value or no value means that it's in-the-middle action that is set with session properties before it's - * executed, and it's properties are put back to session after execution
      • - * - *
      - * - *
    • sessionReset - boolean value causing all session values to be reset to action's default values or application - * scope values, note that it is similliar to type="start" and in fact it does the same, but in our team it is sometimes - * semantically preferred. We use session scope in two patterns - sometimes there are wizzard-like action sequences that - * have start and end, and sometimes we just want simply reset current session values.
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * There are no know extension points for this interceptor. - * - * - * - *

    Example code: - * - *

    - * 
    - * <!-- As the filter and orderBy parameters are common for all my browse-type actions,
    - *      you can move control to the scope interceptor. In the session parameter you can list
    - *      action properties that are going to be automatically managed over session. You can
    - *      do the same for application-scoped variables-->
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="basicStack"/>
    - *     <interceptor-ref name="hibernate"/>
    - *     <interceptor-ref name="scope">
    - *         <param name="session">filter,orderBy</param>
    - *         <param name="autoCreateSession">true</param>
    - *     </interceptor-ref>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * 
    - * - */ -public class ScopeInterceptor extends AbstractInterceptor implements PreResultListener { - - private static final long serialVersionUID = 9120762699600054395L; - - private static final Log LOG = LogFactory.getLog(ScopeInterceptor.class); - - private String[] application = null; - private String[] session = null; - private String key; - private String type = null; - private boolean autoCreateSession = true; - private String sessionReset = "session.reset"; - private boolean reset = false; - - /** - * Sets a list of application scoped properties - * - * @param s A comma-delimited list - */ - public void setApplication(String s) { - if (s != null) { - application = s.split(" *, *"); - } - } - - /** - * Sets a list of session scoped properties - * - * @param s A comma-delimited list - */ - public void setSession(String s) { - if (s != null) { - session = s.split(" *, *"); - } - } - - /** - * Sets if the session should be automatically created - * - * @param value True if it should be created - */ - public void setAutoCreateSession(String value) { - if (value != null && value.length() > 0) { - this.autoCreateSession = new Boolean(value).booleanValue(); - } - } - - private String getKey(ActionInvocation invocation) { - ActionProxy proxy = invocation.getProxy(); - if (key == null || "CLASS".equals(key)) { - return "struts.ScopeInterceptor:" + proxy.getAction().getClass(); - } else if ("ACTION".equals(key)) { - return "struts.ScopeInterceptor:" + proxy.getNamespace() + ":" + proxy.getActionName(); - } - return key; - } - - /** - * The constructor - */ - public ScopeInterceptor() { - super(); - } - - - private static final Object NULL = new Object() { - public String toString() { - return "NULL"; - } - }; - - private static final Object nullConvert(Object o) { - if (o == null) { - return NULL; - } - - if (o == NULL) { - return null; - } - - return o; - } - - - private static Map locks = new IdentityHashMap(); - - static final void lock(Object o, ActionInvocation invocation) throws Exception { - synchronized (o) { - int count = 3; - Object previous = null; - while ((previous = locks.get(o)) != null) { - if (previous == invocation) { - return; - } - if (count-- <= 0) { - locks.remove(o); - o.notify(); - - throw new StrutsException("Deadlock in session lock"); - } - o.wait(10000); - } - ; - locks.put(o, invocation); - } - } - - static final void unlock(Object o) { - synchronized (o) { - locks.remove(o); - o.notify(); - } - } - - protected void after(ActionInvocation invocation, String result) throws Exception { - Map ses = ActionContext.getContext().getSession(); - if ( ses != null) { - unlock(ses); - } - } - - - protected void before(ActionInvocation invocation) throws Exception { - invocation.addPreResultListener(this); - Map ses = ActionContext.getContext().getSession(); - if (ses == null && autoCreateSession) { - ses = new SessionMap(ServletActionContext.getRequest()); - ActionContext.getContext().setSession(ses); - } - - if ( ses != null) { - lock(ses, invocation); - } - - String key = getKey(invocation); - Map app = ActionContext.getContext().getApplication(); - final ValueStack stack = ActionContext.getContext().getValueStack(); - - if (LOG.isDebugEnabled()) { - LOG.debug("scope interceptor before"); - } - - if (application != null) - for (int i = 0; i < application.length; i++) { - String string = application[i]; - Object attribute = app.get(key + string); - if (attribute != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("application scoped variable set " + string + " = " + String.valueOf(attribute)); - } - - stack.setValue(string, nullConvert(attribute)); - } - } - - if (ActionContext.getContext().getParameters().get(sessionReset) != null) { - return; - } - - if (reset) { - return; - } - - if (ses == null) { - LOG.debug("No HttpSession created... Cannot set session scoped variables"); - return; - } - - if (session != null && (!"start".equals(type))) { - for (int i = 0; i < session.length; i++) { - String string = session[i]; - Object attribute = ses.get(key + string); - if (attribute != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("session scoped variable set " + string + " = " + String.valueOf(attribute)); - } - stack.setValue(string, nullConvert(attribute)); - } - } - } - } - - public void setKey(String key) { - this.key = key; - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.PreResultListener#beforeResult(com.opensymphony.xwork2.ActionInvocation, java.lang.String) - */ - public void beforeResult(ActionInvocation invocation, String resultCode) { - String key = getKey(invocation); - Map app = ActionContext.getContext().getApplication(); - final ValueStack stack = ActionContext.getContext().getValueStack(); - - if (application != null) - for (int i = 0; i < application.length; i++) { - String string = application[i]; - Object value = stack.findValue(string); - if (LOG.isDebugEnabled()) { - LOG.debug("application scoped variable saved " + string + " = " + String.valueOf(value)); - } - - //if( value != null) - app.put(key + string, nullConvert(value)); - } - - boolean ends = "end".equals(type); - - Map ses = ActionContext.getContext().getSession(); - if (ses != null) { - - if (session != null) { - for (int i = 0; i < session.length; i++) { - String string = session[i]; - if (ends) { - ses.remove(key + string); - } else { - Object value = stack.findValue(string); - - if (LOG.isDebugEnabled()) { - LOG.debug("session scoped variable saved " + string + " = " + String.valueOf(value)); - } - - // Null value should be scoped too - //if( value != null) - ses.put(key + string, nullConvert(value)); - } - } - } - unlock(ses); - } else { - LOG.debug("No HttpSession created... Cannot save session scoped variables."); - } - if (LOG.isDebugEnabled()) { - LOG.debug("scope interceptor after (before result)"); - } - } - - /** - * @return The type of scope operation, "start" or "end" - */ - public String getType() { - return type; - } - - /** - * Sets the type of scope operation - * - * @param type Either "start" or "end" - */ - public void setType(String type) { - type = type.toLowerCase(); - if ("start".equals(type) || "end".equals(type)) { - this.type = type; - } else { - throw new IllegalArgumentException("Only start or end are allowed arguments for type"); - } - } - - /** - * @return Gets the session reset parameter name - */ - public String getSessionReset() { - return sessionReset; - } - - /** - * @param sessionReset The session reset parameter name - */ - public void setSessionReset(String sessionReset) { - this.sessionReset = sessionReset; - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation) - */ - public String intercept(ActionInvocation invocation) throws Exception { - String result = null; - Map ses = ActionContext.getContext().getSession(); - before(invocation); - try { - result = invocation.invoke(); - after(invocation, result); - } finally { - if (ses != null) { - unlock(ses); - } - } - - return result; - } - - /** - * @return True if the scope is reset - */ - public boolean isReset() { - return reset; - } - - /** - * @param reset True if the scope should be reset - */ - public void setReset(boolean reset) { - this.reset = reset; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java deleted file mode 100644 index 96b1039ba..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java +++ /dev/null @@ -1,158 +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.interceptor; - -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.StrutsStatics; -import org.apache.struts2.util.ServletContextAware; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; - - -/** - * - * - * An interceptor which sets action properties based on the interfaces an action implements. For example, if the action - * implements {@link ParameterAware} then the action context's parameter map will be set on it. - * - *

    This interceptor is designed to set all properties an action needs if it's aware of servlet parameters, the - * servlet context, the session, etc. Interfaces that it supports are: - * - *

      - * - *
    • {@link ServletContextAware}
    • - * - *
    • {@link ServletRequestAware}
    • - * - *
    • {@link ServletResponseAware}
    • - * - *
    • {@link ParameterAware}
    • - * - *
    • {@link RequestAware}
    • - * - *
    • {@link SessionAware}
    • - * - *
    • {@link ApplicationAware}
    • - * - *
    • {@link PrincipalAware}
    • - * - *
    - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • None
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * There are no known extension points for this interceptor. - * - * - * - *

    Example code: - * - *

    - * 
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="servlet-config"/>
    - *     <interceptor-ref name="basicStack"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * 
    - * - * @see ServletContextAware - * @see ServletRequestAware - * @see ServletResponseAware - * @see ParameterAware - * @see SessionAware - * @see ApplicationAware - * @see PrincipalAware - */ -public class ServletConfigInterceptor extends AbstractInterceptor implements StrutsStatics { - - private static final long serialVersionUID = 605261777858676638L; - - /** - * Sets action properties based on the interfaces an action implements. Things like application properties, - * parameters, session attributes, etc are set based on the implementing interface. - * - * @param invocation an encapsulation of the action execution state. - * @throws Exception if an error occurs when setting action properties. - */ - public String intercept(ActionInvocation invocation) throws Exception { - final Object action = invocation.getAction(); - final ActionContext context = invocation.getInvocationContext(); - - if (action instanceof ServletRequestAware) { - HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST); - ((ServletRequestAware) action).setServletRequest(request); - } - - if (action instanceof ServletResponseAware) { - HttpServletResponse response = (HttpServletResponse) context.get(HTTP_RESPONSE); - ((ServletResponseAware) action).setServletResponse(response); - } - - if (action instanceof ParameterAware) { - ((ParameterAware) action).setParameters(context.getParameters()); - } - - if (action instanceof RequestAware) { - ((RequestAware) action).setRequest((Map) context.get("request")); - } - - if (action instanceof SessionAware) { - ((SessionAware) action).setSession(context.getSession()); - } - - if (action instanceof ApplicationAware) { - ((ApplicationAware) action).setApplication(context.getApplication()); - } - - if (action instanceof PrincipalAware) { - HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST); - ((PrincipalAware) action).setPrincipalProxy(new PrincipalProxy(request)); - } - if (action instanceof ServletContextAware) { - ServletContext servletContext = (ServletContext) context.get(SERVLET_CONTEXT); - ((ServletContextAware) action).setServletContext(servletContext); - } - return invocation.invoke(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java deleted file mode 100644 index d372a7089..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java +++ /dev/null @@ -1,40 +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.interceptor; - -import javax.servlet.http.HttpServletRequest; - - -/** - * All Actions that want to have access to the servlet request object must implement this interface.

    - *

    - * This interface is only relevant if the Action is used in a servlet environment.

    - *

    - * Note that using this interface makes the Action tied to a servlet environment, so it should be - * avoided if possible since things like unit testing will become more difficult. - * - */ -public interface ServletRequestAware { - - /** - * Sets the HTTP request object in implementing classes. - * - * @param request the HTTP request. - */ - public void setServletRequest(HttpServletRequest request); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java deleted file mode 100644 index 5fef895ee..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java +++ /dev/null @@ -1,40 +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.interceptor; - -import javax.servlet.http.HttpServletResponse; - - -/** - * All Actions that want to have access to the servlet response object must implement this interface.

    - *

    - * This interface is only relevant if the Action is used in a servlet environment.

    - *

    - * Note that using this interface makes the Action tied to a servlet environment, so it should be - * avoided if possible since things like unit testing will become more difficult. - * - */ -public interface ServletResponseAware { - - /** - * Sets the HTTP response object in implementing classes. - * - * @param response the HTTP response. - */ - public void setServletResponse(HttpServletResponse response); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java deleted file mode 100644 index f21b999de..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java +++ /dev/null @@ -1,40 +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.interceptor; - -import java.util.Map; - - -/** - * Actions that want access to the user's HTTP session should implement this interface.

    - *

    - * This interface is only relevant if the Action is used in a servlet environment.

    - *

    - * Note that using this interface makes the Action tied to a servlet environment, so it should be - * avoided if possible since things like unit testing will become more difficult. - * - */ -public interface SessionAware { - - /** - * Sets the Map of session attributes in the implementing class. - * - * @param session a Map of HTTP session attribute name/value pairs. - */ - public void setSession(Map session); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java deleted file mode 100644 index 9938900ce..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java +++ /dev/null @@ -1,122 +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.interceptor; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * - * - * This interceptor extends {@link ConversionErrorInterceptor} but only adds conversion errors from the ActionContext to - * the field errors of the action if the field value is not null, "", or {""} (a size 1 String array with only an empty - * String). See {@link ConversionErrorInterceptor} for more information, as well as the Type Conversion documentation. - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • None
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * There are no known extension points for this interceptor. - * - * - * - *

    - * 
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="params"/>
    - *     <interceptor-ref name="conversionError"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * 
    - * - * @see com.opensymphony.xwork2.ActionContext#getConversionErrors() - * @see ConversionErrorInterceptor - */ -public class StrutsConversionErrorInterceptor extends ConversionErrorInterceptor { - - private static final long serialVersionUID = 2759744840082921602L; - - protected Object getOverrideExpr(ActionInvocation invocation, Object value) { - ValueStack stack = invocation.getStack(); - - try { - stack.push(value); - - return "'" + stack.findValue("top", String.class) + "'"; - } finally { - stack.pop(); - } - } - - /** - * Returns false if the value is null, "", or {""} (array of size 1 with a blank element). Returns - * true otherwise. - * - * @param propertyName the name of the property to check. - * @param value the value to error check. - * @return false if the value is null, "", or {""}, true otherwise. - */ - protected boolean shouldAddError(String propertyName, Object value) { - if (value == null) { - return false; - } - - if ("".equals(value)) { - return false; - } - - if (value instanceof String[]) { - String[] array = (String[]) value; - - if (array.length == 0) { - return false; - } - - if (array.length > 1) { - return true; - } - - String str = array[0]; - - if ("".equals(str)) { - return false; - } - } - - return true; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java deleted file mode 100644 index 515c08388..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java +++ /dev/null @@ -1,171 +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.interceptor; - -import java.util.Map; - -import org.apache.struts2.util.TokenHelper; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ValidationAware; -import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor; -import com.opensymphony.xwork2.util.LocalizedTextUtil; - -/** - * - * - * Ensures that only one request per token is processed. This interceptor can make sure that back buttons and double - * clicks don't cause un-intended side affects. For example, you can use this to prevent careless users who might double - * click on a "checkout" button at an online store. This interceptor uses a fairly primitive technique for when an - * invalid token is found: it returns the result invalid.token, which can be mapped in your action configuration. - * A more complex implementation, {@link TokenSessionStoreInterceptor}, can provide much better logic for when invalid - * tokens are found. - * - *

    - * - * Note: To set a token in your form, you should use the token tag. This tag is required and must be used - * in the forms that submit to actions protected by this interceptor. Any request that does not provide a token (using - * the token tag) will be processed as a request with an invalid token. - * - *

    - * - * Internationalization Note: The following key could be used to internationalized the action errors generated - * by this token interceptor - * - *

      - *
    • struts.messages.invalid.token
    • - *
    - * - *

    - * - * NOTE: As this method extends off MethodFilterInterceptor, it is capable of - * deciding if it is applicable only to selective methods in the action class. See - * MethodFilterInterceptor for more info. - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • None
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * While not very common for users to extend, this interceptor is extended by the {@link TokenSessionStoreInterceptor}. - * The {@link #handleInvalidToken} and {@link #handleValidToken} methods are protected and available for more - * interesting logic, such as done with the token session interceptor. - * - * - * - *

    Example code: - * - *

    - * 
    - * 
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="token"/>
    - *     <interceptor-ref name="basicStack"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * <-- In this case, myMethod of the action class will not 
    - *        get checked for invalidity of token -->
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="token">
    - *     	  <param name="excludeMethods">myMethod</param>
    - *     </interceptor-ref name="token"/>
    - *     <interceptor-ref name="basicStack"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * 
    - * 
    - * - * @see TokenSessionStoreInterceptor - * @see TokenHelper - */ -public class TokenInterceptor extends MethodFilterInterceptor { - - private static final long serialVersionUID = -6680894220590585506L; - - public static final String INVALID_TOKEN_CODE = "invalid.token"; - - /** - * @see com.opensymphony.xwork2.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork2.ActionInvocation) - */ - protected String doIntercept(ActionInvocation invocation) throws Exception { - if (log.isDebugEnabled()) { - log.debug("Intercepting invocation to check for valid transaction token."); - } - - Map session = ActionContext.getContext().getSession(); - - synchronized (session) { - if (!TokenHelper.validToken()) { - return handleInvalidToken(invocation); - } - - return handleValidToken(invocation); - } - } - - /** - * Determines what to do if an invalida token is provided. If the action implements {@link ValidationAware} - * - * @param invocation the action invocation where the invalid token failed - * @return the return code to indicate should be processed - * @throws Exception when any unexpected error occurs. - */ - protected String handleInvalidToken(ActionInvocation invocation) throws Exception { - Object action = invocation.getAction(); - String errorMessage = LocalizedTextUtil.findText(this.getClass(), "struts.messages.invalid.token", - invocation.getInvocationContext().getLocale(), - "The form has already been processed or no token was supplied, please try again.", new Object[0]); - - if (action instanceof ValidationAware) { - ((ValidationAware) action).addActionError(errorMessage); - } else { - log.warn(errorMessage); - } - - return INVALID_TOKEN_CODE; - } - - /** - * Called when a valid token is found. This method invokes the action by can be changed to do something more - * interesting. - * - * @param invocation the action invocation - * @throws Exception when any unexpected error occurs. - */ - protected String handleValidToken(ActionInvocation invocation) throws Exception { - return invocation.invoke(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java deleted file mode 100644 index faedeeb77..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java +++ /dev/null @@ -1,152 +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.interceptor; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.util.InvocationSessionStore; -import org.apache.struts2.util.TokenHelper; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * - * - * This interceptor builds off of the {@link TokenInterceptor}, providing advanced logic for handling invalid tokens. - * Unlike the normal token interceptor, this interceptor will attempt to provide intelligent fail-over in the event of - * multiple requests using the same session. That is, it will block subsequent requests until the first request is - * complete, and then instead of returning the invalid.token code, it will attempt to display the same response - * that the original, valid action invocation would have displayed if no multiple requests were submitted in the first - * place. - * - *

    - * - * NOTE: As this method extends off MethodFilterInterceptor, it is capable of - * deciding if it is applicable only to selective methods in the action class. See - * MethodFilterInterceptor for more info. - * - * - * - *

    Interceptor parameters: - * - * - * - *

      - * - *
    • None
    • - * - *
    - * - * - * - *

    Extending the interceptor: - * - *

    - * - * - * - * There are no known extension points for this interceptor. - * - * - * - *

    Example code: - * - *

    - * 
    - * 
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="token-session/>
    - *     <interceptor-ref name="basicStack"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * <-- In this case, myMethod of the action class will not 
    - *        get checked for invalidity of token -->
    - * <action name="someAction" class="com.examples.SomeAction">
    - *     <interceptor-ref name="token-session>
    - *         <param name="excludeMethods">myMethod</param>
    - *     </interceptor-ref name="token-session>
    - *     <interceptor-ref name="basicStack"/>
    - *     <result name="success">good_result.ftl</result>
    - * </action>
    - * 
    - * 
    - * 
    - * - */ -public class TokenSessionStoreInterceptor extends TokenInterceptor { - - private static final long serialVersionUID = -9032347965469098195L; - - /* (non-Javadoc) - * @see org.apache.struts2.interceptor.TokenInterceptor#handleInvalidToken(com.opensymphony.xwork2.ActionInvocation) - */ - protected String handleInvalidToken(ActionInvocation invocation) throws Exception { - ActionContext ac = invocation.getInvocationContext(); - - HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST); - String tokenName = TokenHelper.getTokenName(); - String token = TokenHelper.getToken(tokenName); - - Map params = ac.getParameters(); - params.remove(tokenName); - params.remove(TokenHelper.TOKEN_NAME_FIELD); - - if ((tokenName != null) && (token != null)) { - ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(tokenName, token); - - if (savedInvocation != null) { - // set the valuestack to the request scope - ValueStack stack = savedInvocation.getStack(); - request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); - - Result result = savedInvocation.getResult(); - - if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) { - result.execute(savedInvocation); - } - - // turn off execution of this invocations result - invocation.getProxy().setExecuteResult(false); - - return savedInvocation.getResultCode(); - } - } - - return INVALID_TOKEN_CODE; - } - - /* (non-Javadoc) - * @see org.apache.struts2.interceptor.TokenInterceptor#handleValidToken(com.opensymphony.xwork2.ActionInvocation) - */ - protected String handleValidToken(ActionInvocation invocation) throws Exception { - // we know the token name and token must be there - String key = TokenHelper.getTokenName(); - String token = TokenHelper.getToken(key); - InvocationSessionStore.storeInvocation(key, token, invocation); - - return invocation.invoke(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java deleted file mode 100644 index 66535199e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java +++ /dev/null @@ -1,358 +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.interceptor.debugging; - -import java.beans.BeanInfo; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Array; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.views.freemarker.FreemarkerResult; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; -import com.opensymphony.xwork2.interceptor.PreResultListener; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * Provides several different debugging screens to provide insight into the - * data behind the page. The value of the 'debug' request parameter determines - * the screen: - *
      - *
    • xml - Dumps the parameters, context, session, and value - * stack as an XML document.
    • - *
    • console - Shows a popup 'OGNL Console' that allows the - * user to test OGNL expressions against the value stack. The XML data from - * the 'xml' mode is inserted at the top of the page.
    • - *
    • command - Tests an OGNL expression and returns the - * string result. Only used by the OGNL console.
    • - *
    - *

    - *

    - * This interceptor only is activated when devMode is enabled in - * struts.properties. The 'debug' parameter is removed from the parameter list - * before the action is executed. All operations occur before the natural - * Result has a chance to execute.

    - */ -public class DebuggingInterceptor implements Interceptor { - - private static final long serialVersionUID = -3097324155953078783L; - - private final static Log log = LogFactory.getLog(DebuggingInterceptor.class); - - private String[] ignorePrefixes = new String[]{"org.apache.struts.", - "com.opensymphony.xwork2.", "xwork."}; - private String[] _ignoreKeys = new String[]{"application", "session", - "parameters", "request"}; - private HashSet ignoreKeys = new HashSet(Arrays.asList(_ignoreKeys)); - - private final static String XML_MODE = "xml"; - private final static String CONSOLE_MODE = "console"; - private final static String COMMAND_MODE = "command"; - - private final static String SESSION_KEY = "org.apache.struts2.interceptor.debugging.VALUE_STACK"; - - private final static String DEBUG_PARAM = "debug"; - private final static String EXPRESSION_PARAM = "expression"; - - private boolean enableXmlWithConsole = false; - - - /** - * Unused. - */ - public void init() { - } - - - /** - * Unused. - */ - public void destroy() { - } - - - /* - * (non-Javadoc) - * - * @see com.opensymphony.xwork2.interceptor.Interceptor#invoke(com.opensymphony.xwork2.ActionInvocation) - */ - public String intercept(ActionInvocation inv) throws Exception { - - Boolean devMode = (Boolean) ActionContext.getContext().get( - ActionContext.DEV_MODE); - boolean cont = true; - if (devMode) { - final ActionContext ctx = ActionContext.getContext(); - String type = getParameter(DEBUG_PARAM); - ctx.getParameters().remove(DEBUG_PARAM); - if (XML_MODE.equals(type)) { - inv.addPreResultListener( - new PreResultListener() { - public void beforeResult(ActionInvocation inv, String result) { - printContext(); - } - }); - } else if (CONSOLE_MODE.equals(type)) { - inv.addPreResultListener( - new PreResultListener() { - public void beforeResult(ActionInvocation inv, String actionResult) { - String xml = ""; - if (enableXmlWithConsole) { - StringWriter writer = new StringWriter(); - printContext(new PrettyPrintWriter(writer)); - xml = writer.toString(); - xml = xml.replaceAll("&", "&"); - xml = xml.replaceAll(">", ">"); - xml = xml.replaceAll("<", "<"); - } - ActionContext.getContext().put("debugXML", xml); - - FreemarkerResult result = new FreemarkerResult(); - result.setContentType("text/html"); - result.setLocation("/org/apache/struts2/interceptor/debugging/console.ftl"); - result.setParse(false); - try { - result.execute(inv); - } catch (Exception ex) { - log.error("Unable to create debugging console", ex); - } - - } - }); - } else if (COMMAND_MODE.equals(type)) { - ValueStack stack = (ValueStack) ctx.getSession().get(SESSION_KEY); - String cmd = getParameter(EXPRESSION_PARAM); - - HttpServletResponse res = ServletActionContext.getResponse(); - res.setContentType("text/plain"); - - try { - PrintWriter writer = - ServletActionContext.getResponse().getWriter(); - writer.print(stack.findValue(cmd)); - writer.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - cont = false; - } - } - if (cont) { - try { - return inv.invoke(); - } finally { - if (devMode) { - final ActionContext ctx = ActionContext.getContext(); - ctx.getSession().put(SESSION_KEY, ctx.get(ActionContext.VALUE_STACK)); - } - } - } else { - return null; - } - } - - - /** - * Gets a single string from the request parameters - * - * @param key The key - * @return The parameter value - */ - private String getParameter(String key) { - String[] arr = (String[]) ActionContext.getContext().getParameters().get(key); - if (arr != null && arr.length > 0) { - return arr[0]; - } - return null; - } - - - /** - * Prints the current context to the response in XML format. - */ - protected void printContext() { - HttpServletResponse res = ServletActionContext.getResponse(); - res.setContentType("text/xml"); - - try { - PrettyPrintWriter writer = new PrettyPrintWriter( - ServletActionContext.getResponse().getWriter()); - printContext(writer); - writer.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - - /** - * Prints the current request to the existing writer. - * - * @param writer The XML writer - */ - protected void printContext(PrettyPrintWriter writer) { - ActionContext ctx = ActionContext.getContext(); - writer.startNode(DEBUG_PARAM); - serializeIt(ctx.getParameters(), "parameters", writer, - new ArrayList()); - writer.startNode("context"); - String key; - Map ctxMap = ctx.getContextMap(); - for (Object o : ctxMap.keySet()) { - key = o.toString(); - boolean print = !ignoreKeys.contains(key); - - for (String ignorePrefixe : ignorePrefixes) { - if (key.startsWith(ignorePrefixe)) { - print = false; - break; - } - } - if (print) { - serializeIt(ctxMap.get(key), key, writer, new ArrayList()); - } - } - writer.endNode(); - serializeIt(ctx.getSession(), "request", writer, new ArrayList()); - serializeIt(ctx.getSession(), "session", writer, new ArrayList()); - - ValueStack stack = (ValueStack) ctx.get(ActionContext.VALUE_STACK); - serializeIt(stack.getRoot(), "valueStack", writer, new ArrayList()); - writer.endNode(); - } - - - /** - * Recursive function to serialize objects to XML. Currently it will - * serialize Collections, maps, Arrays, and JavaBeans. It maintains a stack - * of objects serialized already in the current functioncall. This is used - * to avoid looping (stack overflow) of circular linked objects. Struts and - * XWork objects are ignored. - * - * @param bean The object you want serialized. - * @param name The name of the object, used for element <name/> - * @param writer The XML writer - * @param stack List of objects we're serializing since the first calling - * of this function (to prevent looping on circular references). - */ - protected void serializeIt(Object bean, String name, - PrettyPrintWriter writer, List stack) { - writer.flush(); - // Check stack for this object - if ((bean != null) && (stack.contains(bean))) { - if (log.isInfoEnabled()) { - log.info("Circular reference detected, not serializing object: " - + name); - } - return; - } else if (bean != null) { - // Push object onto stack. - // Don't push null objects ( handled below) - stack.add(bean); - } - if (bean == null) { - return; - } - String clsName = bean.getClass().getName(); - - writer.startNode(name); - - // It depends on the object and it's value what todo next: - if (bean instanceof Collection) { - Collection col = (Collection) bean; - - // Iterate through components, and call ourselves to process - // elements - for (Object aCol : col) { - serializeIt(aCol, "value", writer, stack); - } - } else if (bean instanceof Map) { - - Map map = (Map) bean; - - // Loop through keys and call ourselves - for (Object key : map.keySet()) { - Object Objvalue = map.get(key); - serializeIt(Objvalue, key.toString(), writer, stack); - } - } else if (bean.getClass().isArray()) { - // It's an array, loop through it and keep calling ourselves - for (int i = 0; i < Array.getLength(bean); i++) { - serializeIt(Array.get(bean, i), "arrayitem", writer, stack); - } - } else { - if (clsName.startsWith("java.lang")) { - writer.setValue(bean.toString()); - } else { - // Not java.lang, so we can call ourselves with this object's - // values - try { - BeanInfo info = Introspector.getBeanInfo(bean.getClass()); - PropertyDescriptor[] props = info.getPropertyDescriptors(); - - for (PropertyDescriptor prop : props) { - String n = prop.getName(); - Method m = prop.getReadMethod(); - - // Call ourselves with the result of the method - // invocation - if (m != null) { - serializeIt(m.invoke(bean), n, writer, stack); - } - } - } catch (Exception e) { - log.error(e, e); - } - } - } - - writer.endNode(); - - // Remove object from stack - stack.remove(bean); - } - - - /** - * @param enableXmlWithConsole the enableXmlWithConsole to set - */ - public void setEnableXmlWithConsole(boolean enableXmlWithConsole) { - this.enableXmlWithConsole = enableXmlWithConsole; - } - - - -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java b/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java deleted file mode 100644 index f73681424..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.apache.struts2.interceptor.debugging; - -import java.io.PrintWriter; -import java.io.Writer; -import java.util.Stack; - -/** - * A simple writer that outputs XML in a pretty-printed indented stream. - * - *

    By default, the chars

    & < > " ' \r are escaped and replaced with a suitable XML entity. - * To alter this behavior, override the the {@link #writeText(com.thoughtworks.xstream.core.util.QuickWriter, String)} - * and {@link #writeAttributeValue(com.thoughtworks.xstream.core.util.QuickWriter, String)} methods.

    - * - *

    This code was taken from the XStream project under the BSD license.

    - * - */ -public class PrettyPrintWriter { - - private final PrintWriter writer; - private final Stack elementStack = new Stack(); - private final char[] lineIndenter; - - private boolean tagInProgress; - private int depth; - private boolean readyForNewLine; - private boolean tagIsEmpty; - private String newLine; - - private static final char[] NULL = "�".toCharArray(); - private static final char[] AMP = "&".toCharArray(); - private static final char[] LT = "<".toCharArray(); - private static final char[] GT = ">".toCharArray(); - private static final char[] SLASH_R = " ".toCharArray(); - private static final char[] QUOT = """.toCharArray(); - private static final char[] APOS = "'".toCharArray(); - private static final char[] CLOSE = "': - this.writer.write(GT); - break; - case '"': - this.writer.write(QUOT); - break; - case '\'': - this.writer.write(APOS); - break; - case '\r': - this.writer.write(SLASH_R); - break; - default: - this.writer.write(c); - } - } - } - - public void endNode() { - depth--; - if (tagIsEmpty) { - writer.write('/'); - readyForNewLine = false; - finishTag(); - elementStack.pop(); - } else { - finishTag(); - writer.write(CLOSE); - writer.write((String)elementStack.pop()); - writer.write('>'); - } - readyForNewLine = true; - if (depth == 0 ) { - writer.flush(); - } - } - - private void finishTag() { - if (tagInProgress) { - writer.write('>'); - } - tagInProgress = false; - if (readyForNewLine) { - endOfLine(); - } - readyForNewLine = false; - tagIsEmpty = false; - } - - protected void endOfLine() { - writer.write(newLine); - for (int i = 0; i < depth; i++) { - writer.write(lineIndenter); - } - } - - public void flush() { - writer.flush(); - } - - public void close() { - writer.close(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java b/trunk/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java deleted file mode 100644 index 2d452a2cb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java +++ /dev/null @@ -1,103 +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.portlet; - -/** - * Interface defining some constants used in the Struts portlet implementation - * - */ -public interface PortletActionConstants { - /** - * Default action name to use when no default action has been configured in the portlet - * init parameters. - */ - String DEFAULT_ACTION_NAME = "default"; - - /** - * Action name parameter name - */ - String ACTION_PARAM = "struts.portlet.action"; - - /** - * Key for parameter holding the last executed portlet mode. - */ - String MODE_PARAM = "struts.portlet.mode"; - - /** - * Key used for looking up and storing the portlet phase - */ - String PHASE = "struts.portlet.phase"; - - /** - * Constant used for the render phase ( - * {@link javax.portlet.Portlet#render(javax.portlet.RenderRequest, javax.portlet.RenderResponse)}) - */ - Integer RENDER_PHASE = new Integer(1); - - /** - * Constant used for the event phase ( - * {@link javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)}) - */ - Integer EVENT_PHASE = new Integer(2); - - /** - * Key used for looking up and storing the - * {@link javax.portlet.PortletRequest} - */ - String REQUEST = "struts.portlet.request"; - - /** - * Key used for looking up and storing the - * {@link javax.portlet.PortletResponse} - */ - String RESPONSE = "struts.portlet.response"; - - /** - * Key used for looking up and storing the action that was invoked in the event phase. - */ - String EVENT_ACTION = "struts.portlet.eventAction"; - - /** - * Key used for looking up and storing the - * {@link javax.portlet.PortletConfig} - */ - String PORTLET_CONFIG = "struts.portlet.config"; - - /** - * Name of the action used as error handler - */ - String ERROR_ACTION = "errorHandler"; - - /** - * Key for the portlet namespace stored in the - * {@link org.apache.struts2.portlet.context.PortletActionContext}. - */ - String PORTLET_NAMESPACE = "struts.portlet.portletNamespace"; - - /** - * Key for the mode-to-namespace map stored in the - * {@link org.apache.struts2.portlet.context.PortletActionContext}. - */ - String MODE_NAMESPACE_MAP = "struts.portlet.modeNamespaceMap"; - - /** - * Key for the default action name for the portlet, stored in the - * {@link org.apache.struts2.portlet.context.PortletActionContext}. - */ - String DEFAULT_ACTION_FOR_MODE = "struts.portlet.defaultActionForMode"; -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java b/trunk/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java deleted file mode 100644 index 34c5223c4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java +++ /dev/null @@ -1,203 +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.portlet; - -import java.io.Serializable; -import java.util.AbstractMap; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.portlet.PortletContext; - -/** - * Portlet specific {@link java.util.Map} implementation representing the - * {@link javax.portlet.PortletContext} of a Portlet. - * - */ -public class PortletApplicationMap extends AbstractMap implements Serializable { - - private static final long serialVersionUID = 2296107511063504414L; - - private PortletContext context; - - private Set entries; - - /** - * Creates a new map object given the {@link PortletContext}. - * - * @param ctx The portlet context. - */ - public PortletApplicationMap(PortletContext ctx) { - this.context = ctx; - } - - /** - * Removes all entries from the Map and removes all attributes from the - * portlet context. - */ - public void clear() { - entries = null; - - Enumeration e = context.getAttributeNames(); - - while (e.hasMoreElements()) { - context.removeAttribute(e.nextElement().toString()); - } - } - - /** - * Creates a Set of all portlet context attributes as well as context init - * parameters. - * - * @return a Set of all portlet context attributes as well as context init - * parameters. - */ - public Set entrySet() { - if (entries == null) { - entries = new HashSet(); - - // Add portlet context attributes - Enumeration enumeration = context.getAttributeNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = context.getAttribute(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key - .equals(entry.getKey())) - && ((value == null) ? (entry.getValue() == null) - : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) - ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - context.setAttribute(key.toString(), obj); - - return value; - } - }); - } - - // Add portlet context init params - enumeration = context.getInitParameterNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = context.getInitParameter(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key - .equals(entry.getKey())) - && ((value == null) ? (entry.getValue() == null) - : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) - ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - context.setAttribute(key.toString(), obj); - - return value; - } - }); - } - } - - return entries; - } - - /** - * Returns the portlet context attribute or init parameter based on the - * given key. If the entry is not found, null is returned. - * - * @param key - * the entry key. - * @return the portlet context attribute or init parameter or null - * if the entry is not found. - */ - public Object get(Object key) { - // Try context attributes first, then init params - // This gives the proper shadowing effects - String keyString = key.toString(); - Object value = context.getAttribute(keyString); - - return (value == null) ? context.getInitParameter(keyString) : value; - } - - /** - * Sets a portlet context attribute given a attribute name and value. - * - * @param key - * the name of the attribute. - * @param value - * the value to set. - * @return the attribute that was just set. - */ - public Object put(Object key, Object value) { - entries = null; - context.setAttribute(key.toString(), value); - - return get(key); - } - - /** - * Removes the specified portlet context attribute. - * - * @param key - * the attribute to remove. - * @return the entry that was just removed. - */ - public Object remove(Object key) { - entries = null; - - Object value = get(key); - context.removeAttribute(key.toString()); - - return value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java b/trunk/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java deleted file mode 100644 index b76b5baa3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java +++ /dev/null @@ -1,164 +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.portlet; - -import java.util.AbstractMap; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import javax.portlet.PortletRequest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * A simple implementation of the {@link java.util.Map} interface to handle a collection of request attributes. - * - */ -public class PortletRequestMap extends AbstractMap { - - private static final Log LOG = LogFactory.getLog(PortletRequestMap.class); - - private Set entries = null; - private PortletRequest request = null; - - /** - * Saves the request to use as the backing for getting and setting values - * - * @param request the portlet request. - */ - public PortletRequestMap(PortletRequest request) { - this.request = request; - if(LOG.isDebugEnabled()) { - LOG.debug("Dumping request parameters: "); - Iterator params = request.getParameterMap().keySet().iterator(); - while(params.hasNext()) { - String key = (String)params.next(); - String val = request.getParameter(key); - LOG.debug(key + " = " + val); - } - } - } - - /** - * Removes all attributes from the request as well as clears entries in this - * map. - */ - public void clear() { - entries = null; - Enumeration keys = request.getAttributeNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - request.removeAttribute(key); - } - } - - /** - * Returns a Set of attributes from the portlet request. - * - * @return a Set of attributes from the portlet request. - */ - public Set entrySet() { - if (entries == null) { - entries = new HashSet(); - - Enumeration enumeration = request.getAttributeNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = request.getAttribute(key); - entries.add(new Entry() { - public boolean equals(Object obj) { - Entry entry = (Entry) obj; - - return ((key == null) ? (entry.getKey() == null) : key - .equals(entry.getKey())) - && ((value == null) ? (entry.getValue() == null) - : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) - ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - request.setAttribute(key, obj); - - return value; - } - }); - } - } - - return entries; - } - - /** - * Returns the request attribute associated with the given key or - * null if it doesn't exist. - * - * @param key the name of the request attribute. - * @return the request attribute or null if it doesn't exist. - */ - public Object get(Object key) { - return request.getAttribute(key.toString()); - } - - /** - * Saves an attribute in the request. - * - * @param key the name of the request attribute. - * @param value the value to set. - * @return the object that was just set. - */ - public Object put(Object key, Object value) { - entries = null; - request.setAttribute(key.toString(), value); - - return get(key); - } - - /** - * Removes the specified request attribute. - * - * @param key the name of the attribute to remove. - * @return the value that was removed or null if the value was - * not found (and hence, not removed). - */ - public Object remove(Object key) { - entries = null; - - Object value = get(key); - request.removeAttribute(key.toString()); - - return value; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java b/trunk/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java deleted file mode 100644 index b3ff045f6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java +++ /dev/null @@ -1,168 +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.portlet; - -import java.util.AbstractMap; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.portlet.PortletRequest; -import javax.portlet.PortletSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * A simple implementation of the {@link java.util.Map} interface to handle a collection of portlet session - * attributes. The {@link #entrySet()} method enumerates over all session attributes and creates a Set of entries. - * Note, this will occur lazily - only when the entry set is asked for. - * - */ -public class PortletSessionMap extends AbstractMap { - - private static final Log LOG = LogFactory.getLog(PortletSessionMap.class); - - private PortletSession session = null; - private Set entries = null; - - /** - * Creates a new session map given a portlet request. - * - * @param request the portlet request object. - */ - public PortletSessionMap(PortletRequest request) { - this.session = request.getPortletSession(); - if(LOG.isDebugEnabled()) { - LOG.debug("Dumping session info: "); - Enumeration enumeration = session.getAttributeNames(); - while(enumeration.hasMoreElements()) { - String key = (String)enumeration.nextElement(); - Object val = session.getAttribute(key); - LOG.debug(key + " = " + val); - } - } - } - - /** - * @see java.util.Map#entrySet() - */ - public Set entrySet() { - synchronized (session) { - if (entries == null) { - entries = new HashSet(); - - Enumeration enumeration = session.getAttributeNames(); - - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = session.getAttribute(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; - - return ((key == null) ? (entry.getKey() == null) - : key.equals(entry.getKey())) - && ((value == null) ? (entry.getValue() == null) - : value.equals(entry.getValue())); - } - - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) - ^ ((value == null) ? 0 : value.hashCode()); - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object obj) { - session.setAttribute(key, obj); - - return value; - } - }); - } - } - } - - return entries; - } - - /** - * Returns the session attribute associated with the given key or - * null if it doesn't exist. - * - * @param key the name of the session attribute. - * @return the session attribute or null if it doesn't exist. - */ - public Object get(Object key) { - synchronized (session) { - return session.getAttribute(key.toString()); - } - } - - /** - * Saves an attribute in the session. - * - * @param key the name of the session attribute. - * @param value the value to set. - * @return the object that was just set. - */ - public Object put(Object key, Object value) { - synchronized (session) { - entries = null; - session.setAttribute(key.toString(), value); - - return get(key); - } - } - - /** - * @see java.util.Map#clear() - */ - public void clear() { - synchronized (session) { - entries = null; - session.invalidate(); - } - } - - /** - * Removes the specified session attribute. - * - * @param key the name of the attribute to remove. - * @return the value that was removed or null if the value was - * not found (and hence, not removed). - */ - public Object remove(Object key) { - synchronized (session) { - entries = null; - - Object value = get(key); - session.removeAttribute(key.toString()); - - return value; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java b/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java deleted file mode 100644 index 86870b409..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java +++ /dev/null @@ -1,193 +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.portlet.context; - -import java.util.Map; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletConfig; -import javax.portlet.PortletRequest; -import javax.portlet.PortletResponse; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.apache.struts2.portlet.PortletActionConstants; - -import com.opensymphony.xwork2.ActionContext; - - -/** - * PortletActionContext. ActionContext thread local for the portlet environment. - * - * @version $Revision$ $Date$ - */ -public class PortletActionContext implements PortletActionConstants { - - /** - * Get the PortletConfig of the portlet that is executing. - * - * @return The PortletConfig of the executing portlet. - */ - public static PortletConfig getPortletConfig() { - return (PortletConfig) getContext().get(PORTLET_CONFIG); - } - - /** - * Get the RenderRequest. Can only be invoked in the render phase. - * - * @return The current RenderRequest. - * @throws IllegalStateException If the method is invoked in the wrong phase. - */ - public static RenderRequest getRenderRequest() { - if (!isRender()) { - throw new IllegalStateException( - "RenderRequest cannot be obtained in event phase"); - } - return (RenderRequest) getContext().get(REQUEST); - } - - /** - * Get the RenderResponse. Can only be invoked in the render phase. - * - * @return The current RenderResponse. - * @throws IllegalStateException If the method is invoked in the wrong phase. - */ - public static RenderResponse getRenderResponse() { - if (!isRender()) { - throw new IllegalStateException( - "RenderResponse cannot be obtained in event phase"); - } - return (RenderResponse) getContext().get(RESPONSE); - } - - /** - * Get the ActionRequest. Can only be invoked in the event phase. - * - * @return The current ActionRequest. - * @throws IllegalStateException If the method is invoked in the wrong phase. - */ - public static ActionRequest getActionRequest() { - if (!isEvent()) { - throw new IllegalStateException( - "ActionRequest cannot be obtained in render phase"); - } - return (ActionRequest) getContext().get(REQUEST); - } - - /** - * Get the ActionRequest. Can only be invoked in the event phase. - * - * @return The current ActionRequest. - * @throws IllegalStateException If the method is invoked in the wrong phase. - */ - public static ActionResponse getActionResponse() { - if (!isEvent()) { - throw new IllegalStateException( - "ActionResponse cannot be obtained in render phase"); - } - return (ActionResponse) getContext().get(RESPONSE); - } - - /** - * Get the action namespace of the portlet. Used to organize actions for multiple portlets in - * the same portlet application. - * - * @return The portlet namespace as defined in portlet.xml and struts.xml - */ - public static String getPortletNamespace() { - return (String)getContext().get(PORTLET_NAMESPACE); - } - - /** - * Get the current PortletRequest. - * - * @return The current PortletRequest. - */ - public static PortletRequest getRequest() { - return (PortletRequest) getContext().get(REQUEST); - } - - /** - * Get the current PortletResponse - * - * @return The current PortletResponse. - */ - public static PortletResponse getResponse() { - return (PortletResponse) getContext().get(RESPONSE); - } - - /** - * Get the phase that the portlet is executing in. - * - * @return {@link PortletActionConstants#RENDER_PHASE} in render phase, and - * {@link PortletActionConstants#EVENT_PHASE} in the event phase. - */ - public static Integer getPhase() { - return (Integer) getContext().get(PHASE); - } - - /** - * @return true if the Portlet is executing in render phase. - */ - public static boolean isRender() { - return PortletActionConstants.RENDER_PHASE.equals(getPhase()); - } - - /** - * @return true if the Portlet is executing in the event phase. - */ - public static boolean isEvent() { - return PortletActionConstants.EVENT_PHASE.equals(getPhase()); - } - - /** - * @return The current ActionContext. - */ - private static ActionContext getContext() { - return ActionContext.getContext(); - } - - /** - * Check to see if the current request is a portlet request. - * - * @return true if the current request is a portlet request. - */ - public static boolean isPortletRequest() { - return getRequest() != null; - } - - /** - * Get the default action name for the current mode. - * - * @return The default action name for the current portlet mode. - */ - public static String getDefaultActionForMode() { - return (String)getContext().get(DEFAULT_ACTION_FOR_MODE); - } - - /** - * Get the namespace to mode mappings. - * - * @return The map of the namespaces for each mode. - */ - public static Map getModeNamespaceMap() { - return (Map)getContext().get(MODE_NAMESPACE_MAP); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java b/trunk/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java deleted file mode 100644 index 181229de0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java +++ /dev/null @@ -1,63 +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.portlet.context; - -import java.io.IOException; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsStatics; - -import com.opensymphony.xwork2.ActionContext; - -/** - * Since a portlet is not dispatched the same way as a servlet, the - * {@link org.apache.struts2.ServletActionContext} is not immediately available, as it - * depends on objects from the servlet API. However, the WW2 view implementations require access - * to the objects in the {@link org.apache.struts2.ServletActionContext}, and this servlet - * makes sure that these are available when the portlet actions are executing the render results. - * - */ -public class PreparatorServlet extends HttpServlet implements StrutsStatics { - - private static final long serialVersionUID = 1853399729352984089L; - - private final static Log LOG = LogFactory.getLog(PreparatorServlet.class); - - /** - * Prepares the {@link org.apache.struts2.ServletActionContext} with the - * {@link ServletContext}, {@link HttpServletRequest} and {@link HttpServletResponse}. - */ - public void service(HttpServletRequest servletRequest, - HttpServletResponse servletResponse) throws ServletException, - IOException { - LOG.debug("Preparing servlet objects for dispatch"); - ServletContext ctx = getServletContext(); - ActionContext.getContext().put(SERVLET_CONTEXT, ctx); - ActionContext.getContext().put(HTTP_REQUEST, servletRequest); - ActionContext.getContext().put(HTTP_RESPONSE, servletResponse); - LOG.debug("Preparation complete"); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java b/trunk/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java deleted file mode 100644 index 23d174b52..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java +++ /dev/null @@ -1,60 +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.portlet.context; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -/** - * Some of the factory/managers (e.g. the ObjectFactory) need access to - * the {@link org.apache.struts2.ServletActionContext} object when initializing. - * This {@link javax.servlet.ServletContextListener} keeps a reference to the - * {@link javax.servlet.ServletContext} and exposes it through a public static - * method. - * - */ -public class ServletContextHolderListener implements ServletContextListener { - - private static ServletContext context = null; - - /** - * @return The current servlet context - */ - public static ServletContext getServletContext() { - return context; - } - - /** - * Stores the reference to the {@link ServletContext}. - * - * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) - */ - public void contextInitialized(ServletContextEvent event) { - context = event.getServletContext(); - - } - - /** - * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) - */ - public void contextDestroyed(ServletContextEvent event) { - context = null; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java b/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java deleted file mode 100644 index 7a9172a49..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java +++ /dev/null @@ -1,70 +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.portlet.dispatcher; - -import com.opensymphony.xwork2.Action; - -import java.io.Serializable; - -/** - * When a portlet is targetted for an event, the portlet will receive two - * portlet requests, one for the event phase, and then followed by a render - * operation. When in the event phase, the action that is executed can't render - * any output. This means that if an action in the XWork configuration is executed in the event - * phase, and the action is set up with a result that should render something, the result can't - * immediately be executed. The portlet needs to "wait" to the render phase to do the - * rendering. - *

    - * When the {@link org.apache.struts2.portlet.result.PortletResult} detects such a - * scenario, instead of executing the actual view, it prepares a couple of render parameters - * specifying this action and the location of the view, which then will be executed in the - * following render request. - */ -public class DirectRenderFromEventAction implements Action, Serializable { - - private static final long serialVersionUID = -1814807772308405785L; - - private String location = null; - - /** - * Get the location of the view. - * - * @return Returns the location. - */ - public String getLocation() { - return location; - } - - /** - * Set the location of the view. - * - * @param location The location to set. - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * Always return success. - * - * @return SUCCESS - */ - public String execute() throws Exception { - return SUCCESS; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java b/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java deleted file mode 100644 index 321bff6dc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java +++ /dev/null @@ -1,597 +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.portlet.dispatcher; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.GenericPortlet; -import javax.portlet.PortletConfig; -import javax.portlet.PortletException; -import javax.portlet.PortletMode; -import javax.portlet.PortletRequest; -import javax.portlet.PortletResponse; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.StrutsStatics; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.ApplicationMap; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.RequestMap; -import org.apache.struts2.dispatcher.SessionMap; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.portlet.PortletActionConstants; -import org.apache.struts2.portlet.PortletApplicationMap; -import org.apache.struts2.portlet.PortletRequestMap; -import org.apache.struts2.portlet.PortletSessionMap; -import org.apache.struts2.portlet.context.PortletActionContext; -import org.apache.struts2.portlet.context.ServletContextHolderListener; -import org.apache.struts2.util.AttributeMap; -import org.apache.struts2.util.ObjectFactoryInitializable; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; -import com.opensymphony.xwork2.util.FileManager; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.ActionProxyFactory; -import com.opensymphony.xwork2.ObjectFactory; -import com.opensymphony.xwork2.config.ConfigurationException; -import com.opensymphony.xwork2.util.LocalizedTextUtil; - -/** - * - *

    - * Struts JSR-168 portlet dispatcher. Similar to the WW2 Servlet dispatcher, - * but adjusted to a portal environment. The portlet is configured through the portlet.xml - * descriptor. Examples and descriptions follow below: - *

    - * - * - * @author Nils-Helge Garli - * @author Rainer Hermanns - * - *

    Init parameters

    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    NameDescriptionDefault value
    portletNamespaceThe namespace for the portlet in the xwork configuration. This - * namespace is prepended to all action lookups, and makes it possible to host multiple - * portlets in the same portlet application. If this parameter is set, the complete namespace - * will be /portletNamespace/modeNamespace/actionNameThe default namespace
    viewNamespaceBase namespace in the xwork configuration for the view portlet - * modeThe default namespace
    editNamespaceBase namespace in the xwork configuration for the edit portlet - * modeThe default namespace
    helpNamespaceBase namespace in the xwork configuration for the help portlet - * modeThe default namespace
    defaultViewActionDefault action to invoke in the view portlet mode if no action is - * specifieddefault
    defaultEditActionDefault action to invoke in the edit portlet mode if no action is - * specifieddefault
    defaultHelpActionDefault action to invoke in the help portlet mode if no action is - * specifieddefault
    - * - *

    Example:

    - *
    - * 
    - * 
    - * <init-param>
    - *     <!-- The view mode namespace. Maps to a namespace in the xwork config file -->
    - *     <name>viewNamespace</name>
    - *     <value>/view</value>
    - * </init-param>
    - * <init-param>
    - *    <!-- The default action to invoke in view mode -->
    - *	  <name>defaultViewAction</name>
    - *    <value>index</value>
    - * </init-param>
    - * <init-param>
    - *     <!-- The view mode namespace. Maps to a namespace in the xwork config file -->
    - *     <name>editNamespace</name>
    - *     <value>/edit</value>
    - * </init-param>
    - * <init-param>
    - *     <!-- The default action to invoke in view mode -->
    - *     <name>defaultEditAction</name>
    - *	   <value>index</value>
    - * </init-param>
    - * <init-param>
    - *     <!-- The view mode namespace. Maps to a namespace in the xwork config file -->
    - *     <name>helpNamespace</name>
    - *     <value>/help</value>
    - * </init-param>
    - * <init-param>
    - *     <!-- The default action to invoke in view mode -->
    - *     <name>defaultHelpAction</name>
    - *     <value>index</value>
    - * </init-param>
    - *   
    - * 
    - * 
    - */ -public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, - PortletActionConstants { - - private static final Log LOG = LogFactory.getLog(Jsr168Dispatcher.class); - - private ActionProxyFactory factory = null; - - private Map modeMap = new HashMap(3); - - private Map actionMap = new HashMap(3); - - private String portletNamespace = null; - - private Dispatcher dispatcherUtils; - - /** - * Initialize the portlet with the init parameters from portlet.xml - */ - public void init(PortletConfig cfg) throws PortletException { - super.init(cfg); - LOG.debug("Initializing portlet " + getPortletName()); - // For testability - if (factory == null) { - factory = ActionProxyFactory.getFactory(); - } - portletNamespace = cfg.getInitParameter("portletNamespace"); - LOG.debug("PortletNamespace: " + portletNamespace); - parseModeConfig(cfg, PortletMode.VIEW, "viewNamespace", - "defaultViewAction"); - parseModeConfig(cfg, PortletMode.EDIT, "editNamespace", - "defaultEditAction"); - parseModeConfig(cfg, PortletMode.HELP, "helpNamespace", - "defaultHelpAction"); - parseModeConfig(cfg, new PortletMode("config"), "configNamespace", - "defaultConfigAction"); - parseModeConfig(cfg, new PortletMode("about"), "aboutNamespace", - "defaultAboutAction"); - parseModeConfig(cfg, new PortletMode("print"), "printNamespace", - "defaultPrintAction"); - parseModeConfig(cfg, new PortletMode("preview"), "previewNamespace", - "defaultPreviewAction"); - parseModeConfig(cfg, new PortletMode("edit_defaults"), - "editDefaultsNamespace", "defaultEditDefaultsAction"); - if (StringUtils.isEmpty(portletNamespace)) { - portletNamespace = ""; - } - LocalizedTextUtil - .addDefaultResourceBundle("org/apache/struts2/struts-messages"); - - //check for configuration reloading - if ("true".equalsIgnoreCase(Settings - .get(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD))) { - FileManager.setReloadingConfigs(true); - } - - if ("true".equalsIgnoreCase(Settings.get(StrutsConstants.STRUTS_DEVMODE))) { - Settings.set(StrutsConstants.STRUTS_I18N_RELOAD, "true"); - Settings.set(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, "true"); - } - - if (Settings.isSet(StrutsConstants.STRUTS_OBJECTFACTORY)) { - String className = (String) Settings - .get(StrutsConstants.STRUTS_OBJECTFACTORY); - if (className.equals("spring")) { - // note: this class name needs to be in string form so we don't put hard - // dependencies on spring, since it isn't technically required. - className = "org.apache.struts2.spring.StrutsSpringObjectFactory"; - } else if (className.equals("plexus")) { - // note: this class name needs to be in string form so we don't put hard - // dependencies on spring, since it isn't technically required. - className = "org.apache.struts2.plexus.PlexusObjectFactory"; - } - - try { - Class clazz = ClassLoaderUtil.loadClass(className, - Jsr168Dispatcher.class); - ObjectFactory objectFactory = (ObjectFactory) clazz - .newInstance(); - if (objectFactory instanceof ObjectFactoryInitializable) { - ((ObjectFactoryInitializable) objectFactory) - .init(ServletContextHolderListener - .getServletContext()); - } - ObjectFactory.setObjectFactory(objectFactory); - } catch (Exception e) { - LOG.error("Could not load ObjectFactory named " + className - + ". Using default ObjectFactory.", e); - } - } - Dispatcher.setPortletSupportActive(true); - dispatcherUtils = new Dispatcher(ServletContextHolderListener.getServletContext()); - } - - /** - * Parse the mode to namespace mappings configured in portlet.xml - * @param portletConfig The PortletConfig - * @param portletMode The PortletMode - * @param nameSpaceParam Name of the init parameter where the namespace for the mode - * is configured. - * @param defaultActionParam Name of the init parameter where the default action to - * execute for the mode is configured. - */ - private void parseModeConfig(PortletConfig portletConfig, - PortletMode portletMode, String nameSpaceParam, - String defaultActionParam) { - String namespace = portletConfig.getInitParameter(nameSpaceParam); - if (StringUtils.isEmpty(namespace)) { - namespace = ""; - } - modeMap.put(portletMode, namespace); - String defaultAction = portletConfig - .getInitParameter(defaultActionParam); - if (StringUtils.isEmpty(defaultAction)) { - defaultAction = DEFAULT_ACTION_NAME; - } - StringBuffer fullPath = new StringBuffer(); - if (StringUtils.isNotEmpty(portletNamespace)) { - fullPath.append(portletNamespace + "/"); - } - if (StringUtils.isNotEmpty(namespace)) { - fullPath.append(namespace + "/"); - } - fullPath.append(defaultAction); - ActionMapping mapping = new ActionMapping(); - mapping.setName(getActionName(fullPath.toString())); - mapping.setNamespace(getNamespace(fullPath.toString())); - actionMap.put(portletMode, mapping); - } - - /** - * Service an action from the event phase. - * - * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, - * javax.portlet.ActionResponse) - */ - public void processAction(ActionRequest request, ActionResponse response) - throws PortletException, IOException { - LOG.debug("Entering processAction"); - resetActionContext(); - try { - serviceAction(request, response, getActionMapping(request), - getRequestMap(request), getParameterMap(request), - getSessionMap(request), getApplicationMap(), - portletNamespace, EVENT_PHASE); - LOG.debug("Leaving processAction"); - } finally { - ActionContext.setContext(null); - } - } - - /** - * Service an action from the render phase. - * - * @see javax.portlet.Portlet#render(javax.portlet.RenderRequest, - * javax.portlet.RenderResponse) - */ - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - - LOG.debug("Entering render"); - resetActionContext(); - response.setTitle(getTitle(request)); - try { - // Check to see if an event set the render to be included directly - serviceAction(request, response, getActionMapping(request), - getRequestMap(request), getParameterMap(request), - getSessionMap(request), getApplicationMap(), - portletNamespace, RENDER_PHASE); - LOG.debug("Leaving render"); - } finally { - resetActionContext(); - } - } - - /** - * Reset the action context. - */ - private void resetActionContext() { - ActionContext.setContext(null); - } - - /** - * Merges all application and portlet attributes into a single - * HashMap to represent the entire Action context. - * - * @param requestMap a Map of all request attributes. - * @param parameterMap a Map of all request parameters. - * @param sessionMap a Map of all session attributes. - * @param applicationMap a Map of all servlet context attributes. - * @param request the PortletRequest object. - * @param response the PortletResponse object. - * @param portletConfig the PortletConfig object. - * @param phase The portlet phase (render or action, see - * {@link PortletActionConstants}) - * @return a HashMap representing the Action context. - */ - public HashMap createContextMap(Map requestMap, Map parameterMap, - Map sessionMap, Map applicationMap, PortletRequest request, - PortletResponse response, PortletConfig portletConfig, Integer phase) { - - // TODO Must put http request/response objects into map for use with - // ServletActionContext - HashMap extraContext = new HashMap(); - extraContext.put(ActionContext.PARAMETERS, parameterMap); - extraContext.put(ActionContext.SESSION, sessionMap); - extraContext.put(ActionContext.APPLICATION, applicationMap); - - Locale locale = null; - if (Settings.isSet(StrutsConstants.STRUTS_LOCALE)) { - locale = LocalizedTextUtil.localeFromString(Settings.get(StrutsConstants.STRUTS_LOCALE), request.getLocale()); - } else { - locale = request.getLocale(); - } - extraContext.put(ActionContext.LOCALE, locale); - - extraContext.put(StrutsStatics.STRUTS_PORTLET_CONTEXT, getPortletContext()); - extraContext.put(ActionContext.DEV_MODE, Boolean.valueOf(Settings.get(StrutsConstants.STRUTS_DEVMODE))); - extraContext.put(REQUEST, request); - extraContext.put(RESPONSE, response); - extraContext.put(PORTLET_CONFIG, portletConfig); - extraContext.put(PORTLET_NAMESPACE, portletNamespace); - extraContext.put(DEFAULT_ACTION_FOR_MODE, actionMap.get(request.getPortletMode())); - // helpers to get access to request/session/application scope - extraContext.put("request", requestMap); - extraContext.put("session", sessionMap); - extraContext.put("application", applicationMap); - extraContext.put("parameters", parameterMap); - extraContext.put(MODE_NAMESPACE_MAP, modeMap); - - extraContext.put(PHASE, phase); - - AttributeMap attrMap = new AttributeMap(extraContext); - extraContext.put("attr", attrMap); - - return extraContext; - } - - /** - * Loads the action and executes it. This method first creates the action - * context from the given parameters then loads an ActionProxy - * from the given action name and namespace. After that, the action is - * executed and output channels throught the response object. - * - * @param request the HttpServletRequest object. - * @param response the HttpServletResponse object. - * @param mapping the action mapping. - * @param requestMap a Map of request attributes. - * @param parameterMap a Map of request parameters. - * @param sessionMap a Map of all session attributes. - * @param applicationMap a Map of all application attributes. - * @param portletNamespace the namespace or context of the action. - * @param phase The portlet phase (render or action, see - * {@link PortletActionConstants}) - */ - public void serviceAction(PortletRequest request, PortletResponse response, - ActionMapping mapping, Map requestMap, Map parameterMap, - Map sessionMap, Map applicationMap, String portletNamespace, - Integer phase) throws PortletException { - LOG.debug("serviceAction"); - Dispatcher.setInstance(dispatcherUtils); - HashMap extraContext = createContextMap(requestMap, parameterMap, - sessionMap, applicationMap, request, response, - getPortletConfig(), phase); - String actionName = mapping.getName(); - String namespace = mapping.getNamespace(); - try { - LOG.debug("Creating action proxy for name = " + actionName - + ", namespace = " + namespace); - ActionProxy proxy = factory.createActionProxy( - dispatcherUtils.getConfigurationManager().getConfiguration(), namespace, - actionName, extraContext); - request.setAttribute("struts.valueStack", proxy.getInvocation() - .getStack()); - if (PortletActionConstants.RENDER_PHASE.equals(phase) - && StringUtils.isNotEmpty(request - .getParameter(EVENT_ACTION))) { - - ActionProxy action = (ActionProxy) request.getPortletSession() - .getAttribute(EVENT_ACTION); - if (action != null) { - ValueStack stack = proxy.getInvocation().getStack(); - Object top = stack.pop(); - stack.push(action.getInvocation().getAction()); - stack.push(top); - } - } - proxy.execute(); - if (PortletActionConstants.EVENT_PHASE.equals(phase)) { - // Store the executed action in the session for retrieval in the - // render phase. - ActionResponse actionResp = (ActionResponse) response; - request.getPortletSession().setAttribute(EVENT_ACTION, proxy); - actionResp.setRenderParameter(EVENT_ACTION, "true"); - } - } catch (ConfigurationException e) { - LOG.error("Could not find action", e); - throw new PortletException("Could not find action " + actionName, e); - } catch (Exception e) { - LOG.error("Could not execute action", e); - throw new PortletException("Error executing action " + actionName, - e); - } - } - - /** - * Returns a Map of all application attributes. Copies all attributes from - * the {@link PortletActionContext}into an {@link ApplicationMap}. - * - * @return a Map of all application attributes. - */ - protected Map getApplicationMap() { - return new PortletApplicationMap(getPortletContext()); - } - - /** - * Gets the namespace of the action from the request. The namespace is the - * same as the portlet mode. E.g, view mode is mapped to namespace - * view, and edit mode is mapped to the namespace - * edit - * - * @param request the PortletRequest object. - * @return the namespace of the action. - */ - protected ActionMapping getActionMapping(PortletRequest request) { - ActionMapping mapping = new ActionMapping(); - if (resetAction(request)) { - mapping = (ActionMapping) actionMap.get(request.getPortletMode()); - } else { - String actionPath = request.getParameter(ACTION_PARAM); - if (StringUtils.isEmpty(actionPath)) { - mapping = (ActionMapping) actionMap.get(request - .getPortletMode()); - } else { - String namespace = ""; - String action = actionPath; - int idx = actionPath.lastIndexOf('/'); - if (idx >= 0) { - namespace = actionPath.substring(0, idx); - action = actionPath.substring(idx + 1); - } - mapping.setName(action); - mapping.setNamespace(namespace); - } - } - return mapping; - } - - /** - * Get the namespace part of the action path. - * @param actionPath Full path to action - * @return The namespace part. - */ - String getNamespace(String actionPath) { - int idx = actionPath.lastIndexOf('/'); - String namespace = ""; - if (idx >= 0) { - namespace = actionPath.substring(0, idx); - } - return namespace; - } - - /** - * Get the action name part of the action path. - * @param actionPath Full path to action - * @return The action name. - */ - String getActionName(String actionPath) { - int idx = actionPath.lastIndexOf('/'); - String action = actionPath; - if (idx >= 0) { - action = actionPath.substring(idx + 1); - } - return action; - } - - /** - * Returns a Map of all request parameters. This implementation just calls - * {@link PortletRequest#getParameterMap()}. - * - * @param request the PortletRequest object. - * @return a Map of all request parameters. - * @throws IOException if an exception occurs while retrieving the parameter - * map. - */ - protected Map getParameterMap(PortletRequest request) throws IOException { - return new HashMap(request.getParameterMap()); - } - - /** - * Returns a Map of all request attributes. The default implementation is to - * wrap the request in a {@link RequestMap}. Override this method to - * customize how request attributes are mapped. - * - * @param request the PortletRequest object. - * @return a Map of all request attributes. - */ - protected Map getRequestMap(PortletRequest request) { - return new PortletRequestMap(request); - } - - /** - * Returns a Map of all session attributes. The default implementation is to - * wrap the reqeust in a {@link SessionMap}. Override this method to - * customize how session attributes are mapped. - * - * @param request the PortletRequest object. - * @return a Map of all session attributes. - */ - protected Map getSessionMap(PortletRequest request) { - return new PortletSessionMap(request); - } - - /** - * Convenience method to ease testing. - * @param factory - */ - protected void setActionProxyFactory(ActionProxyFactory factory) { - this.factory = factory; - } - - /** - * Check to see if the action parameter is valid for the current portlet mode. If the portlet - * mode has been changed with the portal widgets, the action name is invalid, since the - * action name belongs to the previous executing portlet mode. If this method evaluates to - * true the default<Mode>Action is used instead. - * @param request The portlet request. - * @return true if the action should be reset. - */ - private boolean resetAction(PortletRequest request) { - boolean reset = false; - Map paramMap = request.getParameterMap(); - String[] modeParam = (String[]) paramMap.get(MODE_PARAM); - if (modeParam != null && modeParam.length == 1) { - String originatingMode = modeParam[0]; - String currentMode = request.getPortletMode().toString(); - if (!currentMode.equals(originatingMode)) { - reset = true; - } - } - return reset; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java b/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java deleted file mode 100644 index ba33f3348..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java +++ /dev/null @@ -1,243 +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.portlet.result; - -import java.io.IOException; -import java.util.StringTokenizer; - -import javax.portlet.ActionResponse; -import javax.portlet.PortletConfig; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.StrutsResultSupport; -import org.apache.struts2.portlet.PortletActionConstants; -import org.apache.struts2.portlet.context.PortletActionContext; - -import com.opensymphony.xwork2.ActionInvocation; - -/** - * Result type that includes a JSP to render. - * - */ -public class PortletResult extends StrutsResultSupport { - - private static final long serialVersionUID = 434251393926178567L; - - /** - * Logger instance. - */ - private static final Log LOG = LogFactory.getLog(PortletResult.class); - - private String contentType = "text/html"; - - private String title; - - public PortletResult() { - super(); - } - - public PortletResult(String location) { - super(location); - } - - /** - * Execute the result. Obtains the - * {@link javax.portlet.PortletRequestDispatcher}from the - * {@link PortletActionContext}and includes the JSP. - * - * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation) - */ - public void doExecute(String finalLocation, - ActionInvocation actionInvocation) throws Exception { - - if (PortletActionContext.isRender()) { - executeRenderResult(finalLocation); - } else if (PortletActionContext.isEvent()) { - executeActionResult(finalLocation, actionInvocation); - } else { - executeRegularServletResult(finalLocation, actionInvocation); - } - } - - /** - * Executes the regular servlet result. - * - * @param finalLocation - * @param actionInvocation - */ - private void executeRegularServletResult(String finalLocation, - ActionInvocation actionInvocation) throws ServletException, IOException { - ServletContext ctx = ServletActionContext.getServletContext(); - HttpServletRequest req = ServletActionContext.getRequest(); - HttpServletResponse res = ServletActionContext.getResponse(); - try { - ctx.getRequestDispatcher(finalLocation).include(req, res); - } catch (ServletException e) { - LOG.error("ServletException including " + finalLocation, e); - throw e; - } catch (IOException e) { - LOG.error("IOException while including result '" + finalLocation + "'", e); - throw e; - } - } - - /** - * Executes the action result. - * - * @param finalLocation - * @param invocation - */ - protected void executeActionResult(String finalLocation, - ActionInvocation invocation) { - LOG.debug("Executing result in Event phase"); - ActionResponse res = PortletActionContext.getActionResponse(); - LOG.debug("Setting event render parameter: " + finalLocation); - if (finalLocation.indexOf('?') != -1) { - convertQueryParamsToRenderParams(res, finalLocation - .substring(finalLocation.indexOf('?') + 1)); - finalLocation = finalLocation.substring(0, finalLocation - .indexOf('?')); - } - if (finalLocation.endsWith(".action")) { - // View is rendered with a view action...luckily... - finalLocation = finalLocation.substring(0, finalLocation - .lastIndexOf(".")); - res.setRenderParameter(PortletActionConstants.ACTION_PARAM, finalLocation); - } else { - // View is rendered outside an action...uh oh... - res.setRenderParameter(PortletActionConstants.ACTION_PARAM, "renderDirect"); - res.setRenderParameter("location", finalLocation); - } - res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext - .getRequest().getPortletMode().toString()); - } - - /** - * Converts the query params to render params. - * - * @param response - * @param queryParams - */ - protected static void convertQueryParamsToRenderParams( - ActionResponse response, String queryParams) { - StringTokenizer tok = new StringTokenizer(queryParams, "&"); - while (tok.hasMoreTokens()) { - String token = tok.nextToken(); - String key = token.substring(0, token.indexOf('=')); - String value = token.substring(token.indexOf('=') + 1); - response.setRenderParameter(key, value); - } - } - - /** - * Executes the render result. - * - * @param finalLocation - * @throws PortletException - * @throws IOException - */ - protected void executeRenderResult(final String finalLocation) throws PortletException, IOException { - LOG.debug("Executing result in Render phase"); - PortletConfig cfg = PortletActionContext.getPortletConfig(); - RenderRequest req = PortletActionContext.getRenderRequest(); - RenderResponse res = PortletActionContext.getRenderResponse(); - LOG.debug("PortletConfig: " + cfg); - LOG.debug("RenderRequest: " + req); - LOG.debug("RenderResponse: " + res); - res.setContentType(contentType); - if (StringUtils.isNotEmpty(title)) { - res.setTitle(title); - } - LOG.debug("Location: " + finalLocation); - PortletRequestDispatcher preparator = cfg.getPortletContext() - .getNamedDispatcher("preparator"); - if(preparator == null) { - throw new PortletException("Cannot look up 'preparator' servlet. Make sure that you" + - "have configured it correctly in the web.xml file."); - } - new IncludeTemplate() { - protected void when(PortletException e) { - LOG.error("PortletException while dispatching to 'preparator' servlet", e); - } - protected void when(IOException e) { - LOG.error("IOException while dispatching to 'preparator' servlet", e); - } - }.include(preparator, req, res); - PortletRequestDispatcher dispatcher = cfg.getPortletContext().getRequestDispatcher(finalLocation); - if(dispatcher == null) { - throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'"); - } - new IncludeTemplate() { - protected void when(PortletException e) { - LOG.error("PortletException while dispatching to '" + finalLocation + "'"); - } - protected void when(IOException e) { - LOG.error("IOException while dispatching to '" + finalLocation + "'"); - } - }.include(dispatcher, req, res); - } - - /** - * Sets the content type. - * - * @param contentType The content type to set. - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * Sets the title. - * - * @param title The title to set. - */ - public void setTitle(String title) { - this.title = title; - } - - static class IncludeTemplate { - protected void include(PortletRequestDispatcher dispatcher, RenderRequest req, RenderResponse res) throws PortletException, IOException{ - try { - dispatcher.include(req, res); - } - catch(PortletException e) { - when(e); - throw e; - } - catch(IOException e) { - when(e); - throw e; - } - } - - protected void when(PortletException e) {} - - protected void when(IOException e) {} - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java b/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java deleted file mode 100644 index 313abdfbf..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java +++ /dev/null @@ -1,293 +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.portlet.result; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; - -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspFactory; -import javax.servlet.jsp.PageContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.dispatcher.StrutsResultSupport; -import org.apache.struts2.portlet.PortletActionConstants; -import org.apache.struts2.portlet.context.PortletActionContext; -import org.apache.struts2.views.JspSupportServlet; -import org.apache.struts2.views.velocity.VelocityManager; -import org.apache.velocity.Template; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.context.Context; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * - * Using the Servlet container's {@link JspFactory}, this result mocks a JSP - * execution environment and then displays a Velocity template that will be - * streamed directly to the servlet output. - * - *

    This result type takes the - * following parameters: - * - * - * - *

      - * - *
    • location (default) - the location of the template to process. - *
    • - * - *
    • parse - true by default. If set to false, the location param - * will not be parsed for Ognl expressions.
    • - * - *
    - *

    - * This result follows the same rules from {@link StrutsResultSupport}. - *

    - * - * - * - * Example: - * - *
    - * <!-- START SNIPPET: example -->
    - *  <result name="success" type="velocity">
    - *    <param name="location">foo.vm</param>
    - *  </result>
    - *  <!-- END SNIPPET: example -->
    - * 
    - * - */ -public class PortletVelocityResult extends StrutsResultSupport { - - private static final long serialVersionUID = -8241086555872212274L; - - private static final Log log = LogFactory - .getLog(PortletVelocityResult.class); - - public PortletVelocityResult() { - super(); - } - - public PortletVelocityResult(String location) { - super(location); - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation) - */ - public void doExecute(String location, ActionInvocation invocation) - throws Exception { - if (PortletActionContext.isEvent()) { - executeActionResult(location, invocation); - } else if (PortletActionContext.isRender()) { - executeRenderResult(location, invocation); - } - } - - /** - * Executes the result - * - * @param location The location string - * @param invocation The action invocation - */ - private void executeActionResult(String location, - ActionInvocation invocation) { - ActionResponse res = PortletActionContext.getActionResponse(); - // View is rendered outside an action...uh oh... - res.setRenderParameter(PortletActionConstants.ACTION_PARAM, - "freemarkerDirect"); - res.setRenderParameter("location", location); - res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext - .getRequest().getPortletMode().toString()); - - } - - /** - * Creates a Velocity context from the action, loads a Velocity template and - * executes the template. Output is written to the servlet output stream. - * - * @param finalLocation the location of the Velocity template - * @param invocation an encapsulation of the action execution state. - * @throws Exception if an error occurs when creating the Velocity context, - * loading or executing the template or writing output to the - * servlet response stream. - */ - public void executeRenderResult(String finalLocation, - ActionInvocation invocation) throws Exception { - prepareServletActionContext(); - ValueStack stack = ActionContext.getContext().getValueStack(); - - HttpServletRequest request = ServletActionContext.getRequest(); - HttpServletResponse response = ServletActionContext.getResponse(); - JspFactory jspFactory = null; - ServletContext servletContext = ServletActionContext - .getServletContext(); - Servlet servlet = JspSupportServlet.jspSupportServlet; - - VelocityManager.getInstance().init(servletContext); - - boolean usedJspFactory = false; - PageContext pageContext = (PageContext) ActionContext.getContext().get( - ServletActionContext.PAGE_CONTEXT); - - if (pageContext == null && servlet != null) { - jspFactory = JspFactory.getDefaultFactory(); - pageContext = jspFactory.getPageContext(servlet, request, response, - null, true, 8192, true); - ActionContext.getContext().put(ServletActionContext.PAGE_CONTEXT, - pageContext); - usedJspFactory = true; - } - - try { - String encoding = getEncoding(finalLocation); - String contentType = getContentType(finalLocation); - - if (encoding != null) { - contentType = contentType + ";charset=" + encoding; - } - - VelocityManager velocityManager = VelocityManager.getInstance(); - Template t = getTemplate(stack, - velocityManager.getVelocityEngine(), invocation, - finalLocation, encoding); - - Context context = createContext(velocityManager, stack, request, - response, finalLocation); - Writer writer = new OutputStreamWriter(response.getOutputStream(), - encoding); - - response.setContentType(contentType); - - t.merge(context, writer); - - // always flush the writer (we used to only flush it if this was a - // jspWriter, but someone asked - // to do it all the time (WW-829). Since Velocity support is being - // deprecated, we'll oblige :) - writer.flush(); - } catch (Exception e) { - log.error("Unable to render Velocity Template, '" + finalLocation - + "'", e); - throw e; - } finally { - if (usedJspFactory) { - jspFactory.releasePageContext(pageContext); - } - } - - return; - } - - /** - * Retrieve the content type for this template.

    People can override - * this method if they want to provide specific content types for specific - * templates (eg text/xml). - * - * @return The content type associated with this template (default - * "text/html") - */ - protected String getContentType(String templateLocation) { - return "text/html"; - } - - /** - * Retrieve the encoding for this template.

    People can override this - * method if they want to provide specific encodings for specific templates. - * - * @return The encoding associated with this template (defaults to the value - * of 'struts.i18n.encoding' property) - */ - protected String getEncoding(String templateLocation) { - String encoding = (String) Settings - .get(StrutsConstants.STRUTS_I18N_ENCODING); - if (encoding == null) { - encoding = System.getProperty("file.encoding"); - } - if (encoding == null) { - encoding = "UTF-8"; - } - return encoding; - } - - /** - * Given a value stack, a Velocity engine, and an action invocation, this - * method returns the appropriate Velocity template to render. - * - * @param stack the value stack to resolve the location again (when parse - * equals true) - * @param velocity the velocity engine to process the request against - * @param invocation an encapsulation of the action execution state. - * @param location the location of the template - * @param encoding the charset encoding of the template - * @return the template to render - * @throws Exception when the requested template could not be found - */ - protected Template getTemplate(ValueStack stack, - VelocityEngine velocity, ActionInvocation invocation, - String location, String encoding) throws Exception { - if (!location.startsWith("/")) { - location = invocation.getProxy().getNamespace() + "/" + location; - } - - Template template = velocity.getTemplate(location, encoding); - - return template; - } - - /** - * Creates the VelocityContext that we'll use to render this page. - * - * @param velocityManager a reference to the velocityManager to use - * @param stack the value stack to resolve the location against (when parse - * equals true) - * @param location the name of the template that is being used - * @return the a minted Velocity context. - */ - protected Context createContext(VelocityManager velocityManager, - ValueStack stack, HttpServletRequest request, - HttpServletResponse response, String location) { - return velocityManager.createContext(stack, request, response); - } - - /** - * Prepares the servlet action context for this request - */ - private void prepareServletActionContext() throws PortletException, - IOException { - PortletRequestDispatcher disp = PortletActionContext.getPortletConfig() - .getPortletContext().getNamedDispatcher("preparator"); - disp.include(PortletActionContext.getRenderRequest(), - PortletActionContext.getRenderResponse()); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java b/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java deleted file mode 100644 index ee3920ceb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java +++ /dev/null @@ -1,299 +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.portlet.util; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.portlet.PortletMode; -import javax.portlet.PortletSecurityException; -import javax.portlet.PortletURL; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.WindowState; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsException; -import org.apache.struts2.portlet.PortletActionConstants; -import org.apache.struts2.portlet.context.PortletActionContext; - -/** - * Helper class for creating Portlet URLs. Portlet URLs are fundamentally different from regular - * servlet URLs since they never target the application itself; all requests go through the portlet - * container and must therefore be programatically constructed using the - * {@link javax.portlet.RenderResponse#createActionURL()} and - * {@link javax.portlet.RenderResponse#createRenderURL()} APIs. - * - */ -public class PortletUrlHelper { - public static final String ENCODING = "UTF-8"; - - private static final Log LOG = LogFactory.getLog(PortletUrlHelper.class); - - /** - * Create a portlet URL with for the specified action and namespace. - * - * @param action The action the URL should invoke. - * @param namespace The namespace of the action to invoke. - * @param params The parameters of the URL. - * @param type The type of the url, either action or render - * @param mode The PortletMode of the URL. - * @param state The WindowState of the URL. - * @return The URL String. - */ - public static String buildUrl(String action, String namespace, Map params, - String type, String mode, String state) { - return buildUrl(action, namespace, params, null, type, mode, state, - true, true); - } - - /** - * Create a portlet URL with for the specified action and namespace. - * - * @see #buildUrl(String, String, Map, String, String, String) - */ - public static String buildUrl(String action, String namespace, Map params, - String scheme, String type, String portletMode, String windowState, - boolean includeContext, boolean encodeResult) { - RenderRequest request = PortletActionContext.getRenderRequest(); - RenderResponse response = PortletActionContext.getRenderResponse(); - LOG.debug("Creating url. Action = " + action + ", Namespace = " - + namespace + ", Type = " + type); - namespace = prependNamespace(namespace, portletMode); - if(StringUtils.isEmpty(portletMode)) { - portletMode = PortletActionContext.getRenderRequest().getPortletMode().toString(); - } - String result = null; - int paramStartIndex = action.indexOf('?'); - if (paramStartIndex > 0) { - String value = action; - action = value.substring(0, value.indexOf('?')); - String queryStr = value.substring(paramStartIndex + 1); - StringTokenizer tok = new StringTokenizer(queryStr, "&"); - while (tok.hasMoreTokens()) { - String paramVal = tok.nextToken(); - String key = paramVal.substring(0, paramVal.indexOf('=')); - String val = paramVal.substring(paramVal.indexOf('=') + 1); - params.put(key, new String[] { val }); - } - } - if (StringUtils.isNotEmpty(namespace)) { - StringBuffer sb = new StringBuffer(); - sb.append(namespace); - if(!action.startsWith("/") && !namespace.endsWith("/")) { - sb.append("/"); - } - action = sb.append(action).toString(); - LOG.debug("Resulting actionPath: " + action); - } - params.put(PortletActionConstants.ACTION_PARAM, new String[] { action }); - - PortletURL url = null; - if ("action".equalsIgnoreCase(type)) { - LOG.debug("Creating action url"); - url = response.createActionURL(); - } else { - LOG.debug("Creating render url"); - url = response.createRenderURL(); - } - - params.put(PortletActionConstants.MODE_PARAM, portletMode); - url.setParameters(ensureParamsAreStringArrays(params)); - - if ("HTTPS".equalsIgnoreCase(scheme)) { - try { - url.setSecure(true); - } catch (PortletSecurityException e) { - LOG.error("Cannot set scheme to https", e); - } - } - try { - url.setPortletMode(getPortletMode(request, portletMode)); - url.setWindowState(getWindowState(request, windowState)); - } catch (Exception e) { - LOG.error("Unable to set mode or state:" + e.getMessage(), e); - } - result = url.toString(); - // TEMP BUG-WORKAROUND FOR DOUBLE ESCAPING OF AMPERSAND - if(result.indexOf("&") >= 0) { - result = StringUtils.replace(result, "&", "&"); - } - return result; - - } - - /** - * - * Prepend the namespace configuration for the specified namespace and PortletMode. - * - * @param namespace The base namespace. - * @param portletMode The PortletMode. - * - * @return prepended namespace. - */ - private static String prependNamespace(String namespace, String portletMode) { - StringBuffer sb = new StringBuffer(); - PortletMode mode = PortletActionContext.getRenderRequest().getPortletMode(); - if(StringUtils.isNotEmpty(portletMode)) { - mode = new PortletMode(portletMode); - } - String portletNamespace = PortletActionContext.getPortletNamespace(); - String modeNamespace = (String)PortletActionContext.getModeNamespaceMap().get(mode); - LOG.debug("PortletNamespace: " + portletNamespace + ", modeNamespace: " + modeNamespace); - if(StringUtils.isNotEmpty(portletNamespace)) { - sb.append(portletNamespace); - } - if(StringUtils.isNotEmpty(modeNamespace)) { - if(!modeNamespace.startsWith("/")) { - sb.append("/"); - } - sb.append(modeNamespace); - } - if(StringUtils.isNotEmpty(namespace)) { - if(!namespace.startsWith("/")) { - sb.append("/"); - } - sb.append(namespace); - } - LOG.debug("Resulting namespace: " + sb); - return sb.toString(); - } - - /** - * Encode an url to a non Struts action resource, like stylesheet, image or - * servlet. - * - * @param value - * @return encoded url to non Struts action resources. - */ - public static String buildResourceUrl(String value, Map params) { - StringBuffer sb = new StringBuffer(); - // Relative URLs are not allowed in a portlet - if (!value.startsWith("/")) { - sb.append("/"); - } - sb.append(value); - if(params != null && params.size() > 0) { - sb.append("?"); - Iterator it = params.keySet().iterator(); - try { - while(it.hasNext()) { - String key = (String)it.next(); - String val = (String)params.get(key); - - sb.append(URLEncoder.encode(key, ENCODING)).append("="); - sb.append(URLEncoder.encode(val, ENCODING)); - if(it.hasNext()) { - sb.append("&"); - } - } - } catch (UnsupportedEncodingException e) { - throw new StrutsException("Encoding "+ENCODING+" not found"); - } - } - RenderResponse resp = PortletActionContext.getRenderResponse(); - RenderRequest req = PortletActionContext.getRenderRequest(); - return resp.encodeURL(req.getContextPath() + sb.toString()); - } - - /** - * Will ensure that all entries in params are String arrays, - * as requried by the setParameters on the PortletURL. - * - * @param params The parameters to the URL. - * @return A Map with all parameters as String arrays. - */ - public static Map ensureParamsAreStringArrays(Map params) { - Map result = null; - if (params != null) { - result = new HashMap(params.size()); - Iterator it = params.keySet().iterator(); - while (it.hasNext()) { - Object key = it.next(); - Object val = params.get(key); - if (val instanceof String[]) { - result.put(key, val); - } else { - result.put(key, new String[] { val.toString() }); - } - } - } - return result; - } - - /** - * Convert the given String to a WindowState object. - * - * @param portletReq The RenderRequest. - * @param windowState The WindowState as a String. - * @return The WindowState that mathces the windowState String, or if - * the Sring is blank, the current WindowState. - */ - private static WindowState getWindowState(RenderRequest portletReq, - String windowState) { - WindowState state = portletReq.getWindowState(); - if (StringUtils.isNotEmpty(windowState)) { - state = portletReq.getWindowState(); - if ("maximized".equalsIgnoreCase(windowState)) { - state = WindowState.MAXIMIZED; - } else if ("normal".equalsIgnoreCase(windowState)) { - state = WindowState.NORMAL; - } else if ("minimized".equalsIgnoreCase(windowState)) { - state = WindowState.MINIMIZED; - } - } - if(state == null) { - state = WindowState.NORMAL; - } - return state; - } - - /** - * Convert the given String to a PortletMode object. - * - * @param portletReq The RenderRequest. - * @param portletMode The PortletMode as a String. - * @return The PortletMode that mathces the portletMode String, or if - * the Sring is blank, the current PortletMode. - */ - private static PortletMode getPortletMode(RenderRequest portletReq, - String portletMode) { - PortletMode mode = portletReq.getPortletMode(); - - if (StringUtils.isNotEmpty(portletMode)) { - mode = portletReq.getPortletMode(); - if ("edit".equalsIgnoreCase(portletMode)) { - mode = PortletMode.EDIT; - } else if ("view".equalsIgnoreCase(portletMode)) { - mode = PortletMode.VIEW; - } else if ("help".equalsIgnoreCase(portletMode)) { - mode = PortletMode.HELP; - } - } - if(mode == null) { - mode = PortletMode.VIEW; - } - return mode; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java b/trunk/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java deleted file mode 100644 index 45d1e4d30..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java +++ /dev/null @@ -1,85 +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.spring; - -import javax.servlet.ServletContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.util.ObjectFactoryInitializable; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.opensymphony.xwork2.spring.SpringObjectFactory; - - - -/** - * Struts object factory that integrates with Spring. - *

    - * Spring should be loaded using a web context listener - * org.springframework.web.context.ContextLoaderListener defined in web.xml. - * - */ -public class StrutsSpringObjectFactory extends SpringObjectFactory implements ObjectFactoryInitializable { - private static final Log log = LogFactory.getLog(StrutsSpringObjectFactory.class); - - /* (non-Javadoc) - * @see org.apache.struts2.util.ObjectFactoryInitializable#init(javax.servlet.ServletContext) - */ - public void init(ServletContext servletContext) { - log.info("Initializing Struts-Spring integration..."); - - ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); - if (appContext == null) { - // uh oh! looks like the lifecycle listener wasn't installed. Let's inform the user - String message = "********** FATAL ERROR STARTING UP SPRING-STRUTS INTEGRATION **********\n" + - "Looks like the Spring listener was not configured for your web app! \n" + - "Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.\n" + - "You might need to add the following to web.xml: \n" + - " \n" + - " org.springframework.web.context.ContextLoaderListener\n" + - " "; - log.fatal(message); - return; - } - - this.setApplicationContext(appContext); - - String autoWire = Settings.get(StrutsConstants.STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE); - int type = AutowireCapableBeanFactory.AUTOWIRE_BY_NAME; // default - if ("name".equals(autoWire)) { - type = AutowireCapableBeanFactory.AUTOWIRE_BY_NAME; - } else if ("type".equals(autoWire)) { - type = AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } else if ("auto".equals(autoWire)) { - type = AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT; - } else if ("constructor".equals(autoWire)) { - type = AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR; - } - this.setAutowireStrategy(type); - - boolean useClassCache = "true".equals(Settings.get(StrutsConstants.STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE)); - this.setUseClassCache(useClassCache); - - log.info("... initialized Struts-Spring integration successfully"); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java b/trunk/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java deleted file mode 100644 index b98688508..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java +++ /dev/null @@ -1,114 +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.spring.lifecycle; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.DispatcherListener; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.config.ExternalReferenceResolver; -import com.opensymphony.xwork2.config.entities.PackageConfig; - -/** - * Setup any {@link com.opensymphony.xwork2.config.ExternalReferenceResolver}s - * that implement the ApplicationContextAware interface from the Spring - * framework. Relies on Spring's - * {@link org.springframework.web.context.ContextLoaderListener}having been - * called first. - */ -public class SpringExternalReferenceResolverSetupListener implements - ServletContextListener { - - private Map listeners = new HashMap(); - - /* (non-Javadoc) - * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) - */ - public synchronized void contextDestroyed(ServletContextEvent event) { - Listener l = listeners.get(event.getServletContext()); - Dispatcher.removeDispatcherListener(l); - listeners.remove(event.getServletContext()); - } - - /* (non-Javadoc) - * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) - */ - public synchronized void contextInitialized(ServletContextEvent event) { - Listener l = new Listener(event.getServletContext()); - Dispatcher.addDispatcherListener(l); - listeners.put(event.getServletContext(), l); - } - - /** - * Handles initializing and cleaning up the dispatcher - * @author brownd - * - */ - private class Listener implements DispatcherListener { - - private ServletContext servletContext; - - /** - * Constructs the listener - * - * @param ctx The servlet context - */ - public Listener(ServletContext ctx) { - this.servletContext = ctx; - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.DispatcherListener#dispatcherInitialized(org.apache.struts2.dispatcher.Dispatcher) - */ - public void dispatcherInitialized(Dispatcher du) { - ApplicationContext appContext = WebApplicationContextUtils - .getWebApplicationContext(servletContext); - - Configuration xworkConfig = du.getConfigurationManager().getConfiguration(); - Map packageConfigs = xworkConfig.getPackageConfigs(); - Iterator i = packageConfigs.values().iterator(); - - while (i.hasNext()) { - PackageConfig packageConfig = (PackageConfig) i.next(); - ExternalReferenceResolver resolver = packageConfig.getExternalRefResolver(); - if (resolver == null || !(resolver instanceof ApplicationContextAware)) - continue; - ApplicationContextAware contextAware = (ApplicationContextAware) resolver; - contextAware.setApplicationContext(appContext); - } - - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.DispatcherListener#dispatcherDestroyed(org.apache.struts2.dispatcher.Dispatcher) - */ - public void dispatcherDestroyed(Dispatcher du) { - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java b/trunk/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java deleted file mode 100644 index a148e6598..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java +++ /dev/null @@ -1,81 +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.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import com.opensymphony.xwork2.Action; - - -/** - * A bean that takes several iterators and outputs them in sequence - * - * @see org.apache.struts2.components.AppendIterator - * @see org.apache.struts2.views.jsp.iterator.AppendIteratorTag - */ -public class AppendIteratorFilter extends IteratorFilterSupport implements Iterator, Action { - - List iterators = new ArrayList(); - - // Attributes ---------------------------------------------------- - List sources = new ArrayList(); - - - // Public -------------------------------------------------------- - public void setSource(Object anIterator) { - sources.add(anIterator); - } - - // Action implementation ----------------------------------------- - public String execute() { - // Make source transformations - for (int i = 0; i < sources.size(); i++) { - Object source = sources.get(i); - iterators.add(getIterator(source)); - } - - return SUCCESS; - } - - // Iterator implementation --------------------------------------- - public boolean hasNext() { - if (iterators.size() > 0) { - return (((Iterator) iterators.get(0)).hasNext()); - } else { - return false; - } - } - - public Object next() { - try { - return ((Iterator) iterators.get(0)).next(); - } finally { - if (iterators.size() > 0) { - if (!((Iterator) iterators.get(0)).hasNext()) { - iterators.remove(0); - } - } - } - } - - public void remove() { - throw new UnsupportedOperationException(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/AttributeMap.java b/trunk/core/src/main/java/org/apache/struts2/util/AttributeMap.java deleted file mode 100644 index 93b04ccdf..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/AttributeMap.java +++ /dev/null @@ -1,134 +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.util; - -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import javax.servlet.jsp.PageContext; - -import org.apache.struts2.ServletActionContext; - - -/** - * A Map that holds 4 levels of scope. - *

    - * The scopes are the ones known in the web world.: - *

      - *
    • Page scope
    • - *
    • Request scope
    • - *
    • Session scope
    • - *
    • Application scope
    • - *
    - * A object is searched in the order above, starting from page and ending at application scope. - * - */ -public class AttributeMap implements Map { - - protected static final String UNSUPPORTED = "method makes no sense for a simplified map"; - - - Map context; - - - public AttributeMap(Map context) { - this.context = context; - } - - - public boolean isEmpty() { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - public void clear() { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - public boolean containsKey(Object key) { - return (get(key) != null); - } - - public boolean containsValue(Object value) { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - public Set entrySet() { - return Collections.EMPTY_SET; - } - - public Object get(Object key) { - PageContext pc = getPageContext(); - - if (pc == null) { - Map request = (Map) context.get("request"); - Map session = (Map) context.get("session"); - Map application = (Map) context.get("application"); - - if ((request != null) && (request.get(key) != null)) { - return request.get(key); - } else if ((session != null) && (session.get(key) != null)) { - return session.get(key); - } else if ((application != null) && (application.get(key) != null)) { - return application.get(key); - } - } else { - try{ - return pc.findAttribute(key.toString()); - }catch (NullPointerException npe){ - return null; - } - } - - return null; - } - - public Set keySet() { - return Collections.EMPTY_SET; - } - - public Object put(Object key, Object value) { - PageContext pc = getPageContext(); - if (pc != null) { - pc.setAttribute(key.toString(), value); - } - - return null; - } - - public void putAll(Map t) { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - public Object remove(Object key) { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - public int size() { - throw new UnsupportedOperationException(UNSUPPORTED); - } - - public Collection values() { - return Collections.EMPTY_SET; - } - - private PageContext getPageContext() { - return (PageContext) context.get(ServletActionContext.PAGE_CONTEXT); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java b/trunk/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java deleted file mode 100644 index b07e64841..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java +++ /dev/null @@ -1,131 +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.util; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - - -/** - * This class is extremely useful for loading resources and classes in a fault tolerant manner - * that works across different applications servers. - *

    - * It has come out of many months of frustrating use of multiple application servers at Atlassian, - * please don't change things unless you're sure they're not going to break in one server or another! - * - */ -public class ClassLoaderUtils { - - /** - * Load a given resource. - *

    - * This method will try to load the resource using the following methods (in order): - *

      - *
    • From {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()} - *
    • From {@link Class#getClassLoader() ClassLoaderUtil.class.getClassLoader()} - *
    • From the {@link Class#getClassLoader() callingClass.getClassLoader() } - *
    - * - * @param resourceName The name of the resource to load - * @param callingClass The Class object of the calling object - */ - public static URL getResource(String resourceName, Class callingClass) { - URL url = null; - - url = Thread.currentThread().getContextClassLoader().getResource(resourceName); - - if (url == null) { - url = ClassLoaderUtils.class.getClassLoader().getResource(resourceName); - } - - if (url == null) { - url = callingClass.getClassLoader().getResource(resourceName); - } - - return url; - } - - /** - * This is a convenience method to load a resource as a stream. - *

    - * The algorithm used to find the resource is given in getResource() - * - * @param resourceName The name of the resource to load - * @param callingClass The Class object of the calling object - */ - public static InputStream getResourceAsStream(String resourceName, Class callingClass) { - URL url = getResource(resourceName, callingClass); - - try { - return (url != null) ? url.openStream() : null; - } catch (IOException e) { - return null; - } - } - - /** - * Load a class with a given name. - *

    - * It will try to load the class in the following order: - *

      - *
    • From {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()} - *
    • Using the basic {@link Class#forName(java.lang.String) } - *
    • From {@link Class#getClassLoader() ClassLoaderUtil.class.getClassLoader()} - *
    • From the {@link Class#getClassLoader() callingClass.getClassLoader() } - *
    - * - * @param className The name of the class to load - * @param callingClass The Class object of the calling object - * @throws ClassNotFoundException If the class cannot be found anywhere. - */ - public static Class loadClass(String className, Class callingClass) throws ClassNotFoundException { - try { - return Thread.currentThread().getContextClassLoader().loadClass(className); - } catch (ClassNotFoundException e) { - try { - return Class.forName(className); - } catch (ClassNotFoundException ex) { - try { - return ClassLoaderUtils.class.getClassLoader().loadClass(className); - } catch (ClassNotFoundException exc) { - return callingClass.getClassLoader().loadClass(className); - } - } - } - } - - /** - * Prints the current classloader hierarchy - useful for debugging. - */ - public static void printClassLoader() { - System.out.println("ClassLoaderUtils.printClassLoader"); - printClassLoader(Thread.currentThread().getContextClassLoader()); - } - - /** - * Prints the classloader hierarchy from a given classloader - useful for debugging. - */ - public static void printClassLoader(ClassLoader cl) { - System.out.println("ClassLoaderUtils.printClassLoader(cl = " + cl + ")"); - - if (cl != null) { - printClassLoader(cl.getParent()); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ContainUtil.java b/trunk/core/src/main/java/org/apache/struts2/util/ContainUtil.java deleted file mode 100644 index d1093421d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ContainUtil.java +++ /dev/null @@ -1,66 +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.util; - -import java.lang.reflect.Array; -import java.util.Collection; -import java.util.Map; - - -/** - * ContainUtil will check if object 1 contains object 2. - * Object 1 may be an Object, array, Collection, or a Map - * - */ -public class ContainUtil { - - public static boolean contains(Object obj1, Object obj2) { - if ((obj1 == null) || (obj2 == null)) { - //log.debug("obj1 or obj2 are null."); - return false; - } - - if (obj1 instanceof Map) { - if (((Map) obj1).containsValue(obj2)) { - //log.debug("obj1 is a map and contains obj2"); - return true; - } - } else if (obj1 instanceof Collection) { - if (((Collection) obj1).contains(obj2)) { - //log.debug("obj1 is a collection and contains obj2"); - return true; - } - } else if (obj1.getClass().isArray()) { - for (int i = 0; i < Array.getLength(obj1); i++) { - Object value = null; - value = Array.get(obj1, i); - - if (value.equals(obj2)) { - //log.debug("obj1 is an array and contains obj2"); - return true; - } - } - } else if (obj1.equals(obj2)) { - //log.debug("obj1 is an object and equals obj2"); - return true; - } - - //log.debug("obj1 does not contain obj2: " + obj1 + ", " + obj2); - return false; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/Counter.java b/trunk/core/src/main/java/org/apache/struts2/util/Counter.java deleted file mode 100644 index ad5e53d0c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/Counter.java +++ /dev/null @@ -1,120 +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.util; - -import java.io.Serializable; - - -/** - * A bean that can be used to keep track of a counter. - *

    - * Since it is an Iterator it can be used by the iterator tag - * - */ -public class Counter implements java.util.Iterator, Serializable { - - private static final long serialVersionUID = 2796965884308060179L; - - boolean wrap = false; - - // Attributes ---------------------------------------------------- - long first = 1; - long current = first; - long interval = 1; - long last = -1; - - - public void setAdd(long addition) { - current += addition; - } - - public void setCurrent(long current) { - this.current = current; - } - - public long getCurrent() { - return current; - } - - public void setFirst(long first) { - this.first = first; - current = first; - } - - public long getFirst() { - return first; - } - - public void setInterval(long interval) { - this.interval = interval; - } - - public long getInterval() { - return interval; - } - - public void setLast(long last) { - this.last = last; - } - - public long getLast() { - return last; - } - - // Public -------------------------------------------------------- - public long getNext() { - long next = current; - current += interval; - - if (wrap && (current > last)) { - current -= ((1 + last) - first); - } - - return next; - } - - public long getPrevious() { - current -= interval; - - if (wrap && (current < first)) { - current += (last - first + 1); - } - - return current; - } - - public void setWrap(boolean wrap) { - this.wrap = wrap; - } - - public boolean isWrap() { - return wrap; - } - - public boolean hasNext() { - return ((last == -1) || wrap) ? true : (current <= last); - } - - public Object next() { - return new Long(getNext()); - } - - public void remove() { - // Do nothing - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/DateFormatter.java b/trunk/core/src/main/java/org/apache/struts2/util/DateFormatter.java deleted file mode 100644 index 61e569f1b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/DateFormatter.java +++ /dev/null @@ -1,90 +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.util; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - - -/** - * A bean that can be used to format dates - * - */ -public class DateFormatter { - - Date date; - DateFormat format; - - // Attributes ---------------------------------------------------- - DateFormat parser; - - - // Public -------------------------------------------------------- - public DateFormatter() { - this.parser = new SimpleDateFormat(); - this.format = new SimpleDateFormat(); - this.date = new Date(); - } - - - public void setDate(String date) { - try { - this.date = parser.parse(date); - } catch (ParseException e) { - throw new IllegalArgumentException(e.getMessage()); - } - } - - public void setDate(Date date) { - this.date = date; - } - - public void setDate(int date) { - setDate(Integer.toString(date)); - } - - public Date getDate() { - return this.date; - } - - public void setFormat(String format) { - this.format = new SimpleDateFormat(format); - } - - public void setFormat(DateFormat format) { - this.format = format; - } - - public String getFormattedDate() { - return format.format(date); - } - - public void setParseFormat(String format) { - this.parser = new SimpleDateFormat(format); - } - - public void setParser(DateFormat parser) { - this.parser = parser; - } - - public void setTime(long time) { - date.setTime(time); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java b/trunk/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java deleted file mode 100644 index e3dde75ef..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java +++ /dev/null @@ -1,217 +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.util; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.RandomAccessFile; -import java.io.Writer; -import java.util.Iterator; -import java.util.LinkedList; - - -/** - * A speedy implementation of ByteArrayOutputStream. It's not synchronized, and it - * does not copy buffers when it's expanded. There's also no copying of the internal buffer - * if it's contents is extracted with the writeTo(stream) method. - * - */ -public class FastByteArrayOutputStream extends OutputStream { - - // Static -------------------------------------------------------- - private static final int DEFAULT_BLOCK_SIZE = 8192; - - - private LinkedList buffers; - - // Attributes ---------------------------------------------------- - // internal buffer - private byte[] buffer; - - // is the stream closed? - private boolean closed; - private int blockSize; - private int index; - private int size; - - - // Constructors -------------------------------------------------- - public FastByteArrayOutputStream() { - this(DEFAULT_BLOCK_SIZE); - } - - public FastByteArrayOutputStream(int aSize) { - blockSize = aSize; - buffer = new byte[blockSize]; - } - - - public int getSize() { - return size + index; - } - - public void close() { - closed = true; - } - - public byte[] toByteArray() { - byte[] data = new byte[getSize()]; - - // Check if we have a list of buffers - int pos = 0; - - if (buffers != null) { - Iterator iter = buffers.iterator(); - - while (iter.hasNext()) { - byte[] bytes = (byte[]) iter.next(); - System.arraycopy(bytes, 0, data, pos, blockSize); - pos += blockSize; - } - } - - // write the internal buffer directly - System.arraycopy(buffer, 0, data, pos, index); - - return data; - } - - public String toString() { - return new String(toByteArray()); - } - - // OutputStream overrides ---------------------------------------- - public void write(int datum) throws IOException { - if (closed) { - throw new IOException("Stream closed"); - } else { - if (index == blockSize) { - addBuffer(); - } - - // store the byte - buffer[index++] = (byte) datum; - } - } - - public void write(byte[] data, int offset, int length) throws IOException { - if (data == null) { - throw new NullPointerException(); - } else if ((offset < 0) || ((offset + length) > data.length) || (length < 0)) { - throw new IndexOutOfBoundsException(); - } else if (closed) { - throw new IOException("Stream closed"); - } else { - if ((index + length) > blockSize) { - int copyLength; - - do { - if (index == blockSize) { - addBuffer(); - } - - copyLength = blockSize - index; - - if (length < copyLength) { - copyLength = length; - } - - System.arraycopy(data, offset, buffer, index, copyLength); - offset += copyLength; - index += copyLength; - length -= copyLength; - } while (length > 0); - } else { - // Copy in the subarray - System.arraycopy(data, offset, buffer, index, length); - index += length; - } - } - } - - // Public - public void writeTo(OutputStream out) throws IOException { - // Check if we have a list of buffers - if (buffers != null) { - Iterator iter = buffers.iterator(); - - while (iter.hasNext()) { - byte[] bytes = (byte[]) iter.next(); - out.write(bytes, 0, blockSize); - } - } - - // write the internal buffer directly - out.write(buffer, 0, index); - } - - public void writeTo(RandomAccessFile out) throws IOException { - // Check if we have a list of buffers - if (buffers != null) { - Iterator iter = buffers.iterator(); - - while (iter.hasNext()) { - byte[] bytes = (byte[]) iter.next(); - out.write(bytes, 0, blockSize); - } - } - - // write the internal buffer directly - out.write(buffer, 0, index); - } - - public void writeTo(Writer out, String encoding) throws IOException { - // Check if we have a list of buffers - if (buffers != null) { - Iterator iter = buffers.iterator(); - - while (iter.hasNext()) { - byte[] bytes = (byte[]) iter.next(); - - if (encoding != null) { - out.write(new String(bytes, encoding)); - } else { - out.write(new String(bytes)); - } - } - } - - // write the internal buffer directly - if (encoding != null) { - out.write(new String(buffer, 0, index, encoding)); - } else { - out.write(new String(buffer, 0, index)); - } - } - - /** - * Create a new buffer and store the - * current one in linked list - */ - protected void addBuffer() { - if (buffers == null) { - buffers = new LinkedList(); - } - - buffers.addLast(buffer); - - buffer = new byte[blockSize]; - size += index; - index = 0; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java b/trunk/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java deleted file mode 100644 index 53119682c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java +++ /dev/null @@ -1,118 +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.util; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * InvocationSessionStore - * - */ -public class InvocationSessionStore { - - private static final String INVOCATION_MAP_KEY = "org.apache.struts2.util.InvocationSessionStore.invocationMap"; - - - private InvocationSessionStore() { - } - - - /** - * Checks the Map in the Session for the key and the token. If the - * ActionInvocation is saved in the Session, the ValueStack from the - * ActionProxy associated with the ActionInvocation is set into the - * ActionContext and the ActionInvocation is returned. - * - * @param key the name the DefaultActionInvocation and ActionContext were saved as - * @return the DefaultActionInvocation saved using the key, or null if none was found - */ - public static ActionInvocation loadInvocation(String key, String token) { - InvocationContext invocationContext = (InvocationContext) getInvocationMap().get(key); - - if ((invocationContext == null) || !invocationContext.token.equals(token)) { - return null; - } - - ValueStack stack = invocationContext.invocation.getStack(); - ActionContext.getContext().setValueStack(stack); - - return invocationContext.invocation; - } - - /** - * Stores the DefaultActionInvocation and ActionContext into the Session using the provided key for loading later using - * {@link #loadInvocation} - * - * @param key - * @param invocation - */ - public static void storeInvocation(String key, String token, ActionInvocation invocation) { - InvocationContext invocationContext = new InvocationContext(invocation, token); - Map invocationMap = getInvocationMap(); - invocationMap.put(key, invocationContext); - setInvocationMap(invocationMap); - } - - static void setInvocationMap(Map invocationMap) { - Map session = ActionContext.getContext().getSession(); - - if (session == null) { - throw new IllegalStateException("Unable to access the session."); - } - - session.put(INVOCATION_MAP_KEY, invocationMap); - } - - static Map getInvocationMap() { - Map session = ActionContext.getContext().getSession(); - - if (session == null) { - throw new IllegalStateException("Unable to access the session."); - } - - Map invocationMap = (Map) session.get(INVOCATION_MAP_KEY); - - if (invocationMap == null) { - invocationMap = new HashMap(); - setInvocationMap(invocationMap); - } - - return invocationMap; - } - - - private static class InvocationContext implements Serializable { - - private static final long serialVersionUID = -286697666275777888L; - - ActionInvocation invocation; - String token; - - public InvocationContext(ActionInvocation invocation, String token) { - this.invocation = invocation; - this.token = token; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java b/trunk/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java deleted file mode 100644 index 5f3a26913..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java +++ /dev/null @@ -1,56 +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.util; - -import java.util.Enumeration; -import java.util.Iterator; - - -/** - * A base class for iterator filters - * - */ -public abstract class IteratorFilterSupport { - - // Protected implementation -------------------------------------- - protected Object getIterator(Object source) { - return MakeIterator.convert(source); - } - - - // Wrapper for enumerations - public class EnumerationIterator implements Iterator { - Enumeration enumeration; - - public EnumerationIterator(Enumeration aEnum) { - enumeration = aEnum; - } - - public boolean hasNext() { - return enumeration.hasMoreElements(); - } - - public Object next() { - return enumeration.nextElement(); - } - - public void remove() { - throw new UnsupportedOperationException("Remove is not supported in IteratorFilterSupport."); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java b/trunk/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java deleted file mode 100644 index 6bf81d650..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java +++ /dev/null @@ -1,138 +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.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.Action; - - -/** - * A bean that generates an iterator filled with a given object depending on the count, - * separator and converter defined. It is being used by IteratorGeneratorTag. - * - */ -public class IteratorGenerator implements Iterator, Action { - - private static final Log _log = LogFactory.getLog(IteratorGenerator.class); - - List values; - Object value; - String separator; - Converter converter; - - // Attributes ---------------------------------------------------- - int count = 0; - int currentCount = 0; - - - public void setCount(int aCount) { - this.count = aCount; - } - - public boolean getHasNext() { - return hasNext(); - } - - public Object getNext() { - return next(); - } - - public void setSeparator(String aChar) { - separator = aChar; - } - - public void setConverter(Converter aConverter) { - converter = aConverter; - } - - // Public -------------------------------------------------------- - public void setValues(Object aValue) { - value = aValue; - } - - // Action implementation ----------------------------------------- - public String execute() { - if (value == null) { - return ERROR; - } else { - values = new ArrayList(); - - if (separator != null) { - StringTokenizer tokens = new StringTokenizer(value.toString(), separator); - - while (tokens.hasMoreTokens()) { - String token = tokens.nextToken().trim(); - if (converter != null) { - try { - Object convertedObj = converter.convert(token); - values.add(convertedObj); - } - catch(Exception e) { // make sure things, goes on, we just ignore the bad ones - _log.warn("unable to convert ["+token+"], skipping this token, it will not appear in the generated iterator", e); - } - } - else { - values.add(token); - } - } - } else { - values.add(value.toString()); - } - - // Count default is the size of the list of values - if (count == 0) { - count = values.size(); - } - - return SUCCESS; - } - } - - // Iterator implementation --------------------------------------- - public boolean hasNext() { - return (value == null) ? false : ((currentCount < count) || (count == -1)); - } - - public Object next() { - try { - return values.get(currentCount % values.size()); - } finally { - currentCount++; - } - } - - public void remove() { - throw new UnsupportedOperationException("Remove is not supported in IteratorGenerator."); - } - - - // Inner class -------------------------------------------------- - /** - * Interface for converting each separated token into an Object of choice. - */ - public static interface Converter { - Object convert(String token) throws Exception; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ListEntry.java b/trunk/core/src/main/java/org/apache/struts2/util/ListEntry.java deleted file mode 100644 index db7b195e7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ListEntry.java +++ /dev/null @@ -1,49 +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.util; - -/** - * Entry in a list. - * - */ -public class ListEntry { - - final private Object key; - final private Object value; - final private boolean isSelected; - - - public ListEntry(Object key, Object value, boolean isSelected) { - this.key = key; - this.value = value; - this.isSelected = isSelected; - } - - - public boolean getIsSelected() { - return isSelected; - } - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java b/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java deleted file mode 100644 index fe59ec284..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java +++ /dev/null @@ -1,106 +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.util; - -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - - -/** - * MakeIterator. - * - */ -public class MakeIterator { - - /** - * Determine whether a given object can be made into an Iterator - * - * @param object the object to check - * @return true if the object can be converted to an iterator and - * false otherwise - */ - public static boolean isIterable(Object object) { - if (object == null) { - return false; - } - - if (object instanceof Map) { - return true; - } else if (object instanceof Collection) { - return true; - } else if (object.getClass().isArray()) { - return true; - } else if (object instanceof Enumeration) { - return true; - } else if (object instanceof Iterator) { - return true; - } else { - return false; - } - } - - public static Iterator convert(Object value) { - Iterator iterator; - - if (value instanceof Iterator) { - return (Iterator) value; - } - - if (value instanceof Map) { - value = ((Map) value).entrySet(); - } - - if (value == null) { - return null; - } - - if (value instanceof Collection) { - iterator = ((Collection) value).iterator(); - } else if (value.getClass().isArray()) { - //need ability to support primitives; therefore, cannot - //use Object[] casting. - ArrayList list = new ArrayList(Array.getLength(value)); - - for (int j = 0; j < Array.getLength(value); j++) { - list.add(Array.get(value, j)); - } - - iterator = list.iterator(); - } else if (value instanceof Enumeration) { - Enumeration enumeration = (Enumeration) value; - ArrayList list = new ArrayList(); - - while (enumeration.hasMoreElements()) { - list.add(enumeration.nextElement()); - } - - iterator = list.iterator(); - } else { - List list = new ArrayList(1); - list.add(value); - iterator = list.iterator(); - } - - return iterator; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java b/trunk/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java deleted file mode 100644 index e46ec4685..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java +++ /dev/null @@ -1,87 +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.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import com.opensymphony.xwork2.Action; - - -/** - * A bean that takes several iterators and outputs the merge of them. Used by - * MergeIteratorTag. - * - * @see org.apache.struts2.views.jsp.iterator.MergeIteratorTag - * @see org.apache.struts2.components.MergeIterator - */ -public class MergeIteratorFilter extends IteratorFilterSupport implements Iterator, Action { - - List iterators = new ArrayList(); - - // Attributes ---------------------------------------------------- - List sources = new ArrayList(); - int idx = 0; - - - // Public -------------------------------------------------------- - public void setSource(Object anIterator) { - sources.add(anIterator); - } - - // Action implementation ----------------------------------------- - public String execute() { - // Make source transformations - for (int i = 0; i < sources.size(); i++) { - Object source = sources.get(i); - iterators.add(getIterator(source)); - } - - return SUCCESS; - } - - // Iterator implementation --------------------------------------- - public boolean hasNext() { - while (iterators.size() > 0) { - if (((Iterator) iterators.get(idx)).hasNext()) { - return true; - } else { - iterators.remove(idx); - - if (iterators.size() > 0) { - idx = idx % iterators.size(); - } - } - } - - return false; - } - - public Object next() { - try { - return ((Iterator) iterators.get(idx)).next(); - } finally { - idx = (idx + 1) % iterators.size(); - } - } - - public void remove() { - throw new UnsupportedOperationException("Remove is not supported in MergeIteratorFilter."); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java b/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java deleted file mode 100644 index c2e26b277..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java +++ /dev/null @@ -1,30 +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.util; - -/** - * An interface to be implemented by any ObjectFactory implementation - * if it requires shutdown hook whenever an ObjectFactory is to be - * destroyed. - * - * @see org.apache.struts2.dispatcher.FilterDispatcher - * @see org.apache.struts2.dispatcher.Dispatcher - */ -public interface ObjectFactoryDestroyable { - void destroy(); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java b/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java deleted file mode 100644 index 7db4f8992..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java +++ /dev/null @@ -1,30 +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.util; - -import javax.servlet.ServletContext; - -/** - * Used to pass ServletContext init parameters to various - * frameworks such as Spring, Plexus and Portlet. - */ -public interface ObjectFactoryInitializable { - - void init(ServletContext servletContext); - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java b/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java deleted file mode 100644 index 84356f4d1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java +++ /dev/null @@ -1,30 +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.util; - -/** - * An interface indicating the lifecycle of an ObjectFactory implementation. - * - * @see ObjectFactoryLifecycle - * @see com.opensymphony.xwork2.ObjectFactory - * @see org.apache.struts2.util.ObjectFactoryInitializable - * @see org.apache.struts2.util.ObjectFactoryDestroyable - */ -public interface ObjectFactoryLifecycle extends ObjectFactoryInitializable, ObjectFactoryDestroyable { - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/PrefixTrie.java b/trunk/core/src/main/java/org/apache/struts2/util/PrefixTrie.java deleted file mode 100644 index 24288b13b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/PrefixTrie.java +++ /dev/null @@ -1,63 +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.util; - -/** - * Quickly matches a prefix to an object. - * - */ -public class PrefixTrie { - - // supports 7-bit chars. - private static final int SIZE = 128; - - Node root = new Node(); - - public void put(String prefix, Object value) { - Node current = root; - for (int i = 0; i < prefix.length(); i++) { - char c = prefix.charAt(i); - if (c > SIZE) - throw new IllegalArgumentException("'" + c + "' is too big."); - if (current.next[c] == null) - current.next[c] = new Node(); - current = current.next[c]; - } - current.value = value; - } - - public Object get(String key) { - Node current = root; - for (int i = 0; i < key.length(); i++) { - char c = key.charAt(i); - if (c > SIZE) - return null; - current = current.next[c]; - if (current == null) - return null; - if (current.value != null) - return current.value; - } - return null; - } - - static class Node { - Object value; - Node[] next = new Node[SIZE]; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java b/trunk/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java deleted file mode 100644 index 9f26f8651..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java +++ /dev/null @@ -1,87 +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.util; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.DispatcherListener; - -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.config.entities.PackageConfig; - - -/** - * A Servlet Context Listener that will loop through all Reference Resolvers available in - * the xwork Configuration and set the ServletContext on those that are ServletContextAware. - * The Servlet Context can be used by the External Reference Resolver to initialise it's state. i.e. the - * Spring framework uses a ContextServletListener to initialise it's IoC container, storing it's - * container context (ApplicationContext in Spring terms) in the Servlet context, the External - * Reference Resolver can get a reference to the container context from the servlet context. - */ -public class ResolverSetupServletContextListener implements ServletContextListener { - - Map listeners = new HashMap(); - - public synchronized void contextDestroyed(ServletContextEvent event) { - Listener l = listeners.get(event.getServletContext()); - Dispatcher.removeDispatcherListener(l); - listeners.remove(event.getServletContext()); - } - - public synchronized void contextInitialized(ServletContextEvent event) { - Listener l = new Listener(event.getServletContext()); - Dispatcher.addDispatcherListener(l); - listeners.put(event.getServletContext(), l); - } - - private class Listener implements DispatcherListener { - - private ServletContext servletContext; - - public Listener(ServletContext ctx) { - this.servletContext = ctx; - } - - public void dispatcherInitialized(Dispatcher du) { - Configuration config = du.getConfigurationManager().getConfiguration(); - String key; - PackageConfig packageConfig; - - for (Iterator iter = config.getPackageConfigNames().iterator(); - iter.hasNext();) { - key = (String) iter.next(); - packageConfig = config.getPackageConfig(key); - - if (packageConfig.getExternalRefResolver()instanceof ServletContextAware) { - ((ServletContextAware) packageConfig.getExternalRefResolver()).setServletContext(servletContext); - } - } - - } - - public void dispatcherDestroyed(Dispatcher du) { - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/ServletContextAware.java b/trunk/core/src/main/java/org/apache/struts2/util/ServletContextAware.java deleted file mode 100644 index 17a60d255..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/ServletContextAware.java +++ /dev/null @@ -1,29 +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.util; - -import javax.servlet.ServletContext; - - -/** - * For components that have a dependence on the Servlet context. - */ -public interface ServletContextAware { - - public void setServletContext(ServletContext context); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java b/trunk/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java deleted file mode 100644 index 9fdf2c5a7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java +++ /dev/null @@ -1,105 +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.util; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.Action; - - -/** - * A bean that takes a source and comparator then attempt to sort the source - * utilizing the comparator. It is being used in SortIteratorTag. - * - * @see org.apache.struts2.views.jsp.iterator.SortIteratorTag - */ -public class SortIteratorFilter extends IteratorFilterSupport implements Iterator, Action { - - Comparator comparator; - Iterator iterator; - List list; - - // Attributes ---------------------------------------------------- - Object source; - - - public void setComparator(Comparator aComparator) { - this.comparator = aComparator; - } - - public List getList() { - return list; - } - - // Public -------------------------------------------------------- - public void setSource(Object anIterator) { - source = anIterator; - } - - // Action implementation ----------------------------------------- - public String execute() { - if (source == null) { - return ERROR; - } else { - try { - if (!MakeIterator.isIterable(source)) { - LogFactory.getLog(SortIteratorFilter.class.getName()).warn("Cannot create SortIterator for source " + source); - - return ERROR; - } - - list = new ArrayList(); - - Iterator i = MakeIterator.convert(source); - - while (i.hasNext()) { - list.add(i.next()); - } - - // Sort it - Collections.sort(list, comparator); - iterator = list.iterator(); - - return SUCCESS; - } catch (Exception e) { - LogFactory.getLog(SortIteratorFilter.class.getName()).warn("Error creating sort iterator.", e); - - return ERROR; - } - } - } - - // Iterator implementation --------------------------------------- - public boolean hasNext() { - return (source == null) ? false : iterator.hasNext(); - } - - public Object next() { - return iterator.next(); - } - - public void remove() { - throw new UnsupportedOperationException("Remove is not supported in SortIteratorFilter."); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/Sorter.java b/trunk/core/src/main/java/org/apache/struts2/util/Sorter.java deleted file mode 100644 index c1e929e01..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/Sorter.java +++ /dev/null @@ -1,149 +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.util; - -import java.util.Comparator; - -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.ValueStackFactory; - - -/** - * Sorters. Utility sorters for use with the "sort" tag. - * - * @see org.apache.struts2.views.jsp.iterator.SortIteratorTag - * @see SortIteratorFilter - */ -public class Sorter { - - public Comparator getAscending() { - return new Comparator() { - public int compare(Object o1, Object o2) { - if (o1 instanceof Comparable) { - return ((Comparable) o1).compareTo(o2); - } else { - String s1 = o1.toString(); - String s2 = o2.toString(); - - return s1.compareTo(s2); - } - } - }; - } - - public Comparator getAscending(final String anExpression) { - return new Comparator() { - private ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - public int compare(Object o1, Object o2) { - // Get value for first object - stack.push(o1); - - Object v1 = stack.findValue(anExpression); - stack.pop(); - - // Get value for second object - stack.push(o2); - - Object v2 = stack.findValue(anExpression); - stack.pop(); - - // Ensure non-null - if (v1 == null) { - v1 = ""; - } - - if (v2 == null) { - v2 = ""; - } - - // Compare them - if (v1 instanceof Comparable && v1.getClass().equals(v2.getClass())) { - return ((Comparable) v1).compareTo(v2); - } else { - String s1 = v1.toString(); - String s2 = v2.toString(); - - return s1.compareTo(s2); - } - } - }; - } - - public Comparator getComparator(String anExpression, boolean ascending) { - if (ascending) { - return getAscending(anExpression); - } else { - return getDescending(anExpression); - } - } - - public Comparator getDescending() { - return new Comparator() { - public int compare(Object o1, Object o2) { - if (o2 instanceof Comparable) { - return ((Comparable) o2).compareTo(o1); - } else { - String s1 = o1.toString(); - String s2 = o2.toString(); - - return s2.compareTo(s1); - } - } - }; - } - - public Comparator getDescending(final String anExpression) { - return new Comparator() { - private ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - public int compare(Object o1, Object o2) { - // Get value for first object - stack.push(o1); - - Object v1 = stack.findValue(anExpression); - stack.pop(); - - // Get value for second object - stack.push(o2); - - Object v2 = stack.findValue(anExpression); - stack.pop(); - - // Ensure non-null - if (v1 == null) { - v1 = ""; - } - - if (v2 == null) { - v2 = ""; - } - - // Compare them - if (v2 instanceof Comparable && v1.getClass().equals(v2.getClass())) { - return ((Comparable) v2).compareTo(v1); - } else { - String s1 = v1.toString(); - String s2 = v2.toString(); - - return s2.compareTo(s1); - } - } - }; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java b/trunk/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java deleted file mode 100644 index e81c3b0d6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java +++ /dev/null @@ -1,89 +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.util; - -import java.util.Map; - -import ognl.DefaultTypeConverter; - -/** - * - * - * Base class for type converters used in Struts. This class provides two abstract methods that are used to convert - * both to and from strings -- the critical functionality that is core to Struts's type coversion system. - * - *

    Type converters do not have to use this class. It is merely a helper base class, although it is recommended that - * you use this class as it provides the common type conversion contract required for all web-based type conversion. - * - *

    There's a hook (fall back method) called performFallbackConversion of which - * could be used to perform some fallback conversion if convertValue method of this - * failed. By default it just ask its super class (Ognl's DefaultTypeConverter) to do the conversion. - * - *

    To allow the framework to recognize that a conversion error has occurred, throw an XWorkException or - * preferable a TypeConversionException. - * - * - * - */ -public abstract class StrutsTypeConverter extends DefaultTypeConverter { - public Object convertValue(Map context, Object o, Class toClass) { - if (toClass.equals(String.class)) { - return convertToString(context, o); - } else if (o instanceof String[]) { - return convertFromString(context, (String[]) o, toClass); - } else if (o instanceof String) { - return convertFromString(context, new String[]{(String) o}, toClass); - } else { - return performFallbackConversion(context, o, toClass); - } - } - - /** - * Hook to perform a fallback conversion if every default options failed. By default - * this will ask Ognl's DefaultTypeConverter (of which this class extends) to - * perform the conversion. - * - * @param context - * @param o - * @param toClass - * @return The fallback conversion - */ - protected Object performFallbackConversion(Map context, Object o, Class toClass) { - return super.convertValue(context, o, toClass); - } - - - /** - * Converts one or more String values to the specified class. - * - * @param context the action context - * @param values the String values to be converted, such as those submitted from an HTML form - * @param toClass the class to convert to - * @return the converted object - */ - public abstract Object convertFromString(Map context, String[] values, Class toClass); - - /** - * Converts the specified object to a String. - * - * @param context the action context - * @param o the object to be converted - * @return the converted String - */ - public abstract String convertToString(Map context, Object o); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java deleted file mode 100644 index 0440e3d78..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ /dev/null @@ -1,290 +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.util; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.views.jsp.ui.OgnlTool; -import org.apache.struts2.views.util.UrlHelper; - -import com.opensymphony.xwork2.util.TextUtils; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.ObjectFactory; - - -/** - * Struts base utility class, for use in Velocity and Freemarker templates - * - */ -public class StrutsUtil { - - protected static final Log log = LogFactory.getLog(StrutsUtil.class); - - - protected HttpServletRequest request; - protected HttpServletResponse response; - protected Map classes = new Hashtable(); - protected OgnlTool ognl = OgnlTool.getInstance(); - protected ValueStack stack; - - - public StrutsUtil(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - this.stack = stack; - this.request = request; - this.response = response; - } - - - public Object bean(Object aName) throws Exception { - String name = aName.toString(); - Class c = (Class) classes.get(name); - - if (c == null) { - c = ClassLoaderUtils.loadClass(name, StrutsUtil.class); - classes.put(name, c); - } - - return ObjectFactory.getObjectFactory().buildBean(c, stack.getContext()); - } - - public boolean isTrue(String expression) { - Boolean retVal = (Boolean) stack.findValue(expression, Boolean.class); - if (retVal == null) { - return false; - } - return retVal.booleanValue(); - } - - public Object findString(String name) { - return stack.findValue(name, String.class); - } - - public String include(Object aName) throws Exception { - return include(aName, request, response); - } - - /** - * @deprecated the request and response are stored in this util class, please use include(string) - */ - public String include(Object aName, HttpServletRequest aRequest, HttpServletResponse aResponse) throws Exception { - try { - RequestDispatcher dispatcher = aRequest.getRequestDispatcher(aName.toString()); - - if (dispatcher == null) { - throw new IllegalArgumentException("Cannot find included file " + aName); - } - - ResponseWrapper responseWrapper = new ResponseWrapper(aResponse); - - dispatcher.include(aRequest, responseWrapper); - - return responseWrapper.getData(); - } - catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - public String urlEncode(String s) { - try { - return URLEncoder.encode(s, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return s; - } - } - - public String buildUrl(String url) { - return UrlHelper.buildUrl(url, request, response, null); - } - - public Object findValue(String expression, String className) throws ClassNotFoundException { - return stack.findValue(expression, Class.forName(className)); - } - - public String getText(String text) { - return (String) stack.findValue("getText('" + text + "')"); - } - - /* - * @return the url ContextPath. An empty string if one does not exist. - */ - public String getContext() { - return (request == null)? "" : request.getContextPath(); - } - - /** - * the selectedList objects are matched to the list.listValue - *

    - * listKey and listValue are optional, and if not provided, the list item is used - * - * @param selectedList the name of the action property - * that contains the list of selected items - * or single item if its not an array or list - * @param list the name of the action property - * that contains the list of selectable items - * @param listKey an ognl expression that is exaluated relative to the list item - * to use as the key of the ListEntry - * @param listValue an ognl expression that is exaluated relative to the list item - * to use as the value of the ListEntry - * @return a List of ListEntry - */ - public List makeSelectList(String selectedList, String list, String listKey, String listValue) { - List selectList = new ArrayList(); - - Collection selectedItems = null; - - Object i = stack.findValue(selectedList); - - if (i != null) { - if (i.getClass().isArray()) { - selectedItems = Arrays.asList((Object[]) i); - } else if (i instanceof Collection) { - selectedItems = (Collection) i; - } else { - // treat it is a single item - selectedItems = new ArrayList(); - selectedItems.add(i); - } - } - - Collection items = (Collection) stack.findValue(list); - - if (items != null) { - for (Iterator iter = items.iterator(); iter.hasNext();) { - Object element = (Object) iter.next(); - Object key = null; - - if ((listKey == null) || (listKey.length() == 0)) { - key = element; - } else { - key = ognl.findValue(listKey, element); - } - - Object value = null; - - if ((listValue == null) || (listValue.length() == 0)) { - value = element; - } else { - value = ognl.findValue(listValue, element); - } - - boolean isSelected = false; - - if ((value != null) && (selectedItems != null) && selectedItems.contains(value)) { - isSelected = true; - } - - selectList.add(new ListEntry(key, value, isSelected)); - } - } - - return selectList; - } - - public String htmlEncode(Object obj) { - if (obj == null) { - return null; - } - - return TextUtils.htmlEncode(obj.toString()); - } - - public int toInt(long aLong) { - return (int) aLong; - } - - public long toLong(int anInt) { - return (long) anInt; - } - - public long toLong(String aLong) { - if (aLong == null) { - return 0; - } - - return Long.parseLong(aLong); - } - - public String toString(long aLong) { - return Long.toString(aLong); - } - - public String toString(int anInt) { - return Integer.toString(anInt); - } - - - static class ResponseWrapper extends HttpServletResponseWrapper { - StringWriter strout; - PrintWriter writer; - ServletOutputStream sout; - - ResponseWrapper(HttpServletResponse aResponse) { - super(aResponse); - strout = new StringWriter(); - sout = new ServletOutputStreamWrapper(strout); - writer = new PrintWriter(strout); - } - - public String getData() { - writer.flush(); - - return strout.toString(); - } - - public ServletOutputStream getOutputStream() { - return sout; - } - - public PrintWriter getWriter() throws IOException { - return writer; - } - } - - static class ServletOutputStreamWrapper extends ServletOutputStream { - StringWriter writer; - - ServletOutputStreamWrapper(StringWriter aWriter) { - writer = aWriter; - } - - public void write(int aByte) { - writer.write(aByte); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java b/trunk/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java deleted file mode 100644 index 5909dc168..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java +++ /dev/null @@ -1,173 +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.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.Action; - - -/** - * A bean that takes an iterator and outputs a subset of it. - * - */ -public class SubsetIteratorFilter extends IteratorFilterSupport implements Iterator, Action { - - private static final Log _log = LogFactory.getLog(SubsetIteratorFilter.class); - - Iterator iterator; - Object source; - int count = -1; - int currentCount = 0; - - Decider decider; - - // Attributes ---------------------------------------------------- - int start = 0; - - - public void setCount(int aCount) { - this.count = aCount; - } - - // Public -------------------------------------------------------- - public void setSource(Object anIterator) { - source = anIterator; - } - - public void setStart(int aStart) { - this.start = aStart; - } - - public void setDecider(Decider aDecider) { - this.decider = aDecider; - } - - // Action implementation ----------------------------------------- - public String execute() { - if (source == null) { - LogFactory.getLog(SubsetIteratorFilter.class.getName()).warn("Source is null returning empty set."); - - return ERROR; - } - - // Make source transformations - source = getIterator(source); - - // Calculate iterator filter - if (source instanceof Iterator) { - iterator = (Iterator) source; - - - // Read away items - for (int i = 0; (i < start) && iterator.hasNext(); i++) { - iterator.next(); - } - - - // now let Decider decide if element should be added (if a decider exist) - if (decider != null) { - List list = new ArrayList(); - while(iterator.hasNext()) { - Object currentElement = iterator.next(); - if (decide(currentElement)) { - list.add(currentElement); - } - } - iterator = list.iterator(); - } - - } else if (source.getClass().isArray()) { - ArrayList list = new ArrayList(((Object[]) source).length); - Object[] objects = (Object[]) source; - int len = objects.length; - - if (count >= 0) { - len = start + count; - if (len > objects.length) { - len = objects.length; - } - } - - for (int j = start; j < len; j++) { - if (decide(objects[j])) { - list.add(objects[j]); - } - } - - count = -1; // Don't have to check this in the iterator code - iterator = list.iterator(); - } - - if (iterator == null) { - throw new IllegalArgumentException("Source is not an iterator:" + source); - } - - return SUCCESS; - } - - // Iterator implementation --------------------------------------- - public boolean hasNext() { - return (iterator == null) ? false : (iterator.hasNext() && ((count < 0) || (currentCount < count))); - } - - public Object next() { - currentCount++; - - return iterator.next(); - } - - public void remove() { - iterator.remove(); - } - - // inner class --------------------------------------------------- - /** - * A decider determines if the given element should be added to the list or not. - */ - public static interface Decider { - - /** - * Should the object be added to the list? - * @param element the object - * @return true to add. - * @throws Exception can be thrown. - */ - boolean decide(Object element) throws Exception; - } - - // protected ----------------------------------------------------- - protected boolean decide(Object element) { - if (decider != null) { - try { - boolean okToAdd = decider.decide(element); - return okToAdd; - } - catch(Exception e) { - _log.warn("decider ["+decider+"] encountered an error while decide adding element ["+element+"], element will be ignored, it will not appeared in subseted iterator", e); - return false; - } - } - return true; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/TabbedPane.java b/trunk/core/src/main/java/org/apache/struts2/util/TabbedPane.java deleted file mode 100644 index 890bb73b1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/TabbedPane.java +++ /dev/null @@ -1,65 +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.util; - -import java.util.Vector; - - -/** - * A bean that helps implement a tabbed pane - * - */ -public class TabbedPane { - - protected String tabAlign = null; - - // Attributes ---------------------------------------------------- - protected Vector content = null; - protected int selectedIndex = 0; - - - // Public -------------------------------------------------------- - public TabbedPane(int defaultIndex) { - selectedIndex = defaultIndex; - } - - - public void setContent(Vector content) { - this.content = content; - } - - public Vector getContent() { - return content; - } - - public void setSelectedIndex(int selectedIndex) { - this.selectedIndex = selectedIndex; - } - - public int getSelectedIndex() { - return selectedIndex; - } - - public void setTabAlign(String tabAlign) { - this.tabAlign = tabAlign; - } - - public String getTabAlign() { - return tabAlign; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/Timer.java b/trunk/core/src/main/java/org/apache/struts2/util/Timer.java deleted file mode 100644 index c06ea1879..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/Timer.java +++ /dev/null @@ -1,48 +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.util; - - -/** - * A bean that can be used to time execution of pages - * - */ -public class Timer { - - // Attributes ---------------------------------------------------- - long current = System.currentTimeMillis(); - long start = current; - - - // Public -------------------------------------------------------- - public long getTime() { - // Return how long time has passed since last check point - long now = System.currentTimeMillis(); - long time = now - current; - - // Reset so that next time we get from this point - current = now; - - return time; - } - - public long getTotal() { - // Reset start so that next time we get from this point - return System.currentTimeMillis() - start; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/TokenHelper.java b/trunk/core/src/main/java/org/apache/struts2/util/TokenHelper.java deleted file mode 100644 index 8dce61b00..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/TokenHelper.java +++ /dev/null @@ -1,183 +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.util; - -import java.math.BigInteger; -import java.util.Map; -import java.util.Random; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.LocalizedTextUtil; - -/** - * TokenHelper - * - */ -public class TokenHelper { - - /** - * The default name to map the token value - */ - public static final String DEFAULT_TOKEN_NAME = "struts.token"; - - /** - * The name of the field which will hold the token name - */ - public static final String TOKEN_NAME_FIELD = "struts.token.name"; - private static final Log LOG = LogFactory.getLog(TokenHelper.class); - private static final Random RANDOM = new Random(); - - - /** - * Sets a transaction token into the session using the default token name. - * - * @return the token string - */ - public static String setToken() { - return setToken(DEFAULT_TOKEN_NAME); - } - - /** - * Sets a transaction token into the session using the provided token name. - * - * @param tokenName the name to store into the session with the token as the value - * @return the token string - */ - public static String setToken(String tokenName) { - Map session = ActionContext.getContext().getSession(); - String token = generateGUID(); - try { - session.put(tokenName, token); - } - catch(IllegalStateException e) { - // WW-1182 explain to user what the problem is - String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage(); - LOG.error(msg, e); - throw new IllegalArgumentException(msg); - } - - return token; - } - - - /** - * Gets a transaction token into the session using the default token name. - * - * @return token - */ - public static String getToken() { - return getToken(DEFAULT_TOKEN_NAME); - } - - /** - * Gets the Token value from the params in the ServletActionContext using the given name - * - * @param tokenName the name of the parameter which holds the token value - * @return the token String or null, if the token could not be found - */ - public static String getToken(String tokenName) { - Map params = ActionContext.getContext().getParameters(); - String[] tokens = (String[]) params.get(tokenName); - String token; - - if ((tokens == null) || (tokens.length < 1)) { - LOG.warn("Could not find token mapped to token name " + tokenName); - - return null; - } - - token = tokens[0]; - - return token; - } - - /** - * Gets the token name from the Parameters in the ServletActionContext - * - * @return the token name found in the params, or null if it could not be found - */ - public static String getTokenName() { - Map params = ActionContext.getContext().getParameters(); - - if (!params.containsKey(TOKEN_NAME_FIELD)) { - LOG.warn("Could not find token name in params."); - - return null; - } - - String[] tokenNames = (String[]) params.get(TOKEN_NAME_FIELD); - String tokenName; - - if ((tokenNames == null) || (tokenNames.length < 1)) { - LOG.warn("Got a null or empty token name."); - - return null; - } - - tokenName = tokenNames[0]; - - return tokenName; - } - - /** - * Checks for a valid transaction token in the current request params. If a valid token is found, it is - * removed so the it is not valid again. - * - * @return false if there was no token set into the params (check by looking for {@link #TOKEN_NAME_FIELD}), true if a valid token is found - */ - public static boolean validToken() { - String tokenName = getTokenName(); - - if (tokenName == null) { - if (LOG.isDebugEnabled()) - LOG.debug("no token name found -> Invalid token "); - return false; - } - - String token = getToken(tokenName); - - if (token == null) { - if (LOG.isDebugEnabled()) - LOG.debug("no token found for token name "+tokenName+" -> Invalid token "); - return false; - } - - Map session = ActionContext.getContext().getSession(); - String sessionToken = (String) session.get(tokenName); - - if (!token.equals(sessionToken)) { - LOG.warn(LocalizedTextUtil.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{ - token, sessionToken - })); - - return false; - } - - // remove the token so it won't be used again - session.remove(tokenName); - - return true; - } - - public static String generateGUID() { - return new BigInteger(165, RANDOM).toString(36).toUpperCase(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/URLBean.java b/trunk/core/src/main/java/org/apache/struts2/util/URLBean.java deleted file mode 100644 index db5cd3db4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/URLBean.java +++ /dev/null @@ -1,96 +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.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.views.util.UrlHelper; - - -/** - * A bean that can generate a URL. - * - */ -public class URLBean { - - HashMap params; - HttpServletRequest request; - HttpServletResponse response; - String page; - - - public void setPage(String page) { - this.page = page; - } - - public void setRequest(HttpServletRequest request) { - this.request = request; - } - - public void setResponse(HttpServletResponse response) { - this.response = response; - } - - public String getURL() { - // all this trickier with maps is to reduce the number of objects created - Map fullParams = null; - - if (params != null) { - fullParams = new HashMap(); - } - - if (page == null) { - // No particular page requested, so go to "same page" - // Add query params to parameters - if (fullParams != null) { - fullParams.putAll(request.getParameterMap()); - } else { - fullParams = request.getParameterMap(); - } - } - - // added parameters override, just like in URLTag - if (params != null) { - fullParams.putAll(params); - } - - return UrlHelper.buildUrl(page, request, response, fullParams); - } - - public URLBean addParameter(String name, Object value) { - if (params == null) { - params = new HashMap(); - } - - if (value == null) { - params.remove(name); - } else { - params.put(name, value.toString()); - } - - return this; - } - - public String toString() { - return getURL(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java b/trunk/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java deleted file mode 100644 index 0f4f8c56d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java +++ /dev/null @@ -1,55 +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.util; - -import java.io.CharArrayWriter; -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.views.velocity.VelocityManager; -import org.apache.velocity.context.Context; -import org.apache.velocity.exception.MethodInvocationException; -import org.apache.velocity.exception.ParseErrorException; -import org.apache.velocity.exception.ResourceNotFoundException; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * Struts velocity related util. - * - */ -public class VelocityStrutsUtil extends StrutsUtil { - - private Context ctx; - - public VelocityStrutsUtil(Context ctx, ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - this.ctx = ctx; - } - - public String evaluate(String expression) throws IOException, ResourceNotFoundException, MethodInvocationException, ParseErrorException { - CharArrayWriter writer = new CharArrayWriter(); - VelocityManager.getInstance().getVelocityEngine().evaluate(ctx, writer, "Error parsing " + expression, expression); - - return writer.toString(); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java b/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java deleted file mode 100644 index 9c27d8531..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java +++ /dev/null @@ -1,134 +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.validators; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.dispatcher.ApplicationMap; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.RequestMap; -import org.apache.struts2.dispatcher.SessionMap; - -import uk.ltd.getahead.dwr.WebContextFactory; - -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.DefaultActionInvocation; -import com.opensymphony.xwork2.DefaultActionProxy; -import com.opensymphony.xwork2.ValidationAware; -import com.opensymphony.xwork2.ValidationAwareSupport; -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.config.entities.ActionConfig; - -/** - *

    - * Use the dwr configuration as follows :- - * - *

    - * 
    - * 
    - * <dwr<
    - *    <allow<
    - *      <create creator="new" javascript="validator" class="org.apache.struts2.validators.DWRValidator"/<
    - *      <convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/<
    - *    </allow<
    - * </dwr<
    - * 
    - * 
    - * 
    - */ -public class DWRValidator { - private static final Log LOG = LogFactory.getLog(DWRValidator.class); - - public ValidationAwareSupport doPost(String namespace, String action, Map params) throws Exception { - HttpServletRequest req = WebContextFactory.get().getHttpServletRequest(); - ServletContext servletContext = WebContextFactory.get().getServletContext(); - HttpServletResponse res = WebContextFactory.get().getHttpServletResponse(); - - Map requestParams = new HashMap(req.getParameterMap()); - if (params != null) { - requestParams.putAll(params); - } else { - params = requestParams; - } - Map requestMap = new RequestMap(req); - Map session = new SessionMap(req); - Map application = new ApplicationMap(servletContext); - Dispatcher du = Dispatcher.getInstance(); - HashMap ctx = du.createContextMap(requestMap, - params, - session, - application, - req, - res, - servletContext); - - try { - Configuration cfg = du.getConfigurationManager().getConfiguration(); - ValidatorActionProxy proxy = new ValidatorActionProxy(cfg, namespace, action, ctx); - proxy.execute(); - Object a = proxy.getAction(); - - if (a instanceof ValidationAware) { - ValidationAware aware = (ValidationAware) a; - ValidationAwareSupport vas = new ValidationAwareSupport(); - vas.setActionErrors(aware.getActionErrors()); - vas.setActionMessages(aware.getActionMessages()); - vas.setFieldErrors(aware.getFieldErrors()); - - return vas; - } else { - return null; - } - } catch (Exception e) { - LOG.error("Error while trying to validate", e); - return null; - } - } - - public static class ValidatorActionInvocation extends DefaultActionInvocation { - private static final long serialVersionUID = -7645433725470191275L; - - protected ValidatorActionInvocation(ActionProxy proxy, Map extraContext) throws Exception { - super(proxy, extraContext, true); - } - - protected String invokeAction(Object action, ActionConfig actionConfig) throws Exception { - return Action.NONE; // don't actually execute the action - } - } - - public static class ValidatorActionProxy extends DefaultActionProxy { - private static final long serialVersionUID = 5754781916414047963L; - - protected ValidatorActionProxy(Configuration config, String namespace, String actionName, Map extraContext) throws Exception { - super(config, namespace, actionName, extraContext, false, true); - } - - protected void prepare() throws Exception { - invocation = new ValidatorActionInvocation(this, extraContext); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java b/trunk/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java deleted file mode 100644 index 8fde4da96..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java +++ /dev/null @@ -1,37 +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.views; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; - -/** - */ -public class JspSupportServlet extends HttpServlet { - - private static final long serialVersionUID = 8302309812391541933L; - - public static JspSupportServlet jspSupportServlet; - - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - - jspSupportServlet = this; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java deleted file mode 100644 index 0a3c8d88a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java +++ /dev/null @@ -1,342 +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.views.freemarker; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.Properties; - -import javax.servlet.GenericServlet; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.views.JspSupportServlet; -import org.apache.struts2.views.freemarker.tags.StrutsModels; -import org.apache.struts2.views.util.ContextUtil; - -import com.opensymphony.xwork2.util.FileManager; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.ObjectFactory; - -import freemarker.cache.FileTemplateLoader; -import freemarker.cache.MultiTemplateLoader; -import freemarker.cache.TemplateLoader; -import freemarker.cache.WebappTemplateLoader; -import freemarker.ext.beans.BeansWrapper; -import freemarker.ext.jsp.TaglibFactory; -import freemarker.ext.servlet.HttpRequestHashModel; -import freemarker.ext.servlet.HttpRequestParametersHashModel; -import freemarker.ext.servlet.HttpSessionHashModel; -import freemarker.ext.servlet.ServletContextHashModel; -import freemarker.template.ObjectWrapper; -import freemarker.template.SimpleHash; -import freemarker.template.TemplateException; -import freemarker.template.TemplateExceptionHandler; -import freemarker.template.TemplateModel; - - -/** - * Static Configuration Manager for the FreemarkerResult's configuration - * - *

    - * - * Possible extension points are :- - *

      - *
    • createConfiguration method
    • - *
    • loadSettings method
    • - *
    • getTemplateLoader method
    • - *
    • populateContext method
    • - *
    - * - *

    - * createConfiguration method
    - * Create a freemarker Configuration. - *

    - * - * loadSettings method
    - * Load freemarker settings, default to freemarker.properties (if found in classpath) - *

    - * - * getTemplateLoader method
    - * create a freemarker TemplateLoader that loads freemarker template in the following order :- - *

      - *
    1. path defined in ServletContext init parameter named 'templatePath' or 'TemplatePath' (must be an absolute path)
    2. - *
    3. webapp classpath
    4. - *
    5. struts's static folder (under [STRUT2_SOURCE]/org/apache/struts2/static/
    6. - *
    - *

    - * - * populateContext method
    - * populate the created model. - * - */ -public class FreemarkerManager { - - private static final Log log = LogFactory.getLog(FreemarkerManager.class); - public static final String CONFIG_SERVLET_CONTEXT_KEY = "freemarker.Configuration"; - public static final String KEY_EXCEPTION = "exception"; - - // coppied from freemarker servlet - since they are private - private static final String ATTR_APPLICATION_MODEL = ".freemarker.Application"; - private static final String ATTR_JSP_TAGLIBS_MODEL = ".freemarker.JspTaglibs"; - private static final String ATTR_REQUEST_MODEL = ".freemarker.Request"; - private static final String ATTR_REQUEST_PARAMETERS_MODEL = ".freemarker.RequestParameters"; - - // coppied from freemarker servlet - so that there is no dependency on it - public static final String KEY_APPLICATION = "Application"; - public static final String KEY_REQUEST_MODEL = "Request"; - public static final String KEY_SESSION_MODEL = "Session"; - public static final String KEY_JSP_TAGLIBS = "JspTaglibs"; - public static final String KEY_REQUEST_PARAMETER_MODEL = "Parameters"; - private static FreemarkerManager instance = null; - - - /** - * To allow for custom configuration of freemarker, sublcass this class "ConfigManager" and - * set the Struts configuration property - * struts.freemarker.configmanager.classname to the fully qualified classname. - *

    - * This allows you to override the protected methods in the ConfigMangaer - * to programatically create your own Configuration instance - */ - public final static synchronized FreemarkerManager getInstance() { - if (instance == null) { - String classname = FreemarkerManager.class.getName(); - - if (Settings.isSet(StrutsConstants.STRUTS_FREEMARKER_MANAGER_CLASSNAME)) { - classname = Settings.get(StrutsConstants.STRUTS_FREEMARKER_MANAGER_CLASSNAME).trim(); - } - - try { - log.info("Instantiating Freemarker ConfigManager!, " + classname); - // singleton instances shouldn't be built accessing request or session-specific context data - instance = (FreemarkerManager) ObjectFactory.getObjectFactory().buildBean(classname, null); - } catch (Exception e) { - log.fatal("Fatal exception occurred while trying to instantiate a Freemarker ConfigManager instance, " + classname, e); - } - } - - // if the instance creation failed, make sure there is a default instance - if (instance == null) { - instance = new FreemarkerManager(); - } - - return instance; - } - - public final synchronized freemarker.template.Configuration getConfiguration(ServletContext servletContext) throws TemplateException { - freemarker.template.Configuration config = (freemarker.template.Configuration) servletContext.getAttribute(CONFIG_SERVLET_CONTEXT_KEY); - - if (config == null) { - config = createConfiguration(servletContext); - - // store this configuration in the servlet context - servletContext.setAttribute(CONFIG_SERVLET_CONTEXT_KEY, config); - } - - config.setWhitespaceStripping(true); - - return config; - } - - protected ScopesHashModel buildScopesHashModel(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, ObjectWrapper wrapper, ValueStack stack) { - ScopesHashModel model = new ScopesHashModel(wrapper, servletContext, request, stack); - - // Create hash model wrapper for servlet context (the application) - // only need one thread to do this once, per servlet context - synchronized (servletContext) { - ServletContextHashModel servletContextModel = (ServletContextHashModel) servletContext.getAttribute(ATTR_APPLICATION_MODEL); - - if (servletContextModel == null) { - - GenericServlet servlet = JspSupportServlet.jspSupportServlet; - // TODO if the jsp support servlet isn't load-on-startup then it won't exist - // if it hasn't been accessed, and a JSP page is accessed - if (servlet != null) { - servletContextModel = new ServletContextHashModel(servlet, wrapper); - servletContext.setAttribute(ATTR_APPLICATION_MODEL, servletContextModel); - TaglibFactory taglibs = new TaglibFactory(servletContext); - servletContext.setAttribute(ATTR_JSP_TAGLIBS_MODEL, taglibs); - } - - } - - model.put(KEY_APPLICATION, servletContextModel); - model.put(KEY_JSP_TAGLIBS, (TemplateModel) servletContext.getAttribute(ATTR_JSP_TAGLIBS_MODEL)); - } - - // Create hash model wrapper for session - HttpSession session = request.getSession(false); - if (session != null) { - model.put(KEY_SESSION_MODEL, new HttpSessionHashModel(session, wrapper)); - } else { - // no session means no attributes ??? - // model.put(KEY_SESSION_MODEL, new SimpleHash()); - } - - // Create hash model wrapper for the request attributes - HttpRequestHashModel requestModel = (HttpRequestHashModel) request.getAttribute(ATTR_REQUEST_MODEL); - - if ((requestModel == null) || (requestModel.getRequest() != request)) { - requestModel = new HttpRequestHashModel(request, response, wrapper); - request.setAttribute(ATTR_REQUEST_MODEL, requestModel); - } - - model.put(KEY_REQUEST_MODEL, requestModel); - - - // Create hash model wrapper for request parameters - HttpRequestParametersHashModel reqParametersModel = (HttpRequestParametersHashModel) request.getAttribute(ATTR_REQUEST_PARAMETERS_MODEL); - if (reqParametersModel == null || requestModel.getRequest() != request) { - reqParametersModel = new HttpRequestParametersHashModel(request); - request.setAttribute(ATTR_REQUEST_PARAMETERS_MODEL, reqParametersModel); - } - model.put(KEY_REQUEST_PARAMETER_MODEL, reqParametersModel); - - return model; - } - - protected void populateContext(ScopesHashModel model, ValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) { - // put the same objects into the context that the velocity result uses - Map standard = ContextUtil.getStandardContext(stack, request, response); - model.putAll(standard); - - // support for JSP exception pages, exposing the servlet or JSP exception - Throwable exception = (Throwable) request.getAttribute("javax.servlet.error.exception"); - - if (exception == null) { - exception = (Throwable) request.getAttribute("javax.servlet.error.JspException"); - } - - if (exception != null) { - model.put(KEY_EXCEPTION, exception); - } - } - - protected BeansWrapper getObjectWrapper() { - return new StrutsBeanWrapper(); - } - - /** - * The default template loader is a MultiTemplateLoader which includes - * a ClassTemplateLoader and a WebappTemplateLoader (and a FileTemplateLoader depending on - * the init-parameter 'TemplatePath'). - *

    - * The ClassTemplateLoader will resolve fully qualified template includes - * that begin with a slash. for example /com/company/template/common.ftl - *

    - * The WebappTemplateLoader attempts to resolve templates relative to the web root folder - */ - protected TemplateLoader getTemplateLoader(ServletContext servletContext) { - // construct a FileTemplateLoader for the init-param 'TemplatePath' - FileTemplateLoader templatePathLoader = null; - - String templatePath = servletContext.getInitParameter("TemplatePath"); - if (templatePath == null) { - templatePath = servletContext.getInitParameter("templatePath"); - } - - if (templatePath != null) { - try { - templatePathLoader = new FileTemplateLoader(new File(templatePath)); - } catch (IOException e) { - log.error("Invalid template path specified: " + e.getMessage(), e); - } - } - - // presume that most apps will require the class and webapp template loader - // if people wish to - return templatePathLoader != null ? - new MultiTemplateLoader(new TemplateLoader[]{ - templatePathLoader, - new WebappTemplateLoader(servletContext), - new StrutsClassTemplateLoader() - }) - : new MultiTemplateLoader(new TemplateLoader[]{ - new WebappTemplateLoader(servletContext), - new StrutsClassTemplateLoader() - }); - } - - /** - * Create the instance of the freemarker Configuration object. - *

    - * this implementation - *

      - *
    • obtains the default configuration from Configuration.getDefaultConfiguration() - *
    • sets up template loading from a ClassTemplateLoader and a WebappTemplateLoader - *
    • sets up the object wrapper to be the BeansWrapper - *
    • loads settings from the classpath file /freemarker.properties - *
    - * - * @param servletContext - */ - protected freemarker.template.Configuration createConfiguration(ServletContext servletContext) throws TemplateException { - freemarker.template.Configuration configuration = new freemarker.template.Configuration(); - - configuration.setTemplateLoader(getTemplateLoader(servletContext)); - - configuration.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER); - - configuration.setObjectWrapper(getObjectWrapper()); - - if (Settings.isSet(StrutsConstants.STRUTS_I18N_ENCODING)) { - configuration.setDefaultEncoding(Settings.get(StrutsConstants.STRUTS_I18N_ENCODING)); - } - - loadSettings(servletContext, configuration); - - return configuration; - } - - /** - * Load the settings from the /freemarker.properties file on the classpath - * - * @see freemarker.template.Configuration#setSettings for the definition of valid settings - */ - protected void loadSettings(ServletContext servletContext, freemarker.template.Configuration configuration) { - try { - InputStream in = FileManager.loadFile("freemarker.properties", FreemarkerManager.class); - - if (in != null) { - Properties p = new Properties(); - p.load(in); - configuration.setSettings(p); - } - } catch (IOException e) { - log.error("Error while loading freemarker settings from /freemarker.properties", e); - } catch (TemplateException e) { - log.error("Error while loading freemarker settings from /freemarker.properties", e); - } - } - - public SimpleHash buildTemplateModel(ValueStack stack, Object action, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, ObjectWrapper wrapper) { - ScopesHashModel model = buildScopesHashModel(servletContext, request, response, wrapper, stack); - populateContext(model, stack, action, request, response); - model.put("s", new StrutsModels(stack, request, response)); - return model; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java deleted file mode 100644 index ac6105df0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java +++ /dev/null @@ -1,280 +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.views.freemarker; - -import java.io.IOException; -import java.io.Writer; -import java.util.Locale; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.StrutsResultSupport; -import org.apache.struts2.views.util.ResourceUtil; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.LocaleProvider; -import com.opensymphony.xwork2.util.ValueStack; - -import freemarker.template.Configuration; -import freemarker.template.ObjectWrapper; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; - - -/** - * - * - * Renders a view using the Freemarker template engine. - *

    - * The FreemarkarManager class configures the template loaders so that the - * template location can be either - *

    - * - *
      - * - *
    • relative to the web root folder. eg /WEB-INF/views/home.ftl - *
    • - * - *
    • a classpath resuorce. eg com/company/web/views/home.ftl
    • - * - *
    - * - * - * - * This result type takes the following parameters: - * - * - * - *
      - * - *
    • location (default) - the location of the template to process.
    • - * - *
    • parse - true by default. If set to false, the location param will - * not be parsed for Ognl expressions.
    • - * - *
    • contentType - defaults to "text/html" unless specified.
    • - * - *
    - * - * - * - * Example: - * - *
    - * 
    - * 
    - * <result name="success" type="freemarker">foo.ftl</result>
    - * 
    - * 
    - * 
    - */ -public class FreemarkerResult extends StrutsResultSupport { - - private static final long serialVersionUID = -3778230771704661631L; - - protected ActionInvocation invocation; - protected Configuration configuration; - protected ObjectWrapper wrapper; - - /* - * Struts results are constructed for each result execution - * - * the current context is availible to subclasses via these protected fields - */ - protected String location; - private String pContentType = "text/html"; - - public FreemarkerResult() { - super(); - } - - public FreemarkerResult(String location) { - super(location); - } - - public void setContentType(String aContentType) { - pContentType = aContentType; - } - - /** - * allow parameterization of the contentType - * the default being text/html - */ - public String getContentType() { - return pContentType; - } - - /** - * Execute this result, using the specified template location. - *

    - * The template location has already been interoplated for any variable substitutions - *

    - * this method obtains the freemarker configuration and the object wrapper from the provided hooks. - * It them implements the template processing workflow by calling the hooks for - * preTemplateProcess and postTemplateProcess - */ - public void doExecute(String location, ActionInvocation invocation) throws IOException, TemplateException { - this.location = location; - this.invocation = invocation; - this.configuration = getConfiguration(); - this.wrapper = getObjectWrapper(); - - if (!location.startsWith("/")) { - ActionContext ctx = invocation.getInvocationContext(); - HttpServletRequest req = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST); - String base = ResourceUtil.getResourceBase(req); - location = base + "/" + location; - } - - Template template = configuration.getTemplate(location, deduceLocale()); - TemplateModel model = createModel(); - - // Give subclasses a chance to hook into preprocessing - if (preTemplateProcess(template, model)) { - try { - // Process the template - template.process(model, getWriter()); - } finally { - // Give subclasses a chance to hook into postprocessing - postTemplateProcess(template, model); - } - } - } - - /** - * This method is called from {@link #doExecute(String, ActionInvocation)} to obtain the - * FreeMarker configuration object that this result will use for template loading. This is a - * hook that allows you to custom-configure the configuration object in a subclass, or to fetch - * it from an IoC container. - *

    - * - * The default implementation obtains the configuration from the ConfigurationManager instance. - * - */ - protected Configuration getConfiguration() throws TemplateException { - return FreemarkerManager.getInstance().getConfiguration(ServletActionContext.getServletContext()); - } - - /** - * This method is called from {@link #doExecute(String, ActionInvocation)} to obtain the - * FreeMarker object wrapper object that this result will use for adapting objects into template - * models. This is a hook that allows you to custom-configure the wrapper object in a subclass. - *

    - * - * The default implementation returns {@link Configuration#getObjectWrapper()} - * - */ - protected ObjectWrapper getObjectWrapper() { - return configuration.getObjectWrapper(); - } - - /** - * The default writer writes directly to the response writer. - */ - protected Writer getWriter() throws IOException { - return ServletActionContext.getResponse().getWriter(); - } - - /** - * Build the instance of the ScopesHashModel, including JspTagLib support - *

    - * Objects added to the model are - *

    - *

      - *
    • Application - servlet context attributes hash model - *
    • JspTaglibs - jsp tag lib factory model - *
    • Request - request attributes hash model - *
    • Session - session attributes hash model - *
    • request - the HttpServletRequst object for direct access - *
    • response - the HttpServletResponse object for direct access - *
    • stack - the OgnLValueStack instance for direct access - *
    • ognl - the instance of the OgnlTool - *
    • action - the action itself - *
    • exception - optional : the JSP or Servlet exception as per the servlet spec (for JSP Exception pages) - *
    • struts - instance of the StrutsUtil class - *
    - */ - protected TemplateModel createModel() throws TemplateModelException { - ServletContext servletContext = ServletActionContext.getServletContext(); - HttpServletRequest request = ServletActionContext.getRequest(); - HttpServletResponse response = ServletActionContext.getResponse(); - ValueStack stack = ServletActionContext.getContext().getValueStack(); - - Object action = null; - if(invocation!= null ) action = invocation.getAction(); //Added for NullPointException - return FreemarkerManager.getInstance().buildTemplateModel(stack, action, servletContext, request, response, wrapper); - } - - /** - * Returns the locale used for the {@link Configuration#getTemplate(String, Locale)} call. The base implementation - * simply returns the locale setting of the action (assuming the action implements {@link LocaleProvider}) or, if - * the action does not the configuration's locale is returned. Override this method to provide different behaviour, - */ - protected Locale deduceLocale() { - if (invocation.getAction() instanceof LocaleProvider) { - return ((LocaleProvider) invocation.getAction()).getLocale(); - } else { - return configuration.getLocale(); - } - } - - /** - * the default implementation of postTemplateProcess applies the contentType parameter - */ - protected void postTemplateProcess(Template template, TemplateModel data) throws IOException { - } - - /** - * Called before the execution is passed to template.process(). - * This is a generic hook you might use in subclasses to perform a specific - * action before the template is processed. By default does nothing. - * A typical action to perform here is to inject application-specific - * objects into the model root - * - * @return true to process the template, false to suppress template processing. - */ - protected boolean preTemplateProcess(Template template, TemplateModel model) throws IOException { - Object attrContentType = template.getCustomAttribute("content_type"); - - if (attrContentType != null) { - ServletActionContext.getResponse().setContentType(attrContentType.toString()); - } else { - String contentType = getContentType(); - - if (contentType == null) { - contentType = "text/html"; - } - - String encoding = template.getEncoding(); - - if (encoding != null) { - contentType = contentType + "; charset=" + encoding; - } - - ServletActionContext.getResponse().setContentType(contentType); - } - - return true; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java deleted file mode 100644 index b5d3c5aa9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java +++ /dev/null @@ -1,283 +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.views.freemarker; - -import java.io.IOException; -import java.io.Writer; -import java.util.Locale; - -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.StrutsResultSupport; -import org.apache.struts2.portlet.PortletActionConstants; -import org.apache.struts2.portlet.context.PortletActionContext; -import org.apache.struts2.views.util.ResourceUtil; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - -import freemarker.template.Configuration; -import freemarker.template.ObjectWrapper; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; - -/** - */ -public class PortletFreemarkerResult extends StrutsResultSupport { - - private static final long serialVersionUID = -5570612389289887543L; - - protected ActionInvocation invocation; - - protected Configuration configuration; - - protected ObjectWrapper wrapper; - - /* - * Struts results are constructed for each result execeution - * - * the current context is availible to subclasses via these protected fields - */ - protected String location; - - private String pContentType = "text/html"; - - public PortletFreemarkerResult() { - super(); - } - - public PortletFreemarkerResult(String location) { - super(location); - } - - public void setContentType(String aContentType) { - pContentType = aContentType; - } - - /** - * allow parameterization of the contentType the default being text/html - */ - public String getContentType() { - return pContentType; - } - - /** - * Execute this result, using the specified template location.

    The - * template location has already been interoplated for any variable - * substitutions

    this method obtains the freemarker configuration and - * the object wrapper from the provided hooks. It them implements the - * template processing workflow by calling the hooks for preTemplateProcess - * and postTemplateProcess - */ - public void doExecute(String location, ActionInvocation invocation) - throws IOException, TemplateException, PortletException { - if (PortletActionContext.isEvent()) { - executeActionResult(location, invocation); - } else if (PortletActionContext.isRender()) { - executeRenderResult(location, invocation); - } - } - - /** - * @param location - * @param invocation - */ - private void executeActionResult(String location, - ActionInvocation invocation) { - ActionResponse res = PortletActionContext.getActionResponse(); - // View is rendered outside an action...uh oh... - res.setRenderParameter(PortletActionConstants.ACTION_PARAM, "freemarkerDirect"); - res.setRenderParameter("location", location); - res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext - .getRequest().getPortletMode().toString()); - - } - - /** - * @param location - * @param invocation - * @throws TemplateException - * @throws IOException - * @throws TemplateModelException - */ - private void executeRenderResult(String location, - ActionInvocation invocation) throws TemplateException, IOException, - TemplateModelException, PortletException { - prepareServletActionContext(); - this.location = location; - this.invocation = invocation; - this.configuration = getConfiguration(); - this.wrapper = getObjectWrapper(); - - HttpServletRequest req = ServletActionContext.getRequest(); - - if (!location.startsWith("/")) { - String base = ResourceUtil.getResourceBase(req); - location = base + "/" + location; - } - - Template template = configuration.getTemplate(location, deduceLocale()); - TemplateModel model = createModel(); - // Give subclasses a chance to hook into preprocessing - if (preTemplateProcess(template, model)) { - try { - // Process the template - PortletActionContext.getRenderResponse().setContentType(pContentType); - template.process(model, getWriter()); - } finally { - // Give subclasses a chance to hook into postprocessing - postTemplateProcess(template, model); - } - } - } - - /** - * - */ - private void prepareServletActionContext() throws PortletException, - IOException { - PortletRequestDispatcher disp = PortletActionContext.getPortletConfig() - .getPortletContext().getNamedDispatcher("preparator"); - disp.include(PortletActionContext.getRenderRequest(), - PortletActionContext.getRenderResponse()); - } - - /** - * This method is called from {@link #doExecute(String, ActionInvocation)} - * to obtain the FreeMarker configuration object that this result will use - * for template loading. This is a hook that allows you to custom-configure - * the configuration object in a subclass, or to fetch it from an IoC - * container.

    The default implementation obtains the configuration - * from the ConfigurationManager instance. - */ - protected Configuration getConfiguration() throws TemplateException { - return FreemarkerManager.getInstance().getConfiguration( - ServletActionContext.getServletContext()); - } - - /** - * This method is called from {@link #doExecute(String, ActionInvocation)} - * to obtain the FreeMarker object wrapper object that this result will use - * for adapting objects into template models. This is a hook that allows you - * to custom-configure the wrapper object in a subclass.

    The default - * implementation returns {@link Configuration#getObjectWrapper()} - */ - protected ObjectWrapper getObjectWrapper() { - return configuration.getObjectWrapper(); - } - - /** - * The default writer writes directly to the response writer. - */ - protected Writer getWriter() throws IOException { - return PortletActionContext.getRenderResponse().getWriter(); - } - - /** - * Build the instance of the ScopesHashModel, including JspTagLib support - *

    Objects added to the model are

    - *

      - *
    • Application - servlet context attributes hash model - *
    • JspTaglibs - jsp tag lib factory model - *
    • Request - request attributes hash model - *
    • Session - session attributes hash model - *
    • request - the HttpServletRequst object for direct access - *
    • response - the HttpServletResponse object for direct access - *
    • stack - the OgnLValueStack instance for direct access - *
    • ognl - the instance of the OgnlTool - *
    • action - the action itself - *
    • exception - optional : the JSP or Servlet exception as per the - * servlet spec (for JSP Exception pages) - *
    • struts - instance of the StrutsUtil class - *
    - */ - protected TemplateModel createModel() throws TemplateModelException { - ServletContext servletContext = ServletActionContext - .getServletContext(); - HttpServletRequest request = ServletActionContext.getRequest(); - HttpServletResponse response = ServletActionContext.getResponse(); - ValueStack stack = ServletActionContext.getContext() - .getValueStack(); - return FreemarkerManager.getInstance().buildTemplateModel(stack, - invocation.getAction(), servletContext, request, response, - wrapper); - } - - /** - * Returns the locale used for the - * {@link Configuration#getTemplate(String, Locale)}call. The base - * implementation simply returns the locale setting of the configuration. - * Override this method to provide different behaviour, - */ - protected Locale deduceLocale() { - return configuration.getLocale(); - } - - /** - * the default implementation of postTemplateProcess applies the contentType - * parameter - */ - protected void postTemplateProcess(Template template, TemplateModel data) - throws IOException { - } - - /** - * Called before the execution is passed to template.process(). This is a - * generic hook you might use in subclasses to perform a specific action - * before the template is processed. By default does nothing. A typical - * action to perform here is to inject application-specific objects into the - * model root - * - * @return true to process the template, false to suppress template - * processing. - */ - protected boolean preTemplateProcess(Template template, TemplateModel model) - throws IOException { - Object attrContentType = template.getCustomAttribute("content_type"); - - if (attrContentType != null) { - ServletActionContext.getResponse().setContentType( - attrContentType.toString()); - } else { - String contentType = getContentType(); - - if (contentType == null) { - contentType = "text/html"; - } - - String encoding = template.getEncoding(); - - if (encoding != null) { - contentType = contentType + "; charset=" + encoding; - } - - ServletActionContext.getResponse().setContentType(contentType); - } - - return true; - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java deleted file mode 100644 index b8387d55c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java +++ /dev/null @@ -1,118 +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.views.freemarker; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import com.opensymphony.xwork2.util.ValueStack; - -import freemarker.template.ObjectWrapper; -import freemarker.template.SimpleHash; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; - - -/** - * Simple Hash model that also searches other scopes. - *

    - * If the key doesn't exist in this hash, this template model tries to - * resolve the key within the attributes of the following scopes, - * in the order stated: Request, Session, Servlet Context - */ -public class ScopesHashModel extends SimpleHash { - - private static final long serialVersionUID = 5551686380141886764L; - - private HttpServletRequest request; - private ServletContext servletContext; - private ValueStack stack; - - - public ScopesHashModel(ObjectWrapper objectWrapper, ServletContext context, HttpServletRequest request, ValueStack stack) { - super(objectWrapper); - this.servletContext = context; - this.request = request; - this.stack = stack; - } - - - public TemplateModel get(String key) throws TemplateModelException { - // Lookup in default scope - TemplateModel model = super.get(key); - - if (model != null) { - return model; - } - - - if (stack != null) { - Object obj = stack.findValue(key); - - if (obj != null) { - return wrap(obj); - } - - // ok, then try the context - obj = stack.getContext().get(key); - if (obj != null) { - return wrap(obj); - } - } - - if (request != null) { - // Lookup in request scope - Object obj = request.getAttribute(key); - - if (obj != null) { - return wrap(obj); - } - - // Lookup in session scope - HttpSession session = request.getSession(false); - - if (session != null) { - obj = session.getAttribute(key); - - if (obj != null) { - return wrap(obj); - } - } - } - - if (servletContext != null) { - // Lookup in application scope - Object obj = servletContext.getAttribute(key); - - if (obj != null) { - return wrap(obj); - } - } - - return null; - } - - public void put(String string, boolean b) { - super.put(string, b); - } - - public void put(String string, Object object) { - super.put(string, object); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java deleted file mode 100644 index 1cf4284a4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java +++ /dev/null @@ -1,95 +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.views.freemarker; - -import java.util.Map; -import java.util.Set; - -import freemarker.core.CollectionAndSequence; -import freemarker.ext.beans.BeansWrapper; -import freemarker.ext.beans.MapModel; -import freemarker.ext.util.ModelFactory; -import freemarker.template.ObjectWrapper; -import freemarker.template.SimpleSequence; -import freemarker.template.TemplateBooleanModel; -import freemarker.template.TemplateCollectionModel; -import freemarker.template.TemplateHashModelEx; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; - -/** - * - * - * The StrutsBeanWrapper extends the default FreeMarker BeansWrapper and provides almost no change in functionality, - * except for how it handles maps. Normally, FreeMarker has two modes of operation: either support for friendly - * map built-ins (?keys, ?values, etc) but only support for String keys; OR no special built-in support (ie: ?keys - * returns the methods on the map instead of the keys) but support for String and non-String keys alike. Struts - * provides an alternative implementation that gives us the best of both worlds. - * - *

    It is possible that this special behavior may be confusing or can cause problems. Therefore, you can set the - * struts.freemarker.wrapper.altMap property in struts.properties to false, allowing the normal BeansWrapper - * logic to take place instead. - * - * - */ -public class StrutsBeanWrapper extends BeansWrapper { - private static final boolean altMapWrapper - = "true".equals(org.apache.struts2.config.Settings.get("struts.freemarker.wrapper.altMap")); - - public TemplateModel wrap(Object object) throws TemplateModelException { - if (object instanceof TemplateBooleanModel) { - return super.wrap(object); - } - - // attempt to get the best of both the SimpleMapModel and the MapModel of FM. - if (altMapWrapper && object instanceof Map) { - return getInstance(object, FriendlyMapModel.FACTORY); - } - - return super.wrap(object); - } - - /** - * Attempting to get the best of both worlds of FM's MapModel and SimpleMapModel, by reimplementing the isEmpty(), - * keySet() and values() methods. ?keys and ?values built-ins are thus available, just as well as plain Map - * methods. - */ - private final static class FriendlyMapModel extends MapModel implements TemplateHashModelEx { - static final ModelFactory FACTORY = new ModelFactory() { - public TemplateModel create(Object object, ObjectWrapper wrapper) { - return new FriendlyMapModel((Map) object, (BeansWrapper) wrapper); - } - }; - - public FriendlyMapModel(Map map, BeansWrapper wrapper) { - super(map, wrapper); - } - - public boolean isEmpty() { - return ((Map) object).isEmpty(); - } - - protected Set keySet() { - return ((Map) object).keySet(); - } - - public TemplateCollectionModel values() { - return new CollectionAndSequence(new SimpleSequence(((Map) object).values(), wrapper)); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java deleted file mode 100644 index cda5b46e9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java +++ /dev/null @@ -1,32 +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.views.freemarker; - -import java.net.URL; - -import com.opensymphony.xwork2.util.ClassLoaderUtil; - -import freemarker.cache.URLTemplateLoader; - -/** - */ -public class StrutsClassTemplateLoader extends URLTemplateLoader { - protected URL getURL(String name) { - return ClassLoaderUtil.getResource(name, getClass()); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java deleted file mode 100644 index 9e66613b4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionError; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionError - */ -public class ActionErrorModel extends TagModel { - public ActionErrorModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new ActionError(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java deleted file mode 100644 index a3c7508c6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionMessage; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionMessage - */ -public class ActionMessageModel extends TagModel { - public ActionMessageModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new ActionMessage(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java deleted file mode 100644 index b057657f5..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionComponent; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionComponent - */ -public class ActionModel extends TagModel { - public ActionModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new ActionComponent(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java deleted file mode 100644 index bb529ad80..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Anchor; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Anchor - */ -public class AnchorModel extends TagModel { - public AnchorModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Anchor(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java deleted file mode 100644 index d3e7a2678..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Bean; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Bean - */ -public class BeanModel extends TagModel { - public BeanModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Bean(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java deleted file mode 100644 index cedd7b6b0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java +++ /dev/null @@ -1,96 +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.views.freemarker.tags; - -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; - -import org.apache.struts2.components.Component; - -import freemarker.template.TemplateModelException; -import freemarker.template.TransformControl; - -/** - */ -public class CallbackWriter extends Writer implements TransformControl { - private Component bean; - private Writer writer; - private StringWriter body; - private boolean afterBody = false; - - public CallbackWriter(Component bean, Writer writer) { - this.bean = bean; - this.writer = writer; - - if (bean.usesBody()) { - this.body = new StringWriter(); - } - } - - public void close() throws IOException { - if (bean.usesBody()) { - body.close(); - } - } - - public void flush() throws IOException { - writer.flush(); - - if (bean.usesBody()) { - body.flush(); - } - } - - public void write(char cbuf[], int off, int len) throws IOException { - if (bean.usesBody() && !afterBody) { - body.write(cbuf, off, len); - } else { - writer.write(cbuf, off, len); - } - } - - public int onStart() throws TemplateModelException, IOException { - boolean result = bean.start(this); - - if (result) { - return EVALUATE_BODY; - } else { - return SKIP_BODY; - } - } - - public int afterBody() throws TemplateModelException, IOException { - afterBody = true; - boolean result = bean.end(this, bean.usesBody() ? body.toString() : ""); - - if (result) { - return REPEAT_EVALUATION; - } else { - return END_EVALUATION; - } - } - - public void onError(Throwable throwable) throws Throwable { - throw throwable; - } - - public Component getBean() { - return bean; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java deleted file mode 100644 index fb9e28438..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.CheckboxList; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see CheckboxList - */ -public class CheckboxListModel extends TagModel { - public CheckboxListModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new CheckboxList(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java deleted file mode 100644 index 75f68d84e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Checkbox; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Checkbox - */ -public class CheckboxModel extends TagModel { - public CheckboxModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Checkbox(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java deleted file mode 100644 index 48f620eb3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ComboBox; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ComboBox - */ -public class ComboBoxModel extends TagModel { - public ComboBoxModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new ComboBox(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java deleted file mode 100644 index 8e8b851af..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.GenericUIBean; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ComponentModel - */ -public class ComponentModel extends TagModel { - public ComponentModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new GenericUIBean(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java deleted file mode 100644 index 56ac58386..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java +++ /dev/null @@ -1,41 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Date; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * DateModel - * - */ -public class DateModel extends TagModel { - - public DateModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Date(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java deleted file mode 100644 index 51ee611e4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.DatePicker; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see DatePicker - */ -public class DatePickerModel extends TextFieldModel { - public DatePickerModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new DatePicker(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java deleted file mode 100644 index 2d4134536..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Div; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Div - */ -public class DivModel extends TagModel { - public DivModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Div(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java deleted file mode 100644 index 4baea67ab..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.DoubleSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see DoubleSelect - */ -public class DoubleSelectModel extends TagModel { - public DoubleSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new DoubleSelect(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java deleted file mode 100644 index 434324ed3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java +++ /dev/null @@ -1,41 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.ElseIf; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @version $Date$ $Id$ - */ -public class ElseIfModel extends TagModel { - - public ElseIfModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new ElseIf(stack); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java deleted file mode 100644 index 64ca5dd94..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java +++ /dev/null @@ -1,42 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Else; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - * @version $Date$ $Id$ - */ -public class ElseModel extends TagModel { - - public ElseModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Else(stack); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java deleted file mode 100644 index 93a5e3006..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.FieldError; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see FieldError - */ -public class FieldErrorModel extends TagModel { - public FieldErrorModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new FieldError(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java deleted file mode 100644 index 495513671..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.File; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see File - */ -public class FileModel extends TagModel { - public FileModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new File(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java deleted file mode 100644 index a8b1b91bc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Form; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Form - */ -public class FormModel extends TagModel { - public FormModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Form(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java deleted file mode 100644 index 9100ed41b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Head; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Head - */ -public class HeadModel extends TagModel { - public HeadModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Head(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java deleted file mode 100644 index 5d2a87433..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Hidden; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Hidden - */ -public class HiddenModel extends TagModel { - public HiddenModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Hidden(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java deleted file mode 100644 index d2f90974c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.I18n; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see I18n - */ -public class I18nModel extends TagModel { - public I18nModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new I18n(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java deleted file mode 100644 index ef008c23f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java +++ /dev/null @@ -1,41 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.If; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @version $Date$ $Id$ - */ -public class IfModel extends TagModel { - - - public IfModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new If(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java deleted file mode 100644 index a74a67afb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Include; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Include - */ -public class IncludeModel extends TagModel { - public IncludeModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Include(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java deleted file mode 100644 index f4ea11718..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.IteratorComponent; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see IteratorComponent - */ -public class IteratorModel extends TagModel { - public IteratorModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new IteratorComponent(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java deleted file mode 100644 index d8088e6f4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Label; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Label - */ -public class LabelModel extends TagModel { - public LabelModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Label(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java deleted file mode 100644 index 8d193d734..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java +++ /dev/null @@ -1,40 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.OptGroup; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * Freemarker's TransformModel for OptGroup component. - * - */ -public class OptGroupModel extends TagModel { - public OptGroupModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new OptGroup(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java deleted file mode 100644 index 15b76a7b1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java +++ /dev/null @@ -1,41 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.OptionTransferSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see OptionTransferSelect - */ -public class OptionTransferSelectModel extends TagModel { - - public OptionTransferSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new OptionTransferSelect(stack, req, res); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java deleted file mode 100644 index 00dc0858c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Panel; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Panel - */ -public class PanelModel extends TagModel { - public PanelModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Panel(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java deleted file mode 100644 index 74fb7792d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Param; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Param - */ -public class ParamModel extends TagModel { - public ParamModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Param(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java deleted file mode 100644 index 6f9a4d87d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Password; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Password - */ -public class PasswordModel extends TagModel { - public PasswordModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Password(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java deleted file mode 100644 index 61e9fa034..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Property; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Property - */ -public class PropertyModel extends TagModel { - public PropertyModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Property(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java deleted file mode 100644 index dc74f0d83..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Push; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Push - */ -public class PushModel extends TagModel { - public PushModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Push(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java deleted file mode 100644 index 358be7f6d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Radio; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Radio - */ -public class RadioModel extends TagModel { - public RadioModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Radio(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java deleted file mode 100644 index 40efe93d6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Reset; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see org.apache.struts2.components.Reset - */ -public class ResetModel extends TagModel { - public ResetModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Reset(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java deleted file mode 100644 index 43bc7460f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Select; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Select - */ -public class SelectModel extends TagModel { - public SelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Select(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java deleted file mode 100644 index f3828652b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Set; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Set - */ -public class SetModel extends TagModel { - public SetModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Set(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java deleted file mode 100644 index 298a8388e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java +++ /dev/null @@ -1,463 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * Provides @s.tag access for various tags. - * - */ -public class StrutsModels { - protected ValueStack stack; - protected HttpServletRequest req; - protected HttpServletResponse res; - - protected ActionModel action; - protected BeanModel bean; - protected CheckboxModel checkbox; - protected CheckboxListModel checkboxlist; - protected ComboBoxModel comboBox; - protected ComponentModel component; - protected DateModel date; - protected DatePickerModel datepicker; - protected DivModel div; - protected DoubleSelectModel doubleselect; - protected FileModel file; - protected FormModel form; - protected HeadModel head; - protected HiddenModel hidden; - protected AnchorModel a; - protected I18nModel i18n; - protected IncludeModel include; - protected LabelModel label; - protected PanelModel panel; - protected PasswordModel password; - protected PushModel push; - protected ParamModel param; - protected RadioModel radio; - protected SelectModel select; - protected SetModel set; - protected SubmitModel submit; - protected ResetModel reset; - protected TabbedPanelModel tabbedPanel; - protected TextAreaModel textarea; - protected TextModel text; - protected TextFieldModel textfield; - protected TokenModel token; - protected URLModel url; - protected WebTableModel table; - protected PropertyModel property; - protected IteratorModel iterator; - protected ActionErrorModel actionerror; - protected ActionMessageModel actionmessage; - protected FieldErrorModel fielderror; - protected OptionTransferSelectModel optiontransferselect; - protected TreeModel treeModel; - protected UpDownSelectModel updownselect; - protected OptGroupModel optGroupModel; - protected IfModel ifModel; - protected ElseModel elseModel; - protected ElseIfModel elseIfModel; - protected TimePickerModel timePickerModel; - - - public StrutsModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - this.stack = stack; - this.req = req; - this.res = res; - } - - public CheckboxListModel getCheckboxlist() { - if (checkboxlist == null) { - checkboxlist = new CheckboxListModel(stack, req, res); - } - - return checkboxlist; - } - - public CheckboxModel getCheckbox() { - if (checkbox == null) { - checkbox = new CheckboxModel(stack, req, res); - } - - return checkbox; - } - - public ComboBoxModel getComboBox() { - if (comboBox == null) { - comboBox = new ComboBoxModel(stack, req, res); - } - - return comboBox; - } - - public ComponentModel getComponent() { - if (component == null) { - component = new ComponentModel(stack, req, res); - } - - return component; - } - - public DoubleSelectModel getDoubleselect() { - if (doubleselect == null) { - doubleselect = new DoubleSelectModel(stack, req, res); - } - - return doubleselect; - } - - public FileModel getFile() { - if (file == null) { - file = new FileModel(stack, req, res); - } - - return file; - } - - public FormModel getForm() { - if (form == null) { - form = new FormModel(stack, req, res); - } - - return form; - } - - public HeadModel getHead() { - if (head == null) { - head = new HeadModel(stack, req, res); - } - - return head; - } - - public HiddenModel getHidden() { - if (hidden == null) { - hidden = new HiddenModel(stack, req, res); - } - - return hidden; - } - public LabelModel getLabel() { - if (label == null) { - label = new LabelModel(stack, req, res); - } - - return label; - } - - public PasswordModel getPassword() { - if (password == null) { - password = new PasswordModel(stack, req, res); - } - - return password; - } - - public RadioModel getRadio() { - if (radio == null) { - radio = new RadioModel(stack, req, res); - } - - return radio; - } - - public SelectModel getSelect() { - if (select == null) { - select = new SelectModel(stack, req, res); - } - - return select; - } - - public SubmitModel getSubmit() { - if (submit == null) { - submit = new SubmitModel(stack, req, res); - } - - return submit; - } - - public ResetModel getReset() { - if (reset == null) { - reset = new ResetModel(stack, req, res); - } - - return reset; - } - - public TextAreaModel getTextarea() { - if (textarea == null) { - textarea = new TextAreaModel(stack, req, res); - } - - return textarea; - } - - public TextFieldModel getTextfield() { - if (textfield == null) { - textfield = new TextFieldModel(stack, req, res); - } - - return textfield; - } - - public DateModel getDate() { - if (date == null) { - date = new DateModel(stack, req, res); - } - - return date; - } - - public DatePickerModel getDatepicker() { - if (datepicker == null) { - datepicker = new DatePickerModel(stack, req, res); - } - - return datepicker; - } - - public TokenModel getToken() { - if (token == null) { - token = new TokenModel(stack, req, res); - } - - return token; - } - - public WebTableModel getTable() { - if (table == null) { - table = new WebTableModel(stack, req, res); - } - - return table; - } - - public URLModel getUrl() { - if (url == null) { - url = new URLModel(stack, req, res); - } - - return url; - } - - public IncludeModel getInclude() { - if (include == null) { - include = new IncludeModel(stack, req, res); - } - - return include; - } - - public ParamModel getParam() { - if (param == null) { - param = new ParamModel(stack, req, res); - } - - return param; - } - - public ActionModel getAction() { - if (action == null) { - action = new ActionModel(stack, req, res); - } - - return action; - } - - public AnchorModel getA() { - if (a == null) { - a = new AnchorModel(stack, req, res); - } - - return a; - } - - public AnchorModel getHref() { - if (a == null) { - a = new AnchorModel(stack, req, res); - } - - return a; - } - - public DivModel getDiv() { - if (div == null) { - div = new DivModel(stack, req, res); - } - - return div; - } - - public TextModel getText() { - if (text == null) { - text = new TextModel(stack, req, res); - } - - return text; - } - - public TabbedPanelModel getTabbedPanel() { - if (tabbedPanel == null) { - tabbedPanel = new TabbedPanelModel(stack, req, res); - } - - return tabbedPanel; - } - - public PanelModel getPanel() { - if (panel == null) { - panel = new PanelModel(stack, req, res); - } - - return panel; - } - - public BeanModel getBean() { - if (bean == null) { - bean = new BeanModel(stack, req, res); - } - - return bean; - } - - public I18nModel getI18n() { - if (i18n == null) { - i18n = new I18nModel(stack, req, res); - } - - return i18n; - } - - public PushModel getPush() { - if (push == null) { - push = new PushModel(stack, req, res); - } - - return push; - } - - public SetModel getSet() { - if (set == null) { - set = new SetModel(stack, req, res); - } - - return set; - } - - public PropertyModel getProperty() { - if (property == null) { - property = new PropertyModel(stack, req, res); - } - - return property; - } - - public IteratorModel getIterator() { - if (iterator == null) { - iterator = new IteratorModel(stack, req, res); - } - - return iterator; - } - - public ActionErrorModel getActionerror() { - if (actionerror == null) { - actionerror = new ActionErrorModel(stack, req, res); - } - - return actionerror; - } - - public ActionMessageModel getActionmessage() { - if (actionmessage == null) { - actionmessage = new ActionMessageModel(stack, req, res); - } - - return actionmessage; - } - - public FieldErrorModel getFielderror() { - if (fielderror == null) { - fielderror = new FieldErrorModel(stack, req, res); - } - - return fielderror; - } - - public OptionTransferSelectModel getOptiontransferselect() { - if (optiontransferselect == null) { - optiontransferselect = new OptionTransferSelectModel(stack, req, res); - } - return optiontransferselect; - } - - public TreeModel getTree() { - if (treeModel == null) { - treeModel = new TreeModel(stack,req, res); - } - return treeModel; - } - - public UpDownSelectModel getUpdownselect() { - if (updownselect == null) { - updownselect = new UpDownSelectModel(stack, req, res); - } - return updownselect; - } - - public OptGroupModel getOptgroup() { - if (optGroupModel == null) { - optGroupModel = new OptGroupModel(stack, req, res); - } - return optGroupModel; - } - - public IfModel getIf() { - if (ifModel == null) { - ifModel = new IfModel(stack, req, res); - } - return ifModel; - } - - public ElseModel getElse() { - if (elseModel == null) { - elseModel = new ElseModel(stack, req, res); - } - return elseModel; - } - - public ElseIfModel getElseif() { - if (elseIfModel == null) { - elseIfModel = new ElseIfModel(stack, req, res); - } - return elseIfModel; - } - - public TimePickerModel getTimepicker() { - if (timePickerModel == null) { - timePickerModel = new TimePickerModel(stack, req, res); - } - return timePickerModel; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java deleted file mode 100644 index 6d91e4fa6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Submit; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Submit - */ -public class SubmitModel extends TagModel { - public SubmitModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Submit(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java deleted file mode 100644 index 00db842a9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TabbedPanel; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TabbedPanel - */ -public class TabbedPanelModel extends TagModel { - public TabbedPanelModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new TabbedPanel(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java deleted file mode 100644 index 4b89a654c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java +++ /dev/null @@ -1,102 +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.views.freemarker.tags; - -import java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -import freemarker.template.SimpleNumber; -import freemarker.template.SimpleSequence; -import freemarker.template.TemplateModelException; -import freemarker.template.TemplateTransformModel; - -public abstract class TagModel implements TemplateTransformModel { - private static final Log LOG = LogFactory.getLog(TagModel.class); - - protected ValueStack stack; - protected HttpServletRequest req; - protected HttpServletResponse res; - - public TagModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - this.stack = stack; - this.req = req; - this.res = res; - } - - public Writer getWriter(Writer writer, Map params) throws TemplateModelException, IOException { - Component bean = getBean(); - Map basicParams = convertParams(params); - bean.copyParams(basicParams); - bean.addAllParameters(getComplexParams(params)); - return new CallbackWriter(bean, writer); - } - - protected abstract Component getBean(); - - private Map convertParams(Map params) { - HashMap map = new HashMap(params.size()); - for (Iterator iterator = params.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - Object value = entry.getValue(); - if (value != null && !complexType(value)) { - map.put(entry.getKey(), value.toString()); - } - } - return map; - } - - private Map getComplexParams(Map params) { - HashMap map = new HashMap(params.size()); - for (Iterator iterator = params.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - Object value = entry.getValue(); - if (value != null && complexType(value)) { - if (value instanceof freemarker.ext.beans.BeanModel) { - map.put(entry.getKey(), ((freemarker.ext.beans.BeanModel) value).getWrappedObject()); - } else if (value instanceof SimpleNumber) { - map.put(entry.getKey(), ((SimpleNumber) value).getAsNumber()); - } else if (value instanceof SimpleSequence) { - try { - map.put(entry.getKey(), ((SimpleSequence) value).toList()); - } catch (TemplateModelException e) { - LOG.error("There was a problem converting a SimpleSequence to a list", e); - } - } - } - } - return map; - } - - private boolean complexType(Object value) { - return value instanceof freemarker.ext.beans.BeanModel - || value instanceof SimpleNumber - || value instanceof SimpleSequence; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java deleted file mode 100644 index 69f7ada39..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TextArea; - -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); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java deleted file mode 100644 index d80d5c693..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TextField; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TextField - */ -public class TextFieldModel extends TagModel { - public TextFieldModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new TextField(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java deleted file mode 100644 index e14f05129..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Text; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Text - */ -public class TextModel extends TagModel { - public TextModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Text(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java deleted file mode 100644 index fef0b76e9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.apache.struts2.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TimePicker; - -import com.opensymphony.xwork2.util.ValueStack; - -public class TimePickerModel extends TagModel { - - public TimePickerModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new TimePicker(stack, req, res); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java deleted file mode 100644 index 0d800a990..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Token; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Token - */ -public class TokenModel extends TagModel { - public TokenModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Token(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java deleted file mode 100644 index b27a238fc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java +++ /dev/null @@ -1,41 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Tree; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * TreeModel - * @see Tree - * - */ -public class TreeModel extends TagModel { - public TreeModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new Tree(stack,req,res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java deleted file mode 100644 index c2735e3bc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java +++ /dev/null @@ -1,40 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TreeNode; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * TreeNodeModel - * @see TreeNode - */ -public class TreeNodeModel extends TagModel { - public TreeNodeModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new TreeNode(stack,req,res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java deleted file mode 100644 index 0b3cd8557..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.URL; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see URL - */ -public class URLModel extends TagModel { - public URLModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new URL(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java deleted file mode 100644 index 484cacbbe..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java +++ /dev/null @@ -1,42 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.UpDownSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see UpDownSelect - * - */ -public class UpDownSelectModel extends TagModel { - - public UpDownSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new UpDownSelect(stack, req, res); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java b/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java deleted file mode 100644 index 2757dbfba..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java +++ /dev/null @@ -1,39 +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.views.freemarker.tags; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.table.WebTable; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see WebTable - */ -public class WebTableModel extends TagModel { - public WebTableModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - - protected Component getBean() { - return new WebTable(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java deleted file mode 100644 index 59fe8dcd5..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java +++ /dev/null @@ -1,75 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionComponent; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionComponent - */ -public class ActionTag extends ComponentTagSupport { - - private static final long serialVersionUID = -5384167073331678855L; - - protected String name; - protected String namespace; - protected boolean executeResult; - protected boolean ignoreContextParams; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionComponent(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - ActionComponent action = (ActionComponent) component; - action.setName(name); - action.setNamespace(namespace); - action.setExecuteResult(executeResult); - action.setIgnoreContextParams(ignoreContextParams); - action.start(pageContext.getOut()); - } - - protected void addParameter(String name, Object value) { - ActionComponent ac = (ActionComponent) component; - ac.addParameter(name, value); - } - - public void setName(String name) { - this.name = name; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public void setExecuteResult(boolean executeResult) { - this.executeResult = executeResult; - } - - public void setIgnoreContextParams(boolean ignoreContextParams) { - this.ignoreContextParams = ignoreContextParams; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java deleted file mode 100644 index 1316ace2f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java +++ /dev/null @@ -1,55 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.components.Bean; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Bean - */ -public class BeanTag extends ComponentTagSupport { - - private static final long serialVersionUID = -3863152522071209267L; - - protected static Log log = LogFactory.getLog(BeanTag.class); - - protected String name; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Bean(stack); - } - - protected void populateParams() { - super.populateParams(); - - ((Bean) component).setName(name); - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java deleted file mode 100644 index 32ba71620..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java +++ /dev/null @@ -1,60 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspException; - -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - */ -public abstract class ComponentTagSupport extends StrutsBodyTagSupport { - protected Component component; - - public abstract Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res); - - public int doEndTag() throws JspException { - component.end(pageContext.getOut(), getBody()); - component = null; - return EVAL_PAGE; - } - - public int doStartTag() throws JspException { - component = getBean(getStack(), (HttpServletRequest) pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse()); - populateParams(); - boolean evalBody = component.start(pageContext.getOut()); - - if (evalBody) { - return component.usesBody() ? EVAL_BODY_BUFFERED : EVAL_BODY_INCLUDE; - } else { - return SKIP_BODY; - } - } - - protected void populateParams() { - component.setId(id); - } - - public Component getComponent() { - return component; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java deleted file mode 100644 index 893cb83db..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java +++ /dev/null @@ -1,63 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Date; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Date - */ -public class DateTag extends ComponentTagSupport { - - private static final long serialVersionUID = -6216963123295613440L; - - protected String name; - protected String format; - protected boolean nice; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Date(stack); - } - - protected void populateParams() { - super.populateParams(); - Date d = (Date)component; - d.setName(name); - d.setFormat(format); - d.setNice(nice); - - } - - public void setFormat(String format) { - this.format = format; - } - - public void setNice(boolean nice) { - this.nice = nice; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java deleted file mode 100644 index d52c853ce..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java +++ /dev/null @@ -1,48 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.ElseIf; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ElseIf - */ -public class ElseIfTag extends ComponentTagSupport { - - private static final long serialVersionUID = -3872016920741400345L; - - protected String test; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ElseIf(stack); - } - - protected void populateParams() { - ((ElseIf) getComponent()).setTest(test); - } - - public void setTest(String test) { - this.test = test; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java deleted file mode 100644 index 7954e26de..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java +++ /dev/null @@ -1,39 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Else; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Else - */ -public class ElseTag extends ComponentTagSupport { - - private static final long serialVersionUID = 8166807953193406785L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Else(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java deleted file mode 100644 index 49b24a9e2..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java +++ /dev/null @@ -1,51 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.I18n; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see I18n - */ -public class I18nTag extends ComponentTagSupport { - - private static final long serialVersionUID = -7914587341936116887L; - - protected String name; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new I18n(stack); - } - - protected void populateParams() { - super.populateParams(); - - ((I18n) component).setName(name); - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java deleted file mode 100644 index 6f5bdcda0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java +++ /dev/null @@ -1,49 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.If; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see If - */ -public class IfTag extends ComponentTagSupport { - - private static final long serialVersionUID = 4448870162549923833L; - - String test; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new If(stack); - } - - protected void populateParams() { - ((If) getComponent()).setTest(test); - } - - public void setTest(String test) { - this.test = test; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java deleted file mode 100644 index a2d45bf3a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java +++ /dev/null @@ -1,51 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Include; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Include - */ -public class IncludeTag extends ComponentTagSupport { - - private static final long serialVersionUID = -1585165567043278243L; - - protected String value; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Include(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - ((Include) component).setValue(value); - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java deleted file mode 100644 index ff216b0b3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java +++ /dev/null @@ -1,74 +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.views.jsp; - - -/** - * The iterator tag can export an IteratorStatus object so that - * one can get information about the status of the iteration, such as - * the size, current index, and whether any more items are available. - * - */ -public class IteratorStatus { - protected StatusState state; - - public IteratorStatus(StatusState aState) { - state = aState; - } - - public int getCount() { - return state.index + 1; - } - - public boolean isEven() { - return ((state.index + 1) % 2) == 0; - } - - public boolean isFirst() { - return state.index == 0; - } - - public int getIndex() { - return state.index; - } - - public boolean isLast() { - return state.last; - } - - public boolean isOdd() { - return ((state.index + 1) % 2) == 1; - } - - public int modulus(int operand) { - return (state.index + 1) % operand; - } - - public static class StatusState { - boolean last = false; - int index = 0; - - public void setLast(boolean isLast) { - last = isLast; - } - - public void next() { - index++; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java deleted file mode 100644 index 1c944ff60..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java +++ /dev/null @@ -1,81 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspException; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.IteratorComponent; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see IteratorComponent - */ -public class IteratorTag extends ComponentTagSupport { - - private static final long serialVersionUID = -1827978135193581901L; - - protected String statusAttr; - protected String value; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new IteratorComponent(stack); - } - - protected void populateParams() { - super.populateParams(); - - IteratorComponent tag = (IteratorComponent) getComponent(); - tag.setStatus(statusAttr); - tag.setValue(value); - } - - public void setStatus(String status) { - this.statusAttr = status; - } - - public void setValue(String value) { - this.value = value; - } - - public int doEndTag() throws JspException { - component = null; - return EVAL_PAGE; - } - - public int doAfterBody() throws JspException { - boolean again = component.end(pageContext.getOut(), getBody()); - - if (again) { - return EVAL_BODY_AGAIN; - } else { - if (bodyContent != null) { - try { - bodyContent.writeOut(bodyContent.getEnclosingWriter()); - } catch (Exception e) { - throw new JspException(e.getMessage()); - } - } - return SKIP_BODY; - } - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java deleted file mode 100644 index fd67c5d2f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java +++ /dev/null @@ -1,57 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Param; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Param - */ -public class ParamTag extends ComponentTagSupport { - - private static final long serialVersionUID = -968332732207156408L; - - protected String name; - protected String value; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Param(stack); - } - - protected void populateParams() { - super.populateParams(); - - Param param = (Param) component; - param.setName(name); - param.setValue(value); - } - - public void setName(String name) { - this.name = name; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java deleted file mode 100644 index ffd925aee..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java +++ /dev/null @@ -1,64 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Property; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Property - */ -public class PropertyTag extends ComponentTagSupport { - - private static final long serialVersionUID = 435308349113743852L; - - private String defaultValue; - private String value; - private boolean escape = true; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Property(stack); - } - - protected void populateParams() { - super.populateParams(); - - Property tag = (Property) component; - tag.setDefault(defaultValue); - tag.setValue(value); - tag.setEscape(escape); - } - - public void setDefault(String defaultValue) { - this.defaultValue = defaultValue; - } - - public void setEscape(boolean escape) { - this.escape = escape; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java deleted file mode 100644 index 6645f4a7b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java +++ /dev/null @@ -1,51 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Push; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Push - */ -public class PushTag extends ComponentTagSupport { - - private static final long serialVersionUID = -1357895305148907931L; - - protected String value; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Push(stack); - } - - protected void populateParams() { - super.populateParams(); - - ((Push) component).setValue(value); - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java deleted file mode 100644 index 13170ed48..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java +++ /dev/null @@ -1,64 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Set; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Set - */ -public class SetTag extends ComponentTagSupport { - - private static final long serialVersionUID = -5074213926790716974L; - - protected String name; - protected String scope; - protected String value; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Set(stack); - } - - protected void populateParams() { - super.populateParams(); - - Set set = (Set) component; - set.setName(name); - set.setScope(scope); - set.setValue(value); - } - - public void setName(String name) { - this.name = name; - } - - public void setScope(String scope) { - this.scope = scope; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java deleted file mode 100644 index 8b7b7e5ce..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java +++ /dev/null @@ -1,124 +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.views.jsp; - -import java.io.PrintWriter; - -import javax.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.struts2.util.FastByteArrayOutputStream; -import org.apache.struts2.views.util.ContextUtil; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * Contains common functonalities for Struts JSP Tags. - * - */ -public class StrutsBodyTagSupport extends BodyTagSupport { - - private static final long serialVersionUID = -1201668454354226175L; - - /** - * @s.tagattribute required="false" type="String" - * description="The id of the tag element." - */ - public void setId(String string) { - super.setId(string); - } - - protected boolean altSyntax() { - return ContextUtil.isUseAltSyntax(getStack().getContext()); - } - - protected ValueStack getStack() { - return TagUtils.getStack(pageContext); - } - - protected String findString(String expr) { - return (String) findValue(expr, String.class); - } - - protected Object findValue(String expr) { - if (altSyntax()) { - // does the expression start with %{ and end with }? if so, just cut it off! - if (expr.startsWith("%{") && expr.endsWith("}")) { - expr = expr.substring(2, expr.length() - 1); - } - } - - return getStack().findValue(expr); - } - - protected Object findValue(String expr, Class toType) { - if (altSyntax() && toType == String.class) { - return translateVariables(expr, getStack()); - } else { - if (altSyntax()) { - // does the expression start with %{ and end with }? if so, just cut it off! - if (expr.startsWith("%{") && expr.endsWith("}")) { - expr = expr.substring(2, expr.length() - 1); - } - } - - return getStack().findValue(expr, toType); - } - } - - protected String toString(Throwable t) { - FastByteArrayOutputStream bout = new FastByteArrayOutputStream(); - PrintWriter wrt = new PrintWriter(bout); - t.printStackTrace(wrt); - wrt.close(); - - return bout.toString(); - } - - protected String getBody() { - if (bodyContent == null) { - return ""; - } else { - return bodyContent.getString().trim(); - } - } - - public static String translateVariables(String expression, ValueStack stack) { - while (true) { - int x = expression.indexOf("%{"); - int y = expression.indexOf("}", x); - - if ((x != -1) && (y != -1)) { - String var = expression.substring(x + 2, y); - - Object o = stack.findValue(var, String.class); - - if (o != null) { - expression = expression.substring(0, x) + o + expression.substring(y + 1); - } else { - // the variable doesn't exist, so don't display anything - expression = expression.substring(0, x) + expression.substring(y + 1); - } - } else { - break; - } - } - - return expression; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java deleted file mode 100644 index cb7c1d778..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java +++ /dev/null @@ -1,104 +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.views.jsp; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.PageContext; - -import org.apache.struts2.RequestUtils; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.ApplicationMap; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.RequestMap; -import org.apache.struts2.dispatcher.SessionMap; -import org.apache.struts2.dispatcher.mapper.ActionMapper; -import org.apache.struts2.dispatcher.mapper.ActionMapperFactory; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.util.AttributeMap; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.ValueStackFactory; - - -/** - */ -public class TagUtils { - - public static ValueStack getStack(PageContext pageContext) { - HttpServletRequest req = (HttpServletRequest) pageContext.getRequest(); - ValueStack stack = (ValueStack) req.getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY); - - if (stack == null) { - stack = ValueStackFactory.getFactory().createValueStack(); - - HttpServletResponse res = (HttpServletResponse) pageContext.getResponse(); - Dispatcher du = Dispatcher.getInstance(); - Map extraContext = du.createContextMap(new RequestMap(req), - req.getParameterMap(), - new SessionMap(req), - new ApplicationMap(pageContext.getServletContext()), - req, - res, - pageContext.getServletContext()); - extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext); - stack.getContext().putAll(extraContext); - req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); - - // also tie this stack/context to the ThreadLocal - ActionContext.setContext(new ActionContext(stack.getContext())); - } else { - // let's make sure that the current page context is in the action context - Map context = stack.getContext(); - context.put(ServletActionContext.PAGE_CONTEXT, pageContext); - - AttributeMap attrMap = new AttributeMap(context); - context.put("attr", attrMap); - } - - return stack; - } - - public static String buildNamespace(ValueStack stack, HttpServletRequest request) { - ActionContext context = new ActionContext(stack.getContext()); - ActionInvocation invocation = context.getActionInvocation(); - - if (invocation == null) { - ActionMapper mapper = ActionMapperFactory.getMapper(); - ActionMapping mapping = mapper.getMapping(request, - Dispatcher.getInstance().getConfigurationManager()); - - if (mapping != null) { - return mapping.getNamespace(); - } else { - // well, if the ActionMapper can't tell us, and there is no existing action invocation, - // let's just go with a default guess that the namespace is the last the path minus the - // last part (/foo/bar/baz.xyz -> /foo/bar) - - String path = RequestUtils.getServletPath(request); - return path.substring(0, path.lastIndexOf("/")); - } - } else { - return invocation.getProxy().getNamespace(); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java deleted file mode 100644 index ebcdc549a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java +++ /dev/null @@ -1,51 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Text; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Text - */ -public class TextTag extends ComponentTagSupport { - - private static final long serialVersionUID = -3075088084198264581L; - - protected String name; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Text(stack); - } - - protected void populateParams() { - super.populateParams(); - - ((Text) component).setName(name); - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java deleted file mode 100644 index 9fbf7780d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java +++ /dev/null @@ -1,120 +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.views.jsp; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.URL; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see URL - */ -public class URLTag extends ComponentTagSupport { - - private static final long serialVersionUID = 1722460444125206226L; - - protected String includeParams; - protected String scheme; - protected String value; - protected String action; - protected String namespace; - protected String method; - protected String encode; - protected String includeContext; - protected String portletMode; - protected String windowState; - protected String portletUrlType; - protected String anchor; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new URL(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - URL url = (URL) component; - url.setIncludeParams(includeParams); - url.setScheme(scheme); - url.setValue(value); - url.setMethod(method); - url.setNamespace(namespace); - url.setAction(action); - url.setPortletMode(portletMode); - url.setPortletUrlType(portletUrlType); - url.setWindowState(windowState); - url.setAnchor(anchor); - - if (encode != null) { - url.setEncode(Boolean.valueOf(encode).booleanValue()); - } - if (includeContext != null) { - url.setIncludeContext(Boolean.valueOf(includeContext).booleanValue()); - } - } - - public void setEncode(String encode) { - this.encode = encode; - } - - public void setIncludeContext(String includeContext) { - this.includeContext = includeContext; - } - - public void setIncludeParams(String name) { - includeParams = name; - } - - public void setAction(String action) { - this.action = action; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public void setMethod(String method) { - this.method = method; - } - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - public void setValue(String value) { - this.value = value; - } - public void setPortletMode(String portletMode) { - this.portletMode = portletMode; - } - public void setPortletUrlType(String portletUrlType) { - this.portletUrlType = portletUrlType; - } - public void setWindowState(String windowState) { - this.windowState = windowState; - } - - public void setAnchor(String anchor) { - this.anchor = anchor; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java deleted file mode 100644 index 0d68b356b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java +++ /dev/null @@ -1,44 +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.views.jsp.iterator; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.AppendIterator; -import org.apache.struts2.components.Component; -import org.apache.struts2.views.jsp.ComponentTagSupport; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * Append a list of iterators. The values of the iterators will be merged - * into one iterator. - * - * @see AppendIterator - */ -public class AppendIteratorTag extends ComponentTagSupport { - - private static final long serialVersionUID = -6017337859763283691L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new AppendIterator(stack); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java deleted file mode 100644 index 90e4c921b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java +++ /dev/null @@ -1,253 +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.views.jsp.iterator; - -import javax.servlet.jsp.JspException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.util.IteratorGenerator; -import org.apache.struts2.util.IteratorGenerator.Converter; -import org.apache.struts2.views.jsp.StrutsBodyTagSupport; - - -/** - * - * NOTE: JSP-TAG - * - *

    Generate an iterator based on the val attribute supplied.

    - * - * NOTE: The generated iterator will ALWAYS be pushed into the top of the stack, and poped - * at the end of the tag. - * - * - * - *
      - *
    • val* (Object) - the source to be parsed into an iterator
    • - *
    • count (Object) - the max number (Integer, Float, Double, Long, String) entries to be in the iterator
    • - *
    • separator (String) - the separator to be used in separating the val into entries of the iterator
    • - *
    • id (String) - the id to store the resultant iterator into page context, if such id is supplied
    • - *
    • converter (Object) - the converter (must extends off IteratorGenerator.Converter interface) to convert the String entry parsed from val into an object
    • - *
    - * - * - * - * - * Example One: - *
    - * Generate a simple iterator
    - * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}">
    - *	<s:iterator>
    - *		<s:property /><br/>
    - *	</s:iterator>
    - * </s:generator>
    - * 
    - * This generates an iterator and print it out using the iterator tag. - * - * Example Two: - *
    - * Generate an iterator with count attribute
    - * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="3">
    - *	<s:iterator>
    - *		<s:property /><br/>
    - *	</s:iterator>
    - * </s:generator>
    - * 
    - * This generates an iterator, but only 3 entries will be available in the iterator - * generated, namely aaa, bbb and ccc respectively because count attribute is set to 3 - * - * Example Three: - *
    - * Generate an iterator with id attribute
    - * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator="," id="myAtt" />
    - * <%
    - * 	Iterator i = (Iterator) pageContext.getAttribute("myAtt");
    - * 	while(i.hasNext()) {
    - * 		String s = (String) i.next(); %>
    - * 		<%=s%> <br/>
    - * <% 	}
    - * %>
    - * 
    - * This generates an iterator and put it in the PageContext under the key as specified - * by the id attribute. - * - * - * Example Four: - *
    - * Generate an iterator with comparator attribute
    - * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" converter="%{myConverter}">
    - *	<s:iterator>
    - * 		<s:property /><br/>
    - * 	</s:iterator>
    - * </s:generator>
    - *
    - *
    - * public class GeneratorTagAction extends ActionSupport {
    - *
    - *   ....
    - *
    - *	 public Converter getMyConverter() {
    - *		return new Converter() {
    - *			public Object convert(String value) throws Exception {
    - *				return "converter-"+value;
    - *			}
    - *		};
    - *	 }
    - *
    - *   ...
    - *
    - * }
    - * 
    - * This will generate an iterator with each entries decided by the converter supplied. With - * this converter, it simply add "converter-" to each entries. - * - * - * @see org.apache.struts2.util.IteratorGenerator - * - * @s.tag name="generator" tld-body-content="JSP" - * description="Generate an iterator for a iterable source." - */ -public class IteratorGeneratorTag extends StrutsBodyTagSupport { - - private static final long serialVersionUID = 2968037295463973936L; - - public static final String DEFAULT_SEPARATOR = ","; - - private static final Log _log = LogFactory.getLog(IteratorGeneratorTag.class); - - String countAttr; - String separatorAttr; - String valueAttr; - String converterAttr; - - IteratorGenerator iteratorGenerator = null; - - /** - * @s.tagattribute required="false" type="Integer" - * description="the max number entries to be in the iterator" - */ - public void setCount(String count) { - countAttr = count; - } - - /** - * @s.tagattribute required="true" type="String" - * description="the separator to be used in separating the val into entries of the iterator" - */ - public void setSeparator(String separator) { - separatorAttr = separator; - } - - /** - * @s.tagattribute required="true" - * description="the source to be parsed into an iterator" - */ - public void setVal(String val) { - valueAttr = val; - } - - /** - * @s.tagattribute required="false" type="org.apache.struts2.util.IteratorGenerator.Converter" - * description="the converter to convert the String entry parsed from val into an object" - */ - public void setConverter(String aConverter) { - converterAttr = aConverter; - } - - /** - * @s.tagattribute required="false" type="String" - * description="the id to store the resultant iterator into page context, if such id is supplied" - */ - public void setId(String string) { - super.setId(string); - } - - public int doStartTag() throws JspException { - - // value - Object value = findValue(valueAttr); - - // separator - String separator = DEFAULT_SEPARATOR; - if (separatorAttr != null && separatorAttr.length() > 0) { - separator = findString(separatorAttr); - } - - // TODO: maybe this could be put into an Util class, or there is already one? - // count - int count = 0; - if (countAttr != null && countAttr.length() > 0) { - Object countObj = findValue(countAttr); - if (countObj instanceof Integer) { - count = ((Integer)countObj).intValue(); - } - else if (countObj instanceof Float) { - count = ((Float)countObj).intValue(); - } - else if (countObj instanceof Long) { - count = ((Long)countObj).intValue(); - } - else if (countObj instanceof Double) { - count = ((Long)countObj).intValue(); - } - else if (countObj instanceof String) { - try { - count = Integer.parseInt((String)countObj); - } - catch(NumberFormatException e) { - _log.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e); - } - } - } - - // converter - Converter converter = null; - if (converterAttr != null && converterAttr.length() > 0) { - converter = (Converter) findValue(converterAttr); - } - - - iteratorGenerator = new IteratorGenerator(); - iteratorGenerator.setValues(value); - iteratorGenerator.setCount(count); - iteratorGenerator.setSeparator(separator); - iteratorGenerator.setConverter(converter); - - iteratorGenerator.execute(); - - - - // push resulting iterator into stack - getStack().push(iteratorGenerator); - if (getId() != null && getId().length() > 0) { - // if an id is specified, we have the resulting iterator set into - // the pageContext attribute as well - pageContext.setAttribute(getId(), iteratorGenerator); - } - - return EVAL_BODY_INCLUDE; - } - - public int doEndTag() throws JspException { - // pop resulting iterator from stack at end tag - getStack().pop(); - iteratorGenerator = null; // clean up - - return EVAL_PAGE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java deleted file mode 100644 index 9d3eec513..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java +++ /dev/null @@ -1,45 +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.views.jsp.iterator; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.MergeIterator; -import org.apache.struts2.views.jsp.ComponentTagSupport; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * Append a list of iterators. The values of the iterators will be merged - * into one iterator. - * - * @see MergeIterator - * @see org.apache.struts2.util.MergeIteratorFilter - */ -public class MergeIteratorTag extends ComponentTagSupport { - - private static final long serialVersionUID = 4999729472466011218L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new MergeIterator(stack); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java deleted file mode 100644 index 2c7f6e65b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java +++ /dev/null @@ -1,152 +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.views.jsp.iterator; - -import java.util.Comparator; - -import javax.servlet.jsp.JspException; - -import org.apache.struts2.util.MakeIterator; -import org.apache.struts2.util.SortIteratorFilter; -import org.apache.struts2.views.jsp.StrutsBodyTagSupport; - - -/** - * - * - * NOTE: JSP-TAG - * - *

    A Tag that sorts a List using a Comparator both passed in as the tag attribute. - * If 'id' attribute is specified, the sorted list will be placed into the PageContext - * attribute using the key specified by 'id'. The sorted list will ALWAYS be - * pushed into the stack and poped at the end of this tag.

    - * - * - * - * - * - * - *
      - *
    • id (String) - if specified, the sorted iterator will be place with this id under page context
    • - *
    • source (Object) - the source for the sort to take place (should be iteratable) else JspException will be thrown
    • - *
    • comparator* (Object) - the comparator used to do sorting (should be a type of Comparator or its decendent) else JspException will be thrown
    • - *
    - * - * - * - * - * - *
    - * 
    - *
    - * USAGE 1:
    - * <s:sort comparator="myComparator" source="myList">
    - *      <s:iterator>
    - * 		<!-- do something with each sorted elements -->
    - * 		<s:property value="..." />
    - *      </s:iterator>
    - * </s:sort>
    - *
    - * USAGE 2:
    - * <s:sort id="mySortedList" comparator="myComparator" source="myList" />
    - *
    - * <%
    - *    Iterator sortedIterator = (Iterator) pageContext.getAttribute("mySortedList");
    - *    for (Iterator i = sortedIterator; i.hasNext(); ) {
    - *    	// do something with each of the sorted elements
    - *    }
    - * %>
    - *
    - * 
    - * 
    - * - * - * @see org.apache.struts2.util.SortIteratorFilter - * - * @s.tag name="sort" tld-body-content="JSP" - * description="Sort a List using a Comparator both passed in as the tag attribute." - */ -public class SortIteratorTag extends StrutsBodyTagSupport { - - private static final long serialVersionUID = -7835719609764092235L; - - String comparatorAttr; - String sourceAttr; - - SortIteratorFilter sortIteratorFilter = null; - - /** - * @s.tagattribute required="true" type="java.util.Comparator" - * description="The comparator to use" - */ - public void setComparator(String comparator) { - comparatorAttr = comparator; - } - - /** - * @s.tagattribute required="false" - * description="The iterable source to sort" - */ - public void setSource(String source) { - sourceAttr = source; - } - - public int doStartTag() throws JspException { - // Source - Object srcToSort; - if (sourceAttr == null) { - srcToSort = findValue("top"); - } else { - srcToSort = findValue(sourceAttr); - } - if (! MakeIterator.isIterable(srcToSort)) { // see if source is Iteratable - throw new JspException("source ["+srcToSort+"] is not iteratable"); - } - - // Comparator - Object comparatorObj = findValue(comparatorAttr); - if (! (comparatorObj instanceof Comparator)) { - throw new JspException("comparator ["+comparatorObj+"] does not implements Comparator interface"); - } - Comparator c = (Comparator) findValue(comparatorAttr); - - // SortIteratorFilter - sortIteratorFilter = new SortIteratorFilter(); - sortIteratorFilter.setComparator(c); - sortIteratorFilter.setSource(srcToSort); - sortIteratorFilter.execute(); - - // push sorted iterator into stack, so nexted tag have access to it - getStack().push(sortIteratorFilter); - if (getId() != null && getId().length() > 0) { - pageContext.setAttribute(getId(), sortIteratorFilter); - } - - return EVAL_BODY_INCLUDE; - } - - public int doEndTag() throws JspException { - int returnVal = super.doEndTag(); - - // pop sorted list from stack at the end of tag - getStack().pop(); - sortIteratorFilter = null; - - return returnVal; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java deleted file mode 100644 index 47a7b5e5f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java +++ /dev/null @@ -1,288 +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.views.jsp.iterator; - -import javax.servlet.jsp.JspException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.util.SubsetIteratorFilter; -import org.apache.struts2.util.SubsetIteratorFilter.Decider; -import org.apache.struts2.views.jsp.StrutsBodyTagSupport; - - -/** - * - * NOTE: JSP-TAG - * - *

    A tag that takes an iterator and outputs a subset of it. It delegates to - * {@link org.apache.struts2.util.SubsetIteratorFilter} internally to - * perform the subset functionality.

    - * - * - * - *
      - *
    • count (Object) - Indicate the number of entries to be in the resulting subset iterator
    • - *
    • source* (Object) - Indicate the source of which the resulting subset iterator is to be derived base on
    • - *
    • start (Object) - Indicate the starting index (eg. first entry is 0) of entries in the source to be available as the first entry in the resulting subset iterator
    • - *
    • decider (Object) - Extension to plug-in a decider to determine if that particular entry is to be included in the resulting subset iterator
    • - *
    • id (String) - Indicate the pageContext attribute id to store the resultant subset iterator in
    • - *
    - * - * - * - *
    - * 
    - * public class MySubsetTagAction extends ActionSupport {
    - *      public String execute() throws Exception {
    - *		   l = new ArrayList();
    - *		   l.add(new Integer(1));
    - *		   l.add(new Integer(2));
    - *		   l.add(new Integer(3));
    - *		   l.add(new Integer(4));
    - *		   l.add(new Integer(5));
    - *		   return "done";
    - *	    }
    - *
    - *
    - *	    public Integer[] getMyArray() {
    - *		   return a;
    - *	    }
    - *
    - *	    public List getMyList() {
    - *		   return l;
    - *	     }
    - *
    - *      public Decider getMyDecider() {
    - *		return new Decider() {
    - *			public boolean decide(Object element) throws Exception {
    - *				int i = ((Integer)element).intValue();
    - *				return (((i % 2) == 0)?true:false);
    - *			}
    - *		};
    - *		}
    - *	}
    - * 
    - * 
    - * - * - *
    - * 
    - * <!-- s: List basic -->
    - *    <s:subset source="myList">
    - *	     <s:iterator>
    - *		    <s:property />
    - *	     </s:iterator>
    - *    </s:subset>
    - * 
    - * 
    - * - *
    - * 
    - * <!-- B: List with count -->
    - *    <s:subset source="myList" count="3">
    - * 	     <s:iterator>
    - * 		     <s:property />
    - * 	     </s:iterator>
    - *     </s:subset>
    - * 
    - * 
    - * - *
    - * 
    - * <!--  C: List with start -->
    - *      <s:subset source="myList" count="13" start="3">
    - * 	       <s:iterator>
    - * 		     <s:property />
    - * 	       </s:iterator>
    - *      </s:subset>
    - * 
    - * 
    - * - *
    - * 
    - * <!--  D: List with id -->
    - *      <s:subset id="mySubset" source="myList" count="13" start="3" />
    - *      <%
    - * 	        Iterator i = (Iterator) pageContext.getAttribute("mySubset");
    - *          while(i.hasNext()) {
    - *      %>
    - *      <%=i.next() %>
    - *      <%  } %>
    - * 
    - * 
    - * - *
    - * 
    - *  <!--  D: List with Decider -->
    - *      <s:subset source="myList" decider="myDecider">
    - * 	           <s:iterator>
    - *		            <s:property />
    - *	           </s:iterator>
    - *      </s:subset>
    - * 
    - * 
    - * - * - * @s.tag name="subset" tld-body-content="JSP" - * description="Takes an iterator and outputs a subset of it" - */ -public class SubsetIteratorTag extends StrutsBodyTagSupport { - - private static final long serialVersionUID = -6252696081713080102L; - - private static final Log _log = LogFactory.getLog(SubsetIteratorTag.class); - - String countAttr; - String sourceAttr; - String startAttr; - String deciderAttr; - - SubsetIteratorFilter subsetIteratorFilter = null; - - - /** - * @s.tagattribute required="false" type="Integer" - * description="Indicate the number of entries to be in the resulting subset iterator" - */ - public void setCount(String count) { - countAttr = count; - } - - /** - * @s.tagattribute required="false" - * description="Indicate the source of which the resulting subset iterator is to be derived base on" - */ - public void setSource(String source) { - sourceAttr = source; - } - - /** - * @s.tagattribute required="false" type="Integer" - * description="Indicate the starting index (eg. first entry is 0) of entries in the source to be available as the first entry in the resulting subset iterator" - */ - public void setStart(String start) { - startAttr = start; - } - - /** - * @s.tagattribute required="false" type="org.apache.struts2.util.SubsetIteratorFilter.Decider" - * description="Extension to plug-in a decider to determine if that particular entry is to be included in the resulting subset iterator" - */ - public void setDecider(String decider) { - deciderAttr = decider; - } - - - public int doStartTag() throws JspException { - - // source - Object source = null; - if (sourceAttr == null && sourceAttr.length() <= 0) { - source = findValue("top"); - } else { - source = findValue(sourceAttr); - } - - // count - int count = -1; - if (countAttr != null && countAttr.length() > 0) { - Object countObj = findValue(countAttr); - if (countObj instanceof Integer) { - count = ((Integer)countObj).intValue(); - } - else if (countObj instanceof Float) { - count = ((Float)countObj).intValue(); - } - else if (countObj instanceof Long) { - count = ((Long)countObj).intValue(); - } - else if (countObj instanceof Double) { - count = ((Long)countObj).intValue(); - } - else if (countObj instanceof String) { - try { - count = Integer.parseInt((String)countObj); - } - catch(NumberFormatException e) { - _log.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e); - } - } - } - - // start - int start = 0; - if (startAttr != null && startAttr.length() > 0) { - Object startObj = findValue(startAttr); - if (startObj instanceof Integer) { - start = ((Integer)startObj).intValue(); - } - else if (startObj instanceof Float) { - start = ((Float)startObj).intValue(); - } - else if (startObj instanceof Long) { - start = ((Long)startObj).intValue(); - } - else if (startObj instanceof Double) { - start = ((Long)startObj).intValue(); - } - else if (startObj instanceof String) { - try { - start = Integer.parseInt((String)startObj); - } - catch(NumberFormatException e) { - _log.warn("unable to convert count attribute ["+startObj+"] to number, ignore count attribute", e); - } - } - } - - // decider - Decider decider = null; - if (deciderAttr != null && deciderAttr.length() > 0) { - Object deciderObj = findValue(deciderAttr); - if (! (deciderObj instanceof Decider)) { - throw new JspException("decider found from stack ["+deciderObj+"] does not implement "+Decider.class); - } - decider = (Decider) deciderObj; - } - - - subsetIteratorFilter = new SubsetIteratorFilter(); - subsetIteratorFilter.setCount(count); - subsetIteratorFilter.setDecider(decider); - subsetIteratorFilter.setSource(source); - subsetIteratorFilter.setStart(start); - subsetIteratorFilter.execute(); - - getStack().push(subsetIteratorFilter); - if (getId() != null) { - pageContext.setAttribute(getId(), subsetIteratorFilter); - } - - return EVAL_BODY_INCLUDE; - } - - public int doEndTag() throws JspException { - - getStack().pop(); - - subsetIteratorFilter = null; - - return EVAL_PAGE; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/package.html b/trunk/core/src/main/java/org/apache/struts2/views/jsp/package.html deleted file mode 100644 index f17fa990b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/package.html +++ /dev/null @@ -1 +0,0 @@ -Struts's JSP tag library. diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java deleted file mode 100644 index f6feec829..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java +++ /dev/null @@ -1,36 +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.views.jsp.ui; - -import org.apache.struts2.components.ClosingUIBean; - -/** - */ -public abstract class AbstractClosingTag extends AbstractUITag { - protected String openTemplate; - - protected void populateParams() { - super.populateParams(); - - ((ClosingUIBean) component).setOpenTemplate(openTemplate); - } - - public void setOpenTemplate(String openTemplate) { - this.openTemplate = openTemplate; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java deleted file mode 100644 index 26d3d1c31..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java +++ /dev/null @@ -1,369 +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.views.jsp.ui; - -import org.apache.struts2.components.DoubleListUIBean; - - -/** - */ -public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { - - protected String doubleList; - protected String doubleListKey; - protected String doubleListValue; - protected String doubleName; - protected String doubleValue; - protected String formName; - - protected String emptyOption; - protected String headerKey; - protected String headerValue; - protected String multiple; - protected String size; - - protected String doubleId; - protected String doubleDisabled; - protected String doubleMultiple; - protected String doubleSize; - protected String doubleHeaderKey; - protected String doubleHeaderValue; - protected String doubleEmptyOption; - - protected String doubleCssClass; - protected String doubleCssStyle; - - protected String doubleOnclick; - protected String doubleOndblclick; - protected String doubleOnmousedown; - protected String doubleOnmouseup; - protected String doubleOnmouseover; - protected String doubleOnmousemove; - protected String doubleOnmouseout; - protected String doubleOnfocus; - protected String doubleOnblur; - protected String doubleOnkeypress; - protected String doubleOnkeydown; - protected String doubleOnkeyup; - protected String doubleOnselect; - protected String doubleOnchange; - - protected String doubleAccesskey; - - protected void populateParams() { - super.populateParams(); - - DoubleListUIBean bean = ((DoubleListUIBean) this.component); - bean.setDoubleList(doubleList); - bean.setDoubleListKey(doubleListKey); - bean.setDoubleListValue(doubleListValue); - bean.setDoubleName(doubleName); - bean.setDoubleValue(doubleValue); - bean.setFormName(formName); - - bean.setDoubleId(doubleId); - bean.setDoubleDisabled(doubleDisabled); - bean.setDoubleMultiple(doubleMultiple); - bean.setDoubleSize(doubleSize); - bean.setDoubleHeaderKey(doubleHeaderKey); - bean.setDoubleHeaderValue(doubleHeaderValue); - bean.setDoubleEmptyOption(doubleEmptyOption); - - bean.setDoubleCssClass(doubleCssClass); - bean.setDoubleCssStyle(doubleCssStyle); - - bean.setDoubleOnclick(doubleOnclick); - bean.setDoubleOndblclick(doubleOndblclick); - bean.setDoubleOnmousedown(doubleOnmousedown); - bean.setDoubleOnmouseup(doubleOnmouseup); - bean.setDoubleOnmouseover(doubleOnmouseover); - bean.setDoubleOnmousemove(doubleOnmousemove); - bean.setDoubleOnmouseout(doubleOnmouseout); - bean.setDoubleOnfocus(doubleOnfocus); - bean.setDoubleOnblur(doubleOnblur); - bean.setDoubleOnkeypress(doubleOnkeypress); - bean.setDoubleOnkeydown(doubleOnkeydown); - bean.setDoubleOnkeyup(doubleOnkeyup); - bean.setDoubleOnselect(doubleOnselect); - bean.setDoubleOnchange(doubleOnchange); - - bean.setDoubleAccesskey(doubleAccesskey); - - bean.setEmptyOption(emptyOption); - bean.setHeaderKey(headerKey); - bean.setHeaderValue(headerValue); - bean.setMultiple(multiple); - bean.setSize(size); - } - - public void setDoubleList(String list) { - this.doubleList = list; - } - - public void setDoubleListKey(String listKey) { - this.doubleListKey = listKey; - } - - public void setDoubleListValue(String listValue) { - this.doubleListValue = listValue; - } - - public void setDoubleName(String aName) { - doubleName = aName; - } - - public void setDoubleValue(String doubleValue) { - this.doubleValue = doubleValue; - } - - public void setFormName(String formName) { - this.formName = formName; - } - - public String getDoubleCssClass() { - return doubleCssClass; - } - - public void setDoubleCssClass(String doubleCssClass) { - this.doubleCssClass = doubleCssClass; - } - - public String getDoubleCssStyle() { - return doubleCssStyle; - } - - public void setDoubleCssStyle(String doubleCssStyle) { - this.doubleCssStyle = doubleCssStyle; - } - - public String getDoubleDisabled() { - return doubleDisabled; - } - - public void setDoubleDisabled(String doubleDisabled) { - this.doubleDisabled = doubleDisabled; - } - - public String getDoubleEmptyOption() { - return doubleEmptyOption; - } - - public void setDoubleEmptyOption(String doubleEmptyOption) { - this.doubleEmptyOption = doubleEmptyOption; - } - - public String getDoubleHeaderKey() { - return doubleHeaderKey; - } - - public void setDoubleHeaderKey(String doubleHeaderKey) { - this.doubleHeaderKey = doubleHeaderKey; - } - - public String getDoubleHeaderValue() { - return doubleHeaderValue; - } - - public void setDoubleHeaderValue(String doubleHeaderValue) { - this.doubleHeaderValue = doubleHeaderValue; - } - - public String getDoubleId() { - return doubleId; - } - - public void setDoubleId(String doubleId) { - this.doubleId = doubleId; - } - - public String getDoubleMultiple() { - return doubleMultiple; - } - - public void setDoubleMultiple(String doubleMultiple) { - this.doubleMultiple = doubleMultiple; - } - - public String getDoubleOnblur() { - return doubleOnblur; - } - - public void setDoubleOnblur(String doubleOnblur) { - this.doubleOnblur = doubleOnblur; - } - - public String getDoubleOnchange() { - return doubleOnchange; - } - - public void setDoubleOnchange(String doubleOnchange) { - this.doubleOnchange = doubleOnchange; - } - - public String getDoubleOnclick() { - return doubleOnclick; - } - - public void setDoubleOnclick(String doubleOnclick) { - this.doubleOnclick = doubleOnclick; - } - - public String getDoubleOndblclick() { - return doubleOndblclick; - } - - public void setDoubleOndblclick(String doubleOndblclick) { - this.doubleOndblclick = doubleOndblclick; - } - - public String getDoubleOnfocus() { - return doubleOnfocus; - } - - public void setDoubleOnfocus(String doubleOnfocus) { - this.doubleOnfocus = doubleOnfocus; - } - - public String getDoubleOnkeydown() { - return doubleOnkeydown; - } - - public void setDoubleOnkeydown(String doubleOnkeydown) { - this.doubleOnkeydown = doubleOnkeydown; - } - - public String getDoubleOnkeypress() { - return doubleOnkeypress; - } - - public void setDoubleOnkeypress(String doubleOnkeypress) { - this.doubleOnkeypress = doubleOnkeypress; - } - - public String getDoubleOnkeyup() { - return doubleOnkeyup; - } - - public void setDoubleOnkeyup(String doubleOnkeyup) { - this.doubleOnkeyup = doubleOnkeyup; - } - - public String getDoubleOnmousedown() { - return doubleOnmousedown; - } - - public void setDoubleOnmousedown(String doubleOnmousedown) { - this.doubleOnmousedown = doubleOnmousedown; - } - - public String getDoubleOnmousemove() { - return doubleOnmousemove; - } - - public void setDoubleOnmousemove(String doubleOnmousemove) { - this.doubleOnmousemove = doubleOnmousemove; - } - - public String getDoubleOnmouseout() { - return doubleOnmouseout; - } - - public void setDoubleOnmouseout(String doubleOnmouseout) { - this.doubleOnmouseout = doubleOnmouseout; - } - - public String getDoubleOnmouseover() { - return doubleOnmouseover; - } - - public void setDoubleOnmouseover(String doubleOnmouseover) { - this.doubleOnmouseover = doubleOnmouseover; - } - - public String getDoubleOnmouseup() { - return doubleOnmouseup; - } - - public void setDoubleOnmouseup(String doubleOnmouseup) { - this.doubleOnmouseup = doubleOnmouseup; - } - - public String getDoubleOnselect() { - return doubleOnselect; - } - - public void setDoubleOnselect(String doubleOnselect) { - this.doubleOnselect = doubleOnselect; - } - - public String getDoubleSize() { - return doubleSize; - } - - public void setDoubleSize(String doubleSize) { - this.doubleSize = doubleSize; - } - - public String getDoubleList() { - return doubleList; - } - - public String getDoubleListKey() { - return doubleListKey; - } - - public String getDoubleListValue() { - return doubleListValue; - } - - public String getDoubleName() { - return doubleName; - } - - public String getDoubleValue() { - return doubleValue; - } - - public String getFormName() { - return formName; - } - - public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } - - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } - - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } - - public void setMultiple(String multiple) { - this.multiple = multiple; - } - - public void setSize(String size) { - this.size = size; - } - - public void setDoubleAccesskey(String doubleAccesskey) { - this.doubleAccesskey = doubleAccesskey; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java deleted file mode 100644 index 372f93ecf..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java +++ /dev/null @@ -1,49 +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.views.jsp.ui; - -import org.apache.struts2.components.ListUIBean; - -/** - */ -public abstract class AbstractListTag extends AbstractUITag { - protected String list; - protected String listKey; - protected String listValue; - - protected void populateParams() { - super.populateParams(); - - ListUIBean listUIBean = ((ListUIBean) component); - listUIBean.setList(list); - listUIBean.setListKey(listKey); - listUIBean.setListValue(listValue); - } - - public void setList(String list) { - this.list = list; - } - - public void setListKey(String listKey) { - this.listKey = listKey; - } - - public void setListValue(String listValue) { - this.listValue = listValue; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java deleted file mode 100644 index db6ed4afe..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java +++ /dev/null @@ -1,34 +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.views.jsp.ui; - - -import org.apache.struts2.components.ListUIBean; - -/** - */ -public abstract class AbstractRequiredListTag extends AbstractListTag { - - protected void populateParams() { - super.populateParams(); - - ListUIBean listUIBean = (ListUIBean) component; - listUIBean.setThrowExceptionOnNullValueAttribute(true); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java deleted file mode 100644 index cf9dbe48e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java +++ /dev/null @@ -1,225 +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.views.jsp.ui; - -import org.apache.struts2.components.UIBean; -import org.apache.struts2.views.jsp.ComponentTagSupport; - - -/** - * Abstract base class for all UI tags. - * - */ -public abstract class AbstractUITag extends ComponentTagSupport { - protected String cssClass; - protected String cssStyle; - protected String title; - protected String disabled; - protected String label; - protected String labelPosition; - protected String requiredposition; - protected String name; - protected String required; - protected String tabindex; - protected String value; - protected String template; - protected String theme; - protected String templateDir; - protected String onclick; - protected String ondblclick; - protected String onmousedown; - protected String onmouseup; - protected String onmouseover; - protected String onmousemove; - protected String onmouseout; - protected String onfocus; - protected String onblur; - protected String onkeypress; - protected String onkeydown; - protected String onkeyup; - protected String onselect; - protected String onchange; - protected String accesskey; - - // tooltip attributes - protected String tooltip; - protected String tooltipConfig; - - - protected void populateParams() { - super.populateParams(); - - UIBean uiBean = (UIBean) component; - uiBean.setCssClass(cssClass); - uiBean.setCssClass(cssClass); - uiBean.setCssStyle(cssStyle); - uiBean.setTitle(title); - uiBean.setDisabled(disabled); - uiBean.setLabel(label); - uiBean.setLabelposition(labelPosition); - uiBean.setRequiredposition(requiredposition); - uiBean.setName(name); - uiBean.setRequired(required); - uiBean.setTabindex(tabindex); - uiBean.setValue(value); - uiBean.setTemplate(template); - uiBean.setTheme(theme); - uiBean.setTemplateDir(templateDir); - uiBean.setOnclick(onclick); - uiBean.setOndblclick(ondblclick); - uiBean.setOnmousedown(onmousedown); - uiBean.setOnmouseup(onmouseup); - uiBean.setOnmouseover(onmouseover); - uiBean.setOnmousemove(onmousemove); - uiBean.setOnmouseout(onmouseout); - uiBean.setOnfocus(onfocus); - uiBean.setOnblur(onblur); - uiBean.setOnkeypress(onkeypress); - uiBean.setOnkeydown(onkeydown); - uiBean.setOnkeyup(onkeyup); - uiBean.setOnselect(onselect); - uiBean.setOnchange(onchange); - uiBean.setTooltip(tooltip); - uiBean.setTooltipConfig(tooltipConfig); - uiBean.setAccesskey(accesskey); - } - - public void setCssClass(String cssClass) { - this.cssClass = cssClass; - } - - public void setCssStyle(String cssStyle) { - this.cssStyle = cssStyle; - } - - public void setTitle(String title) { - this.title = title; - } - - public void setDisabled(String disabled) { - this.disabled = disabled; - } - - public void setLabel(String label) { - this.label = label; - } - - public void setLabelposition(String labelPosition) { - this.labelPosition = labelPosition; - } - - public void setRequiredposition(String requiredPosition) { - this.requiredposition = requiredPosition; - } - - public void setName(String name) { - this.name = name; - } - - public void setRequired(String required) { - this.required = required; - } - - public void setTabindex(String tabindex) { - this.tabindex = tabindex; - } - - public void setValue(String value) { - this.value = value; - } - - public void setTemplateDir(String templateDir) { - this.templateDir = templateDir; - } - - public void setTemplate(String template) { - this.template = template; - } - - public void setTheme(String theme) { - this.theme = theme; - } - - public void setOnclick(String onclick) { - this.onclick = onclick; - } - - public void setOndblclick(String ondblclick) { - this.ondblclick = ondblclick; - } - - public void setOnmousedown(String onmousedown) { - this.onmousedown = onmousedown; - } - - public void setOnmouseup(String onmouseup) { - this.onmouseup = onmouseup; - } - - public void setOnmouseover(String onmouseover) { - this.onmouseover = onmouseover; - } - - public void setOnmousemove(String onmousemove) { - this.onmousemove = onmousemove; - } - - public void setOnmouseout(String onmouseout) { - this.onmouseout = onmouseout; - } - - public void setOnfocus(String onfocus) { - this.onfocus = onfocus; - } - - public void setOnblur(String onblur) { - this.onblur = onblur; - } - - public void setOnkeypress(String onkeypress) { - this.onkeypress = onkeypress; - } - - public void setOnkeydown(String onkeydown) { - this.onkeydown = onkeydown; - } - - public void setOnkeyup(String onkeyup) { - this.onkeyup = onkeyup; - } - - public void setOnselect(String onselect) { - this.onselect = onselect; - } - - public void setOnchange(String onchange) { - this.onchange = onchange; - } - - public void setTooltip(String tooltip) { - this.tooltip = tooltip; - } - - public void setTooltipConfig(String tooltipConfig) { - this.tooltipConfig = tooltipConfig; - } - - public void setAccesskey(String accesskey) { - this.accesskey = accesskey; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java deleted file mode 100644 index 020229830..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java +++ /dev/null @@ -1,40 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionError; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * ActionError Tag. - * - */ -public class ActionErrorTag extends AbstractUITag { - - private static final long serialVersionUID = -3710234378022378639L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionError(stack, req, res); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java deleted file mode 100644 index 54d6bd569..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java +++ /dev/null @@ -1,39 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionMessage; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * ActionMessage Tag. - * - */ -public class ActionMessageTag extends AbstractUITag { - - private static final long serialVersionUID = 243396927554182506L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionMessage(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java deleted file mode 100644 index 79f88b826..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java +++ /dev/null @@ -1,83 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Anchor; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Anchor - */ -public class AnchorTag extends AbstractClosingTag { - - private static final long serialVersionUID = -1034616578492431113L; - - protected String href; - protected String errorText; - protected String showErrorTransportText; - protected String notifyTopics; - protected String afterLoading; - protected String preInvokeJS; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Anchor(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - Anchor link = (Anchor) component; - - link.setHref(href); - link.setErrorText(errorText); - link.setShowErrorTransportText(showErrorTransportText); - link.setNotifyTopics(notifyTopics); - link.setAfterLoading(afterLoading); - link.setPreInvokeJS(preInvokeJS); - } - - public void setHref(String href) { - this.href = href; - } - - public void setErrorText(String errorText) { - this.errorText = errorText; - } - - public void setShowErrorTransportText(String showErrorTransportText) { - this.showErrorTransportText = showErrorTransportText; - } - - public void setNotifyTopics(String notifyTopics) { - this.notifyTopics = notifyTopics; - } - - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - public void setPreInvokeJS(String preInvokeJS) { - this.preInvokeJS = preInvokeJS; - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java deleted file mode 100644 index 610856829..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java +++ /dev/null @@ -1,39 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.CheckboxList; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see CheckboxList - */ -public class CheckboxListTag extends AbstractRequiredListTag { - - private static final long serialVersionUID = 4023034029558150010L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new CheckboxList(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java deleted file mode 100644 index 4bc493ca9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java +++ /dev/null @@ -1,51 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Checkbox; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Checkbox - */ -public class CheckboxTag extends AbstractUITag { - - private static final long serialVersionUID = -350752809266337636L; - - protected String fieldValue; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Checkbox(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - ((Checkbox) component).setFieldValue(fieldValue); - } - - public void setFieldValue(String aValue) { - this.fieldValue = aValue; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java deleted file mode 100644 index c699c0a39..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java +++ /dev/null @@ -1,80 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ComboBox; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ComboBox - */ -public class ComboBoxTag extends TextFieldTag { - - private static final long serialVersionUID = 3509392460170385605L; - - protected String list; - protected String listKey; - protected String listValue; - protected String headerKey; - protected String headerValue; - protected String emptyOption; - - public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } - - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } - - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } - - public void setListKey(String listKey) { - this.listKey = listKey; - } - - public void setListValue(String listValue) { - this.listValue = listValue; - } - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ComboBox(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - ((ComboBox) component).setList(list); - ((ComboBox) component).setListKey(listKey); - ((ComboBox) component).setListValue(listValue); - ((ComboBox) component).setHeaderKey(headerKey); - ((ComboBox) component).setHeaderValue(headerValue); - ((ComboBox) component).setEmptyOption(emptyOption); - } - - public void setList(String list) { - this.list = list; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java deleted file mode 100644 index 4aa464fba..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java +++ /dev/null @@ -1,38 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.GenericUIBean; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see GenericUIBean - */ -public class ComponentTag extends AbstractUITag { - - private static final long serialVersionUID = 5448365363044104731L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new GenericUIBean(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java deleted file mode 100644 index e10d92475..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java +++ /dev/null @@ -1,71 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.DatePicker; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see DatePicker - */ -public class DatePickerTag extends TextFieldTag { - - private static final long serialVersionUID = 4054114507143447232L; - - protected String format; - protected String dateIconPath; - protected String templatePath; - protected String templateCssPath; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new DatePicker(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - final DatePicker datePicker = (DatePicker) component; - datePicker.setFormat(format); - datePicker.setDateIconPath(dateIconPath); - datePicker.setTemplatePath(templatePath); - datePicker.setTemplateCssPath(templateCssPath); - } - - public void setFormat(String format) { - this.format = format; - } - - public void setDateIconPath(String dateIconPath) { - this.dateIconPath = dateIconPath; - } - - public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; - } - - public void setTemplateCssPath(String templateCsspath) { - this.templateCssPath = templateCsspath; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java deleted file mode 100644 index a49391c44..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.apache.struts2.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Debug; - -import com.opensymphony.xwork2.util.ValueStack; - -public class DebugTag extends AbstractUITag { - - private static final long serialVersionUID = 3487684841317160628L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Debug(stack, req, res); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java deleted file mode 100644 index 20ce6fcda..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java +++ /dev/null @@ -1,90 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Div; - -import com.opensymphony.xwork2.util.ValueStack; - -public class DivTag extends AbstractClosingTag { - - private static final long serialVersionUID = 5309231035916461758L; - - protected String href; - protected String updateFreq; - protected String delay="1"; - protected String loadingText; - protected String errorText; - protected String showErrorTransportText; - protected String listenTopics; - protected String afterLoading; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Div(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - Div div = (Div) component; - div.setHref(href); - div.setUpdateFreq(updateFreq); - div.setDelay(delay); - div.setLoadingText(loadingText); - div.setErrorText(errorText); - div.setShowErrorTransportText(showErrorTransportText); - div.setListenTopics(listenTopics); - div.setAfterLoading(afterLoading); - } - - public void setHref(String href) { - this.href = href; - } - - public void setUpdateFreq(String updateFreq) { - this.updateFreq = updateFreq; - } - - public void setDelay(String delay) { - this.delay = delay; - } - - public void setLoadingText(String loadingText) { - this.loadingText = loadingText; - } - - public void setErrorText(String errorText) { - this.errorText = errorText; - } - - public void setShowErrorTransportText(String showErrorTransportText) { - this.showErrorTransportText = showErrorTransportText; - } - - public void setListenTopics(String listenTopics) { - this.listenTopics = listenTopics; - } - - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java deleted file mode 100644 index 832ecae25..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java +++ /dev/null @@ -1,50 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.DoubleSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see DoubleSelect - */ -public class DoubleSelectTag extends AbstractDoubleListTag { - - private static final long serialVersionUID = 7426011596359509386L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new DoubleSelect(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - DoubleSelect doubleSelect = ((DoubleSelect) component); - doubleSelect.setEmptyOption(emptyOption); - doubleSelect.setHeaderKey(headerKey); - doubleSelect.setHeaderValue(headerValue); - doubleSelect.setMultiple(multiple); - doubleSelect.setSize(size); - - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java deleted file mode 100644 index ce4e86f01..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java +++ /dev/null @@ -1,39 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.FieldError; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * FieldError Tag. - */ -public class FieldErrorTag extends AbstractUITag { - - private static final long serialVersionUID = -182532967507726323L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new FieldError(stack, req, res); - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java deleted file mode 100644 index 75be076b4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java +++ /dev/null @@ -1,58 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.File; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see File - */ -public class FileTag extends AbstractUITag { - - private static final long serialVersionUID = -2154950640215144864L; - - protected String accept; - protected String size; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new File(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - File file = ((File) component); - file.setAccept(accept); - file.setSize(size); - } - - public void setAccept(String accept) { - this.accept = accept; - } - - public void setSize(String size) { - this.size = size; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java deleted file mode 100644 index 82aa83333..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java +++ /dev/null @@ -1,106 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Form; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Form - */ -public class FormTag extends AbstractClosingTag { - - private static final long serialVersionUID = 2792301046860819658L; - - protected String action; - protected String target; - protected String enctype; - protected String method; - protected String namespace; - protected String validate; - protected String onsubmit; - protected String portletMode; - protected String windowState; - protected String acceptcharset; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Form(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - Form form = ((Form) component); - form.setAction(action); - form.setTarget(target); - form.setEnctype(enctype); - form.setMethod(method); - form.setNamespace(namespace); - form.setValidate(validate); - form.setOnsubmit(onsubmit); - form.setPortletMode(portletMode); - form.setWindowState(windowState); - form.setAcceptcharset(acceptcharset); - } - - - public void setAction(String action) { - this.action = action; - } - - public void setTarget(String target) { - this.target = target; - } - - public void setEnctype(String enctype) { - this.enctype = enctype; - } - - public void setMethod(String method) { - this.method = method; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public void setValidate(String validate) { - this.validate = validate; - } - - public void setOnsubmit(String onsubmit) { - this.onsubmit = onsubmit; - } - - public void setPortletMode(String portletMode) { - this.portletMode = portletMode; - } - - public void setWindowState(String windowState) { - this.windowState = windowState; - } - - public void setAcceptcharset(String acceptcharset) { - this.acceptcharset = acceptcharset; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java deleted file mode 100644 index e7af7dbfd..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java +++ /dev/null @@ -1,63 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Head; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Head - */ -public class HeadTag extends AbstractUITag { - - private static final long serialVersionUID = 6876765769175246030L; - - private String calendarcss; - private String debug; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Head(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - if (calendarcss != null) { - ((Head) component).setCalendarcss(calendarcss); - } - if (debug != null) { - ((Head) component).setDebug(Boolean.valueOf(debug).booleanValue()); - } - } - - public String getCalendarcss() { - return calendarcss; - } - - public void setCalendarcss(String calendarcss) { - this.calendarcss = calendarcss; - } - - public void setDebug(String debug) { - this.debug = debug; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java deleted file mode 100644 index 45a9aa61c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java +++ /dev/null @@ -1,39 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Hidden; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Hidden - */ -public class HiddenTag extends AbstractUITag { - - private static final long serialVersionUID = -1124367972048371675L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Hidden(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java deleted file mode 100644 index 29052fd82..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java +++ /dev/null @@ -1,51 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Label; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Label - */ -public class LabelTag extends AbstractUITag { - - private static final long serialVersionUID = 4008321310097730458L; - - protected String forAttr; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Label(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - ((Label) component).setFor(forAttr); - } - - public void setFor(String aFor) { - this.forAttr = aFor; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java deleted file mode 100644 index f94b412b0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java +++ /dev/null @@ -1,45 +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.views.jsp.ui; - -import ognl.Ognl; -import ognl.OgnlException; - -import com.opensymphony.xwork2.util.OgnlUtil; - - -/** - */ -public class OgnlTool { - private static OgnlTool instance = new OgnlTool(); - - private OgnlTool() { - } - - public static OgnlTool getInstance() { - return instance; - } - - public Object findValue(String expr, Object context) { - try { - return Ognl.getValue(OgnlUtil.compile(expr), context); - } catch (OgnlException e) { - return null; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java deleted file mode 100644 index 9578f8d02..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java +++ /dev/null @@ -1,76 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.OptGroup; -import org.apache.struts2.views.jsp.ComponentTagSupport; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - */ -public class OptGroupTag extends ComponentTagSupport { - - private static final long serialVersionUID = 7367401003498678762L; - - protected String list; - protected String label; - protected String disabled; - protected String listKey; - protected String listValue; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptGroup(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - OptGroup optGroup = (OptGroup) component; - optGroup.setList(list); - optGroup.setLabel(label); - optGroup.setDisabled(disabled); - optGroup.setListKey(listKey); - optGroup.setListValue(listValue); - } - - public void setList(String list) { - this.list = list; - } - - public void setLabel(String label) { - this.label = label; - } - - public void setDisabled(String disabled) { - this.disabled = disabled; - } - - public void setListKey(String listKey) { - this.listKey = listKey; - } - - public void setListValue(String listValue) { - this.listValue = listValue; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java deleted file mode 100644 index c6e41640c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java +++ /dev/null @@ -1,225 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.OptionTransferSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * OptionTransferSelect jsp tag. - */ -public class OptionTransferSelectTag extends AbstractDoubleListTag { - - private static final long serialVersionUID = 250474334495763536L; - - protected String allowAddToLeft; - protected String allowAddToRight; - protected String allowAddAllToLeft; - protected String allowAddAllToRight; - protected String allowSelectAll; - protected String allowUpDownOnLeft; - protected String allowUpDownOnRight; - - protected String leftTitle; - protected String rightTitle; - - protected String buttonCssClass; - protected String buttonCssStyle; - - protected String addToLeftLabel; - protected String addToRightLabel; - protected String addAllToLeftLabel; - protected String addAllToRightLabel; - protected String selectAllLabel; - protected String leftUpLabel; - protected String leftDownLabel; - protected String rightUpLabel; - protected String rightDownLabel; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptionTransferSelect(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - OptionTransferSelect optionTransferSelect = (OptionTransferSelect) component; - optionTransferSelect.setAllowAddToLeft(allowAddToLeft); - optionTransferSelect.setAllowAddToRight(allowAddToRight); - optionTransferSelect.setAllowAddAllToLeft(allowAddAllToLeft); - optionTransferSelect.setAllowAddAllToRight(allowAddAllToRight); - optionTransferSelect.setAllowSelectAll(allowSelectAll); - optionTransferSelect.setAllowUpDownOnLeft(allowUpDownOnLeft); - optionTransferSelect.setAllowUpDownOnRight(allowUpDownOnRight); - - optionTransferSelect.setAddToLeftLabel(addToLeftLabel); - optionTransferSelect.setAddToRightLabel(addToRightLabel); - optionTransferSelect.setAddAllToLeftLabel(addAllToLeftLabel); - optionTransferSelect.setAddAllToRightLabel(addAllToRightLabel); - optionTransferSelect.setSelectAllLabel(selectAllLabel); - optionTransferSelect.setLeftUpLabel(leftUpLabel); - optionTransferSelect.setLeftDownLabel(leftDownLabel); - optionTransferSelect.setRightUpLabel(rightUpLabel); - optionTransferSelect.setRightDownLabel(rightDownLabel); - - optionTransferSelect.setButtonCssClass(buttonCssClass); - optionTransferSelect.setButtonCssStyle(buttonCssStyle); - - optionTransferSelect.setLeftTitle(leftTitle); - optionTransferSelect.setRightTitle(rightTitle); - } - - - public String getAddAllToLeftLabel() { - return addAllToLeftLabel; - } - - - public void setAddAllToLeftLabel(String addAllToLeftLabel) { - this.addAllToLeftLabel = addAllToLeftLabel; - } - - - public String getAddAllToRightLabel() { - return addAllToRightLabel; - } - - - public void setAddAllToRightLabel(String addAllToRightLabel) { - this.addAllToRightLabel = addAllToRightLabel; - } - - - public String getAddToLeftLabel() { - return addToLeftLabel; - } - - - public void setAddToLeftLabel(String addToLeftLabel) { - this.addToLeftLabel = addToLeftLabel; - } - - - public String getAddToRightLabel() { - return addToRightLabel; - } - - - public void setAddToRightLabel(String addToRightLabel) { - this.addToRightLabel = addToRightLabel; - } - - - public String getAllowAddAllToLeft() { - return allowAddAllToLeft; - } - - - public void setAllowAddAllToLeft(String allowAddAllToLeft) { - this.allowAddAllToLeft = allowAddAllToLeft; - } - - - public String getAllowAddAllToRight() { - return allowAddAllToRight; - } - - - public void setAllowAddAllToRight(String allowAddAllToRight) { - this.allowAddAllToRight = allowAddAllToRight; - } - - - public String getAllowAddToLeft() { - return allowAddToLeft; - } - - - public void setAllowAddToLeft(String allowAddToLeft) { - this.allowAddToLeft = allowAddToLeft; - } - - - public String getAllowAddToRight() { - return allowAddToRight; - } - - - public void setAllowAddToRight(String allowAddToRight) { - this.allowAddToRight = allowAddToRight; - } - - - public String getLeftTitle() { - return leftTitle; - } - - - public void setLeftTitle(String leftTitle) { - this.leftTitle = leftTitle; - } - - - public String getRightTitle() { - return rightTitle; - } - - - public void setRightTitle(String rightTitle) { - this.rightTitle = rightTitle; - } - - - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - public String getAllowSelectAll() { - return this.allowSelectAll; - } - - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } - - public String getSelectAllLabel() { - return this.selectAllLabel; - } - - public void setButtonCssClass(String buttonCssId) { - this.buttonCssClass = buttonCssId; - } - - public String getButtonCssClass() { - return buttonCssClass; - } - - public void setButtonCssStyle(String buttonCssStyle) { - this.buttonCssStyle = buttonCssStyle; - } - - public String getButtonCssStyle() { - return this.buttonCssStyle; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java deleted file mode 100644 index 67245f7aa..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java +++ /dev/null @@ -1,63 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Panel; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Panel - */ -public class PanelTag extends DivTag { - - private static final long serialVersionUID = -1698805503599998611L; - - protected String tabName; - protected String subscribeTopicName; - protected String remote; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Panel(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - Panel panel = ((Panel) component); - panel.setTabName(tabName); - panel.setSubscribeTopicName(subscribeTopicName); - panel.setRemote(remote); - } - - public void setTabName(String tabName) { - this.tabName = tabName; - } - - public void setSubscribeTopicName(String subscribeTopicName) { - this.subscribeTopicName = subscribeTopicName; - } - - public void setRemote(String remote) { - this.remote = remote; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java deleted file mode 100644 index f6ca252a8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java +++ /dev/null @@ -1,55 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Password; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Password - */ -public class PasswordTag extends TextFieldTag { - - private static final long serialVersionUID = 6802043323617377573L; - - protected String showPassword; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Password(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - ((Password) component).setShowPassword(showPassword); - } - - public void setShow(String showPassword) { - this.showPassword = showPassword; - } - - public void setShowPassword(String showPassword) { - this.showPassword = showPassword; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java deleted file mode 100644 index fdc1fe9a3..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java +++ /dev/null @@ -1,39 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Radio; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Radio - */ -public class RadioTag extends AbstractRequiredListTag { - - private static final long serialVersionUID = -6497403399521333624L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Radio(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java deleted file mode 100644 index af5459444..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java +++ /dev/null @@ -1,70 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Reset; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see org.apache.struts2.components.Reset - */ -public class ResetTag extends AbstractUITag { - - private static final long serialVersionUID = 4742704832277392108L; - - protected String action; - protected String method; - protected String align; - protected String type; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Reset(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - Reset reset = ((Reset) component); - reset.setAction(action); - reset.setMethod(method); - reset.setAlign(align); - reset.setType(type); - } - - public void setAction(String action) { - this.action = action; - } - - public void setMethod(String method) { - this.method = method; - } - - public void setAlign(String align) { - this.align = align; - } - - public void setType(String type) { - this.type = type; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java deleted file mode 100644 index 878865cfe..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java +++ /dev/null @@ -1,77 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Select; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Select - */ -public class SelectTag extends AbstractRequiredListTag { - - private static final long serialVersionUID = 6121715260335609618L; - - protected String emptyOption; - protected String headerKey; - protected String headerValue; - protected String multiple; - protected String size; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Select(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - Select select = ((Select) component); - select.setEmptyOption(emptyOption); - select.setHeaderKey(headerKey); - select.setHeaderValue(headerValue); - select.setMultiple(multiple); - select.setSize(size); - } - - public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } - - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } - - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } - - public void setMultiple(String multiple) { - this.multiple = multiple; - } - - public void setSize(String size) { - this.size = size; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java deleted file mode 100644 index da73a87b6..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java +++ /dev/null @@ -1,113 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Submit; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Submit - */ -public class SubmitTag extends AbstractUITag { - - private static final long serialVersionUID = 2179281109958301343L; - - protected String action; - protected String method; - protected String align; - protected String resultDivId; - protected String onLoadJS; - protected String notifyTopics; - protected String listenTopics; - protected String preInvokeJS; - protected String type; - protected String src; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Submit(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - Submit submit = ((Submit) component); - submit.setAction(action); - submit.setMethod(method); - submit.setAlign(align); - submit.setResultDivId(resultDivId); - submit.setOnLoadJS(onLoadJS); - submit.setNotifyTopics(notifyTopics); - submit.setListenTopics(listenTopics); - submit.setPreInvokeJS(preInvokeJS); - submit.setType(type); - submit.setSrc(src); - } - - public void setAction(String action) { - this.action = action; - } - - public void setMethod(String method) { - this.method = method; - } - - public void setAlign(String align) { - this.align = align; - } - - public void setResultDivId(String resultDivId) { - this.resultDivId = resultDivId; - } - - public void setOnLoadJS(String onLoadJS) { - this.onLoadJS = onLoadJS; - } - - public void setNotifyTopics(String notifyTopics) { - this.notifyTopics = notifyTopics; - } - - public void setListenTopics(String listenTopics) { - this.listenTopics = listenTopics; - } - - public void setPreInvokeJS(String preInvokeJS) { - this.preInvokeJS = preInvokeJS; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getSrc() { - return src; - } - - public void setSrc(String src) { - this.src = src; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java deleted file mode 100644 index eb8e65d2a..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java +++ /dev/null @@ -1,50 +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.views.jsp.ui; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Panel; -import org.apache.struts2.components.TabbedPanel; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TabbedPanel - */ -public class TabbedPanelTag extends AbstractClosingTag { - - private static final long serialVersionUID = -4719930205515386252L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TabbedPanel(stack, req, res); - } - - public List getTabs() { - return ((TabbedPanel) component).getTabs(); - } - - public void addTab(Panel pane) { - ((TabbedPanel) component).addTab(pane); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java deleted file mode 100644 index fcd69372f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java +++ /dev/null @@ -1,70 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TextField; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TextField - */ -public class TextFieldTag extends AbstractUITag { - - private static final long serialVersionUID = 5811285953670562288L; - - protected String maxlength; - protected String readonly; - protected String size; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TextField(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - TextField textField = ((TextField) component); - textField.setMaxlength(maxlength); - textField.setReadonly(readonly); - textField.setSize(size); - } - - /** - * @deprecated please use {@link #setMaxlength} instead - */ - public void setMaxLength(String maxlength) { - this.maxlength = maxlength; - } - - public void setMaxlength(String maxlength) { - this.maxlength = maxlength; - } - - public void setReadonly(String readonly) { - this.readonly = readonly; - } - - public void setSize(String size) { - this.size = size; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java deleted file mode 100644 index 7ad223913..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java +++ /dev/null @@ -1,71 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TextArea; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see TextArea - */ -public class TextareaTag extends AbstractUITag { - - private static final long serialVersionUID = -4107122506712927927L; - - protected String cols; - protected String readonly; - protected String rows; - protected String wrap; - - 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); - } - - public void setCols(String cols) { - this.cols = cols; - } - - public void setReadonly(String readonly) { - this.readonly = readonly; - } - - public void setRows(String rows) { - this.rows = rows; - } - - public void setWrap(String wrap) { - this.wrap = wrap; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java deleted file mode 100644 index 5d6e4af90..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java +++ /dev/null @@ -1,69 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TimePicker; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @version $Date$ $Id$ - */ -public class TimePickerTag extends TextFieldTag { - - private static final long serialVersionUID = 3527737048468381376L; - - protected String format; - protected String timeIconPath; - protected String templatePath; - protected String templateCssPath; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TimePicker(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - final TimePicker timePicker = (TimePicker) component; - timePicker.setFormat(format); - timePicker.setTimeIconPath(timeIconPath); - timePicker.setTemplatePath(templatePath); - timePicker.setTemplateCssPath(templateCssPath); - } - - public void setFormat(String format) { - this.format = format; - } - - public void setTimeIconPath(String timeIconPath) { - this.timeIconPath = timeIconPath; - } - - public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; - } - - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java deleted file mode 100644 index e3fdd9851..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java +++ /dev/null @@ -1,39 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Token; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see Token - */ -public class TokenTag extends AbstractUITag { - - private static final long serialVersionUID = 722480798151703457L; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Token(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java deleted file mode 100644 index 4020dcb1d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java +++ /dev/null @@ -1,53 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TreeNode; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TreeNode - */ -public class TreeNodeTag extends AbstractClosingTag { - - private static final long serialVersionUID = 7340746943017900803L; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TreeNode(stack,req,res); - } - - public void setLabel(String label) { - this.label = label; - } - - // NOTE: not necessary, label property is inherited, will be populated - // by super-class - /*protected void populateParams() { - if (label != null) { - TreeNode treeNode = (TreeNode)component; - treeNode.setLabel(label); - } - super.populateParams(); - }*/ -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java deleted file mode 100644 index be672bdc7..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java +++ /dev/null @@ -1,302 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Tree; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Tree - */ -public class TreeTag extends AbstractClosingTag { - - private static final long serialVersionUID = 2735218501058548013L; - - private String toggle; - private String treeSelectedTopic; - private String treeExpandedTopic; - private String treeCollapsedTopic; - private String rootNode; - private String childCollectionProperty; - private String nodeTitleProperty; - private String nodeIdProperty; - private String showRootGrid; - - private String showGrid; - private String blankIconSrc; - private String gridIconSrcL; - private String gridIconSrcV; - private String gridIconSrcP; - private String gridIconSrcC; - private String gridIconSrcX; - private String gridIconSrcY; - private String expandIconSrcPlus; - private String expandIconSrcMinus; - private String iconWidth; - private String iconHeight; - private String toggleDuration; - private String templateCssPath; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Tree(stack,req,res); - } - - protected void populateParams() { - super.populateParams(); - - Tree tree = (Tree) component; - if (childCollectionProperty != null) - tree.setChildCollectionProperty(childCollectionProperty); - if (nodeIdProperty != null) - tree.setNodeIdProperty(nodeIdProperty); - if (nodeTitleProperty != null) - tree.setNodeTitleProperty(nodeTitleProperty); - if (rootNode != null) - tree.setRootNode(rootNode); - if (toggle != null) - tree.setToggle(toggle); - if (treeCollapsedTopic != null) - tree.setTreeCollapsedTopic(treeCollapsedTopic); - if (treeExpandedTopic != null) - tree.setTreeExpandedTopic(treeExpandedTopic); - if (treeSelectedTopic != null) - tree.setTreeSelectedTopic(treeSelectedTopic); - if (showRootGrid != null) - tree.setShowRootGrid(showRootGrid); - - if (showGrid != null) - tree.setShowGrid(showGrid); - if (blankIconSrc != null) - tree.setBlankIconSrc(blankIconSrc); - if (gridIconSrcL != null) - tree.setGridIconSrcL(gridIconSrcC); - if (gridIconSrcV != null) - tree.setGridIconSrcV(gridIconSrcV); - if (gridIconSrcP != null) - tree.setGridIconSrcP(gridIconSrcP); - if (gridIconSrcC != null) - tree.setGridIconSrcC(gridIconSrcC); - if (gridIconSrcX != null) - tree.setGridIconSrcX(gridIconSrcX); - if (gridIconSrcY != null) - tree.setGridIconSrcY(gridIconSrcY); - if (expandIconSrcPlus != null) - tree.setExpandIconSrcPlus(expandIconSrcPlus); - if (expandIconSrcMinus != null) - tree.setExpandIconSrcMinus(expandIconSrcMinus); - if (iconWidth != null) - tree.setIconWidth(iconWidth); - if (iconHeight != null) - tree.setIconHeight(iconHeight); - if (toggleDuration != null) - tree.setToggleDuration(toggleDuration); - if (templateCssPath != null) - tree.setTemplateCssPath(templateCssPath); - } - - public String getToggle() { - return toggle; - } - - public void setToggle(String toggle) { - this.toggle = toggle; - } - - public String getTreeSelectedTopic() { - return treeSelectedTopic; - } - - public void setTreeSelectedTopic(String treeSelectedTopic) { - this.treeSelectedTopic = treeSelectedTopic; - } - - public String getTreeExpandedTopic() { - return treeExpandedTopic; - } - - public void setTreeExpandedTopic(String treeExpandedTopic) { - this.treeExpandedTopic = treeExpandedTopic; - } - - public String getTreeCollapsedTopic() { - return treeCollapsedTopic; - } - - public void setTreeCollapsedTopic(String treeCollapsedTopic) { - this.treeCollapsedTopic = treeCollapsedTopic; - } - - public String getRootNode() { - return rootNode; - } - - public void setRootNode(String rootNode) { - this.rootNode = rootNode; - } - - public String getChildCollectionProperty() { - return childCollectionProperty; - } - - public void setChildCollectionProperty(String childCollectionProperty) { - this.childCollectionProperty = childCollectionProperty; - } - - public String getNodeTitleProperty() { - return nodeTitleProperty; - } - - public void setNodeTitleProperty(String nodeTitleProperty) { - this.nodeTitleProperty = nodeTitleProperty; - } - - public String getNodeIdProperty() { - return nodeIdProperty; - } - - public void setNodeIdProperty(String nodeIdProperty) { - this.nodeIdProperty = nodeIdProperty; - } - - public String getShowRootGrid() { - return showRootGrid; - } - - public void setShowRootGrid(String showRootGrid) { - this.showRootGrid = showRootGrid; - } - - public String getBlankIconSrc() { - return blankIconSrc; - } - - public void setBlankIconSrc(String blankIconSrc) { - this.blankIconSrc = blankIconSrc; - } - - public String getExpandIconSrcMinus() { - return expandIconSrcMinus; - } - - public void setExpandIconSrcMinus(String expandIconSrcMinus) { - this.expandIconSrcMinus = expandIconSrcMinus; - } - - public String getExpandIconSrcPlus() { - return expandIconSrcPlus; - } - - public void setExpandIconSrcPlus(String expandIconSrcPlus) { - this.expandIconSrcPlus = expandIconSrcPlus; - } - - public String getGridIconSrcC() { - return gridIconSrcC; - } - - public void setGridIconSrcC(String gridIconSrcC) { - this.gridIconSrcC = gridIconSrcC; - } - - public String getGridIconSrcL() { - return gridIconSrcL; - } - - public void setGridIconSrcL(String gridIconSrcL) { - this.gridIconSrcL = gridIconSrcL; - } - - public String getGridIconSrcP() { - return gridIconSrcP; - } - - public void setGridIconSrcP(String gridIconSrcP) { - this.gridIconSrcP = gridIconSrcP; - } - - public String getGridIconSrcV() { - return gridIconSrcV; - } - - public void setGridIconSrcV(String gridIconSrcV) { - this.gridIconSrcV = gridIconSrcV; - } - - public String getGridIconSrcX() { - return gridIconSrcX; - } - - public void setGridIconSrcX(String gridIconSrcX) { - this.gridIconSrcX = gridIconSrcX; - } - - public String getGridIconSrcY() { - return gridIconSrcY; - } - - public void setGridIconSrcY(String gridIconSrcY) { - this.gridIconSrcY = gridIconSrcY; - } - - public String getIconHeight() { - return iconHeight; - } - - public void setIconHeight(String iconHeight) { - this.iconHeight = iconHeight; - } - - public String getIconWidth() { - return iconWidth; - } - - public void setIconWidth(String iconWidth) { - this.iconWidth = iconWidth; - } - - public String getTemplateCssPath() { - return templateCssPath; - } - - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } - - public String getToggleDuration() { - return toggleDuration; - } - - public void setToggleDuration(String toggleDuration) { - this.toggleDuration = toggleDuration; - } - - public String getShowGrid() { - return showGrid; - } - - public void setShowGrid(String showGrid) { - this.showGrid = showGrid; - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java deleted file mode 100644 index 3879901ff..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java +++ /dev/null @@ -1,120 +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.views.jsp.ui; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.UpDownSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see UpDownSelect - */ -public class UpDownSelectTag extends SelectTag { - - private static final long serialVersionUID = -8136573053799541353L; - - protected String allowMoveUp; - protected String allowMoveDown; - protected String allowSelectAll; - - protected String moveUpLabel; - protected String moveDownLabel; - protected String selectAllLabel; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new UpDownSelect(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - UpDownSelect c = (UpDownSelect) component; - - c.setAllowMoveUp(allowMoveUp); - c.setAllowMoveDown(allowMoveDown); - c.setAllowSelectAll(allowSelectAll); - - c.setMoveUpLabel(moveUpLabel); - c.setMoveDownLabel(moveDownLabel); - c.setSelectAllLabel(selectAllLabel); - - } - - - public String getAllowMoveUp() { - return allowMoveUp; - } - - public void setAllowMoveUp(String allowMoveUp) { - this.allowMoveUp = allowMoveUp; - } - - - - public String getAllowMoveDown() { - return allowMoveDown; - } - - public void setAllowMoveDown(String allowMoveDown) { - this.allowMoveDown = allowMoveDown; - } - - - - public String getAllowSelectAll() { - return allowSelectAll; - } - - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - - public String getMoveUpLabel() { - return moveUpLabel; - } - - public void setMoveUpLabel(String moveUpLabel) { - this.moveUpLabel = moveUpLabel; - } - - - - public String getMoveDownLabel() { - return moveDownLabel; - } - - public void setMoveDownLabel(String moveDownLabel) { - this.moveDownLabel = moveDownLabel; - } - - - - public String getSelectAllLabel() { - return selectAllLabel; - } - - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java b/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java deleted file mode 100644 index 6234723f1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java +++ /dev/null @@ -1,71 +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.views.jsp.ui.table; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.table.WebTable; -import org.apache.struts2.views.jsp.ui.ComponentTag; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * @see WebTable - */ -public class WebTableTag extends ComponentTag { - - private static final long serialVersionUID = 2978932111492397942L; - - protected String sortOrder; - protected String modelName; - protected boolean sortable; - protected int sortColumn; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new WebTable(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - WebTable table = (WebTable) component; - table.setSortOrder(sortOrder); - table.setSortable(sortable); - table.setModelName(modelName); - table.setSortOrder(sortOrder); - } - - public void setSortOrder(String sortOrder) { - this.sortOrder = sortOrder; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public void setSortable(boolean sortable) { - this.sortable = sortable; - } - - public void setSortColumn(int sortColumn) { - this.sortColumn = sortColumn; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java b/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java deleted file mode 100644 index e3cf24072..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java +++ /dev/null @@ -1,94 +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.views.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.util.StrutsUtil; -import org.apache.struts2.views.jsp.ui.OgnlTool; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * Value Stack's Context related Utilities. - * - */ -public class ContextUtil { - public static final String REQUEST = "request"; - public static final String REQUEST2 = "request"; - public static final String RESPONSE = "response"; - public static final String RESPONSE2 = "response"; - public static final String SESSION = "session"; - public static final String BASE = "base"; - public static final String STACK = "stack"; - public static final String OGNL = "ognl"; - public static final String STRUTS = "struts"; - public static final String ACTION = "action"; - - public static Map getStandardContext(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - HashMap map = new HashMap(); - map.put(REQUEST, req); - map.put(REQUEST2, req); - map.put(RESPONSE, res); - map.put(RESPONSE2, res); - map.put(SESSION, req.getSession(false)); - map.put(BASE, req.getContextPath()); - map.put(STACK, stack); - map.put(OGNL, OgnlTool.getInstance()); - map.put(STRUTS, new StrutsUtil(stack, req, res)); - - ActionInvocation invocation = (ActionInvocation) stack.getContext().get(ActionContext.ACTION_INVOCATION); - if (invocation != null) { - map.put(ACTION, invocation.getAction()); - } - return map; - } - - /** - * Return true if either Configuration's altSyntax is on or the stack context's useAltSyntax is on - * @param context stack's context - * @return boolean - */ - public static boolean isUseAltSyntax(Map context) { - // We didn't make altSyntax static cause, if so, struts.configuration.xml.reload will not work - // plus the Configuration implementation should cache the properties, which the framework's - // configuration implementation does - boolean altSyntax = "true".equals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX)); - return altSyntax ||( - (context.containsKey("useAltSyntax") && - context.get("useAltSyntax") != null && - "true".equals(context.get("useAltSyntax").toString()))); - } - - /** - * Returns a String for overriding the default templateSuffix if templateSuffix is on the stack - * @param context stack's context - * @return String - */ - public static String getTemplateSuffix(Map context) { - return context.containsKey("templateSuffix") ? (String) context.get("templateSuffix") : null; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java b/trunk/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java deleted file mode 100644 index a0f8fd1bc..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java +++ /dev/null @@ -1,35 +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.views.util; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts2.RequestUtils; - -/** - */ -public class ResourceUtil { - public static String getResourceBase(HttpServletRequest req) { - String path = RequestUtils.getServletPath(req); - if (path == null || "".equals(path)) { - return ""; - } - - return path.substring(0, path.lastIndexOf('/')); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/util/TextUtil.java b/trunk/core/src/main/java/org/apache/struts2/views/util/TextUtil.java deleted file mode 100644 index 21d5c99a1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/util/TextUtil.java +++ /dev/null @@ -1,242 +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.views.util; - - -/** - * This class handles HTML escaping of text. - * It was written and optimized to be as fast as possible. - * - */ -public class TextUtil { - - protected static final int MAX_LENGTH = 300; - - /** - * We use arrays of char in the lookup table because it is faster - * appending this to a StringBuffer than appending a String - */ - protected static final char[][] _stringChars = new char[MAX_LENGTH][]; - - static { - // Initialize the mapping table - initMapping(); - } - - - /** - * Call escapeHTML(s, false) - */ - public static final String escapeHTML(String s) { - return escapeHTML(s, false); - } - - /** - * Escape HTML. - * - * @param s string to be escaped - * @param escapeEmpty if true, then empty string will be escaped. - */ - public static final String escapeHTML(String s, boolean escapeEmpty) { - int len = s.length(); - - if (len == 0) { - return s; - } - - if (!escapeEmpty) { - String trimmed = s.trim(); - - if ((trimmed.length() == 0) || ("\"\"").equals(trimmed)) { - return s; - } - } - - int i = 0; - - // First loop through String and check if escaping is needed at all - // No buffers are copied at this time - do { - int index = s.charAt(i); - - if (index >= MAX_LENGTH) { - if (index != 0x20AC) { // If not euro symbol - - continue; - } - - break; - } else if (_stringChars[index] != null) { - break; - } - } while (++i < len); - - // If the check went to the end with no escaping then i should be == len now - // otherwise we must continue escaping for real - if (i == len) { - return s; - } - - // We found a character to escape and broke out at position i - // Now copy all characters before that to StringBuffer sb - // Since a char[] will be used for copying we might as well get - // a complete copy of it so that we can use array indexing instead of charAt - StringBuffer sb = new StringBuffer(len + 40); - char[] chars = new char[len]; - - // Copy all chars from the String s to the chars buffer - s.getChars(0, len, chars, 0); - - // Append the first i characters that we have checked to the resulting StringBuffer - sb.append(chars, 0, i); - - int last = i; - char[] subst; - - for (; i < len; i++) { - char c = chars[i]; - int index = c; - - if (index < MAX_LENGTH) { - subst = _stringChars[index]; - - // It is faster to append a char[] than a String which is why we use this - if (subst != null) { - if (i > last) { - sb.append(chars, last, i - last); - } - - sb.append(subst); - last = i + 1; - } - } - // Check if it is the euro symbol. This could be changed to check in a second lookup - // table in case one wants to convert more characters in that area - else if (index == 0x20AC) { - if (i > last) { - sb.append(chars, last, i - last); - } - - sb.append("€"); - last = i + 1; - } - } - - if (i > last) { - sb.append(chars, last, i - last); - } - - return sb.toString(); - } - - protected static void addMapping(int c, String txt, String[] strings) { - strings[c] = txt; - } - - protected static void initMapping() { - String[] strings = new String[MAX_LENGTH]; - - addMapping(0x22, """, strings); // " - addMapping(0x26, "&", strings); // & - addMapping(0x3c, "<", strings); // < - addMapping(0x3e, ">", strings); // > - - addMapping(0xa1, "¡", strings); // - addMapping(0xa2, "¢", strings); // - addMapping(0xa3, "£", strings); // - addMapping(0xa9, "©", strings); // � - addMapping(0xae, "®", strings); // � - addMapping(0xbf, "¿", strings); // - - addMapping(0xc0, "À", strings); // � - addMapping(0xc1, "Á", strings); // � - addMapping(0xc2, "Â", strings); // � - addMapping(0xc3, "Ã", strings); // � - addMapping(0xc4, "Ä", strings); // � - addMapping(0xc5, "Å", strings); // � - addMapping(0xc6, "Æ", strings); // � - addMapping(0xc7, "Ç", strings); // � - addMapping(0xc8, "È", strings); // - addMapping(0xc9, "É", strings); // - addMapping(0xca, "Ê", strings); // - addMapping(0xcb, "Ë", strings); // - addMapping(0xcc, "Ì", strings); // - addMapping(0xcd, "Í", strings); // - addMapping(0xce, "Î", strings); // - addMapping(0xcf, "Ï", strings); // - - addMapping(0xd0, "Ð", strings); // - addMapping(0xd1, "Ñ", strings); // - addMapping(0xd2, "Ò", strings); // - addMapping(0xd3, "Ó", strings); // - addMapping(0xd4, "Ô", strings); // - addMapping(0xd5, "Õ", strings); // - addMapping(0xd6, "Ö", strings); // � - addMapping(0xd7, "×", strings); // - addMapping(0xd8, "Ø", strings); // - addMapping(0xd9, "Ù", strings); // - addMapping(0xda, "Ú", strings); // - addMapping(0xdb, "Û", strings); // - addMapping(0xdc, "Ü", strings); // - addMapping(0xdd, "Ý", strings); // - addMapping(0xde, "Þ", strings); // - addMapping(0xdf, "ß", strings); // - - addMapping(0xe0, "à", strings); // - addMapping(0xe1, "á", strings); // - addMapping(0xe2, "â", strings); // - addMapping(0xe3, "ã", strings); // - addMapping(0xe4, "ä", strings); // � - addMapping(0xe5, "å", strings); // � - addMapping(0xe6, "æ", strings); // - addMapping(0xe7, "ç", strings); // - addMapping(0xe8, "è", strings); // - addMapping(0xe9, "é", strings); // - addMapping(0xea, "ê", strings); // - addMapping(0xeb, "ë", strings); // - addMapping(0xec, "ì", strings); // - addMapping(0xed, "í", strings); // - addMapping(0xee, "î", strings); // - addMapping(0xef, "ï", strings); // - - addMapping(0xf0, "ð", strings); // - addMapping(0xf1, "ñ", strings); // - addMapping(0xf2, "ò", strings); // - addMapping(0xf3, "ó", strings); // - addMapping(0xf4, "ô", strings); // - addMapping(0xf5, "õ", strings); // - addMapping(0xf6, "ö", strings); // � - addMapping(0xf7, "÷", strings); // - addMapping(0xf8, "ø", strings); // - addMapping(0xf9, "ù", strings); // - addMapping(0xfa, "ú", strings); // - addMapping(0xfb, "û", strings); // - addMapping(0xfc, "ü", strings); // - addMapping(0xfd, "ý", strings); // - addMapping(0xfe, "þ", strings); // - addMapping(0xff, "ÿ", strings); // - - for (int i = 0; i < strings.length; i++) { - String str = strings[i]; - - if (str != null) { - _stringChars[i] = str.toCharArray(); - } - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java b/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java deleted file mode 100644 index 75f81cf79..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java +++ /dev/null @@ -1,307 +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.views.util; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.TextParseUtil; -import com.opensymphony.xwork2.util.ValueStack; -import com.opensymphony.xwork2.util.XWorkContinuationConfig; - - -/** - * UrlHelper - * - */ -public class UrlHelper { - private static final Log LOG = LogFactory.getLog(UrlHelper.class); - - /** - * Default HTTP port (80). - */ - private static final int DEFAULT_HTTP_PORT = 80; - - /** - * Default HTTPS port (443). - */ - private static final int DEFAULT_HTTPS_PORT = 443; - - private static final String AMP = "&"; - - public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params) { - return buildUrl(action, request, response, params, null, true, true); - } - - public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params, String scheme, boolean includeContext, boolean encodeResult) { - return buildUrl(action, request, response, params, scheme, includeContext, encodeResult, false); - } - - public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params, String scheme, boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort) { - StringBuffer link = new StringBuffer(); - - boolean changedScheme = false; - - int httpPort = DEFAULT_HTTP_PORT; - - try { - httpPort = Integer.parseInt((String) Settings.get(StrutsConstants.STRUTS_URL_HTTP_PORT)); - } catch (Exception ex) { - } - - int httpsPort = DEFAULT_HTTPS_PORT; - - try { - httpsPort = Integer.parseInt((String) Settings.get(StrutsConstants.STRUTS_URL_HTTPS_PORT)); - } catch (Exception ex) { - } - - // only append scheme if it is different to the current scheme *OR* - // if we explicity want it to be appended by having forceAddSchemeHostAndPort = true - if (forceAddSchemeHostAndPort) { - String reqScheme = request.getScheme(); - changedScheme = true; - link.append(scheme != null ? scheme : reqScheme); - link.append("://"); - link.append(request.getServerName()); - - if ((scheme.equals("http") && (httpPort != DEFAULT_HTTP_PORT)) || (scheme.equals("https") && httpsPort != DEFAULT_HTTPS_PORT)) - { - link.append(":"); - link.append(scheme.equals("http") ? httpPort : httpsPort); - } - } - else if ( - (scheme != null) && !scheme.equals(request.getScheme())) { - changedScheme = true; - link.append(scheme); - link.append("://"); - link.append(request.getServerName()); - - if ((scheme.equals("http") && (httpPort != DEFAULT_HTTP_PORT)) || (scheme.equals("https") && httpsPort != DEFAULT_HTTPS_PORT)) - { - link.append(":"); - link.append(scheme.equals("http") ? httpPort : httpsPort); - } - } - - if (action != null) { - // Check if context path needs to be added - // Add path to absolute links - if (action.startsWith("/") && includeContext) { - String contextPath = request.getContextPath(); - if (!contextPath.equals("/")) { - link.append(contextPath); - } - } else if (changedScheme) { - - // (Applicable to Servlet 2.4 containers) - // If the request was forwarded, the attribute below will be set with the original URL - String uri = (String) request.getAttribute("javax.servlet.forward.request_uri"); - - // If the attribute wasn't found, default to the value in the request object - if (uri == null) { - uri = request.getRequestURI(); - } - - link.append(uri.substring(0, uri.lastIndexOf('/') + 1)); - } - - // Add page - link.append(action); - } else { - // Go to "same page" - String requestURI = (String) request.getAttribute("struts.request_uri"); - - // (Applicable to Servlet 2.4 containers) - // If the request was forwarded, the attribute below will be set with the original URL - if (requestURI == null) { - requestURI = (String) request.getAttribute("javax.servlet.forward.request_uri"); - } - - // If neither request attributes were found, default to the value in the request object - if (requestURI == null) { - requestURI = request.getRequestURI(); - } - - link.append(requestURI); - } - - // tie in the continuation parameter - String continueId = (String) ActionContext.getContext().get(XWorkContinuationConfig.CONTINUE_KEY); - if (continueId != null) { - if (params == null) { - params = Collections.singletonMap(XWorkContinuationConfig.CONTINUE_PARAM, continueId); - } else { - params.put(XWorkContinuationConfig.CONTINUE_PARAM, continueId); - } - } - - //if the action was not explicitly set grab the params from the request - buildParametersString(params, link); - - String result; - - try { - result = encodeResult ? response.encodeURL(link.toString()) : link.toString(); - } catch (Exception ex) { - // Could not encode the URL for some reason - // Use it unchanged - result = link.toString(); - } - - return result; - } - - public static void buildParametersString(Map params, StringBuffer link) { - buildParametersString(params, link, AMP); - } - - public static void buildParametersString(Map params, StringBuffer link, String paramSeparator) { - if ((params != null) && (params.size() > 0)) { - if (link.toString().indexOf("?") == -1) { - link.append("?"); - } else { - link.append(paramSeparator); - } - - // Set params - Iterator iter = params.entrySet().iterator(); - - String[] valueHolder = new String[1]; - - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - String name = (String) entry.getKey(); - Object value = entry.getValue(); - - String[] values; - - if (value instanceof String[]) { - values = (String[]) value; - } else { - valueHolder[0] = value.toString(); - values = valueHolder; - } - - for (int i = 0; i < values.length; i++) { - if (values[i] != null) { - link.append(name); - link.append('='); - link.append(translateAndEncode(values[i])); - } - - if (i < (values.length - 1)) { - link.append(paramSeparator); - } - } - - if (iter.hasNext()) { - link.append(paramSeparator); - } - } - } - } - - /** - * Translates any script expressions using {@link com.opensymphony.xwork2.util.TextParseUtil#translateVariables} and - * encodes the URL using {@link java.net.URLEncoder#encode} with the encoding specified in the configuration. - * - * @param input - * @return the translated and encoded string - */ - public static String translateAndEncode(String input) { - String translatedInput = translateVariable(input); - String encoding = getEncodingFromConfiguration(); - - try { - return URLEncoder.encode(translatedInput, encoding); - } catch (UnsupportedEncodingException e) { - LOG.warn("Could not encode URL parameter '" + input + "', returning value un-encoded"); - return translatedInput; - } - } - - public static String translateAndDecode(String input) { - String translatedInput = translateVariable(input); - String encoding = getEncodingFromConfiguration(); - - try { - return URLDecoder.decode(translatedInput, encoding); - } catch (UnsupportedEncodingException e) { - LOG.warn("Could not encode URL parameter '" + input + "', returning value un-encoded"); - return translatedInput; - } - } - - private static String translateVariable(String input) { - ValueStack valueStack = ServletActionContext.getContext().getValueStack(); - String output = TextParseUtil.translateVariables(input, valueStack); - return output; - } - - private static String getEncodingFromConfiguration() { - final String encoding; - if (Settings.isSet(StrutsConstants.STRUTS_I18N_ENCODING)) { - encoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - } else { - encoding = "UTF-8"; - } - return encoding; - } - - public static Map parseQueryString(String queryString) { - Map queryParams = new LinkedHashMap(); - if (queryString != null) { - String[] params = queryString.split("&"); - for (int a=0; a< params.length; a++) { - if (params[a].trim().length() > 0) { - String[] tmpParams = params[a].split("="); - String paramName = null; - String paramValue = ""; - if (tmpParams.length > 0) { - paramName = tmpParams[0]; - } - if (tmpParams.length > 1) { - paramValue = tmpParams[1]; - } - if (paramName != null) { - String translatedParamValue = translateAndDecode(paramValue); - queryParams.put(paramName, translatedParamValue); - } - } - } - } - return queryParams; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/util/package.html b/trunk/core/src/main/java/org/apache/struts2/views/util/package.html deleted file mode 100644 index 27945fae8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/util/package.html +++ /dev/null @@ -1 +0,0 @@ -Miscellaneous helper classes for all views. diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java deleted file mode 100644 index 59c909927..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java +++ /dev/null @@ -1,48 +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.views.velocity; - -import java.io.InputStream; - -import org.apache.struts2.util.ClassLoaderUtils; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; - - -/** - * Loads resource from the Thread's context ClassLoader. - * - */ -public class StrutsResourceLoader extends ClasspathResourceLoader { - - public synchronized InputStream getResourceStream(String name) throws ResourceNotFoundException { - if ((name == null) || (name.length() == 0)) { - throw new ResourceNotFoundException("No template name provided"); - } - - if (name.startsWith("/")) { - name = name.substring(1); - } - - try { - return ClassLoaderUtils.getResourceAsStream(name, StrutsResourceLoader.class); - } catch (Exception e) { - throw new ResourceNotFoundException(e.getMessage()); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java deleted file mode 100644 index e163c5337..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java +++ /dev/null @@ -1,112 +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.views.velocity; - -import org.apache.velocity.VelocityContext; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - */ -public class StrutsVelocityContext extends VelocityContext { - - private static final long serialVersionUID = 8497212428904436963L; - ValueStack stack; - VelocityContext[] chainedContexts; - - - public StrutsVelocityContext(ValueStack stack) { - this(null, stack); - } - - public StrutsVelocityContext(VelocityContext[] chainedContexts, ValueStack stack) { - this.chainedContexts = chainedContexts; - this.stack = stack; - } - - - public boolean internalContainsKey(Object key) { - boolean contains = super.internalContainsKey(key); - - // first let's check to see if we contain the requested key - if (contains) { - return true; - } - - // if not, let's search for the key in the ognl value stack - if (stack != null) { - Object o = stack.findValue(key.toString()); - - if (o != null) { - return true; - } - - o = stack.getContext().get(key.toString()); - if (o != null) { - return true; - } - } - - // if we still haven't found it, le's search through our chained contexts - if (chainedContexts != null) { - for (int index = 0; index < chainedContexts.length; index++) { - if (chainedContexts[index].containsKey(key)) { - return true; - } - } - } - - // nope, i guess it's really not here - return false; - } - - public Object internalGet(String key) { - // first, let's check to see if have the requested value - if (super.internalContainsKey(key)) { - return super.internalGet(key); - } - - // still no luck? let's look against the value stack - if (stack != null) { - Object object = stack.findValue(key); - - if (object != null) { - return object; - } - - object = stack.getContext().get(key); - if (object != null) { - return object; - } - - } - - // finally, if we're chained to other contexts, let's look in them - if (chainedContexts != null) { - for (int index = 0; index < chainedContexts.length; index++) { - if (chainedContexts[index].containsKey(key)) { - return chainedContexts[index].internalGet(key); - } - } - } - - // nope, i guess it's really not here - return null; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java deleted file mode 100644 index 7107561fe..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java +++ /dev/null @@ -1,135 +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.views.velocity; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.util.Properties; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspFactory; -import javax.servlet.jsp.PageContext; - -import org.apache.struts2.RequestUtils; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.config.Settings; -import org.apache.struts2.views.util.ContextUtil; -import org.apache.velocity.Template; -import org.apache.velocity.context.Context; -import org.apache.velocity.exception.MethodInvocationException; -import org.apache.velocity.exception.ParseErrorException; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.runtime.RuntimeSingleton; -import org.apache.velocity.servlet.VelocityServlet; - -import com.opensymphony.xwork2.ActionContext; - - -/** - * @deprecated please use {@link org.apache.struts2.dispatcher.VelocityResult} instead of direct access - */ -public class StrutsVelocityServlet extends VelocityServlet { - private static final long serialVersionUID = -2078492831396251182L; - private VelocityManager velocityManager; - - public StrutsVelocityServlet() { - velocityManager = VelocityManager.getInstance(); - } - - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - - // initialize our VelocityManager - velocityManager.init(servletConfig.getServletContext()); - } - - protected Context createContext(HttpServletRequest request, HttpServletResponse response) { - return velocityManager.createContext(ActionContext.getContext().getValueStack(), request, response); - } - - protected Template handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Context context) throws Exception { - String servletPath = (String) httpServletRequest.getAttribute("javax.servlet.include.servlet_path"); - - if (servletPath == null) { - servletPath = RequestUtils.getServletPath(httpServletRequest); - } - - return getTemplate(servletPath, getEncoding()); - } - - /** - * This method extends the VelocityServlet's loadConfiguration method by performing the following actions: - *
      - *
    • invokes VelocityServlet.loadConfiguration to create a properties object
    • - *
    • alters the RESOURCE_LOADER to include a class loader
    • - *
    • configures the class loader using the StrutsResourceLoader
    • - *
    - * - * @param servletConfig - * @throws IOException - * @throws FileNotFoundException - * @see org.apache.velocity.servlet.VelocityServlet#loadConfiguration - */ - protected Properties loadConfiguration(ServletConfig servletConfig) throws IOException, FileNotFoundException { - return velocityManager.loadConfiguration(servletConfig.getServletContext()); - } - - /** - * create a PageContext and render the template to PageContext.getOut() - * - * @see VelocityServlet#mergeTemplate(Template, Context, HttpServletResponse) for additional documentation - */ - protected void mergeTemplate(Template template, Context context, HttpServletResponse response) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, IOException, UnsupportedEncodingException, Exception { - // save the old PageContext - PageContext oldPageContext = ServletActionContext.getPageContext(); - - // create a new PageContext - JspFactory jspFactory = JspFactory.getDefaultFactory(); - HttpServletRequest request = (HttpServletRequest) context.get(ContextUtil.REQUEST); - PageContext pageContext = jspFactory.getPageContext(this, request, response, null, true, 8192, true); - - // put the new PageContext into ActionContext - ActionContext actionContext = ActionContext.getContext(); - actionContext.put(ServletActionContext.PAGE_CONTEXT, pageContext); - - try { - Writer writer = pageContext.getOut(); - template.merge(context, writer); - writer.flush(); - } finally { - // perform cleanup - jspFactory.releasePageContext(pageContext); - actionContext.put(ServletActionContext.PAGE_CONTEXT, oldPageContext); - } - } - - private String getEncoding() { - // todo look into converting this to using XWork/Struts encoding rules - try { - return Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - } catch (IllegalArgumentException e) { - return RuntimeSingleton.getString(RuntimeSingleton.OUTPUT_ENCODING, DEFAULT_OUTPUT_ENCODING); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java deleted file mode 100644 index 62477a8b9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java +++ /dev/null @@ -1,672 +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.views.velocity; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.StringTokenizer; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.StrutsConstants; -import org.apache.struts2.StrutsException; -import org.apache.struts2.config.Settings; -import org.apache.struts2.util.VelocityStrutsUtil; -import org.apache.struts2.views.jsp.ui.OgnlTool; -import org.apache.struts2.views.util.ContextUtil; -import org.apache.struts2.views.velocity.components.ActionDirective; -import org.apache.struts2.views.velocity.components.ActionErrorDirective; -import org.apache.struts2.views.velocity.components.ActionMessageDirective; -import org.apache.struts2.views.velocity.components.AnchorDirective; -import org.apache.struts2.views.velocity.components.BeanDirective; -import org.apache.struts2.views.velocity.components.CheckBoxDirective; -import org.apache.struts2.views.velocity.components.CheckBoxListDirective; -import org.apache.struts2.views.velocity.components.ComboBoxDirective; -import org.apache.struts2.views.velocity.components.ComponentDirective; -import org.apache.struts2.views.velocity.components.DateDirective; -import org.apache.struts2.views.velocity.components.DatePickerDirective; -import org.apache.struts2.views.velocity.components.DivDirective; -import org.apache.struts2.views.velocity.components.DoubleSelectDirective; -import org.apache.struts2.views.velocity.components.FieldErrorDirective; -import org.apache.struts2.views.velocity.components.FileDirective; -import org.apache.struts2.views.velocity.components.FormDirective; -import org.apache.struts2.views.velocity.components.HeadDirective; -import org.apache.struts2.views.velocity.components.HiddenDirective; -import org.apache.struts2.views.velocity.components.I18nDirective; -import org.apache.struts2.views.velocity.components.IncludeDirective; -import org.apache.struts2.views.velocity.components.LabelDirective; -import org.apache.struts2.views.velocity.components.OptionTransferSelectDirective; -import org.apache.struts2.views.velocity.components.PanelDirective; -import org.apache.struts2.views.velocity.components.ParamDirective; -import org.apache.struts2.views.velocity.components.PasswordDirective; -import org.apache.struts2.views.velocity.components.PropertyDirective; -import org.apache.struts2.views.velocity.components.PushDirective; -import org.apache.struts2.views.velocity.components.RadioDirective; -import org.apache.struts2.views.velocity.components.ResetDirective; -import org.apache.struts2.views.velocity.components.SelectDirective; -import org.apache.struts2.views.velocity.components.SetDirective; -import org.apache.struts2.views.velocity.components.SubmitDirective; -import org.apache.struts2.views.velocity.components.TabbedPanelDirective; -import org.apache.struts2.views.velocity.components.TextAreaDirective; -import org.apache.struts2.views.velocity.components.TextDirective; -import org.apache.struts2.views.velocity.components.TextFieldDirective; -import org.apache.struts2.views.velocity.components.TokenDirective; -import org.apache.struts2.views.velocity.components.TreeDirective; -import org.apache.struts2.views.velocity.components.TreeNodeDirective; -import org.apache.struts2.views.velocity.components.URLDirective; -import org.apache.struts2.views.velocity.components.UpDownSelectDirective; -import org.apache.struts2.views.velocity.components.WebTableDirective; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.context.Context; -import org.apache.velocity.tools.view.ToolboxManager; -import org.apache.velocity.tools.view.context.ChainedContext; -import org.apache.velocity.tools.view.servlet.ServletToolboxManager; - -import com.opensymphony.xwork2.ObjectFactory; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * Manages the environment for Velocity result types - * - */ -public class VelocityManager { - private static final Log log = LogFactory.getLog(VelocityManager.class); - private static VelocityManager instance; - public static final String STRUTS = "struts"; - - /** - * the parent JSP tag - */ - public static final String PARENT = "parent"; - - /** - * the current JSP tag - */ - public static final String TAG = "tag"; - - private VelocityEngine velocityEngine; - - /** - * A reference to the toolbox manager. - */ - protected ToolboxManager toolboxManager = null; - private String toolBoxLocation; - - - /** - * Names of contexts that will be chained on every request - */ - private String[] chainedContextNames; - - private Properties velocityProperties; - - protected VelocityManager() { - init(); - } - - /** - * retrieve an instance to the current VelocityManager - */ - public synchronized static VelocityManager getInstance() { - if (instance == null) { - String classname = VelocityManager.class.getName(); - - if (Settings.isSet(StrutsConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME)) { - classname = Settings.get(StrutsConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME).trim(); - } - - if (!classname.equals(VelocityManager.class.getName())) { - try { - log.info("Instantiating VelocityManager!, " + classname); - // singleton instances shouldn't be built accessing request or session-specific context data - instance = (VelocityManager) ObjectFactory.getObjectFactory().buildBean(classname, null); - } catch (Exception e) { - log.fatal("Fatal exception occurred while trying to instantiate a VelocityManager instance, " + classname, e); - instance = new VelocityManager(); - } - } else { - instance = new VelocityManager(); - } - } - - return instance; - } - - /** - * @return a reference to the VelocityEngine used by all struts velocity thingies with the exception of - * directly accessed *.vm pages - */ - public VelocityEngine getVelocityEngine() { - return velocityEngine; - } - - /** - * This method is responsible for creating the standard VelocityContext used by all WW2 velocity views. The - * following context parameters are defined: - *

    - *

      - *
    • request - the current HttpServletRequest
    • - *
    • response - the current HttpServletResponse
    • - *
    • stack - the current {@link ValueStack}
    • - *
    • ognl - an {@link OgnlTool}
    • - *
    • struts - an instance of {@link org.apache.struts2.util.StrutsUtil}
    • - *
    • action - the current Struts action
    • - *
    - * - * @return a new StrutsVelocityContext - */ - public Context createContext(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - VelocityContext[] chainedContexts = prepareChainedContexts(req, res, stack.getContext()); - StrutsVelocityContext context = new StrutsVelocityContext(chainedContexts, stack); - Map standardMap = ContextUtil.getStandardContext(stack, req, res); - for (Iterator iterator = standardMap.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - context.put((String) entry.getKey(), entry.getValue()); - } - context.put(STRUTS, new VelocityStrutsUtil(context, stack, req, res)); - - - ServletContext ctx = null; - try { - ctx = ServletActionContext.getServletContext(); - } catch (NullPointerException npe) { - // in case this was used outside the lifecycle of struts servlet - log.debug("internal toolbox context ignored"); - } - - if (toolboxManager != null && ctx != null) { - ChainedContext chained = new ChainedContext(context, req, res, ctx); - chained.setToolbox(toolboxManager.getToolboxContext(chained)); - return chained; - } else { - return context; - } - - } - - /** - * constructs contexts for chaining on this request. This method does not - * perform any initialization of the contexts. All that must be done in the - * context itself. - * - * @param servletRequest - * @param servletResponse - * @param extraContext - * @return an VelocityContext[] of contexts to chain - */ - protected VelocityContext[] prepareChainedContexts(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Map extraContext) { - if (this.chainedContextNames == null) { - return null; - } - List contextList = new ArrayList(); - for (int i = 0; i < chainedContextNames.length; i++) { - String className = chainedContextNames[i]; - try { - VelocityContext velocityContext = (VelocityContext) ObjectFactory.getObjectFactory().buildBean(className, null); - contextList.add(velocityContext); - } catch (Exception e) { - log.warn("Warning. " + e.getClass().getName() + " caught while attempting to instantiate a chained VelocityContext, " + className + " -- skipping"); - } - } - if (contextList.size() > 0) { - VelocityContext[] extraContexts = new VelocityContext[contextList.size()]; - contextList.toArray(extraContexts); - return extraContexts; - } else { - return null; - } - } - - /** - * initializes the VelocityManager. this should be called during the initialization process, say by - * ServletDispatcher. this may be called multiple times safely although calls beyond the first won't do anything - * - * @param context the current servlet context - */ - public synchronized void init(ServletContext context) { - if (velocityEngine == null) { - velocityEngine = newVelocityEngine(context); - } - this.initToolbox(context); - } - - /** - * load optional velocity properties using the following loading strategy - *
      - *
    • relative to the servlet context path
    • - *
    • relative to the WEB-INF directory
    • - *
    • on the classpath
    • - *
    - * - * @param context the current ServletContext. may not be null - * @return the optional properties if struts.velocity.configfile was specified, an empty Properties file otherwise - */ - public Properties loadConfiguration(ServletContext context) { - if (context == null) { - String gripe = "Error attempting to create a loadConfiguration from a null ServletContext!"; - log.error(gripe); - throw new IllegalArgumentException(gripe); - } - - Properties properties = new Properties(); - - // now apply our systemic defaults, then allow user to override - applyDefaultConfiguration(context, properties); - - - String defaultUserDirective = properties.getProperty("userdirective"); - - /** - * if the user has specified an external velocity configuration file, we'll want to search for it in the - * following order - * - * 1. relative to the context path - * 2. relative to /WEB-INF - * 3. in the class path - */ - String configfile; - - if (Settings.isSet(StrutsConstants.STRUTS_VELOCITY_CONFIGFILE)) { - configfile = Settings.get(StrutsConstants.STRUTS_VELOCITY_CONFIGFILE); - } else { - configfile = "velocity.properties"; - } - - configfile = configfile.trim(); - - InputStream in = null; - String resourceLocation = null; - - try { - if (context.getRealPath(configfile) != null) { - // 1. relative to context path, i.e. /velocity.properties - String filename = context.getRealPath(configfile); - - if (filename != null) { - File file = new File(filename); - - if (file.isFile()) { - resourceLocation = file.getCanonicalPath() + " from file system"; - in = new FileInputStream(file); - } - - // 2. if nothing was found relative to the context path, search relative to the WEB-INF directory - if (in == null) { - file = new File(context.getRealPath("/WEB-INF/" + configfile)); - - if (file.isFile()) { - resourceLocation = file.getCanonicalPath() + " from file system"; - in = new FileInputStream(file); - } - } - } - } - - // 3. finally, if there's no physical file, how about something in our classpath - if (in == null) { - in = VelocityManager.class.getClassLoader().getResourceAsStream(configfile); - if (in != null) { - resourceLocation = configfile + " from classloader"; - } - } - - // if we've got something, load 'er up - if (in != null) { - log.info("Initializing velocity using " + resourceLocation); - properties.load(in); - } - } catch (IOException e) { - log.warn("Unable to load velocity configuration " + resourceLocation, e); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } - } - - // overide with programmatically set properties - if (this.velocityProperties != null) { - Iterator keys = this.velocityProperties.keySet().iterator(); - while (keys.hasNext()) { - String key = (String) keys.next(); - properties.setProperty(key, this.velocityProperties.getProperty(key)); - } - } - - String userdirective = properties.getProperty("userdirective"); - - if ((userdirective == null) || userdirective.trim().equals("")) { - userdirective = defaultUserDirective; - } else { - userdirective = userdirective.trim() + "," + defaultUserDirective; - } - - properties.setProperty("userdirective", userdirective); - - - // for debugging purposes, allows users to dump out the properties that have been configured - if (log.isDebugEnabled()) { - log.debug("Initializing Velocity with the following properties ..."); - - for (Iterator iter = properties.keySet().iterator(); - iter.hasNext();) { - String key = (String) iter.next(); - String value = properties.getProperty(key); - - if (log.isDebugEnabled()) { - log.debug(" '" + key + "' = '" + value + "'"); - } - } - } - - return properties; - } - - /** - * performs one-time initializations - */ - protected void init() { - - // read in the names of contexts to add to each request - initChainedContexts(); - - - if (Settings.isSet(StrutsConstants.STRUTS_VELOCITY_TOOLBOXLOCATION)) { - toolBoxLocation = Settings.get(StrutsConstants.STRUTS_VELOCITY_TOOLBOXLOCATION).toString(); - } - - } - - - /** - * Initializes the ServletToolboxManager for this servlet's - * toolbox (if any). - */ - protected void initToolbox(ServletContext context) { - /* if we have a toolbox, get a manager for it */ - if (toolBoxLocation != null) { - toolboxManager = ServletToolboxManager.getInstance(context, toolBoxLocation); - } else { - Velocity.info("VelocityViewServlet: No toolbox entry in configuration."); - } - } - - - /** - * allow users to specify via the struts.properties file a set of additional VelocityContexts to chain to the - * the StrutsVelocityContext. The intent is to allow these contexts to store helper objects that the ui - * developer may want access to. Examples of reasonable VelocityContexts would be an IoCVelocityContext, a - * SpringReferenceVelocityContext, and a ToolboxVelocityContext - */ - protected void initChainedContexts() { - - if (Settings.isSet(StrutsConstants.STRUTS_VELOCITY_CONTEXTS)) { - // we expect contexts to be a comma separated list of classnames - String contexts = Settings.get(StrutsConstants.STRUTS_VELOCITY_CONTEXTS).toString(); - StringTokenizer st = new StringTokenizer(contexts, ","); - List contextList = new ArrayList(); - - while (st.hasMoreTokens()) { - String classname = st.nextToken(); - contextList.add(classname); - } - if (contextList.size() > 0) { - String[] chainedContexts = new String[contextList.size()]; - contextList.toArray(chainedContexts); - this.chainedContextNames = chainedContexts; - } - - - } - - } - - /** - *

    - * Instantiates a new VelocityEngine. - *

    - *

    - * The following is the default Velocity configuration - *

    - *
    -     *  resource.loader = file, class
    -     *  file.resource.loader.path = real path of webapp
    -     *  class.resource.loader.description = Velocity Classpath Resource Loader
    -     *  class.resource.loader.class = org.apache.struts2.views.velocity.StrutsResourceLoader
    -     * 
    - *

    - * this default configuration can be overridden by specifying a struts.velocity.configfile property in the - * struts.properties file. the specified config file will be searched for in the following order: - *

    - *
      - *
    • relative to the servlet context path
    • - *
    • relative to the WEB-INF directory
    • - *
    • on the classpath
    • - *
    - * - * @param context the current ServletContext. may not be null - */ - protected VelocityEngine newVelocityEngine(ServletContext context) { - if (context == null) { - String gripe = "Error attempting to create a new VelocityEngine from a null ServletContext!"; - log.error(gripe); - throw new IllegalArgumentException(gripe); - } - - Properties p = loadConfiguration(context); - - VelocityEngine velocityEngine = new VelocityEngine(); - - // Set the velocity attribute for the servlet context - // if this is not set the webapp loader WILL NOT WORK - velocityEngine.setApplicationAttribute(ServletContext.class.getName(), - context); - - try { - velocityEngine.init(p); - } catch (Exception e) { - String gripe = "Unable to instantiate VelocityEngine!"; - throw new StrutsException(gripe, e); - } - - return velocityEngine; - } - - /** - * once we've loaded up the user defined configurations, we will want to apply Struts specification configurations. - *
      - *
    • if Velocity.RESOURCE_LOADER has not been defined, then we will use the defaults which is a joined file, - * class loader for unpackaed wars and a straight class loader otherwise
    • - *
    • we need to define the various Struts custom user directives such as #param, #tag, and #bodytag
    • - *
    - * - * @param context - * @param p - */ - private void applyDefaultConfiguration(ServletContext context, Properties p) { - // ensure that caching isn't overly aggressive - - /** - * Load a default resource loader definition if there isn't one present. - * Ben Hall (22/08/2003) - */ - if (p.getProperty(Velocity.RESOURCE_LOADER) == null) { - p.setProperty(Velocity.RESOURCE_LOADER, "strutsfile, strutsclass"); - } - - /** - * If there's a "real" path add it for the strutsfile resource loader. - * If there's no real path and they haven't configured a loader then we change - * resource loader property to just use the strutsclass loader - * Ben Hall (22/08/2003) - */ - if (context.getRealPath("") != null) { - p.setProperty("strutsfile.resource.loader.description", "Velocity File Resource Loader"); - p.setProperty("strutsfile.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); - p.setProperty("strutsfile.resource.loader.path", context.getRealPath("")); - p.setProperty("strutsfile.resource.loader.modificationCheckInterval", "2"); - p.setProperty("strutsfile.resource.loader.cache", "true"); - } else { - // remove strutsfile from resource loader property - String prop = p.getProperty(Velocity.RESOURCE_LOADER); - if (prop.indexOf("strutsfile,") != -1) { - prop = replace(prop, "strutsfile,", ""); - } else if (prop.indexOf(", strutsfile") != -1) { - prop = replace(prop, ", strutsfile", ""); - } else if (prop.indexOf("strutsfile") != -1) { - prop = replace(prop, "strutsfile", ""); - } - - p.setProperty(Velocity.RESOURCE_LOADER, prop); - } - - /** - * Refactored the Velocity templates for the Struts taglib into the classpath from the web path. This will - * enable Struts projects to have access to the templates by simply including the Struts jar file. - * Unfortunately, there does not appear to be a macro for the class loader keywords - * Matt Ho - Mon Mar 17 00:21:46 PST 2003 - */ - p.setProperty("strutsclass.resource.loader.description", "Velocity Classpath Resource Loader"); - p.setProperty("strutsclass.resource.loader.class", "org.apache.struts2.views.velocity.StrutsResourceLoader"); - p.setProperty("strutsclass.resource.loader.modificationCheckInterval", "2"); - p.setProperty("strutsclass.resource.loader.cache", "true"); - - // components - StringBuffer sb = new StringBuffer(); - - addDirective(sb, ActionDirective.class); - addDirective(sb, BeanDirective.class); - addDirective(sb, CheckBoxDirective.class); - addDirective(sb, CheckBoxListDirective.class); - addDirective(sb, ComboBoxDirective.class); - addDirective(sb, ComponentDirective.class); - addDirective(sb, DateDirective.class); - addDirective(sb, DatePickerDirective.class); - addDirective(sb, DivDirective.class); - addDirective(sb, DoubleSelectDirective.class); - addDirective(sb, FileDirective.class); - addDirective(sb, FormDirective.class); - addDirective(sb, HeadDirective.class); - addDirective(sb, HiddenDirective.class); - addDirective(sb, AnchorDirective.class); - addDirective(sb, I18nDirective.class); - addDirective(sb, IncludeDirective.class); - addDirective(sb, LabelDirective.class); - addDirective(sb, PanelDirective.class); - addDirective(sb, ParamDirective.class); - addDirective(sb, PasswordDirective.class); - addDirective(sb, PushDirective.class); - addDirective(sb, PropertyDirective.class); - addDirective(sb, RadioDirective.class); - addDirective(sb, SelectDirective.class); - addDirective(sb, SetDirective.class); - addDirective(sb, SubmitDirective.class); - addDirective(sb, ResetDirective.class); - addDirective(sb, TabbedPanelDirective.class); - addDirective(sb, TextAreaDirective.class); - addDirective(sb, TextDirective.class); - addDirective(sb, TextFieldDirective.class); - addDirective(sb, TokenDirective.class); - addDirective(sb, TreeDirective.class); - addDirective(sb, TreeNodeDirective.class); - addDirective(sb, URLDirective.class); - addDirective(sb, WebTableDirective.class); - addDirective(sb, ActionErrorDirective.class); - addDirective(sb, ActionMessageDirective.class); - addDirective(sb, FieldErrorDirective.class); - addDirective(sb, OptionTransferSelectDirective.class); - addDirective(sb, UpDownSelectDirective.class); - - String directives = sb.toString(); - - String userdirective = p.getProperty("userdirective"); - if ((userdirective == null) || userdirective.trim().equals("")) { - userdirective = directives; - } else { - userdirective = userdirective.trim() + "," + directives; - } - - p.setProperty("userdirective", userdirective); - } - - private void addDirective(StringBuffer sb, Class clazz) { - sb.append(clazz.getName()).append(","); - } - - private static final String replace(String string, String oldString, String newString) { - if (string == null) { - return null; - } - // If the newString is null, just return the string since there's nothing to replace. - if (newString == null) { - return string; - } - int i = 0; - // Make sure that oldString appears at least once before doing any processing. - if ((i = string.indexOf(oldString, i)) >= 0) { - // Use char []'s, as they are more efficient to deal with. - char[] string2 = string.toCharArray(); - char[] newString2 = newString.toCharArray(); - int oLength = oldString.length(); - StringBuffer buf = new StringBuffer(string2.length); - buf.append(string2, 0, i).append(newString2); - i += oLength; - int j = i; - // Replace all remaining instances of oldString with newString. - while ((i = string.indexOf(oldString, i)) > 0) { - buf.append(string2, j, i - j).append(newString2); - i += oLength; - j = i; - } - buf.append(string2, j, string2.length - j); - return buf.toString(); - } - return string; - } - - /** - * @return the velocityProperties - */ - public Properties getVelocityProperties() { - return velocityProperties; - } - - /** - * @param velocityProperties the velocityProperties to set - */ - public void setVelocityProperties(Properties velocityProperties) { - this.velocityProperties = velocityProperties; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java deleted file mode 100644 index 633e00297..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java +++ /dev/null @@ -1,126 +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.views.velocity.components; - -import java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.components.Component; -import org.apache.velocity.context.InternalContextAdapter; -import org.apache.velocity.exception.MethodInvocationException; -import org.apache.velocity.exception.ParseErrorException; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.runtime.directive.Directive; -import org.apache.velocity.runtime.parser.node.Node; - -import com.opensymphony.xwork2.util.ValueStack; - -public abstract class AbstractDirective extends Directive { - public String getName() { - return "s" + getBeanName(); - } - - public abstract String getBeanName(); - - /** - * All components, unless otherwise stated, are LINE-level directives. - */ - public int getType() { - return LINE; - } - - protected abstract Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res); - - public boolean render(InternalContextAdapter ctx, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { - // get the bean - ValueStack stack = (ValueStack) ctx.get("stack"); - HttpServletRequest req = (HttpServletRequest) stack.getContext().get(ServletActionContext.HTTP_REQUEST); - HttpServletResponse res = (HttpServletResponse) stack.getContext().get(ServletActionContext.HTTP_RESPONSE); - Component bean = getBean(stack, req, res); - - // get the parameters - Map params = createPropertyMap(ctx, node); - bean.copyParams(params); - //bean.addAllParameters(params); - bean.start(writer); - - if (getType() == BLOCK) { - Node body = node.jjtGetChild(node.jjtGetNumChildren() - 1); - body.render(ctx, writer); - } - - bean.end(writer, ""); - return true; - } - - /** - * create a Map of properties that the user has passed in. for example, - *
    -     * #xxx("name=hello" "value=world" "template=foo")
    -     * 
    - * would yield a params that contains {["name", "hello"], ["value", "world"], ["template", "foo"]} - * - * @param node the Node passed in to the render method - * @return a Map of the user specified properties - * @throws org.apache.velocity.exception.ParseErrorException - * if the was an error in the format of the property - */ - protected Map createPropertyMap(InternalContextAdapter contextAdapter, Node node) throws ParseErrorException, MethodInvocationException { - Map propertyMap = new HashMap(); - - int children = node.jjtGetNumChildren(); - if (getType() == BLOCK) { - children--; - } - - for (int index = 0, length = children; index < length; index++) { - this.putProperty(propertyMap, contextAdapter, node.jjtGetChild(index)); - } - - return propertyMap; - } - - /** - * adds a given Node's key/value pair to the propertyMap. For example, if this Node contained the value "rows=20", - * then the key, rows, would be added to the propertyMap with the String value, 20. - * - * @param propertyMap a params containing all the properties that we wish to set - * @param node the parameter to set expressed in "name=value" format - */ - protected void putProperty(Map propertyMap, InternalContextAdapter contextAdapter, Node node) throws ParseErrorException, MethodInvocationException { - // node.value uses the StrutsValueStack to evaluate the directive's value parameter - String param = node.value(contextAdapter).toString(); - - int idx = param.indexOf("="); - - if (idx != -1) { - String property = param.substring(0, idx); - - String value = param.substring(idx + 1); - propertyMap.put(property, value); - } else { - throw new ParseErrorException("#" + this.getName() + " arguments must include an assignment operator! For example #tag( Component \"template=mytemplate\" ). #tag( TextField \"mytemplate\" ) is illegal!"); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java deleted file mode 100644 index a0b4eb112..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionComponent; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionComponent - */ -public class ActionDirective extends AbstractDirective { - public String getBeanName() { - return "action"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionComponent(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java deleted file mode 100644 index 435e1c85f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionError; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionError - */ -public class ActionErrorDirective extends AbstractDirective { - public String getBeanName() { - return "actionerror"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionError(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java deleted file mode 100644 index 0e56e7433..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ActionMessage; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ActionMessage - */ -public class ActionMessageDirective extends AbstractDirective { - public String getBeanName() { - return "actionmessage"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionMessage(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java deleted file mode 100644 index fbf9db252..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java +++ /dev/null @@ -1,43 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Anchor; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Anchor - */ -public class AnchorDirective extends AbstractDirective { - public String getBeanName() { - return "a"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Anchor(stack, req, res); - } - - public int getType() { - return BLOCK; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java deleted file mode 100644 index 38ca4bdca..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Bean; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Bean - */ -public class BeanDirective extends AbstractDirective { - public String getBeanName() { - return "bean"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Bean(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java deleted file mode 100644 index 664857bb8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Checkbox; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Checkbox - */ -public class CheckBoxDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Checkbox(stack, req, res); - } - - public String getBeanName() { - return "checkbox"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java deleted file mode 100644 index 1fb6fb896..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.CheckboxList; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see CheckboxList - */ -public class CheckBoxListDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new CheckboxList(stack, req, res); - } - - public String getBeanName() { - return "checkboxlist"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java deleted file mode 100644 index 124c4136f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.ComboBox; -import org.apache.struts2.components.Component; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see ComboBox - */ -public class ComboBoxDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ComboBox(stack, req, res); - } - - public String getBeanName() { - return "combobox"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java deleted file mode 100644 index 3d295d727..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java +++ /dev/null @@ -1,43 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.GenericUIBean; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see GenericUIBean - */ -public class ComponentDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new GenericUIBean(stack, req, res); - } - - public String getBeanName() { - return "component"; - } - - public int getType() { - return BLOCK; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java deleted file mode 100644 index 28ac7088e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java +++ /dev/null @@ -1,40 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Date; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * DateDirective - */ -public class DateDirective extends AbstractDirective { - - public String getBeanName() { - return "date"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Date(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java deleted file mode 100644 index 77aa7e227..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.DatePicker; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see DatePicker - */ -public class DatePickerDirective extends TextFieldDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new DatePicker(stack, req, res); - } - - public String getBeanName() { - return "datepicker"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java deleted file mode 100644 index 0a8da4927..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Div; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Div - */ -public class DivDirective extends AbstractDirective { - public String getBeanName() { - return "div"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Div(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java deleted file mode 100644 index 29015bebe..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.DoubleSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see DoubleSelect - */ -public class DoubleSelectDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new DoubleSelect(stack, req, res); - } - - public String getBeanName() { - return "doubleselect"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java deleted file mode 100644 index 799f1a8c8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.FieldError; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see FieldError - */ -public class FieldErrorDirective extends AbstractDirective { - public String getBeanName() { - return "fielderror"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new FieldError(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java deleted file mode 100644 index b4b7f0ba9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.File; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see File - */ -public class FileDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new File(stack, req, res); - } - - public String getBeanName() { - return "file"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java deleted file mode 100644 index 60361a787..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java +++ /dev/null @@ -1,43 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Form; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Form - */ -public class FormDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Form(stack, req, res); - } - - public String getBeanName() { - return "form"; - } - - public int getType() { - return BLOCK; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java deleted file mode 100644 index 974d264f2..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Head; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Head - */ -public class HeadDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Head(stack, req, res); - } - - public String getBeanName() { - return "head"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java deleted file mode 100644 index dd4a946f0..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Hidden; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Hidden - */ -public class HiddenDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Hidden(stack, req, res); - } - - public String getBeanName() { - return "hidden"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java deleted file mode 100644 index 922508fa9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.I18n; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see I18n - */ -public class I18nDirective extends AbstractDirective { - public String getBeanName() { - return "i18n"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new I18n(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java deleted file mode 100644 index 3219a0a92..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Include; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Include - */ -public class IncludeDirective extends AbstractDirective { - public String getBeanName() { - return "include"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Include(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java deleted file mode 100644 index 20c566579..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Label; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Label - */ -public class LabelDirective extends AbstractDirective { - public String getBeanName() { - return "label"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Label(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java deleted file mode 100644 index 36b4dae2d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java +++ /dev/null @@ -1,41 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.OptGroup; - -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * OptGroup velocity directive. - */ -public class OptGroupDirective extends AbstractDirective { - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptGroup(stack, req, res); - } - - public String getBeanName() { - return "optgroup"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java deleted file mode 100644 index 0ac1745aa..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java +++ /dev/null @@ -1,41 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.OptionTransferSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see OptionTransferSelect - */ -public class OptionTransferSelectDirective extends AbstractDirective { - - public String getBeanName() { - return "optiontransferselect"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptionTransferSelect(stack, req, res); - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java deleted file mode 100644 index f62239f87..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Panel; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Panel - */ -public class PanelDirective extends AbstractDirective { - public String getBeanName() { - return "panel"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Panel(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java deleted file mode 100644 index 7c0ef6da1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Param; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Param - */ -public class ParamDirective extends AbstractDirective { - public String getBeanName() { - return "param"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Param(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java deleted file mode 100644 index d9b396cda..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Password; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Password - */ -public class PasswordDirective extends AbstractDirective { - public String getBeanName() { - return "password"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Password(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java deleted file mode 100644 index 32913385d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java +++ /dev/null @@ -1,38 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Property; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - */ -public class PropertyDirective extends AbstractDirective { - public String getBeanName() { - return "property"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Property(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java deleted file mode 100644 index 91d533967..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Push; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Push - */ -public class PushDirective extends AbstractDirective { - public String getBeanName() { - return "push"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Push(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java deleted file mode 100644 index 14289cd31..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Radio; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Radio - */ -public class RadioDirective extends AbstractDirective { - public String getBeanName() { - return "radio"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Radio(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java deleted file mode 100644 index 73e62fac5..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Reset; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see org.apache.struts2.components.Reset - */ -public class ResetDirective extends AbstractDirective { - public String getBeanName() { - return "reset"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Reset(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java deleted file mode 100644 index cd57a2c67..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Select; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Select - */ -public class SelectDirective extends AbstractDirective { - public String getBeanName() { - return "select"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Select(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java deleted file mode 100644 index 2e9ce6717..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Set; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Set - */ -public class SetDirective extends AbstractDirective { - public String getBeanName() { - return "set"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Set(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java deleted file mode 100644 index 40b99c560..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Submit; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Submit - */ -public class SubmitDirective extends AbstractDirective { - public String getBeanName() { - return "submit"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Submit(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java deleted file mode 100644 index 9a256a4c1..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TabbedPanel; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TabbedPanel - */ -public class TabbedPanelDirective extends AbstractDirective { - public String getBeanName() { - return "tabbedpanel"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TabbedPanel(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java deleted file mode 100644 index 8315da596..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TextArea; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TextArea - */ -public class TextAreaDirective extends AbstractDirective { - public String getBeanName() { - return "textarea"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TextArea(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java deleted file mode 100644 index a3def019b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Text; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Text - */ -public class TextDirective extends AbstractDirective { - public String getBeanName() { - return "text"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Text(stack); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java deleted file mode 100644 index d1dcb028e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TextField; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see TextField - */ -public class TextFieldDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TextField(stack, req, res); - } - - public String getBeanName() { - return "textfield"; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java deleted file mode 100644 index 0002eec2c..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Token; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see Token - */ -public class TokenDirective extends AbstractDirective { - public String getBeanName() { - return "token"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Token(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java deleted file mode 100644 index bdcfb1e8d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java +++ /dev/null @@ -1,40 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.Tree; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * TreeDirective - * @see Tree - */ -public class TreeDirective extends AbstractDirective { - public String getBeanName() { - return "tree"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new Tree(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java deleted file mode 100644 index 3f6392c37..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java +++ /dev/null @@ -1,41 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.TreeNode; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * TreeNodeDirective - * @see TreeNode - */ -public class TreeNodeDirective extends AbstractDirective { - public String getBeanName() { - return "treenode"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TreeNode(stack, req, res); - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java deleted file mode 100644 index bed53d87e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.URL; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see URL - */ -public class URLDirective extends AbstractDirective { - public String getBeanName() { - return "url"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new URL(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java deleted file mode 100644 index d5cb969ea..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java +++ /dev/null @@ -1,41 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.UpDownSelect; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see UpDownSelect - * - */ -public class UpDownSelectDirective extends AbstractDirective { - - public String getBeanName() { - return "updownselect"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new UpDownSelect(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java b/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java deleted file mode 100644 index e9570f453..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java +++ /dev/null @@ -1,39 +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.views.velocity.components; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.components.Component; -import org.apache.struts2.components.table.WebTable; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @see WebTable - */ -public class WebTableDirective extends AbstractDirective { - public String getBeanName() { - return "table"; - } - - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new WebTable(stack, req, res); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/velocity/package.html b/trunk/core/src/main/java/org/apache/struts2/views/velocity/package.html deleted file mode 100644 index 82188fd64..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/velocity/package.html +++ /dev/null @@ -1 +0,0 @@ -Classes for views using Velocity. diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java deleted file mode 100644 index 5e5ed16c9..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java +++ /dev/null @@ -1,137 +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.views.xslt; - -import java.util.HashMap; -import java.util.Map; - -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.TypeInfo; - -/** - * AbstractAdapterElement extends the abstract Node type and implements - * the DOM Element interface. - */ -public abstract class AbstractAdapterElement extends AbstractAdapterNode implements Element { - - private Map attributeAdapters; - - public AbstractAdapterElement() { } - - public void setAttribute(String string, String string1) throws DOMException { - throw operationNotSupported(); - } - - protected Map getAttributeAdapters() { - if ( attributeAdapters == null ) - attributeAdapters = buildAttributeAdapters(); - return attributeAdapters; - } - - protected Map buildAttributeAdapters() { - return new HashMap(); - } - - /** - * No attributes, return empty attributes if asked. - */ - public String getAttribute(String string) { - return ""; - } - - public void setAttributeNS(String string, String string1, String string2) throws DOMException { - throw operationNotSupported(); - } - - public String getAttributeNS(String string, String string1) { - return null; - } - - public Attr setAttributeNode(Attr attr) throws DOMException { - throw operationNotSupported(); - } - - public Attr getAttributeNode( String name ) { - return (Attr)getAttributes().getNamedItem( name ); - } - - public Attr setAttributeNodeNS(Attr attr) throws DOMException { - throw operationNotSupported(); - } - - public Attr getAttributeNodeNS(String string, String string1) { - throw operationNotSupported(); - } - - public String getNodeName() { - return getTagName(); - } - - public short getNodeType() { - return Node.ELEMENT_NODE; - } - - public String getTagName() { - return getPropertyName(); - } - - public boolean hasAttribute(String string) { - return false; - } - - public boolean hasAttributeNS(String string, String string1) { - return false; - } - - public boolean hasChildNodes() { - return getElementsByTagName("*").getLength() > 0; - } - - public void removeAttribute(String string) throws DOMException { - throw operationNotSupported(); - } - - public void removeAttributeNS(String string, String string1) throws DOMException { - throw operationNotSupported(); - } - - public Attr removeAttributeNode(Attr attr) throws DOMException { - throw operationNotSupported(); - } - - public void setIdAttributeNode(Attr attr, boolean b) throws DOMException { - throw operationNotSupported(); - } - - public TypeInfo getSchemaTypeInfo() { - throw operationNotSupported(); - } - - public void setIdAttribute(String string, boolean b) throws DOMException { - throw operationNotSupported(); - } - - public void setIdAttributeNS(String string, String string1, boolean b) throws DOMException { - throw operationNotSupported(); - } - -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java deleted file mode 100644 index 5ce4f3cf8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java +++ /dev/null @@ -1,380 +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.views.xslt; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsException; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.UserDataHandler; - -/** - * AbstractAdapterNode is the base for childAdapters that expose a read-only view - * of a Java object as a DOM Node. This class implements the core parent-child - * and sibling node traversal functionality shared by all adapter type nodes - * and used in proxy node support. - * - * @see AbstractAdapterElement - */ -public abstract class AbstractAdapterNode implements AdapterNode { - - private static final NamedNodeMap EMPTY_NAMEDNODEMAP = - new NamedNodeMap() { - public int getLength() { - return 0; - } - - public Node item(int index) { - return null; - } - - public Node getNamedItem(String name) { - return null; - } - - public Node removeNamedItem(String name) throws DOMException { - return null; - } - - public Node setNamedItem(Node arg) throws DOMException { - return null; - } - - public Node setNamedItemNS(Node arg) throws DOMException { - return null; - } - - public Node getNamedItemNS(String namespaceURI, String localName) { - return null; - } - - public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { - return null; - } - }; - - private List childAdapters; - private Log log = LogFactory.getLog(this.getClass()); - - // The domain object that we are adapting - private Object propertyValue; - private String propertyName; - private AdapterNode parent; - private AdapterFactory adapterFactory; - - - public AbstractAdapterNode() { - if (LogFactory.getLog(getClass()).isDebugEnabled()) { - LogFactory.getLog(getClass()).debug("Creating " + this); - } - } - - /** - * - * @param adapterFactory - * @param parent - * @param propertyName - * @param value - */ - protected void setContext(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value) { - setAdapterFactory(adapterFactory); - setParent(parent); - setPropertyName(propertyName); - setPropertyValue(value); - } - - /** - * subclasses override to produce their children - * - * @return List of child adapters. - */ - protected List buildChildAdapters() { - return new ArrayList(); - } - - /** - * Lazily initialize child childAdapters - */ - protected List getChildAdapters() { - if (childAdapters == null) { - childAdapters = buildChildAdapters(); - } - return childAdapters; - } - - public Node getChildBeforeOrAfter(Node child, boolean before) { - log.debug("getChildBeforeOrAfter: "); - List adapters = getChildAdapters(); - log.debug("childAdapters = " + adapters); - log.debug("child = " + child); - int index = adapters.indexOf(child); - if (index < 0) - throw new StrutsException(child + " is no child of " + this); - int siblingIndex = before ? index - 1 : index + 1; - return ((0 < siblingIndex) && (siblingIndex < adapters.size())) ? - ((Node) adapters.get(siblingIndex)) : null; - } - - public Node getChildAfter(Node child) { - log.trace("getChildafter"); - return getChildBeforeOrAfter(child, false/*after*/); - } - - public Node getChildBefore(Node child) { - log.trace("getchildbefore"); - return getChildBeforeOrAfter(child, true/*after*/); - } - - public NodeList getElementsByTagName(String tagName) { - if (tagName.equals("*")) { - return getChildNodes(); - } else { - LinkedList filteredChildren = new LinkedList(); - - for (Node adapterNode : getChildAdapters()) { - if (adapterNode.getNodeName().equals(tagName)) { - filteredChildren.add(adapterNode); - } - } - - return new SimpleNodeList(filteredChildren); - } - } - - public NodeList getElementsByTagNameNS(String string, String string1) { - // TODO: - return null; - } - - // Begin Node methods - - public NamedNodeMap getAttributes() { - return EMPTY_NAMEDNODEMAP; - } - - public NodeList getChildNodes() { - NodeList nl = new SimpleNodeList(getChildAdapters()); - if (log.isDebugEnabled()) - log.debug("getChildNodes for tag: " - + getNodeName() + " num children: " + nl.getLength()); - return nl; - } - - public Node getFirstChild() { - return (getChildNodes().getLength() > 0) ? getChildNodes().item(0) : null; - } - - public Node getLastChild() { - return (getChildNodes().getLength() > 0) ? getChildNodes().item(getChildNodes().getLength() - 1) : null; - } - - - public String getLocalName() { - return null; - } - - public String getNamespaceURI() { - return null; - } - - public void setNodeValue(String string) throws DOMException { - throw operationNotSupported(); - } - - public String getNodeValue() throws DOMException { - throw operationNotSupported(); - } - - public Document getOwnerDocument() { - return null; - } - - public Node getParentNode() { - log.trace("getParentNode"); - return getParent(); - } - - public AdapterNode getParent() { - return parent; - } - - public void setParent(AdapterNode parent) { - this.parent = parent; - } - - public Object getPropertyValue() { - return propertyValue; - } - - public void setPropertyValue(Object prop) { - this.propertyValue = prop; - } - - public void setPrefix(String string) throws DOMException { - throw operationNotSupported(); - } - - public String getPrefix() { - return null; - } - - public Node getNextSibling() { - Node next = getParent().getChildAfter(this); - if (log.isTraceEnabled()) { - log.trace("getNextSibling on " + getNodeName() + ": " - + ((next == null) ? "null" : next.getNodeName())); - } - - return getParent().getChildAfter(this); - } - - public Node getPreviousSibling() { - return getParent().getChildBefore(this); - } - - public String getPropertyName() { - return propertyName; - } - - public void setPropertyName(String name) { - this.propertyName = name; - } - - public AdapterFactory getAdapterFactory() { - return adapterFactory; - } - - public void setAdapterFactory(AdapterFactory adapterFactory) { - this.adapterFactory = adapterFactory; - } - - public boolean isSupported(String string, String string1) { - throw operationNotSupported(); - } - - public Node appendChild(Node node) throws DOMException { - throw operationNotSupported(); - } - - public Node cloneNode(boolean b) { - log.trace("cloneNode"); - throw operationNotSupported(); - } - - public boolean hasAttributes() { - return false; - } - - public boolean hasChildNodes() { - return false; - } - - public Node insertBefore(Node node, Node node1) throws DOMException { - throw operationNotSupported(); - } - - public void normalize() { - log.trace("normalize"); - throw operationNotSupported(); - } - - public Node removeChild(Node node) throws DOMException { - throw operationNotSupported(); - } - - public Node replaceChild(Node node, Node node1) throws DOMException { - throw operationNotSupported(); - } - - // Begin DOM 3 methods - - public boolean isDefaultNamespace(String string) { - throw operationNotSupported(); - } - - public String lookupNamespaceURI(String string) { - throw operationNotSupported(); - } - - public String getNodeName() { - throw operationNotSupported(); - } - - public short getNodeType() { - throw operationNotSupported(); - } - - public String getBaseURI() { - throw operationNotSupported(); - } - - public short compareDocumentPosition(Node node) throws DOMException { - throw operationNotSupported(); - } - - public String getTextContent() throws DOMException { - throw operationNotSupported(); - } - - public void setTextContent(String string) throws DOMException { - throw operationNotSupported(); - - } - - public boolean isSameNode(Node node) { - throw operationNotSupported(); - } - - public String lookupPrefix(String string) { - throw operationNotSupported(); - } - - public boolean isEqualNode(Node node) { - throw operationNotSupported(); - } - - public Object getFeature(String string, String string1) { - throw operationNotSupported(); - } - - public Object setUserData(String string, Object object, UserDataHandler userDataHandler) { - throw operationNotSupported(); - } - - public Object getUserData(String string) { - throw operationNotSupported(); - } - - // End node methods - - protected StrutsException operationNotSupported() { - return new StrutsException("Operation not supported."); - } - - public String toString() { - return getClass() + ": " + getNodeName() + " parent=" + getParentNode(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java deleted file mode 100644 index f3cb037a4..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java +++ /dev/null @@ -1,239 +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.views.xslt; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.apache.struts2.StrutsException; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.Text; - -/** - * AdapterFactory produces Node adapters for Java object types. - * Adapter classes are generally instantiated dynamically via a no-args constructor - * and populated with their context information via the AdapterNode interface. - * - * This factory supports proxying of generic DOM Node trees, allowing arbitrary - * Node types to be mixed together. You may simply return a Document or Node - * type as an object property and it will appear as a sub-tree in the XML as - * you'd expect. See #proxyNode(). - * - * Customization of the result XML can be accomplished by providing - * alternate adapters for Java types. Adapters are associated with Java - * types through the registerAdapterType() method. - * - * For example, since there is no default Date adapter, Date objects will be - * rendered with the generic Bean introspecting adapter, producing output - * like: - *
    -     
    -        19
    -        1
    -        0
    -        7
    -        8
    -        4
    -        
    -        300
    -        105
    -    
    - * 
    - * - * By extending the StringAdapter and overriding its normal behavior we can - * create a custom Date formatter: - * - *
    -      public static class CustomDateAdapter extends StringAdapter {
    -        protected String getStringValue() {
    -            Date date = (Date)getPropertyValue();
    -            return DateFormat.getTimeInstance( DateFormat.FULL ).format( date );
    -        }
    -    }
    - * 
    - * - * Producing output like: - * -
    -     12:02:54 AM CDT
    - 
    - * - * The StringAdapter (which is normally invoked only to adapt String values) - * is a useful base for these kinds of customizations and can produce - * structured XML output as well as plain text by setting its parseStringAsXML() - * property to true. - * - * See provided examples. - */ -public class AdapterFactory { - - /** - * Map> - */ - private Map adapterTypes = new HashMap(); - - /** - * Register an adapter type for a Java class type. - * - * @param type the Java class type which is to be handled by the adapter. - * @param adapterType The adapter class, which implements AdapterNode. - */ - public void registerAdapterType(Class type, Class adapterType) { - adapterTypes.put(type, adapterType); - } - - /** - * Create a top level Document adapter for the specified Java object. - * The document will have a root element with the specified property name - * and contain the specified Java object content. - * - * @param propertyName The name of the root document element - * @return - * @throws IllegalAccessException - * @throws InstantiationException - */ - public Document adaptDocument(String propertyName, Object propertyValue) - throws IllegalAccessException, InstantiationException { - //if ( propertyValue instanceof Document ) - // return (Document)propertyValue; - - return new SimpleAdapterDocument(this, null, propertyName, propertyValue); - } - - - /** - * Create an Node adapter for a child element. - * Note that the parent of the created node must be an AdapterNode, however - * the child node itself may be any type of Node. - * - * @see #adaptDocument( String, Object ) - */ - public Node adaptNode(AdapterNode parent, String propertyName, Object value) { - Class adapterClass = getAdapterForValue(value); - if (adapterClass != null) - return constructAdapterInstance(adapterClass, parent, propertyName, value); - - // If the property is a Document, "unwrap" it to the root element - if (value instanceof Document) - value = ((Document) value).getDocumentElement(); - - // If the property is already a Node, proxy it - if (value instanceof Node) - return proxyNode(parent, (Node) value); - - // Check other supported types or default to generic JavaBean introspecting adapter - Class valueType = value.getClass(); - - if (valueType.isArray()) - adapterClass = ArrayAdapter.class; - else if (value instanceof String || value instanceof Number || valueType.isPrimitive()) - adapterClass = StringAdapter.class; - else if (value instanceof Collection) - adapterClass = CollectionAdapter.class; - else if (value instanceof Map) - adapterClass = MapAdapter.class; - else - adapterClass = BeanAdapter.class; - - return constructAdapterInstance(adapterClass, parent, propertyName, value); - } - - /** - * Construct a proxy adapter for a value that is an existing DOM Node. - * This allows arbitrary DOM Node trees to be mixed in with our results. - * The proxied nodes are read-only and currently support only - * limited types of Nodes including Element, Text, and Attributes. (Other - * Node types may be ignored by the proxy and not appear in the result tree). - *

    - * // TODO: - * NameSpaces are not yet supported. - *

    - * This method is primarily for use by the adapter node classes. - */ - public Node proxyNode(AdapterNode parent, Node node) { - // If the property is a Document, "unwrap" it to the root element - if (node instanceof Document) - node = ((Document) node).getDocumentElement(); - - if (node == null) - return null; - if (node.getNodeType() == Node.ELEMENT_NODE) - return new ProxyElementAdapter(this, parent, (Element) node); - if (node.getNodeType() == Node.TEXT_NODE) - return new ProxyTextNodeAdapter(this, parent, (Text) node); - if (node.getNodeType() == Node.ATTRIBUTE_NODE) - return new ProxyAttrAdapter(this, parent, (Attr) node); - - return null; // Unsupported Node type - ignore for now - } - - public NamedNodeMap proxyNamedNodeMap(AdapterNode parent, NamedNodeMap nnm) { - return new ProxyNamedNodeMap(this, parent, nnm); - } - - /** - * Create an instance of an adapter dynamically and set its context via - * the AdapterNode interface. - */ - private Node constructAdapterInstance(Class adapterClass, AdapterNode parent, String propertyName, Object propertyValue) { - // Check to see if the class has a no-args constructor - try { - adapterClass.getConstructor(new Class []{}); - } catch (NoSuchMethodException e1) { - throw new StrutsException("Adapter class: " + adapterClass - + " does not have a no-args consructor."); - } - - try { - AdapterNode adapterNode = (AdapterNode) adapterClass.newInstance(); - adapterNode.setAdapterFactory(this); - adapterNode.setParent(parent); - adapterNode.setPropertyName(propertyName); - adapterNode.setPropertyValue(propertyValue); - - return adapterNode; - - } catch (IllegalAccessException e) { - e.printStackTrace(); - throw new StrutsException("Cannot adapt " + propertyValue + " (" + propertyName + ") :" + e.getMessage()); - } catch (InstantiationException e) { - e.printStackTrace(); - throw new StrutsException("Cannot adapt " + propertyValue + " (" + propertyName + ") :" + e.getMessage()); - } - } - - /** - * Create an appropriate adapter for a null value. - * - * @param parent - * @param propertyName - */ - public Node adaptNullValue(BeanAdapter parent, String propertyName) { - return new StringAdapter(this, parent, propertyName, "null"); - } - - //TODO: implement Configuration option to provide additional adapter classes - public Class getAdapterForValue(Object value) { - return adapterTypes.get(value.getClass()); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java deleted file mode 100644 index fa6c70fc8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java +++ /dev/null @@ -1,75 +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.views.xslt; - -import org.w3c.dom.Node; - -/** - */ -public interface AdapterNode extends Node { - - /** - * The adapter factory that created this node. - */ - AdapterFactory getAdapterFactory(); - - /** - * The adapter factory that created this node. - */ - void setAdapterFactory(AdapterFactory factory); - - /** - * The parent adapter node of this node. Note that our parent must be another adapter node, but our children may be any - * kind of Node. - */ - AdapterNode getParent(); - - /** - * The parent adapter node of this node. Note that our parent must be another adapter node, but our children may be any - * kind of Node. - */ - void setParent(AdapterNode parent); - - /** - * The child node before the specified sibling - */ - Node getChildBefore(Node thisNode); - - /** - * The child node after the specified sibling - */ - Node getChildAfter(Node thisNode); - - /** - * The name of the Java object (property) that we are adapting - */ - String getPropertyName(); - - /** - * The name of the Java object (property) that we are adapting - */ - void setPropertyName(String name); - - /** - * The Java object (property) that we are adapting - */ - Object getPropertyValue(); - - /** The Java object (property) that we are adapting */ - void setPropertyValue(Object prop ); -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java deleted file mode 100644 index a434d63a8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java +++ /dev/null @@ -1,57 +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.views.xslt; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Node; - - -/** - */ -public class ArrayAdapter extends AbstractAdapterElement { - - private Log log = LogFactory.getLog(this.getClass()); - - public ArrayAdapter() { - } - - public ArrayAdapter(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value) { - setContext(adapterFactory, parent, propertyName, value); - } - - protected List buildChildAdapters() { - List children = new ArrayList(); - Object[] values = (Object[]) getPropertyValue(); - - for (Object value : values) { - Node childAdapter = getAdapterFactory().adaptNode(this, "item", value); - if (childAdapter != null) - children.add(childAdapter); - - if (log.isDebugEnabled()) { - log.debug(this + " adding adapter: " + childAdapter); - } - } - - return children; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java deleted file mode 100644 index 822c84d0d..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java +++ /dev/null @@ -1,172 +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.views.xslt; - -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.StrutsException; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - - -/** - * This class is the most general type of adapter, utilizing reflective introspection to present a DOM view of all of - * the public properties of its value. For example, a property returning a JavaBean such as: - * - *

    - * public Person getMyPerson() { ... }
    - * ...
    - * class Person {
    - * 		public String getFirstName();
    - * 		public String getLastName();
    - * }
    - * 
    - * - * would be rendered as: ... ... - */ -public class BeanAdapter extends AbstractAdapterElement { - //~ Static fields/initializers ///////////////////////////////////////////// - - private static final Object[] NULLPARAMS = new Object[0]; - - /** - * Cache can savely be static because the cached information is the same for all instances of this class. - */ - private static Map propertyDescriptorCache; - - //~ Instance fields //////////////////////////////////////////////////////// - - private Log log = LogFactory.getLog(this.getClass()); - - //~ Constructors /////////////////////////////////////////////////////////// - - public BeanAdapter() { - } - - public BeanAdapter( - AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value) { - setContext(adapterFactory, parent, propertyName, value); - } - - //~ Methods //////////////////////////////////////////////////////////////// - - public String getTagName() { - return getPropertyName(); - } - - public NodeList getChildNodes() { - NodeList nl = super.getChildNodes(); - // Log child nodes for debug: - if (log.isDebugEnabled() && nl != null) { - log.debug("BeanAdapter getChildNodes for: " + getTagName()); - log.debug(nl.toString()); - } - return nl; - } - - protected List buildChildAdapters() { - log.debug("BeanAdapter building children. PropName = " + getPropertyName()); - List newAdapters = new ArrayList(); - Class type = getPropertyValue().getClass(); - PropertyDescriptor[] props = getPropertyDescriptors(getPropertyValue()); - - if (props.length > 0) { - for (PropertyDescriptor prop : props) { - Method m = prop.getReadMethod(); - log.debug("Bean reading property method: " + m.getName()); - - if (m == null) { - //FIXME: write only property or indexed access - continue; - } - - String propertyName = prop.getName(); - Object propertyValue; - - /* - Unwrap any invocation target exceptions and log them. - We really need a way to control which properties are accessed. - Perhaps with annotations in Java5? - */ - try { - propertyValue = m.invoke(getPropertyValue(), NULLPARAMS); - } catch (Exception e) { - if (e instanceof InvocationTargetException) - e = (Exception) ((InvocationTargetException) e).getTargetException(); - log.error(e); - continue; - } - - Node childAdapter; - - if (propertyValue == null) { - childAdapter = getAdapterFactory().adaptNullValue(this, propertyName); - } else { - childAdapter = getAdapterFactory().adaptNode(this, propertyName, propertyValue); - } - - if (childAdapter != null) - newAdapters.add(childAdapter); - - if (log.isDebugEnabled()) { - log.debug(this + " adding adapter: " + childAdapter); - } - } - } else { - // No properties found - log.info( - "Class " + type.getName() + " has no readable properties, " + " trying to adapt " + getPropertyName() + " with StringAdapter..."); - } - - return newAdapters; - } - - /** - * Caching facade method to Introspector.getBeanInfo(Class, Class).getPropertyDescriptors(); - */ - private synchronized PropertyDescriptor[] getPropertyDescriptors(Object bean) { - try { - if (propertyDescriptorCache == null) { - propertyDescriptorCache = new HashMap(); - } - - PropertyDescriptor[] props = propertyDescriptorCache.get(bean.getClass()); - - if (props == null) { - log.debug("Caching property descriptor for " + bean.getClass().getName()); - props = Introspector.getBeanInfo(bean.getClass(), Object.class).getPropertyDescriptors(); - propertyDescriptorCache.put(bean.getClass(), props); - } - - return props; - } catch (IntrospectionException e) { - e.printStackTrace(); - throw new StrutsException("Error getting property descriptors for " + bean + " : " + e.getMessage()); - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java deleted file mode 100644 index 4fa7dc843..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java +++ /dev/null @@ -1,57 +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.views.xslt; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Node; - - -/** - */ -public class CollectionAdapter extends AbstractAdapterElement { - - private Log log = LogFactory.getLog(this.getClass()); - - public CollectionAdapter() { } - - public CollectionAdapter(AdapterFactory rootAdapterFactory, AdapterNode parent, String propertyName, Object value) { - setContext(rootAdapterFactory, parent, propertyName, value); - } - - protected List buildChildAdapters() { - Collection values = (Collection) getPropertyValue(); - List children = new ArrayList(values.size()); - - for (Object value : values) { - Node childAdapter = getAdapterFactory().adaptNode(this, "item", value); - if (childAdapter != null) - children.add(childAdapter); - - if (log.isDebugEnabled()) { - log.debug(this + " adding adapter: " + childAdapter); - } - } - - return children; - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java deleted file mode 100644 index 5c835940f..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java +++ /dev/null @@ -1,83 +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.views.xslt; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.w3c.dom.Node; - -/** - * MapAdapter adapters a java.util.Map type to an XML DOM with the following - * structure: - *
    - * 	
    - * 		
    - * 			...
    - * 			...
    - * 		
    - * 		...
    - * 	
    - * 
    - */ -public class MapAdapter extends AbstractAdapterElement { - - public MapAdapter() { } - - public MapAdapter(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Map value) { - setContext( adapterFactory, parent, propertyName, value ); - } - - public Map map() { - return (Map)getPropertyValue(); - } - - protected List buildChildAdapters() { - List children = new ArrayList(map().entrySet().size()); - - for (Object o : map().entrySet()) { - Map.Entry entry = (Map.Entry) o; - Object key = entry.getKey(); - Object value = entry.getValue(); - EntryElement child = new EntryElement( - getAdapterFactory(), this, "entry", key, value); - children.add(child); - } - - return children; - } - - class EntryElement extends AbstractAdapterElement { - Object key, value; - - public EntryElement( AdapterFactory adapterFactory, - AdapterNode parent, String propertyName, Object key, Object value ) { - setContext( adapterFactory, parent, propertyName, null/*we have two values*/ ); - this.key = key; - this.value = value; - } - - protected List buildChildAdapters() { - List children = new ArrayList(); - children.add( getAdapterFactory().adaptNode( this, "key", key ) ); - children.add( getAdapterFactory().adaptNode( this, "value", value ) ); - return children; - } - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java deleted file mode 100644 index 1e0e4c6eb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java +++ /dev/null @@ -1,82 +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.views.xslt; - -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Element; -import org.w3c.dom.TypeInfo; - -/** - * ProxyAttrAdapter is a pass-through adapter for objects which already - * implement the Attr interface. All methods are proxied to the underlying - * Node except node traversal (e.g. getParent()) related methods which - * are implemented by the abstract adapter node to work with the parent adapter. - */ -public class ProxyAttrAdapter extends ProxyNodeAdapter implements Attr { - - public ProxyAttrAdapter(AdapterFactory factory, AdapterNode parent, Attr value) { - super(factory, parent, value); - } - - // convenience - protected Attr attr() { - return (Attr) getPropertyValue(); - } - - // Proxied Attr methods - - public String getName() { - return attr().getName(); - } - - public boolean getSpecified() { - return attr().getSpecified(); - } - - public String getValue() { - return attr().getValue(); - } - - public void setValue(String string) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Element getOwnerElement() { - return (Element) getParent(); - } - - // DOM level 3 - - public TypeInfo getSchemaTypeInfo() { - throw operationNotSupported(); - } - - public boolean isId() { - throw operationNotSupported(); - } - - // end DOM level 3 - - // End Proxied Attr methods - - public String toString() { - return "ProxyAttribute for: " + attr(); - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java deleted file mode 100644 index c3a073f51..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java +++ /dev/null @@ -1,165 +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.views.xslt; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.TypeInfo; - -/** - * ProxyElementAdapter is a pass-through adapter for objects which already - * implement the Element interface. All methods are proxied to the underlying - * Node except getParent(), getNextSibling() and getPreviousSibling(), which - * are implemented by the abstract adapter node to work with the parent adapter. - * - * Note: this class wants to be (extend) both an AbstractElementAdapter - * and ProxyElementAdapter, but its proxy-ness is winning right now. - */ -public class ProxyElementAdapter extends ProxyNodeAdapter implements Element { - - private Log log = LogFactory.getLog(this.getClass()); - - public ProxyElementAdapter(AdapterFactory factory, AdapterNode parent, Element value) { - super(factory, parent, value); - } - - /** - * Get the proxied Element - */ - protected Element element() { - return (Element) getPropertyValue(); - } - - protected List buildChildAdapters() { - List adapters = new ArrayList(); - NodeList children = node().getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node child = children.item(i); - Node adapter = wrap(child); - if (adapter != null) { - log.debug("wrapped child node: " + child.getNodeName()); - adapters.add(adapter); - } - } - return adapters; - } - - // Proxied Element methods - - public String getTagName() { - return element().getTagName(); - } - - public boolean hasAttribute(String name) { - return element().hasAttribute(name); - } - - public String getAttribute(String name) { - return element().getAttribute(name); - } - - public boolean hasAttributeNS(String namespaceURI, String localName) { - return element().hasAttributeNS(namespaceURI, localName); - } - - public Attr getAttributeNode(String name) { - log.debug("wrapping attribute"); - return (Attr) wrap(element().getAttributeNode(name)); - } - - // I'm overriding this just for clarity. The base impl is correct. - public NodeList getElementsByTagName(String name) { - return super.getElementsByTagName(name); - } - - public String getAttributeNS(String namespaceURI, String localName) { - return element().getAttributeNS(namespaceURI, localName); - } - - public Attr getAttributeNodeNS(String namespaceURI, String localName) { - return (Attr) wrap(element().getAttributeNodeNS(namespaceURI, localName)); - } - - public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { - return super.getElementsByTagNameNS(namespaceURI, localName); - } - - // Unsupported mutators of Element - - public void removeAttribute(String name) throws DOMException { - throw new UnsupportedOperationException(); - } - - public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { - throw new UnsupportedOperationException(); - } - - public void setAttribute(String name, String value) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Attr removeAttributeNode(Attr oldAttr) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Attr setAttributeNode(Attr newAttr) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { - throw new UnsupportedOperationException(); - } - - public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { - throw new UnsupportedOperationException(); - } - - // end proxied Element methods - - // unsupported DOM level 3 methods - - public TypeInfo getSchemaTypeInfo() { - throw operationNotSupported(); - } - - public void setIdAttribute(String string, boolean b) throws DOMException { - throw operationNotSupported(); - } - - public void setIdAttributeNS(String string, String string1, boolean b) throws DOMException { - throw operationNotSupported(); - } - - public void setIdAttributeNode(Attr attr, boolean b) throws DOMException { - throw operationNotSupported(); - } - - // end DOM level 3 methods - - public String toString() { - return "ProxyElement for: " + element(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java deleted file mode 100644 index fd3166b62..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java +++ /dev/null @@ -1,78 +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.views.xslt; - -import org.w3c.dom.DOMException; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * A NamedNodeMap that wraps the Nodes returned in their proxies. - * - * Note: Since maps have no guaranteed order we don't need to worry about identity - * here as we do with "child" adapters. In that case we need to preserve identity - * in order to support finding the next/previous siblings. - */ -public class ProxyNamedNodeMap implements NamedNodeMap { - - private NamedNodeMap nodes; - private AdapterFactory adapterFactory; - private AdapterNode parent; - - public ProxyNamedNodeMap(AdapterFactory factory, AdapterNode parent, NamedNodeMap nodes) { - this.nodes = nodes; - this.adapterFactory = factory; - this.parent = parent; - } - - protected Node wrap(Node node) { - return adapterFactory.proxyNode(parent, node); - } - - public int getLength() { - return nodes.getLength(); - } - - public Node item(int index) { - return wrap(nodes.item(index)); - } - - public Node getNamedItem(String name) { - return wrap(nodes.getNamedItem(name)); - } - - public Node removeNamedItem(String name) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Node setNamedItem(Node arg) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Node setNamedItemNS(Node arg) throws DOMException { - throw new UnsupportedOperationException(); - } - - public Node getNamedItemNS(String namespaceURI, String localName) { - return wrap(nodes.getNamedItemNS(namespaceURI, localName)); - } - - public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { - throw new UnsupportedOperationException(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java deleted file mode 100644 index 247c42aab..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java +++ /dev/null @@ -1,131 +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.views.xslt; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.DOMException; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * ProxyNodeAdapter is a read-only delegating adapter for objects which already - * implement the Node interface. All methods are proxied to the underlying - * Node except getParent(), getNextSibling() and getPreviousSibling(), which - * are implemented by the abstract adapter node to work with the parent adapter. - */ -public abstract class ProxyNodeAdapter extends AbstractAdapterNode { - - private Log log = LogFactory.getLog(this.getClass()); - - public ProxyNodeAdapter(AdapterFactory factory, AdapterNode parent, Node value) { - setContext(factory, parent, "document"/*propname unused*/, value); - log.debug("proxied node is: " + value); - log.debug("node class is: " + value.getClass()); - log.debug("node type is: " + value.getNodeType()); - log.debug("node name is: " + value.getNodeName()); - } - - /** - * Get the proxied Node value - */ - protected Node node() { - return (Node) getPropertyValue(); - } - - /** - * Get and adapter to wrap the proxied node. - * - * @param node - */ - protected Node wrap(Node node) { - return getAdapterFactory().proxyNode(this, node); - } - - protected NamedNodeMap wrap(NamedNodeMap nnm) { - return getAdapterFactory().proxyNamedNodeMap(this, nnm); - } - //protected NodeList wrap( NodeList nl ) { } - - //protected Node unwrap( Node child ) { - // return ((ProxyNodeAdapter)child).node(); - //} - - // Proxied Node methods - - public String getNodeName() { - log.trace("getNodeName"); - return node().getNodeName(); - } - - public String getNodeValue() throws DOMException { - log.trace("getNodeValue"); - return node().getNodeValue(); - } - - public short getNodeType() { - if (log.isTraceEnabled()) - log.trace("getNodeType: " + getNodeName() + ": " + node().getNodeType()); - return node().getNodeType(); - } - - public NamedNodeMap getAttributes() { - NamedNodeMap nnm = wrap(node().getAttributes()); - if (log.isTraceEnabled()) - log.trace("getAttributes: " + nnm); - return nnm; - } - - public boolean hasChildNodes() { - log.trace("hasChildNodes"); - return node().hasChildNodes(); - } - - public boolean isSupported(String s, String s1) { - log.trace("isSupported"); - // Is this ok? What kind of features are they asking about? - return node().isSupported(s, s1); - } - - public String getNamespaceURI() { - log.trace("getNamespaceURI"); - return node().getNamespaceURI(); - } - - public String getPrefix() { - log.trace("getPrefix"); - return node().getPrefix(); - } - - public String getLocalName() { - log.trace("getLocalName"); - return node().getLocalName(); - } - - public boolean hasAttributes() { - log.trace("hasAttributes"); - return node().hasAttributes(); - } - - // End proxied Node methods - - public String toString() { - return "ProxyNode for: " + node(); - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java deleted file mode 100644 index 0fc9cccb8..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java +++ /dev/null @@ -1,94 +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.views.xslt; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Text; - -/** - * ProxyTextNodeAdapter is a pass-through adapter for objects which already - * implement the Text interface. All methods are proxied to the underlying - * Node except getParent(), getNextSibling() and getPreviousSibling(), which - * are implemented by the abstract adapter node to work with the parent adapter. - */ -public class ProxyTextNodeAdapter extends ProxyNodeAdapter implements Text { - - public ProxyTextNodeAdapter(AdapterFactory factory, AdapterNode parent, Text value) { - super(factory, parent, value); - } - - // convenience - Text text() { - return (Text) getPropertyValue(); - } - - public String toString() { - return "ProxyTextNode for: " + text(); - } - - public Text splitText(int offset) throws DOMException { - throw new UnsupportedOperationException(); - } - - public int getLength() { - return text().getLength(); - } - - public void deleteData(int offset, int count) throws DOMException { - throw new UnsupportedOperationException(); - } - - public String getData() throws DOMException { - return text().getData(); - } - - public String substringData(int offset, int count) throws DOMException { - return text().substringData(offset, count); - } - - public void replaceData(int offset, int count, String arg) throws DOMException { - throw new UnsupportedOperationException(); - } - - public void insertData(int offset, String arg) throws DOMException { - throw new UnsupportedOperationException(); - } - - public void appendData(String arg) throws DOMException { - throw new UnsupportedOperationException(); - } - - public void setData(String data) throws DOMException { - throw new UnsupportedOperationException(); - } - - // DOM level 3 - - public boolean isElementContentWhitespace() { - throw operationNotSupported(); - } - - public String getWholeText() { - throw operationNotSupported(); - } - - public Text replaceWholeText(String string) throws DOMException { - throw operationNotSupported(); - } -} - diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java deleted file mode 100644 index c295d4f74..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java +++ /dev/null @@ -1,70 +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.views.xslt; - -import java.io.InputStream; - -import javax.servlet.ServletContext; -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.URIResolver; -import javax.xml.transform.stream.StreamSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * ServletURIResolver is a URIResolver that can retrieve resources from the servlet context using the scheme "response". - * e.g. - * - * A URI resolver is called when a stylesheet uses an xsl:include, xsl:import, or document() function to find the - * resource (file). - */ -public class ServletURIResolver implements URIResolver { - - private Log log = LogFactory.getLog(getClass()); - static final String PROTOCOL = "response:"; - - private ServletContext sc; - - public ServletURIResolver(ServletContext sc) { - log.trace("ServletURIResolver: " + sc); - this.sc = sc; - } - - public Source resolve(String href, String base) throws TransformerException { - log.debug("ServletURIResolver resolve(): href=" + href + ", base=" + base); - if (href.startsWith(PROTOCOL)) { - String res = href.substring(PROTOCOL.length()); - log.debug("Resolving resource <" + res + ">"); - - InputStream is = sc.getResourceAsStream(res); - - if (is == null) { - throw new TransformerException( - "Resource " + res + " not found in resources."); - } - - return new StreamSource(is); - } - - throw new TransformerException( - "Cannot handle procotol of resource " + href); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java deleted file mode 100644 index 3879b304e..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java +++ /dev/null @@ -1,254 +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.views.xslt; - -import java.util.Arrays; -import java.util.List; - -import org.apache.struts2.StrutsException; -import org.w3c.dom.Attr; -import org.w3c.dom.CDATASection; -import org.w3c.dom.Comment; -import org.w3c.dom.DOMConfiguration; -import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.EntityReference; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.ProcessingInstruction; -import org.w3c.dom.Text; - -/** - * SimpleAdapterDocument adapted a Java object and presents it as - * a Document. This class represents the Document container and uses - * the AdapterFactory to produce a child adapter for the wrapped object. - * The adapter produced must be of an Element type or an exception is thrown. - * - * Note: in theory we could base this on AbstractAdapterElement and then allow - * the wrapped object to be a more general Node type. We would just use - * ourselves as the root element. However I don't think this is an issue as - * people expect Documents to wrap Elements. - */ -public class SimpleAdapterDocument extends AbstractAdapterNode implements Document { - - private Element rootElement; - - public SimpleAdapterDocument( - AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value) { - setContext(adapterFactory, parent, propertyName, value); - - } - - public void setPropertyValue(Object prop) { - super.setPropertyValue(prop); - rootElement = null; // recreate the root element - } - - /** - * Lazily construct the root element adapter from the value object. - */ - private Element getRootElement() { - if (rootElement != null) - return rootElement; - - Node node = getAdapterFactory().adaptNode( - this, getPropertyName(), getPropertyValue()); - if (node instanceof Element) - rootElement = (Element) node; - else - throw new StrutsException( - "Document adapter expected to wrap an Element type. Node is not an element:" + node); - - return rootElement; - } - - protected List getChildAdapters() { - return Arrays.asList(new Node[]{getRootElement()}); - } - - public NodeList getChildNodes() { - return new NodeList() { - public Node item(int i) { - return getRootElement(); - } - - public int getLength() { - return 1; - } - }; - } - - public DocumentType getDoctype() { - return null; - } - - public Element getDocumentElement() { - return getRootElement(); - } - - public Element getElementById(String string) { - return null; - } - - public NodeList getElementsByTagName(String string) { - return null; - } - - public NodeList getElementsByTagNameNS(String string, String string1) { - return null; - } - - public Node getFirstChild() { - return getRootElement(); - } - - public DOMImplementation getImplementation() { - return null; - } - - public Node getLastChild() { - return getRootElement(); - } - - public String getNodeName() { - return "#document"; - } - - public short getNodeType() { - return Node.DOCUMENT_NODE; - } - - public Attr createAttribute(String string) throws DOMException { - return null; - } - - public Attr createAttributeNS(String string, String string1) throws DOMException { - return null; - } - - public CDATASection createCDATASection(String string) throws DOMException { - return null; - } - - public Comment createComment(String string) { - return null; - } - - public DocumentFragment createDocumentFragment() { - return null; - } - - public Element createElement(String string) throws DOMException { - return null; - } - - public Element createElementNS(String string, String string1) throws DOMException { - return null; - } - - public EntityReference createEntityReference(String string) throws DOMException { - return null; - } - - public ProcessingInstruction createProcessingInstruction(String string, String string1) throws DOMException { - return null; - } - - public Text createTextNode(String string) { - return null; - } - - public boolean hasChildNodes() { - return true; - } - - public Node importNode(Node node, boolean b) throws DOMException { - return null; - } - - public Node getChildAfter(Node child) { - return null; - } - - public Node getChildBefore(Node child) { - return null; - } - - // DOM level 3 - - public String getInputEncoding() { - throw operationNotSupported(); - } - - public String getXmlEncoding() { - throw operationNotSupported(); - } - - public boolean getXmlStandalone() { - throw operationNotSupported(); - } - - public void setXmlStandalone(boolean b) throws DOMException { - throw operationNotSupported(); - } - - public String getXmlVersion() { - throw operationNotSupported(); - } - - public void setXmlVersion(String string) throws DOMException { - throw operationNotSupported(); - } - - public boolean getStrictErrorChecking() { - throw operationNotSupported(); - } - - public void setStrictErrorChecking(boolean b) { - throw operationNotSupported(); - } - - public String getDocumentURI() { - throw operationNotSupported(); - } - - public void setDocumentURI(String string) { - throw operationNotSupported(); - } - - public Node adoptNode(Node node) throws DOMException { - throw operationNotSupported(); - } - - public DOMConfiguration getDomConfig() { - throw operationNotSupported(); - } - - public void normalizeDocument() { - throw operationNotSupported(); - } - - public Node renameNode(Node node, String string, String string1) throws DOMException { - return null; - } - // end DOM level 3 -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java deleted file mode 100644 index ba4993159..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java +++ /dev/null @@ -1,55 +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.views.xslt; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class SimpleNodeList implements NodeList { - - private Log log = LogFactory.getLog(SimpleNodeList.class); - - private List nodes; - - public SimpleNodeList(List nodes) { - this.nodes = nodes; - } - - public int getLength() { - if (log.isTraceEnabled()) - log.trace("getLength: " + nodes.size()); - return nodes.size(); - } - - public Node item(int i) { - log.trace("getItem: " + i); - return nodes.get(i); - } - - public String toString() { - StringBuffer sb = new StringBuffer("SimpleNodeList: ["); - for (int i = 0; i < getLength(); i++) - sb.append(item(i).getNodeName() + ','); - sb.append("]"); - return sb.toString(); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java deleted file mode 100644 index 152d9332b..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java +++ /dev/null @@ -1,102 +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.views.xslt; - -import org.apache.struts2.StrutsException; -import org.w3c.dom.DOMException; -import org.w3c.dom.Node; -import org.w3c.dom.Text; - - -/** - * - */ -public class SimpleTextNode extends AbstractAdapterNode implements Node, Text { - - public SimpleTextNode(AdapterFactory rootAdapterFactory, AdapterNode parent, String propertyName, Object value) { - setContext(rootAdapterFactory, parent, propertyName, value); - } - - protected String getStringValue() { - return getPropertyValue().toString(); - } - - public void setData(String string) throws DOMException { - throw new StrutsException("Operation not supported"); - } - - public String getData() throws DOMException { - return getStringValue(); - } - - public int getLength() { - return getStringValue().length(); - } - - public String getNodeName() { - return "#text"; - } - - public short getNodeType() { - return Node.TEXT_NODE; - } - - public String getNodeValue() throws DOMException { - return getStringValue(); - } - - public void appendData(String string) throws DOMException { - throw new StrutsException("Operation not supported"); - } - - public void deleteData(int i, int i1) throws DOMException { - throw new StrutsException("Operation not supported"); - } - - public void insertData(int i, String string) throws DOMException { - throw new StrutsException("Operation not supported"); - } - - public void replaceData(int i, int i1, String string) throws DOMException { - throw new StrutsException("Operation not supported"); - } - - public Text splitText(int i) throws DOMException { - throw new StrutsException("Operation not supported"); - } - - public String substringData(int beginIndex, int endIndex) throws DOMException { - return getStringValue().substring(beginIndex, endIndex); - } - - // DOM level 3 - - public boolean isElementContentWhitespace() { - throw operationNotSupported(); - } - - public String getWholeText() { - throw operationNotSupported(); - } - - public Text replaceWholeText(String string) throws DOMException { - throw operationNotSupported(); - } - // end DOM level 3 - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java deleted file mode 100644 index fe3a5eb52..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java +++ /dev/null @@ -1,112 +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.views.xslt; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.w3c.dom.Node; - -import org.xml.sax.InputSource; - -import com.opensymphony.xwork2.util.DomHelper; - -/** - * StringAdapter adapts a Java String value to a DOM Element with the specified - * property name containing the String's text. - * e.g. a property
    String getFoo() { return "My Text!"; }
    - * will appear in the result DOM as: - * MyText! - * - * Subclasses may override the getStringValue() method in order to use StringAdapter - * as a simplified custom XML adapter for Java types. A subclass can enable XML - * parsing of the value string via the setParseStringAsXML() method and then - * override getStringValue() to return a String containing the custom formatted XML. - * - */ -public class StringAdapter extends AbstractAdapterElement { - - private Log log = LogFactory.getLog(this.getClass()); - boolean parseStringAsXML; - - public StringAdapter() { - } - - public StringAdapter(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, String value) { - setContext(adapterFactory, parent, propertyName, value); - } - - /** - * Get the object to be adapted as a String value. - *

    - * This method can be overridden by subclasses that wish to use StringAdapter - * as a simplified customizable XML adapter for Java types. A subclass can - * enable parsing of the value string as containing XML text via the - * setParseStringAsXML() method and then override getStringValue() to return a - * String containing the custom formatted XML. - */ - protected String getStringValue() { - return getPropertyValue().toString(); - } - - protected List buildChildAdapters() { - Node node; - if (getParseStringAsXML()) { - log.debug("parsing string as xml: " + getStringValue()); - // Parse the String to a DOM, then proxy that as our child - node = DomHelper.parse(new InputSource(new StringReader(getStringValue()))); - node = getAdapterFactory().proxyNode(this, node); - } else { - log.debug("using string as is: " + getStringValue()); - // Create a Text node as our child - node = new SimpleTextNode(getAdapterFactory(), this, "text", getStringValue()); - } - - List children = new ArrayList(); - children.add(node); - return children; - } - - /** - * Is this StringAdapter to interpret its string values as containing - * XML Text? - * - * @see #setParseStringAsXML(boolean) - */ - public boolean getParseStringAsXML() { - return parseStringAsXML; - } - - /** - * When set to true the StringAdapter will interpret its String value - * as containing XML text and parse it to a DOM Element. The new DOM - * Element will be a child of this String element. (i.e. wrapped in an - * element of the property name specified for this StringAdapter). - * - * @param parseStringAsXML - * @see #getParseStringAsXML() - */ - public void setParseStringAsXML(boolean parseStringAsXML) { - this.parseStringAsXML = parseStringAsXML; - } - -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java b/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java deleted file mode 100644 index b0ee149cb..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java +++ /dev/null @@ -1,347 +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.views.xslt; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.URIResolver; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.config.Settings; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.util.TextParseUtil; -import com.opensymphony.xwork2.util.ValueStack; - - -/** - * - * - * XSLTResult uses XSLT to transform action object to XML. Recent version has - * been specifically modified to deal with Xalan flaws. When using Xalan you may - * notice that even though you have very minimal stylesheet like this one - *

    - * <xsl:template match="/result">
    - *   <result />
    - * </xsl:template>
    - * - *

    - * then Xalan would still iterate through every property of your action and it's - * all descendants. - *

    - * - *

    - * If you had double-linked objects then Xalan would work forever analysing - * infinite object tree. Even if your stylesheet was not constructed to process - * them all. It's becouse current Xalan eagerly and extensively converts - * everything to it's internal DTM model before further processing. - *

    - * - *

    - * Thet's why there's a loop eliminator added that works by indexing every - * object-property combination during processing. If it notices that some - * object's property were already walked through, it doesn't get any deeper. - * Say, you have two objects x and y with the following properties set - * (pseudocode): - *

    - *
    - * x.y = y;
    - * and
    - * y.x = x;
    - * action.x=x;
    - * - *

    - * Due to that modification the resulting XML document based on x would be: - *

    - * - *
    - * <result>
    - *   <x>
    - *     <y/>
    - *   </x>
    - * </result>
    - * - *

    - * Without it there would be an endless x/y/x/y/x/y/... elements. - *

    - * - *

    - * The XSLTResult code tries also to deal with the fact that DTM model is built - * in a manner that childs are processed before siblings. The result is that if - * there is object x that is both set in action's x property, and very deeply - * under action's a property then it would only appear under a, not under x. - * That's not what we expect, and that's why XSLTResult allows objects to repeat - * in various places to some extent. - *

    - * - *

    - * Sometimes the object mesh is still very dense and you may notice that even - * though you have relatively simple stylesheet execution takes a tremendous - * amount of time. To help you to deal with that obstacle of Xalan you may - * attach regexp filters to elements paths (xpath). - *

    - * - *

    - * Note: In your .xsl file the root match must be named result. - *
    This example will output the username by using getUsername on your - * action class: - *

    - * <xsl:template match="result">
    - *   <html>
    - *   <body>
    - *   Hello <xsl:value-of select="username"/> how are you?
    - *   </body>
    - *   <html>
    - * <xsl:template/>
    - * 
    - * - *

    - * In the following example the XSLT result would only walk through action's - * properties without their childs. It would also skip every property that has - * "hugeCollection" in their name. Element's path is first compared to - * excludingPattern - if it matches it's no longer processed. Then it is - * compared to matchingPattern and processed only if there's a match. - *

    - * - * - * - *
    
    - * <result name="success" type="xslt">
    - *   <param name="location">foo.xslt</param>
    - *   <param name="matchingPattern">^/result/[^/*]$</param>
    - *   <param name="excludingPattern">.*(hugeCollection).*</param>
    - * </result>
    - * 
    - * - * This result type takes the following parameters: - * - * - * - *
      - * - *
    • location (default) - the location to go to after execution.
    • - * - *
    • parse - true by default. If set to false, the location param will - * not be parsed for Ognl expressions.
    • - * - *
    • matchingPattern - Pattern that matches only desired elements, by - * default it matches everything.
    • - * - *
    • excludingPattern - Pattern that eliminates unwanted elements, by - * default it matches none.
    • - * - *
    - * - *

    - * struts.properties related configuration: - *

    - *
      - * - *
    • struts.xslt.nocache - Defaults to false. If set to true, disables - * stylesheet caching. Good for development, bad for production.
    • - * - *
    - * - * - * - * Example: - * - *
    
    - * <result name="success" type="xslt">foo.xslt</result>
    - * 
    - * - */ -public class XSLTResult implements Result { - - private static final long serialVersionUID = 6424691441777176763L; - private static final Log log = LogFactory.getLog(XSLTResult.class); - public static final String DEFAULT_PARAM = "stylesheetLocation"; - - protected boolean noCache; - private final Map templatesCache; - private String stylesheetLocation; - private boolean parse; - private AdapterFactory adapterFactory; - - public XSLTResult() { - templatesCache = new HashMap(); - noCache = Settings.get("struts.xslt.nocache").trim().equalsIgnoreCase("true"); - } - - public XSLTResult(String stylesheetLocation) { - this(); - setStylesheetLocation(stylesheetLocation); - } - - /** - * @deprecated Use #setStylesheetLocation(String) - */ - public void setLocation(String location) { - setStylesheetLocation(location); - } - - public void setStylesheetLocation(String location) { - if (location == null) - throw new IllegalArgumentException("Null location"); - this.stylesheetLocation = location; - } - - public String getStylesheetLocation() { - return stylesheetLocation; - } - - /** - * If true, parse the stylesheet location for OGNL expressions. - * - * @param parse - */ - public void setParse(boolean parse) { - this.parse = parse; - } - - public void execute(ActionInvocation invocation) throws Exception { - long startTime = System.currentTimeMillis(); - String location = getStylesheetLocation(); - - if (parse) { - ValueStack stack = ActionContext.getContext().getValueStack(); - location = TextParseUtil.translateVariables(location, stack); - } - - try { - HttpServletResponse response = ServletActionContext.getResponse(); - - Writer writer = response.getWriter(); - - // Create a transformer for the stylesheet. - Templates templates = null; - Transformer transformer; - if (location != null) { - templates = getTemplates(location); - transformer = templates.newTransformer(); - } else - transformer = TransformerFactory.newInstance().newTransformer(); - - transformer.setURIResolver(getURIResolver()); - - String mimeType; - if (templates == null) - mimeType = "text/xml"; // no stylesheet, raw xml - else - mimeType = templates.getOutputProperties().getProperty(OutputKeys.MEDIA_TYPE); - if (mimeType == null) { - // guess (this is a servlet, so text/html might be the best guess) - mimeType = "text/html"; - } - - response.setContentType(mimeType); - - Source xmlSource = getDOMSourceForStack(invocation.getAction()); - - // Transform the source XML to System.out. - PrintWriter out = response.getWriter(); - - log.debug("xmlSource = " + xmlSource); - transformer.transform(xmlSource, new StreamResult(out)); - - out.close(); // ...and flush... - - if (log.isDebugEnabled()) { - log.debug("Time:" + (System.currentTimeMillis() - startTime) + "ms"); - } - - writer.flush(); - } catch (Exception e) { - log.error("Unable to render XSLT Template, '" + location + "'", e); - throw e; - } - } - - protected AdapterFactory getAdapterFactory() { - if (adapterFactory == null) - adapterFactory = new AdapterFactory(); - return adapterFactory; - } - - protected void setAdapterFactory(AdapterFactory adapterFactory) { - this.adapterFactory = adapterFactory; - } - - /** - * Get the URI Resolver to be called by the processor when it encounters an xsl:include, xsl:import, or document() - * function. The default is an instance of ServletURIResolver, which operates relative to the servlet context. - */ - protected URIResolver getURIResolver() { - return new ServletURIResolver( - ServletActionContext.getServletContext()); - } - - protected Templates getTemplates(String path) throws TransformerException, IOException { - String pathFromRequest = ServletActionContext.getRequest().getParameter("xslt.location"); - - if (pathFromRequest != null) - path = pathFromRequest; - - if (path == null) - throw new TransformerException("Stylesheet path is null"); - - Templates templates = templatesCache.get(path); - - if (noCache || (templates == null)) { - synchronized (templatesCache) { - URL resource = ServletActionContext.getServletContext().getResource(path); - - if (resource == null) { - throw new TransformerException("Stylesheet " + path + " not found in resources."); - } - - log.debug("Preparing XSLT stylesheet templates: " + path); - - TransformerFactory factory = TransformerFactory.newInstance(); - templates = factory.newTemplates(new StreamSource(resource.openStream())); - templatesCache.put(path, templates); - } - } - - return templates; - } - - protected Source getDOMSourceForStack(Object action) - throws IllegalAccessException, InstantiationException { - return new DOMSource(getAdapterFactory().adaptDocument("result", action) ); - } -} diff --git a/trunk/core/src/main/java/org/apache/struts2/views/xslt/package.html b/trunk/core/src/main/java/org/apache/struts2/views/xslt/package.html deleted file mode 100644 index ed05a0a58..000000000 --- a/trunk/core/src/main/java/org/apache/struts2/views/xslt/package.html +++ /dev/null @@ -1,24 +0,0 @@ - -

    -The new xslt view supports an extensible Java XML adapter framework that makes -it easy to customize the XML rendering of objects and to incorporate structured -XML text and arbitarary DOM fragments into the output. -

    -

    -The XSLTResult class now uses an extensible adapter factory for rendering the -Struts action Java object tree to an XML DOM for consumption by the -stylesheet. Users can easily register their own adapters to produce custom XML -views of Java types or simply extend a default "String" adapter and return -plain or XML text to be incorporated into the DOM. The new adapter mechanism -is capable of proxying existing DOM trees and incorporating them into the -results, so you can freely mix DOMs produced from other sources into your -result tree. -

    -

    -A default java.util.Map adapter is also now provided to render Maps to XML. -

    -

    -Please see the javadoc on the AdapterFactory for more details. -

    - - diff --git a/trunk/core/src/main/resources/META-INF/struts-tags.tld b/trunk/core/src/main/resources/META-INF/struts-tags.tld deleted file mode 100644 index 1a515f132..000000000 --- a/trunk/core/src/main/resources/META-INF/struts-tags.tld +++ /dev/null @@ -1,11308 +0,0 @@ - - - - - - 2.2.3 - 1.2 - s - - /struts-tags - - Struts Tags - - - - head - org.apache.struts2.views.jsp.ui.HeadTag - empty - - - - calendarcss - false - true - - - - - - debug - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - push - org.apache.struts2.views.jsp.PushTag - JSP - - - - value - true - true - - - - - - id - false - true - - - - - - - - - - table - org.apache.struts2.views.jsp.ui.table.WebTableTag - JSP - - - - modelName - true - true - - - - - - sortColumn - false - true - - - - - - sortOrder - false - true - - - - - - sortable - false - true - - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - component - org.apache.struts2.views.jsp.ui.ComponentTag - JSP - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - token - org.apache.struts2.views.jsp.ui.TokenTag - JSP - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - set - org.apache.struts2.views.jsp.SetTag - empty - - - - name - true - true - - - value]]> - - - - scope - false - true - - - application, session, request, page, or action.]]> - - - - value - false - true - - name]]> - - - - id - false - true - - - - - - - - - - i18n - org.apache.struts2.views.jsp.I18nTag - JSP - - - - name - true - true - - - - - - id - false - true - - - - - - - - - - merge - org.apache.struts2.views.jsp.iterator.MergeIteratorTag - JSP - - - - id - false - true - - - - - - - - - - password - org.apache.struts2.views.jsp.ui.PasswordTag - JSP - - - - showPassword - false - true - - - - - - maxlength - false - true - - - - - - maxLength - false - true - - - - - - readonly - false - true - - - - - - size - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - submit - org.apache.struts2.views.jsp.ui.SubmitTag - JSP - - - - resultDivId - false - true - - - - - - - onLoadJS - false - true - - - - - - - notifyTopics - false - true - - - - - - listenTopics - false - true - - - - - - preInvokeJS - false - true - - - - - - - label - false - true - - - input type submit, since button text will always be the value parameter. For the type image, alt parameter will be set to this value.]]> - - - - src - false - true - - - image type submit button. Will have no effect for types input and button.]]> - - - - action - false - true - - - - - - method - false - true - - - - - - align - false - true - - - - - - type - false - true - - - input, button and image.]]> - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - form - org.apache.struts2.views.jsp.ui.FormTag - JSP - - - - onsubmit - false - true - - - - - - action - false - true - - - - - - target - false - true - - - - - - enctype - false - true - - - - - - method - false - true - - - - - - namespace - false - true - - - - - - validate - false - true - - - - - - - portletMode - false - true - - - - - - windowState - false - true - - - - - - acceptcharset - false - true - - - - - - - openTemplate - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - include - org.apache.struts2.views.jsp.IncludeTag - JSP - - - - value - true - true - - - - - - id - false - true - - - - - - - - - - div - org.apache.struts2.views.jsp.ui.DivTag - JSP - - - - updateFreq - false - true - - - - - - delay - false - true - - - - - - loadingText - false - true - - - - - - - listenTopics - false - true - - - - - - - theme - false - true - - - This tag will usually use the ajax theme.]]> - - - - href - false - true - - - - - - errorText - false - true - - - - - - - showErrorTransportText - false - true - - - - - - afterLoading - false - true - - - - - - - openTemplate - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - label - org.apache.struts2.views.jsp.ui.LabelTag - JSP - - - - for - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - action - org.apache.struts2.views.jsp.ActionTag - JSP - - - - id - false - true - - - - - - name - true - true - - - - - - - namespace - false - true - - - - - - executeResult - false - true - - - - - - - ignoreContextParams - false - true - - - - - - - - - - bean - org.apache.struts2.views.jsp.BeanTag - JSP - - - - name - true - true - - - - - - - id - false - true - - - - - - - - - - sort - org.apache.struts2.views.jsp.iterator.SortIteratorTag - JSP - - - - comparator - true - true - - - - - - source - false - true - - - - - - id - false - true - - - - - - - - - optgroup - org.apache.struts2.views.jsp.ui.OptGroupTag - JSP - - - - label - false - true - - - - - - disabled - false - true - - - - - - list - false - true - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - id - false - true - - - - - - - - - - hidden - org.apache.struts2.views.jsp.ui.HiddenTag - JSP - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - iterator - org.apache.struts2.views.jsp.IteratorTag - JSP - - - - status - false - true - - - - - - - value - false - true - - - - - - - id - false - true - - - - - - - - - - actionerror - org.apache.struts2.views.jsp.ui.ActionErrorTag - empty - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - if - org.apache.struts2.views.jsp.IfTag - JSP - - - - test - true - true - - - - - - id - false - true - - - - - - - - - - select - org.apache.struts2.views.jsp.ui.SelectTag - JSP - - - - emptyOption - false - true - - - - - - headerKey - false - true - - - - - - - headerValue - false - true - - - - - - multiple - false - true - - - - - - - size - false - true - - - - - - list - true - true - - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - reset - org.apache.struts2.views.jsp.ui.ResetTag - JSP - - - - label - false - true - - - input type reset, since button text will always be the value parameter.]]> - - - - action - false - true - - - - - - method - false - true - - - - - - align - false - true - - - - - - type - false - true - - - input, button and image.]]> - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - append - org.apache.struts2.views.jsp.iterator.AppendIteratorTag - JSP - - - - id - false - true - - - - - - - - - - updownselect - org.apache.struts2.views.jsp.ui.UpDownSelectTag - JSP - - - - allowMoveUp - false - true - - - - - - allowMoveDown - false - true - - - - - - allowSelectAll - false - true - - - - - - moveUpLabel - false - true - - - - - - moveDownLabel - false - true - - - - - - selectAllLabel - false - true - - - - - - emptyOption - false - true - - - - - - headerKey - false - true - - - - - - - headerValue - false - true - - - - - - multiple - false - true - - - - - - - size - false - true - - - - - - list - true - true - - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - else - org.apache.struts2.views.jsp.ElseTag - - - - id - false - true - - - - - - - - - - debug - org.apache.struts2.views.jsp.ui.DebugTag - JSP - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - param - org.apache.struts2.views.jsp.ParamTag - JSP - - - - name - false - true - - - - - - value - false - true - - - - - - id - false - true - - - - - - - - - - optiontransferselect - org.apache.struts2.views.jsp.ui.OptionTransferSelectTag - JSP - - - - addAllToLeftLabel - false - true - - - - - - addAllToRightLabel - false - true - - - - - - addToLeftLabel - false - true - - - - - - addToRightLabel - false - true - - - - - - allowAddAllToLeft - false - true - - - - - - allowAddAllToRight - false - true - - - - - - allowAddToLeft - false - true - - - - - - allowAddToRight - false - true - - - - - - leftTitle - false - true - - - - - - rightTitle - false - true - - - - - - allowSelectAll - false - true - - - - - - selectAllLabel - false - true - - - - - - buttonCssClass - false - true - - - - - - buttonCssStyle - false - true - - - - - - doubleList - true - true - - - - - - doubleListKey - false - true - - - - - - doubleListValue - false - true - - - - - - doubleName - true - true - - - - - - doubleValue - false - true - - - - - - formName - false - true - - - - - - doubleCssClass - false - true - - - - - - doubleCssStyle - false - true - - - - - - doubleHeaderKey - false - true - - - - - - doubleHeaderValue - false - true - - - - - - doubleEmptyOption - false - true - - - - - - doubleDisabled - false - true - - - - - - doubleId - false - true - - - - - - doubleMultiple - false - true - - - - - - doubleOnblur - false - true - - - - - - doubleOnchange - false - true - - - - - - doubleOnclick - false - true - - - - - - doubleOndblclick - false - true - - - - - - doubleOnfocus - false - true - - - - - - doubleOnkeydown - false - true - - - - - - doubleOnkeypress - false - true - - - - - - doubleOnkeyup - false - true - - - - - - doubleOnmousedown - false - true - - - - - - doubleOnmousemove - false - true - - - - - - doubleOnmouseout - false - true - - - - - - doubleOnmouseover - false - true - - - - - - doubleOnmouseup - false - true - - - - - - doubleOnselect - false - true - - - - - - doubleSize - false - true - - - - - - doubleListKey - false - true - - - - - - emptyOption - false - true - - - - - - headerKey - false - true - - - - - - - headerValue - false - true - - - - - - multiple - false - true - - - - - - - size - false - true - - - - - - list - true - true - - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - textfield - org.apache.struts2.views.jsp.ui.TextFieldTag - JSP - - - - maxlength - false - true - - - - - - maxLength - false - true - - - - - - readonly - false - true - - - - - - size - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - doubleselect - org.apache.struts2.views.jsp.ui.DoubleSelectTag - JSP - - - - - doubleList - true - true - - - - - - doubleListKey - false - true - - - - - - doubleListValue - false - true - - - - - - doubleName - true - true - - - - - - doubleValue - false - true - - - - - - formName - false - true - - - - - - doubleCssClass - false - true - - - - - - doubleCssStyle - false - true - - - - - - doubleHeaderKey - false - true - - - - - - doubleHeaderValue - false - true - - - - - - doubleEmptyOption - false - true - - - - - - doubleDisabled - false - true - - - - - - doubleId - false - true - - - - - - doubleMultiple - false - true - - - - - - doubleOnblur - false - true - - - - - - doubleOnchange - false - true - - - - - - doubleOnclick - false - true - - - - - - doubleOndblclick - false - true - - - - - - doubleOnfocus - false - true - - - - - - doubleOnkeydown - false - true - - - - - - doubleOnkeypress - false - true - - - - - - doubleOnkeyup - false - true - - - - - - doubleOnmousedown - false - true - - - - - - doubleOnmousemove - false - true - - - - - - doubleOnmouseout - false - true - - - - - - doubleOnmouseover - false - true - - - - - - doubleOnmouseup - false - true - - - - - - doubleOnselect - false - true - - - - - - doubleSize - false - true - - - - - - doubleListKey - false - true - - - - - - emptyOption - false - true - - - - - - headerKey - false - true - - - - - - - headerValue - false - true - - - - - - multiple - false - true - - - - - - - size - false - true - - - - - - doubleAccesskey - false - true - - - - - - list - true - true - - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - textarea - org.apache.struts2.views.jsp.ui.TextareaTag - JSP - - - - cols - false - true - - - - - - readonly - false - true - - - - - - rows - false - true - - - - - - wrap - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - generator - org.apache.struts2.views.jsp.iterator.IteratorGeneratorTag - JSP - - - - count - false - true - - - - - - separator - true - true - - - val into entries of the iterator]]> - - - - val - true - true - - - - - - converter - false - true - - - val into an object]]> - - - - id - false - true - - - - - - - - - - checkbox - org.apache.struts2.views.jsp.ui.CheckboxTag - JSP - - - - fieldValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - date - org.apache.struts2.views.jsp.DateTag - empty - - - - format - false - false - - - - - - nice - false - true - - - - - - name - true - true - - - - - - id - false - true - - - - - - - - - - a - org.apache.struts2.views.jsp.ui.AnchorTag - JSP - - - - - id - false - true - - - - - - notifyTopics - false - true - - - - - - preInvokeJS - false - true - - - - - - - theme - false - true - - - This tag will usually use the ajax theme.]]> - - - - href - false - true - - - - - - errorText - false - true - - - - - - - showErrorTransportText - false - true - - - - - - afterLoading - false - true - - - - - - - openTemplate - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - - - - file - org.apache.struts2.views.jsp.ui.FileTag - JSP - - - - accept - false - true - - - - - - size - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - url - org.apache.struts2.views.jsp.URLTag - JSP - - - - includeParams - false - true - - - - - - - scheme - false - true - - - - - - value - false - true - - - - - - action - false - true - - - - - - namespace - false - true - - - - - - method - false - true - - - - - - encode - false - true - - - - - - includeContext - false - true - - - - - - portletMode - false - true - - - - - - windowState - false - true - - - - - - portletUrlType - false - true - - - - - - anchor - false - true - - - - - - id - false - true - - - - - - - - - - radio - org.apache.struts2.views.jsp.ui.RadioTag - JSP - - - - list - true - true - - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - combobox - org.apache.struts2.views.jsp.ui.ComboBoxTag - JSP - - - - list - true - true - - - - - - - maxlength - false - true - - - - - - maxLength - false - true - - - - - - readonly - false - true - - - - - - size - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - checkboxlist - org.apache.struts2.views.jsp.ui.CheckboxListTag - JSP - - - - list - true - true - - - - - - - listKey - false - true - - - - - - listValue - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - panel - org.apache.struts2.views.jsp.ui.PanelTag - JSP - - - - tabName - true - true - - - - - - subscribeTopicName - false - true - - - - - - remote - false - true - - - - - - - updateFreq - false - true - - - - - - delay - false - true - - - - - - loadingText - false - true - - - - - - - listenTopics - false - true - - - - - - - theme - false - true - - - This tag will usually use the ajax theme.]]> - - - - href - false - true - - - - - - errorText - false - true - - - - - - - showErrorTransportText - false - true - - - - - - afterLoading - false - true - - - - - - - openTemplate - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - actionmessage - org.apache.struts2.views.jsp.ui.ActionMessageTag - empty - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - tree - org.apache.struts2.views.jsp.ui.TreeTag - JSP - - - - toggle - false - true - - - - - - treeSelectedTopic - false - true - - - - - - treeExpandedTopic - false - true - - - - - - treeCollapsedTopic - false - true - - - - - - rootNode - false - true - - - - - - childCollectionProperty - false - true - - - - - - nodeTitleProperty - false - true - - - - - - nodeIdProperty - false - true - - - - - - showRootGrid - false - true - - - - - - blankIconSrc - false - true - - - - - - expandIconSrcMinus - false - true - - - - - - expandIconSrcPlus - false - true - - - - - - gridIconSrcC - false - true - - - - - - gridIconSrcL - false - true - - - - - - gridIconSrcP - false - true - - - - - - gridIconSrcV - false - true - - - - - - gridIconSrcX - false - true - - - - - - gridIconSrcY - false - true - - - - - - iconHeight - false - true - - - - - - iconWidth - false - true - - - - - - templateCssPath - false - true - - - - - - toggleDuration - false - true - - - - - - showGrid - false - true - - - - - - openTemplate - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - property - org.apache.struts2.views.jsp.PropertyTag - empty - - - - default - false - true - - value attribute is null]]> - - - - escape - false - true - - - - - - value - false - true - - - - - - id - false - true - - - - - - - - - - tabbedPanel - org.apache.struts2.views.jsp.ui.TabbedPanelTag - JSP - - - - id - true - true - - - - - - openTemplate - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - - - - treenode - org.apache.struts2.views.jsp.ui.TreeNodeTag - JSP - - - - label - true - true - - - - - - openTemplate - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - fielderror - org.apache.struts2.views.jsp.ui.FieldErrorTag - JSP - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - - subset - org.apache.struts2.views.jsp.iterator.SubsetIteratorTag - JSP - - - - count - false - true - - - - - - source - false - true - - - - - - - start - false - true - - - - - - - decider - false - true - - - - - - - id - false - true - - - - - - - - - elseif - org.apache.struts2.views.jsp.ElseIfTag - JSP - - - - test - true - true - - - - - - id - false - true - - - - - - - - - - text - org.apache.struts2.views.jsp.TextTag - JSP - - - - name - true - true - - - - - - id - false - true - - - - - - - - - - datepicker - org.apache.struts2.views.jsp.ui.DatePickerTag - JSP - - - - language - false - true - - - - - - format - false - true - - - - - - showstime - false - true - - - - - - - singleclick - false - true - - - - - - maxlength - false - true - - - - - - maxLength - false - true - - - - - - readonly - false - true - - - - - - size - false - true - - - - - - theme - false - true - - - - - - templateDir - false - true - - - - - - - template - false - true - - - - - - cssClass - false - true - - - - - - cssStyle - false - true - - - - - - title - false - true - - - - - - disabled - false - true - - - - - - label - false - true - - - - - - labelposition - false - true - - - - - - requiredposition - false - true - - - - - - name - false - true - - - - - - required - false - true - - - - - - - tabindex - false - true - - - - - - value - false - true - - - - - - onclick - false - true - - - - - - ondblclick - false - true - - - - - - onmousedown - false - true - - - - - - onmouseup - false - true - - - - - - onmouseover - false - true - - - - - - onmousemove - false - true - - - - - - onmouseout - false - true - - - - - - onfocus - false - true - - - - - - onblur - false - true - - - - - - onkeypress - false - true - - - - - - onkeydown - false - true - - - - - - onkeyup - false - true - - - - - - onselect - false - true - - - - - - onchange - false - true - - - - - - accesskey - false - true - - - - - - tooltip - false - true - - - - - - tooltipConfig - false - true - - - - - - id - false - true - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/default.properties b/trunk/core/src/main/resources/org/apache/struts2/default.properties deleted file mode 100644 index 275322c92..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/default.properties +++ /dev/null @@ -1,146 +0,0 @@ -### START SNIPPET: complete_file - -### Struts default properties -###(can be overridden by a struts.properties file in the root of the classpath) -### - -### Specifies the Configuration used to configure Struts -### one could extend org.apache.struts2.config.Configuration -### to build one's customize way of getting the configurations parameters into Struts -# struts.configuration=org.apache.struts2.config.DefaultConfiguration - -### This can be used to set your default locale and encoding scheme -# struts.locale=en_US -struts.i18n.encoding=UTF-8 - -### if specified, the default object factory can be overridden here -### Note: short-hand notation is supported in some cases, such as "spring" -### Alternatively, you can provide a com.opensymphony.xwork2.ObjectFactory subclass name here -# struts.objectFactory = spring - -### specifies the autoWiring logic when using the SpringObjectFactory. -### valid values are: name, type, auto, and constructor (name is the default) -struts.objectFactory.spring.autoWire = name - -### indicates to the struts-spring integration if Class instances should be cached -### this should, until a future Spring release makes it possible, be left as true -### unless you know exactly what you are doing! -### valid values are: true, false (true is the default) -struts.objectFactory.spring.useClassCache = true - -### if specified, the default object type determiner can be overridden here -### Note: short-hand notation is supported in some cases, such as "tiger" or "notiger" -### Alternatively, you can provide a com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation name here -### Note: if you have the xwork-tiger.jar within your classpath, GenericsObjectTypeDeterminer is used by default -### To disable tiger support use the "notiger" property value here. -#struts.objectTypeDeterminer = tiger -#struts.objectTypeDeterminer = notiger - -### Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data -# struts.multipart.parser=cos -# struts.multipart.parser=pell -struts.multipart.parser=jakarta -# uses javax.servlet.context.tempdir by default -struts.multipart.saveDir= -struts.multipart.maxSize=2097152 - -### Load custom property files (does not override struts.properties!) -# struts.custom.properties=application,org/apache/struts2/extension/custom - -### How request URLs are mapped to and from actions -struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper - -### Used by the DefaultActionMapper -### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do -struts.action.extension=action - -### Used by FilterDispatcher -### If true then Struts serves static content from inside its jar. -### If false then the static content must be available at /struts -struts.serve.static=true - -### Used by FilterDispatcher -### This is good for development where one wants changes to the static content be -### fetch on each request. -### NOTE: This will only have effect if struts.serve.static=true -### If true -> Struts will write out header for static contents such that they will -### be cached by web browsers (using Date, Cache-Content, Pragma, Expires) -### headers). -### If false -> Struts will write out header for static contents such that they are -### NOT to be cached by web browser (using Cache-Content, Pragma, Expires -### headers) -struts.serve.static.browserCache=true - -### Set this to false if you wish to disable implicit dynamic method invocation -### via the URL request. This includes URLs like foo!bar.action, as well as params -### like method:bar (but not action:foo). -### An alternative to implicit dynamic method invocation is to use wildcard -### mappings, such as -struts.enable.DynamicMethodInvocation = true - -### use alternative syntax that requires %{} in most places -### to evaluate expressions for String attributes for tags -struts.tag.altSyntax=true - -### when set to true, Struts will act much more friendly for developers. This -### includes: -### - struts.i18n.reload = true -### - struts.configuration.xml.reload = true -### - raising various debug or ignorable problems to errors -### For example: normally a request to foo.action?someUnknownField=true should -### be ignored (given that any value can come from the web and it -### should not be trusted). However, during development, it may be -### useful to know when these errors are happening and be told of -### them right away. -struts.devMode = false - -### when set to true, resource bundles will be reloaded on _every_ request. -### this is good during development, but should never be used in production -struts.i18n.reload=false - -### Standard UI theme -### Change this to reflect which path should be used for JSP control tag templates by default -struts.ui.theme=xhtml -struts.ui.templateDir=template -#sets the default template type. Either ftl, vm, or jsp -struts.ui.templateSuffix=ftl - -### Configuration reloading -### This will cause the configuration to reload struts.xml when it is changed -struts.configuration.xml.reload=false - -### Location of velocity.properties file. defaults to velocity.properties -# struts.velocity.configfile = velocity.properties - -### Comma separated list of VelocityContext classnames to chain to the StrutsVelocityContext -# struts.velocity.contexts = - -### used to build URLs, such as the UrlTag -struts.url.http.port = 80 -struts.url.https.port = 443 -### possible values are: none, get or all -struts.url.includeParams = get - -### Load custom default resource bundles -# struts.custom.i18n.resources=testmessages,testmessages2 - -### workaround for some app servers that don't handle HttpServletRequest.getParameterMap() -### often used for WebLogic, Orion, and OC4J -struts.dispatcher.parametersWorkaround = false - -### configure the Freemarker Manager class to be used -### Allows user to plug-in customised Freemarker Manager if necessary -### MUST extends off org.apache.struts2.views.freemarker.FreemarkerManager -#struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager - -### See the StrutsBeanWrapper javadocs for more information -struts.freemarker.wrapper.altMap=true - -### configure the XSLTResult class to use stylesheet caching. -### Set to true for developers and false for production. -struts.xslt.nocache=false - -### A list of configuration files automatically loaded by Struts -struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml - -### END SNIPPET: complete_file diff --git a/trunk/core/src/main/resources/org/apache/struts2/dispatcher/error.ftl b/trunk/core/src/main/resources/org/apache/struts2/dispatcher/error.ftl deleted file mode 100644 index 58049e81d..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/dispatcher/error.ftl +++ /dev/null @@ -1,123 +0,0 @@ - - - Struts Problem Report - - - -

    Struts Problem Report

    -

    - Struts has detected an unhandled exception: -

    - -<#assign msgs = [] /> -<#list chain as ex> - <#if ex.message?exists> - <#assign msgs = [ex.message] + msgs/> - - -<#assign rootex = exception/> -<#list chain as ex> - <#if (ex.location?exists && (ex.location != unknown))> - <#assign rootloc = ex.location/> - <#assign rootex = ex/> - <#else> - <#assign tmploc = locator.getLocation(ex) /> - <#if (tmploc != unknown)> - <#assign rootloc = tmploc/> - <#assign rootex = ex/> - - - - -
    - - - - - - <#if rootloc?exists> - - - - - - - - - <#if (rootloc.columnNumber >= 0)> - - - - - - - -
    Messages: - <#if (msgs?size > 1)> -
      - <#list msgs as msg> -
    1. ${msg}
    2. - -
    - <#elseif (msgs?size == 1)> - ${msgs[0]} - -
    File:${rootloc.URI}
    Line number:${rootloc.lineNumber}
    Column number:${rootloc.columnNumber}
    -
    - -<#if rootloc?exists> - <#assign snippet = rootloc.getSnippet(2) /> - <#if (snippet?size > 0)> -
    -
    - - <#list snippet as line> - <#if (line_index == 2)> - <#if (rootloc.columnNumber >= 3)> -
    ${(line[0..(rootloc.columnNumber-3)]?html)}${(line[(rootloc.columnNumber-2)]?html)}<#if ((rootloc.columnNumber)${(line[(rootloc.columnNumber-1)..]?html)}
    - <#else> -
    ${line?html}
    - - <#else> -
    ${line?html}
    - - -
    - - - -
    -
    -

    Stacktraces

    -<#list chain as ex> -
    - ${ex} -
    -
    -    <#list ex.stackTrace as frame>
    -    ${frame}
    -    
    -    
    -
    -
    - -
    - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl b/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl deleted file mode 100644 index 14b39b5e0..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl +++ /dev/null @@ -1,14 +0,0 @@ - - - - - -
    -    ${debugXML}
    -
    - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.css b/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.css deleted file mode 100644 index 293e2fc87..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.css +++ /dev/null @@ -1,19 +0,0 @@ -.wc-results { - overflow: auto; - margin: 0px; - padding: 5px; - font-family: courier; - color: white; - background-color: black; - height: 400px; -} -.wc-results pre { - display: inline; -} -.wc-command { - margin: 0px; - font-family: courier; - color: white; - background-color: black; - width: 100%; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html b/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html deleted file mode 100644 index ce093c969..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - -OGNL Console - - -
    -
    -
    - Welcome to the OGNL console! -
    - :-> -
    - -
    -
    - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js b/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js deleted file mode 100644 index 2e7783b3f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js +++ /dev/null @@ -1,58 +0,0 @@ - function printResult(result_string) - { - var result_div = document.getElementById('wc-result'); - var result_array = result_string.split('\n'); - - var new_command = document.getElementById('wc-command').value; - result_div.appendChild(document.createTextNode(new_command)); - result_div.appendChild(document.createElement('br')); - - for (var line_index in result_array) { - var result_wrap = document.createElement('pre') - line = document.createTextNode(result_array[line_index]); - result_wrap.appendChild(line); - result_div.appendChild(result_wrap); - result_div.appendChild(document.createElement('br')); - - } - result_div.appendChild(document.createTextNode(':-> ')); - - result_div.scrollTop = result_div.scrollHeight; - document.getElementById('wc-command').value = ''; - } - - function keyEvent(event) - { - switch(event.keyCode){ - case 13: - var the_shell_command = document.getElementById('wc-command').value; - if (the_shell_command) { - commands_history[commands_history.length] = the_shell_command; - history_pointer = commands_history.length; - var the_url = window.opener.location.pathname + '?debug=command&expression='+escape(the_shell_command); - dojo.io.bind({ - url: the_url, - load: function(type, data, evt){ printResult(data); }, - mimetype: "text/plain" - }); - } - break; - case 38: // this is the arrow up - if (history_pointer > 0) { - history_pointer--; - document.getElementById('wc-command').value = commands_history[history_pointer]; - } - break; - case 40: // this is the arrow down - if (history_pointer < commands_history.length - 1 ) { - history_pointer++; - document.getElementById('wc-command').value = commands_history[history_pointer]; - } - break; - default: - break; - } - } - - var commands_history = new Array(); - var history_pointer; diff --git a/trunk/core/src/main/resources/org/apache/struts2/interceptor/package.html b/trunk/core/src/main/resources/org/apache/struts2/interceptor/package.html deleted file mode 100644 index 1413ca1b1..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/interceptor/package.html +++ /dev/null @@ -1 +0,0 @@ -Web specific interceptor classes. diff --git a/trunk/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl b/trunk/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl deleted file mode 100644 index 1d1869f84..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl +++ /dev/null @@ -1,11 +0,0 @@ - - - "/> - - - Please wait while we process your request... -

    - - This page will reload automatically and display your request when it is completed. - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/package.html b/trunk/core/src/main/resources/org/apache/struts2/package.html deleted file mode 100644 index 5ed3ff00b..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/package.html +++ /dev/null @@ -1 +0,0 @@ -Main Struts interfaces and classes. diff --git a/trunk/core/src/main/resources/org/apache/struts2/sitegraph/sitegraph-usage.txt b/trunk/core/src/main/resources/org/apache/struts2/sitegraph/sitegraph-usage.txt deleted file mode 100644 index 258d01972..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/sitegraph/sitegraph-usage.txt +++ /dev/null @@ -1,7 +0,0 @@ -// START SNIPPET: sitegraph-usage -Usage: -config CONFIG_DIR -views VIEWS_DIRS -output OUTPUT [-ns NAMESPACE] - CONFIG_DIR => a directory containing struts.xml - VIEWS_DIRS => comma seperated list of dirs containing JSPs, VMs, etc - OUPUT => the directory where the output should go - NAMESPACE => the namespace path restriction (/, /foo, etc) -// END SNIPPET: sitegraph-usage diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/CommonFunctions.js b/trunk/core/src/main/resources/org/apache/struts2/static/CommonFunctions.js deleted file mode 100644 index 25e609403..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/CommonFunctions.js +++ /dev/null @@ -1,97 +0,0 @@ - -/** - * Methods for the tabbed component - */ -var unselectedClass = "tab_default tab_unselected"; -var unselectedContentsClass = "tab_contents_hidden"; -var unselectedOverClass = "tab_default tab_unselected tab_unselected_over"; -var selectedClass = "tab_default tab_selected"; -var selectedContentsClass = "tab_contents_header"; - -function mouseIn(tab) { - var className = tab.className; - if (className.indexOf('unselected') > -1) { - className = unselectedOverClass; - tab.className = className; - } -} - -function mouseOut(tab) { - var className = tab.className; - if (className.indexOf('unselected') > -1) { - className = unselectedClass; - tab.className = className; - } -} - -/* - * An object that represents a tabbed page. - * - * @param htmlId the id of the element that represents the tab page - * @param remote whether this is a remote element and needs refreshing - */ -function TabContent( htmlId, remote ) { - - this.elementId = htmlId; - this.isRemote = remote; - var selected = false; - var self = this; - - /* - * Shows or hides this page depending on whether the visible - * tab id matches this objects id. - * - * @param visibleTabId the id of the tab that was selected - */ - this.updateVisibility = function( visibleTabId ) { - var thElement = document.getElementById( 'tab_header_'+self.elementId ); - var tcElement = document.getElementById( 'tab_contents_'+self.elementId ); - if (!selected && visibleTabId==self.elementId) { - thElement.className = selectedClass; - tcElement.className = selectedContentsClass; - self.selected = true; - - } else { - thElement.className = unselectedClass; - tcElement.className = unselectedContentsClass; - self.selected = false; - } - if (self.isRemote==true && visibleTabId==self.elementId) { - var rel = window['tab_contents_update_'+self.elementId]; - // If the first tab is a remote tab, rel is null on initial loading... - // so don't try to call a method that doesn't exist. This is only - // for IE, and the workaround is to use a - // as the content of the DIV. - if (rel.bind) - rel.bind(); - } - } - -} - -/** - * Checks whether the current form include an ajax-ified submit button, if so - * we return true (otherwise false). - * - * @param form the HTML form element to check - */ -function isAjaxFormSubmit( form ) { - // we check whether this exists - // - var thisForm = document.getElementById(form.id); - var matchUrl = /\s+dojoAttachPoint/; - if( thisForm.innerHTML.match(matchUrl) ) { - return false; - } - for( i=0; i - -Depending on the edition that you have downloaded, this base dojo.js file may or -may not include the modules you wish to use in your application. To ensure that -they are available, use dojo.require() to request them. A very rich application -might include: - - - - -Note that only those modules which are *not* already "baked in" to dojo.js by -the edition's build process are requested by dojo.require(). This helps make -your application faster without forcing you to use a build tool while in -development. See "Building Dojo" and "Working From Source" for more details. - - -Compatibility -------------- - -In addition to it's suite of unit-tests for core system components, Dojo has -been tested on almost every modern browser, including: - - - IE 5.5+ - - Mozilla 1.2+, Firefox 1.0+ - - Safari 1.3.9+ - - Konqueror 3.4+ - - Opera 8.5+ - -Note that some widgets and features may not preform exactly the same on every -browser due to browser implementation differences. - -For those looking to use Dojo in non-browser environments, please see "Working -From Source". - - -Documentation and Getting Help ------------------------------- - -Articles outlining major Dojo systems are linked from: - - http://dojotoolkit.org/docs/ - -Toolkit APIs are listed in outline form at: - - http://dojotoolkit.org/docs/apis/ - -And documented in full at: - - http://manual.dojotoolkit.org/ - -The project also maintains a JotSpot Wiki at: - - http://dojo.jot.com/ - -A FAQ has been extracted from mailing list traffic: - - http://dojo.jot.com/FAQ - -And the main Dojo user mailing list is archived and made searchable at: - - http://news.gmane.org/gmane.comp.web.dojo.user/ - -You can sign up for this list, which is a great place to ask questions, at: - - http://dojotoolkit.org/mailman/listinfo/dojo-interest - -The Dojo developers also tend to hang out in IRC and help people with Dojo -problems. You're most likely to find them at: - - irc.freenode.net #dojo - -Note that 2PM Wed PST in this channel is reserved for a weekly meeting between -project developers, although anyone is welcome to participate. - - -Working From Source -------------------- - -The core of Dojo is a powerful package system that allows developers to optimize -Dojo for deployment while using *exactly the same* application code in -development. Therefore, working from source is almost exactly like working from -a pre-built edition. Pre-built editions are significantly faster to load than -working from source, but are not as flexible when in development. - -There are multiple ways to get the source. Nightly snapshots of the Dojo source -repository are available at: - - http://archive.dojotoolkit.org/nightly.tgz - -Anonymous Subversion access is also available: - - %> svn co http://dojootoolkit.org/svn/dojo/trunk/ - -Each of these sources will include some extra directories not included in the -pre-packaged editions, including command-line tests and build tools for -constructing your own packages. - -Running the command-line unit test suite requires Ant 1.6. If it is installed -and in your path, you can run the tests using: - - %> cd buildscripts - %> ant test - -The command-line test harness makes use of Rhino, a JavaScript interpreter -written in Java. Once you have a copy of Dojo's source tree, you have a copy of -Rhino. From the root directory, you can use Rhino interactively to load Dojo: - - %> java -jar buildscripts/lib/js.jar - Rhino 1.5 release 3 2002 01 27 - js> load("dojo.js"); - js> print(dojo); - [object Object] - js> quit(); - -This environment is wonderful for testing raw JavaScript functionality in, or -even for scripting your system. Since Rhino has full access to anything in -Java's classpath, the sky is the limit! - -Building Dojo -------------- - -Dojo requires Ant 1.6.x in order to build correctly. While using Dojo from -source does *NOT* require that you make a build, speeding up your application by -constructing a custom profile build does. - -Once you have Ant and a source snapshot of Dojo, you can make your own profile -build ("edition") which includes only those modules your application uses by -customizing one of the files in: - - [dojo]/buildscripts/profiles/ - -These files are named *.profile.js and each one contains a list of modules to -include in a build. If we created a new profile called "test.profile.js", we -could then make a profile build using it by doing: - - %> cd buildscripts - %> ant -Dprofile=test -Ddocless=true release intern-strings - -If the build is successful, your newly minted and compressed profile build will -be placed in [dojo]/releae/dojo/ - -------------------------------------------------------------------------------- -Copyright (c) 2004-2005, The Dojo Foundation, All Rights Reserved - -vim:ts=4:et:tw=80:shiftwidth=4: diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/build.txt b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/build.txt deleted file mode 100644 index 28c43186f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/build.txt +++ /dev/null @@ -1,13 +0,0 @@ - -Files baked into this package: - -../src/bootstrap1.js, -../src/hostenv_browser.js, -../src/bootstrap2.js, -../src/lang.js, -../src/string.js, -../src/io.js, -../src/dom.js, -../src/io/BrowserIO.js - - \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/dojo.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/dojo.js deleted file mode 100644 index df8c9aae4..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/dojo.js +++ /dev/null @@ -1,2521 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/* - This is a compiled version of Dojo, built for deployment and not for - development. To get an editable version, please visit: - - http://dojotoolkit.org - - for documentation and information on getting the source. -*/ - -var dj_global=this; -function dj_undef(_1,_2){ -if(!_2){ -_2=dj_global; -} -return (typeof _2[_1]=="undefined"); -} -if(dj_undef("djConfig")){ -var djConfig={}; -} -var dojo; -if(dj_undef("dojo")){ -dojo={}; -} -dojo.version={major:0,minor:2,patch:2,flag:"",revision:Number("$Rev: 2836 $".match(/[0-9]+/)[0]),toString:function(){ -with(dojo.version){ -return major+"."+minor+"."+patch+flag+" ("+revision+")"; -} -}}; -dojo.evalObjPath=function(_3,_4){ -if(typeof _3!="string"){ -return dj_global; -} -if(_3.indexOf(".")==-1){ -if((dj_undef(_3,dj_global))&&(_4)){ -dj_global[_3]={}; -} -return dj_global[_3]; -} -var _5=_3.split(/\./); -var _6=dj_global; -for(var i=0;i<_5.length;++i){ -if(!_4){ -_6=_6[_5[i]]; -if((typeof _6=="undefined")||(!_6)){ -return _6; -} -}else{ -if(dj_undef(_5[i],_6)){ -_6[_5[i]]={}; -} -_6=_6[_5[i]]; -} -} -return _6; -}; -dojo.errorToString=function(_8){ -return ((!dj_undef("message",_8))?_8.message:(dj_undef("description",_8)?_8:_8.description)); -}; -dojo.raise=function(_9,_a){ -if(_a){ -_9=_9+": "+dojo.errorToString(_a); -} -var he=dojo.hostenv; -if((!dj_undef("hostenv",dojo))&&(!dj_undef("println",dojo.hostenv))){ -dojo.hostenv.println("FATAL: "+_9); -} -throw Error(_9); -}; -dj_throw=dj_rethrow=function(m,e){ -dojo.deprecated("dj_throw and dj_rethrow deprecated, use dojo.raise instead"); -dojo.raise(m,e); -}; -dojo.debug=function(){ -if(!djConfig.isDebug){ -return; -} -var _e=arguments; -if(dj_undef("println",dojo.hostenv)){ -dojo.raise("dojo.debug not available (yet?)"); -} -var _f=dj_global["jum"]&&!dj_global["jum"].isBrowser; -var s=[(_f?"":"DEBUG: ")]; -for(var i=0;i<_e.length;++i){ -if(!false&&_e[i] instanceof Error){ -var msg="["+_e[i].name+": "+dojo.errorToString(_e[i])+(_e[i].fileName?", file: "+_e[i].fileName:"")+(_e[i].lineNumber?", line: "+_e[i].lineNumber:"")+"]"; -}else{ -try{ -var msg=String(_e[i]); -} -catch(e){ -if(dojo.render.html.ie){ -var msg="[ActiveXObject]"; -}else{ -var msg="[unknown]"; -} -} -} -s.push(msg); -} -if(_f){ -jum.debug(s.join(" ")); -}else{ -dojo.hostenv.println(s.join(" ")); -} -}; -dojo.debugShallow=function(obj){ -if(!djConfig.isDebug){ -return; -} -dojo.debug("------------------------------------------------------------"); -dojo.debug("Object: "+obj); -for(i in obj){ -dojo.debug(i+": "+obj[i]); -} -dojo.debug("------------------------------------------------------------"); -}; -var dj_debug=dojo.debug; -function dj_eval(s){ -return dj_global.eval?dj_global.eval(s):eval(s); -} -dj_unimplemented=dojo.unimplemented=function(_15,_16){ -var _17="'"+_15+"' not implemented"; -if((!dj_undef(_16))&&(_16)){ -_17+=" "+_16; -} -dojo.raise(_17); -}; -dj_deprecated=dojo.deprecated=function(_18,_19,_1a){ -var _1b="DEPRECATED: "+_18; -if(_19){ -_1b+=" "+_19; -} -if(_1a){ -_1b+=" -- will be removed in version: "+_1a; -} -dojo.debug(_1b); -}; -dojo.inherits=function(_1c,_1d){ -if(typeof _1d!="function"){ -dojo.raise("superclass: "+_1d+" borken"); -} -_1c.prototype=new _1d(); -_1c.prototype.constructor=_1c; -_1c.superclass=_1d.prototype; -_1c["super"]=_1d.prototype; -}; -dj_inherits=function(_1e,_1f){ -dojo.deprecated("dj_inherits deprecated, use dojo.inherits instead"); -dojo.inherits(_1e,_1f); -}; -dojo.render=(function(){ -function vscaffold(_20,_21){ -var tmp={capable:false,support:{builtin:false,plugin:false},prefixes:_20}; -for(var x in _21){ -tmp[x]=false; -} -return tmp; -} -return {name:"",ver:dojo.version,os:{win:false,linux:false,osx:false},html:vscaffold(["html"],["ie","opera","khtml","safari","moz"]),svg:vscaffold(["svg"],["corel","adobe","batik"]),vml:vscaffold(["vml"],["ie"]),swf:vscaffold(["Swf","Flash","Mm"],["mm"]),swt:vscaffold(["Swt"],["ibm"])}; -})(); -dojo.hostenv=(function(){ -var _24={isDebug:false,allowQueryConfig:false,baseScriptUri:"",baseRelativePath:"",libraryScriptUri:"",iePreventClobber:false,ieClobberMinimal:true,preventBackButtonFix:true,searchIds:[],parseWidgets:true}; -if(typeof djConfig=="undefined"){ -djConfig=_24; -}else{ -for(var _25 in _24){ -if(typeof djConfig[_25]=="undefined"){ -djConfig[_25]=_24[_25]; -} -} -} -var djc=djConfig; -function _def(obj,_28,def){ -return (dj_undef(_28,obj)?def:obj[_28]); -} -return {name_:"(unset)",version_:"(unset)",pkgFileName:"__package__",loading_modules_:{},loaded_modules_:{},addedToLoadingCount:[],removedFromLoadingCount:[],inFlightCount:0,modulePrefixes_:{dojo:{name:"dojo",value:"src"}},setModulePrefix:function(_2a,_2b){ -this.modulePrefixes_[_2a]={name:_2a,value:_2b}; -},getModulePrefix:function(_2c){ -var mp=this.modulePrefixes_; -if((mp[_2c])&&(mp[_2c]["name"])){ -return mp[_2c].value; -} -return _2c; -},getTextStack:[],loadUriStack:[],loadedUris:[],post_load_:false,modulesLoadedListeners:[],getName:function(){ -return this.name_; -},getVersion:function(){ -return this.version_; -},getText:function(uri){ -dojo.unimplemented("getText","uri="+uri); -},getLibraryScriptUri:function(){ -dojo.unimplemented("getLibraryScriptUri",""); -}}; -})(); -dojo.hostenv.getBaseScriptUri=function(){ -if(djConfig.baseScriptUri.length){ -return djConfig.baseScriptUri; -} -var uri=new String(djConfig.libraryScriptUri||djConfig.baseRelativePath); -if(!uri){ -dojo.raise("Nothing returned by getLibraryScriptUri(): "+uri); -} -var _30=uri.lastIndexOf("/"); -djConfig.baseScriptUri=djConfig.baseRelativePath; -return djConfig.baseScriptUri; -}; -dojo.hostenv.setBaseScriptUri=function(uri){ -djConfig.baseScriptUri=uri; -}; -dojo.hostenv.loadPath=function(_32,_33,cb){ -if((_32.charAt(0)=="/")||(_32.match(/^\w+:/))){ -dojo.raise("relpath '"+_32+"'; must be relative"); -} -var uri=this.getBaseScriptUri()+_32; -if(djConfig.cacheBust&&dojo.render.html.capable){ -uri+="?"+String(djConfig.cacheBust).replace(/\W+/g,""); -} -try{ -return ((!_33)?this.loadUri(uri,cb):this.loadUriAndCheck(uri,_33,cb)); -} -catch(e){ -dojo.debug(e); -return false; -} -}; -dojo.hostenv.loadUri=function(uri,cb){ -if(this.loadedUris[uri]){ -return; -} -var _38=this.getText(uri,null,true); -if(_38==null){ -return 0; -} -this.loadedUris[uri]=true; -var _39=dj_eval(_38); -return 1; -}; -dojo.hostenv.loadUriAndCheck=function(uri,_3b,cb){ -var ok=true; -try{ -ok=this.loadUri(uri,cb); -} -catch(e){ -dojo.debug("failed loading ",uri," with error: ",e); -} -return ((ok)&&(this.findModule(_3b,false)))?true:false; -}; -dojo.loaded=function(){ -}; -dojo.hostenv.loaded=function(){ -this.post_load_=true; -var mll=this.modulesLoadedListeners; -for(var x=0;x1){ -dojo.hostenv.modulesLoadedListeners.push(function(){ -obj[_41](); -}); -} -} -}; -dojo.hostenv.modulesLoaded=function(){ -if(this.post_load_){ -return; -} -if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){ -if(this.inFlightCount>0){ -dojo.debug("files still in flight!"); -return; -} -if(typeof setTimeout=="object"){ -setTimeout("dojo.hostenv.loaded();",0); -}else{ -dojo.hostenv.loaded(); -} -} -}; -dojo.hostenv.moduleLoaded=function(_42){ -var _43=dojo.evalObjPath((_42.split(".").slice(0,-1)).join(".")); -this.loaded_modules_[(new String(_42)).toLowerCase()]=_43; -}; -dojo.hostenv._global_omit_module_check=false; -dojo.hostenv.loadModule=function(_44,_45,_46){ -if(!_44){ -return; -} -_46=this._global_omit_module_check||_46; -var _47=this.findModule(_44,false); -if(_47){ -return _47; -} -if(dj_undef(_44,this.loading_modules_)){ -this.addedToLoadingCount.push(_44); -} -this.loading_modules_[_44]=1; -var _48=_44.replace(/\./g,"/")+".js"; -var _49=_44.split("."); -var _4a=_44.split("."); -for(var i=_49.length-1;i>0;i--){ -var _4c=_49.slice(0,i).join("."); -var _4d=this.getModulePrefix(_4c); -if(_4d!=_4c){ -_49.splice(0,i,_4d); -break; -} -} -var _4e=_49[_49.length-1]; -if(_4e=="*"){ -_44=(_4a.slice(0,-1)).join("."); -while(_49.length){ -_49.pop(); -_49.push(this.pkgFileName); -_48=_49.join("/")+".js"; -if(_48.charAt(0)=="/"){ -_48=_48.slice(1); -} -ok=this.loadPath(_48,((!_46)?_44:null)); -if(ok){ -break; -} -_49.pop(); -} -}else{ -_48=_49.join("/")+".js"; -_44=_4a.join("."); -var ok=this.loadPath(_48,((!_46)?_44:null)); -if((!ok)&&(!_45)){ -_49.pop(); -while(_49.length){ -_48=_49.join("/")+".js"; -ok=this.loadPath(_48,((!_46)?_44:null)); -if(ok){ -break; -} -_49.pop(); -_48=_49.join("/")+"/"+this.pkgFileName+".js"; -if(_48.charAt(0)=="/"){ -_48=_48.slice(1); -} -ok=this.loadPath(_48,((!_46)?_44:null)); -if(ok){ -break; -} -} -} -if((!ok)&&(!_46)){ -dojo.raise("Could not load '"+_44+"'; last tried '"+_48+"'"); -} -} -if(!_46){ -_47=this.findModule(_44,false); -if(!_47){ -dojo.raise("symbol '"+_44+"' is not defined after loading '"+_48+"'"); -} -} -return _47; -}; -dojo.hostenv.startPackage=function(_50){ -var _51=_50.split(/\./); -if(_51[_51.length-1]=="*"){ -_51.pop(); -} -return dojo.evalObjPath(_51.join("."),true); -}; -dojo.hostenv.findModule=function(_52,_53){ -var lmn=(new String(_52)).toLowerCase(); -if(this.loaded_modules_[lmn]){ -return this.loaded_modules_[lmn]; -} -var _55=dojo.evalObjPath(_52); -if((_52)&&(typeof _55!="undefined")&&(_55)){ -this.loaded_modules_[lmn]=_55; -return _55; -} -if(_53){ -dojo.raise("no loaded module named '"+_52+"'"); -} -return null; -}; -if(typeof window=="undefined"){ -dojo.raise("no window object"); -} -(function(){ -if(djConfig.allowQueryConfig){ -var _56=document.location.toString(); -var _57=_56.split("?",2); -if(_57.length>1){ -var _58=_57[1]; -var _59=_58.split("&"); -for(var x in _59){ -var sp=_59[x].split("="); -if((sp[0].length>9)&&(sp[0].substr(0,9)=="djConfig.")){ -var opt=sp[0].substr(9); -try{ -djConfig[opt]=eval(sp[1]); -} -catch(e){ -djConfig[opt]=sp[1]; -} -} -} -} -} -if(((djConfig["baseScriptUri"]=="")||(djConfig["baseRelativePath"]==""))&&(document&&document.getElementsByTagName)){ -var _5d=document.getElementsByTagName("script"); -var _5e=/(__package__|dojo)\.js([\?\.]|$)/i; -for(var i=0;i<_5d.length;i++){ -var src=_5d[i].getAttribute("src"); -if(!src){ -continue; -} -var m=src.match(_5e); -if(m){ -root=src.substring(0,m.index); -if(!this["djConfig"]){ -djConfig={}; -} -if(djConfig["baseScriptUri"]==""){ -djConfig["baseScriptUri"]=root; -} -if(djConfig["baseRelativePath"]==""){ -djConfig["baseRelativePath"]=root; -} -break; -} -} -} -var dr=dojo.render; -var drh=dojo.render.html; -var dua=drh.UA=navigator.userAgent; -var dav=drh.AV=navigator.appVersion; -var t=true; -var f=false; -drh.capable=t; -drh.support.builtin=t; -dr.ver=parseFloat(drh.AV); -dr.os.mac=dav.indexOf("Macintosh")>=0; -dr.os.win=dav.indexOf("Windows")>=0; -dr.os.linux=dav.indexOf("X11")>=0; -drh.opera=dua.indexOf("Opera")>=0; -drh.khtml=(dav.indexOf("Konqueror")>=0)||(dav.indexOf("Safari")>=0); -drh.safari=dav.indexOf("Safari")>=0; -var _68=dua.indexOf("Gecko"); -drh.mozilla=drh.moz=(_68>=0)&&(!drh.khtml); -if(drh.mozilla){ -drh.geckoVersion=dua.substring(_68+6,_68+14); -} -drh.ie=(document.all)&&(!drh.opera); -drh.ie50=drh.ie&&dav.indexOf("MSIE 5.0")>=0; -drh.ie55=drh.ie&&dav.indexOf("MSIE 5.5")>=0; -drh.ie60=drh.ie&&dav.indexOf("MSIE 6.0")>=0; -dr.vml.capable=drh.ie; -dr.svg.capable=f; -dr.svg.support.plugin=f; -dr.svg.support.builtin=f; -dr.svg.adobe=f; -if(document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("org.w3c.dom.svg","1.0")){ -dr.svg.capable=t; -dr.svg.support.builtin=t; -dr.svg.support.plugin=f; -dr.svg.adobe=f; -}else{ -if(navigator.mimeTypes&&navigator.mimeTypes.length>0){ -var _69=navigator.mimeTypes["image/svg+xml"]||navigator.mimeTypes["image/svg"]||navigator.mimeTypes["image/svg-xml"]; -if(_69){ -dr.svg.adobe=_69&&_69.enabledPlugin&&_69.enabledPlugin.description&&(_69.enabledPlugin.description.indexOf("Adobe")>-1); -if(dr.svg.adobe){ -dr.svg.capable=t; -dr.svg.support.plugin=t; -} -} -}else{ -if(drh.ie&&dr.os.win){ -var _69=f; -try{ -var _6a=new ActiveXObject("Adobe.SVGCtl"); -_69=t; -} -catch(e){ -} -if(_69){ -dr.svg.capable=t; -dr.svg.support.plugin=t; -dr.svg.adobe=t; -} -}else{ -dr.svg.capable=f; -dr.svg.support.plugin=f; -dr.svg.adobe=f; -} -} -} -})(); -dojo.hostenv.startPackage("dojo.hostenv"); -dojo.hostenv.name_="browser"; -dojo.hostenv.searchIds=[]; -var DJ_XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"]; -dojo.hostenv.getXmlhttpObject=function(){ -var _6b=null; -var _6c=null; -try{ -_6b=new XMLHttpRequest(); -} -catch(e){ -} -if(!_6b){ -for(var i=0;i<3;++i){ -var _6e=DJ_XMLHTTP_PROGIDS[i]; -try{ -_6b=new ActiveXObject(_6e); -} -catch(e){ -_6c=e; -} -if(_6b){ -DJ_XMLHTTP_PROGIDS=[_6e]; -break; -} -} -} -if(!_6b){ -return dojo.raise("XMLHTTP not available",_6c); -} -return _6b; -}; -dojo.hostenv.getText=function(uri,_70,_71){ -var _72=this.getXmlhttpObject(); -if(_70){ -_72.onreadystatechange=function(){ -if((4==_72.readyState)&&(_72["status"])){ -if(_72.status==200){ -_70(_72.responseText); -} -} -}; -} -_72.open("GET",uri,_70?true:false); -_72.send(null); -if(_70){ -return null; -} -return _72.responseText; -}; -dojo.hostenv.defaultDebugContainerId="dojoDebug"; -dojo.hostenv._println_buffer=[]; -dojo.hostenv._println_safe=false; -dojo.hostenv.println=function(_73){ -if(!dojo.hostenv._println_safe){ -dojo.hostenv._println_buffer.push(_73); -}else{ -try{ -var _74=document.getElementById(djConfig.debugContainerId?djConfig.debugContainerId:dojo.hostenv.defaultDebugContainerId); -if(!_74){ -_74=document.getElementsByTagName("body")[0]||document.body; -} -var div=document.createElement("div"); -div.appendChild(document.createTextNode(_73)); -_74.appendChild(div); -} -catch(e){ -try{ -document.write("

    "+_73+"
    "); -} -catch(e2){ -window.status=_73; -} -} -} -}; -dojo.addOnLoad(function(){ -dojo.hostenv._println_safe=true; -while(dojo.hostenv._println_buffer.length>0){ -dojo.hostenv.println(dojo.hostenv._println_buffer.shift()); -} -}); -function dj_addNodeEvtHdlr(_76,_77,fp,_79){ -var _7a=_76["on"+_77]||function(){ -}; -_76["on"+_77]=function(){ -fp.apply(_76,arguments); -_7a.apply(_76,arguments); -}; -return true; -} -dj_addNodeEvtHdlr(window,"load",function(){ -if(dojo.render.html.ie){ -dojo.hostenv.makeWidgets(); -} -dojo.hostenv.modulesLoaded(); -}); -dojo.hostenv.makeWidgets=function(){ -var _7b=[]; -if(djConfig.searchIds&&djConfig.searchIds.length>0){ -_7b=_7b.concat(djConfig.searchIds); -} -if(dojo.hostenv.searchIds&&dojo.hostenv.searchIds.length>0){ -_7b=_7b.concat(dojo.hostenv.searchIds); -} -if((djConfig.parseWidgets)||(_7b.length>0)){ -if(dojo.evalObjPath("dojo.widget.Parse")){ -try{ -var _7c=new dojo.xml.Parse(); -if(_7b.length>0){ -for(var x=0;x<_7b.length;x++){ -var _7e=document.getElementById(_7b[x]); -if(!_7e){ -continue; -} -var _7f=_7c.parseElement(_7e,null,true); -dojo.widget.getParser().createComponents(_7f); -} -}else{ -if(djConfig.parseWidgets){ -var _7f=_7c.parseElement(document.getElementsByTagName("body")[0]||document.body,null,true); -dojo.widget.getParser().createComponents(_7f); -} -} -} -catch(e){ -dojo.debug("auto-build-widgets error:",e); -} -} -} -}; -dojo.hostenv.modulesLoadedListeners.push(function(){ -if(!dojo.render.html.ie){ -dojo.hostenv.makeWidgets(); -} -}); -try{ -if(dojo.render.html.ie){ -document.write(""); -document.write(""); -} -} -catch(e){ -} -dojo.hostenv.writeIncludes=function(){ -}; -dojo.hostenv.byId=dojo.byId=function(id,doc){ -if(typeof id=="string"||id instanceof String){ -if(!doc){ -doc=document; -} -return doc.getElementById(id); -} -return id; -}; -dojo.hostenv.byIdArray=dojo.byIdArray=function(){ -var ids=[]; -for(var i=0;i=0;i--){ -if(arr[i]===val){ -return i; -} -} -}else{ -for(var i=arr.length-1;i>=0;i--){ -if(arr[i]==val){ -return i; -} -} -} -return -1; -}; -dojo.lang.lastIndexOf=dojo.lang.findLast; -dojo.lang.inArray=function(arr,val){ -return dojo.lang.find(arr,val)>-1; -}; -dojo.lang.getNameInObj=function(ns,_d4){ -if(!ns){ -ns=dj_global; -} -for(var x in ns){ -if(ns[x]===_d4){ -return new String(x); -} -} -return null; -}; -dojo.lang.has=function(obj,_d7){ -return (typeof obj[_d7]!=="undefined"); -}; -dojo.lang.isEmpty=function(obj){ -if(dojo.lang.isObject(obj)){ -var tmp={}; -var _da=0; -for(var x in obj){ -if(obj[x]&&(!tmp[x])){ -_da++; -break; -} -} -return (_da==0); -}else{ -if(dojo.lang.isArrayLike(obj)||dojo.lang.isString(obj)){ -return obj.length==0; -} -} -}; -dojo.lang.forEach=function(arr,_dd,_de){ -var _df=dojo.lang.isString(arr); -if(_df){ -arr=arr.split(""); -} -var il=arr.length; -for(var i=0;i<((_de)?il:arr.length);i++){ -if(_dd(arr[i],i,arr)=="break"){ -break; -} -} -}; -dojo.lang.map=function(arr,obj,_e4){ -var _e5=dojo.lang.isString(arr); -if(_e5){ -arr=arr.split(""); -} -if(dojo.lang.isFunction(obj)&&(!_e4)){ -_e4=obj; -obj=dj_global; -}else{ -if(dojo.lang.isFunction(obj)&&_e4){ -var _e6=obj; -obj=_e4; -_e4=_e6; -} -} -if(Array.map){ -var _e7=Array.map(arr,_e4,obj); -}else{ -var _e7=[]; -for(var i=0;i=3){ -dojo.raise("thisObject doesn't exist!"); -} -_f3=dj_global; -} -for(var i=0;i=3){ -dojo.raise("thisObject doesn't exist!"); -} -_f8=dj_global; -} -for(var i=0;i=3){ -dojo.raise("thisObject doesn't exist!"); -} -_fd=dj_global; -} -var _ff=[]; -for(var i=0;i0){ -return str.replace(/^\s+/,""); -}else{ -if(wh<0){ -return str.replace(/\s+$/,""); -}else{ -return str.replace(/^\s+|\s+$/g,""); -} -} -}; -dojo.string.trimStart=function(str){ -return dojo.string.trim(str,1); -}; -dojo.string.trimEnd=function(str){ -return dojo.string.trim(str,-1); -}; -dojo.string.paramString=function(str,_122,_123){ -for(var name in _122){ -var re=new RegExp("\\%\\{"+name+"\\}","g"); -str=str.replace(re,_122[name]); -} -if(_123){ -str=str.replace(/%\{([^\}\s]+)\}/g,""); -} -return str; -}; -dojo.string.capitalize=function(str){ -if(!dojo.lang.isString(str)){ -return ""; -} -if(arguments.length==0){ -str=this; -} -var _127=str.split(" "); -var _128=""; -var len=_127.length; -for(var i=0;i/gm,">").replace(/"/gm,"""); -if(!_13a){ -str=str.replace(/'/gm,"'"); -} -return str; -}; -dojo.string.escapeSql=function(str){ -return str.replace(/'/gm,"''"); -}; -dojo.string.escapeRegExp=function(str){ -return str.replace(/\\/gm,"\\\\").replace(/([\f\b\n\t\r])/gm,"\\$1"); -}; -dojo.string.escapeJavaScript=function(str){ -return str.replace(/(["'\f\b\n\t\r])/gm,"\\$1"); -}; -dojo.string.repeat=function(str,_13f,_140){ -var out=""; -for(var i=0;i<_13f;i++){ -out+=str; -if(_140&&i<_13f-1){ -out+=_140; -} -} -return out; -}; -dojo.string.endsWith=function(str,end,_145){ -if(_145){ -str=str.toLowerCase(); -end=end.toLowerCase(); -} -return str.lastIndexOf(end)==str.length-end.length; -}; -dojo.string.endsWithAny=function(str){ -for(var i=1;i-1)){ -return true; -} -} -return false; -}; -dojo.string.pad=function(str,len,c,dir){ -var out=String(str); -if(!c){ -c="0"; -} -if(!dir){ -dir=1; -} -while(out.length0){ -out=c+out; -}else{ -out+=c; -} -} -return out; -}; -dojo.string.padLeft=function(str,len,c){ -return dojo.string.pad(str,len,c,1); -}; -dojo.string.padRight=function(str,len,c){ -return dojo.string.pad(str,len,c,-1); -}; -dojo.string.normalizeNewlines=function(text,_15b){ -if(_15b=="\n"){ -text=text.replace(/\r\n/g,"\n"); -text=text.replace(/\r/g,"\n"); -}else{ -if(_15b=="\r"){ -text=text.replace(/\r\n/g,"\r"); -text=text.replace(/\n/g,"\r"); -}else{ -text=text.replace(/([^\r])\n/g,"$1\r\n"); -text=text.replace(/\r([^\n])/g,"\r\n$1"); -} -} -return text; -}; -dojo.string.splitEscaped=function(str,_15d){ -var _15e=[]; -for(var i=0,prevcomma=0;i=4){ -this.changeUrl=_169; -} -} -}; -dojo.lang.extend(dojo.io.Request,{url:"",mimetype:"text/plain",method:"GET",content:undefined,transport:undefined,changeUrl:undefined,formNode:undefined,sync:false,bindSuccess:false,useCache:false,preventCache:false,load:function(type,data,evt){ -},error:function(type,_16e){ -},handle:function(){ -},abort:function(){ -},fromKwArgs:function(_16f){ -if(_16f["url"]){ -_16f.url=_16f.url.toString(); -} -if(!_16f["method"]&&_16f["formNode"]&&_16f["formNode"].method){ -_16f.method=_16f["formNode"].method; -} -if(!_16f["handle"]&&_16f["handler"]){ -_16f.handle=_16f.handler; -} -if(!_16f["load"]&&_16f["loaded"]){ -_16f.load=_16f.loaded; -} -if(!_16f["changeUrl"]&&_16f["changeURL"]){ -_16f.changeUrl=_16f.changeURL; -} -_16f.encoding=dojo.lang.firstValued(_16f["encoding"],djConfig["bindEncoding"],""); -_16f.sendTransport=dojo.lang.firstValued(_16f["sendTransport"],djConfig["ioSendTransport"],true); -var _170=dojo.lang.isFunction; -for(var x=0;x5)&&(_18b[x].indexOf("dojo-")>=0)){ -return "dojo:"+_18b[x].substr(5).toLowerCase(); -} -} -} -} -} -return _188.toLowerCase(); -}; -dojo.dom.getUniqueId=function(){ -do{ -var id="dj_unique_"+(++arguments.callee._idIncrement); -}while(document.getElementById(id)); -return id; -}; -dojo.dom.getUniqueId._idIncrement=0; -dojo.dom.firstElement=dojo.dom.getFirstChildElement=function(_18e,_18f){ -var node=_18e.firstChild; -while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){ -node=node.nextSibling; -} -if(_18f&&node&&node.tagName&&node.tagName.toLowerCase()!=_18f.toLowerCase()){ -node=dojo.dom.nextElement(node,_18f); -} -return node; -}; -dojo.dom.lastElement=dojo.dom.getLastChildElement=function(_191,_192){ -var node=_191.lastChild; -while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){ -node=node.previousSibling; -} -if(_192&&node&&node.tagName&&node.tagName.toLowerCase()!=_192.toLowerCase()){ -node=dojo.dom.prevElement(node,_192); -} -return node; -}; -dojo.dom.nextElement=dojo.dom.getNextSiblingElement=function(node,_195){ -if(!node){ -return null; -} -do{ -node=node.nextSibling; -}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE); -if(node&&_195&&_195.toLowerCase()!=node.tagName.toLowerCase()){ -return dojo.dom.nextElement(node,_195); -} -return node; -}; -dojo.dom.prevElement=dojo.dom.getPreviousSiblingElement=function(node,_197){ -if(!node){ -return null; -} -if(_197){ -_197=_197.toLowerCase(); -} -do{ -node=node.previousSibling; -}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE); -if(node&&_197&&_197.toLowerCase()!=node.tagName.toLowerCase()){ -return dojo.dom.prevElement(node,_197); -} -return node; -}; -dojo.dom.moveChildren=function(_198,_199,trim){ -var _19b=0; -if(trim){ -while(_198.hasChildNodes()&&_198.firstChild.nodeType==dojo.dom.TEXT_NODE){ -_198.removeChild(_198.firstChild); -} -while(_198.hasChildNodes()&&_198.lastChild.nodeType==dojo.dom.TEXT_NODE){ -_198.removeChild(_198.lastChild); -} -} -while(_198.hasChildNodes()){ -_199.appendChild(_198.firstChild); -_19b++; -} -return _19b; -}; -dojo.dom.copyChildren=function(_19c,_19d,trim){ -var _19f=_19c.cloneNode(true); -return this.moveChildren(_19f,_19d,trim); -}; -dojo.dom.removeChildren=function(node){ -var _1a1=node.childNodes.length; -while(node.hasChildNodes()){ -node.removeChild(node.firstChild); -} -return _1a1; -}; -dojo.dom.replaceChildren=function(node,_1a3){ -dojo.dom.removeChildren(node); -node.appendChild(_1a3); -}; -dojo.dom.removeNode=function(node){ -if(node&&node.parentNode){ -return node.parentNode.removeChild(node); -} -}; -dojo.dom.getAncestors=function(node,_1a6,_1a7){ -var _1a8=[]; -var _1a9=dojo.lang.isFunction(_1a6); -while(node){ -if(!_1a9||_1a6(node)){ -_1a8.push(node); -} -if(_1a7&&_1a8.length>0){ -return _1a8[0]; -} -node=node.parentNode; -} -if(_1a7){ -return null; -} -return _1a8; -}; -dojo.dom.getAncestorsByTag=function(node,tag,_1ac){ -tag=tag.toLowerCase(); -return dojo.dom.getAncestors(node,function(el){ -return ((el.tagName)&&(el.tagName.toLowerCase()==tag)); -},_1ac); -}; -dojo.dom.getFirstAncestorByTag=function(node,tag){ -return dojo.dom.getAncestorsByTag(node,tag,true); -}; -dojo.dom.isDescendantOf=function(node,_1b1,_1b2){ -if(_1b2&&node){ -node=node.parentNode; -} -while(node){ -if(node==_1b1){ -return true; -} -node=node.parentNode; -} -return false; -}; -dojo.dom.innerXML=function(node){ -if(node.innerXML){ -return node.innerXML; -}else{ -if(typeof XMLSerializer!="undefined"){ -return (new XMLSerializer()).serializeToString(node); -} -} -}; -dojo.dom.createDocumentFromText=function(str,_1b5){ -if(!_1b5){ -_1b5="text/xml"; -} -if(typeof DOMParser!="undefined"){ -var _1b6=new DOMParser(); -return _1b6.parseFromString(str,_1b5); -}else{ -if(typeof ActiveXObject!="undefined"){ -var _1b7=new ActiveXObject("Microsoft.XMLDOM"); -if(_1b7){ -_1b7.async=false; -_1b7.loadXML(str); -return _1b7; -}else{ -dojo.debug("toXml didn't work?"); -} -}else{ -if(document.createElement){ -var tmp=document.createElement("xml"); -tmp.innerHTML=str; -if(document.implementation&&document.implementation.createDocument){ -var _1b9=document.implementation.createDocument("foo","",null); -for(var i=0;i"); -} -} -catch(e){ -} -dojo.io.checkChildrenForFile=function(node){ -var _1d8=false; -var _1d9=node.getElementsByTagName("input"); -dojo.lang.forEach(_1d9,function(_1da){ -if(_1d8){ -return; -} -if(_1da.getAttribute("type")=="file"){ -_1d8=true; -} -}); -return _1d8; -}; -dojo.io.formHasFile=function(_1db){ -return dojo.io.checkChildrenForFile(_1db); -}; -dojo.io.encodeForm=function(_1dc,_1dd){ -if((!_1dc)||(!_1dc.tagName)||(!_1dc.tagName.toLowerCase()=="form")){ -dojo.raise("Attempted to encode a non-form element."); -} -var enc=/utf/i.test(_1dd||"")?encodeURIComponent:dojo.string.encodeAscii; -var _1df=[]; -for(var i=0;i<_1dc.elements.length;i++){ -var elm=_1dc.elements[i]; -if(elm.disabled||elm.tagName.toLowerCase()=="fieldset"||!elm.name){ -continue; -} -var name=enc(elm.name); -var type=elm.type.toLowerCase(); -if(type=="select-multiple"){ -for(var j=0;j=0){ -while(!this.historyStack[hsl]["urlHash"]){ -hsl--; -} -lh=this.historyStack[hsl]["urlHash"]; -} -if(lh){ -_207=function(){ -if(window.location.hash!=""){ -setTimeout("window.location.href = '"+lh+"';",1); -} -_20a(); -}; -} -this.forwardStack=[]; -var _20d=args["forward"]||args["forwardButton"]; -var tfw=function(){ -if(window.location.hash!=""){ -window.location.href=hash; -} -if(_20d){ -_20d(); -} -}; -if(args["forward"]){ -args.forward=tfw; -}else{ -if(args["forwardButton"]){ -args.forwardButton=tfw; -} -} -}else{ -if(dojo.render.html.moz){ -if(!this.locationTimer){ -this.locationTimer=setInterval("dojo.io.XMLHTTPTransport.checkLocation();",200); -} -} -} -} -this.historyStack.push({"url":url,"callback":_207,"kwArgs":args,"urlHash":hash}); -}; -this.checkLocation=function(){ -var hsl=this.historyStack.length; -if((window.location.hash==this.initialHash)||(window.location.href==this.initialHref)&&(hsl==1)){ -this.handleBackButton(); -return; -} -if(this.forwardStack.length>0){ -if(this.forwardStack[this.forwardStack.length-1].urlHash==window.location.hash){ -this.handleForwardButton(); -return; -} -} -if((hsl>=2)&&(this.historyStack[hsl-2])){ -if(this.historyStack[hsl-2].urlHash==window.location.hash){ -this.handleBackButton(); -return; -} -} -}; -this.iframeLoaded=function(evt,_211){ -var isp=_211.href.split("?"); -if(isp.length<2){ -if(this.historyStack.length==1){ -this.handleBackButton(); -} -return; -} -var _213=isp[1]; -if(this.moveForward){ -this.moveForward=false; -return; -} -var last=this.historyStack.pop(); -if(!last){ -if(this.forwardStack.length>0){ -var next=this.forwardStack[this.forwardStack.length-1]; -if(_213==next.url.split("?")[1]){ -this.handleForwardButton(); -} -} -return; -} -this.historyStack.push(last); -if(this.historyStack.length>=2){ -if(isp[1]==this.historyStack[this.historyStack.length-2].url.split("?")[1]){ -this.handleBackButton(); -} -}else{ -this.handleBackButton(); -} -}; -this.handleBackButton=function(){ -var last=this.historyStack.pop(); -if(!last){ -return; -} -if(last["callback"]){ -last.callback(); -}else{ -if(last.kwArgs["backButton"]){ -last.kwArgs["backButton"](); -}else{ -if(last.kwArgs["back"]){ -last.kwArgs["back"](); -}else{ -if(last.kwArgs["handle"]){ -last.kwArgs.handle("back"); -} -} -} -} -this.forwardStack.push(last); -}; -this.handleForwardButton=function(){ -var last=this.forwardStack.pop(); -if(!last){ -return; -} -if(last.kwArgs["forward"]){ -last.kwArgs.forward(); -}else{ -if(last.kwArgs["forwardButton"]){ -last.kwArgs.forwardButton(); -}else{ -if(last.kwArgs["handle"]){ -last.kwArgs.handle("forward"); -} -} -} -this.historyStack.push(last); -}; -this.inFlight=[]; -this.inFlightTimer=null; -this.startWatchingInFlight=function(){ -if(!this.inFlightTimer){ -this.inFlightTimer=setInterval("dojo.io.XMLHTTPTransport.watchInFlight();",10); -} -}; -this.watchInFlight=function(){ -for(var x=this.inFlight.length-1;x>=0;x--){ -var tif=this.inFlight[x]; -if(!tif){ -this.inFlight.splice(x,1); -continue; -} -if(4==tif.http.readyState){ -this.inFlight.splice(x,1); -doLoad(tif.req,tif.http,tif.url,tif.query,tif.useCache); -if(this.inFlight.length==0){ -clearInterval(this.inFlightTimer); -this.inFlightTimer=null; -} -} -} -}; -var _21a=dojo.hostenv.getXmlhttpObject()?true:false; -this.canHandle=function(_21b){ -return _21a&&dojo.lang.inArray((_21b["mimetype"]||"".toLowerCase()),["text/plain","text/html","application/xml","text/xml","text/javascript","text/json"])&&dojo.lang.inArray(_21b["method"].toLowerCase(),["post","get","head"])&&!(_21b["formNode"]&&dojo.io.formHasFile(_21b["formNode"])); -}; -this.multipartBoundary="45309FFF-BD65-4d50-99C9-36986896A96F"; -this.bind=function(_21c){ -if(!_21c["url"]){ -if(!_21c["formNode"]&&(_21c["backButton"]||_21c["back"]||_21c["changeUrl"]||_21c["watchForURL"])&&(!djConfig.preventBackButtonFix)){ -this.addToHistory(_21c); -return true; -} -} -var url=_21c.url; -var _21e=""; -if(_21c["formNode"]){ -var ta=_21c.formNode.getAttribute("action"); -if((ta)&&(!_21c["url"])){ -url=ta; -} -var tp=_21c.formNode.getAttribute("method"); -if((tp)&&(!_21c["method"])){ -_21c.method=tp; -} -_21e+=dojo.io.encodeForm(_21c.formNode,_21c.encoding); -} -if(url.indexOf("#")>-1){ -dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",url); -url=url.split("#")[0]; -} -if(_21c["file"]){ -_21c.method="post"; -} -if(!_21c["method"]){ -_21c.method="get"; -} -if(_21c.method.toLowerCase()=="get"){ -_21c.multipart=false; -}else{ -if(_21c["file"]){ -_21c.multipart=true; -}else{ -if(!_21c["multipart"]){ -_21c.multipart=false; -} -} -} -if(_21c["backButton"]||_21c["back"]||_21c["changeUrl"]){ -this.addToHistory(_21c); -} -var _221=_21c["content"]||{}; -if(_21c.sendTransport){ -_221["dojo.transport"]="xmlhttp"; -} -do{ -if(_21c.postContent){ -_21e=_21c.postContent; -break; -} -if(_221){ -_21e+=dojo.io.argsFromMap(_221,_21c.encoding); -} -if(_21c.method.toLowerCase()=="get"||!_21c.multipart){ -break; -} -var t=[]; -if(_21e.length){ -var q=_21e.split("&"); -for(var i=0;i-1?"&":"?")+_21e; -} -if(_228){ -_22d+=(dojo.string.endsWithAny(_22d,"?","&")?"":(_22d.indexOf("?")>-1?"&":"?"))+"dojo.preventCache="+new Date().valueOf(); -} -http.open(_21c.method.toUpperCase(),_22d,_227); -setHeaders(http,_21c); -http.send(null); -} -if(!_227){ -doLoad(_21c,http,url,_21e,_229); -} -_21c.abort=function(){ -return http.abort(); -}; -return; -}; -dojo.io.transports.addTransport("XMLHTTPTransport"); -}; - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js deleted file mode 100644 index 777d429c0..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js +++ /dev/null @@ -1,3476 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/** -* @file bootstrap1.js -* -* bootstrap file that runs before hostenv_*.js file. -* -* @author Copyright 2004 Mark D. Anderson (mda@discerning.com) -* @author Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php -* -* $Id: bootstrap1.js 2836 2006-01-16 08:36:18Z alex $ -*/ - -/** - * The global djConfig can be set prior to loading the library, to override - * certain settings. It does not exist under dojo.* so that it can be set - * before the dojo variable exists. Setting any of these variables *after* the - * library has loaded does nothing at all. The variables that can be set are - * as follows: - */ - -/** - * dj_global is an alias for the top-level global object in the host - * environment (the "window" object in a browser). - */ -var dj_global = this; //typeof window == 'undefined' ? this : window; - -function dj_undef(name, obj){ - if(!obj){ obj = dj_global; } - return (typeof obj[name] == "undefined"); -} - -if(dj_undef("djConfig")){ - var djConfig = {}; -} - -/** - * dojo is the root variable of (almost all) our public symbols. - */ -var dojo; -if(dj_undef("dojo")){ dojo = {}; } - -dojo.version = { - major: 0, minor: 2, patch: 2, flag: "", - revision: Number("$Rev: 2836 $".match(/[0-9]+/)[0]), - toString: function() { - with (dojo.version) { - return major + "." + minor + "." + patch + flag + " (" + revision + ")"; - } - } -}; - -/* - * evaluate a string like "A.B" without using eval. - */ -dojo.evalObjPath = function(objpath, create){ - // fast path for no periods - if(typeof objpath != "string"){ return dj_global; } - if(objpath.indexOf('.') == -1){ - if((dj_undef(objpath, dj_global))&&(create)){ - dj_global[objpath] = {}; - } - return dj_global[objpath]; - } - - var syms = objpath.split(/\./); - var obj = dj_global; - for(var i=0;i 1) { - dojo.hostenv.modulesLoadedListeners.push(function() { - obj[fcnName](); - }); - } -}; - -dojo.hostenv.modulesLoaded = function(){ - if(this.post_load_){ return; } - if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){ - if(this.inFlightCount > 0){ - dojo.debug("files still in flight!"); - return; - } - if(typeof setTimeout == "object"){ - setTimeout("dojo.hostenv.loaded();", 0); - }else{ - dojo.hostenv.loaded(); - } - } -} - -dojo.hostenv.moduleLoaded = function(modulename){ - var modref = dojo.evalObjPath((modulename.split(".").slice(0, -1)).join('.')); - this.loaded_modules_[(new String(modulename)).toLowerCase()] = modref; -} - -/** -* loadModule("A.B") first checks to see if symbol A.B is defined. -* If it is, it is simply returned (nothing to do). -* -* If it is not defined, it will look for "A/B.js" in the script root directory, -* followed by "A.js". -* -* It throws if it cannot find a file to load, or if the symbol A.B is not -* defined after loading. -* -* It returns the object A.B. -* -* This does nothing about importing symbols into the current package. -* It is presumed that the caller will take care of that. For example, to import -* all symbols: -* -* with (dojo.hostenv.loadModule("A.B")) { -* ... -* } -* -* And to import just the leaf symbol: -* -* var B = dojo.hostenv.loadModule("A.B"); -* ... -* -* dj_load is an alias for dojo.hostenv.loadModule -*/ -dojo.hostenv._global_omit_module_check = false; -dojo.hostenv.loadModule = function(modulename, exact_only, omit_module_check){ - if(!modulename){ return; } - omit_module_check = this._global_omit_module_check || omit_module_check; - var module = this.findModule(modulename, false); - if(module){ - return module; - } - - // protect against infinite recursion from mutual dependencies - if(dj_undef(modulename, this.loading_modules_)){ - this.addedToLoadingCount.push(modulename); - } - this.loading_modules_[modulename] = 1; - - // convert periods to slashes - var relpath = modulename.replace(/\./g, '/') + '.js'; - - var syms = modulename.split("."); - var nsyms = modulename.split("."); - for (var i = syms.length - 1; i > 0; i--) { - var parentModule = syms.slice(0, i).join("."); - var parentModulePath = this.getModulePrefix(parentModule); - if (parentModulePath != parentModule) { - syms.splice(0, i, parentModulePath); - break; - } - } - var last = syms[syms.length - 1]; - // figure out if we're looking for a full package, if so, we want to do - // things slightly diffrently - if(last=="*"){ - modulename = (nsyms.slice(0, -1)).join('.'); - - while(syms.length){ - syms.pop(); - syms.push(this.pkgFileName); - relpath = syms.join("/") + '.js'; - if(relpath.charAt(0)=="/"){ - relpath = relpath.slice(1); - } - ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if(ok){ break; } - syms.pop(); - } - }else{ - relpath = syms.join("/") + '.js'; - modulename = nsyms.join('.'); - var ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if((!ok)&&(!exact_only)){ - syms.pop(); - while(syms.length){ - relpath = syms.join('/') + '.js'; - ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if(ok){ break; } - syms.pop(); - relpath = syms.join('/') + '/'+this.pkgFileName+'.js'; - if(relpath.charAt(0)=="/"){ - relpath = relpath.slice(1); - } - ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if(ok){ break; } - } - } - - if((!ok)&&(!omit_module_check)){ - dojo.raise("Could not load '" + modulename + "'; last tried '" + relpath + "'"); - } - } - - // check that the symbol was defined - if(!omit_module_check){ - // pass in false so we can give better error - module = this.findModule(modulename, false); - if(!module){ - dojo.raise("symbol '" + modulename + "' is not defined after loading '" + relpath + "'"); - } - } - - return module; -} - -/** -* startPackage("A.B") follows the path, and at each level creates a new empty -* object or uses what already exists. It returns the result. -*/ -dojo.hostenv.startPackage = function(packname){ - var syms = packname.split(/\./); - if(syms[syms.length-1]=="*"){ - syms.pop(); - } - return dojo.evalObjPath(syms.join("."), true); -} - -/** - * findModule("A.B") returns the object A.B if it exists, otherwise null. - * @param modulename A string like 'A.B'. - * @param must_exist Optional, defualt false. throw instead of returning null - * if the module does not currently exist. - */ -dojo.hostenv.findModule = function(modulename, must_exist) { - // check cache - /* - if(!dj_undef(modulename, this.modules_)){ - return this.modules_[modulename]; - } - */ - - var lmn = (new String(modulename)).toLowerCase(); - - if(this.loaded_modules_[lmn]){ - return this.loaded_modules_[lmn]; - } - - // see if symbol is defined anyway - var module = dojo.evalObjPath(modulename); - if((modulename)&&(typeof module != 'undefined')&&(module)){ - this.loaded_modules_[lmn] = module; - return module; - } - - if(must_exist){ - dojo.raise("no loaded module named '" + modulename + "'"); - } - return null; -} - -/** -* @file hostenv_browser.js -* -* Implements the hostenv interface for a browser environment. -* -* Perhaps it could be called a "dom" or "useragent" environment. -* -* @author Copyright 2004 Mark D. Anderson (mda@discerning.com) -* @author Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php -*/ - -// make jsc shut up (so we can use jsc to sanity check the code even if it will never run it). -/*@cc_on -@if (@_jscript_version >= 7) -var window; var XMLHttpRequest; -@end -@*/ - -if(typeof window == 'undefined'){ - dojo.raise("no window object"); -} - -// attempt to figure out the path to dojo if it isn't set in the config -(function() { - // before we get any further with the config options, try to pick them out - // of the URL. Most of this code is from NW - if(djConfig.allowQueryConfig){ - var baseUrl = document.location.toString(); // FIXME: use location.query instead? - var params = baseUrl.split("?", 2); - if(params.length > 1){ - var paramStr = params[1]; - var pairs = paramStr.split("&"); - for(var x in pairs){ - var sp = pairs[x].split("="); - // FIXME: is this eval dangerous? - if((sp[0].length > 9)&&(sp[0].substr(0, 9) == "djConfig.")){ - var opt = sp[0].substr(9); - try{ - djConfig[opt]=eval(sp[1]); - }catch(e){ - djConfig[opt]=sp[1]; - } - } - } - } - } - - if(((djConfig["baseScriptUri"] == "")||(djConfig["baseRelativePath"] == "")) &&(document && document.getElementsByTagName)){ - var scripts = document.getElementsByTagName("script"); - var rePkg = /(__package__|dojo)\.js([\?\.]|$)/i; - for(var i = 0; i < scripts.length; i++) { - var src = scripts[i].getAttribute("src"); - if(!src) { continue; } - var m = src.match(rePkg); - if(m) { - root = src.substring(0, m.index); - if(!this["djConfig"]) { djConfig = {}; } - if(djConfig["baseScriptUri"] == "") { djConfig["baseScriptUri"] = root; } - if(djConfig["baseRelativePath"] == "") { djConfig["baseRelativePath"] = root; } - break; - } - } - } - - var dr = dojo.render; - var drh = dojo.render.html; - var dua = drh.UA = navigator.userAgent; - var dav = drh.AV = navigator.appVersion; - var t = true; - var f = false; - drh.capable = t; - drh.support.builtin = t; - - dr.ver = parseFloat(drh.AV); - dr.os.mac = dav.indexOf("Macintosh") >= 0; - dr.os.win = dav.indexOf("Windows") >= 0; - // could also be Solaris or something, but it's the same browser - dr.os.linux = dav.indexOf("X11") >= 0; - - drh.opera = dua.indexOf("Opera") >= 0; - drh.khtml = (dav.indexOf("Konqueror") >= 0)||(dav.indexOf("Safari") >= 0); - drh.safari = dav.indexOf("Safari") >= 0; - var geckoPos = dua.indexOf("Gecko"); - drh.mozilla = drh.moz = (geckoPos >= 0)&&(!drh.khtml); - if (drh.mozilla) { - // gecko version is YYYYMMDD - drh.geckoVersion = dua.substring(geckoPos + 6, geckoPos + 14); - } - drh.ie = (document.all)&&(!drh.opera); - drh.ie50 = drh.ie && dav.indexOf("MSIE 5.0")>=0; - drh.ie55 = drh.ie && dav.indexOf("MSIE 5.5")>=0; - drh.ie60 = drh.ie && dav.indexOf("MSIE 6.0")>=0; - - dr.vml.capable=drh.ie; - dr.svg.capable = f; - dr.svg.support.plugin = f; - dr.svg.support.builtin = f; - dr.svg.adobe = f; - if (document.implementation - && document.implementation.hasFeature - && document.implementation.hasFeature("org.w3c.dom.svg", "1.0") - ){ - dr.svg.capable = t; - dr.svg.support.builtin = t; - dr.svg.support.plugin = f; - dr.svg.adobe = f; - }else{ - // check for ASVG - if(navigator.mimeTypes && navigator.mimeTypes.length > 0){ - var result = navigator.mimeTypes["image/svg+xml"] || - navigator.mimeTypes["image/svg"] || - navigator.mimeTypes["image/svg-xml"]; - if (result){ - dr.svg.adobe = result && result.enabledPlugin && - result.enabledPlugin.description && - (result.enabledPlugin.description.indexOf("Adobe") > -1); - if(dr.svg.adobe) { - dr.svg.capable = t; - dr.svg.support.plugin = t; - } - } - }else if(drh.ie && dr.os.win){ - var result = f; - try { - var test = new ActiveXObject("Adobe.SVGCtl"); - result = t; - } catch(e){} - if (result){ - dr.svg.capable = t; - dr.svg.support.plugin = t; - dr.svg.adobe = t; - } - }else{ - dr.svg.capable = f; - dr.svg.support.plugin = f; - dr.svg.adobe = f; - } - } -})(); - -dojo.hostenv.startPackage("dojo.hostenv"); - -dojo.hostenv.name_ = 'browser'; -dojo.hostenv.searchIds = []; - -// These are in order of decreasing likelihood; this will change in time. -var DJ_XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0']; - -dojo.hostenv.getXmlhttpObject = function(){ - var http = null; - var last_e = null; - try{ http = new XMLHttpRequest(); }catch(e){} - if(!http){ - for(var i=0; i<3; ++i){ - var progid = DJ_XMLHTTP_PROGIDS[i]; - try{ - http = new ActiveXObject(progid); - }catch(e){ - last_e = e; - } - - if(http){ - DJ_XMLHTTP_PROGIDS = [progid]; // so faster next time - break; - } - } - - /*if(http && !http.toString) { - http.toString = function() { "[object XMLHttpRequest]"; } - }*/ - } - - if(!http){ - return dojo.raise("XMLHTTP not available", last_e); - } - - return http; -} - -/** - * Read the contents of the specified uri and return those contents. - * - * @param uri A relative or absolute uri. If absolute, it still must be in the - * same "domain" as we are. - * - * @param async_cb If not specified, load synchronously. If specified, load - * asynchronously, and use async_cb as the progress handler which takes the - * xmlhttp object as its argument. If async_cb, this function returns null. - * - * @param fail_ok Default false. If fail_ok and !async_cb and loading fails, - * return null instead of throwing. - */ -dojo.hostenv.getText = function(uri, async_cb, fail_ok){ - - var http = this.getXmlhttpObject(); - - if(async_cb){ - http.onreadystatechange = function(){ - if((4==http.readyState)&&(http["status"])){ - if(http.status==200){ - // dojo.debug("LOADED URI: "+uri); - async_cb(http.responseText); - } - } - } - } - - http.open('GET', uri, async_cb ? true : false); - http.send(null); - if(async_cb){ - return null; - } - - return http.responseText; -} - -/* - * It turns out that if we check *right now*, as this script file is being loaded, - * then the last script element in the window DOM is ourselves. - * That is because any subsequent script elements haven't shown up in the document - * object yet. - */ - /* -function dj_last_script_src() { - var scripts = window.document.getElementsByTagName('script'); - if(scripts.length < 1){ - dojo.raise("No script elements in window.document, so can't figure out my script src"); - } - var script = scripts[scripts.length - 1]; - var src = script.src; - if(!src){ - dojo.raise("Last script element (out of " + scripts.length + ") has no src"); - } - return src; -} - -if(!dojo.hostenv["library_script_uri_"]){ - dojo.hostenv.library_script_uri_ = dj_last_script_src(); -} -*/ - -dojo.hostenv.defaultDebugContainerId = 'dojoDebug'; -dojo.hostenv._println_buffer = []; -dojo.hostenv._println_safe = false; -dojo.hostenv.println = function (line){ - if(!dojo.hostenv._println_safe){ - dojo.hostenv._println_buffer.push(line); - }else{ - try { - var console = document.getElementById(djConfig.debugContainerId ? - djConfig.debugContainerId : dojo.hostenv.defaultDebugContainerId); - if(!console) { console = document.getElementsByTagName("body")[0] || document.body; } - - var div = document.createElement("div"); - div.appendChild(document.createTextNode(line)); - console.appendChild(div); - } catch (e) { - try{ - // safari needs the output wrapped in an element for some reason - document.write("
    " + line + "
    "); - }catch(e2){ - window.status = line; - } - } - } -} - -dojo.addOnLoad(function(){ - dojo.hostenv._println_safe = true; - while(dojo.hostenv._println_buffer.length > 0){ - dojo.hostenv.println(dojo.hostenv._println_buffer.shift()); - } -}); - -function dj_addNodeEvtHdlr (node, evtName, fp, capture){ - var oldHandler = node["on"+evtName] || function(){}; - node["on"+evtName] = function(){ - fp.apply(node, arguments); - oldHandler.apply(node, arguments); - } - return true; -} - -dj_addNodeEvtHdlr(window, "load", function(){ - if(dojo.render.html.ie){ - dojo.hostenv.makeWidgets(); - } - dojo.hostenv.modulesLoaded(); -}); - -dojo.hostenv.makeWidgets = function(){ - // you can put searchIds in djConfig and dojo.hostenv at the moment - // we should probably eventually move to one or the other - var sids = []; - if(djConfig.searchIds && djConfig.searchIds.length > 0) { - sids = sids.concat(djConfig.searchIds); - } - if(dojo.hostenv.searchIds && dojo.hostenv.searchIds.length > 0) { - sids = sids.concat(dojo.hostenv.searchIds); - } - - if((djConfig.parseWidgets)||(sids.length > 0)){ - if(dojo.evalObjPath("dojo.widget.Parse")){ - // we must do this on a delay to avoid: - // http://www.shaftek.org/blog/archives/000212.html - // IE is such a tremendous peice of shit. - try{ - var parser = new dojo.xml.Parse(); - if(sids.length > 0){ - for(var x=0; xv\:*{ behavior:url(#default#VML); }'); - document.write(''); - } -} catch (e) { } - -// stub, over-ridden by debugging code. This will at least keep us from -// breaking when it's not included -dojo.hostenv.writeIncludes = function(){} - -dojo.hostenv.byId = dojo.byId = function(id, doc){ - if(typeof id == "string" || id instanceof String){ - if(!doc){ doc = document; } - return doc.getElementById(id); - } - return id; // assume it's a node -} - -dojo.hostenv.byIdArray = dojo.byIdArray = function(){ - var ids = []; - for(var i = 0; i < arguments.length; i++){ - if((arguments[i] instanceof Array)||(typeof arguments[i] == "array")){ - for(var j = 0; j < arguments[i].length; j++){ - ids = ids.concat(dojo.hostenv.byIdArray(arguments[i][j])); - } - }else{ - ids.push(dojo.hostenv.byId(arguments[i])); - } - } - return ids; -} - -/* - * bootstrap2.js - runs after the hostenv_*.js file. - */ - -/* - * This method taks a "map" of arrays which one can use to optionally load dojo - * modules. The map is indexed by the possible dojo.hostenv.name_ values, with - * two additional values: "default" and "common". The items in the "default" - * array will be loaded if none of the other items have been choosen based on - * the hostenv.name_ item. The items in the "common" array will _always_ be - * loaded, regardless of which list is chosen. Here's how it's normally - * called: - * - * dojo.hostenv.conditionalLoadModule({ - * browser: [ - * ["foo.bar.baz", true, true], // an example that passes multiple args to loadModule() - * "foo.sample.*", - * "foo.test, - * ], - * default: [ "foo.sample.*" ], - * common: [ "really.important.module.*" ] - * }); - */ -dojo.hostenv.conditionalLoadModule = function(modMap){ - var common = modMap["common"]||[]; - var result = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]); - - for(var x=0; x= 0; i--) { - if(arr[i] === val){ return i; } - } - }else{ - for(var i = arr.length-1; i >= 0; i--) { - if(arr[i] == val){ return i; } - } - } - return -1; -} - -dojo.lang.lastIndexOf = dojo.lang.findLast; - -dojo.lang.inArray = function(arr, val){ - return dojo.lang.find(arr, val) > -1; -} - -dojo.lang.getNameInObj = function(ns, item){ - if(!ns){ ns = dj_global; } - - for(var x in ns){ - if(ns[x] === item){ - return new String(x); - } - } - return null; -} - -// FIXME: Is this worthless since you can do: if(name in obj) -// is this the right place for this? -dojo.lang.has = function(obj, name){ - return (typeof obj[name] !== 'undefined'); -} - -dojo.lang.isEmpty = function(obj) { - if(dojo.lang.isObject(obj)) { - var tmp = {}; - var count = 0; - for(var x in obj){ - if(obj[x] && (!tmp[x])){ - count++; - break; - } - } - return (count == 0); - } else if(dojo.lang.isArrayLike(obj) || dojo.lang.isString(obj)) { - return obj.length == 0; - } -} - -dojo.lang.forEach = function(arr, unary_func, fix_length){ - var isString = dojo.lang.isString(arr); - if(isString) { arr = arr.split(""); } - var il = arr.length; - for(var i=0; i< ((fix_length) ? il : arr.length); i++){ - if(unary_func(arr[i], i, arr) == "break"){ - break; - } - } -} - -dojo.lang.map = function(arr, obj, unary_func){ - var isString = dojo.lang.isString(arr); - if(isString){ - arr = arr.split(""); - } - if(dojo.lang.isFunction(obj)&&(!unary_func)){ - unary_func = obj; - obj = dj_global; - }else if(dojo.lang.isFunction(obj) && unary_func){ - // ff 1.5 compat - var tmpObj = obj; - obj = unary_func; - unary_func = tmpObj; - } - - if(Array.map){ - var outArr = Array.map(arr, unary_func, obj); - }else{ - var outArr = []; - for(var i=0;i= 3) { dojo.raise("thisObject doesn't exist!"); } - thisObject = dj_global; - } - - for(var i = 0; i < arr.length; i++) { - if(!callback.call(thisObject, arr[i], i, arr)) { - return false; - } - } - return true; - } -} - -dojo.lang.some = function(arr, callback, thisObject) { - var isString = dojo.lang.isString(arr); - if(isString) { arr = arr.split(""); } - if(Array.some) { - return Array.some(arr, callback, thisObject); - } else { - if(!thisObject) { - if(arguments.length >= 3) { dojo.raise("thisObject doesn't exist!"); } - thisObject = dj_global; - } - - for(var i = 0; i < arr.length; i++) { - if(callback.call(thisObject, arr[i], i, arr)) { - return true; - } - } - return false; - } -} - -dojo.lang.filter = function(arr, callback, thisObject) { - var isString = dojo.lang.isString(arr); - if(isString) { arr = arr.split(""); } - if(Array.filter) { - var outArr = Array.filter(arr, callback, thisObject); - } else { - if(!thisObject) { - if(arguments.length >= 3) { dojo.raise("thisObject doesn't exist!"); } - thisObject = dj_global; - } - - var outArr = []; - for(var i = 0; i < arr.length; i++) { - if(callback.call(thisObject, arr[i], i, arr)) { - outArr.push(arr[i]); - } - } - } - if(isString) { - return outArr.join(""); - } else { - return outArr; - } -} - -dojo.AdapterRegistry = function(){ - /*** - A registry to facilitate adaptation. - - Pairs is an array of [name, check, wrap] triples - - All check/wrap functions in this registry should be of the same arity. - ***/ - this.pairs = []; -} - -dojo.lang.extend(dojo.AdapterRegistry, { - register: function (name, check, wrap, /* optional */ override){ - /*** - The check function should return true if the given arguments are - appropriate for the wrap function. - - If override is given and true, the check function will be given - highest priority. Otherwise, it will be the lowest priority - adapter. - ***/ - - if (override) { - this.pairs.unshift([name, check, wrap]); - } else { - this.pairs.push([name, check, wrap]); - } - }, - - match: function (/* ... */) { - /*** - Find an adapter for the given arguments. - - If no suitable adapter is found, throws NotFound. - ***/ - for(var i = 0; i < this.pairs.length; i++){ - var pair = this.pairs[i]; - if(pair[1].apply(this, arguments)){ - return pair[2].apply(this, arguments); - } - } - throw new Error("No match found"); - // dojo.raise("No match found"); - }, - - unregister: function (name) { - /*** - Remove a named adapter from the registry - ***/ - for(var i = 0; i < this.pairs.length; i++){ - var pair = this.pairs[i]; - if(pair[0] == name){ - this.pairs.splice(i, 1); - return true; - } - } - return false; - } -}); - -dojo.lang.reprRegistry = new dojo.AdapterRegistry(); -dojo.lang.registerRepr = function(name, check, wrap, /*optional*/ override){ - /*** - Register a repr function. repr functions should take - one argument and return a string representation of it - suitable for developers, primarily used when debugging. - - If override is given, it is used as the highest priority - repr, otherwise it will be used as the lowest. - ***/ - dojo.lang.reprRegistry.register(name, check, wrap, override); - }; - -dojo.lang.repr = function(obj){ - /*** - Return a "programmer representation" for an object - ***/ - if(typeof(obj) == "undefined"){ - return "undefined"; - }else if(obj === null){ - return "null"; - } - - try{ - if(typeof(obj["__repr__"]) == 'function'){ - return obj["__repr__"](); - }else if((typeof(obj["repr"]) == 'function')&&(obj.repr != arguments.callee)){ - return obj["repr"](); - } - return dojo.lang.reprRegistry.match(obj); - }catch(e){ - if(typeof(obj.NAME) == 'string' && ( - obj.toString == Function.prototype.toString || - obj.toString == Object.prototype.toString - )){ - return o.NAME; - } - } - - if(typeof(obj) == "function"){ - obj = (obj + "").replace(/^\s+/, ""); - var idx = obj.indexOf("{"); - if(idx != -1){ - obj = obj.substr(0, idx) + "{...}"; - } - } - return obj + ""; -} - -dojo.lang.reprArrayLike = function(arr){ - try{ - var na = dojo.lang.map(arr, dojo.lang.repr); - return "[" + na.join(", ") + "]"; - }catch(e){ } -}; - -dojo.lang.reprString = function(str){ - return ('"' + str.replace(/(["\\])/g, '\\$1') + '"' - ).replace(/[\f]/g, "\\f" - ).replace(/[\b]/g, "\\b" - ).replace(/[\n]/g, "\\n" - ).replace(/[\t]/g, "\\t" - ).replace(/[\r]/g, "\\r"); -}; - -dojo.lang.reprNumber = function(num){ - return num + ""; -}; - -(function(){ - var m = dojo.lang; - m.registerRepr("arrayLike", m.isArrayLike, m.reprArrayLike); - m.registerRepr("string", m.isString, m.reprString); - m.registerRepr("numbers", m.isNumber, m.reprNumber); - m.registerRepr("boolean", m.isBoolean, m.reprNumber); - // m.registerRepr("numbers", m.typeMatcher("number", "boolean"), m.reprNumber); -})(); - -/** - * Creates a 1-D array out of all the arguments passed, - * unravelling any array-like objects in the process - * - * Ex: - * unnest(1, 2, 3) ==> [1, 2, 3] - * unnest(1, [2, [3], [[[4]]]]) ==> [1, 2, 3, 4] - */ -dojo.lang.unnest = function(/* ... */) { - var out = []; - for(var i = 0; i < arguments.length; i++) { - if(dojo.lang.isArrayLike(arguments[i])) { - var add = dojo.lang.unnest.apply(this, arguments[i]); - out = out.concat(add); - } else { - out.push(arguments[i]); - } - } - return out; -} - -/** - * Return the first argument that isn't undefined - */ -dojo.lang.firstValued = function(/* ... */) { - for(var i = 0; i < arguments.length; i++) { - if(typeof arguments[i] != "undefined") { - return arguments[i]; - } - } - return undefined; -} - -/** - * Converts an array-like object (i.e. arguments, DOMCollection) - * to an array -**/ -dojo.lang.toArray = function(arrayLike, startOffset) { - var array = []; - for(var i = startOffset||0; i < arrayLike.length; i++) { - array.push(arrayLike[i]); - } - return array; -} - -dojo.provide("dojo.string"); -dojo.require("dojo.lang"); - -/** - * Trim whitespace from 'str'. If 'wh' > 0, - * only trim from start, if 'wh' < 0, only trim - * from end, otherwise trim both ends - */ -dojo.string.trim = function(str, wh){ - if(!dojo.lang.isString(str)){ return str; } - if(!str.length){ return str; } - if(wh > 0) { - return str.replace(/^\s+/, ""); - } else if(wh < 0) { - return str.replace(/\s+$/, ""); - } else { - return str.replace(/^\s+|\s+$/g, ""); - } -} - -/** - * Trim whitespace at the beginning of 'str' - */ -dojo.string.trimStart = function(str) { - return dojo.string.trim(str, 1); -} - -/** - * Trim whitespace at the end of 'str' - */ -dojo.string.trimEnd = function(str) { - return dojo.string.trim(str, -1); -} - -/** - * Parameterized string function - * str - formatted string with %{values} to be replaces - * pairs - object of name: "value" value pairs - * killExtra - remove all remaining %{values} after pairs are inserted - */ -dojo.string.paramString = function(str, pairs, killExtra) { - for(var name in pairs) { - var re = new RegExp("\\%\\{" + name + "\\}", "g"); - str = str.replace(re, pairs[name]); - } - - if(killExtra) { str = str.replace(/%\{([^\}\s]+)\}/g, ""); } - return str; -} - -/** Uppercases the first letter of each word */ -dojo.string.capitalize = function (str) { - if (!dojo.lang.isString(str)) { return ""; } - if (arguments.length == 0) { str = this; } - var words = str.split(' '); - var retval = ""; - var len = words.length; - for (var i=0; i/gm, ">").replace(/"/gm, """); - if(!noSingleQuotes) { str = str.replace(/'/gm, "'"); } - return str; -} - -dojo.string.escapeSql = function(str) { - return str.replace(/'/gm, "''"); -} - -dojo.string.escapeRegExp = function(str) { - return str.replace(/\\/gm, "\\\\").replace(/([\f\b\n\t\r])/gm, "\\$1"); -} - -dojo.string.escapeJavaScript = function(str) { - return str.replace(/(["'\f\b\n\t\r])/gm, "\\$1"); -} - -/** - * Return 'str' repeated 'count' times, optionally - * placing 'separator' between each rep - */ -dojo.string.repeat = function(str, count, separator) { - var out = ""; - for(var i = 0; i < count; i++) { - out += str; - if(separator && i < count - 1) { - out += separator; - } - } - return out; -} - -/** - * Returns true if 'str' ends with 'end' - */ -dojo.string.endsWith = function(str, end, ignoreCase) { - if(ignoreCase) { - str = str.toLowerCase(); - end = end.toLowerCase(); - } - return str.lastIndexOf(end) == str.length - end.length; -} - -/** - * Returns true if 'str' ends with any of the arguments[2 -> n] - */ -dojo.string.endsWithAny = function(str /* , ... */) { - for(var i = 1; i < arguments.length; i++) { - if(dojo.string.endsWith(str, arguments[i])) { - return true; - } - } - return false; -} - -/** - * Returns true if 'str' starts with 'start' - */ -dojo.string.startsWith = function(str, start, ignoreCase) { - if(ignoreCase) { - str = str.toLowerCase(); - start = start.toLowerCase(); - } - return str.indexOf(start) == 0; -} - -/** - * Returns true if 'str' starts with any of the arguments[2 -> n] - */ -dojo.string.startsWithAny = function(str /* , ... */) { - for(var i = 1; i < arguments.length; i++) { - if(dojo.string.startsWith(str, arguments[i])) { - return true; - } - } - return false; -} - -/** - * Returns true if 'str' starts with any of the arguments 2 -> n - */ -dojo.string.has = function(str /* , ... */) { - for(var i = 1; i < arguments.length; i++) { - if(str.indexOf(arguments[i] > -1)) { - return true; - } - } - return false; -} - -/** - * Pad 'str' to guarantee that it is at least 'len' length - * with the character 'c' at either the start (dir=1) or - * end (dir=-1) of the string - */ -dojo.string.pad = function(str, len/*=2*/, c/*='0'*/, dir/*=1*/) { - var out = String(str); - if(!c) { - c = '0'; - } - if(!dir) { - dir = 1; - } - while(out.length < len) { - if(dir > 0) { - out = c + out; - } else { - out += c; - } - } - return out; -} - -/** same as dojo.string.pad(str, len, c, 1) */ -dojo.string.padLeft = function(str, len, c) { - return dojo.string.pad(str, len, c, 1); -} - -/** same as dojo.string.pad(str, len, c, -1) */ -dojo.string.padRight = function(str, len, c) { - return dojo.string.pad(str, len, c, -1); -} - -dojo.string.normalizeNewlines = function (text,newlineChar) { - if (newlineChar == "\n") { - text = text.replace(/\r\n/g, "\n"); - text = text.replace(/\r/g, "\n"); - } else if (newlineChar == "\r") { - text = text.replace(/\r\n/g, "\r"); - text = text.replace(/\n/g, "\r"); - } else { - text = text.replace(/([^\r])\n/g, "$1\r\n"); - text = text.replace(/\r([^\n])/g, "\r\n$1"); - } - return text; -} - -dojo.string.splitEscaped = function (str,charac) { - var components = []; - for (var i = 0, prevcomma = 0; i < str.length; i++) { - if (str.charAt(i) == '\\') { i++; continue; } - if (str.charAt(i) == charac) { - components.push(str.substring(prevcomma, i)); - prevcomma = i + 1; - } - } - components.push(str.substr(prevcomma)); - return components; -} - - -// do we even want to offer this? is it worth it? -dojo.string.addToPrototype = function() { - for(var method in dojo.string) { - if(dojo.lang.isFunction(dojo.string[method])) { - var func = (function() { - var meth = method; - switch(meth) { - case "addToPrototype": - return null; - break; - case "escape": - return function(type) { - return dojo.string.escape(type, this); - } - break; - default: - return function() { - var args = [this]; - for(var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - dojo.debug(args); - return dojo.string[meth].apply(dojo.string, args); - } - } - })(); - if(func) { String.prototype[method] = func; } - } - } -} - -dojo.provide("dojo.io.IO"); -dojo.require("dojo.string"); - -/****************************************************************************** - * Notes about dojo.io design: - * - * The dojo.io.* package has the unenviable task of making a lot of different - * types of I/O feel natural, despite a universal lack of good (or even - * reasonable!) I/O capability in the host environment. So lets pin this down - * a little bit further. - * - * Rhino: - * perhaps the best situation anywhere. Access to Java classes allows you - * to do anything one might want in terms of I/O, both synchronously and - * async. Can open TCP sockets and perform low-latency client/server - * interactions. HTTP transport is available through Java HTTP client and - * server classes. Wish it were always this easy. - * - * xpcshell: - * XPCOM for I/O. A cluster-fuck to be sure. - * - * spidermonkey: - * S.O.L. - * - * Browsers: - * Browsers generally do not provide any useable filesystem access. We are - * therefore limited to HTTP for moving information to and from Dojo - * instances living in a browser. - * - * XMLHTTP: - * Sync or async, allows reading of arbitrary text files (including - * JS, which can then be eval()'d), writing requires server - * cooperation and is limited to HTTP mechanisms (POST and GET). - * - * "); - } -}catch(e){/* squelch */} - -dojo.io.checkChildrenForFile = function(node){ - var hasFile = false; - var inputs = node.getElementsByTagName("input"); - dojo.lang.forEach(inputs, function(input){ - if(hasFile){ return; } - if(input.getAttribute("type")=="file"){ - hasFile = true; - } - }); - return hasFile; -} - -dojo.io.formHasFile = function(formNode){ - return dojo.io.checkChildrenForFile(formNode); -} - -// TODO: Move to htmlUtils -dojo.io.encodeForm = function(formNode, encoding){ - if((!formNode)||(!formNode.tagName)||(!formNode.tagName.toLowerCase() == "form")){ - dojo.raise("Attempted to encode a non-form element."); - } - var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii; - var values = []; - - for(var i = 0; i < formNode.elements.length; i++){ - var elm = formNode.elements[i]; - if(elm.disabled || elm.tagName.toLowerCase() == "fieldset" || !elm.name){ - continue; - } - var name = enc(elm.name); - var type = elm.type.toLowerCase(); - - if(type == "select-multiple"){ - for(var j = 0; j < elm.options.length; j++){ - if(elm.options[j].selected) { - values.push(name + "=" + enc(elm.options[j].value)); - } - } - }else if(dojo.lang.inArray(type, ["radio", "checkbox"])){ - if(elm.checked){ - values.push(name + "=" + enc(elm.value)); - } - }else if(!dojo.lang.inArray(type, ["file", "submit", "reset", "button"])) { - values.push(name + "=" + enc(elm.value)); - } - } - - // now collect input type="image", which doesn't show up in the elements array - var inputs = formNode.getElementsByTagName("input"); - for(var i = 0; i < inputs.length; i++) { - var input = inputs[i]; - if(input.type.toLowerCase() == "image" && input.form == formNode) { - var name = enc(input.name); - values.push(name + "=" + enc(input.value)); - values.push(name + ".x=0"); - values.push(name + ".y=0"); - } - } - return values.join("&") + "&"; -} - -dojo.io.setIFrameSrc = function(iframe, src, replace){ - try{ - var r = dojo.render.html; - // dojo.debug(iframe); - if(!replace){ - if(r.safari){ - iframe.location = src; - }else{ - frames[iframe.name].location = src; - } - }else{ - // Fun with DOM 0 incompatibilities! - var idoc; - if(r.ie){ - idoc = iframe.contentWindow.document; - }else if(r.moz){ - idoc = iframe.contentWindow; - }else if(r.safari){ - idoc = iframe.document; - } - idoc.location.replace(src); - } - }catch(e){ - dojo.debug(e); - dojo.debug("setIFrameSrc: "+e); - } -} - -dojo.io.XMLHTTPTransport = new function(){ - var _this = this; - - this.initialHref = window.location.href; - this.initialHash = window.location.hash; - - this.moveForward = false; - - var _cache = {}; // FIXME: make this public? do we even need to? - this.useCache = false; // if this is true, we'll cache unless kwArgs.useCache = false - this.preventCache = false; // if this is true, we'll always force GET requests to cache - this.historyStack = []; - this.forwardStack = []; - this.historyIframe = null; - this.bookmarkAnchor = null; - this.locationTimer = null; - - /* NOTES: - * Safari 1.2: - * back button "works" fine, however it's not possible to actually - * DETECT that you've moved backwards by inspecting window.location. - * Unless there is some other means of locating. - * FIXME: perhaps we can poll on history.length? - * IE 5.5 SP2: - * back button behavior is macro. It does not move back to the - * previous hash value, but to the last full page load. This suggests - * that the iframe is the correct way to capture the back button in - * these cases. - * IE 6.0: - * same behavior as IE 5.5 SP2 - * Firefox 1.0: - * the back button will return us to the previous hash on the same - * page, thereby not requiring an iframe hack, although we do then - * need to run a timer to detect inter-page movement. - */ - - // FIXME: Should this even be a function? or do we just hard code it in the next 2 functions? - function getCacheKey(url, query, method) { - return url + "|" + query + "|" + method.toLowerCase(); - } - - function addToCache(url, query, method, http) { - _cache[getCacheKey(url, query, method)] = http; - } - - function getFromCache(url, query, method) { - return _cache[getCacheKey(url, query, method)]; - } - - this.clearCache = function() { - _cache = {}; - } - - // moved successful load stuff here - function doLoad(kwArgs, http, url, query, useCache) { - if((http.status==200)||(location.protocol=="file:" && http.status==0)) { - var ret; - if(kwArgs.method.toLowerCase() == "head"){ - var headers = http.getAllResponseHeaders(); - ret = {}; - ret.toString = function(){ return headers; } - var values = headers.split(/[\r\n]+/g); - for(var i = 0; i < values.length; i++) { - var pair = values[i].match(/^([^:]+)\s*:\s*(.+)$/i); - if(pair) { - ret[pair[1]] = pair[2]; - } - } - }else if(kwArgs.mimetype == "text/javascript"){ - try{ - ret = dj_eval(http.responseText); - }catch(e){ - dojo.debug(e); - dojo.debug(http.responseText); - ret = null; - } - }else if(kwArgs.mimetype == "text/json"){ - try{ - ret = dj_eval("("+http.responseText+")"); - }catch(e){ - dojo.debug(e); - dojo.debug(http.responseText); - ret = false; - } - }else if((kwArgs.mimetype == "application/xml")|| - (kwArgs.mimetype == "text/xml")){ - ret = http.responseXML; - if(!ret || typeof ret == "string") { - ret = dojo.dom.createDocumentFromText(http.responseText); - } - }else{ - ret = http.responseText; - } - - if(useCache){ // only cache successful responses - addToCache(url, query, kwArgs.method, http); - } - kwArgs[(typeof kwArgs.load == "function") ? "load" : "handle"]("load", ret, http); - }else{ - var errObj = new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); - kwArgs[(typeof kwArgs.error == "function") ? "error" : "handle"]("error", errObj, http); - } - } - - // set headers (note: Content-Type will get overriden if kwArgs.contentType is set) - function setHeaders(http, kwArgs){ - if(kwArgs["headers"]) { - for(var header in kwArgs["headers"]) { - if(header.toLowerCase() == "content-type" && !kwArgs["contentType"]) { - kwArgs["contentType"] = kwArgs["headers"][header]; - } else { - http.setRequestHeader(header, kwArgs["headers"][header]); - } - } - } - } - - this.addToHistory = function(args){ - var callback = args["back"]||args["backButton"]||args["handle"]; - var hash = null; - if(!this.historyIframe){ - this.historyIframe = window.frames["djhistory"]; - } - if(!this.bookmarkAnchor){ - this.bookmarkAnchor = document.createElement("a"); - (document.body||document.getElementsByTagName("body")[0]).appendChild(this.bookmarkAnchor); - this.bookmarkAnchor.style.display = "none"; - } - if((!args["changeUrl"])||(dojo.render.html.ie)){ - var url = dojo.hostenv.getBaseScriptUri()+"iframe_history.html?"+(new Date()).getTime(); - this.moveForward = true; - dojo.io.setIFrameSrc(this.historyIframe, url, false); - } - if(args["changeUrl"]){ - hash = "#"+ ((args["changeUrl"]!==true) ? args["changeUrl"] : (new Date()).getTime()); - setTimeout("window.location.href = '"+hash+"';", 1); - this.bookmarkAnchor.href = hash; - if(dojo.render.html.ie){ - // IE requires manual setting of the hash since we are catching - // events from the iframe - var oldCB = callback; - var lh = null; - var hsl = this.historyStack.length-1; - if(hsl>=0){ - while(!this.historyStack[hsl]["urlHash"]){ - hsl--; - } - lh = this.historyStack[hsl]["urlHash"]; - } - if(lh){ - callback = function(){ - if(window.location.hash != ""){ - setTimeout("window.location.href = '"+lh+"';", 1); - } - oldCB(); - } - } - // when we issue a new bind(), we clobber the forward - // FIXME: is this always a good idea? - this.forwardStack = []; - var oldFW = args["forward"]||args["forwardButton"];; - var tfw = function(){ - if(window.location.hash != ""){ - window.location.href = hash; - } - if(oldFW){ // we might not actually have one - oldFW(); - } - } - if(args["forward"]){ - args.forward = tfw; - }else if(args["forwardButton"]){ - args.forwardButton = tfw; - } - }else if(dojo.render.html.moz){ - // start the timer - if(!this.locationTimer){ - this.locationTimer = setInterval("dojo.io.XMLHTTPTransport.checkLocation();", 200); - } - } - } - - this.historyStack.push({"url": url, "callback": callback, "kwArgs": args, "urlHash": hash}); - } - - this.checkLocation = function(){ - var hsl = this.historyStack.length; - - if((window.location.hash == this.initialHash)||(window.location.href == this.initialHref)&&(hsl == 1)){ - // FIXME: could this ever be a forward button? - // we can't clear it because we still need to check for forwards. Ugg. - // clearInterval(this.locationTimer); - this.handleBackButton(); - return; - } - // first check to see if we could have gone forward. We always halt on - // a no-hash item. - if(this.forwardStack.length > 0){ - if(this.forwardStack[this.forwardStack.length-1].urlHash == window.location.hash){ - this.handleForwardButton(); - return; - } - } - // ok, that didn't work, try someplace back in the history stack - if((hsl >= 2)&&(this.historyStack[hsl-2])){ - if(this.historyStack[hsl-2].urlHash==window.location.hash){ - this.handleBackButton(); - return; - } - } - } - - this.iframeLoaded = function(evt, ifrLoc){ - var isp = ifrLoc.href.split("?"); - if(isp.length < 2){ - // alert("iframeLoaded"); - // we hit the end of the history, so we should go back - if(this.historyStack.length == 1){ - this.handleBackButton(); - } - return; - } - var query = isp[1]; - if(this.moveForward){ - // we were expecting it, so it's not either a forward or backward - // movement - this.moveForward = false; - return; - } - - var last = this.historyStack.pop(); - // we don't have anything in history, so it could be a forward button - if(!last){ - if(this.forwardStack.length > 0){ - var next = this.forwardStack[this.forwardStack.length-1]; - if(query == next.url.split("?")[1]){ - this.handleForwardButton(); - } - } - // regardless, we didnt' have any history, so it can't be a back button - return; - } - // put it back on the stack so we can do something useful with it when - // we call handleBackButton() - this.historyStack.push(last); - if(this.historyStack.length >= 2){ - if(isp[1] == this.historyStack[this.historyStack.length-2].url.split("?")[1]){ - // looks like it IS a back button press, so handle it - this.handleBackButton(); - } - }else{ - this.handleBackButton(); - } - } - - this.handleBackButton = function(){ - var last = this.historyStack.pop(); - if(!last){ return; } - if(last["callback"]){ - last.callback(); - }else if(last.kwArgs["backButton"]){ - last.kwArgs["backButton"](); - }else if(last.kwArgs["back"]){ - last.kwArgs["back"](); - }else if(last.kwArgs["handle"]){ - last.kwArgs.handle("back"); - } - this.forwardStack.push(last); - } - - this.handleForwardButton = function(){ - // FIXME: should we build in support for re-issuing the bind() call here? - // alert("alert we found a forward button call"); - var last = this.forwardStack.pop(); - if(!last){ return; } - if(last.kwArgs["forward"]){ - last.kwArgs.forward(); - }else if(last.kwArgs["forwardButton"]){ - last.kwArgs.forwardButton(); - }else if(last.kwArgs["handle"]){ - last.kwArgs.handle("forward"); - } - this.historyStack.push(last); - } - - this.inFlight = []; - this.inFlightTimer = null; - - this.startWatchingInFlight = function(){ - if(!this.inFlightTimer){ - this.inFlightTimer = setInterval("dojo.io.XMLHTTPTransport.watchInFlight();", 10); - } - } - - this.watchInFlight = function(){ - for(var x=this.inFlight.length-1; x>=0; x--){ - var tif = this.inFlight[x]; - if(!tif){ this.inFlight.splice(x, 1); continue; } - if(4==tif.http.readyState){ - // remove it so we can clean refs - this.inFlight.splice(x, 1); - doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache); - if(this.inFlight.length == 0){ - clearInterval(this.inFlightTimer); - this.inFlightTimer = null; - } - } // FIXME: need to implement a timeout param here! - } - } - - var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false; - this.canHandle = function(kwArgs){ - // canHandle just tells dojo.io.bind() if this is a good transport to - // use for the particular type of request. - - // FIXME: we need to determine when form values need to be - // multi-part mime encoded and avoid using this transport for those - // requests. - return hasXmlHttp - && dojo.lang.inArray((kwArgs["mimetype"]||"".toLowerCase()), ["text/plain", "text/html", "application/xml", "text/xml", "text/javascript", "text/json"]) - && dojo.lang.inArray(kwArgs["method"].toLowerCase(), ["post", "get", "head"]) - && !( kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"]) ); - } - - this.multipartBoundary = "45309FFF-BD65-4d50-99C9-36986896A96F"; // unique guid as a boundary value for multipart posts - - this.bind = function(kwArgs){ - if(!kwArgs["url"]){ - // are we performing a history action? - if( !kwArgs["formNode"] - && (kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"] || kwArgs["watchForURL"]) - && (!djConfig.preventBackButtonFix)) { - this.addToHistory(kwArgs); - return true; - } - } - - // build this first for cache purposes - var url = kwArgs.url; - var query = ""; - if(kwArgs["formNode"]){ - var ta = kwArgs.formNode.getAttribute("action"); - if((ta)&&(!kwArgs["url"])){ url = ta; } - var tp = kwArgs.formNode.getAttribute("method"); - if((tp)&&(!kwArgs["method"])){ kwArgs.method = tp; } - query += dojo.io.encodeForm(kwArgs.formNode, kwArgs.encoding); - } - - if(url.indexOf("#") > -1) { - dojo.debug("Warning: dojo.io.bind: stripping hash values from url:", url); - url = url.split("#")[0]; - } - - if(kwArgs["file"]){ - // force post for file transfer - kwArgs.method = "post"; - } - - if(!kwArgs["method"]){ - kwArgs.method = "get"; - } - - // guess the multipart value - if(kwArgs.method.toLowerCase() == "get"){ - // GET cannot use multipart - kwArgs.multipart = false; - }else{ - if(kwArgs["file"]){ - // enforce multipart when sending files - kwArgs.multipart = true; - }else if(!kwArgs["multipart"]){ - // default - kwArgs.multipart = false; - } - } - - if(kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"]){ - this.addToHistory(kwArgs); - } - - var content = kwArgs["content"] || {}; - - if(kwArgs.sendTransport) { - content["dojo.transport"] = "xmlhttp"; - } - - do { // break-block - if(kwArgs.postContent){ - query = kwArgs.postContent; - break; - } - - if(content) { - query += dojo.io.argsFromMap(content, kwArgs.encoding); - } - - if(kwArgs.method.toLowerCase() == "get" || !kwArgs.multipart){ - break; - } - - var t = []; - if(query.length){ - var q = query.split("&"); - for(var i = 0; i < q.length; ++i){ - if(q[i].length){ - var p = q[i].split("="); - t.push( "--" + this.multipartBoundary, - "Content-Disposition: form-data; name=\"" + p[0] + "\"", - "", - p[1]); - } - } - } - - if(kwArgs.file){ - if(dojo.lang.isArray(kwArgs.file)){ - for(var i = 0; i < kwArgs.file.length; ++i){ - var o = kwArgs.file[i]; - t.push( "--" + this.multipartBoundary, - "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", - "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), - "", - o.content); - } - }else{ - var o = kwArgs.file; - t.push( "--" + this.multipartBoundary, - "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", - "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), - "", - o.content); - } - } - - if(t.length){ - t.push("--"+this.multipartBoundary+"--", ""); - query = t.join("\r\n"); - } - }while(false); - - // kwArgs.Connection = "close"; - - var async = kwArgs["sync"] ? false : true; - - var preventCache = kwArgs["preventCache"] || - (this.preventCache == true && kwArgs["preventCache"] != false); - var useCache = kwArgs["useCache"] == true || - (this.useCache == true && kwArgs["useCache"] != false ); - - // preventCache is browser-level (add query string junk), useCache - // is for the local cache. If we say preventCache, then don't attempt - // to look in the cache, but if useCache is true, we still want to cache - // the response - if(!preventCache && useCache){ - var cachedHttp = getFromCache(url, query, kwArgs.method); - if(cachedHttp){ - doLoad(kwArgs, cachedHttp, url, query, false); - return; - } - } - - // much of this is from getText, but reproduced here because we need - // more flexibility - var http = dojo.hostenv.getXmlhttpObject(); - var received = false; - - // build a handler function that calls back to the handler obj - if(async){ - // FIXME: setting up this callback handler leaks on IE!!! - this.inFlight.push({ - "req": kwArgs, - "http": http, - "url": url, - "query": query, - "useCache": useCache - }); - this.startWatchingInFlight(); - } - - if(kwArgs.method.toLowerCase() == "post"){ - // FIXME: need to hack in more flexible Content-Type setting here! - http.open("POST", url, async); - setHeaders(http, kwArgs); - http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) : - (kwArgs.contentType || "application/x-www-form-urlencoded")); - http.send(query); - }else{ - var tmpUrl = url; - if(query != "") { - tmpUrl += (tmpUrl.indexOf("?") > -1 ? "&" : "?") + query; - } - if(preventCache) { - tmpUrl += (dojo.string.endsWithAny(tmpUrl, "?", "&") - ? "" : (tmpUrl.indexOf("?") > -1 ? "&" : "?")) + "dojo.preventCache=" + new Date().valueOf(); - } - http.open(kwArgs.method.toUpperCase(), tmpUrl, async); - setHeaders(http, kwArgs); - http.send(null); - } - - if( !async ) { - doLoad(kwArgs, http, url, query, useCache); - } - - kwArgs.abort = function(){ - return http.abort(); - } - - return; - } - dojo.io.transports.addTransport("XMLHTTPTransport"); -} - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/alg/Alg.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/alg/Alg.js deleted file mode 100644 index 144a1d4dc..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/alg/Alg.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.alg.Alg"); -dojo.require("dojo.lang"); -dj_deprecated("dojo.alg.Alg is deprecated, use dojo.lang instead"); - -dojo.alg.find = function(arr, val){ return dojo.lang.find(arr, val); } - -dojo.alg.inArray = function(arr, val){ - return dojo.lang.inArray(arr, val); -} -dojo.alg.inArr = dojo.alg.inArray; // for backwards compatibility - -dojo.alg.getNameInObj = function(ns, item){ - return dojo.lang.getNameInObj(ns, item); -} - -// is this the right place for this? -dojo.alg.has = function(obj, name){ - return dojo.lang.has(obj, name); -} - -dojo.alg.forEach = function(arr, unary_func, fix_length){ - return dojo.lang.forEach(arr, unary_func, fix_length); -} - -dojo.alg.for_each = dojo.alg.forEach; // burst compat - -dojo.alg.map = function(arr, obj, unary_func){ - return dojo.lang.map(arr, obj, unary_func); -} - -dojo.alg.tryThese = function(){ - return dojo.lang.tryThese.apply(dojo.lang, arguments); -} - -dojo.alg.delayThese = function(farr, cb, delay, onend){ - return dojo.lang.delayThese.apply(dojo.lang, arguments); -} - -dojo.alg.for_each_call = dojo.alg.map; // burst compat diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/alg/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/alg/__package__.js deleted file mode 100644 index 7f5efb453..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/alg/__package__.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.alg.Alg", false, true); -dojo.hostenv.moduleLoaded("dojo.alg.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js deleted file mode 100644 index 1d25bcb29..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js +++ /dev/null @@ -1,361 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.animation"); -dojo.provide("dojo.animation.Animation"); - -dojo.require("dojo.lang"); -dojo.require("dojo.math"); -dojo.require("dojo.math.curves"); - -/* -Animation package based off of Dan Pupius' work on Animations: -http://pupius.co.uk/js/Toolkit.Drawing.js -*/ - -dojo.animation.Animation = function(curve, duration, accel, repeatCount, rate) { - // public properties - if(dojo.lang.isArray(curve)) { - curve = new dojo.math.curves.Line(curve[0], curve[1]); - } - this.curve = curve; - this.duration = duration; - this.repeatCount = repeatCount || 0; - this.rate = rate || 25; - if(accel) { - if(dojo.lang.isFunction(accel.getValue)) { - this.accel = accel; - } else { - var i = 0.35*accel+0.5; // 0.15 <= i <= 0.85 - this.accel = new dojo.math.curves.CatmullRom([[0], [i], [1]], 0.45); - } - } -} -dojo.lang.extend(dojo.animation.Animation, { - // public properties - curve: null, - duration: 0, - repeatCount: 0, - accel: null, - - // events - onBegin: null, - onAnimate: null, - onEnd: null, - onPlay: null, - onPause: null, - onStop: null, - handler: null, - - // "private" properties - _animSequence: null, - _startTime: null, - _endTime: null, - _lastFrame: null, - _timer: null, - _percent: 0, - _active: false, - _paused: false, - _startRepeatCount: 0, - - // public methods - play: function(gotoStart) { - if( gotoStart ) { - clearTimeout(this._timer); - this._active = false; - this._paused = false; - this._percent = 0; - } else if( this._active && !this._paused ) { - return; - } - - this._startTime = new Date().valueOf(); - if( this._paused ) { - this._startTime -= (this.duration * this._percent / 100); - } - this._endTime = this._startTime + this.duration; - this._lastFrame = this._startTime; - - var e = new dojo.animation.AnimationEvent(this, null, this.curve.getValue(this._percent), - this._startTime, this._startTime, this._endTime, this.duration, this._percent, 0); - - this._active = true; - this._paused = false; - - if( this._percent == 0 ) { - if(!this._startRepeatCount) { - this._startRepeatCount = this.repeatCount; - } - e.type = "begin"; - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onBegin == "function") { this.onBegin(e); } - } - - e.type = "play"; - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onPlay == "function") { this.onPlay(e); } - - if(this._animSequence) { this._animSequence._setCurrent(this); } - - //dojo.lang.hitch(this, cycle)(); - this._cycle(); - }, - - pause: function() { - clearTimeout(this._timer); - if( !this._active ) { return; } - this._paused = true; - var e = new dojo.animation.AnimationEvent(this, "pause", this.curve.getValue(this._percent), - this._startTime, new Date().valueOf(), this._endTime, this.duration, this._percent, 0); - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onPause == "function") { this.onPause(e); } - }, - - playPause: function() { - if( !this._active || this._paused ) { - this.play(); - } else { - this.pause(); - } - }, - - gotoPercent: function(pct, andPlay) { - clearTimeout(this._timer); - this._active = true; - this._paused = true; - this._percent = pct; - if( andPlay ) { this.play(); } - }, - - stop: function(gotoEnd) { - clearTimeout(this._timer); - var step = this._percent / 100; - if( gotoEnd ) { - step = 1; - } - var e = new dojo.animation.AnimationEvent(this, "stop", this.curve.getValue(step), - this._startTime, new Date().valueOf(), this._endTime, this.duration, this._percent, Math.round(fps)); - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onStop == "function") { this.onStop(e); } - this._active = false; - this._paused = false; - }, - - status: function() { - if( this._active ) { - return this._paused ? "paused" : "playing"; - } else { - return "stopped"; - } - }, - - // "private" methods - _cycle: function() { - clearTimeout(this._timer); - if( this._active ) { - var curr = new Date().valueOf(); - var step = (curr - this._startTime) / (this._endTime - this._startTime); - fps = 1000 / (curr - this._lastFrame); - this._lastFrame = curr; - - if( step >= 1 ) { - step = 1; - this._percent = 100; - } else { - this._percent = step * 100; - } - - // Perform accelleration - if(this.accel && this.accel.getValue) { - step = this.accel.getValue(step); - } - - var e = new dojo.animation.AnimationEvent(this, "animate", this.curve.getValue(step), - this._startTime, curr, this._endTime, this.duration, this._percent, Math.round(fps)); - - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onAnimate == "function") { this.onAnimate(e); } - - if( step < 1 ) { - this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate); - } else { - e.type = "end"; - this._active = false; - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onEnd == "function") { this.onEnd(e); } - - if( this.repeatCount > 0 ) { - this.repeatCount--; - this.play(true); - } else if( this.repeatCount == -1 ) { - this.play(true); - } else { - if(this._startRepeatCount) { - this.repeatCount = this._startRepeatCount; - this._startRepeatCount = 0; - } - if( this._animSequence ) { - this._animSequence._playNext(); - } - } - } - } - } -}); - -dojo.animation.AnimationEvent = function(anim, type, coords, sTime, cTime, eTime, dur, pct, fps) { - this.type = type; // "animate", "begin", "end", "play", "pause", "stop" - this.animation = anim; - - this.coords = coords; - this.x = coords[0]; - this.y = coords[1]; - this.z = coords[2]; - - this.startTime = sTime; - this.currentTime = cTime; - this.endTime = eTime; - - this.duration = dur; - this.percent = pct; - this.fps = fps; -}; -dojo.lang.extend(dojo.animation.AnimationEvent, { - coordsAsInts: function() { - var cints = new Array(this.coords.length); - for(var i = 0; i < this.coords.length; i++) { - cints[i] = Math.round(this.coords[i]); - } - return cints; - } -}); - -dojo.animation.AnimationSequence = function(repeatCount){ - this._anims = []; - this.repeatCount = repeatCount || 0; -} - -dojo.lang.extend(dojo.animation.AnimationSequence, { - repeateCount: 0, - - _anims: [], - _currAnim: -1, - - onBegin: null, - onEnd: null, - onNext: null, - handler: null, - - add: function() { - for(var i = 0; i < arguments.length; i++) { - this._anims.push(arguments[i]); - arguments[i]._animSequence = this; - } - }, - - remove: function(anim) { - for(var i = 0; i < this._anims.length; i++) { - if( this._anims[i] == anim ) { - this._anims[i]._animSequence = null; - this._anims.splice(i, 1); - break; - } - } - }, - - removeAll: function() { - for(var i = 0; i < this._anims.length; i++) { - this._anims[i]._animSequence = null; - } - this._anims = []; - this._currAnim = -1; - }, - - clear: function() { - this.removeAll(); - }, - - play: function(gotoStart) { - if( this._anims.length == 0 ) { return; } - if( gotoStart || !this._anims[this._currAnim] ) { - this._currAnim = 0; - } - if( this._anims[this._currAnim] ) { - if( this._currAnim == 0 ) { - var e = {type: "begin", animation: this._anims[this._currAnim]}; - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onBegin == "function") { this.onBegin(e); } - } - this._anims[this._currAnim].play(gotoStart); - } - }, - - pause: function() { - if( this._anims[this._currAnim] ) { - this._anims[this._currAnim].pause(); - } - }, - - playPause: function() { - if( this._anims.length == 0 ) { return; } - if( this._currAnim == -1 ) { this._currAnim = 0; } - if( this._anims[this._currAnim] ) { - this._anims[this._currAnim].playPause(); - } - }, - - stop: function() { - if( this._anims[this._currAnim] ) { - this._anims[this._currAnim].stop(); - } - }, - - status: function() { - if( this._anims[this._currAnim] ) { - return this._anims[this._currAnim].status(); - } else { - return "stopped"; - } - }, - - _setCurrent: function(anim) { - for(var i = 0; i < this._anims.length; i++) { - if( this._anims[i] == anim ) { - this._currAnim = i; - break; - } - } - }, - - _playNext: function() { - if( this._currAnim == -1 || this._anims.length == 0 ) { return; } - this._currAnim++; - if( this._anims[this._currAnim] ) { - var e = {type: "next", animation: this._anims[this._currAnim]}; - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onNext == "function") { this.onNext(e); } - this._anims[this._currAnim].play(true); - } else { - var e = {type: "end", animation: this._anims[this._anims.length-1]}; - if(typeof this.handler == "function") { this.handler(e); } - if(typeof this.onEnd == "function") { this.onEnd(e); } - if(this.repeatCount > 0) { - this._currAnim = 0; - this.repeatCount--; - this._anims[this._currAnim].play(true); - } else if(this.repeatCount == -1) { - this._currAnim = 0; - this._anims[this._currAnim].play(true); - } else { - this._currAnim = -1; - } - } - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js deleted file mode 100644 index 335d243b2..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.animation.Timer"); -dojo.require("dojo.lang"); - -dojo.animation.Timer = function(intvl){ - var timer = null; - this.isRunning = false; - this.interval = intvl; - - this.onTick = function(){}; - this.onStart = null; - this.onStop = null; - - this.setInterval = function(ms){ - if (this.isRunning) window.clearInterval(timer); - this.interval = ms; - if (this.isRunning) timer = window.setInterval(dojo.lang.hitch(this, "onTick"), this.interval); - }; - - this.start = function(){ - if (typeof this.onStart == "function") this.onStart(); - this.isRunning = true; - timer = window.setInterval(this.onTick, this.interval); - }; - this.stop = function(){ - if (typeof this.onStop == "function") this.onStop(); - this.isRunning = false; - window.clearInterval(timer); - }; -}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js deleted file mode 100644 index 7e3a9cd32..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.hostenv.conditionalLoadModule({ - common: ["dojo.animation.Animation", false, false] -}); -dojo.hostenv.moduleLoaded("dojo.animation.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js deleted file mode 100644 index 071af451d..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js +++ /dev/null @@ -1,663 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/** -* @file bootstrap1.js -* -* bootstrap file that runs before hostenv_*.js file. -* -* @author Copyright 2004 Mark D. Anderson (mda@discerning.com) -* @author Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php -* -* $Id: bootstrap1.js 2836 2006-01-16 08:36:18Z alex $ -*/ - -/** - * The global djConfig can be set prior to loading the library, to override - * certain settings. It does not exist under dojo.* so that it can be set - * before the dojo variable exists. Setting any of these variables *after* the - * library has loaded does nothing at all. The variables that can be set are - * as follows: - */ - -/** - * dj_global is an alias for the top-level global object in the host - * environment (the "window" object in a browser). - */ -var dj_global = this; //typeof window == 'undefined' ? this : window; - -function dj_undef(name, obj){ - if(!obj){ obj = dj_global; } - return (typeof obj[name] == "undefined"); -} - -if(dj_undef("djConfig")){ - var djConfig = {}; -} - -/** - * dojo is the root variable of (almost all) our public symbols. - */ -var dojo; -if(dj_undef("dojo")){ dojo = {}; } - -dojo.version = { - major: 0, minor: 2, patch: 2, flag: "", - revision: Number("$Rev: 2836 $".match(/[0-9]+/)[0]), - toString: function() { - with (dojo.version) { - return major + "." + minor + "." + patch + flag + " (" + revision + ")"; - } - } -}; - -/* - * evaluate a string like "A.B" without using eval. - */ -dojo.evalObjPath = function(objpath, create){ - // fast path for no periods - if(typeof objpath != "string"){ return dj_global; } - if(objpath.indexOf('.') == -1){ - if((dj_undef(objpath, dj_global))&&(create)){ - dj_global[objpath] = {}; - } - return dj_global[objpath]; - } - - var syms = objpath.split(/\./); - var obj = dj_global; - for(var i=0;i 1) { - dojo.hostenv.modulesLoadedListeners.push(function() { - obj[fcnName](); - }); - } -}; - -dojo.hostenv.modulesLoaded = function(){ - if(this.post_load_){ return; } - if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){ - if(this.inFlightCount > 0){ - dojo.debug("files still in flight!"); - return; - } - if(typeof setTimeout == "object"){ - setTimeout("dojo.hostenv.loaded();", 0); - }else{ - dojo.hostenv.loaded(); - } - } -} - -dojo.hostenv.moduleLoaded = function(modulename){ - var modref = dojo.evalObjPath((modulename.split(".").slice(0, -1)).join('.')); - this.loaded_modules_[(new String(modulename)).toLowerCase()] = modref; -} - -/** -* loadModule("A.B") first checks to see if symbol A.B is defined. -* If it is, it is simply returned (nothing to do). -* -* If it is not defined, it will look for "A/B.js" in the script root directory, -* followed by "A.js". -* -* It throws if it cannot find a file to load, or if the symbol A.B is not -* defined after loading. -* -* It returns the object A.B. -* -* This does nothing about importing symbols into the current package. -* It is presumed that the caller will take care of that. For example, to import -* all symbols: -* -* with (dojo.hostenv.loadModule("A.B")) { -* ... -* } -* -* And to import just the leaf symbol: -* -* var B = dojo.hostenv.loadModule("A.B"); -* ... -* -* dj_load is an alias for dojo.hostenv.loadModule -*/ -dojo.hostenv._global_omit_module_check = false; -dojo.hostenv.loadModule = function(modulename, exact_only, omit_module_check){ - if(!modulename){ return; } - omit_module_check = this._global_omit_module_check || omit_module_check; - var module = this.findModule(modulename, false); - if(module){ - return module; - } - - // protect against infinite recursion from mutual dependencies - if(dj_undef(modulename, this.loading_modules_)){ - this.addedToLoadingCount.push(modulename); - } - this.loading_modules_[modulename] = 1; - - // convert periods to slashes - var relpath = modulename.replace(/\./g, '/') + '.js'; - - var syms = modulename.split("."); - var nsyms = modulename.split("."); - for (var i = syms.length - 1; i > 0; i--) { - var parentModule = syms.slice(0, i).join("."); - var parentModulePath = this.getModulePrefix(parentModule); - if (parentModulePath != parentModule) { - syms.splice(0, i, parentModulePath); - break; - } - } - var last = syms[syms.length - 1]; - // figure out if we're looking for a full package, if so, we want to do - // things slightly diffrently - if(last=="*"){ - modulename = (nsyms.slice(0, -1)).join('.'); - - while(syms.length){ - syms.pop(); - syms.push(this.pkgFileName); - relpath = syms.join("/") + '.js'; - if(relpath.charAt(0)=="/"){ - relpath = relpath.slice(1); - } - ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if(ok){ break; } - syms.pop(); - } - }else{ - relpath = syms.join("/") + '.js'; - modulename = nsyms.join('.'); - var ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if((!ok)&&(!exact_only)){ - syms.pop(); - while(syms.length){ - relpath = syms.join('/') + '.js'; - ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if(ok){ break; } - syms.pop(); - relpath = syms.join('/') + '/'+this.pkgFileName+'.js'; - if(relpath.charAt(0)=="/"){ - relpath = relpath.slice(1); - } - ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); - if(ok){ break; } - } - } - - if((!ok)&&(!omit_module_check)){ - dojo.raise("Could not load '" + modulename + "'; last tried '" + relpath + "'"); - } - } - - // check that the symbol was defined - if(!omit_module_check){ - // pass in false so we can give better error - module = this.findModule(modulename, false); - if(!module){ - dojo.raise("symbol '" + modulename + "' is not defined after loading '" + relpath + "'"); - } - } - - return module; -} - -/** -* startPackage("A.B") follows the path, and at each level creates a new empty -* object or uses what already exists. It returns the result. -*/ -dojo.hostenv.startPackage = function(packname){ - var syms = packname.split(/\./); - if(syms[syms.length-1]=="*"){ - syms.pop(); - } - return dojo.evalObjPath(syms.join("."), true); -} - -/** - * findModule("A.B") returns the object A.B if it exists, otherwise null. - * @param modulename A string like 'A.B'. - * @param must_exist Optional, defualt false. throw instead of returning null - * if the module does not currently exist. - */ -dojo.hostenv.findModule = function(modulename, must_exist) { - // check cache - /* - if(!dj_undef(modulename, this.modules_)){ - return this.modules_[modulename]; - } - */ - - var lmn = (new String(modulename)).toLowerCase(); - - if(this.loaded_modules_[lmn]){ - return this.loaded_modules_[lmn]; - } - - // see if symbol is defined anyway - var module = dojo.evalObjPath(modulename); - if((modulename)&&(typeof module != 'undefined')&&(module)){ - this.loaded_modules_[lmn] = module; - return module; - } - - if(must_exist){ - dojo.raise("no loaded module named '" + modulename + "'"); - } - return null; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js deleted file mode 100644 index 488c24ab5..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/* - * bootstrap2.js - runs after the hostenv_*.js file. - */ - -/* - * This method taks a "map" of arrays which one can use to optionally load dojo - * modules. The map is indexed by the possible dojo.hostenv.name_ values, with - * two additional values: "default" and "common". The items in the "default" - * array will be loaded if none of the other items have been choosen based on - * the hostenv.name_ item. The items in the "common" array will _always_ be - * loaded, regardless of which list is chosen. Here's how it's normally - * called: - * - * dojo.hostenv.conditionalLoadModule({ - * browser: [ - * ["foo.bar.baz", true, true], // an example that passes multiple args to loadModule() - * "foo.sample.*", - * "foo.test, - * ], - * default: [ "foo.sample.*" ], - * common: [ "really.important.module.*" ] - * }); - */ -dojo.hostenv.conditionalLoadModule = function(modMap){ - var common = modMap["common"]||[]; - var result = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]); - - for(var x=0; x=0; x--){ - dojo.clobberLastObject(removals[x]); - } - var depList = []; - var seen = {}; - for(var x=0; x"); - } - document.write(""); - dj_eval = old_dj_eval; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js deleted file mode 100644 index 8fd51cf2c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.ArrayList"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.ArrayList = function(arr){ - var items = []; - if (arr) items = items.concat(arr); - this.count = items.length; - this.add = function(obj){ - items.push(obj); - this.count = items.length; - }; - this.addRange = function(a){ - if (a.getIterator) { - var e = a.getIterator(); - while (!e.atEnd) { - this.add(e.current); - e.moveNext(); - } - this.count = items.length; - } else { - for (var i=0; i=0) { - items.splice(i,1); - } - this.count = items.length; - }; - this.removeAt = function(i){ - items.splice(i,1); - this.count = items.length; - }; - this.reverse = function(){ - items.reverse(); - }; - this.sort = function(fn){ - if (fn){ - items.sort(fn); - } else { - items.sort(); - } - }; - this.setByIndex = function(i, obj){ - items[i]=obj; - this.count=items.length; - }; - this.toArray = function(){ - return [].concat(items); - } - this.toString = function(){ - return items.join(","); - }; -}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js deleted file mode 100644 index 9166bc5a5..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js +++ /dev/null @@ -1,200 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.BinaryTree"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.BinaryTree = function(data){ - function node(data, rnode, lnode){ - this.value = data || null; - this.right = rnode || null; - this.left = lnode || null; - this.clone = function(){ - var c = new node(); - if (this.value.value) c.value = this.value.clone(); - else c.value = this.value; - if (this.left) c.left = this.left.clone(); - if (this.right) c.right = this.right.clone(); - } - this.compare = function(n){ - if (this.value > n.value) return 1; - if (this.value < n.value) return -1; - return 0; - } - this.compareData = function(d){ - if (this.value > d) return 1; - if (this.value < d) return -1; - return 0; - } - } - - function inorderTraversalBuildup(current, a){ - if (current){ - inorderTraversalBuildup(current.left, a); - a.add(current); - inorderTraversalBuildup(current.right, a); - } - } - - function preorderTraversal(current, sep){ - var s = ""; - if (current){ - s = current.value.toString() + sep; - s += preorderTraversal(current.left, sep); - s += preorderTraversal(current.right, sep); - } - return s; - } - function inorderTraversal(current, sep){ - var s = ""; - if (current){ - s = inorderTraversal(current.left, sep); - s += current.value.toString() + sep; - s += inorderTraversal(current.right, sep); - } - return s; - } - function postorderTraversal(current, sep){ - var s = ""; - if (current){ - s = postorderTraversal(current.left, sep); - s += postorderTraversal(current.right, sep); - s += current.value.toString() + sep; - } - return s; - } - - function searchHelper(current, data){ - if (!current) return null; - var i = current.compareData(data); - if (i == 0) return current; - if (result > 0) return searchHelper(current.left, data); - else return searchHelper(current.right, data); - } - - this.add = function(data){ - var n = new node(data); - var i; - var current = root; - var parent = null; - while (current){ - i = current.compare(n); - if (i == 0) return; - parent = current; - if (i > 0) current = current.left; - else current = current.right; - } - this.count++; - if (!parent) root = n; - else { - i = parent.compare(n); - if (i > 0) parent.left = n; - else parent.right = n; - } - }; - this.clear = function(){ - root = null; - this.count = 0; - }; - this.clone = function(){ - var c = new dojo.collections.BinaryTree(); - c.root = root.clone(); - c.count = this.count; - return c; - }; - this.contains = function(data){ - return this.search(data) != null; - }; - this.deleteData = function(data){ - var current = root; - var parent = null; - var i = current.compareData(data); - while (i != 0 && current != null){ - if (i > 0){ - parent = current; - current = current.left; - } else if (i < 0) { - parent = current; - current = current.right; - } - i = current.compareData(data); - } - if (!current) return; - this.count--; - if (!current.right) { - if (!parent) root = current.left; - else { - i = parent.compare(current); - if (i > 0) parent.left = current.left; - else if (i < 0) parent.right = current.left; - } - } else if (!current.right.left){ - if (!parent) root = current.right; - else { - i = parent.compare(current); - if (i > 0) parent.left = current.right; - else if (i < 0) parent.right = current.right; - } - } else { - var leftmost = current.right.left; - var lmParent = current.right; - while (leftmost.left != null){ - lmParent = leftmost; - leftmost = leftmost.left; - } - lmParent.left = leftmost.right; - leftmost.left = current.left; - leftmost.right = current.right; - if (!parent) root = leftmost; - else { - i = parent.compare(current); - if (i > 0) parent.left = leftmost; - else if (i < 0) parent.right = leftmost; - } - } - }; - this.getIterator = function(){ - var a = new ArrayList(); - inorderTraversalBuildup(root, a); - return a.getIterator(); - }; - this.search = function(data){ - return searchHelper(root, data); - }; - this.toString = function(order, sep){ - if (!order) var order = dojo.collections.BinaryTree.TraversalMethods.Inorder; - if (!sep) var sep = " "; - var s = ""; - switch (order){ - case dojo.collections.BinaryTree.TraversalMethods.Preorder: - s = preorderTraversal(root, sep); - break; - case dojo.collections.BinaryTree.TraversalMethods.Inorder: - s = inorderTraversal(root, sep); - break; - case dojo.collections.BinaryTree.TraversalMethods.Postorder: - s = postorderTraversal(root, sep); - break; - }; - if (s.length == 0) return ""; - else return s.substring(0, s.length - sep.length); - }; - - this.count = 0; - var root = this.root = null; - if (data) { - this.add(data); - } -} -dojo.collections.BinaryTree.TraversalMethods = { - Preorder : 0, - Inorder : 1, - Postorder : 2 -}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/ByteArray.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/ByteArray.js deleted file mode 100644 index b04aaa2ef..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/ByteArray.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.ByteArray"); -dojo.require("dojo.collections.Collections"); - -// the following is an implementation of a 32 bit Byte Array. -dojo.collections.ByteArray = function(s){ - - - -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js deleted file mode 100644 index 1a0e8bb07..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.Collections"); - -dojo.collections = {Collections:true}; -dojo.collections.DictionaryEntry = function(k,v){ - this.key = k; - this.value = v; - this.valueOf = function(){ return this.value; }; - this.toString = function(){ return this.value; }; -} - -dojo.collections.Iterator = function(a){ - var obj = a; - var position = 0; - this.atEnd = (position>=obj.length-1); - this.current = obj[position]; - this.moveNext = function(){ - if(++position>=obj.length){ - this.atEnd = true; - } - if(this.atEnd){ - return false; - } - this.current=obj[position]; - return true; - } - this.reset = function(){ - position = 0; - this.atEnd = false; - this.current = obj[position]; - } -} - -dojo.collections.DictionaryIterator = function(obj){ - var arr = [] ; // Create an indexing array - for (var p in obj) arr.push(obj[p]) ; // fill it up - var position = 0 ; - this.atEnd = (position>=arr.length-1); - this.current = arr[position]||null ; - this.entry = this.current||null ; - this.key = (this.entry)?this.entry.key:null ; - this.value = (this.entry)?this.entry.value:null ; - this.moveNext = function() { - if (++position>=arr.length) { - this.atEnd = true ; - } - if(this.atEnd){ - return false; - } - this.entry = this.current = arr[position] ; - if (this.entry) { - this.key = this.entry.key ; - this.value = this.entry.value ; - } - return true; - } ; - this.reset = function() { - position = 0 ; - this.atEnd = false ; - this.current = arr[position]||null ; - this.entry = this.current||null ; - this.key = (this.entry)?this.entry.key:null ; - this.value = (this.entry)?this.entry.value:null ; - } ; -}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js deleted file mode 100644 index 094078d33..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.Dictionary"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.Dictionary = function(dictionary){ - var items = {}; - this.count = 0; - - this.add = function(k,v){ - items[k] = new dojo.collections.DictionaryEntry(k,v); - this.count++; - }; - this.clear = function(){ - items = {}; - this.count = 0; - }; - this.clone = function(){ - return new dojo.collections.Dictionary(this); - }; - this.contains = this.containsKey = function(k){ - return (items[k] != null); - }; - this.containsValue = function(v){ - var e = this.getIterator(); - while (!e.atEnd) { - if (e.value == v) return true; - e.moveNext(); - } - return false; - }; - this.getKeyList = function(){ - var arr = []; - var e = this.getIterator(); - while (!e.atEnd) { - arr.push(e.key); - e.moveNext(); - } - return arr; - }; - this.getValueList = function(){ - var arr = []; - var e = this.getIterator(); - while (!e.atEnd) { - arr.push(e.value); - e.moveNext(); - } - return arr; - }; - this.item = function(k){ - return items[k]; - }; - this.getIterator = function(){ - return new dojo.collections.DictionaryIterator(items); - }; - this.remove = function(k){ - delete items[k]; - this.count--; - }; - - if (dictionary){ - var e = dictionary.getIterator(); - while (!e.atEnd) { - this.add(e.key, e.value); - e.moveNext(); - } - } -}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js deleted file mode 100644 index 8bd10ebcf..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.Graph"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.Graph = function(nodes){ - function node(key, data, neighbors) { - this.key = key; - this.data = data; - this.neighbors = neighbors || new adjacencyList(); - this.addDirected = function(){ - if (arguments[0].constructor == edgeToNeighbor){ - this.neighbors.add(arguments[0]); - } else { - var n = arguments[0]; - var cost = arguments[1] || 0; - this.neighbors.add(new edgeToNeighbor(n, cost)); - } - } - } - function nodeList(){ - var d = new dojo.collections.Dictionary(); - function nodelistiterator(){ - var o = [] ; // Create an indexing array - var e = d.getIterator(); - while (e.moveNext()) o[o.length] = e.current; - - var position = 0 ; - this.current = null ; - this.entry = null ; - this.key = null ; - this.value = null ; - this.atEnd = false ; - this.moveNext = function() { - if (this.atEnd) return !this.atEnd ; - this.entry = this.current = o[position] ; - if (this.entry) { - this.key = this.entry.key ; - this.value = this.entry.data ; - } - if (position == o.length) this.atEnd = true ; - position++ ; - return !this.atEnd ; - } ; - this.reset = function() { - position = 0 ; - this.atEnd = false ; - } ; - } - - this.add = function(node){ - d.add(node.key, node); - }; - this.clear = function(){ - d.clear(); - }; - this.containsKey = function(key){ - return d.containsKey(key); - }; - this.getIterator = function(){ - return new nodelistiterator(this); - }; - this.item = function(key){ - return d.item(key); - }; - this.remove = function(node){ - d.remove(node.key); - }; - } - function edgeToNeighbor(node, cost){ - this.neighbor = node; - this.cost = cost; - } - function adjacencyList(){ - var d = []; - this.add = function(o){ - d.push(o); - }; - this.item = function(i){ - return d[i]; - }; - this.getIterator = function(){ - return new dojo.collections.Iterator([].concat(d)); - }; - } - - this.nodes = nodes || new nodeList(); - this.count = this.nodes.count; - this.clear = function(){ - this.nodes.clear(); - this.count = 0; - }; - this.addNode = function(){ - var n = arguments[0]; - if (arguments.length > 1) { - n = new node(arguments[0], arguments[1]); - } - if (!this.nodes.containsKey(n.key)) { - this.nodes.add(n); - this.count++; - } - }; - this.addDirectedEdge = function(uKey, vKey, cost){ - var uNode, vNode; - if (uKey.constructor != node) { - uNode = this.nodes.item(uKey); - vNode = this.nodes.item(vKey); - } else { - uNode = uKey; - vNode = vKey; - } - var c = cost || 0; - uNode.addDirected(vNode, c); - }; - this.addUndirectedEdge = function(uKey, vKey, cost){ - var uNode, vNode; - if (uKey.constructor != node) { - uNode = this.nodes.item(uKey); - vNode = this.nodes.item(vKey); - } else { - uNode = uKey; - vNode = vKey; - } - var c = cost || 0; - uNode.addDirected(vNode, c); - vNode.addDirected(uNode, c); - }; - this.contains = function(n){ - return this.nodes.containsKey(n.key); - }; - this.containsKey = function(k){ - return this.nodes.containsKey(k); - }; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/List.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/List.js deleted file mode 100644 index 6779f0e63..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/List.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.List"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.List = function(dictionary){ - dojo.deprecated("dojo.collections.List", "Use dojo.collections.Dictionary instead."); - return new dojo.collections.Dictionary(dictionary); -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js deleted file mode 100644 index 4d68d1625..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.Queue"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.Queue = function(arr){ - var q = []; - if (arr) q = q.concat(arr); - this.count = q.length; - this.clear = function(){ - q = []; - this.count = q.length; - }; - this.clone = function(){ - return new dojo.collections.Queue(q); - }; - this.contains = function(o){ - for (var i = 0; i < q.length; i++){ - if (q[i] == o) return true; - } - return false; - }; - this.copyTo = function(arr, i){ - arr.splice(i,0,q); - }; - this.dequeue = function(){ - var r = q.shift(); - this.count = q.length; - return r; - }; - this.enqueue = function(o){ - this.count = q.push(o); - }; - this.getIterator = function(){ - return new dojo.collections.Iterator(q); - }; - this.peek = function(){ - return q[0]; - }; - this.toArray = function(){ - return [].concat(q); - }; -}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js deleted file mode 100644 index a14918721..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.Set"); -dojo.require("dojo.collections.Collections"); -dojo.require("dojo.collections.ArrayList"); - -// straight up sets are based on arrays or array-based collections. -dojo.collections.Set = new function(){ - this.union = function(setA, setB){ - if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA); - if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB); - if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections."); - var result = new dojo.collections.ArrayList(setA.toArray()); - var e = setB.getIterator(); - while (!e.atEnd){ - if (!result.contains(e.current)) result.add(e.current); - } - return result; - }; - this.intersection = function(setA, setB){ - if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA); - if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB); - if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections."); - var result = new dojo.collections.ArrayList(); - var e = setB.getIterator(); - while (!e.atEnd){ - if (setA.contains(e.current)) result.add(e.current); - e.moveNext(); - } - return result; - }; - // returns everything in setA that is not in setB. - this.difference = function(setA, setB){ - if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA); - if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB); - if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections."); - var result = new dojo.collections.ArrayList(); - var e = setA.getIterator(); - while (!e.atEnd){ - if (!setB.contains(e.current)) result.add(e.current); - e.moveNext(); - } - return result; - }; - this.isSubSet = function(setA, setB) { - if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA); - if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB); - if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections."); - var e = setA.getIterator(); - while (!e.atEnd){ - if (!setB.contains(e.current)) return false; - e.moveNext(); - } - return true; - }; - this.isSuperSet = function(setA, setB){ - if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA); - if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB); - if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections."); - var e = setB.getIterator(); - while (!e.atEnd){ - if (!setA.contains(e.current)) return false; - e.moveNext(); - } - return true; - }; -}(); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js deleted file mode 100644 index 15d92b947..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.SkipList"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.SkipList = function(){ - function node(height, val){ - this.value = val; - this.height = height; - this.nodes = new nodeList(height); - this.compare = function(val){ - if (this.value > val) return 1; - if (this.value < val) return -1; - return 0; - } - this.incrementHeight = function(){ - this.nodes.incrementHeight(); - this.height++; - }; - this.decrementHeight = function(){ - this.nodes.decrementHeight(); - this.height--; - }; - } - function nodeList(height){ - var arr = []; - this.height = height; - for (var i = 0; i < height; i++) arr[i] = null; - this.item = function(i){ - return arr[i]; - }; - this.incrementHeight = function(){ - this.height++; - arr[this.height] = null; - }; - this.decrementHeight = function(){ - arr.splice(arr.length - 1, 1); - this.height--; - }; - } - function iterator(list){ - this.current = list.head; - this.atEnd = false; - this.moveNext = function(){ - if (this.atEnd) return !this.atEnd; - this.current = this.current.nodes[0]; - this.atEnd = (current == null); - return !this.atEnd; - }; - this.reset = function(){ - this.current = null; - }; - } - - function chooseRandomHeight(max){ - var level = 1; - while (Math.random() < PROB && level < max) level++; - return level; - } - - var PROB = 0.5; - var comparisons = 0; - - this.head = new node(1); - this.count = 0; - this.add = function(val){ - var updates = []; - var current = this.head; - for (var i = this.head.height; i >= 0; i--){ - if (!(current.nodes[i] != null && current.nodes[i].compare(val) < 0)) comparisons++; - while (current.nodes[i] != null && current.nodes[i].compare(val) < 0){ - current = current.nodes[i]; - comparisons++; - } - updates[i] = current; - } - if (current.nodes[0] != null && current.nodes[0].compare(val) == 0) return; - var n = new node(val, chooseRandomHeight(head.height + 1)); - this.count++; - if (n.height > head.height){ - head.incrementHeight(); - head.nodes[head.height - 1] = n; - } - for (i = 0; i < n.height; i++){ - if (i < updates.length) { - n.nodes[i] = updates[i].nodes[i]; - updates[i].nodes[i] = n; - } - } - }; - - this.contains = function(val){ - var current = this.head; - var i; - for (i = head.height - 1; i >= 0; i--) { - while (current.item(i) != null) { - comparisons++; - var result = current.nodes[i].compare(val); - if (result == 0) return true; - else if (result < 0) current = current.nodes[i]; - else break; - } - } - return false; - }; - this.getIterator = function(){ - return new iterator(this); - }; - - this.remove = function(val){ - var updates = []; - var current = this.head; - for (var i = this.head.height - 1; i >= 0; i--){ - if (!(current.nodes[i] != null && current.nodes[i].compare(val) < 0)) comparisons++; - while (current.nodes[i] != null && current.nodes[i].compare(val) < 0) { - current = current.nodes[i]; - comparisons++; - } - updates[i] = current; - } - - current = current.nodes[0]; - if (current != null && current.compare(val) == 0){ - this.count--; - for (var i = 0; i < head.height; i++){ - if (updates[i].nodes[i] != current) break; - else updates[i].nodes[i] = current.nodes[i]; - } - if (head.nodes[head.height - 1] == null) head.decrementHeight(); - } - }; - this.resetComparisons = function(){ - comparisons = 0; - }; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js deleted file mode 100644 index 86acc758c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.SortedList"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.SortedList = function(dictionary){ - var _this = this; - var items = {}; - var q = []; - var sorter = function(a,b){ - if (a.key > b.key) return 1; - if (a.key < b.key) return -1; - return 0; - }; - var build = function(){ - q = []; - var e = _this.getIterator(); - while (!e.atEnd) { - q.push(e.entry); - e.moveNext(); - } - q.sort(sorter); - }; - - this.count = q.length; - this.add = function(k,v){ - if (!items[k]) { - items[k] = new dojo.collections.DictionaryEntry(k,v); - this.count = q.push(items[k]); - q.sort(sorter); - } - }; - this.clear = function(){ - items = {}; - q = []; - this.count = q.length; - }; - this.clone = function(){ - return new dojo.collections.SortedList(this); - }; - this.contains = this.containsKey = function(k){ - return (items[k] != null); - }; - this.containsValue = function(o){ - var e = this.getIterator(); - while (!e.atEnd){ - if (e.value == o) return true; - e.moveNext(); - } - return false; - }; - this.copyTo = function(arr, i){ - var e = this.getIterator(); - var idx = i; - while (!e.atEnd){ - arr.splice(idx, 0, e.entry); - idx++; - e.moveNext(); - } - }; - this.getByIndex = function(i){ - return q[i].value; - }; - this.getIterator = function(){ - return new dojo.collections.DictionaryIterator(items); - }; - this.getKey = function(i){ - return q[i].key; - }; - this.getKeyList = function(){ - var arr = []; - var e = this.getIterator(); - while (!e.atEnd){ - arr.push(e.key); - e.moveNext(); - } - return arr; - }; - this.getValueList = function(){ - var arr = []; - var e = this.getIterator(); - while (!e.atEnd){ - arr.push(e.value); - e.moveNext(); - } - return arr; - }; - this.indexOfKey = function(k){ - for (var i = 0; i < q.length; i++){ - if (q[i].key == k) { - return i; - } - } - return -1; - }; - this.indexOfValue = function(o){ - for (var i = 0; i < q.length; i++){ - if (q[i].value == o) { - return i; - } - } - return -1; - }; - this.item = function(k){ - return items[k]; - }; - - this.remove = function(k){ - delete items[k]; - build(); - this.count = q.length; - }; - this.removeAt = function(i){ - delete items[q[i].key]; - build(); - this.count = q.length; - }; - - this.setByIndex = function(i,o){ - items[q[i].key].value = o; - build(); - this.count = q.length; - }; - - if (dictionary){ - var e = dictionary.getIterator(); - while (!e.atEnd) { - q[q.length] = items[e.key] = new dojo.collections.DictionaryEntry(e.key, e.value); - e.moveNext(); - } - q.sort(sorter); - } -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js deleted file mode 100644 index c55ab1473..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.collections.Stack"); -dojo.require("dojo.collections.Collections"); - -dojo.collections.Stack = function(arr){ - var q = []; - if (arr) q = q.concat(arr); - this.count = q.length; - this.clear = function(){ - q = []; - this.count = q.length; - }; - this.clone = function(){ - return new dojo.collections.Stack(q); - }; - this.contains = function(o){ - for (var i = 0; i < q.length; i++){ - if (q[i] == o) return true; - } - return false; - }; - this.copyTo = function(arr, i){ - arr.splice(i,0,q); - }; - this.getIterator = function(){ - return new dojo.collections.Iterator(q); - }; - this.peek = function(){ - return q[(q.length - 1)]; - }; - this.pop = function(){ - var r = q.pop(); - this.count = q.length; - return r; - }; - this.push = function(o){ - this.count = q.push(o); - }; - this.toArray = function(){ - return [].concat(q); - }; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js deleted file mode 100644 index fdcf1aa07..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.hostenv.conditionalLoadModule({ - common: [ - "dojo.collections.Collections", - "dojo.collections.SortedList", - "dojo.collections.Dictionary", - "dojo.collections.Queue", - "dojo.collections.ArrayList", - "dojo.collections.Stack", - "dojo.collections.Set" - ] -}); -dojo.hostenv.moduleLoaded("dojo.collections.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js deleted file mode 100644 index 17c8cdeab..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.crypto"); - -// enumerations for use in crypto code. Note that 0 == default, for the most part. -dojo.crypto.cipherModes={ ECB:0, CBC:1, PCBC:2, CFB:3, OFB:4, CTR:5 }; -dojo.crypto.outputTypes={ Base64:0,Hex:1,String:2,Raw:3 }; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js deleted file mode 100644 index f4ebf34d5..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js +++ /dev/null @@ -1,548 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.crypto"); -dojo.provide("dojo.crypto.Blowfish"); - -/* Blowfish - * Created based on the C# implementation by Marcus Hahn (http://www.hotpixel.net/) - * Unsigned math functions derived from Joe Gregorio's SecureSyndication GM script - * http://bitworking.org/projects/securesyndication/ - * (Note that this is *not* an adaption of the above script) - * - * version 1.0 - * TRT - * 2005-12-08 - */ -dojo.crypto.Blowfish = new function(){ - var POW2=Math.pow(2,2); - var POW3=Math.pow(2,3); - var POW4=Math.pow(2,4); - var POW8=Math.pow(2,8); - var POW16=Math.pow(2,16); - var POW24=Math.pow(2,24); - var iv=null; // CBC mode initialization vector - var boxes={ - p:[ - 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, - 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, - 0x9216d5d9, 0x8979fb1b - ], - s0:[ - 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, - 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, - 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, - 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, - 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, - 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, - 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, - 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, - 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, - 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, - 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, - 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, - 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, - 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, - 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, - 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, - 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, - 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, - 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, - 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, - 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, - 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, - 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, - 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, - 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, - 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, - 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, - 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, - 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, - 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, - 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, - 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a - ], - s1:[ - 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, - 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, - 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, - 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, - 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, - 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, - 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, - 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, - 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, - 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, - 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, - 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, - 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, - 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, - 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, - 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, - 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, - 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, - 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, - 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, - 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, - 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, - 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, - 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, - 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, - 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, - 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, - 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, - 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, - 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, - 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, - 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 - ], - s2:[ - 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, - 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, - 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, - 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, - 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, - 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, - 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, - 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, - 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, - 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, - 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, - 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, - 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, - 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, - 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, - 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, - 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, - 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, - 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, - 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, - 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, - 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, - 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, - 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, - 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, - 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, - 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, - 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, - 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, - 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, - 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, - 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0 - ], - s3:[ - 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, - 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, - 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, - 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, - 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, - 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, - 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, - 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, - 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, - 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, - 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, - 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, - 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, - 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, - 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, - 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, - 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, - 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, - 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, - 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, - 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, - 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, - 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, - 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, - 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, - 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, - 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, - 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, - 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, - 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, - 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, - 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 - ] - } -//////////////////////////////////////////////////////////////////////////// - function add(x,y){ - var sum=(x+y)&0xffffffff; - if (sum<0){ - sum=-sum; - return (0x10000*((sum>>16)^0xffff))+(((sum&0xffff)^0xffff)+1); - } - return sum; - } - function split(x){ - var r=x&0xffffffff; - if(r<0) { - r=-r; - return [((r&0xffff)^0xffff)+1,(r>>16)^0xffff]; - } - return [r&0xffff,(r>>16)]; - } - function xor(x,y){ - var xs=split(x); - var ys=split(y); - return (0x10000*(xs[1]^ys[1]))+(xs[0]^ys[0]); - } - function $(v, box){ - var d=v&0xff; v>>=8; - var c=v&0xff; v>>=8; - var b=v&0xff; v>>=8; - var a=v&0xff; - var r=add(box.s0[a],box.s1[b]); - r=xor(r,box.s2[c]); - return add(r,box.s3[d]); - } -//////////////////////////////////////////////////////////////////////////// - function eb(o, box){ - var l=o.left; - var r=o.right; - l=xor(l,box.p[0]); - r=xor(r,xor($(l,box),box.p[1])); - l=xor(l,xor($(r,box),box.p[2])); - r=xor(r,xor($(l,box),box.p[3])); - l=xor(l,xor($(r,box),box.p[4])); - r=xor(r,xor($(l,box),box.p[5])); - l=xor(l,xor($(r,box),box.p[6])); - r=xor(r,xor($(l,box),box.p[7])); - l=xor(l,xor($(r,box),box.p[8])); - r=xor(r,xor($(l,box),box.p[9])); - l=xor(l,xor($(r,box),box.p[10])); - r=xor(r,xor($(l,box),box.p[11])); - l=xor(l,xor($(r,box),box.p[12])); - r=xor(r,xor($(l,box),box.p[13])); - l=xor(l,xor($(r,box),box.p[14])); - r=xor(r,xor($(l,box),box.p[15])); - l=xor(l,xor($(r,box),box.p[16])); - o.right=l; - o.left=xor(r,box.p[17]); - } - - function db(o, box){ - var l=o.left; - var r=o.right; - l=xor(l,box.p[17]); - r=xor(r,xor($(l,box),box.p[16])); - l=xor(l,xor($(r,box),box.p[15])); - r=xor(r,xor($(l,box),box.p[14])); - l=xor(l,xor($(r,box),box.p[13])); - r=xor(r,xor($(l,box),box.p[12])); - l=xor(l,xor($(r,box),box.p[11])); - r=xor(r,xor($(l,box),box.p[10])); - l=xor(l,xor($(r,box),box.p[9])); - r=xor(r,xor($(l,box),box.p[8])); - l=xor(l,xor($(r,box),box.p[7])); - r=xor(r,xor($(l,box),box.p[6])); - l=xor(l,xor($(r,box),box.p[5])); - r=xor(r,xor($(l,box),box.p[4])); - l=xor(l,xor($(r,box),box.p[3])); - r=xor(r,xor($(l,box),box.p[2])); - l=xor(l,xor($(r,box),box.p[1])); - o.right=l; - o.left=xor(r,box.p[0]); - } - - // Note that we aren't caching contexts here; it might take a little longer - // but we should be more secure this way. - function init(key){ - var k=key; - if (typeof(k)=="string"){ - var a=[]; - for(var i=0; i>>18)&0x3f)); - s.push(tab.charAt((t>>>12)&0x3f)); - s.push(tab.charAt((t>>>6)&0x3f)); - s.push(tab.charAt(t&0x3f)); - count+=4; - } - var pa=i-ba.length; - while((pa--)>0) s.push(p); - return s.join(""); - } - function fromBase64(str){ - var s=str.split(""); - var p="="; - var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var out=[]; - var l=s.length; - while(s[--l]==p){ } - for (var i=0; i>>16)&0xff); - out.push((t>>>8)&0xff); - out.push(t&0xff); - } - return out; - } -//////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS -// 0.2: Only supporting ECB mode for now. -//////////////////////////////////////////////////////////////////////////// - this.getIV=function(outputType){ - var out=outputType||dojo.crypto.outputTypes.Base64; - switch(out){ - case dojo.crypto.outputTypes.Hex:{ - var s=[]; - for(var i=0; i> 3; - var pos=0; - var o={}; - var isCBC=(mode==dojo.crypto.cipherModes.CBC); - var vector={left:iv.left||null, right:iv.right||null}; - for(var i=0; i>24)&0xff); - cipher.push((o.left>>16)&0xff); - cipher.push((o.left>>8)&0xff); - cipher.push(o.left&0xff); - cipher.push((o.right>>24)&0xff); - cipher.push((o.right>>16)&0xff); - cipher.push((o.right>>8)&0xff); - cipher.push(o.right&0xff); - pos+=8; - } - switch(out){ - case dojo.crypto.outputTypes.Hex:{ - var s=[]; - for(var i=0; i> 3; - var pos=0; - var o={}; - var isCBC=(mode==dojo.crypto.cipherModes.CBC); - var vector={left:iv.left||null, right:iv.right||null}; - for(var i=0; i>24)&0xff); - pt.push((o.left>>16)&0xff); - pt.push((o.left>>8)&0xff); - pt.push(o.left&0xff); - pt.push((o.right>>24)&0xff); - pt.push((o.right>>16)&0xff); - pt.push((o.right>>8)&0xff); - pt.push(o.right&0xff); - pos+=8; - } - - // check for padding, and remove. - if(pt[pt.length-1]==pt[pt.length-2]||pt[pt.length-1]==0x01){ - var n=pt[pt.length-1]; - pt.splice(pt.length-n, n); - } - - // convert to string - for(var i=0; i>5]|=(s.charCodeAt(i/chrsz)&mask)<<(i%32); - return wa; - } - function toString(wa){ - var s=[]; - for(var i=0; i>5]>>>(i%32))&mask)); - return s.join(""); - } - function toHex(wa) { - var h="0123456789abcdef"; - var s=[]; - for(var i=0; i>2]>>((i%4)*8+4))&0xF)+h.charAt((wa[i>>2]>>((i%4)*8))&0xF)); - } - return s.join(""); - } - function toBase64(wa){ - var p="="; - var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var s=[]; - for(var i=0; i>2]>>8*(i%4))&0xFF)<<16)|(((wa[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((wa[i+2>>2]>>8*((i+2)%4))&0xFF); - for(var j=0; j<4; j++){ - if(i*8+j*6>wa.length*32) s.push(p); - else s.push(tab.charAt((t>>6*(3-j))&0x3F)); - } - } - return s.join(""); - } - function add(x,y) { - var l=(x&0xFFFF)+(y&0xFFFF); - var m=(x>>16)+(y>>16)+(l>>16); - return (m<<16)|(l&0xFFFF); - } - function R(n,c){ return (n<>>(32-c)); } - function C(q,a,b,x,s,t){ return add(R(add(add(a,q),add(x,t)),s),b); } - function FF(a,b,c,d,x,s,t){ return C((b&c)|((~b)&d),a,b,x,s,t); } - function GG(a,b,c,d,x,s,t){ return C((b&d)|(c&(~d)),a,b,x,s,t); } - function HH(a,b,c,d,x,s,t){ return C(b^c^d,a,b,x,s,t); } - function II(a,b,c,d,x,s,t){ return C(c^(b|(~d)),a,b,x,s,t); } - function core(x,len){ - x[len>>5]|=0x80<<((len)%32); - x[(((len+64)>>>9)<<4)+14]=len; - var a= 1732584193; - var b=-271733879; - var c=-1732584194; - var d= 271733878; - for(var i=0; i16) wa=core(wa,key.length*chrsz); - var l=[], r=[]; - for(var i=0; i<16; i++){ - l[i]=wa[i]^0x36363636; - r[i]=wa[i]^0x5c5c5c5c; - } - var h=core(l.concat(toWord(data)),512+data.length*chrsz); - return core(r.concat(h),640); - } - - // Public functions - this.compute=function(data,outputType){ - var out=outputType||dojo.crypto.outputTypes.Base64; - switch(out){ - case dojo.crypto.outputTypes.Hex:{ - return toHex(core(toWord(data),data.length*chrsz)); - } - case dojo.crypto.outputTypes.String:{ - return toString(core(toWord(data),data.length*chrsz)); - } - default:{ - return toBase64(core(toWord(data),data.length*chrsz)); - } - } - }; - this.getHMAC=function(data,key,outputType){ - var out=outputType||dojo.crypto.outputTypes.Base64; - switch(out){ - case dojo.crypto.outputTypes.Hex:{ - return toHex(hmac(data,key)); - } - case dojo.crypto.outputTypes.String:{ - return toString(hmac(data,key)); - } - default:{ - return toBase64(hmac(data,key)); - } - } - }; -}(); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js deleted file mode 100644 index b79e2a69c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.crypto.Rijndael"); -dojo.require("dojo.crypto"); - -dojo.crypto.Rijndael = new function(){ - this.encrypt=function(plaintext, key){ - }; - this.decrypt=function(ciphertext, key){ - }; -}(); - -dojo.crypto.AES = dojo.crypto.Rijndael; // alias diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA.js deleted file mode 100644 index 9dda46af7..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.crypto.SHA"); -dojo.require("dojo.crypto"); - -dojo.crypto.SHA = new function(){ - this.compute=function(s){ - }; -}(); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js deleted file mode 100644 index 4b48f3f35..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js +++ /dev/null @@ -1,150 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.crypto"); -dojo.provide("dojo.crypto.SHA1"); - -dojo.crypto.SHA1 = new function(){ - var chrsz=8; - var mask=(1<>5]|=(s.charCodeAt(i/chrsz)&mask)<<(i%32); - return wa; - } - function toString(wa){ - var s=[]; - for(var i=0; i>5]>>>(i%32))&mask)); - return s.join(""); - } - function toHex(wa) { - var h="0123456789abcdef"; - var s=[]; - for(var i=0; i>2]>>((i%4)*8+4))&0xF)+h.charAt((wa[i>>2]>>((i%4)*8))&0xF)); - } - return s.join(""); - } - function toBase64(wa){ - var p="="; - var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var s=[]; - for(var i=0; i>2]>>8*(i%4))&0xFF)<<16)|(((wa[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((wa[i+2>>2]>>8*((i+2)%4))&0xFF); - for(var j=0; j<4; j++){ - if(i*8+j*6>wa.length*32) s.push(p); - else s.push(tab.charAt((t>>6*(3-j))&0x3F)); - } - } - return s.join(""); - } - - // math - function add(x,y){ - var l=(x&0xffff)+(y&0xffff); - var m=(x>>16)+(y>>16)+(l>>16); - return (m<<16)|(l&0xffff); - } - function r(x,n){ return (x<>>(32-n)); } - - // SHA rounds - function f(u,v,w){ return ((u&v)|(~u&w)); } - function g(u,v,w){ return ((u&v)|(u&w)|(v&w)); } - function h(u,v,w){ return (u^v^w); } - - function fn(i,u,v,w){ - if(i<20) return f(u,v,w); - if(i<40) return h(u,v,w); - if(i<60) return g(u,v,w); - return h(u,v,w); - } - function cnst(i){ - if(i<20) return 1518500249; - if(i<40) return 1859775393; - if(i<60) return -1894007588; - return -899497514; - } - - function core(x,len){ - x[len>>5]|=0x80<<(24-len%32); - x[((len+64>>9)<<4)+15]=len; - - var w=[]; - var a= 1732584193; // 0x67452301 - var b=-271733879; // 0xefcdab89 - var c=-1732584194; // 0x98badcfe - var d= 271733878; // 0x10325476 - var e=-1009589776; // 0xc3d2e1f0 - - for(var i=0; i16) wa=core(wa,key.length*chrsz); - var l=[], r=[]; - for(var i=0; i<16; i++){ - l[i]=wa[i]^0x36363636; - r[i]=wa[i]^0x5c5c5c5c; - } - var h=core(l.concat(toWord(data)),512+data.length*chrsz); - return core(r.concat(h),640); - } - - this.compute=function(data,outputType){ - var out=outputType||dojo.crypto.outputTypes.Base64; - switch(out){ - case dojo.crypto.outputTypes.Hex:{ - return toHex(core(toWord(data),data.length*chrsz)); - } - case dojo.crypto.outputTypes.String:{ - return toString(core(toWord(data),data.length*chrsz)); - } - default:{ - return toBase64(core(toWord(data),data.length*chrsz)); - } - } - }; - this.getHMAC=function(data,key,outputType){ - var out=outputType||dojo.crypto.outputTypes.Base64; - switch(out){ - case dojo.crypto.outputTypes.Hex:{ - return toHex(hmac(data,key)); - } - case dojo.crypto.outputTypes.String:{ - return toString(hmac(data,key)); - } - default:{ - return toBase64(hmac(data,key)); - } - } - }; -}(); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js deleted file mode 100644 index 515ffe416..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.crypto.SHA256"); -dojo.require("dojo.crypto"); - -dojo.crypto.SHA256 = new function(){ - this.compute=function(s){ - }; -}(); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js deleted file mode 100644 index a667abb11..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.hostenv.conditionalLoadModule({ - common: [ - "dojo.crypto", - "dojo.crypto.MD5" - ] -}); -dojo.hostenv.moduleLoaded("dojo.crypto.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/data.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/data.js deleted file mode 100644 index ec52fc3e8..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/data.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.data"); - -// currently a stub for dojo.data - -dojo.data = {}; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/data/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/data/__package__.js deleted file mode 100644 index 7836ad16e..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/data/__package__.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.hostenv.conditionalLoadModule({ - common: ["dojo.data"] -}); -dojo.hostenv.moduleLoaded("dojo.data.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/date.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/date.js deleted file mode 100644 index e2d9adc03..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/date.js +++ /dev/null @@ -1,384 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.date"); -dojo.require("dojo.string"); - -/** - * Sets the current Date object to the time given in an ISO 8601 date/time - * stamp - * - * @param string The date/time formted as an ISO 8601 string - */ -dojo.date.setIso8601 = function (dateObject, string) { - var comps = string.split('T'); - dojo.date.setIso8601Date(dateObject, comps[0]); - if (comps.length == 2) { dojo.date.setIso8601Time(dateObject, comps[1]); } - return dateObject; -} - -dojo.date.fromIso8601 = function (string) { - return dojo.date.setIso8601(new Date(0), string); -} - -/** - * Sets the current Date object to the date given in an ISO 8601 date - * stamp. The time is left unchanged. - * - * @param string The date formted as an ISO 8601 string - */ -dojo.date.setIso8601Date = function (dateObject, string) { - var regexp = "^([0-9]{4})((-?([0-9]{2})(-?([0-9]{2}))?)|" + - "(-?([0-9]{3}))|(-?W([0-9]{2})(-?([1-7]))?))?$"; - var d = string.match(new RegExp(regexp)); - - var year = d[1]; - var month = d[4]; - var date = d[6]; - var dayofyear = d[8]; - var week = d[10]; - var dayofweek = (d[12]) ? d[12] : 1; - - dateObject.setYear(year); - - if (dayofyear) { dojo.date.setDayOfYear(dateObject, Number(dayofyear)); } - else if (week) { - dateObject.setMonth(0); - dateObject.setDate(1); - var gd = dateObject.getDay(); - var day = (gd) ? gd : 7; - var offset = Number(dayofweek) + (7 * Number(week)); - - if (day <= 4) { dateObject.setDate(offset + 1 - day); } - else { dateObject.setDate(offset + 8 - day); } - } else { - if (month) { dateObject.setMonth(month - 1); } - if (date) { dateObject.setDate(date); } - } - - return dateObject; -} - -dojo.date.fromIso8601Date = function (string) { - return dojo.date.setIso8601Date(new Date(0), string); -} - -/** - * Sets the current Date object to the date given in an ISO 8601 time - * stamp. The date is left unchanged. - * - * @param string The time formted as an ISO 8601 string - */ -dojo.date.setIso8601Time = function (dateObject, string) { - // first strip timezone info from the end - var timezone = "Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$"; - var d = string.match(new RegExp(timezone)); - - var offset = 0; // local time if no tz info - if (d) { - if (d[0] != 'Z') { - offset = (Number(d[3]) * 60) + Number(d[5]); - offset *= ((d[2] == '-') ? 1 : -1); - } - offset -= dateObject.getTimezoneOffset() - string = string.substr(0, string.length - d[0].length); - } - - // then work out the time - var regexp = "^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$"; - var d = string.match(new RegExp(regexp)); - - var hours = d[1]; - var mins = Number((d[3]) ? d[3] : 0) + offset; - var secs = (d[5]) ? d[5] : 0; - var ms = d[7] ? (Number("0." + d[7]) * 1000) : 0; - - dateObject.setHours(hours); - dateObject.setMinutes(mins); - dateObject.setSeconds(secs); - dateObject.setMilliseconds(ms); - - return dateObject; -} - -dojo.date.fromIso8601Time = function (string) { - return dojo.date.setIso8601Time(new Date(0), string); -} - -/** - * Sets the date to the day of year - * - * @param date The day of year - */ -dojo.date.setDayOfYear = function (dateObject, dayofyear) { - dateObject.setMonth(0); - dateObject.setDate(dayofyear); - return dateObject; -} - -/** - * Retrieves the day of the year the Date is set to. - * - * @return The day of the year - */ -dojo.date.getDayOfYear = function (dateObject) { - var tmpdate = new Date("1/1/" + dateObject.getFullYear()); - return Math.floor((dateObject.getTime() - tmpdate.getTime()) / 86400000); -} - -dojo.date.getWeekOfYear = function (dateObject) { - return Math.ceil(dojo.date.getDayOfYear(dateObject) / 7); -} - -dojo.date.daysInMonth = function (month, year) { - dojo.deprecated("daysInMonth(month, year)", - "replaced by getDaysInMonth(dateObject)", "0.4"); - return dojo.date.getDaysInMonth(new Date(year, month, 1)); -} - -/** - * Returns the number of days in the given month. Leap years are accounted - * for. - * - * @param dateObject Date set to the month concerned - * @return The number of days in the given month - */ -dojo.date.getDaysInMonth = function (dateObject) { - var month = dateObject.getMonth(); - var year = dateObject.getFullYear(); - - /* - * Leap years are years with an additional day YYYY-02-29, where the year - * number is a multiple of four with the following exception: If a year - * is a multiple of 100, then it is only a leap year if it is also a - * multiple of 400. For example, 1900 was not a leap year, but 2000 is one. - */ - var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - if (month == 1 && year) { - if ((!(year % 4) && (year % 100)) || - (!(year % 4) && !(year % 100) && !(year % 400))) { return 29; } - else { return 28; } - } else { return days[month]; } -} - - -dojo.date.months = ["January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December"]; -dojo.date.shortMonths = ["Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec"]; -dojo.date.days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; -dojo.date.shortDays = ["Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat"]; - -/** - * - * Returns a string of the date in the version "January 1, 2004" - * - * @param date The date object - */ -dojo.date.toLongDateString = function(date) { - return dojo.date.months[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear(); -} - -/** - * - * Returns a string of the date in the version "Jan 1, 2004" - * - * @param date The date object - */ -dojo.date.toShortDateString = function(date) { - return dojo.date.shortMonths[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear(); -} - -/** - * - * Returns military formatted time - * - * @param date the date object - */ -dojo.date.toMilitaryTimeString = function(date){ - var h = "00" + date.getHours(); - var m = "00" + date.getMinutes(); - var s = "00" + date.getSeconds(); - return h.substr(h.length-2,2) + ":" + m.substr(m.length-2,2) + ":" + s.substr(s.length-2,2); -} - -/** - * - * Returns a string of the date relative to the current date. - * - * @param date The date object - * - * Example returns: - * - "1 minute ago" - * - "4 minutes ago" - * - "Yesterday" - * - "2 days ago" - */ -dojo.date.toRelativeString = function(date) { - var now = new Date(); - var diff = (now - date) / 1000; - var end = " ago"; - var future = false; - if(diff < 0) { - future = true; - end = " from now"; - diff = -diff; - } - - if(diff < 60) { - diff = Math.round(diff); - return diff + " second" + (diff == 1 ? "" : "s") + end; - } else if(diff < 3600) { - diff = Math.round(diff/60); - return diff + " minute" + (diff == 1 ? "" : "s") + end; - } else if(diff < 3600*24 && date.getDay() == now.getDay()) { - diff = Math.round(diff/3600); - return diff + " hour" + (diff == 1 ? "" : "s") + end; - } else if(diff < 3600*24*7) { - diff = Math.round(diff/(3600*24)); - if(diff == 1) { - return future ? "Tomorrow" : "Yesterday"; - } else { - return diff + " days" + end; - } - } else { - return dojo.date.toShortDateString(date); - } -} - -/** - * Retrieves the day of the week the Date is set to. - * - * @return The day of the week - */ -dojo.date.getDayOfWeekName = function (date) { - return dojo.date.days[date.getDay()]; -} - -/** - * Retrieves the short day of the week name the Date is set to. - * - * @return The short day of the week name - */ -dojo.date.getShortDayOfWeekName = function (date) { - return dojo.date.shortDays[date.getDay()]; -} - -/** - * Retrieves the month name the Date is set to. - * - * @return The month name - */ -dojo.date.getMonthName = function (date) { - return dojo.date.months[date.getMonth()]; -} - -/** - * Retrieves the short month name the Date is set to. - * - * @return The short month name - */ -dojo.date.getShortMonthName = function (date) { - return dojo.date.shortMonths[date.getMonth()]; -} - -/** - * - * Format datetime - * - * @param date the date object - */ -dojo.date.toString = function(date, format){ - - if (format.indexOf("#d") > -1) { - format = format.replace(/#dddd/g, dojo.date.getDayOfWeekName(date)); - format = format.replace(/#ddd/g, dojo.date.getShortDayOfWeekName(date)); - format = format.replace(/#dd/g, (date.getDate().toString().length==1?"0":"")+date.getDate()); - format = format.replace(/#d/g, date.getDate()); - } - - if (format.indexOf("#M") > -1) { - format = format.replace(/#MMMM/g, dojo.date.getMonthName(date)); - format = format.replace(/#MMM/g, dojo.date.getShortMonthName(date)); - format = format.replace(/#MM/g, ((date.getMonth()+1).toString().length==1?"0":"")+(date.getMonth()+1)); - format = format.replace(/#M/g, date.getMonth() + 1); - } - - if (format.indexOf("#y") > -1) { - var fullYear = date.getFullYear().toString(); - format = format.replace(/#yyyy/g, fullYear); - format = format.replace(/#yy/g, fullYear.substring(2)); - format = format.replace(/#y/g, fullYear.substring(3)); - } - - // Return if only date needed; - if (format.indexOf("#") == -1) { - return format; - } - - if (format.indexOf("#h") > -1) { - var hours = date.getHours(); - hours = (hours > 12 ? hours - 12 : (hours == 0) ? 12 : hours); - format = format.replace(/#hh/g, (hours.toString().length==1?"0":"")+hours); - format = format.replace(/#h/g, hours); - } - - if (format.indexOf("#H") > -1) { - format = format.replace(/#HH/g, (date.getHours().toString().length==1?"0":"")+date.getHours()); - format = format.replace(/#H/g, date.getHours()); - } - - if (format.indexOf("#m") > -1) { - format = format.replace(/#mm/g, (date.getMinutes().toString().length==1?"0":"")+date.getMinutes()); - format = format.replace(/#m/g, date.getMinutes()); - } - - if (format.indexOf("#s") > -1) { - format = format.replace(/#ss/g, (date.getSeconds().toString().length==1?"0":"")+date.getSeconds()); - format = format.replace(/#s/g, date.getSeconds()); - } - - if (format.indexOf("#T") > -1) { - format = format.replace(/#TT/g, date.getHours() >= 12 ? "PM" : "AM"); - format = format.replace(/#T/g, date.getHours() >= 12 ? "P" : "A"); - } - - if (format.indexOf("#t") > -1) { - format = format.replace(/#tt/g, date.getHours() >= 12 ? "pm" : "am"); - format = format.replace(/#t/g, date.getHours() >= 12 ? "p" : "a"); - } - - return format; - -} - -/** - * Convert a Date to a SQL string, optionally ignoring the HH:MM:SS portion of the Date - */ -dojo.date.toSql = function(date, noTime) { - var sql = date.getFullYear() + "-" + dojo.string.pad(date.getMonth(), 2) + "-" - + dojo.string.pad(date.getDate(), 2); - if(!noTime) { - sql += " " + dojo.string.pad(date.getHours(), 2) + ":" - + dojo.string.pad(date.getMinutes(), 2) + ":" - + dojo.string.pad(date.getSeconds(), 2); - } - return sql; -} - -/** - * Convert a SQL date string to a JavaScript Date object - */ -dojo.date.fromSql = function(sqlDate) { - var parts = sqlDate.split(/[\- :]/g); - while(parts.length < 6) { - parts.push(0); - } - return new Date(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]); -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js deleted file mode 100644 index b46735e19..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js +++ /dev/null @@ -1,158 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.lang"); -dojo.provide("dojo.dnd.DragSource"); -dojo.provide("dojo.dnd.DropTarget"); -dojo.provide("dojo.dnd.DragObject"); -dojo.provide("dojo.dnd.DragManager"); -dojo.provide("dojo.dnd.DragAndDrop"); - -dojo.dnd.DragSource = function(){ - dojo.dnd.dragManager.registerDragSource(this); -} - -dojo.lang.extend(dojo.dnd.DragSource, { - type: "", - - onDragEnd: function(){ - }, - - onDragStart: function(){ - }, - - unregister: function(){ - dojo.dnd.dragManager.unregisterDragSource(this); - }, - - reregister: function(){ - dojo.dnd.dragManager.registerDragSource(this); - } -}); - -dojo.dnd.DragObject = function(){ - dojo.dnd.dragManager.registerDragObject(this); -} - -dojo.lang.extend(dojo.dnd.DragObject, { - type: "", - - onDragStart: function(){ - // gets called directly after being created by the DragSource - // default action is to clone self as icon - }, - - onDragMove: function(){ - // this changes the UI for the drag icon - // "it moves itself" - }, - - onDragOver: function(){ - }, - - onDragOut: function(){ - }, - - onDragEnd: function(){ - }, - - // normal aliases - onDragLeave: this.onDragOut, - onDragEnter: this.onDragOver, - - // non-camel aliases - ondragout: this.onDragOut, - ondragover: this.onDragOver -}); - -dojo.dnd.DropTarget = function(){ - if (this.constructor == dojo.dnd.DropTarget) { return; } // need to be subclassed - this.acceptedTypes = []; - dojo.dnd.dragManager.registerDropTarget(this); -} - -dojo.lang.extend(dojo.dnd.DropTarget, { - acceptedTypes: [], - - acceptsType: function(type){ - if(!dojo.lang.inArray(this.acceptedTypes, "*")){ // wildcard - if(!dojo.lang.inArray(this.acceptedTypes, type)) { return false; } - } - return true; - }, - - accepts: function(dragObjects){ - if(!dojo.lang.inArray(this.acceptedTypes, "*")){ // wildcard - for (var i = 0; i < dragObjects.length; i++) { - if (!dojo.lang.inArray(this.acceptedTypes, - dragObjects[i].type)) { return false; } - } - } - return true; - }, - - onDragOver: function(){ - }, - - onDragOut: function(){ - }, - - onDragMove: function(){ - }, - - onDrop: function(){ - } -}); - -// NOTE: this interface is defined here for the convenience of the DragManager -// implementor. It is expected that in most cases it will be satisfied by -// extending a native event (DOM event in HTML and SVG). -dojo.dnd.DragEvent = function(){ - this.dragSource = null; - this.dragObject = null; - this.target = null; - this.eventStatus = "success"; - // - // can be one of: - // [ "dropSuccess", "dropFailure", "dragMove", - // "dragStart", "dragEnter", "dragLeave"] - // -} - -dojo.dnd.DragManager = function(){ - /* - * The DragManager handles listening for low-level events and dispatching - * them to higher-level primitives like drag sources and drop targets. In - * order to do this, it must keep a list of the items. - */ -} - -dojo.lang.extend(dojo.dnd.DragManager, { - selectedSources: [], - dragObjects: [], - dragSources: [], - registerDragSource: function(){}, - dropTargets: [], - registerDropTarget: function(){}, - lastDragTarget: null, - currentDragTarget: null, - onKeyDown: function(){}, - onMouseOut: function(){}, - onMouseMove: function(){}, - onMouseUp: function(){} -}); - -// NOTE: despite the existance of the DragManager class, there will be a -// singleton drag manager provided by the renderer-specific D&D support code. -// It is therefore sane for us to assign instance variables to the DragManager -// prototype - -// The renderer-specific file will define the following object: -// dojo.dnd.dragManager = null; diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js deleted file mode 100644 index bd0c68d2c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js +++ /dev/null @@ -1,381 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.dnd.HtmlDragAndDrop"); -dojo.provide("dojo.dnd.HtmlDragSource"); -dojo.provide("dojo.dnd.HtmlDropTarget"); -dojo.provide("dojo.dnd.HtmlDragObject"); - -dojo.require("dojo.dnd.HtmlDragManager"); -dojo.require("dojo.animation.*"); -dojo.require("dojo.dom"); -dojo.require("dojo.style"); -dojo.require("dojo.html"); -dojo.require("dojo.lang"); - -dojo.dnd.HtmlDragSource = function(node, type){ - node = dojo.byId(node); - this.constrainToContainer = false; - if(node){ - this.domNode = node; - this.dragObject = node; - - // register us - dojo.dnd.DragSource.call(this); - - // set properties that might have been clobbered by the mixin - this.type = type||this.domNode.nodeName.toLowerCase(); - } - -} - -dojo.lang.extend(dojo.dnd.HtmlDragSource, { - dragClass: "", // CSS classname(s) applied to node when it is being dragged - - onDragStart: function(){ - var dragObj = new dojo.dnd.HtmlDragObject(this.dragObject, this.type, this.dragClass); - - if (this.constrainToContainer) { - dragObj.constrainTo(this.constrainingContainer); - } - - return dragObj; - }, - setDragHandle: function(node){ - node = dojo.byId(node); - dojo.dnd.dragManager.unregisterDragSource(this); - this.domNode = node; - dojo.dnd.dragManager.registerDragSource(this); - }, - setDragTarget: function(node){ - this.dragObject = node; - }, - - constrainTo: function(container) { - this.constrainToContainer = true; - - if (container) { - this.constrainingContainer = container; - } else { - this.constrainingContainer = this.domNode.parentNode; - } - } -}); - -dojo.dnd.HtmlDragObject = function(node, type, dragClass){ - this.domNode = dojo.byId(node); - this.type = type; - if(dragClass) { this.dragClass = dragClass; } - this.constrainToContainer = false; -} - -dojo.lang.extend(dojo.dnd.HtmlDragObject, { - dragClass: "", - opacity: 0.5, - - // if true, node will not move in X and/or Y direction - disableX: false, - disableY: false, - - /** - * Creates a clone of this node and replaces this node with the clone in the - * DOM tree. This is done to prevent the browser from selecting the textual - * content of the node. This node is then set to opaque and drags around as - * the intermediate representation. - */ - onDragStart: function(e){ - dojo.html.clearSelection(); - - this.scrollOffset = { - top: dojo.html.getScrollTop(), // document.documentElement.scrollTop, - left: dojo.html.getScrollLeft() // document.documentElement.scrollLeft - }; - - this.dragStartPosition = {top: dojo.style.getAbsoluteY(this.domNode, true) + this.scrollOffset.top, - left: dojo.style.getAbsoluteX(this.domNode, true) + this.scrollOffset.left}; - - - this.dragOffset = {top: this.dragStartPosition.top - e.clientY, - left: this.dragStartPosition.left - e.clientX}; - - this.dragClone = this.domNode.cloneNode(true); - //this.domNode.parentNode.replaceChild(this.dragClone, this.domNode); - - - if ((this.domNode.parentNode.nodeName.toLowerCase() == 'body') || (dojo.style.getComputedStyle(this.domNode.parentNode,"position") == "static")) { - this.parentPosition = {top: 0, left: 0}; - } else { - this.parentPosition = {top: dojo.style.getAbsoluteY(this.domNode.parentNode, true), - left: dojo.style.getAbsoluteX(this.domNode.parentNode,true)}; - } - - if (this.constrainToContainer) { - this.constraints = this.getConstraints(); - } - - // set up for dragging - with(this.dragClone.style){ - position = "absolute"; - top = this.dragOffset.top + e.clientY + "px"; - left = this.dragOffset.left + e.clientX + "px"; - } - - if(this.dragClass) { dojo.html.addClass(this.dragClone, this.dragClass); } - dojo.style.setOpacity(this.dragClone, this.opacity); - dojo.html.body().appendChild(this.dragClone); - }, - - getConstraints: function() { - - if (this.constrainingContainer.nodeName.toLowerCase() == 'body') { - width = dojo.html.getViewportWidth(); - height = dojo.html.getViewportHeight(); - padLeft = 0; - padTop = 0; - } else { - width = dojo.style.getContentWidth(this.constrainingContainer); - height = dojo.style.getContentHeight(this.constrainingContainer); - padLeft = dojo.style.getPixelValue(this.constrainingContainer, "padding-left", true); - padTop = dojo.style.getPixelValue(this.constrainingContainer, "padding-top", true); - } - - return { - minX: padLeft, - minY: padTop, - maxX: padLeft+width - dojo.style.getOuterWidth(this.domNode), - maxY: padTop+height - dojo.style.getOuterHeight(this.domNode) - } - }, - - updateDragOffset: function() { - var sTop = dojo.html.getScrollTop(); // document.documentElement.scrollTop; - var sLeft = dojo.html.getScrollLeft(); // document.documentElement.scrollLeft; - if(sTop != this.scrollOffset.top) { - var diff = sTop - this.scrollOffset.top; - this.dragOffset.top += diff; - this.scrollOffset.top = sTop; - } - }, - - /** Moves the node to follow the mouse */ - onDragMove: function(e){ - this.updateDragOffset(); - var x = this.dragOffset.left + e.clientX - this.parentPosition.left; - var y = this.dragOffset.top + e.clientY - this.parentPosition.top; - - if (this.constrainToContainer) { - if (x < this.constraints.minX) { x = this.constraints.minX; } - if (y < this.constraints.minY) { y = this.constraints.minY; } - if (x > this.constraints.maxX) { x = this.constraints.maxX; } - if (y > this.constraints.maxY) { y = this.constraints.maxY; } - } - - if(!this.disableY) { this.dragClone.style.top = y + "px"; } - if(!this.disableX) { this.dragClone.style.left = x + "px"; } - }, - - /** - * If the drag operation returned a success we reomve the clone of - * ourself from the original position. If the drag operation returned - * failure we slide back over to where we came from and end the operation - * with a little grace. - */ - onDragEnd: function(e){ - switch(e.dragStatus){ - - case "dropSuccess": - dojo.dom.removeNode(this.dragClone); - this.dragClone = null; - break; - - case "dropFailure": // slide back to the start - var startCoords = [dojo.style.getAbsoluteX(this.dragClone), - dojo.style.getAbsoluteY(this.dragClone)]; - // offset the end so the effect can be seen - var endCoords = [this.dragStartPosition.left + 1, - this.dragStartPosition.top + 1]; - - // animate - var line = new dojo.math.curves.Line(startCoords, endCoords); - var anim = new dojo.animation.Animation(line, 300, 0, 0); - var dragObject = this; - dojo.event.connect(anim, "onAnimate", function(e) { - dragObject.dragClone.style.left = e.x + "px"; - dragObject.dragClone.style.top = e.y + "px"; - }); - dojo.event.connect(anim, "onEnd", function (e) { - // pause for a second (not literally) and disappear - dojo.lang.setTimeout(dojo.dom.removeNode, 200, - dragObject.dragClone); - }); - anim.play(); - break; - } - }, - - constrainTo: function(container) { - this.constrainToContainer=true; - if (container) { - this.constrainingContainer = container; - } else { - this.constrainingContainer = this.domNode.parentNode; - } - } -}); - -dojo.dnd.HtmlDropTarget = function(node, types){ - if (arguments.length == 0) { return; } - node = dojo.byId(node); - this.domNode = node; - dojo.dnd.DropTarget.call(this); - this.acceptedTypes = types || []; -} -dojo.inherits(dojo.dnd.HtmlDropTarget, dojo.dnd.DropTarget); - -dojo.lang.extend(dojo.dnd.HtmlDropTarget, { - onDragOver: function(e){ - if(!this.accepts(e.dragObjects)){ return false; } - - // cache the positions of the child nodes - this.childBoxes = []; - for (var i = 0, child; i < this.domNode.childNodes.length; i++) { - child = this.domNode.childNodes[i]; - if (child.nodeType != dojo.dom.ELEMENT_NODE) { continue; } - var top = dojo.style.getAbsoluteY(child); - var bottom = top + dojo.style.getInnerHeight(child); - var left = dojo.style.getAbsoluteX(child); - var right = left + dojo.style.getInnerWidth(child); - this.childBoxes.push({top: top, bottom: bottom, - left: left, right: right, node: child}); - } - - // TODO: use dummy node - - return true; - }, - - _getNodeUnderMouse: function(e){ - var mousex = e.pageX || e.clientX + dojo.html.body().scrollLeft; - var mousey = e.pageY || e.clientY + dojo.html.body().scrollTop; - - // find the child - for (var i = 0, child; i < this.childBoxes.length; i++) { - with (this.childBoxes[i]) { - if (mousex >= left && mousex <= right && - mousey >= top && mousey <= bottom) { return i; } - } - } - - return -1; - }, - - createDropIndicator: function() { - this.dropIndicator = document.createElement("div"); - with (this.dropIndicator.style) { - position = "absolute"; - zIndex = 1; - borderTopWidth = "1px"; - borderTopColor = "black"; - borderTopStyle = "solid"; - width = dojo.style.getInnerWidth(this.domNode) + "px"; - left = dojo.style.getAbsoluteX(this.domNode) + "px"; - } - }, - - onDragMove: function(e, dragObjects){ - var i = this._getNodeUnderMouse(e); - - if(!this.dropIndicator){ - this.createDropIndicator(); - } - - if(i < 0) { - if(this.childBoxes.length) { - var before = (dojo.html.gravity(this.childBoxes[0].node, e) & dojo.html.gravity.NORTH); - } else { - var before = true; - } - } else { - var child = this.childBoxes[i]; - var before = (dojo.html.gravity(child.node, e) & dojo.html.gravity.NORTH); - } - this.placeIndicator(e, dragObjects, i, before); - - if(!dojo.html.hasParent(this.dropIndicator)) { - dojo.html.body().appendChild(this.dropIndicator); - } - }, - - placeIndicator: function(e, dragObjects, boxIndex, before) { - with(this.dropIndicator.style){ - if (boxIndex < 0) { - if (this.childBoxes.length) { - top = (before ? this.childBoxes[0].top - : this.childBoxes[this.childBoxes.length - 1].bottom) + "px"; - } else { - top = dojo.style.getAbsoluteY(this.domNode) + "px"; - } - } else { - var child = this.childBoxes[boxIndex]; - top = (before ? child.top : child.bottom) + "px"; - } - } - }, - - onDragOut: function(e) { - dojo.dom.removeNode(this.dropIndicator); - delete this.dropIndicator; - }, - - /** - * Inserts the DragObject as a child of this node relative to the - * position of the mouse. - * - * @return true if the DragObject was inserted, false otherwise - */ - onDrop: function(e){ - this.onDragOut(e); - - var i = this._getNodeUnderMouse(e); - - if (i < 0) { - if (this.childBoxes.length) { - if (dojo.html.gravity(this.childBoxes[0].node, e) & dojo.html.gravity.NORTH) { - return this.insert(e, this.childBoxes[0].node, "before"); - } else { - return this.insert(e, this.childBoxes[this.childBoxes.length-1].node, "after"); - } - } - return this.insert(e, this.domNode, "append"); - } - - var child = this.childBoxes[i]; - if (dojo.html.gravity(child.node, e) & dojo.html.gravity.NORTH) { - return this.insert(e, child.node, "before"); - } else { - return this.insert(e, child.node, "after"); - } - }, - - insert: function(e, refNode, position) { - var node = e.dragObject.domNode; - - if(position == "before") { - return dojo.html.insertBefore(node, refNode); - } else if(position == "after") { - return dojo.html.insertAfter(node, refNode); - } else if(position == "append") { - refNode.appendChild(node); - return true; - } - - return false; - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js deleted file mode 100644 index 9651a06d8..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js +++ /dev/null @@ -1,365 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.dnd.HtmlDragManager"); -dojo.require("dojo.event.*"); -dojo.require("dojo.lang"); -dojo.require("dojo.html"); -dojo.require("dojo.style"); - -// NOTE: there will only ever be a single instance of HTMLDragManager, so it's -// safe to use prototype properties for book-keeping. -dojo.dnd.HtmlDragManager = function(){ -} - -dojo.inherits(dojo.dnd.HtmlDragManager, dojo.dnd.DragManager); - -dojo.lang.extend(dojo.dnd.HtmlDragManager, { - /** - * There are several sets of actions that the DnD code cares about in the - * HTML context: - * 1.) mouse-down -> - * (draggable selection) - * (dragObject generation) - * mouse-move -> - * (draggable movement) - * (droppable detection) - * (inform droppable) - * (inform dragObject) - * mouse-up - * (inform/destroy dragObject) - * (inform draggable) - * (inform droppable) - * 2.) mouse-down -> mouse-down - * (click-hold context menu) - * 3.) mouse-click -> - * (draggable selection) - * shift-mouse-click -> - * (augment draggable selection) - * mouse-down -> - * (dragObject generation) - * mouse-move -> - * (draggable movement) - * (droppable detection) - * (inform droppable) - * (inform dragObject) - * mouse-up - * (inform draggable) - * (inform droppable) - * 4.) mouse-up - * (clobber draggable selection) - */ - disabled: false, // to kill all dragging! - nestedTargets: false, - mouseDownTimer: null, // used for click-hold operations - dsCounter: 0, - dsPrefix: "dojoDragSource", - - // dimension calculation cache for use durring drag - dropTargetDimensions: [], - - currentDropTarget: null, - currentDropTargetPoints: null, - previousDropTarget: null, - _dragTriggered: false, - - selectedSources: [], - dragObjects: [], - - // mouse position properties - currentX: null, - currentY: null, - lastX: null, - lastY: null, - mouseDownX: null, - mouseDownY: null, - threshold: 7, - - dropAcceptable: false, - - // method over-rides - registerDragSource: function(ds){ - if(ds["domNode"]){ - // FIXME: dragSource objects SHOULD have some sort of property that - // references their DOM node, we shouldn't just be passing nodes and - // expecting it to work. - var dp = this.dsPrefix; - var dpIdx = dp+"Idx_"+(this.dsCounter++); - ds.dragSourceId = dpIdx; - this.dragSources[dpIdx] = ds; - ds.domNode.setAttribute(dp, dpIdx); - } - }, - - unregisterDragSource: function(ds){ - if (ds["domNode"]){ - - var dp = this.dsPrefix; - var dpIdx = ds.dragSourceId; - delete ds.dragSourceId; - delete this.dragSources[dpIdx]; - ds.domNode.setAttribute(dp, null); - } - }, - - registerDropTarget: function(dt){ - this.dropTargets.push(dt); - }, - - getDragSource: function(e){ - var tn = e.target; - if(tn === dojo.html.body()){ return; } - var ta = dojo.html.getAttribute(tn, this.dsPrefix); - while((!ta)&&(tn)){ - tn = tn.parentNode; - if((!tn)||(tn === dojo.html.body())){ return; } - ta = dojo.html.getAttribute(tn, this.dsPrefix); - } - return this.dragSources[ta]; - }, - - onKeyDown: function(e){ - }, - - onMouseDown: function(e){ - if(this.disabled) { return; } - - this.mouseDownX = e.clientX; - this.mouseDownY = e.clientY; - - var target = e.target.nodeType == dojo.dom.TEXT_NODE ? - e.target.parentNode : e.target; - - // do not start drag involvement if the user is interacting with - // a form element. - switch(target.tagName.toLowerCase()) { - case "a": case "button": case "textarea": - case "input": - return; - } - - // find a selection object, if one is a parent of the source node - var ds = this.getDragSource(e); - if(!ds){ return; } - if(!dojo.lang.inArray(this.selectedSources, ds)){ - this.selectedSources.push(ds); - } - - // WARNING: preventing the default action on all mousedown events - // prevents user interaction with the contents. - e.preventDefault(); - - dojo.event.connect(document, "onmousemove", this, "onMouseMove"); - }, - - onMouseUp: function(e){ - this.mouseDownX = null; - this.mouseDownY = null; - this._dragTriggered = false; - var _this = this; - e.dragSource = this.dragSource; - if((!e.shiftKey)&&(!e.ctrlKey)){ - dojo.lang.forEach(this.dragObjects, function(tempDragObj){ - var ret = null; - if(!tempDragObj){ return; } - if(_this.currentDropTarget) { - e.dragObject = tempDragObj; - - // NOTE: we can't get anything but the current drop target - // here since the drag shadow blocks mouse-over events. - // This is probelematic for dropping "in" something - var ce = _this.currentDropTarget.domNode.childNodes; - if(ce.length > 0){ - e.dropTarget = ce[0]; - while(e.dropTarget == tempDragObj.domNode){ - e.dropTarget = e.dropTarget.nextSibling; - } - }else{ - e.dropTarget = _this.currentDropTarget.domNode; - } - if (_this.dropAcceptable){ - ret = _this.currentDropTarget.onDrop(e); - } else { - _this.currentDropTarget.onDragOut(e); - } - } - - e.dragStatus = _this.dropAcceptable && ret ? "dropSuccess" : "dropFailure"; - tempDragObj.onDragEnd(e); - }); - - this.selectedSources = []; - this.dragObjects = []; - this.dragSource = null; - } - dojo.event.disconnect(document, "onmousemove", this, "onMouseMove"); - this.currentDropTarget = null; - this.currentDropTargetPoints = null; - }, - - scrollBy: function(x, y) { - for(var i = 0; i < this.dragObjects.length; i++) { - if(this.dragObjects[i].updateDragOffset) { - this.dragObjects[i].updateDragOffset(); - } - } - }, - - _dragStartDistance: function(x, y){ - if((!this.mouseDownX)||(!this.mouseDownX)){ - return; - } - var dx = Math.abs(x-this.mouseDownX); - var dx2 = dx*dx; - var dy = Math.abs(y-this.mouseDownY); - var dy2 = dy*dy; - return parseInt(Math.sqrt(dx2+dy2), 10); - }, - - onMouseMove: function(e){ - var _this = this; - // if we've got some sources, but no drag objects, we need to send - // onDragStart to all the right parties and get things lined up for - // drop target detection - if( (this.selectedSources.length)&& - (!this.dragObjects.length) ){ - var dx; - var dy; - if(!this._dragTriggered){ - this._dragTriggered = (this._dragStartDistance(e.clientX, e.clientY) > this.threshold); - if(!this._dragTriggered){ return; } - dx = e.clientX-this.mouseDownX; - dy = e.clientY-this.mouseDownY; - } - - if (this.selectedSources.length == 1) { - this.dragSource = this.selectedSources[0]; - } - - dojo.lang.forEach(this.selectedSources, function(tempSource){ - if(!tempSource){ return; } - var tdo = tempSource.onDragStart(e); - if(tdo){ - tdo.onDragStart(e); - - // "bump" the drag object to account for the drag threshold - tdo.dragOffset.top += dy; - tdo.dragOffset.left += dx; - - _this.dragObjects.push(tdo); - } - }); - - this.dropTargetDimensions = []; - dojo.lang.forEach(this.dropTargets, function(tempTarget){ - var tn = tempTarget.domNode; - if(!tn){ return; } - var ttx = dojo.style.getAbsoluteX(tn, true); - var tty = dojo.style.getAbsoluteY(tn, true); - _this.dropTargetDimensions.push([ - [ttx, tty], // upper-left - // lower-right - [ ttx+dojo.style.getInnerWidth(tn), tty+dojo.style.getInnerHeight(tn) ], - tempTarget - ]); - }); - } - // FIXME: we need to add dragSources and dragObjects to e - for (var i = 0; i < this.dragObjects.length; i++){ - if(this.dragObjects[i]){ this.dragObjects[i].onDragMove(e); } - } - - // if we have a current drop target, check to see if we're outside of - // it. If so, do all the actions that need doing. - var dtp = this.currentDropTargetPoints; - if((!this.nestedTargets)&&(dtp)&&(this.isInsideBox(e, dtp))){ - if(this.dropAcceptable){ - this.currentDropTarget.onDragMove(e, this.dragObjects); - } - }else{ - // FIXME: need to fix the event object! - // see if we can find a better drop target - var bestBox = this.findBestTarget(e); - - if(bestBox.target == null){ - if(this.currentDropTarget){ - this.currentDropTarget.onDragOut(e); - this.currentDropTarget = null; - this.currentDropTargetPoints = null; - } - this.dropAcceptable = false; - return; - } - - if(this.currentDropTarget != bestBox.target){ - if(this.currentDropTarget){ - this.currentDropTarget.onDragOut(e); - } - this.currentDropTarget = bestBox.target; - this.currentDropTargetPoints = bestBox.points; - e.dragObjects = this.dragObjects; - this.dropAcceptable = this.currentDropTarget.onDragOver(e); - - }else{ - if(this.dropAcceptable){ - this.currentDropTarget.onDragMove(e, this.dragObjects); - } - } - - } - }, - - findBestTarget: function(e) { - var _this = this; - var bestBox = new Object(); - bestBox.target = null; - bestBox.points = null; - dojo.lang.forEach(this.dropTargetDimensions, function(tmpDA) { - if(_this.isInsideBox(e, tmpDA)){ - bestBox.target = tmpDA[2]; - bestBox.points = tmpDA; - if(!_this.nestedTargets){ return "break"; } - } - }); - - return bestBox; - }, - - isInsideBox: function(e, coords){ - if( (e.clientX > coords[0][0])&& - (e.clientX < coords[1][0])&& - (e.clientY > coords[0][1])&& - (e.clientY < coords[1][1]) ){ - return true; - } - return false; - }, - - onMouseOver: function(e){ - }, - - onMouseOut: function(e){ - } -}); - -dojo.dnd.dragManager = new dojo.dnd.HtmlDragManager(); - -// global namespace protection closure -(function(){ - var d = document; - var dm = dojo.dnd.dragManager; - // set up event handlers on the document - dojo.event.connect(d, "onkeydown", dm, "onKeyDown"); - dojo.event.connect(d, "onmouseover", dm, "onMouseOver"); - dojo.event.connect(d, "onmouseout", dm, "onMouseOut"); - dojo.event.connect(d, "onmousedown", dm, "onMouseDown"); - dojo.event.connect(d, "onmouseup", dm, "onMouseUp"); - dojo.event.connect(window, "scrollBy", dm, "scrollBy"); -})(); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js deleted file mode 100644 index 34bfdef82..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.dnd.HtmlDragMove"); -dojo.provide("dojo.dnd.HtmlDragMoveSource"); -dojo.provide("dojo.dnd.HtmlDragMoveObject"); -dojo.require("dojo.dnd.*"); - -dojo.dnd.HtmlDragMoveSource = function(node, type){ - dojo.dnd.HtmlDragSource.call(this, node, type); -} - -dojo.inherits(dojo.dnd.HtmlDragMoveSource, dojo.dnd.HtmlDragSource); - -dojo.lang.extend(dojo.dnd.HtmlDragMoveSource, { - onDragStart: function(){ - var dragObj = new dojo.dnd.HtmlDragMoveObject(this.dragObject, this.type); - - if (this.constrainToContainer) { - dragObj.constrainTo(this.constrainingContainer); - } - return dragObj; - } -}); - -dojo.dnd.HtmlDragMoveObject = function(node, type){ - dojo.dnd.HtmlDragObject.call(this, node, type); -} - -dojo.inherits(dojo.dnd.HtmlDragMoveObject, dojo.dnd.HtmlDragObject); - -dojo.lang.extend(dojo.dnd.HtmlDragMoveObject, { - onDragEnd: function(e){ - delete this.dragClone; - }, - - onDragStart: function(e){ - dojo.html.clearSelection(); - - this.dragClone = this.domNode; - - this.scrollOffset = { - top: dojo.html.getScrollTop(), // document.documentElement.scrollTop, - left: dojo.html.getScrollLeft() // document.documentElement.scrollLeft - }; - - this.dragStartPosition = {top: dojo.style.getAbsoluteY(this.domNode) , - left: dojo.style.getAbsoluteX(this.domNode) }; - - this.dragOffset = {top: this.dragStartPosition.top - e.clientY, - left: this.dragStartPosition.left - e.clientX}; - - if (this.domNode.parentNode.nodeName.toLowerCase() == 'body') { - this.parentPosition = {top: 0, left: 0}; - } else { - this.parentPosition = {top: dojo.style.getAbsoluteY(this.domNode.parentNode, true), - left: dojo.style.getAbsoluteX(this.domNode.parentNode,true)}; - } - - this.dragClone.style.position = "absolute"; - - if (this.constrainToContainer) { - this.constraints = this.getConstraints(); - } - } - -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js deleted file mode 100644 index 39c722aba..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.dnd.Sortable"); -dojo.require("dojo.dnd.*"); - -dojo.dnd.Sortable = function () {} - -dojo.lang.extend(dojo.dnd.Sortable, { - - ondragstart: function (e) { - var dragObject = e.target; - while (dragObject.parentNode && dragObject.parentNode != this) { - dragObject = dragObject.parentNode; - } - // TODO: should apply HtmlDropTarget interface to self - // TODO: should apply HtmlDragObject interface? - return dragObject; - } - -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js deleted file mode 100644 index 55bbf582f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js +++ /dev/null @@ -1,180 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/** - * TreeDrag* specialized on managing subtree drags - * It selects nodes and visualises what's going on, - * but delegates real actions upon tree to the controller - * - * This code is considered a part of controller -*/ - -dojo.provide("dojo.dnd.TreeDragAndDrop"); -dojo.provide("dojo.dnd.TreeDragSource"); -dojo.provide("dojo.dnd.TreeDropTarget"); - -dojo.require("dojo.dnd.HtmlDragAndDrop"); - -dojo.dnd.TreeDragSource = function(node, syncController, type, treeNode){ - this.controller = syncController; - this.treeNode = treeNode; - - dojo.dnd.HtmlDragSource.call(this, node, type); -} - -dojo.inherits(dojo.dnd.TreeDragSource, dojo.dnd.HtmlDragSource); - -dojo.lang.extend(dojo.dnd.TreeDragSource, { - onDragStart: function(){ - /* extend adds functions to prototype */ - var dragObject = dojo.dnd.HtmlDragSource.prototype.onDragStart.call(this); - //dojo.debugShallow(dragObject) - - dragObject.treeNode = this.treeNode; - - dragObject.onDragStart = dojo.lang.hitch(dragObject, function(e) { - - /* save selection */ - this.savedSelectedNode = this.treeNode.tree.selector.selectedNode; - if (this.savedSelectedNode) { - this.savedSelectedNode.unMarkSelected(); - } - - var result = dojo.dnd.HtmlDragObject.prototype.onDragStart.apply(this, arguments); - - /* remove background grid from cloned object */ - dojo.lang.forEach( - this.dragClone.getElementsByTagName('img'), - function(elem) { elem.style.backgroundImage='' } - ); - - return result; - - - }); - - dragObject.onDragEnd = function(e) { - - /* restore selection */ - if (this.savedSelectedNode) { - this.savedSelectedNode.markSelected(); - } - //dojo.debug(e.dragStatus); - - return dojo.dnd.HtmlDragObject.prototype.onDragEnd.apply(this, arguments); - } - //dojo.debug(dragObject.domNode.outerHTML) - - - return dragObject; - }, - - onDragEnd: function(e){ - - - var res = dojo.dnd.HtmlDragSource.prototype.onDragEnd.call(this, e); - - - return res; - } -}); - -// ....................................... - -dojo.dnd.TreeDropTarget = function(node, syncController, type, treeNode){ - - this.treeNode = treeNode; - this.controller = syncController; // I will sync-ly process drops - - dojo.dnd.HtmlDropTarget.apply(this, [node, type]); - -} - -dojo.inherits(dojo.dnd.TreeDropTarget, dojo.dnd.HtmlDropTarget); - -dojo.lang.extend(dojo.dnd.TreeDropTarget, { - - /** - * Check if I can drop sourceTreeNode here - * only tree node targets are implemented ATM - */ - onDragOver: function(e){ - - var sourceTreeNode = e.dragObjects[0].treeNode; - - - if (dojo.lang.isUndefined(sourceTreeNode) || !sourceTreeNode || sourceTreeNode.widgetType != 'EditorTreeNode') { - dojo.raise("Source is not of EditorTreeNode widgetType or not found"); - } - //dojo.debug("This " + this.treeNode.title) - //dojo.debug("Source " + sourceTreeNode); - - // check types compat - var acceptable = dojo.dnd.HtmlDropTarget.prototype.onDragOver.apply(this, arguments); - - //dojo.debug("Check1 "+acceptable) - - - if (!acceptable) return false; - - // can't drop parent to child etc - acceptable = this.controller.canChangeParent(sourceTreeNode, this.treeNode); - - - //dojo.debug("Check2 "+acceptable) - - if (!acceptable) return false; - - - // mark current node being dragged into - if (sourceTreeNode !== this.treeNode) { - this.treeNode.markSelected(); - } - - return true; - - }, - - onDragMove: function(e){ - }, - - onDragOut: function(e) { - - this.treeNode.unMarkSelected(); - - //return dojo.dnd.HtmlDropTarget.prototype.onDragOut.call(this, e); - }, - - onDrop: function(e){ - this.onDragOut(e); - - //dojo.debug('drop'); - - var child = this.domNode; - var targetTreeNode = this.treeNode; - - - if (!dojo.lang.isObject(targetTreeNode)) { - dojo.raise("Wrong DropTarget engaged"); - } - - var sourceTreeNode = e.dragObject.treeNode; - - if (!dojo.lang.isObject(sourceTreeNode)) { - return false; - } - - // I don't check that trees are same! Target/source system deals with it - - //tree.changeParentRemote(sourceTreeNode, targetTreeNode); - return this.controller.processDrop(sourceTreeNode, targetTreeNode); - - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js deleted file mode 100644 index 50dda49e0..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.hostenv.conditionalLoadModule({ - common: ["dojo.dnd.DragAndDrop"], - browser: ["dojo.dnd.HtmlDragAndDrop"] -}); -dojo.hostenv.moduleLoaded("dojo.dnd.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dom.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dom.js deleted file mode 100644 index 2fe223a69..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/dom.js +++ /dev/null @@ -1,465 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.dom"); -dojo.require("dojo.lang"); - -dojo.dom.ELEMENT_NODE = 1; -dojo.dom.ATTRIBUTE_NODE = 2; -dojo.dom.TEXT_NODE = 3; -dojo.dom.CDATA_SECTION_NODE = 4; -dojo.dom.ENTITY_REFERENCE_NODE = 5; -dojo.dom.ENTITY_NODE = 6; -dojo.dom.PROCESSING_INSTRUCTION_NODE = 7; -dojo.dom.COMMENT_NODE = 8; -dojo.dom.DOCUMENT_NODE = 9; -dojo.dom.DOCUMENT_TYPE_NODE = 10; -dojo.dom.DOCUMENT_FRAGMENT_NODE = 11; -dojo.dom.NOTATION_NODE = 12; - -dojo.dom.dojoml = "http://www.dojotoolkit.org/2004/dojoml"; - -/** - * comprehensive list of XML namespaces -**/ -dojo.dom.xmlns = { - svg : "http://www.w3.org/2000/svg", - smil : "http://www.w3.org/2001/SMIL20/", - mml : "http://www.w3.org/1998/Math/MathML", - cml : "http://www.xml-cml.org", - xlink : "http://www.w3.org/1999/xlink", - xhtml : "http://www.w3.org/1999/xhtml", - xul : "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", - xbl : "http://www.mozilla.org/xbl", - fo : "http://www.w3.org/1999/XSL/Format", - xsl : "http://www.w3.org/1999/XSL/Transform", - xslt : "http://www.w3.org/1999/XSL/Transform", - xi : "http://www.w3.org/2001/XInclude", - xforms : "http://www.w3.org/2002/01/xforms", - saxon : "http://icl.com/saxon", - xalan : "http://xml.apache.org/xslt", - xsd : "http://www.w3.org/2001/XMLSchema", - dt: "http://www.w3.org/2001/XMLSchema-datatypes", - xsi : "http://www.w3.org/2001/XMLSchema-instance", - rdf : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - rdfs : "http://www.w3.org/2000/01/rdf-schema#", - dc : "http://purl.org/dc/elements/1.1/", - dcq: "http://purl.org/dc/qualifiers/1.0", - "soap-env" : "http://schemas.xmlsoap.org/soap/envelope/", - wsdl : "http://schemas.xmlsoap.org/wsdl/", - AdobeExtensions : "http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" -}; - -dojo.dom.isNode = dojo.lang.isDomNode = function(wh){ - if(typeof Element == "object") { - try { - return wh instanceof Element; - } catch(E) {} - } else { - // best-guess - return wh && !isNaN(wh.nodeType); - } -} -dojo.lang.whatAmI.custom["node"] = dojo.dom.isNode; - -dojo.dom.getTagName = function(node){ - var tagName = node.tagName; - if(tagName.substr(0,5).toLowerCase()!="dojo:"){ - - if(tagName.substr(0,4).toLowerCase()=="dojo"){ - // FIXME: this assuumes tag names are always lower case - return "dojo:" + tagName.substring(4).toLowerCase(); - } - - // allow lower-casing - var djt = node.getAttribute("dojoType")||node.getAttribute("dojotype"); - if(djt){ - return "dojo:"+djt.toLowerCase(); - } - - if((node.getAttributeNS)&&(node.getAttributeNS(this.dojoml,"type"))){ - return "dojo:" + node.getAttributeNS(this.dojoml,"type").toLowerCase(); - } - try{ - // FIXME: IE really really doesn't like this, so we squelch - // errors for it - djt = node.getAttribute("dojo:type"); - }catch(e){ /* FIXME: log? */ } - if(djt){ - return "dojo:"+djt.toLowerCase(); - } - - if((!dj_global["djConfig"])||(!djConfig["ignoreClassNames"])){ - // FIXME: should we make this optionally enabled via djConfig? - var classes = node.className||node.getAttribute("class"); - // FIXME: following line, without check for existence of classes.indexOf - // breaks firefox 1.5's svg widgets - if((classes)&&(classes.indexOf)&&(classes.indexOf("dojo-") != -1)){ - var aclasses = classes.split(" "); - for(var x=0; x5)&&(aclasses[x].indexOf("dojo-")>=0)){ - return "dojo:"+aclasses[x].substr(5).toLowerCase(); - } - } - } - } - - } - return tagName.toLowerCase(); -} - -dojo.dom.getUniqueId = function(){ - do { - var id = "dj_unique_" + (++arguments.callee._idIncrement); - }while(document.getElementById(id)); - return id; -} -dojo.dom.getUniqueId._idIncrement = 0; - -dojo.dom.firstElement = dojo.dom.getFirstChildElement = function(parentNode, tagName){ - var node = parentNode.firstChild; - while(node && node.nodeType != dojo.dom.ELEMENT_NODE){ - node = node.nextSibling; - } - if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) { - node = dojo.dom.nextElement(node, tagName); - } - return node; -} - -dojo.dom.lastElement = dojo.dom.getLastChildElement = function(parentNode, tagName){ - var node = parentNode.lastChild; - while(node && node.nodeType != dojo.dom.ELEMENT_NODE) { - node = node.previousSibling; - } - if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) { - node = dojo.dom.prevElement(node, tagName); - } - return node; -} - -dojo.dom.nextElement = dojo.dom.getNextSiblingElement = function(node, tagName){ - if(!node) { return null; } - do { - node = node.nextSibling; - } while(node && node.nodeType != dojo.dom.ELEMENT_NODE); - - if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) { - return dojo.dom.nextElement(node, tagName); - } - return node; -} - -dojo.dom.prevElement = dojo.dom.getPreviousSiblingElement = function(node, tagName){ - if(!node) { return null; } - if(tagName) { tagName = tagName.toLowerCase(); } - do { - node = node.previousSibling; - } while(node && node.nodeType != dojo.dom.ELEMENT_NODE); - - if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) { - return dojo.dom.prevElement(node, tagName); - } - return node; -} - -// TODO: hmph -/*this.forEachChildTag = function(node, unaryFunc) { - var child = this.getFirstChildTag(node); - while(child) { - if(unaryFunc(child) == "break") { break; } - child = this.getNextSiblingTag(child); - } -}*/ - -dojo.dom.moveChildren = function(srcNode, destNode, trim){ - var count = 0; - if(trim) { - while(srcNode.hasChildNodes() && - srcNode.firstChild.nodeType == dojo.dom.TEXT_NODE) { - srcNode.removeChild(srcNode.firstChild); - } - while(srcNode.hasChildNodes() && - srcNode.lastChild.nodeType == dojo.dom.TEXT_NODE) { - srcNode.removeChild(srcNode.lastChild); - } - } - while(srcNode.hasChildNodes()){ - destNode.appendChild(srcNode.firstChild); - count++; - } - return count; -} - -dojo.dom.copyChildren = function(srcNode, destNode, trim){ - var clonedNode = srcNode.cloneNode(true); - return this.moveChildren(clonedNode, destNode, trim); -} - -dojo.dom.removeChildren = function(node){ - var count = node.childNodes.length; - while(node.hasChildNodes()){ node.removeChild(node.firstChild); } - return count; -} - -dojo.dom.replaceChildren = function(node, newChild){ - // FIXME: what if newChild is an array-like object? - dojo.dom.removeChildren(node); - node.appendChild(newChild); -} - -dojo.dom.removeNode = function(node){ - if(node && node.parentNode){ - // return a ref to the removed child - return node.parentNode.removeChild(node); - } -} - -dojo.dom.getAncestors = function(node, filterFunction, returnFirstHit) { - var ancestors = []; - var isFunction = dojo.lang.isFunction(filterFunction); - while(node) { - if (!isFunction || filterFunction(node)) { - ancestors.push(node); - } - if (returnFirstHit && ancestors.length > 0) { return ancestors[0]; } - - node = node.parentNode; - } - if (returnFirstHit) { return null; } - return ancestors; -} - -dojo.dom.getAncestorsByTag = function(node, tag, returnFirstHit) { - tag = tag.toLowerCase(); - return dojo.dom.getAncestors(node, function(el){ - return ((el.tagName)&&(el.tagName.toLowerCase() == tag)); - }, returnFirstHit); -} - -dojo.dom.getFirstAncestorByTag = function(node, tag) { - return dojo.dom.getAncestorsByTag(node, tag, true); -} - -dojo.dom.isDescendantOf = function(node, ancestor, guaranteeDescendant){ - // guaranteeDescendant allows us to be a "true" isDescendantOf function - if(guaranteeDescendant && node) { node = node.parentNode; } - while(node) { - if(node == ancestor){ return true; } - node = node.parentNode; - } - return false; -} - -dojo.dom.innerXML = function(node){ - if(node.innerXML){ - return node.innerXML; - }else if(typeof XMLSerializer != "undefined"){ - return (new XMLSerializer()).serializeToString(node); - } -} - -dojo.dom.createDocumentFromText = function(str, mimetype){ - if(!mimetype) { mimetype = "text/xml"; } - if(typeof DOMParser != "undefined") { - var parser = new DOMParser(); - return parser.parseFromString(str, mimetype); - }else if(typeof ActiveXObject != "undefined"){ - var domDoc = new ActiveXObject("Microsoft.XMLDOM"); - if(domDoc) { - domDoc.async = false; - domDoc.loadXML(str); - return domDoc; - }else{ - dojo.debug("toXml didn't work?"); - } - /* - }else if((dojo.render.html.capable)&&(dojo.render.html.safari)){ - // FIXME: this doesn't appear to work! - // from: http://web-graphics.com/mtarchive/001606.php - // var xml = ''+str; - var mtype = "text/xml"; - var xml = ''+str; - var url = "data:"+mtype+";charset=utf-8,"+encodeURIComponent(xml); - var request = new XMLHttpRequest(); - request.open("GET", url, false); - request.overrideMimeType(mtype); - request.send(null); - return request.responseXML; - */ - }else if(document.createElement){ - // FIXME: this may change all tags to uppercase! - var tmp = document.createElement("xml"); - tmp.innerHTML = str; - if(document.implementation && document.implementation.createDocument) { - var xmlDoc = document.implementation.createDocument("foo", "", null); - for(var i = 0; i < tmp.childNodes.length; i++) { - xmlDoc.importNode(tmp.childNodes.item(i), true); - } - return xmlDoc; - } - // FIXME: probably not a good idea to have to return an HTML fragment - // FIXME: the tmp.doc.firstChild is as tested from IE, so it may not - // work that way across the board - return tmp.document && tmp.document.firstChild ? - tmp.document.firstChild : tmp; - } - return null; -} - -dojo.dom.prependChild = function(node, parent) { - if(parent.firstChild) { - parent.insertBefore(node, parent.firstChild); - } else { - parent.appendChild(node); - } - return true; -} - -dojo.dom.insertBefore = function(node, ref, force){ - if (force != true && - (node === ref || node.nextSibling === ref)){ return false; } - var parent = ref.parentNode; - parent.insertBefore(node, ref); - return true; -} - -dojo.dom.insertAfter = function(node, ref, force){ - var pn = ref.parentNode; - if(ref == pn.lastChild){ - if((force != true)&&(node === ref)){ - return false; - } - pn.appendChild(node); - }else{ - return this.insertBefore(node, ref.nextSibling, force); - } - return true; -} - -dojo.dom.insertAtPosition = function(node, ref, position){ - if((!node)||(!ref)||(!position)){ return false; } - switch(position.toLowerCase()){ - case "before": - return dojo.dom.insertBefore(node, ref); - case "after": - return dojo.dom.insertAfter(node, ref); - case "first": - if(ref.firstChild){ - return dojo.dom.insertBefore(node, ref.firstChild); - }else{ - ref.appendChild(node); - return true; - } - break; - default: // aka: last - ref.appendChild(node); - return true; - } -} - -dojo.dom.insertAtIndex = function(node, containingNode, insertionIndex){ - var siblingNodes = containingNode.childNodes; - - // if there aren't any kids yet, just add it to the beginning - - if (!siblingNodes.length){ - containingNode.appendChild(node); - return true; - } - - // otherwise we need to walk the childNodes - // and find our spot - - var after = null; - - for(var i=0; i - * isTag(myFooNode, "foo"); // returns "foo" - * isTag(myFooNode, "bar"); // returns "" - * isTag(myFooNode, "FOO"); // returns "" - * isTag(myFooNode, "hey", "foo", "bar"); // returns "foo" -**/ -dojo.dom.isTag = function(node /* ... */) { - if(node && node.tagName) { - var arr = dojo.lang.toArray(arguments, 1); - return arr[ dojo.lang.find(node.tagName, arr) ] || ""; - } - return ""; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/event.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/event.js deleted file mode 100644 index 325cbf3dd..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/event.js +++ /dev/null @@ -1,484 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.lang"); -dojo.provide("dojo.event"); - -dojo.event = new function(){ - this.canTimeout = dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]); - - // FIXME: where should we put this method (not here!)? - function interpolateArgs(args){ - var dl = dojo.lang; - var ao = { - srcObj: dj_global, - srcFunc: null, - adviceObj: dj_global, - adviceFunc: null, - aroundObj: null, - aroundFunc: null, - adviceType: (args.length>2) ? args[0] : "after", - precedence: "last", - once: false, - delay: null, - rate: 0, - adviceMsg: false - }; - - switch(args.length){ - case 0: return; - case 1: return; - case 2: - ao.srcFunc = args[0]; - ao.adviceFunc = args[1]; - break; - case 3: - if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){ - ao.adviceType = "after"; - ao.srcObj = args[0]; - ao.srcFunc = args[1]; - ao.adviceFunc = args[2]; - }else if((dl.isString(args[1]))&&(dl.isString(args[2]))){ - ao.srcFunc = args[1]; - ao.adviceFunc = args[2]; - }else if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){ - ao.adviceType = "after"; - ao.srcObj = args[0]; - ao.srcFunc = args[1]; - var tmpName = dojo.lang.nameAnonFunc(args[2], ao.adviceObj); - ao.adviceFunc = tmpName; - }else if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){ - ao.adviceType = "after"; - ao.srcObj = dj_global; - var tmpName = dojo.lang.nameAnonFunc(args[0], ao.srcObj); - ao.srcFunc = tmpName; - ao.adviceObj = args[1]; - ao.adviceFunc = args[2]; - } - break; - case 4: - if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){ - // we can assume that we've got an old-style "connect" from - // the sigslot school of event attachment. We therefore - // assume after-advice. - ao.adviceType = "after"; - ao.srcObj = args[0]; - ao.srcFunc = args[1]; - ao.adviceObj = args[2]; - ao.adviceFunc = args[3]; - }else if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){ - ao.adviceType = args[0]; - ao.srcObj = dj_global; - ao.srcFunc = args[1]; - ao.adviceObj = args[2]; - ao.adviceFunc = args[3]; - }else if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){ - ao.adviceType = args[0]; - ao.srcObj = dj_global; - var tmpName = dojo.lang.nameAnonFunc(args[1], dj_global); - ao.srcFunc = tmpName; - ao.adviceObj = args[2]; - ao.adviceFunc = args[3]; - }else if(dl.isObject(args[1])){ - ao.srcObj = args[1]; - ao.srcFunc = args[2]; - ao.adviceObj = dj_global; - ao.adviceFunc = args[3]; - }else if(dl.isObject(args[2])){ - ao.srcObj = dj_global; - ao.srcFunc = args[1]; - ao.adviceObj = args[2]; - ao.adviceFunc = args[3]; - }else{ - ao.srcObj = ao.adviceObj = ao.aroundObj = dj_global; - ao.srcFunc = args[1]; - ao.adviceFunc = args[2]; - ao.aroundFunc = args[3]; - } - break; - case 6: - ao.srcObj = args[1]; - ao.srcFunc = args[2]; - ao.adviceObj = args[3] - ao.adviceFunc = args[4]; - ao.aroundFunc = args[5]; - ao.aroundObj = dj_global; - break; - default: - ao.srcObj = args[1]; - ao.srcFunc = args[2]; - ao.adviceObj = args[3] - ao.adviceFunc = args[4]; - ao.aroundObj = args[5]; - ao.aroundFunc = args[6]; - ao.once = args[7]; - ao.delay = args[8]; - ao.rate = args[9]; - ao.adviceMsg = args[10]; - break; - } - - if((typeof ao.srcFunc).toLowerCase() != "string"){ - ao.srcFunc = dojo.lang.getNameInObj(ao.srcObj, ao.srcFunc); - } - - if((typeof ao.adviceFunc).toLowerCase() != "string"){ - ao.adviceFunc = dojo.lang.getNameInObj(ao.adviceObj, ao.adviceFunc); - } - - if((ao.aroundObj)&&((typeof ao.aroundFunc).toLowerCase() != "string")){ - ao.aroundFunc = dojo.lang.getNameInObj(ao.aroundObj, ao.aroundFunc); - } - - if(!ao.srcObj){ - dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc); - } - if(!ao.adviceObj){ - dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc); - } - return ao; - } - - this.connect = function(){ - var ao = interpolateArgs(arguments); - - // FIXME: just doing a "getForMethod()" seems to be enough to put this into infinite recursion!! - var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc); - if(ao.adviceFunc){ - var mjp2 = dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj, ao.adviceFunc); - } - - mjp.kwAddAdvice(ao); - - return mjp; // advanced users might want to fsck w/ the join point - // manually - } - - this.connectBefore = function() { - var args = ["before"]; - for(var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } - return this.connect.apply(this, args); - } - - this.connectAround = function() { - var args = ["around"]; - for(var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } - return this.connect.apply(this, args); - } - - this._kwConnectImpl = function(kwArgs, disconnect){ - var fn = (disconnect) ? "disconnect" : "connect"; - if(typeof kwArgs["srcFunc"] == "function"){ - kwArgs.srcObj = kwArgs["srcObj"]||dj_global; - var tmpName = dojo.lang.nameAnonFunc(kwArgs.srcFunc, kwArgs.srcObj); - kwArgs.srcFunc = tmpName; - } - if(typeof kwArgs["adviceFunc"] == "function"){ - kwArgs.adviceObj = kwArgs["adviceObj"]||dj_global; - var tmpName = dojo.lang.nameAnonFunc(kwArgs.adviceFunc, kwArgs.adviceObj); - kwArgs.adviceFunc = tmpName; - } - return dojo.event[fn]( (kwArgs["type"]||kwArgs["adviceType"]||"after"), - kwArgs["srcObj"]||dj_global, - kwArgs["srcFunc"], - kwArgs["adviceObj"]||kwArgs["targetObj"]||dj_global, - kwArgs["adviceFunc"]||kwArgs["targetFunc"], - kwArgs["aroundObj"], - kwArgs["aroundFunc"], - kwArgs["once"], - kwArgs["delay"], - kwArgs["rate"], - kwArgs["adviceMsg"]||false ); - } - - this.kwConnect = function(kwArgs){ - return this._kwConnectImpl(kwArgs, false); - - } - - this.disconnect = function(){ - var ao = interpolateArgs(arguments); - if(!ao.adviceFunc){ return; } // nothing to disconnect - var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc); - return mjp.removeAdvice(ao.adviceObj, ao.adviceFunc, ao.adviceType, ao.once); - } - - this.kwDisconnect = function(kwArgs){ - return this._kwConnectImpl(kwArgs, true); - } -} - -// exactly one of these is created whenever a method with a joint point is run, -// if there is at least one 'around' advice. -dojo.event.MethodInvocation = function(join_point, obj, args) { - this.jp_ = join_point; - this.object = obj; - this.args = []; - for(var x=0; x= this.jp_.around.length){ - return this.jp_.object[this.jp_.methodname].apply(this.jp_.object, this.args); - // return this.jp_.run_before_after(this.object, this.args); - }else{ - var ti = this.jp_.around[this.around_index]; - var mobj = ti[0]||dj_global; - var meth = ti[1]; - return mobj[meth].call(mobj, this); - } -} - - -dojo.event.MethodJoinPoint = function(obj, methname){ - this.object = obj||dj_global; - this.methodname = methname; - this.methodfunc = this.object[methname]; - this.before = []; - this.after = []; - this.around = []; -} - -dojo.event.MethodJoinPoint.getForMethod = function(obj, methname) { - // if(!(methname in obj)){ - if(!obj){ obj = dj_global; } - if(!obj[methname]){ - // supply a do-nothing method implementation - obj[methname] = function(){}; - }else if((!dojo.lang.isFunction(obj[methname]))&&(!dojo.lang.isAlien(obj[methname]))){ - return null; // FIXME: should we throw an exception here instead? - } - // we hide our joinpoint instance in obj[methname + '$joinpoint'] - var jpname = methname + "$joinpoint"; - var jpfuncname = methname + "$joinpoint$method"; - var joinpoint = obj[jpname]; - if(!joinpoint){ - var isNode = false; - if(dojo.event["browser"]){ - if( (obj["attachEvent"])|| - (obj["nodeType"])|| - (obj["addEventListener"]) ){ - isNode = true; - dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, methname]); - } - } - obj[jpfuncname] = obj[methname]; - // joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, methname); - joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, jpfuncname); - obj[methname] = function(){ - var args = []; - - if((isNode)&&(!arguments.length)&&(window.event)){ - args.push(dojo.event.browser.fixEvent(window.event)); - }else{ - for(var x=0; x0){ - dojo.lang.forEach(this.before, unrollAdvice, true); - } - - var result; - if(this.around.length>0){ - var mi = new dojo.event.MethodInvocation(this, obj, args); - result = mi.proceed(); - }else if(this.methodfunc){ - result = this.object[this.methodname].apply(this.object, args); - } - - if(this.after.length>0){ - dojo.lang.forEach(this.after, unrollAdvice, true); - } - - return (this.methodfunc) ? result : null; - }, - - getArr: function(kind){ - var arr = this.after; - // FIXME: we should be able to do this through props or Array.in() - if((typeof kind == "string")&&(kind.indexOf("before")!=-1)){ - arr = this.before; - }else if(kind=="around"){ - arr = this.around; - } - return arr; - }, - - kwAddAdvice: function(args){ - this.addAdvice( args["adviceObj"], args["adviceFunc"], - args["aroundObj"], args["aroundFunc"], - args["adviceType"], args["precedence"], - args["once"], args["delay"], args["rate"], - args["adviceMsg"]); - }, - - addAdvice: function( thisAdviceObj, thisAdvice, - thisAroundObj, thisAround, - advice_kind, precedence, - once, delay, rate, asMessage){ - var arr = this.getArr(advice_kind); - if(!arr){ - dojo.raise("bad this: " + this); - } - - var ao = [thisAdviceObj, thisAdvice, thisAroundObj, thisAround, delay, rate, asMessage]; - - if(once){ - if(this.hasAdvice(thisAdviceObj, thisAdvice, advice_kind, arr) >= 0){ - return; - } - } - - if(precedence == "first"){ - arr.unshift(ao); - }else{ - arr.push(ao); - } - }, - - hasAdvice: function(thisAdviceObj, thisAdvice, advice_kind, arr){ - if(!arr){ arr = this.getArr(advice_kind); } - var ind = -1; - for(var x=0; x=0; i=i-1){ - var el = na[i]; - if(el["__clobberAttrs__"]){ - for(var j=0; j'); - document.writeln('Function VBGetSwfVer(i)'); - document.writeln(' on error resume next'); - document.writeln(' Dim swControl, swVersion'); - document.writeln(' swVersion = 0'); - document.writeln(' set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))'); - document.writeln(' if (IsObject(swControl)) then'); - document.writeln(' swVersion = swControl.GetVariable("$version")'); - document.writeln(' end if'); - document.writeln(' VBGetSwfVer = swVersion'); - document.writeln('End Function'); - document.writeln(''); - } - - this._detectVersion(); - this._detectCommunicationVersion(); -} - -dojo.flash.Info.prototype = { - /** The full version string, such as "8r22". */ - version: -1, - - /** - The major, minor, and revisions of the plugin. For example, if the - plugin is 8r22, then the major version is 8, the minor version is 0, - and the revision is 22. - */ - versionMajor: -1, - versionMinor: -1, - versionRevision: -1, - - /** Whether this platform has Flash already installed. */ - capable: false, - - /** - The major version number for how our Flash and JavaScript communicate. - This can currently be the following values: - 6 - We use a combination of the Flash plugin methods, such as SetVariable - and TCallLabel, along with fscommands, to do communication. - 8 - We use the ExternalInterface API. - -1 - For some reason neither method is supported, and no communication - is possible. - */ - commVersion: 6, - - /** - Asserts that this environment has the given major, minor, and revision - numbers for the Flash player. Returns true if the player is equal - or above the given version, false otherwise. - - Example: To test for Flash Player 7r14: - - dojo.flash.info.isVersionOrAbove(7, 0, 14) - */ - isVersionOrAbove: function(reqMajorVer, reqMinorVer, reqVer){ - // make the revision a decimal (i.e. transform revision 14 into - // 0.14 - reqVer = parseFloat("." + reqVer); - if(this.versionMajor > reqMajorVer && this.version >= reqVer){ - return true; - }else if(this.version >= reqVer && this.versionMinor >= reqMinorVer){ - return true; - }else{ - return false; - } - }, - - _detectVersion: function(){ - var versionStr; - - // loop backwards through the versions until we find the newest version - for(var testVersion = 25; testVersion > 0; testVersion--){ - if(dojo.render.html.ie){ - versionStr = VBGetSwfVer(testVersion); - }else{ - versionStr = this._JSFlashInfo(testVersion); - } - - if(versionStr == -1 ){ - this.capable = false; - return; - }else if(versionStr != 0){ - var versionArray; - if(dojo.render.html.ie){ - var tempArray = versionStr.split(" "); - var tempString = tempArray[1]; - versionArray = tempString.split(","); - }else{ - versionArray = versionStr.split("."); - } - - this.versionMajor = versionArray[0]; - this.versionMinor = versionArray[1]; - this.versionRevision = versionArray[2]; - - // 7.0r24 == 7.24 - versionString = this.versionMajor + "." + this.versionRevision; - this.version = parseFloat(versionString); - - this.capable = true; - - break; - } - } - }, - - /** - JavaScript helper required to detect Flash Player PlugIn version - information. Internet Explorer uses a corresponding Visual Basic - version to interact with the Flash ActiveX control. - */ - _JSFlashInfo: function(testVersion){ - // NS/Opera version >= 3 check for Flash plugin in plugin array - if(navigator.plugins != null && navigator.plugins.length > 0){ - if(navigator.plugins["Shockwave Flash 2.0"] || - navigator.plugins["Shockwave Flash"]){ - var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; - var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; - var descArray = flashDescription.split(" "); - var tempArrayMajor = descArray[2].split("."); - var versionMajor = tempArrayMajor[0]; - var versionMinor = tempArrayMajor[1]; - if(descArray[3] != ""){ - tempArrayMinor = descArray[3].split("r"); - }else{ - tempArrayMinor = descArray[4].split("r"); - } - var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0; - var version = versionMajor + "." + versionMinor + "." - + versionRevision; - - return version; - } - } - - return -1; - }, - - /** - Detects the mechanisms that should be used for Flash/JavaScript - communication, setting 'commVersion' to either 6 or 8. If the value is - 6, we use Flash Plugin 6+ features, such as GetVariable, TCallLabel, - and fscommand, to do Flash/JavaScript communication; if the value is - 8, we use the ExternalInterface API for communication. - */ - _detectCommunicationVersion: function(){ - // we prefer Flash 6 features over Flash 8, because they are much faster - // and much less buggy - - // does the Flash plugin have some of the Flash methods? - - // otherwise, is the ExternalInterface API present? - } -}; - -/** A class that is used to write out the Flash object into the page. */ -dojo.flash.Embed = function(){ -} - -dojo.flash.Embed.prototype = { - /** - The width of this Flash applet. The default is the minimal width - necessary to show the Flash settings dialog. - */ - width: 215, - - /** - The height of this Flash applet. The default is the minimal height - necessary to show the Flash settings dialog. - */ - width: 138, - - /** The id of the Flash object. */ - id: "flashObject", - - /** Controls whether this is a visible Flash applet or not. */ - _visible: true, - - /** - Writes the Flash into the page. This must be called before the page - is finished loading. - */ - write: function(){ - // determine our container div's styling - var containerStyle = new dojo.string.Builder(); - containerStyle.append("width: " + this.width + "px; "); - containerStyle.append("height: " + this.height + "px; "); - if(this._visible == false){ - containerStyle.append("position: absolute; "); - containerStyle.append("z-index: 100; "); - containerStyle.append("top: -1000px; "); - containerStyle.append("left: -1000px; "); - } - containerStyle = containerStyle.toString(); - - // Flash 6 - if(dojo.flash.useFlash6()){ - var swfloc = dojo.flash.flash6_version; - - document.writeln('
    '); - document.writeln(' '); - document.writeln('
    '); - } - // Flash 8 - else if (dojo.flash.useFlash8()){ - var swfloc = dojo.uri.dojoUri(dojo.flash.flash8_version).toString(); - } - }, - - /** Gets the Flash object DOM node. */ - get: function(){ - return (dojo.render.html.ie) ? window[this.id] : document[this.id]; - }, - - /** Sets the visibility of this Flash object. */ - setVisible: function(){ - //FIXME: Dynamically make the movie visible or not - }, - - /** Centers the flash applet on the page. */ - center: function(){ - } -}; - - -/** - A class that is used to communicate between Flash and JavaScript in - a way that can pass large amounts of data back and forth reliably, - very fast, and with synchronous method calls. This class encapsulates the - specific way in which this communication occurs, - presenting a common interface to JavaScript irrespective of the underlying - Flash version. -*/ -dojo.flash.Communicator = function(){ - if(dojo.flash.useFlash6()){ - this._writeFlash6(); - }else if (dojo.flash.useFlash8()){ - this._writeFlash8(); - } -} - -dojo.flash.Communicator.prototype = { - _writeFlash6: function(){ - var id = dojo.flash.obj.id; - - // global function needed for Flash 6 callback; - // we write it out as a script tag because the VBScript hook for IE - // callbacks does not work properly if this function is evalled() from - // within the Dojo system - document.writeln(''); - - // hook for Internet Explorer to receive FSCommands from Flash - if(dojo.render.html.ie){ - document.writeln('\n' + - '\n' + - //'' + - '' + - html + ''); - close(); - } - - this.onLoad(); - }else{ - this.editNode.innerHTML = html; - this.onDisplayChanged(e); - } - }); - if(dojo.render.html.moz){ - this.iframe.onload = ifrFunc; - }else{ - ifrFunc(); - } - }, - - /** Draws an active x object, used by IE */ - _drawObject: function (html) { - this.object = document.createElement("object"); - - with (this.object) { - classid = "clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A"; - width = this.inheritWidth ? this._oldWidth : "100%"; - height = this._oldHeight; - Scrollbars = false; - Appearance = this._activeX.appearance.flat; - } - this.domNode.appendChild(this.object); - - this.object.attachEvent("DocumentComplete", dojo.lang.hitch(this, "onLoad")); - this.object.attachEvent("DisplayChanged", dojo.lang.hitch(this, "_updateHeight")); - this.object.attachEvent("DisplayChanged", dojo.lang.hitch(this, "onDisplayChanged")); - - this.object.DocumentHTML = '' + - '' + - '' + - //'' + - '
    ' + html + '
    '; - }, - -/* Event handlers - *****************/ - - onLoad: function(e){ - this.isLoaded = true; - if (this.object){ - this.document = this.object.DOM; - this.editNode = this.document.body.firstChild; - }else if (this.iframe){ - this.editNode = this.document.body; - this.connect(this, "onDisplayChanged", "_updateHeight"); - - try { // sanity check for Mozilla - this.document.execCommand("useCSS", false, true); // old moz call - this.document.execCommand("styleWithCSS", false, false); // new moz call - //this.document.execCommand("insertBrOnReturn", false, false); // new moz call - }catch(e2){ } - - if (dojo.render.html.safari) { - /* - this.iframe.style.visiblity = "visible"; - this.iframe.style.border = "1px solid black"; - this.editNode.style.visiblity = "visible"; - this.editNode.style.border = "1px solid black"; - */ - // this.onDisplayChanged(); - this.connect(this.editNode, "onblur", "onBlur"); - this.connect(this.editNode, "onfocus", "onFocus"); - - this.interval = setInterval(dojo.lang.hitch(this, "onDisplayChanged"), 750); - // dojo.raise("onload"); - // dojo.debug(this.editNode.parentNode.parentNode.parentNode.nodeName); - } else if (dojo.render.html.mozilla) { - - // We need to unhook the blur event listener on close as we - // can encounter a garunteed crash in FF if another event is - // also fired - var doc = this.document; - var blurfp = dojo.event.browser.addListener(this.document, "blur", dojo.lang.hitch(this, "onBlur")); - var unBlur = { unBlur: function(e){ - dojo.event.browser.removeListener(doc, "blur", blurfp); - } }; - dojo.event.connect("before", this, "close", unBlur, "unBlur"); - dojo.event.browser.addListener(this.document, "focus", dojo.lang.hitch(this, "onFocus")); - - // safari can't handle key listeners, it kills the speed - var addListener = dojo.event.browser.addListener; - addListener(this.document, "keypress", dojo.lang.hitch(this, "onKeyPress")); - addListener(this.document, "keydown", dojo.lang.hitch(this, "onKeyDown")); - addListener(this.document, "keyup", dojo.lang.hitch(this, "onKeyUp")); - addListener(this.document, "click", dojo.lang.hitch(this, "onClick")); - } - - // FIXME: when scrollbars appear/disappear this needs to be fired - } - - if(this.focusOnLoad){ - this.focus(); - } - this.onDisplayChanged(e); - }, - - /** Fired on keydown */ - onKeyDown: function (e) { - // we need this event at the moment to get the events from control keys - // such as the backspace. It might be possible to add this to Dojo, so that - // keyPress events can be emulated by the keyDown and keyUp detection. - }, - - /** Fired on keyup */ - onKeyUp: function (e) { - }, - - /** Fired on keypress. */ - onKeyPress: function (e) { - // handle the various key events - - var character = e.charCode > 0 ? String.fromCharCode(e.charCode) : null; - var code = e.keyCode; - - var preventDefault = true; // by default assume we cancel; - - // define some key combos - if (e.ctrlKey || e.metaKey) { // modifier pressed - switch (character) { - case "b": this.execCommand("bold"); break; - case "i": this.execCommand("italic"); break; - case "u": this.execCommand("underline"); break; - //case "a": this.execCommand("selectall"); break; - //case "k": this.execCommand("createlink", ""); break; - case "Z": this.execCommand("redo"); break; - case "s": this.close(true); break; // saves - default: switch (code) { - case e.KEY_LEFT_ARROW: - case e.KEY_RIGHT_ARROW: - //break; // preventDefault stops the browser - // going through its history - default: - preventDefault = false; break; // didn't handle here - } - } - } else { - switch (code) { - case e.KEY_TAB: - // commenting out bcs it's crashing FF - // this.execCommand(e.shiftKey ? "unindent" : "indent"); - // break; - default: - preventDefault = false; break; // didn't handle here - } - } - - if (preventDefault) { e.preventDefault(); } - - // function call after the character has been inserted - dojo.lang.setTimeout(this, this.onKeyPressed, 1, e); - }, - - /** - * Fired after a keypress event has occured and it's action taken. This - * is useful if action needs to be taken after text operations have - * finished - */ - onKeyPressed: function (e) { - // Mozilla adds a single

    with an embedded
    when you hit enter once: - //


    \n

    - // when you hit enter again it adds another
    inside your enter - //


    \n
    \n

    - // and if you hit enter again it splits the
    s over 2

    s - //


    \n

    \n


    \n

    - // now this assumes that

    s have double the line-height of
    s to work - // and so we need to remove the

    s to ensure the position of the cursor - // changes from the users perspective when they hit enter, as the second two - // html snippets render the same when margins are set to 0. - - // TODO: doesn't really work; is this really needed? - //if (dojo.render.html.moz) { - // for (var i = 0; i < this.document.getElementsByTagName("p").length; i++) { - // var p = this.document.getElementsByTagName("p")[i]; - // if (p.innerHTML.match(/^
    \s$/m)) { - // while (p.hasChildNodes()) { p.parentNode.insertBefore(p.firstChild, p); } - // p.parentNode.removeChild(p); - // } - // } - //} - this.onDisplayChanged(/*e*/); // can't pass in e - }, - - onClick: function (e) { this.onDisplayChanged(e); }, - - onBlur: function (e){ }, - onFocus: function (e){ }, - - blur: function () { - if (this.iframe) { this.window.blur(); } - else if (this.editNode) { this.editNode.blur(); } - }, - - focus: function () { - if(this.iframe){ - this.window.focus(); - }else if(this.editNode){ - this.editNode.focus(); - } - }, - - /** this event will be fired everytime the display context changes and the - result needs to be reflected in the UI */ - onDisplayChanged: function (e){ }, - - -/* Formatting commands - **********************/ - - /** IE's Active X codes */ - _activeX: { - command: { - bold: 5000, - italic: 5023, - underline: 5048, - - justifycenter: 5024, - justifyleft: 5025, - justifyright: 5026, - - cut: 5003, - copy: 5002, - paste: 5032, - "delete": 5004, - - undo: 5049, - redo: 5033, - - removeformat: 5034, - selectall: 5035, - unlink: 5050, - - indent: 5018, - outdent: 5031, - - insertorderedlist: 5030, - insertunorderedlist: 5051, - - // table commands - inserttable: 5022, - insertcell: 5019, - insertcol: 5020, - insertrow: 5021, - deletecells: 5005, - deletecols: 5006, - deleterows: 5007, - mergecells: 5029, - splitcell: 5047, - - // the command need mapping, they don't translate directly - // to the contentEditable commands - setblockformat: 5043, - getblockformat: 5011, - getblockformatnames: 5012, - setfontname: 5044, - getfontname: 5013, - setfontsize: 5045, - getfontsize: 5014, - setbackcolor: 5042, - getbackcolor: 5010, - setforecolor: 5046, - getforecolor: 5015, - - findtext: 5008, - font: 5009, - hyperlink: 5016, - image: 5017, - - lockelement: 5027, - makeabsolute: 5028, - sendbackward: 5036, - bringforward: 5037, - sendbelowtext: 5038, - bringabovetext: 5039, - sendtoback: 5040, - bringtofront: 5041, - - properties: 5052 - }, - - ui: { - "default": 0, - prompt: 1, - noprompt: 2 - }, - - status: { - notsupported: 0, - disabled: 1, - enabled: 3, - latched: 7, - ninched: 11 - }, - - appearance: { - flat: 0, - inset: 1 - }, - - state: { - unchecked: 0, - checked: 1, - gray: 2 - } - }, - - /** - * Used as the advice function by dojo.event.connect to map our - * normalized set of commands to those supported by the target - * browser - * - * @param arugments The arguments Array, containing at least one - * item, the command and an optional second item, - * an argument. - */ - _normalizeCommand: function (joinObject){ - var drh = dojo.render.html; - - var command = joinObject.args[0].toLowerCase(); - if(command == "formatblock"){ - if(drh.safari){ command = "heading"; } - if(drh.ie){ joinObject.args[1] = "<"+joinObject.args[1]+">"; } - } - if (command == "hilitecolor" && !drh.mozilla) { command = "backcolor"; } - joinObject.args[0] = command; - - if (joinObject.args.length > 1) { // a command was specified - var argument = joinObject.args[1]; - if (command == "heading") { throw new Error("unimplemented"); } - joinObject.args[1] = argument; - } - - return joinObject.proceed(); - }, - - /** - * Tests whether a command is supported by the host. Clients SHOULD check - * whether a command is supported before attempting to use it, behaviour - * for unsupported commands is undefined. - * - * @param command The command to test for - * @return true if the command is supported, false otherwise - */ - queryCommandAvailable: function (command) { - var ie = 1; - var mozilla = 1 << 1; - var safari = 1 << 2; - var opera = 1 << 3; - function isSupportedBy (browsers) { - return { - ie: Boolean(browsers & ie), - mozilla: Boolean(browsers & mozilla), - safari: Boolean(browsers & safari), - opera: Boolean(browsers & opera) - } - } - - var supportedBy = null; - - switch (command.toLowerCase()) { - case "bold": case "italic": case "underline": - case "subscript": case "superscript": - case "fontname": case "fontsize": - case "forecolor": case "hilitecolor": - case "justifycenter": case "justifyfull": case "justifyleft": case "justifyright": - case "cut": case "copy": case "paste": case "delete": - case "undo": case "redo": - supportedBy = isSupportedBy(mozilla | ie | safari | opera); - break; - - case "createlink": case "unlink": case "removeformat": - case "inserthorizontalrule": case "insertimage": - case "insertorderedlist": case "insertunorderedlist": - case "indent": case "outdent": case "formatblock": case "strikethrough": - supportedBy = isSupportedBy(mozilla | ie | opera); - break; - - case "blockdirltr": case "blockdirrtl": - case "dirltr": case "dirrtl": - case "inlinedirltr": case "inlinedirrtl": - supportedBy = isSupportedBy(ie); - break; - - case "inserttable": - supportedBy = isSupportedBy(mozilla | (this.object ? ie : 0)); - break; - - case "insertcell": case "insertcol": case "insertrow": - case "deletecells": case "deletecols": case "deleterows": - case "mergecells": case "splitcell": - supportedBy = isSupportedBy(this.object ? ie : 0); - break; - - default: return false; - } - - return (dojo.render.html.ie && supportedBy.ie) || - (dojo.render.html.mozilla && supportedBy.mozilla) || - (dojo.render.html.safari && supportedBy.safari) || - (dojo.render.html.opera && supportedBy.opera); - }, - - /** - * Executes a command in the Rich Text area - * - * @param command The command to execute - * @param argument An optional argument to the command - */ - execCommand: function (command, argument) { - if (this.object) { - if (command == "forecolor") { command = "setforecolor"; } - else if (command == "backcolor") { command = "setbackcolor"; } - - //if (typeof this._activeX.command[command] == "undefined") { return null; } - - if (command == "inserttable") { - var tableInfo = this.constructor._tableInfo; - if (!tableInfo) { - tableInfo = document.createElement("object"); - tableInfo.classid = "clsid:47B0DFC7-B7A3-11D1-ADC5-006008A5848C"; - document.body.appendChild(tableInfo); - this.constructor._table = tableInfo; - } - - tableInfo.NumRows = argument.rows; - tableInfo.NumCols = argument.cols; - tableInfo.TableAttrs = argument["TableAttrs"]; - tableInfo.CellAttrs = arr["CellAttrs"]; - tableInfo.Caption = arr["Caption"]; - } - - if (arguments.length == 1) { - return this.object.ExecCommand(this._activeX.command[command], - this._activeX.ui.noprompt); - } else { - return this.object.ExecCommand(this._activeX.command[command], - this._activeX.ui.noprompt, argument); - } - - // fix up unlink in Mozilla to unlink the link and not just the selection - } else if (command == "unlink" && - this.queryCommandEnabled("unlink") && dojo.render.html.mozilla) { - // grab selection - // Mozilla gets upset if we just store the range so we have to - // get the basic properties and recreate to save the selection - var selection = this.window.getSelection(); - var selectionRange = selection.getRangeAt(0); - var selectionStartContainer = selectionRange.startContainer; - var selectionStartOffset = selectionRange.startOffset; - var selectionEndContainer = selectionRange.endContainer; - var selectionEndOffset = selectionRange.endOffset; - - // select our link and unlink - var range = document.createRange(); - var a = this.getSelectedNode(); - while (a.nodeName != "A") { a = a.parentNode; } - range.selectNode(a); - selection.removeAllRanges(); - selection.addRange(range); - - var returnValue = this.document.execCommand("unlink", false, null); - - // restore original selection - var selectionRange = document.createRange(); - selectionRange.setStart(selectionStartContainer, selectionStartOffset); - selectionRange.setEnd(selectionEndContainer, selectionEndOffset); - selection.removeAllRanges(); - selection.addRange(selectionRange); - - return returnValue; - } else if (command == "inserttable" && dojo.render.html.mozilla) { - - var cols = ""; - for (var i = 0; i < argument.cols; i++) { cols += ""; } - cols += ""; - - var table = ""; - for (var i = 0; i < argument.rows; i++) { table += cols; } - table += "
    "; - var returnValue = this.document.execCommand("inserthtml", false, table); - - } else if (command == "hilitecolor" && dojo.render.html.mozilla) { - // mozilla doesn't support hilitecolor properly when useCSS is - // set to false (bugzilla #279330) - - this.document.execCommand("useCSS", false, false); - var returnValue = this.document.execCommand(command, false, argument); - this.document.execCommand("useCSS", false, true); - - } else { - argument = arguments.length > 1 ? argument : null; - var returnValue = this.document.execCommand(command, false, argument); - } - - this.onDisplayChanged(); - return returnValue; - }, - - queryCommandEnabled: function (command, argument) { - if (this.object) { - if (command == "forecolor") { command = "setforecolor"; } - else if (command == "backcolor") { command = "setbackcolor"; } - - if (typeof this._activeX.command[command] == "undefined") { return false; } - var status = this.object.QueryStatus(this._activeX.command[command]); - return (status != this.activeX.status.notsupported && - status != this.activeX.status.diabled); - } else { - // mozilla returns true always - if (command == "unlink" && dojo.render.html.mozilla) { - var node = this.getSelectedNode(); - while (node.parentNode && node.nodeName != "A") { node = node.parentNode; } - return node.nodeName == "A"; - } else if (command == "inserttable" && dojo.render.html.mozilla) { - return true; - } - return this.document.queryCommandEnabled(command); - } - }, - - queryCommandState: function (command, argument) { - if (this.object) { - if (command == "forecolor") { command = "setforecolor"; } - else if (command == "backcolor") { command = "setbackcolor"; } - - if (typeof this._activeX.command[command] == "undefined") { return null; } - var status = this.object.QueryStatus(this._activeX.command[command]); - return (status == this._activeX.status.enabled || - status == this._activeX.status.ninched); - } else { - return this.document.queryCommandState(command); - } - }, - - queryCommandValue: function (command, argument) { - if (this.object) { - switch (command) { - case "forecolor": - case "backcolor": - case "fontsize": - case "fontname": - case "blockformat": - command = "get" + command; - return this.object.execCommand( - this._activeX.command[command], - this._activeX.ui.noprompt); - } - - //var status = this.object.QueryStatus(this._activeX.command[command]); - } else { - return this.document.queryCommandValue(command); - } - }, - - -/* Misc. - ********/ - - getSelectedNode: function () { - if(!this.isLoaded){ return; } - if (this.document.selection) { - return this.document.selection.createRange().parentElement(); - } else if (dojo.render.html.mozilla) { - return this.window.getSelection().getRangeAt(0).commonAncestorContainer; - } - return this.editNode; - }, - - placeCursorAtStart: function () { - if(!this.isLoaded){ - dojo.event.connect(this, "onLoad", this, "placeCursorAtEnd"); - return; - } - dojo.event.disconnect(this, "onLoad", this, "placeCursorAtEnd"); - if (this.window.getSelection) { - var selection = this.window.getSelection; - if (selection.removeAllRanges) { // Mozilla - var range = this.document.createRange(); - range.selectNode(this.editNode.firstChild); - range.collapse(true); - var selection = this.window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - } else { // Safari - // not a great deal we can do - } - } else if (this.document.selection) { // IE - var range = this.document.body.createTextRange(); - range.moveToElementText(this.editNode); - range.collapse(true); - range.select(); - } - }, - - placeCursorAtEnd: function () { - if(!this.isLoaded){ - dojo.event.connect(this, "onLoad", this, "placeCursorAtEnd"); - return; - } - dojo.event.disconnect(this, "onLoad", this, "placeCursorAtEnd"); - if (this.window.getSelection) { - var selection = this.window.getSelection; - if (selection.removeAllRanges) { // Mozilla - var range = this.document.createRange(); - range.selectNode(this.editNode.lastChild); - range.collapse(false); - var selection = this.window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - } else { // Safari - // not a great deal we can do - } - } else if (this.document.selection) { // IE - var range = this.document.body.createTextRange(); - range.moveToElementText(this.editNode); - range.collapse(true); - range.select(); - } - }, - - _lastHeight: 0, - - /** Updates the height of the iframe to fit the contents. */ - _updateHeight: function () { - if (this.iframe) { - /* - if(!this.document.body["offsetHeight"]){ - return; - } - */ - // The height includes the padding, borders and margins so these - // need to be added on - var heights = ["margin-top", "margin-bottom", - "padding-bottom", "padding-top", - "border-width-bottom", "border-width-top"]; - for (var i = 0, chromeheight = 0; i < heights.length; i++) { - var height = dojo.style.getStyle(this.iframe, heights[i]); - // Safari doesn't have all the heights so we have to test - if (height) { - chromeheight += Number(height.replace(/[^0-9]/g, "")); - } - } - // dojo.debug(this.document.body.offsetHeight); - // dojo.debug(chromeheight); - if(this.document.body["offsetHeight"]){ - this._lastHeight = this.document.body.offsetHeight + chromeheight; - this.iframe.height = this._lastHeight + "px"; - this.window.scrollTo(0, 0); - } - // this.iframe.height = this._lastHeight + "px"; - // dojo.debug(this.iframe.height); - } else if (this.object) { - this.object.height = dojo.style.getInnerHeight(this.editNode); - } - }, - - /** - * Saves the content in an onunload event if the editor has not been closed - */ - _saveContent: function(e){ - var saveTextarea = document.getElementById("dojo.widget.RichText.savedContent"); - saveTextarea.value += this._SEPARATOR + this.saveName + ":" + this.getEditorContent(); - }, - - getEditorContent: function(){ - var ec = ""; - try{ - ec = (this._content.length > 0) ? this._content : this.editNode.innerHTML; - }catch(e){ /* squelch */ } - - dojo.lang.forEach(this.contentFilters, function(ef){ - ec = ef(ec); - }); - return ec; - }, - - /** - * Kills the editor and optionally writes back the modified contents to the - * element from which it originated. - * - * @param save Whether or not to save the changes. If false, the changes are - * discarded. - * @return true if the contents has been modified, false otherwise - */ - close: function(save, force){ - if(this.isClosed){return false; } - - if (arguments.length == 0) { save = true; } - this._content = this.editNode.innerHTML; - var changed = (this.savedContent.innerHTML != this._content); - - // line height is squashed for iframes - if (this.iframe){ this.domNode.style.lineHeight = null; } - - if(this.interval){ clearInterval(this.interval); } - - if(dojo.render.html.ie && !this.object){ - dojo.event.browser.clean(this.editNode); - } - if(dojo.render.html.moz){ - var ifr = this.domNode.firstChild; - ifr.style.display = "none"; - /* - setTimeout(function(){ - ifr.parentNode.removeChild(ifr); - }, 0); - */ - }else{ - this.domNode.innerHTML = ""; - } - // dojo.dom.removeChildren(this.domNode); - if(save){ - if(dojo.render.html.moz){ - var nc = document.createElement("span"); - this.domNode.appendChild(nc); - nc.innerHTML = this.editNode.innerHTML; - }else{ - this.domNode.innerHTML = this._content; - } - // kill listeners on the saved content - dojo.event.browser.clean(this.savedContent); - } else { - while (this.savedContent.hasChildNodes()) { - this.domNode.appendChild(this.savedContent.firstChild); - } - } - delete this.savedContent; - - dojo.html.removeClass(this.domNode, "RichTextEditable"); - this.isClosed = true; - this.isLoaded = false; - - return changed; - }, - - destroy: function () { - if (!this.isClosed) { this.close(false); } - - // disconnect those listeners. - while (this._connected.length) { - this.disconnect(this._connected[0], - this._connected[1], this._connected[2]); - } - }, - - _connected: [], - connect: function (targetObj, targetFunc, thisFunc) { - dojo.event.connect(targetObj, targetFunc, this, thisFunc); - // this._connected.push([targetObj, targetFunc, thisFunc]); - }, - - // FIXME: below two functions do not work with the above line commented out - disconnect: function (targetObj, targetFunc, thisFunc) { - for (var i = 0; i < this._connected.length; i++) { - if (this._connected[0] == targetObj && - this._connected[1] == targetFunc && - this._connected[2] == thisFunc) { - dojo.event.disconnect(targetObj, targetFunc, this, thisFunc); - this._connected.splice(i, 1); - break; - } - } - }, - - disconnectAllWithRoot: function (targetObj) { - for (var i = 0; i < this._connected.length; i++) { - if (this._connected[0] == targetObj) { - dojo.event.disconnect(targetObj, - this._connected[1], this, this._connected[2]); - this._connected.splice(i, 1); - } - } - } - -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SimpleDropdownButtons.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SimpleDropdownButtons.js deleted file mode 100644 index 851b862ba..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SimpleDropdownButtons.js +++ /dev/null @@ -1,158 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/* TODO: - * - make the dropdowns "smart" so they can't get cutoff on bottom of page, sides of page, etc. - * - unify menus with the MenuItem and Menu classes so we can add stuff to all menus at once - * - allow buttons to be enabled/disabled at runtime - * - this probably means creating all menus upfront and then triggering a disable action - * for disabled buttons in the constructor loop. we'll need a disable and enable action anyway - * - should each button with menu be a widget object of it's own? - */ -dojo.provide("dojo.widget.SimpleDropdownButtons"); -dojo.provide("dojo.widget.HtmlSimpleDropdownButtons"); - -dojo.deprecated("dojo.widget.SimpleDropdownButtons", "use dojo.widget.DropDownButton2", "0.4"); - -dojo.require("dojo.event.*"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.uri.Uri"); -dojo.require("dojo.dom"); -dojo.require("dojo.style"); -dojo.require("dojo.html"); - -dojo.widget.tags.addParseTreeHandler("dojo:simpledropdownbuttons"); - -dojo.widget.HtmlSimpleDropdownButtons = function() { - dojo.widget.HtmlWidget.call(this); - - this.widgetType = "SimpleDropdownButtons"; - this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/HtmlSimpleDropdownButtons.css"); - - this.menuTriggerClass = "dojoSimpleDropdownButtons"; - this.menuClass = "dojoSimpleDropdownButtonsMenu"; - - // overwrite buildRendering so we don't clobber our list - this.buildRendering = function(args, frag) { - if(this.templateCssPath) { - dojo.style.insertCssFile(this.templateCssPath, null, true); - } - this.domNode = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"]; - - var menu = this.domNode; - if( !dojo.html.hasClass(menu, this.menuTriggerClass) ) { - dojo.html.addClass(menu, this.menuTriggerClass); - } - var li = dojo.dom.getFirstChildElement(menu); - var menuIDs = []; - var arrowIDs = []; - - while(li) { - if(li.getElementsByTagName("ul").length > 0) { - var a = dojo.dom.getFirstChildElement(li); - var arrow = document.createElement("a"); - arrow.href = "javascript:;"; - arrow.innerHTML = " "; - dojo.html.setClass(arrow, "downArrow"); - if(!arrow.id) { - arrow.id = dojo.dom.getUniqueId(); - } - arrowIDs.push(arrow.id); - var submenu = dojo.dom.getNextSiblingElement(a); - if(!submenu.id) { - submenu.id = dojo.dom.getUniqueId(); - } - menuIDs.push(submenu.id); - - if( dojo.html.hasClass(a, "disabled") ) { - dojo.html.addClass(arrow, "disabled"); - dojo.html.disableSelection(li); - arrow.onfocus = function(){ this.blur(); } - } else { - dojo.html.addClass(submenu, this.menuClass); - dojo.html.body().appendChild(submenu); - dojo.event.connect(arrow, "onmousedown", (function() { - var ar = arrow; - return function(e) { - dojo.html.addClass(ar, "pressed"); - } - })()); - dojo.event.connect(arrow, "onclick", (function() { - var aa = a; - var ar = arrow; - var sm = submenu; - var setWidth = false; - - return function(e) { - hideAll(sm, ar); - sm.style.left = (dojo.html.getScrollLeft() - + e.clientX - e.layerX + aa.offsetLeft) + "px"; - sm.style.top = (dojo.html.getScrollTop() + e.clientY - - e.layerY + aa.offsetTop + aa.offsetHeight) + "px"; - sm.style.display = sm.style.display == "block" ? "none" : "block"; - if(sm.style.display == "none") { - dojo.html.removeClass(ar, "pressed"); - e.target.blur() - } - if(!setWidth && sm.style.display == "block" - && sm.offsetWidth < aa.offsetWidth + ar.offsetWidth) { - sm.style.width = aa.offsetWidth + ar.offsetWidth + "px"; - setWidth = true; - } - e.preventDefault(); - } - })()); - } - - dojo.event.connect(a, "onclick", function(e) { - if(e && e.target && e.target.blur) { - e.target.blur(); - } - }); - - if(a.nextSibling) { - li.insertBefore(arrow, a.nextSibling); - } else { - li.appendChild(arrow); - } - - } - li = dojo.dom.getNextSiblingElement(li); - } - - function hideAll(excludeMenu, excludeArrow) { - // hide menus - for(var i = 0; i < menuIDs.length; i++) { - var m = document.getElementById(menuIDs[i]); - if(!excludeMenu || m != excludeMenu) { - document.getElementById(menuIDs[i]).style.display = "none"; - } - } - // restore arrows to non-pressed state - for(var i = 0; i < arrowIDs.length; i++) { - var m = document.getElementById(arrowIDs[i]); - if(!excludeArrow || m != excludeArrow) { - dojo.html.removeClass(m, "pressed"); - } - } - } - - dojo.event.connect(document.documentElement, "onmousedown", function(e) { - if( dojo.html.hasClass(e.target, "downArrow") ) { return }; - for(var i = 0; i < menuIDs.length; i++) { - if( dojo.dom.isDescendantOf(e.target, document.getElementById(menuIDs[i])) ) { - return; - } - } - hideAll(); - }); - } -} -dojo.inherits(dojo.widget.HtmlSimpleDropdownButtons, dojo.widget.HtmlWidget); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SlideShow.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SlideShow.js deleted file mode 100644 index c768e8525..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SlideShow.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.SlideShow"); -dojo.provide("dojo.widget.html.SlideShow"); - -dojo.require("dojo.event"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.fx.html"); -dojo.require("dojo.style"); - -dojo.widget.html.SlideShow = function(){ - dojo.widget.HtmlWidget.call(this); - - this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlSlideShow.html"); - this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/HtmlSlideShow.css"); - - // over-ride some defaults - this.isContainer = false; - this.widgetType = "SlideShow"; - - // useful properties - this.imgUrls = []; // the images we'll go through - this.imgUrlBase = ""; - this.urlsIdx = 0; // where in the images we are - this.delay = 4000; // give it 4 seconds - this.transitionInterval = 2000; // 2 seconds - this.imgWidth = 800; // img width - this.imgHeight = 600; // img height - this.background = "img2"; // what's in the bg - this.foreground = "img1"; // what's in the fg - this.stopped = false; // should I stay or should I go? - this.fadeAnim = null; // references our animation - - // our DOM nodes: - this.imagesContainer = null; - this.startStopButton = null; - this.controlsContainer = null; - this.img1 = null; - this.img2 = null; - - this.fillInTemplate = function(){ - dojo.style.setOpacity(this.img1, 0.9999); - dojo.style.setOpacity(this.img2, 0.9999); - with(this.imagesContainer.style){ - width = this.imgWidth+"px"; - height = this.imgHeight+"px"; - } - with(this.img1.style){ - width = this.imgWidth+"px"; - height = this.imgHeight+"px"; - } - with(this.img2.style){ - width = this.imgWidth+"px"; - height = this.imgHeight+"px"; - } - if(this.imgUrls.length>1){ - this.img2.src = this.imgUrlBase+this.imgUrls[this.urlsIdx++]; - this.endTransition(); - }else{ - this.img1.src = this.imgUrlBase+this.imgUrls[this.urlsIdx++]; - } - } - - this.togglePaused = function(){ - if(this.stopped){ - this.stopped = false; - this.endTransition(); - this.startStopButton.value= "pause"; - }else{ - this.stopped = true; - this.startStopButton.value= "play"; - } - } - - this.backgroundImageLoaded = function(){ - // start fading out the foreground image - if(this.stopped){ return; } - // closure magic for callback - var _this = this; - var callback = function(){ _this.endTransition(); }; - - // actually start the fadeOut effect - // NOTE: if we wanted to use other transition types, we'd set them up - // here as well - if(this.fadeAnim) { - this.fadeAnim.stop(); - } - this.fadeAnim = dojo.fx.html.fadeOut(this[this.foreground], - this.transitionInterval, callback); - } - - this.endTransition = function(){ - // move the foreground image to the background - with(this[this.background].style){ zIndex = parseInt(zIndex)+1; } - with(this[this.foreground].style){ zIndex = parseInt(zIndex)-1; } - - // fg/bg book-keeping - var tmp = this.foreground; - this.foreground = this.background; - this.background = tmp; - - // keep on truckin - this.loadNextImage(); - } - - this.loadNextImage = function(){ - // load a new image in that container, and make sure it informs - // us when it finishes loading - dojo.event.kwConnect({ - srcObj: this[this.background], - srcFunc: "onload", - adviceObj: this, - adviceFunc: "backgroundImageLoaded", - once: true, // make sure we only ever hear about it once - delay: this.delay - }); - dojo.style.setOpacity(this[this.background], 1.0); - this[this.background].src = this.imgUrlBase+this.imgUrls[this.urlsIdx++]; - if(this.urlsIdx>(this.imgUrls.length-1)){ - this.urlsIdx = 0; - } - } -} -dojo.inherits(dojo.widget.html.SlideShow, dojo.widget.HtmlWidget); -dojo.widget.tags.addParseTreeHandler("dojo:slideshow"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SplitPane.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SplitPane.js deleted file mode 100644 index 754946ed2..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SplitPane.js +++ /dev/null @@ -1,514 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.SplitPane"); -dojo.provide("dojo.widget.SplitPanePanel"); -dojo.provide("dojo.widget.html.SplitPane"); -dojo.provide("dojo.widget.html.SplitPanePanel"); - -// -// TODO -// make it prettier -// active dragging upwards doesn't always shift other bars (direction calculation is wrong in this case) -// - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.LayoutPane"); -dojo.require("dojo.widget.Container"); -dojo.require("dojo.html"); -dojo.require("dojo.style"); -dojo.require("dojo.dom"); - -dojo.widget.html.SplitPane = function(){ - - dojo.widget.html.Container.call(this); - - this.sizers = []; -} - -dojo.inherits(dojo.widget.html.SplitPane, dojo.widget.html.Container); - -dojo.lang.extend(dojo.widget.html.SplitPane, { - widgetType: "SplitPane", - virtualSizer: null, - isHorizontal: 0, - paneBefore: null, - paneAfter: null, - isSizing: false, - dragOffset: null, - startPoint: null, - lastPoint: null, - sizingSplitter: null, - isActiveResize: 0, - offsetX: 0, - offsetY: 0, - isDraggingLeft: 0, - templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlSplitPane.css"), - originPos: null, - - activeSizing: '', - sizerWidth: 15, - orientation: 'horizontal', - - debugName: '', - - fillInTemplate: function(){ - - dojo.style.insertCssFile(this.templateCssPath, null, true); - dojo.html.addClass(this.domNode, "dojoHtmlSplitPane"); - this.domNode.style.overflow='hidden'; // workaround firefox bug - - this.paneWidth = dojo.style.getContentWidth(this.domNode); - this.paneHeight = dojo.style.getContentHeight(this.domNode); - - this.isHorizontal = (this.orientation == 'horizontal') ? 1 : 0; - this.isActiveResize = (this.activeSizing == '1') ? 1 : 0; - - //dojo.debug("fillInTemplate for "+this.debugName); - }, - - onResized: function(e){ - this.paneWidth = dojo.style.getContentWidth(this.domNode); - this.paneHeight = dojo.style.getContentHeight(this.domNode); - this.layoutPanels(); - this.notifyChildrenOfResize(); // notify children they've been moved/resized - }, - - postCreate: function(args, fragment, parentComp){ - - // dojo.debug("post create for "+this.debugName); - - // attach the children - - for(var i=0; i 1){ - - space -= this.sizerWidth * (this.children.length - 1); - } - - - // - // calculate total of SizeShare values - // - - var out_of = 0; - - for(var i=0; i 0){ - if (pane.sizeActual > pane.sizeMin){ - if ((pane.sizeActual - pane.sizeMin) > growth){ - - // stick all the growth in this pane - pane.sizeActual = pane.sizeActual - growth; - growth = 0; - }else{ - // put as much growth in here as we can - growth -= pane.sizeActual - pane.sizeMin; - pane.sizeActual = pane.sizeMin; - } - } - } - return growth; - }, - - checkSizes: function(){ - - var total_min_size = 0; - var total_size = 0; - - for(var i=0; i 0){ - if (this.isDraggingLeft){ - for(var i=this.children.length-1; i>=0; i--){ - growth = this.growPane(growth, this.children[i]); - } - }else{ - for(var i=0; i 0) ? 1 : 0; - - if (!this.isActiveResize){ - - if (a < this.paneBefore.position + this.paneBefore.sizeMin){ - - a = this.paneBefore.position + this.paneBefore.sizeMin; - } - - if (a > this.paneAfter.position + (this.paneAfter.sizeActual - (this.sizerWidth + this.paneAfter.sizeMin))){ - - a = this.paneAfter.position + (this.paneAfter.sizeActual - (this.sizerWidth + this.paneAfter.sizeMin)); - } - } - - a -= this.sizingSplitter.position; - - this.checkSizes(); - - return a; - }, - - updateSize: function(){ - - var p = this.clientToScreen(this.lastPoint); - var p = this.screenToClient(this.lastPoint); - - var pos = this.isHorizontal ? p.x - (this.dragOffset.x + this.originPos.x) : p.y - (this.dragOffset.y + this.originPos.y); - - var start_region = this.paneBefore.position; - var end_region = this.paneAfter.position + this.paneAfter.sizeActual; - - this.paneBefore.sizeActual = pos - start_region; - this.paneAfter.position = pos + this.sizerWidth; - this.paneAfter.sizeActual = end_region - this.paneAfter.position; - - for(var i=0; i"+ label + ""; - //textNode.setAttribute("x", coords[6]); - //textNode.setAttribute("y", coords[7]); - break; - case "rectangle": - //FIXME: implement - textString = ""; - //textNode.setAttribute("x", coords[6]); - //textNode.setAttribute("y", coords[7]); - break; - case "circle": - //FIXME: implement - textString = ""; - //textNode.setAttribute("x", coords[6]); - //textNode.setAttribute("y", coords[7]); - break; - } - //textNode.appendChild(labelNode); - //this.domNode.appendChild(textNode); - return textString; - alert(textNode.getComputedTextLength()); - } - - this.fillInTemplate = function(x, y, textSize, label, shape){ - // the idea is to set the text to the appropriate place given its length - // and the template shape - - // FIXME: For now, assuming text sizes are integers in SVG units - this.textSize = textSize || 12; - this.label = label; - // FIXEME: for now, I'm going to fake this... need to come up with a real way to - // determine the actual width of the text, such as computedStyle - var textWidth = this.label.length*this.textSize ; - //this.setLabel(); - } -} - -dojo.inherits(dojo.widget.SvgButton, dojo.widget.DomButton); - -// FIXME -dojo.widget.SvgButton.prototype.shapeString = function(x, y, textSize, label, shape) { - switch(shape) { - case "ellipse": - var coords = dojo.widget.SvgButton.prototype.coordinates(x, y, textSize, label, shape) - return ""; - break; - case "rect": - //FIXME: implement - return ""; - //return ""; - break; - case "circle": - //FIXME: implement - return ""; - //return ""; - break; - } -} - -dojo.widget.SvgButton.prototype.coordinates = function(x, y, textSize, label, shape) { - switch(shape) { - case "ellipse": - var buttonWidth = label.length*textSize; - var buttonHeight = textSize*2.5 - var rx = buttonWidth/2; - var ry = buttonHeight/2; - var cx = rx + x; - var cy = ry + y; - var textX = cx - rx*textSize/25; - var textY = cy*1.1; - return [buttonWidth, buttonHeight, rx, ry, cx, cy, textX, textY]; - break; - case "rectangle": - //FIXME: implement - return ""; - break; - case "circle": - //FIXME: implement - return ""; - break; - } -} - -dojo.widget.SvgButton.prototype.labelString = function(x, y, textSize, label, shape){ - var textString = ""; - var coords = dojo.widget.SvgButton.prototype.coordinates(x, y, textSize, label, shape); - switch(shape) { - case "ellipse": - textString = ""+ label + ""; - break; - case "rectangle": - //FIXME: implement - textString = ""; - break; - case "circle": - //FIXME: implement - textString = ""; - break; - } - return textString; -} - -//dojo.widget.SVGButton.prototype.templateString = ""+ dojo.webui.widgets.SVGButton.prototype.shapeString("ellipse") + ""; - -dojo.widget.SvgButton.prototype.templateString = function(x, y, textSize, label, shape) { - return ""+ dojo.webui.widgets.SVGButton.prototype.shapeString(x, y, textSize, label, shape) + dojo.widget.SVGButton.prototype.labelString(x, y, textSize, label, shape) + ""; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SvgWidget.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SvgWidget.js deleted file mode 100644 index 681875553..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/SvgWidget.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.widget.DomWidget"); -dojo.provide("dojo.widget.SvgWidget"); -dojo.provide("dojo.widget.SVGWidget"); // back compat - -dojo.require("dojo.dom"); - -// SVGWidget is a mixin ONLY -dojo.widget.SvgWidget = function(args){ - // mix in the parent type - // dojo.widget.DomWidget.call(this); -} -dojo.inherits(dojo.widget.SvgWidget, dojo.widget.DomWidget); - -dojo.lang.extend(dojo.widget.SvgWidget, { - getContainerHeight: function(){ - // NOTE: container height must be returned as the INNER height - dj_unimplemented("dojo.widget.SvgWidget.getContainerHeight"); - }, - - getContainerWidth: function(){ - // return this.parent.domNode.offsetWidth; - dj_unimplemented("dojo.widget.SvgWidget.getContainerWidth"); - }, - - setNativeHeight: function(height){ - // var ch = this.getContainerHeight(); - dj_unimplemented("dojo.widget.SVGWidget.setNativeHeight"); - }, - - createNodesFromText: function(txt, wrap){ - return dojo.dom.createNodesFromText(txt, wrap); - } -}); - -dojo.widget.SVGWidget = dojo.widget.SvgWidget; - -try{ -(function(){ - var tf = function(){ - // FIXME: fill this in!!! - var rw = new function(){ - dojo.widget.SvgWidget.call(this); - this.buildRendering = function(){ return; } - this.destroyRendering = function(){ return; } - this.postInitialize = function(){ return; } - this.cleanUp = function(){ return; } - this.widgetType = "SVGRootWidget"; - this.domNode = document.documentElement; - } - var wm = dojo.widget.manager; - wm.root = rw; - wm.add(rw); - - // extend the widgetManager with a getWidgetFromNode method - wm.getWidgetFromNode = function(node){ - var filter = function(x){ - if(x.domNode == node){ - return true; - } - } - var widgets = []; - while((node)&&(widgets.length < 1)){ - widgets = this.getWidgetsByFilter(filter); - node = node.parentNode; - } - if(widgets.length > 0){ - return widgets[0]; - }else{ - return null; - } - } - - wm.getWidgetFromEvent = function(domEvt){ - return this.getWidgetFromNode(domEvt.target); - } - - wm.getWidgetFromPrimitive = wm.getWidgetFromNode; - } - // make sure we get called when the time is right - dojo.event.connect(dojo.hostenv, "loaded", tf); -})(); -}catch(e){ alert(e); } diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TabPane.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TabPane.js deleted file mode 100644 index 2ddde7fae..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TabPane.js +++ /dev/null @@ -1,155 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.TabPane"); -dojo.provide("dojo.widget.html.TabPane"); -dojo.provide("dojo.widget.Tab"); -dojo.provide("dojo.widget.html.Tab"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.LayoutPane"); -dojo.require("dojo.event.*"); -dojo.require("dojo.html"); -dojo.require("dojo.style"); - -////////////////////////////////////////// -// TabPane -- a set of Tabs -////////////////////////////////////////// -dojo.widget.html.TabPane = function() { - dojo.widget.html.LayoutPane.call(this); -} -dojo.inherits(dojo.widget.html.TabPane, dojo.widget.html.LayoutPane); - -dojo.lang.extend(dojo.widget.html.TabPane, { - widgetType: "TabPane", - - // Constructor arguments - labelPosition: "top", - useVisibility: false, // true-->use visibility:hidden instead of display:none - - - templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTabPane.css"), - - selectedTab: "", // initially selected tab (widgetId) - - fillInTemplate: function(args, frag) { - dojo.widget.html.TabPane.superclass.fillInTemplate.call(this, args, frag); - - dojo.style.insertCssFile(this.templateCssPath, null, true); - dojo.html.prependClass(this.domNode, "dojoTabPane"); - }, - - postCreate: function(args, frag) { - // Create

      with special formatting to store all the tab labels - // TODO: set "bottom" css tag if label is on bottom - this.ul = document.createElement("ul"); - dojo.html.addClass(this.ul, "tabs"); - dojo.html.addClass(this.ul, this.labelPosition); - - // Load all the tabs, creating a label for each one - for(var i=0; i - parseContent: false, // parse externally loaded pages for widgets - - preventCache: false, - - buildRendering: function(args, frag) { - dojo.style.insertCssFile(this.templateCssPath); - this.domNode = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"]; - if(!this.domNode) { dj_error("html.Tabs: No node reference"); } - - if(args["tabtarget"]) { - this.tabtarget = args["tabtarget"]; - this.containerNode = document.getElementById(args["tabtarget"]); - } else { - this.containerNode = document.createElement("div"); - var next = this.domNode.nextSibling; - if(next) { - this.domNode.parentNode.insertBefore(this.containerNode, next); - } else { - this.domNode.parentNode.appendChild(this.containerNode); - } - } - dojo.html.addClass(this.containerNode, "dojoTabPanelContainer"); - - var li = dojo.dom.getFirstChildElement(this.domNode); - while(li) { - var a = li.getElementsByTagName("a").item(0); - this.addTab(a); - li = dojo.dom.getNextSiblingElement(li); - } - - if(this.selected == -1) { this.selected = 0; } - this.selectTab(null, this.tabs[this.selected]); - }, - - addTab: function(title, url, tabId, tabHandler) { - // TODO: make this an object proper - var panel = { - url: null, - title: null, - isLoaded: false, - id: null, - isLocal: false - }; - - function isLocal(a) { - var url = a.getAttribute("href"); - var hash = url.indexOf("#"); - if(hash == 0) { - return true; - } - var loc = location.href.split("#")[0]; - var url2 = url.split("#")[0]; - if(loc == url2) { - return true; - } - if(unescape(loc) == url2) { - return true; - } - var outer = a.outerHTML; - if(outer && /href=["']?#/i.test(outer)) { - return true; - } - return false; - } - - if(title && title.tagName && title.tagName.toLowerCase() == "a") { - // init case - var a = title; - var li = a.parentNode; - title = a.innerHTML; - url = a.getAttribute("href"); - var id = null; - var hash = url.indexOf("#"); - if(isLocal(a)) { - id = url.split("#")[1]; - dj_debug("setting local id:", id); - url = "#" + id; - panel.isLocal = true; - } else { - id = a.getAttribute("tabid"); - } - - panel.url = url; - panel.title = title; - panel.id = id || dojo.html.getUniqueId(); - dj_debug("panel id:", panel.id, "url:", panel.url); - } else { - // programmatically adding - var li = document.createElement("li"); - var a = document.createElement("a"); - a.innerHTML = title; - a.href = url; - li.appendChild(a); - this.domNode.appendChild(li); - - panel.url = url; - panel.title = title; - panel.id = tabId || dojo.html.getUniqueId(); - dj_debug("prg tab:", panel.id, "url:", panel.url); - } - - if(panel.isLocal) { - var node = document.getElementById(id); - node.style.display = "none"; - this.containerNode.appendChild(node); - } else { - var node = document.createElement("div"); - node.style.display = "none"; - node.id = panel.id; - this.containerNode.appendChild(node); - } - - var handler = a.getAttribute("tabhandler") || tabHandler; - if(handler) { - this.setPanelHandler(handler, panel); - } - - dojo.event.connect(a, "onclick", this, "selectTab"); - - this.tabs.push(li); - this.panels.push(panel); - - if(this.selected == -1 && dojo.html.hasClass(li, "current")) { - this.selected = this.tabs.length-1; - } - - return { "tab": li, "panel": panel }; - }, - - selectTab: function(e, target) { - if(dojo.lang.isNumber(e)) { - target = this.tabs[e]; - } - else if(e) { - if(e.target) { - target = e.target; - while(target && (target.tagName||"").toLowerCase() != "li") { - target = target.parentNode; - } - } - if(e.preventDefault) { e.preventDefault(); } - } - - dojo.html.removeClass(this.tabs[this.selected], "current"); - - for(var i = 0; i < this.tabs.length; i++) { - if(this.tabs[i] == target) { - dojo.html.addClass(this.tabs[i], "current"); - this.selected = i; - break; - } - } - - var panel = this.panels[this.selected]; - if(panel) { - this.getPanel(panel); - this.hidePanels(panel); - document.getElementById(panel.id).style.display = ""; - } - }, - - setPanelHandler: function(handler, panel) { - var fcn = dojo.lang.isFunction(handler) ? handler : window[handler]; - if(!dojo.lang.isFunction(fcn)) { - throw new Error("Unable to set panel handler, '" + handler + "' not a function."); - return; - } - this["tabHandler" + panel.id] = function() { - return fcn.apply(this, arguments); - } - }, - - runPanelHandler: function(panel) { - if(dojo.lang.isFunction(this["tabHandler" + panel.id])) { - this["tabHandler" + panel.id](panel, document.getElementById(panel.id)); - return false; - } - return true; - }, - - getPanel: function(panel) { - if(this.runPanelHandler(panel)) { - if(panel.isLocal) { - // do nothing? - } else { - if(!panel.isLoaded || !this.useCache) { - this.setExternalContent(panel, panel.url, this.useCache, this.preventCache); - } - } - } - }, - - setExternalContent: function(panel, url, useCache, preventCache) { - var node = document.getElementById(panel.id); - node.innerHTML = "Loading..."; - - var extract = this.extractContent; - var parse = this.parseContent; - - dojo.io.bind({ - url: url, - useCache: useCache, - preventCache: preventCache, - mimetype: "text/html", - handler: function(type, data, e) { - if(type == "load") { - if(extract) { - var matches = data.match(/]*>\s*([\s\S]+)\s*<\/body>/im); - if(matches) { data = matches[1]; } - } - node.innerHTML = data; - panel.isLoaded = true; - if(parse) { - var parser = new dojo.xml.Parse(); - var frag = parser.parseElement(node, null, true); - dojo.widget.getParser().createComponents(frag); - } - } else { - node.innerHTML = "Error loading '" + panel.url + "' (" + e.status + " " + e.statusText + ")"; - } - } - }); - }, - - hidePanels: function(except) { - for(var i = 0; i < this.panels.length; i++) { - if(this.panels[i] != except && this.panels[i].id) { - var p = document.getElementById(this.panels[i].id); - if(p) { - p.style.display = "none"; - } - } - } - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TaskBar.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TaskBar.js deleted file mode 100644 index 768f7ea62..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TaskBar.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.TaskBar"); -dojo.provide("dojo.widget.TaskBarItem"); -dojo.require("dojo.widget.Widget"); - -dojo.widget.TaskBar = function(){ - dojo.widget.Widget.call(this); - - this.widgetType = "TaskBar"; - this.isContainer = true; -} -dojo.inherits(dojo.widget.TaskBar, dojo.widget.Widget); -dojo.widget.tags.addParseTreeHandler("dojo:taskbar"); - -dojo.widget.TaskBarItem = function(){ - dojo.widget.Widget.call(this); - - this.widgetType = "TaskBarItem"; -} -dojo.inherits(dojo.widget.TaskBarItem, dojo.widget.Widget); -dojo.widget.tags.addParseTreeHandler("dojo:taskbaritem"); - -dojo.requireAfterIf("html", "dojo.widget.html.TaskBar"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TemplatedContainer.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TemplatedContainer.js deleted file mode 100644 index 2a0a81aa3..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/TemplatedContainer.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.TemplatedContainer"); -dojo.provide("dojo.widget.html.TemplatedContainer"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.HtmlWidget"); - -dojo.widget.html.TemplatedContainer = function(){ - dojo.widget.HtmlWidget.call(this); -} - -dojo.inherits(dojo.widget.html.TemplatedContainer, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.TemplatedContainer, { - widgetType: "TemplatedContainer", - - isContainer: true, - templateString: '


      ', - header: null, - containerNode: null, - footer: null, - domNode: null, - - onResized: function() { - // Clients should override this function to do special processing, - // then call this.notifyChildrenOfResize() to notify children of resize - this.notifyChildrenOfResize(); - }, - - notifyChildrenOfResize: function() { - for(var i=0; i -10 && timeZoneHour < 0) { - timeZoneHour = "-0" + Math.abs(timeZoneHour); - } else if(timeZoneHour < 10) { - timeZoneHour = "+0" + timeZoneHour.toString(); - } else if(timeZoneHour >= 10) { - timeZoneHour = "+" + timeZoneHour.toString(); - } - var timeZoneMinute = timeZone%60; - if(timeZoneMinute < 10) { - timeZoneMinute = "0" + timeZoneMinute.toString(); - } - return year + "-" + month + "-" + date + "T" + hour + ":" + minute + ":" + second + timeZoneHour +":" + timeZoneMinute; - } - - this.fromRfcDateTime = function(rfcDate, useDefaultMinutes) { - var tempDate = new Date(); - if(!rfcDate || !rfcDate.split("T")[1]) { - if(useDefaultMinutes) { - tempDate.setMinutes(Math.floor(tempDate.getMinutes()/5)*5); - } else { - tempDate.setMinutes(0); - } - } else { - var tempTime = rfcDate.split("T")[1].split(":"); - // fullYear, month, date - var tempDate = new Date(); - tempDate.setHours(tempTime[0]); - tempDate.setMinutes(tempTime[1]); - } - return tempDate; - } - - this.toAmPmHour = function(hour) { - var amPmHour = hour; - var isAm = true; - if (amPmHour == 0) { - amPmHour = 12; - } else if (amPmHour>12) { - amPmHour = amPmHour - 12; - isAm = false; - } else if (amPmHour == 12) { - isAm = false; - } - return [amPmHour, isAm]; - } - - this.fromAmPmHour = function(amPmHour, isAm) { - var hour = parseInt(amPmHour, 10); - if(isAm && hour == 12) { - hour = 0; - } else if (!isAm && hour<12) { - hour = hour + 12; - } - return hour; - } -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Toggler.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Toggler.js deleted file mode 100644 index 225a5fb1b..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Toggler.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.Toggler"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.event.*"); - -// clicking on this node shows/hides another widget - -dojo.widget.Toggler = function(){ - dojo.widget.DomWidget.call(this); -} - -dojo.inherits(dojo.widget.Toggler, dojo.widget.DomWidget); - -dojo.lang.extend(dojo.widget.Toggler, { - widgetType: "Toggler", - - // Associated widget - targetId: '', - - fillInTemplate: function() { - dojo.event.connect(this.domNode, "onclick", this, "onClick"); - }, - - onClick: function() { - var pane = dojo.widget.getWidgetById(this.targetId); - if ( !pane || !pane.toggle ) { return; } - pane.explodeSrc = this.domNode; - pane.doToggle(); - } -}); -dojo.widget.tags.addParseTreeHandler("dojo:toggler"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Toolbar.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Toolbar.js deleted file mode 100644 index a4ca0c0a3..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Toolbar.js +++ /dev/null @@ -1,960 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.ToolbarContainer"); -dojo.provide("dojo.widget.html.ToolbarContainer"); -dojo.provide("dojo.widget.Toolbar"); -dojo.provide("dojo.widget.html.Toolbar"); -dojo.provide("dojo.widget.ToolbarItem"); -dojo.provide("dojo.widget.html.ToolbarButtonGroup"); -dojo.provide("dojo.widget.html.ToolbarButton"); -dojo.provide("dojo.widget.html.ToolbarDialog"); -dojo.provide("dojo.widget.html.ToolbarMenu"); -dojo.provide("dojo.widget.html.ToolbarSeparator"); -dojo.provide("dojo.widget.html.ToolbarSpace"); -dojo.provide("dojo.widget.Icon"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.html"); - -/* ToolbarContainer - *******************/ -dojo.widget.html.ToolbarContainer = function() { - dojo.widget.HtmlWidget.call(this); - - this.widgetType = "ToolbarContainer"; - this.isContainer = true; - - this.templateString = '
      '; - this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/HtmlToolbar.css"); - - this.getItem = function(name) { - if(name instanceof dojo.widget.ToolbarItem) { return name; } - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - var item = child.getItem(name); - if(item) { return item; } - } - } - return null; - } - - this.getItems = function() { - var items = []; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - items = items.concat(child.getItems()); - } - } - return items; - } - - this.enable = function() { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - child.enable.apply(child, arguments); - } - } - } - - this.disable = function() { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - child.disable.apply(child, arguments); - } - } - } - - this.select = function(name) { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - child.select(arguments); - } - } - } - - this.deselect = function(name) { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - child.deselect(arguments); - } - } - } - - this.getItemsState = function() { - var values = {}; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - dojo.lang.mixin(values, child.getItemsState()); - } - } - return values; - } - - this.getItemsActiveState = function() { - var values = {}; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - dojo.lang.mixin(values, child.getItemsActiveState()); - } - } - return values; - } - - this.getItemsSelectedState = function() { - var values = {}; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.html.Toolbar) { - dojo.lang.mixin(values, child.getItemsSelectedState()); - } - } - return values; - } -} -dojo.inherits(dojo.widget.html.ToolbarContainer, dojo.widget.HtmlWidget); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarContainer"); - -/* Toolbar - **********/ -dojo.widget.html.Toolbar = function() { - dojo.widget.HtmlWidget.call(this); - - this.widgetType = "Toolbar"; - this.isContainer = true; - - this.templateString = '
      '; - //this.templateString = '
      '; - - // given a node, tries to find it's toolbar item - this._getItem = function(node) { - var start = new Date(); - var widget = null; - while(node && node != this.domNode) { - if(dojo.html.hasClass(node, "toolbarItem")) { - var widgets = dojo.widget.manager.getWidgetsByFilter(function(w) { return w.domNode == node; }); - if(widgets.length == 1) { - widget = widgets[0]; - break; - } else if(widgets.length > 1) { - dojo.raise("Toolbar._getItem: More than one widget matches the node"); - } - } - node = node.parentNode; - } - return widget; - } - - this._onmouseover = function(e) { - var widget = this._getItem(e.target); - if(widget && widget._onmouseover) { widget._onmouseover(e); } - } - - this._onmouseout = function(e) { - var widget = this._getItem(e.target); - if(widget && widget._onmouseout) { widget._onmouseout(e); } - } - - this._onclick = function(e) { - var widget = this._getItem(e.target); - if(widget && widget._onclick){ - widget._onclick(e); - } - } - - this._onmousedown = function(e) { - var widget = this._getItem(e.target); - if(widget && widget._onmousedown) { widget._onmousedown(e); } - } - - this._onmouseup = function(e) { - var widget = this._getItem(e.target); - if(widget && widget._onmouseup) { widget._onmouseup(e); } - } - - var oldAddChild = this.addChild; - this.addChild = function(item, pos, props) { - var widget = dojo.widget.ToolbarItem.make(item, null, props); - var ret = oldAddChild.call(this, widget, null, pos, null); - return ret; - } - - this.push = function() { - for(var i = 0; i < arguments.length; i++) { - this.addChild(arguments[i]); - } - } - - this.getItem = function(name) { - if(name instanceof dojo.widget.ToolbarItem) { return name; } - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem - && child._name == name) { return child; } - } - return null; - } - - this.getItems = function() { - var items = []; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem) { - items.push(child); - } - } - return items; - } - - this.getItemsState = function() { - var values = {}; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem) { - values[child._name] = { - selected: child._selected, - enabled: child._enabled - }; - } - } - return values; - } - - this.getItemsActiveState = function() { - var values = this.getItemsState(); - for(var item in values) { - values[item] = values[item].enabled; - } - return values; - } - - this.getItemsSelectedState = function() { - var values = this.getItemsState(); - for(var item in values) { - values[item] = values[item].selected; - } - return values; - } - - this.enable = function() { - var items = arguments.length ? arguments : this.children; - for(var i = 0; i < items.length; i++) { - var child = this.getItem(items[i]); - if(child instanceof dojo.widget.ToolbarItem) { - child.enable(false, true); - } - } - } - - this.disable = function() { - var items = arguments.length ? arguments : this.children; - for(var i = 0; i < items.length; i++) { - var child = this.getItem(items[i]); - if(child instanceof dojo.widget.ToolbarItem) { - child.disable(); - } - } - } - - this.select = function() { - for(var i = 0; i < arguments.length; i++) { - var name = arguments[i]; - var item = this.getItem(name); - if(item) { item.select(); } - } - } - - this.deselect = function() { - for(var i = 0; i < arguments.length; i++) { - var name = arguments[i]; - var item = this.getItem(name); - if(item) { item.disable(); } - } - } - - this.setValue = function() { - for(var i = 0; i < arguments.length; i += 2) { - var name = arguments[i], value = arguments[i+1]; - var item = this.getItem(name); - if(item) { - if(item instanceof dojo.widget.ToolbarItem) { - item.setValue(value); - } - } - } - } -} -dojo.inherits(dojo.widget.html.Toolbar, dojo.widget.HtmlWidget); -dojo.widget.tags.addParseTreeHandler("dojo:toolbar"); - -/* ToolbarItem hierarchy: - - ToolbarItem - - ToolbarButton - - ToolbarDialog - - ToolbarMenu - - ToolbarSeparator - - ToolbarSpace - - ToolbarFlexibleSpace -*/ - - -/* ToolbarItem - **************/ -dojo.widget.ToolbarItem = function() { - dojo.widget.HtmlWidget.call(this); -} -dojo.inherits(dojo.widget.ToolbarItem, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.ToolbarItem, { - templateString: '', - - _name: null, - getName: function() { return this._name; }, - setName: function(value) { return this._name = value; }, - getValue: function() { return this.getName(); }, - setValue: function(value) { return this.setName(value); }, - - _selected: false, - isSelected: function() { return this._selected; }, - setSelected: function(is, force, preventEvent) { - if(!this._toggleItem && !force) { return; } - is = Boolean(is); - if(force || this._enabled && this._selected != is) { - this._selected = is; - this.update(); - if(!preventEvent) { - this._fireEvent(is ? "onSelect" : "onDeselect"); - this._fireEvent("onChangeSelect"); - } - } - }, - select: function(force, preventEvent) { - return this.setSelected(true, force, preventEvent); - }, - deselect: function(force, preventEvent) { - return this.setSelected(false, force, preventEvent); - }, - - _toggleItem: false, - isToggleItem: function() { return this._toggleItem; }, - setToggleItem: function(value) { this._toggleItem = Boolean(value); }, - - toggleSelected: function(force) { - return this.setSelected(!this._selected, force); - }, - - _enabled: true, - isEnabled: function() { return this._enabled; }, - setEnabled: function(is, force, preventEvent) { - is = Boolean(is); - if(force || this._enabled != is) { - this._enabled = is; - this.update(); - if(!preventEvent) { - this._fireEvent(this._enabled ? "onEnable" : "onDisable"); - this._fireEvent("onChangeEnabled"); - } - } - return this._enabled; - }, - enable: function(force, preventEvent) { - return this.setEnabled(true, force, preventEvent); - }, - disable: function(force, preventEvent) { - return this.setEnabled(false, force, preventEvent); - }, - toggleEnabled: function(force, preventEvent) { - return this.setEnabled(!this._enabled, force, preventEvent); - }, - - _icon: null, - getIcon: function() { return this._icon; }, - setIcon: function(value) { - var icon = dojo.widget.Icon.make(value); - if(this._icon) { - this._icon.setIcon(icon); - } else { - this._icon = icon; - } - var iconNode = this._icon.getNode(); - if(iconNode.parentNode != this.domNode) { - if(this.domNode.hasChildNodes()) { - this.domNode.insertBefore(iconNode, this.domNode.firstChild); - } else { - this.domNode.appendChild(iconNode); - } - } - return this._icon; - }, - - // TODO: update the label node (this.labelNode?) - _label: "", - getLabel: function() { return this._label; }, - setLabel: function(value) { - var ret = this._label = value; - if(!this.labelNode) { - this.labelNode = document.createElement("span"); - this.domNode.appendChild(this.labelNode); - } - this.labelNode.innerHTML = ""; - this.labelNode.appendChild(document.createTextNode(this._label)); - this.update(); - return ret; - }, - - // fired from: setSelected, setEnabled, setLabel - update: function() { - if(this._enabled) { - dojo.html.removeClass(this.domNode, "disabled"); - if(this._selected) { - dojo.html.addClass(this.domNode, "selected"); - } else { - dojo.html.removeClass(this.domNode, "selected"); - } - } else { - this._selected = false; - dojo.html.addClass(this.domNode, "disabled"); - dojo.html.removeClass(this.domNode, "down"); - dojo.html.removeClass(this.domNode, "hover"); - } - this._updateIcon(); - }, - - _updateIcon: function() { - if(this._icon) { - if(this._enabled) { - if(this._cssHover) { - this._icon.hover(); - } else if(this._selected) { - this._icon.select(); - } else { - this._icon.enable(); - } - } else { - this._icon.disable(); - } - } - }, - - _fireEvent: function(evt) { - if(typeof this[evt] == "function") { - var args = [this]; - for(var i = 1; i < arguments.length; i++) { - args.push(arguments[i]); - } - this[evt].apply(this, args); - } - }, - - _onmouseover: function(e) { - if(!this._enabled) { return }; - dojo.html.addClass(this.domNode, "hover"); - }, - - _onmouseout: function(e) { - dojo.html.removeClass(this.domNode, "hover"); - dojo.html.removeClass(this.domNode, "down"); - if(!this._selected) { - dojo.html.removeClass(this.domNode, "selected"); - } - }, - - _onclick: function(e) { - // FIXME: buttons never seem to have this._enabled set to true on Opera 9 - // dojo.debug("widget:", this.widgetType, ":", this.getName(), ", enabled:", this._enabled); - if(this._enabled && !this._toggleItem) { - this._fireEvent("onClick"); - } - }, - - _onmousedown: function(e) { - if(e.preventDefault) { e.preventDefault(); } - if(!this._enabled) { return }; - dojo.html.addClass(this.domNode, "down"); - if(this._toggleItem) { - if(this.parent.preventDeselect && this._selected) { - return; - } - this.toggleSelected(); - } - }, - - _onmouseup: function(e) { - dojo.html.removeClass(this.domNode, "down"); - }, - - fillInTemplate: function(args, frag) { - if(args.name) { this._name = args.name; } - if(args.selected) { this.select(); } - if(args.disabled) { this.disable(); } - if(args.label) { this.setLabel(args.label); } - if(args.icon) { this.setIcon(args.icon); } - if(args.toggleitem||args.toggleItem) { this.setToggleItem(true); } - } -}); - -dojo.widget.ToolbarItem.make = function(wh, whIsType, props) { - var item = null; - - if(wh instanceof Array) { - item = dojo.widget.createWidget("ToolbarButtonGroup", props); - item.setName(wh[0]); - for(var i = 1; i < wh.length; i++) { - item.addChild(wh[i]); - } - } else if(wh instanceof dojo.widget.ToolbarItem) { - item = wh; - } else if(wh instanceof dojo.uri.Uri) { - item = dojo.widget.createWidget("ToolbarButton", - dojo.lang.mixin(props||{}, {icon: new dojo.widget.Icon(wh.toString())})); - } else if(whIsType) { - item = dojo.widget.createWidget(wh, props) - } else if(typeof wh == "string" || wh instanceof String) { - switch(wh.charAt(0)) { - case "|": - case "-": - case "/": - item = dojo.widget.createWidget("ToolbarSeparator", props); - break; - case " ": - if(wh.length == 1) { - item = dojo.widget.createWidget("ToolbarSpace", props); - } else { - item = dojo.widget.createWidget("ToolbarFlexibleSpace", props); - } - break; - default: - if(/\.(gif|jpg|jpeg|png)$/i.test(wh)) { - item = dojo.widget.createWidget("ToolbarButton", - dojo.lang.mixin(props||{}, {icon: new dojo.widget.Icon(wh.toString())})); - } else { - item = dojo.widget.createWidget("ToolbarButton", - dojo.lang.mixin(props||{}, {label: wh.toString()})); - } - } - } else if(wh && wh.tagName && /^img$/i.test(wh.tagName)) { - item = dojo.widget.createWidget("ToolbarButton", - dojo.lang.mixin(props||{}, {icon: wh})); - } else { - item = dojo.widget.createWidget("ToolbarButton", - dojo.lang.mixin(props||{}, {label: wh.toString()})); - } - return item; -} - -/* ToolbarButtonGroup - *********************/ -dojo.widget.html.ToolbarButtonGroup = function() { - dojo.widget.ToolbarItem.call(this); - - this.widgetType = "ToolbarButtonGroup"; - this.isContainer = true; - - this.templateString = ''; - - // if a button has the same name, it will be selected - // if this is set to a number, the button at that index will be selected - this.defaultButton = ""; - - var oldAddChild = this.addChild; - this.addChild = function(item, pos, props) { - var widget = dojo.widget.ToolbarItem.make(item, null, dojo.lang.mixin(props||{}, {toggleItem:true})); - dojo.event.connect(widget, "onSelect", this, "onChildSelected"); - var ret = oldAddChild.call(this, widget, null, pos, null); - if(widget._name == this.defaultButton - || (typeof this.defaultButton == "number" - && this.children.length-1 == this.defaultButton)) { - widget.select(false, true); - } - return ret; - } - - this.getItem = function(name) { - if(name instanceof dojo.widget.ToolbarItem) { return name; } - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem - && child._name == name) { return child; } - } - return null; - } - - this.getItems = function() { - var items = []; - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem) { - items.push(child); - } - } - return items; - } - - this.onChildSelected = function(e) { - this.select(e._name); - } - - this.enable = function(force, preventEvent) { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem) { - child.enable(force, preventEvent); - if(child._name == this._value) { - child.select(force, preventEvent); - } - } - } - } - - this.disable = function(force, preventEvent) { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem) { - child.disable(force, preventEvent); - } - } - } - - this._value = ""; - this.getValue = function() { return this._value; } - - this.select = function(name, force, preventEvent) { - for(var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if(child instanceof dojo.widget.ToolbarItem) { - if(child._name == name) { - child.select(force, preventEvent); - this._value = name; - } else { - child.deselect(true, preventEvent); - } - } - } - if(!preventEvent) { - this._fireEvent("onSelect", this._value); - this._fireEvent("onChangeSelect", this._value); - } - } - this.setValue = this.select; - - this.preventDeselect = false; // if true, once you select one, you can't have none selected -} -dojo.inherits(dojo.widget.html.ToolbarButtonGroup, dojo.widget.ToolbarItem); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarButtonGroup"); - -/* ToolbarButton - ***********************/ -dojo.widget.html.ToolbarButton = function() { - dojo.widget.ToolbarItem.call(this); -} -dojo.inherits(dojo.widget.html.ToolbarButton, dojo.widget.ToolbarItem); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarButton"); - -dojo.lang.extend(dojo.widget.html.ToolbarButton, { - widgetType: "ToolbarButton", - - fillInTemplate: function(args, frag) { - dojo.widget.html.ToolbarButton.superclass.fillInTemplate.call(this, args, frag); - dojo.html.addClass(this.domNode, "toolbarButton"); - if(this._icon) { - this.setIcon(this._icon); - } - if(this._label) { - this.setLabel(this._label); - } - - if(!this._name) { - if(this._label) { - this.setName(this._label); - } else if(this._icon) { - var src = this._icon.getSrc("enabled").match(/[\/^]([^\.\/]+)\.(gif|jpg|jpeg|png)$/i); - if(src) { this.setName(src[1]); } - } else { - this._name = this._widgetId; - } - } - } -}); - -/* ToolbarDialog - **********************/ -dojo.widget.html.ToolbarDialog = function() { - dojo.widget.html.ToolbarButton.call(this); -} -dojo.inherits(dojo.widget.html.ToolbarDialog, dojo.widget.html.ToolbarButton); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarDialog"); - -dojo.lang.extend(dojo.widget.html.ToolbarDialog, { - widgetType: "ToolbarDialog", - - fillInTemplate: function (args, frag) { - dojo.widget.html.ToolbarDialog.superclass.fillInTemplate.call(this, args, frag); - dojo.event.connect(this, "onSelect", this, "showDialog"); - dojo.event.connect(this, "onDeselect", this, "hideDialog"); - }, - - showDialog: function (e) { - dojo.lang.setTimeout(dojo.event.connect, 1, document, "onmousedown", this, "deselect"); - }, - - hideDialog: function (e) { - dojo.event.disconnect(document, "onmousedown", this, "deselect"); - } - -}); - -/* ToolbarMenu - **********************/ -dojo.widget.html.ToolbarMenu = function() { - dojo.widget.html.ToolbarDialog.call(this); - - this.widgetType = "ToolbarMenu"; -} -dojo.inherits(dojo.widget.html.ToolbarMenu, dojo.widget.html.ToolbarDialog); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarMenu"); - -/* ToolbarMenuItem - ******************/ -dojo.widget.ToolbarMenuItem = function() { -} - -/* ToolbarSeparator - **********************/ -dojo.widget.html.ToolbarSeparator = function() { - dojo.widget.ToolbarItem.call(this); - - this.widgetType = "ToolbarSeparator"; - this.templateString = ''; - - this.defaultIconPath = new dojo.uri.dojoUri("src/widget/templates/buttons/-.gif"); - - var oldFillInTemplate = this.fillInTemplate; - this.fillInTemplate = function(args, frag, skip) { - oldFillInTemplate.call(this, args, frag); - this._name = this.widgetId; - if(!skip) { - if(!this._icon) { - this.setIcon(this.defaultIconPath); - } - this.domNode.appendChild(this._icon.getNode()); - } - } - - // don't want events! - this._onmouseover = this._onmouseout = this._onclick - = this._onmousedown = this._onmouseup = null; -} -dojo.inherits(dojo.widget.html.ToolbarSeparator, dojo.widget.ToolbarItem); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarSeparator"); - -/* ToolbarSpace - **********************/ -dojo.widget.html.ToolbarSpace = function() { - dojo.widget.html.ToolbarSeparator.call(this); - - this.widgetType = "ToolbarSpace"; - - var oldFillInTemplate = this.fillInTemplate; - this.fillInTemplate = function(args, frag, skip) { - oldFillInTemplate.call(this, args, frag, true); - if(!skip) { - dojo.html.addClass(this.domNode, "toolbarSpace"); - } - } -} -dojo.inherits(dojo.widget.html.ToolbarSpace, dojo.widget.html.ToolbarSeparator); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarSpace"); - -/* ToolbarSelect - ******************/ - -/*dojo.widget.html.ToolbarSelect = function() { - dojo.widget.html.ToolbarDialog.call(this); - - // fix inheritence chain - for (var method in this.constructor.prototype) { - this[method] = this.constructor.prototype[method]; - } -} -dojo.inherits(dojo.widget.html.ToolbarSelect, dojo.widget.html.ToolbarDialog); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarSelect"); - -dojo.lang.extend(dojo.widget.html.ToolbarSelect, { - widgetType: "ToolbarSelect", - - fillInTemplate: function (args, frag) { - dojo.widget.html.ToolbarSelect.superclass.fillInTemplate.call(this, args, frag); - - this.dialog = document.createElement("ul"); - for(var value in args.values) { - var li = document.createElement("li"); - li.value = args.values[value]; - li.appendChild(document.createTextNode(value)); - this.dialog.appendChild(li); - } - }, - - showDialog: function (e) { - dojo.widget.html.ToolbarSelect.superclass.showDialog.call(this, e); - with (dojo.html) { - var x = getAbsoluteX(this.domNode); - var y = getAbsoluteY(this.domNode) + getInnerHeight(this.domNode); - } - with (this.domNode.style) { top = y + "px"; left = x + "px"; } - dojo.html.body().appendChild(this.dialog); - }, - - hideDialog: function (e) { - dojo.widget.html.ToolbarSelect.superclass.hideDialog.call(this, e); - this.dialog.parentNode.removeChild(this.dialog); - } - -});*/ - -dojo.widget.html.ToolbarSelect = function() { - dojo.widget.ToolbarItem.call(this); - this.widgetType = "ToolbarSelect"; - this.templateString = ''; - - var oldFillInTemplate = this.fillInTemplate; - this.fillInTemplate = function(args, frag) { - oldFillInTemplate.call(this, args, frag, true); - var keys = args.values; - var i = 0; - for(var val in keys) { - var opt = document.createElement("option"); - opt.setAttribute("value", keys[val]); - opt.innerHTML = val; - this.selectBox.appendChild(opt); - } - } - - this.changed = function(e) { - this._fireEvent("onSetValue", this.selectBox.value); - } - - var oldSetEnabled = this.setEnabled; - this.setEnabled = function(is, force, preventEvent) { - var ret = oldSetEnabled.call(this, is, force, preventEvent); - this.selectBox.disabled = !this._enabled; - return ret; - } - - // don't want events! - this._onmouseover = this._onmouseout = this._onclick - = this._onmousedown = this._onmouseup = null; -} -dojo.inherits(dojo.widget.html.ToolbarSelect, dojo.widget.ToolbarItem); -dojo.widget.tags.addParseTreeHandler("dojo:toolbarSelect"); - -/* Icon - *********/ -// arguments can be IMG nodes, Image() instances or URLs -- enabled is the only one required -dojo.widget.Icon = function(enabled, disabled, hover, selected) { - if(arguments.length == 0) { - throw new Error("Icon must have at least an enabled state"); - } - var states = ["enabled", "disabled", "hover", "selected"]; - var currentState = "enabled"; - var domNode = document.createElement("img"); - - this.getState = function() { return currentState; } - this.setState = function(value) { - if(dojo.lang.inArray(value, states)) { - if(this[value]) { - currentState = value; - domNode.setAttribute("src", this[currentState].src); - } - } else { - throw new Error("Invalid state set on Icon (state: " + value + ")"); - } - } - - this.setSrc = function(state, value) { - if(/^img$/i.test(value.tagName)) { - this[state] = value; - } else if(typeof value == "string" || value instanceof String - || value instanceof dojo.uri.Uri) { - this[state] = new Image(); - this[state].src = value.toString(); - } - return this[state]; - } - - this.setIcon = function(icon) { - for(var i = 0; i < states.length; i++) { - if(icon[states[i]]) { - this.setSrc(states[i], icon[states[i]]); - } - } - this.update(); - } - - this.enable = function() { this.setState("enabled"); } - this.disable = function() { this.setState("disabled"); } - this.hover = function() { this.setState("hover"); } - this.select = function() { this.setState("selected"); } - - this.getSize = function() { - return { - width: domNode.width||domNode.offsetWidth, - height: domNode.height||domNode.offsetHeight - }; - } - - this.setSize = function(w, h) { - domNode.width = w; - domNode.height = h; - return { width: w, height: h }; - } - - this.getNode = function() { - return domNode; - } - - this.getSrc = function(state) { - if(state) { return this[state].src; } - return domNode.src||""; - } - - this.update = function() { - this.setState(currentState); - } - - for(var i = 0; i < states.length; i++) { - var arg = arguments[i]; - var state = states[i]; - this[state] = null; - if(!arg) { continue; } - this.setSrc(state, arg); - } - - this.enable(); -} - -dojo.widget.Icon.make = function(a,b,c,d) { - for(var i = 0; i < arguments.length; i++) { - if(arguments[i] instanceof dojo.widget.Icon) { - return arguments[i]; - } else if(!arguments[i]) { - nullArgs++; - } - } - - return new dojo.widget.Icon(a,b,c,d); -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Tooltip.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Tooltip.js deleted file mode 100644 index af35790e0..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Tooltip.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.Tooltip"); -dojo.require("dojo.widget.Widget"); - -dojo.widget.tags.addParseTreeHandler("dojo:tooltip"); - -dojo.widget.Tooltip = function(){ - dojo.widget.Widget.call(this); - - this.widgetType = "Tooltip"; - this.isContainer = true; -} -dojo.inherits(dojo.widget.Tooltip, dojo.widget.Widget); - -dojo.requireAfterIf("html", "dojo.widget.html.Tooltip"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Tree.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Tree.js deleted file mode 100644 index d1e4cbdd0..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Tree.js +++ /dev/null @@ -1,515 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.Tree"); -dojo.provide("dojo.widget.HtmlTree"); -dojo.provide("dojo.widget.TreeNode"); -dojo.provide("dojo.widget.HtmlTreeNode"); - -dojo.require("dojo.event.*"); -dojo.require("dojo.fx.html"); -dojo.require("dojo.widget.Container"); - -// make it a tag -dojo.widget.tags.addParseTreeHandler("dojo:Tree"); -dojo.widget.tags.addParseTreeHandler("dojo:TreeNode"); - -dojo.widget.HtmlTree = function() { - dojo.widget.html.Container.call(this); -} -dojo.inherits(dojo.widget.HtmlTree, dojo.widget.html.Container); - -dojo.lang.extend(dojo.widget.HtmlTree, { - widgetType: "Tree", - - domNode: null, - - templateCssPath: dojo.uri.dojoUri("src/widget/templates/Tree.css"), - templateString: '
      ', - - selectedNode: null, - toggler: null, - - - // - // these icons control the grid and expando buttons for the whole tree - // - - blankIconSrc: dojo.uri.dojoUri("src/widget/templates/images/treenode_blank.gif").toString(), - - gridIconSrcT: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_t.gif").toString(), // for non-last child grid - gridIconSrcL: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_l.gif").toString(), // for last child grid - gridIconSrcV: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_v.gif").toString(), // vertical line - gridIconSrcP: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_p.gif").toString(), // for under parent item child icons - gridIconSrcC: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_c.gif").toString(), // for under child item child icons - gridIconSrcX: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_x.gif").toString(), // grid for sole root item - gridIconSrcY: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_y.gif").toString(), // grid for last rrot item - gridIconSrcZ: dojo.uri.dojoUri("src/widget/templates/images/treenode_grid_z.gif").toString(), // for under root parent item child icon - - expandIconSrcPlus: dojo.uri.dojoUri("src/widget/templates/images/treenode_expand_plus.gif").toString(), - expandIconSrcMinus: dojo.uri.dojoUri("src/widget/templates/images/treenode_expand_minus.gif").toString(), - - iconWidth: 18, - iconHeight: 18, - - - // - // tree options - // - - showGrid: true, - showRootGrid: true, - - toggle: "default", - toggleDuration: 150, - - - // - // subscribable events - // - - publishSelectionTopic: "", - publishExpandedTopic: "", - publishCollapsedTopic: "", - - - initialize: function(args, frag){ - switch (this.toggle) { - case "fade": this.toggler = new dojo.widget.Tree.FadeToggle(); break; - case "wipe": this.toggler = new dojo.widget.Tree.WipeToggle(); break; - default : this.toggler = new dojo.widget.Tree.DefaultToggle(); - } - }, - - postCreate: function(){ - this.buildTree(); - }, - - buildTree: function(){ - - dojo.html.disableSelection(this.domNode); - - for(var i=0; i
      ', - - childIconSrc: '', - - childIcon: null, - underChildIcon: null, - expandIcon: null, - - title: "", - - labelNode: null, // the item label - imgs: null, // an array of icons imgs - rowNode: null, // the tr - - tree: null, - parentNode: null, - depth: 0, - - isFirstNode: false, - isLastNode: false, - isExpanded: false, - isParent: false, - booted: false, - - buildNode: function(tree, depth){ - - this.tree = tree; - this.depth = depth; - - - // - // add the tree icons - // - - this.imgs = []; - - for(var i=0; i 0) ? true : false; - - this.collapse(); - - return this.domNode; - }, - - onTreeClick: function(e){ - - if (this.isExpanded){ - this.collapse(); - }else{ - this.expand(); - } - }, - - onIconClick: function(){ - this.onLabelClick(); - }, - - onLabelClick: function(){ - - if (this.tree.selectedNode == this){ - - //this.editInline(); - dojo.debug('TODO: start inline edit here!'); - return; - } - - if (this.tree.selectedNode){ this.tree.selectedNode.deselect(); } - - this.tree.selectedNode = this; - this.tree.selectedNode.select(); - }, - - select: function(){ - - dojo.html.addClass(this.labelNode, 'dojoTreeNodeLabelSelected'); - - dojo.event.topic.publish(this.tree.publishSelectionTopic, this.widgetId); - }, - - deselect: function(){ - - dojo.html.removeClass(this.labelNode, 'dojoTreeNodeLabelSelected'); - }, - - updateIcons: function(){ - - this.imgs[0].style.display = this.tree.showRootGrid ? 'inline' : 'none'; - - - // - // set the expand icon - // - - if (this.isParent){ - this.expandIcon.src = this.isExpanded ? this.tree.expandIconSrcMinus : this.tree.expandIconSrcPlus; - }else{ - this.expandIcon.src = this.tree.blankIconSrc; - } - - - // - // set the grid under the expand icon - // - - if (this.tree.showGrid){ - if (this.depth){ - - this.setGridImage(-2, this.isLastNode ? this.tree.gridIconSrcL : this.tree.gridIconSrcT); - }else{ - if (this.isFirstNode){ - this.setGridImage(-2, this.isLastNode ? this.tree.gridIconSrcX : this.tree.gridIconSrcY); - }else{ - this.setGridImage(-2, this.isLastNode ? this.tree.gridIconSrcL : this.tree.gridIconSrcT); - } - } - }else{ - this.setGridImage(-2, this.tree.blankIconSrc); - } - - - // - // set the child icon - // - - if (this.childIconSrc){ - this.childIcon.style.display = 'inline'; - this.childIcon.src = this.childIconSrc; - }else{ - this.childIcon.style.display = 'none'; - } - - - // - // set the grid under the child icon - // - - if ((this.depth || this.tree.showRootGrid) && this.tree.showGrid){ - - this.setGridImage(-1, (this.isParent && this.isExpanded) ? this.tree.gridIconSrcP : this.tree.gridIconSrcC); - }else{ - if (this.tree.showGrid && !this.tree.showRootGrid){ - - this.setGridImage(-1, (this.isParent && this.isExpanded) ? this.tree.gridIconSrcZ : this.tree.blankIconSrc); - }else{ - this.setGridImage(-1, this.tree.blankIconSrc); - } - } - - - // - // set the vertical grid icons - // - - var parent = this.parentNode; - - for(var i=0; i mixInProperties"); - this.mixInProperties(args, fragment, parentComp); - // dojo.debug(this.widgetType, "-> postMixInProperties"); - this.postMixInProperties(args, fragment, parentComp); - // dojo.debug(this.widgetType, "-> dojo.widget.manager.add"); - dojo.widget.manager.add(this); - // dojo.debug(this.widgetType, "-> buildRendering"); - this.buildRendering(args, fragment, parentComp); - // dojo.debug(this.widgetType, "-> initialize"); - this.initialize(args, fragment, parentComp); - // dojo.debug(this.widgetType, "-> postInitialize"); - this.postInitialize(args, fragment, parentComp); - // dojo.debug(this.widgetType, "-> postCreate"); - this.postCreate(args, fragment, parentComp); - // dojo.debug(this.widgetType, "done!"); - return this; - }, - - destroy: function(finalize){ - // FIXME: this is woefully incomplete - this.uninitialize(); - this.destroyRendering(finalize); - dojo.widget.manager.removeById(this.widgetId); - }, - - destroyChildren: function(testFunc){ - testFunc = (!testFunc) ? function(){ return true; } : testFunc; - for(var x=0; xsi)){ - this[x][dojo.string.trim(pairs[y].substr(0, si))] = pairs[y].substr(si+1); - } - } - }else{ - // the default is straight-up string assignment. When would - // we ever hit this? - this[x] = args[x]; - } - } - }else{ - // collect any extra 'non mixed in' args - this.extraArgs[x] = args[x]; - } - } - // dojo.profile.end("mixInProperties"); - }, - - postMixInProperties: function(){ - }, - - initialize: function(args, frag){ - // dj_unimplemented("dojo.widget.Widget.initialize"); - return false; - }, - - postInitialize: function(args, frag){ - return false; - }, - - postCreate: function(args, frag){ - return false; - }, - - uninitialize: function(){ - // dj_unimplemented("dojo.widget.Widget.uninitialize"); - return false; - }, - - buildRendering: function(){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.buildRendering, on "+this.toString()+", "); - return false; - }, - - destroyRendering: function(){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.destroyRendering"); - return false; - }, - - cleanUp: function(){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.cleanUp"); - return false; - }, - - addedTo: function(parent){ - // this is just a signal that can be caught - }, - - addChild: function(child){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.addChild"); - return false; - }, - - addChildAtIndex: function(child, index){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.addChildAtIndex"); - return false; - }, - - removeChild: function(childRef){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.removeChild"); - return false; - }, - - removeChildAtIndex: function(index){ - // SUBCLASSES MUST IMPLEMENT - dj_unimplemented("dojo.widget.Widget.removeChildAtIndex"); - return false; - }, - - resize: function(width, height){ - // both width and height may be set as percentages. The setWidth and - // setHeight functions attempt to determine if the passed param is - // specified in percentage or native units. Integers without a - // measurement are assumed to be in the native unit of measure. - this.setWidth(width); - this.setHeight(height); - }, - - setWidth: function(width){ - if((typeof width == "string")&&(width.substr(-1) == "%")){ - this.setPercentageWidth(width); - }else{ - this.setNativeWidth(width); - } - }, - - setHeight: function(height){ - if((typeof height == "string")&&(height.substr(-1) == "%")){ - this.setPercentageHeight(height); - }else{ - this.setNativeHeight(height); - } - }, - - setPercentageHeight: function(height){ - // SUBCLASSES MUST IMPLEMENT - return false; - }, - - setNativeHeight: function(height){ - // SUBCLASSES MUST IMPLEMENT - return false; - }, - - setPercentageWidth: function(width){ - // SUBCLASSES MUST IMPLEMENT - return false; - }, - - setNativeWidth: function(width){ - // SUBCLASSES MUST IMPLEMENT - return false; - }, - - getDescendants: function() { - var result = []; - var stack = [this]; - var elem; - while (elem = stack.pop()) { - result.push(elem); - dojo.lang.forEach(elem.children, function(elem) { stack.push(elem); }); - } - - return result; - } -}); - -// Lower case name cache: listing of the lower case elements in each widget. -// We can't store the lcArgs in the widget itself because if B subclasses A, -// then B.prototype.lcArgs might return A.prototype.lcArgs, which is not what we -// want -dojo.widget.lcArgsCache = {}; - -// TODO: should have a more general way to add tags or tag libraries? -// TODO: need a default tags class to inherit from for things like getting propertySets -// TODO: parse properties/propertySets into component attributes -// TODO: parse subcomponents -// TODO: copy/clone raw markup fragments/nodes as appropriate -dojo.widget.tags = {}; -dojo.widget.tags.addParseTreeHandler = function(type){ - var ltype = type.toLowerCase(); - this[ltype] = function(fragment, widgetParser, parentComp, insertionIndex, localProps){ - return dojo.widget.buildWidgetFromParseTree(ltype, fragment, widgetParser, parentComp, insertionIndex, localProps); - } -} -dojo.widget.tags.addParseTreeHandler("dojo:widget"); - -dojo.widget.tags["dojo:propertyset"] = function(fragment, widgetParser, parentComp){ - // FIXME: Is this needed? - // FIXME: Not sure that this parses into the structure that I want it to parse into... - // FIXME: add support for nested propertySets - var properties = widgetParser.parseProperties(fragment["dojo:propertyset"]); -} - -// FIXME: need to add the -dojo.widget.tags["dojo:connect"] = function(fragment, widgetParser, parentComp){ - var properties = widgetParser.parseProperties(fragment["dojo:connect"]); -} - -dojo.widget.buildWidgetFromParseTree = function(type, frag, - parser, parentComp, - insertionIndex, localProps){ - var stype = type.split(":"); - stype = (stype.length == 2) ? stype[1] : type; - // FIXME: we don't seem to be doing anything with this! - // var propertySets = parser.getPropertySets(frag); - var localProperties = localProps || parser.parseProperties(frag["dojo:"+stype]); - // var tic = new Date(); - var twidget = dojo.widget.manager.getImplementation(stype); - if(!twidget){ - throw new Error("cannot find \"" + stype + "\" widget"); - }else if (!twidget.create){ - throw new Error("\"" + stype + "\" widget object does not appear to implement *Widget"); - } - localProperties["dojoinsertionindex"] = insertionIndex; - // FIXME: we loose no less than 5ms in construction! - var ret = twidget.create(localProperties, frag, parentComp); - // dojo.debug(new Date() - tic); - return ret; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Wizard.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Wizard.js deleted file mode 100644 index 0bc9697cd..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Wizard.js +++ /dev/null @@ -1,209 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.Wizard"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.LayoutPane"); -dojo.require("dojo.event.*"); -dojo.require("dojo.html"); -dojo.require("dojo.style"); - -////////////////////////////////////////// -// Wizard -- a set of panels -////////////////////////////////////////// -dojo.widget.Wizard = function() { - dojo.widget.html.LayoutPane.call(this); -} -dojo.inherits(dojo.widget.Wizard, dojo.widget.html.LayoutPane); - -dojo.lang.extend(dojo.widget.Wizard, { - - widgetType: "Wizard", - - labelPosition: "top", - - templatePath: dojo.uri.dojoUri("src/widget/templates/Wizard.html"), - templateCssPath: dojo.uri.dojoUri("src/widget/templates/Wizard.css"), - - selected: null, // currently selected panel - wizardNode: null, // the outer wizard node - wizardPanelContainerNode: null, // the container for the panels - wizardControlContainerNode: null, // the container for the wizard controls - previousButton: null, // the previous button - nextButton: null, // the next button - cancelButton: null, // the cancel button - doneButton: null, // the done button - nextButtonLabel: "next", - previousButtonLabel: "previous", - cancelButtonLabel: "cancel", - doneButtonLabel: "done", - cancelFunction : "", - - hideDisabledButtons: false, - - fillInTemplate: function(args, frag){ - dojo.event.connect(this.nextButton, "onclick", this, "nextPanel"); - dojo.event.connect(this.previousButton, "onclick", this, "previousPanel"); - if (this.cancelFunction){ - dojo.event.connect(this.cancelButton, "onclick", this.cancelFunction); - }else{ - this.cancelButton.style.display = "none"; - } - dojo.event.connect(this.doneButton, "onclick", this, "done"); - this.nextButton.value = this.nextButtonLabel; - this.previousButton.value = this.previousButtonLabel; - this.cancelButton.value = this.cancelButtonLabel; - this.doneButton.value = this.doneButtonLabel; - }, - - checkButtons: function(){ - var lastStep = !this.hasNextPanel(); - this.nextButton.disabled = lastStep; - this.setButtonClass(this.nextButton); - if(this.selected.doneFunction){ - this.doneButton.style.display = ""; - // hide the next button if this is the last one and we have a done function - if(lastStep){ - this.nextButton.style.display = "none"; - } - }else{ - this.doneButton.style.display = "none"; - } - this.previousButton.disabled = ((!this.hasPreviousPanel()) || (!this.selected.canGoBack)); - this.setButtonClass(this.previousButton); - }, - - setButtonClass: function(button){ - if(!this.hideDisabledButtons){ - button.style.display = ""; - dojo.html.setClass(button, button.disabled ? "WizardButtonDisabled" : "WizardButton"); - }else{ - button.style.display = button.disabled ? "none" : ""; - } - }, - - registerChild: function(panel, insertionIndex){ - dojo.widget.Wizard.superclass.registerChild.call(this, panel, insertionIndex); - this.wizardPanelContainerNode.appendChild(panel.domNode); - panel.hide(); - - if(!this.selected){ - this.onSelected(panel); - } - this.checkButtons(); - }, - - onSelected: function(panel){ - // Deselect old panel and select new one - if(this.selected ){ - if (this.selected.checkPass()) { - this.selected.hide(); - } else { - return; - } - } - panel.show(); - this.selected = panel; - }, - - getPanels: function() { - return this.getChildrenOfType("WizardPane", false); - }, - - selectedIndex: function() { - if (this.selected) { - return dojo.lang.indexOf(this.getPanels(), this.selected); - } - return -1; - }, - - nextPanel: function() { - var selectedIndex = this.selectedIndex(); - if ( selectedIndex > -1 ) { - var childPanels = this.getPanels(); - if (childPanels[selectedIndex + 1]) { - this.onSelected(childPanels[selectedIndex + 1]); - } - } - this.checkButtons(); - }, - - previousPanel: function() { - var selectedIndex = this.selectedIndex(); - if ( selectedIndex > -1 ) { - var childPanels = this.getPanels(); - if (childPanels[selectedIndex - 1]) { - this.onSelected(childPanels[selectedIndex - 1]); - } - } - this.checkButtons(); - }, - - hasNextPanel: function() { - var selectedIndex = this.selectedIndex(); - return (selectedIndex < (this.getPanels().length - 1)); - }, - - hasPreviousPanel: function() { - var selectedIndex = this.selectedIndex(); - return (selectedIndex > 0); - }, - - done: function() { - this.selected.done(); - } -}); -dojo.widget.tags.addParseTreeHandler("dojo:Wizard"); - -////////////////////////////////////////// -// WizardPane -- a panel in a wizard -////////////////////////////////////////// -dojo.widget.WizardPane = function() { - dojo.widget.html.LayoutPane.call(this); -} -dojo.inherits(dojo.widget.WizardPane, dojo.widget.html.LayoutPane); - -dojo.lang.extend(dojo.widget.WizardPane, { - widgetType: "WizardPane", - - canGoBack: true, - - passFunction: "", - doneFunction: "", - - fillInTemplate: function(args, frag) { - if (this.passFunction) { - this.passFunction = dj_global[this.passFunction]; - } - if (this.doneFunction) { - this.doneFunction = dj_global[this.doneFunction]; - } - }, - - checkPass: function() { - if (this.passFunction && dojo.lang.isFunction(this.passFunction)) { - var failMessage = this.passFunction(); - if (failMessage) { - alert(failMessage); - return false; - } - } - return true; - }, - - done: function() { - if (this.doneFunction && dojo.lang.isFunction(this.doneFunction)) { - this.doneFunction(); - } - } -}); - -dojo.widget.tags.addParseTreeHandler("dojo:WizardPane"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/__package__.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/__package__.js deleted file mode 100644 index 37daeeb72..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/__package__.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.hostenv.conditionalLoadModule({ - common: ["dojo.xml.Parse", - "dojo.widget.Widget", - "dojo.widget.Parse", - "dojo.widget.Manager"], - browser: ["dojo.widget.DomWidget", - "dojo.widget.HtmlWidget"], - svg: ["dojo.widget.SvgWidget"] -}); -dojo.hostenv.moduleLoaded("dojo.widget.*"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Button.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Button.js deleted file mode 100644 index 2d82c2ab5..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Button.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.Button"); -dojo.require("dojo.widget.Button"); - -dojo.deprecated("dojo.widget.Button", "use dojo.widget.Button2", "0.4"); - -dojo.widget.html.Button = function(){ - // mix in the button properties - dojo.widget.Button.call(this); - dojo.widget.HtmlWidget.call(this); -} -dojo.inherits(dojo.widget.html.Button, dojo.widget.HtmlWidget); -dojo.lang.extend(dojo.widget.html.Button, { - - templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.html"), - templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.css"), - - label: "", - labelNode: null, - containerNode: null, - - postCreate: function(args, frag){ - this.labelNode = this.containerNode; - /* - if(this.label != "undefined"){ - this.domNode.appendChild(document.createTextNode(this.label)); - } - */ - }, - - onMouseOver: function(e){ - dojo.html.addClass(this.domNode, "dojoButtonHover"); - dojo.html.removeClass(this.domNode, "dojoButtonNoHover"); - }, - - onMouseOut: function(e){ - dojo.html.removeClass(this.domNode, "dojoButtonHover"); - dojo.html.addClass(this.domNode, "dojoButtonNoHover"); - }, - - // By default, when I am clicked, click the item (link) inside of me. - // By default, a button is a disguised link. - // Todo: support actual submit and reset buttons. - onClick: function (e) { - var child = dojo.dom.getFirstChildElement(this.domNode); - if(child){ - if(child.click){ - child.click(); - }else if(child.href){ - location.href = child.href; - } - } - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Button2.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Button2.js deleted file mode 100644 index 517f80522..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Button2.js +++ /dev/null @@ -1,280 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.Button2"); -dojo.require("dojo.lang"); -dojo.require("dojo.html"); -dojo.require("dojo.style"); - -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.Button2"); - -dojo.widget.html.Button2 = function(){ - // call superclass constructors - dojo.widget.HtmlWidget.call(this); - dojo.widget.Button2.call(this); -} -dojo.inherits(dojo.widget.html.Button2, dojo.widget.HtmlWidget); -dojo.lang.extend(dojo.widget.html.Button2, dojo.widget.Button2.prototype); -dojo.lang.extend(dojo.widget.html.Button2, { - - templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlButton2Template.html"), - templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlButton2Template.css"), - - // button images - inactiveImg: "src/widget/templates/images/pill-button-blue_benji-", - activeImg: "src/widget/templates/images/pill-button-seagreen_benji-", - pressedImg: "src/widget/templates/images/pill-button-purple_benji-", - disabledImg: "src/widget/templates/images/pill-button-gray_benji-", - width2height: 1.0/3.0, - - // attach points - containerNode: null, - leftImage: null, - centerImage: null, - rightImage: null, - - fillInTemplate: function(args, frag){ - if(this.caption != ""){ - this.containerNode.appendChild(document.createTextNode(this.caption)); - } - dojo.html.disableSelection(this.containerNode); - if ( this.disabled ) { - dojo.html.prependClass(this.domNode, "dojoButtonDisabled"); - } - - // after the browser has had a little time to calculate the size needed - // for the button contents, size the button - dojo.lang.setTimeout(this, this.sizeMyself, 0); - }, - - onResized: function(){ - this.sizeMyself(); - }, - - sizeMyself: function(e){ - this.height = dojo.style.getOuterHeight(this.containerNode); - this.containerWidth = dojo.style.getOuterWidth(this.containerNode); - var endWidth= this.height * this.width2height; - - this.containerNode.style.left=endWidth+"px"; - - this.leftImage.height = this.rightImage.height = this.centerImage.height = this.height; - this.leftImage.width = this.rightImage.width = endWidth+1; - this.centerImage.width = this.containerWidth; - this.centerImage.style.left=endWidth+"px"; - this._setImage(this.disabled ? this.disabledImg : this.inactiveImg); - - this.domNode.style.height=this.height + "px"; - this.domNode.style.width= (this.containerWidth+2*endWidth) + "px"; - }, - - onMouseOver: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.domNode, "dojoButtonHover"); - this._setImage(this.activeImg); - }, - - onMouseDown: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.domNode, "dojoButtonDepressed"); - dojo.html.removeClass(this.domNode, "dojoButtonHover"); - this._setImage(this.pressedImg); - }, - onMouseUp: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.domNode, "dojoButtonHover"); - dojo.html.removeClass(this.domNode, "dojoButtonDepressed"); - this._setImage(this.activeImg); - }, - - onMouseOut: function(e){ - if( this.disabled ){ return; } - dojo.html.removeClass(this.domNode, "dojoButtonHover"); - this._setImage(this.inactiveImg); - }, - - buttonClick: function(e){ - if( !this.disabled && this.onClick ) { this.onClick(e); } - }, - - _setImage: function(prefix){ - this.leftImage.src=dojo.uri.dojoUri(prefix + "l.gif"); - this.centerImage.src=dojo.uri.dojoUri(prefix + "c.gif"); - this.rightImage.src=dojo.uri.dojoUri(prefix + "r.gif"); - }, - - _toggleMenu: function(menuId){ - var menu = dojo.widget.getWidgetById(menuId); - if ( !menu ) { return; } - - if ( menu.open && !menu.isShowing) { - var x = dojo.style.getAbsoluteX(this.domNode, true); - var y = dojo.style.getAbsoluteY(this.domNode, true) + this.height; - menu.open(x, y, null, this.domNode); - } else if ( menu.close && menu.isShowing ){ - menu.close(); - } else { - menu.toggle(); - } - } -}); - -/**** DropDownButton - push the button and a menu shows up *****/ -dojo.widget.html.DropDownButton2 = function(){ - // call constructors of superclasses - dojo.widget.DropDownButton2.call(this); - dojo.widget.html.Button2.call(this); -} -dojo.inherits(dojo.widget.html.DropDownButton2, dojo.widget.html.Button2); -dojo.lang.extend(dojo.widget.html.DropDownButton2, dojo.widget.DropDownButton2.prototype); - -dojo.lang.extend(dojo.widget.html.DropDownButton2, { - - downArrow: "src/widget/templates/images/whiteDownArrow.gif", - disabledDownArrow: "src/widget/templates/images/whiteDownArrow.gif", - - fillInTemplate: function(args, frag){ - dojo.widget.html.DropDownButton2.superclass.fillInTemplate.call(this, args, frag); - - // draw the arrow - var arrow = document.createElement("img"); - arrow.src = dojo.uri.dojoUri(this.disabled ? this.disabledDownArrow : this.downArrow); - dojo.html.setClass(arrow, "downArrow"); - this.containerNode.appendChild(arrow); - }, - - onClick: function (e){ - if( this.disabled ){ return; } - this._toggleMenu(this.menuId); - } -}); - -/**** ComboButton - left side is normal button, right side shows menu *****/ -dojo.widget.html.ComboButton2 = function(){ - // call constructors of superclasses - dojo.widget.html.Button2.call(this); - dojo.widget.ComboButton2.call(this); -} -dojo.inherits(dojo.widget.html.ComboButton2, dojo.widget.html.Button2); -dojo.lang.extend(dojo.widget.html.ComboButton2, dojo.widget.ComboButton2.prototype); -dojo.lang.extend(dojo.widget.html.ComboButton2, { - - templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlComboButton2Template.html"), - - // attach points - leftPart: null, - rightPart: null, - arrowBackgroundImage: null, - - // constants - splitWidth: 1, // pixels between left&right part of button - arrowWidth: 10, // width of segment holding down arrow - - sizeMyself: function(e){ - this.height = dojo.style.getOuterHeight(this.containerNode); - this.containerWidth = dojo.style.getOuterWidth(this.containerNode); - var endWidth= this.height/3; - - // left part - this.leftImage.height = this.rightImage.height = this.centerImage.height = - this.arrowBackgroundImage.height = this.height; - this.leftImage.width = endWidth+1; - this.centerImage.width = this.containerWidth; - this.leftPart.style.height = this.height + "px"; - this.leftPart.style.width = endWidth + this.containerWidth + "px"; - this._setImageL(this.disabled ? this.disabledImg : this.inactiveImg); - - // right part - this.arrowBackgroundImage.width=this.arrowWidth; - this.rightImage.width = endWidth+1; - this.rightPart.style.height = this.height + "px"; - this.rightPart.style.width = this.arrowWidth + endWidth + "px"; - this._setImageR(this.disabled ? this.disabledImg : this.inactiveImg); - - // outer container - this.domNode.style.height=this.height + "px"; - var totalWidth = this.containerWidth+this.splitWidth+this.arrowWidth+2*endWidth; - this.domNode.style.width= totalWidth + "px"; - }, - - /** functions on left part of button**/ - leftOver: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.leftPart, "dojoButtonHover"); - this._setImageL(this.activeImg); - }, - - leftDown: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.leftPart, "dojoButtonDepressed"); - dojo.html.removeClass(this.leftPart, "dojoButtonHover"); - this._setImageL(this.pressedImg); - }, - leftUp: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.leftPart, "dojoButtonHover"); - dojo.html.removeClass(this.leftPart, "dojoButtonDepressed"); - this._setImageL(this.activeImg); - }, - - leftOut: function(e){ - if( this.disabled ){ return; } - dojo.html.removeClass(this.leftPart, "dojoButtonHover"); - this._setImageL(this.inactiveImg); - }, - - leftClick: function(e){ - if ( !this.disabled && this.onClick ) { - this.onClick(e); - } - }, - - _setImageL: function(prefix){ - this.leftImage.src=dojo.uri.dojoUri(prefix + "l.gif"); - this.centerImage.src=dojo.uri.dojoUri(prefix + "c.gif"); - }, - - /*** functions on right part of button ***/ - rightOver: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.rightPart, "dojoButtonHover"); - this._setImageR(this.activeImg); - }, - - rightDown: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.rightPart, "dojoButtonDepressed"); - dojo.html.removeClass(this.rightPart, "dojoButtonHover"); - this._setImageR(this.pressedImg); - }, - rightUp: function(e){ - if( this.disabled ){ return; } - dojo.html.prependClass(this.rightPart, "dojoButtonHover"); - dojo.html.removeClass(this.rightPart, "dojoButtonDepressed"); - this._setImageR(this.activeImg); - }, - - rightOut: function(e){ - if( this.disabled ){ return; } - dojo.html.removeClass(this.rightPart, "dojoButtonHover"); - this._setImageR(this.inactiveImg); - }, - - rightClick: function(e){ - if( this.disabled ){ return; } - this._toggleMenu(this.menuId); - }, - - _setImageR: function(prefix){ - this.arrowBackgroundImage.src=dojo.uri.dojoUri(prefix + "c.gif"); - this.rightImage.src=dojo.uri.dojoUri(prefix + "r.gif"); - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Checkbox.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Checkbox.js deleted file mode 100644 index 65b5c4592..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Checkbox.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.widget.Checkbox"); -dojo.provide("dojo.widget.html.Checkbox"); - -// FIXME: the input doesn't get taken out of the tab list (i think) -// FIXME: the image doesn't get into the tab list (needs to steal the tabindex value from the input) - -dojo.widget.html.Checkbox = function(){ - dojo.widget.HtmlWidget.call(this); -} - -dojo.inherits(dojo.widget.html.Checkbox, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.Checkbox, { - widgetType: "Checkbox", - - _testImg: null, - - _events: [ - "onclick", - "onfocus", - "onblur", - "onselect", - "onchange", - "onclick", - "ondblclick", - "onmousedown", - "onmouseup", - "onmouseover", - "onmousemove", - "onmouseout", - "onkeypress", - "onkeydown", - "onkeyup" - ], - - srcOn: dojo.uri.dojoUri('src/widget/templates/check_on.gif'), - srcOff: dojo.uri.dojoUri('src/widget/templates/check_off.gif'), - - fillInTemplate: function(){ - - // FIXME: if images are disabled, we DON'T want to swap out the element - // we can use the usual 'load image to check' trick - // i don't know what image we can check yet, so we'll skip this for now... - - // this._testImg = document.createElement("img"); - // document.body.appendChild(this._testImg); - // this._testImg.src = "spacer.gif?cachebust=" + new Date().valueOf(); - // dojo.connect(this._testImg, 'onload', this, 'onImagesLoaded'); - - this.onImagesLoaded(); - }, - - onImagesLoaded: function(){ - - // FIXME: if we actually check for loading images, remove the thing here - // document.body.removeChild(this._testImg); - - // 'hide' the checkbox - this.domNode.style.position = "absolute"; - this.domNode.style.left = "-9000px"; - - // create a replacement image - this.imgNode = document.createElement("img"); - dojo.html.addClass(this.imgNode, "dojoHtmlCheckbox"); - this.updateImgSrc(); - dojo.event.connect(this.imgNode, 'onclick', this, 'onClick'); - dojo.event.connect(this.domNode, 'onchange', this, 'onChange'); - this.domNode.parentNode.insertBefore(this.imgNode, this.domNode.nextSibling) - - // real ugly - make sure the image has all the events that the checkbox did - for(var i=0; i elements - var node = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"]; - if((node)&&(node.nodeName.toLowerCase() == "select")){ - // NOTE: we're not handling here yet - var opts = node.getElementsByTagName("option"); - var ol = opts.length; - var data = []; - for(var x=0; x 0)){ - var cpos = this.getCaretPos(this.textInputNode); - // only try to extend if we added the last charachter at the end of the input - if((cpos+1) >= this.textInputNode.value.length){ - this.textInputNode.value = results[0][0]; - // build a new range that has the distance from the earlier - // caret position to the end of the first string selected - this.setSelectedRange(this.textInputNode, cpos, this.textInputNode.value.length); - } - } - - var even = true; - while(results.length){ - var tr = results.shift(); - if(tr){ - var td = document.createElement("div"); - td.appendChild(document.createTextNode(tr[0])); - td.setAttribute("resultName", tr[0]); - td.setAttribute("resultValue", tr[1]); - td.className = "cbItem "+((even) ? "cbItemEven" : "cbItemOdd"); - even = (!even); - this.optionsListNode.appendChild(td); - } - } - - dojo.event.kwConnect({ - once: true, - srcObj: dojo.html.body(), - srcFunc: "onclick", - adviceObj: this, - adviceFunc: "hideResultList" - }); - - // prevent IE bleed through - dojo.lang.setTimeout(this, "showBackgroundIframe", 100); - }, - - showBackgroundIframe: function(){ - var w = dojo.style.getOuterWidth(this.optionsListNode); - var h = dojo.style.getOuterHeight(this.optionsListNode); - if ( isNaN(w) || isNaN(h) ){ - // need more time to calculate size - dojo.lang.setTimeout(this, "showBackgroundIframe", 100); - return; - } - this.bgIframe.show([0,0,w,h]); - this.bgIframe.setZIndex(1); - }, - - selectOption: function(evt){ - if(!evt){ - evt = { target: this._highlighted_option }; - } - - if(!dojo.dom.isDescendantOf(evt.target, this.optionsListNode)){ - return; - } - - var tgt = evt.target; - while((tgt.nodeType!=1)||(!tgt.getAttribute("resultName"))){ - tgt = tgt.parentNode; - if(tgt === dojo.html.body()){ - return false; - } - } - - this.textInputNode.value = tgt.getAttribute("resultName"); - this.selectedResult = [tgt.getAttribute("resultName"), tgt.getAttribute("resultValue")]; - this.setValue(tgt.getAttribute("resultName")); - this.comboBoxSelectionValue.value = tgt.getAttribute("resultValue"); - this.hideResultList(); - }, - - clearResultList: function(){ - var oln = this.optionsListNode; - while(oln.firstChild){ - oln.removeChild(oln.firstChild); - } - }, - - hideResultList: function(){ - dojo.fx.fadeHide(this.optionsListNode, 200); - dojo.event.disconnect(dojo.html.body(), "onclick", this, "hideResultList"); - this._result_list_open = false; - this.bgIframe.hide(); - return; - }, - - showResultList: function(){ - if(this._result_list_open){ return; } - with(this.optionsListNode.style){ - display = ""; - // visibility = "hidden"; - height = ""; - width = dojo.html.getInnerWidth(this.downArrowNode)+dojo.html.getInnerWidth(this.textInputNode)+"px"; - if(dojo.render.html.khtml){ - marginTop = dojo.html.totalOffsetTop(this.optionsListNode.parentNode)+"px"; - } - } - dojo.html.setOpacity(this.optionsListNode, 0); - dojo.fx.fadeIn(this.optionsListNode, 200); - this._result_list_open = true; - }, - - handleArrowClick: function(){ - if(this._result_list_open){ - this.hideResultList(); - }else{ - this.startSearchFromInput(); - } - }, - - startSearchFromInput: function(){ - this.startSearch(this.textInputNode.value); - }, - - postCreate: function(){ - dojo.event.connect(this, "startSearch", this.dataProvider, "startSearch"); - dojo.event.connect(this.dataProvider, "provideSearchResults", this, "openResultList"); - var s = dojo.widget.html.stabile.getState(this.widgetId); - if (s) { - this.setState(s); - } - } - -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Container.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Container.js deleted file mode 100644 index 9e5a2f0f4..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Container.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.Container"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.Container"); - -dojo.widget.html.Container = function(){ - dojo.widget.HtmlWidget.call(this); -} - -dojo.inherits(dojo.widget.html.Container, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.Container, { - widgetType: "Container", - - isContainer: true, - containerNode: null, - domNode: null, - - onResized: function() { - // Clients should override this function to do special processing, - // then call this.notifyChildrenOfResize() to notify children of resize - this.notifyChildrenOfResize(); - }, - - notifyChildrenOfResize: function() { - for(var i=0; i]*>\s*([\s\S]+)\s*<\/body>/im); - if(matches) { data = matches[1]; } - } - self.setContent.call(self, data); - } else { - self.setContent.call(self, "Error loading '" + url + "' (" + e.status + " " + e.statusText + ")"); - } - } - }); - }, - - setContent: function(data){ - var node = this.containerNode || this.domNode; - node.innerHTML = data; - if(this.parseContent) { - var parser = new dojo.xml.Parse(); - var frag = parser.parseElement(node, null, true); - dojo.widget.getParser().createComponents(frag); - this.onResized(); - } - }, - - // Generate pane content from given java function - setHandler: function(handler) { - var fcn = dojo.lang.isFunction(handler) ? handler : window[handler]; - if(!dojo.lang.isFunction(fcn)) { - throw new Error("Unable to set handler, '" + handler + "' not a function."); - return; - } - this.handler = function() { - return fcn.apply(this, arguments); - } - }, - - _runHandler: function() { - if(dojo.lang.isFunction(this.handler)) { - this.handler(this, this.domNode); - return false; - } - return true; - } -}); - -dojo.widget.tags.addParseTreeHandler("dojo:ContentPane"); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/ContextMenu.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/ContextMenu.js deleted file mode 100644 index 7fc198c96..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/ContextMenu.js +++ /dev/null @@ -1,166 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.ContextMenu"); -dojo.require("dojo.html"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.ContextMenu"); -dojo.require("dojo.lang"); - -dojo.widget.html.ContextMenu = function(){ - dojo.widget.ContextMenu.call(this); - dojo.widget.HtmlWidget.call(this); - - this.isShowing = 0; - this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlContextMenuTemplate.html"); - this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/Menu.css"); - - this.targetNodeIds = []; // fill this with nodeIds upon widget creation and it only responds to those nodes - - // default event detection method - var eventType = "oncontextmenu"; - - var doc = document.documentElement || dojo.html.body(); - - var _blockHide = false; - - this.fillInTemplate = function(args, frag){ - - var func = "onOpen"; - var attached = false; - - // connect with rightclick if oncontextmenu is not around - // NOTE: It would be very nice to have a dojo.event.browser.supportsEvent here - // NOTE: Opera does not have rightclick events, it is listed here only because - // it bails out when connecting with oncontextmenu event - - if((dojo.render.html.khtml && !dojo.render.html.safari) || (dojo.render.html.opera)){ - eventType = "onmousedown"; - func = "_checkRightClick"; - } - - // attach event listeners to our selected nodes - for(var i=0; i maxX){ posX = posX - menuW; } - if (posY > maxY){ posY = posY - menuH; } - - this.domNode.style.left = posX + "px"; - this.domNode.style.top = posY + "px"; - - - // block the onclick that follows this particular right click - // not if the eventtrigger is documentElement and always when - // we use onmousedown hack - _blockHide = (evt.currentTarget!=doc || eventType=='onmousedown'); - - //return false; // we propably doesnt need to return false as we dont stop the event as we did before - } - - /* - * _canHide is meant to block the onHide call that follows the event that triggered - * onOpen. This is (hopefully) faster that event.connect and event.disconnect every - * time the code executes and it makes connecting with onmousedown event possible - * and we dont have to stop the event from bubbling further. - * - * this code is moved into a separete function because it makes it possible for the - * user to connect to a onHide event, if anyone would like that. - */ - - this._canHide = function(evt){ - // block the onclick that follows the same event that turn on contextmenu - if(_blockHide){ - // the onclick check is needed to prevent displaying multiple - // menus when we have 2 or more contextmenus loaded and are using - // the onmousedown hack - if(evt.type=='click' || eventType=='oncontextmenu'){ - _blockHide = false; - return; - }else{ - return; - } - } - - this.onHide(evt); - } - - this.onHide = function(evt){ - // FIXME: use whatever we use to do more general style setting? - this.domNode.style.display = "none"; - //dojo.event.disconnect(doc, "onclick", this, "onHide"); - this.isShowing = 0; - } - - // callback for rightclicks, needed for browsers that doesnt implement oncontextmenu, konqueror and more? - this._checkRightClick = function(evt){ - - // for some reason konq comes here even when we are not clicking on the attached nodes - // added check for targetnode - if (evt.button==2 && (this.targetNodeIds.length==0 || (evt.currentTarget.id!="" && dojo.lang.inArray(this.targetNodeIds, evt.currentTarget.id)))){ - - return this.onOpen(evt); - } - } - - dojo.event.connect(doc, "onclick", this, "_canHide"); -} - -dojo.inherits(dojo.widget.html.ContextMenu, dojo.widget.HtmlWidget); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DatePicker.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DatePicker.js deleted file mode 100644 index a80d08aa2..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DatePicker.js +++ /dev/null @@ -1,307 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.DatePicker"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.DatePicker"); -dojo.require("dojo.event.*"); -dojo.require("dojo.html"); - -/* - Some assumptions: - - I'm planning on always showing 42 days at a time, and we can scroll by week, - not just by month or year - - To get a sense of what month to highlight, I basically initialize on the - first Saturday of each month, since that will be either the first of two or - the second of three months being partially displayed, and then I work forwards - and backwards from that point. - Currently, I assume that dates are stored in the RFC 3339 format, - because I find it to be most human readable and easy to parse - http://www.faqs.org/rfcs/rfc3339.html: 2005-06-30T08:05:00-07:00 - FIXME: scroll by week not yet implemented -*/ - - -dojo.widget.html.DatePicker = function(){ - dojo.widget.DatePicker.call(this); - dojo.widget.HtmlWidget.call(this); - - var _this = this; - // today's date, JS Date object - this.today = ""; - // selected date, JS Date object - this.date = ""; - // rfc 3339 date - this.storedDate = ""; - // date currently selected in the UI, stored in year, month, date in the format that will be actually displayed - this.currentDate = {}; - // stored in year, month, date in the format that will be actually displayed - this.firstSaturday = {}; - this.classNames = { - previous: "previousMonth", - current: "currentMonth", - next: "nextMonth", - currentDate: "currentDate", - selectedDate: "selectedItem" - } - - this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlDatePicker.html"); - this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/HtmlDatePicker.css"); - - this.fillInTemplate = function(){ - this.initData(); - this.initUI(); - } - - this.initData = function() { - this.today = new Date(); - if(this.storedDate && (this.storedDate.split("-").length > 2)) { - this.date = dojo.widget.DatePicker.util.fromRfcDate(this.storedDate); - } else { - this.date = this.today; - } - // calendar math is simplified if time is set to 0 - this.today.setHours(0); - this.date.setHours(0); - var month = this.date.getMonth(); - var tempSaturday = dojo.widget.DatePicker.util.initFirstSaturday(this.date.getMonth().toString(), this.date.getFullYear()); - this.firstSaturday.year = tempSaturday.year; - this.firstSaturday.month = tempSaturday.month; - this.firstSaturday.date = tempSaturday.date; - } - - this.setDate = function(rfcDate) { - this.storedDate = rfcDate; - } - - - this.initUI = function() { - this.selectedIsUsed = false; - this.currentIsUsed = false; - var currentClassName = ""; - var previousDate = new Date(); - var calendarNodes = this.calendarDatesContainerNode.getElementsByTagName("td"); - var currentCalendarNode; - // set hours of date such that there is no chance of rounding error due to - // time change in local time zones - previousDate.setHours(8); - var nextDate = new Date(this.firstSaturday.year, this.firstSaturday.month, this.firstSaturday.date, 8); - - - if(this.firstSaturday.date < 7) { - // this means there are days to show from the previous month - var dayInWeek = 6; - for (var i=this.firstSaturday.date; i>0; i--) { - currentCalendarNode = calendarNodes.item(dayInWeek); - currentCalendarNode.innerHTML = nextDate.getDate(); - dojo.html.setClass(currentCalendarNode, this.getDateClassName(nextDate, "current")); - dayInWeek--; - previousDate = nextDate; - nextDate = this.incrementDate(nextDate, false); - } - for(var i=dayInWeek; i>-1; i--) { - currentCalendarNode = calendarNodes.item(i); - currentCalendarNode.innerHTML = nextDate.getDate(); - dojo.html.setClass(currentCalendarNode, this.getDateClassName(nextDate, "previous")); - previousDate = nextDate; - nextDate = this.incrementDate(nextDate, false); - } - } else { - nextDate.setDate(1); - for(var i=0; i<7; i++) { - currentCalendarNode = calendarNodes.item(i); - currentCalendarNode.innerHTML = i + 1; - dojo.html.setClass(currentCalendarNode, this.getDateClassName(nextDate, "current")); - previousDate = nextDate; - nextDate = this.incrementDate(nextDate, true); - } - } - previousDate.setDate(this.firstSaturday.date); - previousDate.setMonth(this.firstSaturday.month); - previousDate.setFullYear(this.firstSaturday.year); - nextDate = this.incrementDate(previousDate, true); - var count = 7; - currentCalendarNode = calendarNodes.item(count); - while((nextDate.getMonth() == previousDate.getMonth()) && (count<42)) { - currentCalendarNode.innerHTML = nextDate.getDate(); - dojo.html.setClass(currentCalendarNode, this.getDateClassName(nextDate, "current")); - currentCalendarNode = calendarNodes.item(++count); - previousDate = nextDate; - nextDate = this.incrementDate(nextDate, true); - } - - while(count < 42) { - currentCalendarNode.innerHTML = nextDate.getDate(); - dojo.html.setClass(currentCalendarNode, this.getDateClassName(nextDate, "next")); - currentCalendarNode = calendarNodes.item(++count); - previousDate = nextDate; - nextDate = this.incrementDate(nextDate, true); - } - this.setMonthLabel(this.firstSaturday.month); - this.setYearLabels(this.firstSaturday.year); - } - - this.incrementDate = function(date, bool) { - // bool: true to increase, false to decrease - var time = date.getTime(); - var increment = 1000 * 60 * 60 * 24; - time = (bool) ? (time + increment) : (time - increment); - var returnDate = new Date(); - returnDate.setTime(time); - return returnDate; - } - - this.incrementWeek = function(date, bool) { - dojo.unimplemented('dojo.widget.html.DatePicker.incrementWeek'); - } - - this.incrementMonth = function(date, bool) { - dojo.unimplemented('dojo.widget.html.DatePicker.incrementMonth'); - } - - this.incrementYear = function(date, bool) { - dojo.unimplemented('dojo.widget.html.DatePicker.incrementYear'); - } - - this.onIncrementDate = function(evt) { - dojo.unimplemented('dojo.widget.html.DatePicker.onIncrementDate'); - } - - this.onIncrementWeek = function(evt) { - // FIXME: should make a call to incrementWeek when that is implemented - evt.stopPropagation(); - dojo.unimplemented('dojo.widget.html.DatePicker.onIncrementWeek'); - switch(evt.target) { - case this.increaseWeekNode: - break; - case this.decreaseWeekNode: - break; - } - } - - this.onIncrementMonth = function(evt) { - // FIXME: should make a call to incrementMonth when that is implemented - evt.stopPropagation(); - var month = this.firstSaturday.month; - var year = this.firstSaturday.year; - switch(evt.currentTarget) { - case this.increaseMonthNode: - if(month < 11) { - month++; - } else { - month = 0; - year++; - - this.setYearLabels(year); - } - break; - case this.decreaseMonthNode: - if(month > 0) { - month--; - } else { - month = 11; - year--; - this.setYearLabels(year); - } - break; - case this.increaseMonthNode.getElementsByTagName("img").item(0): - if(month < 11) { - month++; - } else { - month = 0; - year++; - this.setYearLabels(year); - } - break; - case this.decreaseMonthNode.getElementsByTagName("img").item(0): - if(month > 0) { - month--; - } else { - month = 11; - year--; - this.setYearLabels(year); - } - break; - } - var tempSaturday = dojo.widget.DatePicker.util.initFirstSaturday(month.toString(), year); - this.firstSaturday.year = tempSaturday.year; - this.firstSaturday.month = tempSaturday.month; - this.firstSaturday.date = tempSaturday.date; - this.initUI(); - } - - this.onIncrementYear = function(evt) { - // FIXME: should make a call to incrementYear when that is implemented - evt.stopPropagation(); - var year = this.firstSaturday.year; - switch(evt.target) { - case this.nextYearLabelNode: - year++; - break; - case this.previousYearLabelNode: - year--; - break; - } - var tempSaturday = dojo.widget.DatePicker.util.initFirstSaturday(this.firstSaturday.month.toString(), year); - this.firstSaturday.year = tempSaturday.year; - this.firstSaturday.month = tempSaturday.month; - this.firstSaturday.date = tempSaturday.date; - this.initUI(); - } - - this.setMonthLabel = function(monthIndex) { - this.monthLabelNode.innerHTML = this.months[monthIndex]; - } - - this.setYearLabels = function(year) { - this.previousYearLabelNode.innerHTML = year - 1; - this.currentYearLabelNode.innerHTML = year; - this.nextYearLabelNode.innerHTML = year + 1; - } - - this.getDateClassName = function(date, monthState) { - var currentClassName = this.classNames[monthState]; - if ((!this.selectedIsUsed) && (date.getDate() == this.date.getDate()) && (date.getMonth() == this.date.getMonth()) && (date.getFullYear() == this.date.getFullYear())) { - currentClassName = this.classNames.selectedDate + " " + currentClassName; - this.selectedIsUsed = 1; - } - if((!this.currentIsUsed) && (date.getDate() == this.today.getDate()) && (date.getMonth() == this.today.getMonth()) && (date.getFullYear() == this.today.getFullYear())) { - currentClassName = currentClassName + " " + this.classNames.currentDate; - this.currentIsUsed = 1; - } - return currentClassName; - } - - this.onClick = function(evt) { - dojo.event.browser.stopEvent(evt) - } - - this.onSetDate = function(evt) { - dojo.event.browser.stopEvent(evt); - this.selectedIsUsed = 0; - this.todayIsUsed = 0; - var month = this.firstSaturday.month; - var year = this.firstSaturday.year; - if (dojo.html.hasClass(evt.target, this.classNames["next"])) { - month = ++month % 12; - // if month is now == 0, add a year - year = (month==0) ? ++year : year; - } else if (dojo.html.hasClass(evt.target, this.classNames["previous"])) { - month = --month % 12; - // if month is now == 0, add a year - year = (month==11) ? --year : year; - } - this.date = new Date(year, month, evt.target.innerHTML); - this.setDate(dojo.widget.DatePicker.util.toRfcDate(this.date)); - this.initUI(); - } -} -dojo.inherits(dojo.widget.html.DatePicker, dojo.widget.HtmlWidget); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DebugConsole.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DebugConsole.js deleted file mode 100644 index 7458654aa..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DebugConsole.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.DebugConsole"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.FloatingPane"); - -// Collection of widgets in a bar, like Windows task bar -dojo.widget.html.DebugConsole= function(){ - - dojo.widget.html.FloatingPane.call(this); - dojo.widget.DebugConsole.call(this); -} - -dojo.inherits(dojo.widget.html.DebugConsole, dojo.widget.html.FloatingPane); - -dojo.lang.extend(dojo.widget.html.DebugConsole, { - postCreate: function() { - dojo.widget.html.DebugConsole.superclass.postCreate.call(this); - this.clientPane.domNode.id = "debugConsoleClientPane" - djConfig.isDebug = true; - djConfig.debugContainerId = this.clientPane.domNode.id; - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DropdownButton.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DropdownButton.js deleted file mode 100644 index e8f779e71..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/DropdownButton.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -/* TODO: - * - make the dropdown "smart" so it can't get cutoff on bottom of page, sides of page, etc. - */ - -dojo.provide("dojo.widget.html.DropdownButton"); - -dojo.require("dojo.event.*"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.uri.Uri"); -dojo.require("dojo.dom"); -dojo.require("dojo.style"); -dojo.require("dojo.html"); - -dojo.widget.html.DropdownButton = function() { - // mix in the button properties - dojo.widget.DropdownButton.call(this); - dojo.widget.HtmlWidget.call(this); -} - -dojo.inherits(dojo.widget.html.DropdownButton, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.DropdownButton, { - - // In IE, event handlers on objects inside buttons don't work correctly, so - // we just set onClick on the button itself. - templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlDropDownButtonTemplate.html"), - templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.css"), - - // attach points - button: null, - table: null, - labelCell: null, - borderCell: null, - arrowCell: null, - arrow: null, - - fillInTemplate: function(args, frag) { - // input data (containing the anchor for the button itself, plus the - // thing to display when you push the down arrow) - var input = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"]; - - // Recursively expand widgets inside of the - var parser = new dojo.xml.Parse(); - var frag = parser.parseElement(input, null, true); - var ary = dojo.widget.getParser().createComponents(frag); - - this.a = dojo.dom.getFirstChildElement(input); // the button contents - this.menu = dojo.dom.getNextSiblingElement(this.a); // the menu under the button - - this.disabled = dojo.html.hasClass(this.a, "disabled"); - if( this.disabled ) { - dojo.html.addClass(this.button, "dojoDisabled"); - this.domNode.setAttribute("disabled", "true"); - } - - dojo.html.disableSelection(this.a); - this.a.style["text-decoration"]="none"; - this.labelCell.appendChild(this.a); - - this.arrow.src = - dojo.uri.dojoUri("src/widget/templates/images/dropdownButtonsArrow" + - (this.disabled ? "-disabled" : "") + ".gif"); - - // Attach menu to body so that it appears above other buttons - this.menu.style.position="absolute"; - this.menu.style.display="none"; - this.menu.style["z-index"] = 99; - dojo.html.body().appendChild(this.menu); - }, - - postCreate: function() { - if ( dojo.render.html.ie ) { - // Compensate for IE's weird padding of button content, which seems to be relative - // to the length of the content - var contentWidth = dojo.style.getOuterWidth(this.table); - this.labelCell.style["left"] = "-" + (contentWidth / 10) + "px"; - this.arrowCell.style["left"] = (contentWidth / 10) + "px"; - } - - // Make menu at least as wide as the button - var buttonWidth = dojo.style.getOuterWidth(this.button); - var menuWidth = dojo.style.getOuterWidth(this.menu); - if ( buttonWidth > menuWidth ) { - dojo.style.setOuterWidth(this.menu, buttonWidth); - } - }, - - // If someone clicks anywhere else on the screen (including another menu), - // then close this menu. - onCanvasMouseDown: function(e) { - if( !dojo.dom.isDescendantOf(e.target, this.button) && - !dojo.dom.isDescendantOf(e.target, this.menu) ) { - this.hideMenu(); - } - }, - - eventWasOverArrow: function(e) { - // want to use dojo.html.overElement() but also need to detect clicks - // on the area between the arrow and the edge of the button - var eventX = e.clientX; - var borderX = dojo.style.totalOffsetLeft(this.borderCell); - return (eventX > borderX ); - }, - - onMouseOver: function(e) { - dojo.html.addClass(this.button, "dojoButtonHover"); - dojo.html.removeClass(this.button, "dojoButtonNoHover"); - }, - - onMouseOut: function(e) { - dojo.html.removeClass(this.button, "dojoButtonHover"); - dojo.html.addClass(this.button, "dojoButtonNoHover"); - }, - - onClick: function(e) { - if ( this.eventWasOverArrow(e) ) { - this._onClickArrow(); - } else { - this._onClickButton(); - } - }, - - // Action when the user presses the button - _onClickButton: function(e) { - if ( this.a ) { - if ( this.a.click ) { - this.a.click(); - } else if ( this.a.href ) { - location.href = this.a.href; - } - } - }, - - // Action when user presses the arrow - _onClickArrow: function() { - if ( this.menu.style.display == "none" ) { - this.showMenu(); - } else { - this.hideMenu(); - } - }, - - showMenu: function() { - if ( this.disabled ) - return; - - // Position it accordingly, relative to screen root (since - // it's attached to document.body) - this.menu.style.left = dojo.style.totalOffsetLeft(this.button) + "px"; - this.menu.style.top = dojo.style.totalOffsetTop(this.button) + dojo.style.getOuterHeight(this.button) + "px"; - - // Display the menu; do this funky code below to stop the menu from extending - // all the way to the right edge of the screen. - // TODO: retest simple display="" to confirm that it doesn't work. - try { - this.menu.style.display="table"; // mozilla - } catch(e) { - this.menu.style.display="block"; // IE - } - - // If someone clicks somewhere else on the screen then close the menu - dojo.event.connect(document.documentElement, "onmousedown", this, "onCanvasMouseDown"); - - // When someone clicks the menu, after the menu handles the event, - // close the menu (be careful not to close the menu too early or else - // the menu will never receive the event.) - dojo.event.connect(this.menu, "onclick", this, "hideMenu"); - }, - - hideMenu: function() { - this.menu.style.display = "none"; - dojo.event.disconnect(document.documentElement, "onmousedown", this, "onCanvasMouseDown"); - dojo.event.disconnect(this.menu, "onclick", this, "hideMenu"); - } -}); - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/LayoutPane.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/LayoutPane.js deleted file mode 100644 index 21386b712..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/LayoutPane.js +++ /dev/null @@ -1,418 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.LayoutPane"); -dojo.provide("dojo.widget.html.LayoutPane"); - -// -// this widget provides Delphi-style panel layout semantics -// this is a good place to stash layout logic, then derive components from it -// -// TODO: allow more edge priority orders (e.g. t,r,l,b) -// TODO: allow percentage sizing stuff -// - -dojo.require("dojo.widget.LayoutPane"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.event.*"); -dojo.require("dojo.io.*"); -dojo.require("dojo.widget.Container"); -dojo.require("dojo.html"); -dojo.require("dojo.style"); -dojo.require("dojo.dom"); -dojo.require("dojo.string"); - - -dojo.widget.html.LayoutPane = function(){ - dojo.widget.html.Container.call(this); -} - -dojo.inherits(dojo.widget.html.LayoutPane, dojo.widget.html.Container); - -dojo.lang.extend(dojo.widget.html.LayoutPane, { - widgetType: "LayoutPane", - - isChild: false, - - clientWidth: 0, - clientHeight: 0, - - layoutChildPriority: 'top-bottom', - - cssPath: dojo.uri.dojoUri("src/widget/templates/HtmlLayoutPane.css"), - - // If this pane's content is external then set the url here - url: "inline", - extractContent: true, - parseContent: true, - cacheContent: true, - - // To generate pane content from a java function - handler: "none", - - minWidth: 0, - minHeight: 0, - - fillInTemplate: function(){ - this.filterAllowed(this, 'layoutChildPriority', ['left-right', 'top-bottom']); - - // Need to include CSS manually because there is no template file/string - dojo.style.insertCssFile(this.cssPath, null, true); - dojo.html.addClass(this.domNode, "dojoLayoutPane"); - }, - - postCreate: function(args, fragment, parentComp){ - for(var i=0; i]*>\s*([\s\S]+)\s*<\/body>/im); - if(matches) { data = matches[1]; } - } - node.innerHTML = data; - if(parse) { - var parser = new dojo.xml.Parse(); - var frag = parser.parseElement(node, null, true); - dojo.widget.getParser().createComponents(frag); - } - self.onResized(); - } else { - node.innerHTML = "Error loading '" + url + "' (" + e.status + " " + e.statusText + ")"; - } - } - }); - }, - - // Generate pane content from given java function - setHandler: function(handler) { - var fcn = dojo.lang.isFunction(handler) ? handler : window[handler]; - if(!dojo.lang.isFunction(fcn)) { - throw new Error("Unable to set handler, '" + handler + "' not a function."); - return; - } - this.handler = function() { - return fcn.apply(this, arguments); - } - }, - - _runHandler: function() { - if(dojo.lang.isFunction(this.handler)) { - dojo.deprecated("use LinkPane to download content from a java function", "0.4"); - this.handler(this, this.domNode); - return false; - } - return true; - }, - - filterAllowed: function(node, param, values){ - if ( !dojo.lang.inArray(values, node[param]) ) { - node[param] = values[0]; - } - }, - - layoutChildren: function(){ - // find the children to arrange - - var kids = {'left':[], 'right':[], 'top':[], 'bottom':[], 'client':[], 'flood':[]}; - var hits = 0; - - for(var i=0; ilabel, in which case we need to get rid of the - // because we don't want a link. - templateString: '
      ', - - fillInTemplate: function(args, frag){ - var source = this.getFragNodeRef(frag); - - // If user has specified node contents, they become the label - // (the link must be plain text) - this.label += source.innerHTML; - - // Copy style info from input node to output node - this.domNode.style.cssText = source.style.cssText; - dojo.html.addClass(this.domNode, dojo.html.getClass(source)); - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Menu.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Menu.js deleted file mode 100644 index 8f3148a94..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/Menu.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.require("dojo.widget.Menu"); -dojo.provide("dojo.widget.html.Menu"); - -/* HtmlMenu - ***********/ - -dojo.widget.html.Menu = function(){ - dojo.widget.html.Menu.superclass.constructor.call(this); - this.items = []; -} -dojo.inherits(dojo.widget.html.Menu, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.Menu, { - widgetType: "Menu", - isContainer: true, - - // copy children widgets output directly to parent (this node), to avoid - // errors trying to insert an
    • under a
      - snarfChildDomOutput: true, - - templateString: '
        ', - templateCssPath: dojo.uri.dojoUri("src/widget/templates/Menu.css"), - - fillInTemplate: function (args, frag){ - //dojo.widget.HtmlMenu.superclass.fillInTemplate.apply(this, arguments); - this.domNode.className = "dojoMenu"; - }, - - - _register: function (item ) { - dojo.event.connect(item, "onSelect", this, "onSelect"); - this.items.push(item); - }, - - push: function (item) { - this.domNode.appendChild(item.domNode); - this._register(item); - } - -}); - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/MenuItem.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/MenuItem.js deleted file mode 100644 index baff43ad2..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/MenuItem.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.MenuItem"); - -/* HtmlMenuItem - ***************/ - -dojo.widget.html.MenuItem = function(){ - dojo.widget.HtmlWidget.call(this); -} -dojo.inherits(dojo.widget.html.MenuItem, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.MenuItem, { - widgetType: "MenuItem", - templateString: '
      • ', - title: "", - - fillInTemplate: function(args, frag){ - dojo.html.disableSelection(this.domNode); - - if(!dojo.string.isBlank(this.title)){ - this.domNode.appendChild(document.createTextNode(this.title)); - }else{ - this.domNode.appendChild(frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"]); - } - }, - - onMouseOver: function(e){ - dojo.html.addClass(this.domNode, "dojoMenuItemHover"); - }, - - onMouseOut: function(e){ - dojo.html.removeClass(this.domNode, "dojoMenuItemHover"); - }, - - onClick: function(e){ this.onSelect(this, e); }, - onMouseDown: function(e){}, - onMouseUp: function(e){}, - - // By default, when I am clicked, click the item inside of me - onSelect: function (item, e) { - var child = dojo.dom.getFirstChildElement(this.domNode); - if(child){ - if(child.click){ - child.click(); - }else if(child.href){ - location.href = child.href; - } - } - } -}); - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/TaskBar.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/TaskBar.js deleted file mode 100644 index 7a7a6602f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/TaskBar.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.TaskBar"); -dojo.provide("dojo.widget.html.TaskBarItem"); - -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.FloatingPane"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.event"); - -// Icon associated w/a floating pane -dojo.widget.html.TaskBarItem = function(){ - dojo.widget.TaskBarItem.call(this); - dojo.widget.HtmlWidget.call(this); -} -dojo.inherits(dojo.widget.html.TaskBarItem, dojo.widget.HtmlWidget); - -dojo.lang.extend(dojo.widget.html.TaskBarItem, { - // constructor arguments - iconSrc: '', - caption: 'Untitled', - window: null, - templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTaskBarItemTemplate.html"), - templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTaskBar.css"), - - fillInTemplate: function() { - if ( this.iconSrc != '' ) { - var img = document.createElement("img"); - img.src = this.iconSrc; - this.domNode.appendChild(img); - } - this.domNode.appendChild(document.createTextNode(this.caption)); - dojo.html.disableSelection(this.domNode); - }, - - postCreate: function() { - this.window=dojo.widget.getWidgetById(this.windowId); - this.window.explodeSrc = this.domNode; - dojo.event.connect(this.window, "destroy", this, "destroy") - }, - - onClick: function() { - if (this.window.windowState != "minimized") { - this.window.bringToTop(); - } else { - this.window.restoreWindow(); - } - } -}); - -// Collection of widgets in a bar, like Windows task bar -dojo.widget.html.TaskBar = function(){ - - dojo.widget.html.FloatingPane.call(this); - dojo.widget.TaskBar.call(this); - this.titleBarDisplay = "none"; -} - -dojo.inherits(dojo.widget.html.TaskBar, dojo.widget.html.FloatingPane); - -dojo.lang.extend(dojo.widget.html.TaskBar, { - addChild: function(child) { - var tbi = dojo.widget.createWidget("TaskBarItem",{windowId:child.widgetId, caption: child.title, iconSrc: child.iconSrc} ); - dojo.widget.html.TaskBar.superclass.addChild.call(this,tbi); - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/TimePicker.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/TimePicker.js deleted file mode 100644 index d1b053be4..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/html/TimePicker.js +++ /dev/null @@ -1,248 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.html.TimePicker"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.TimePicker"); -dojo.require("dojo.widget.TimePicker.util"); -dojo.require("dojo.event.*"); -dojo.require("dojo.html"); - -dojo.widget.html.TimePicker = function(){ - dojo.widget.TimePicker.call(this); - dojo.widget.HtmlWidget.call(this); - - - var _this = this; - // selected time, JS Date object - this.time = ""; - // set following flag to true if a default time should be set - this.useDefaultTime = false; - // set the following to true to set default minutes to current time, false to // use zero - this.useDefaultMinutes = false; - // rfc 3339 date - this.storedTime = ""; - // time currently selected in the UI, stored in hours, minutes, seconds in the format that will be actually displayed - this.currentTime = {}; - this.classNames = { - selectedTime: "selectedItem" - } - this.any = "any" - // dom node indecies for selected hour, minute, amPm, and "any time option" - this.selectedTime = { - hour: "", - minute: "", - amPm: "", - anyTime: false - } - - // minutes are ordered as follows: ["12", "6", "1", "7", "2", "8", "3", "9", "4", "10", "5", "11"] - this.hourIndexMap = ["", 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11, 0]; - // minutes are ordered as follows: ["00", "30", "05", "35", "10", "40", "15", "45", "20", "50", "25", "55"] - this.minuteIndexMap = [0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11]; - - this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlTimePicker.html"); - this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/HtmlTimePicker.css"); - - this.fillInTemplate = function(){ - this.initData(); - this.initUI(); - } - - this.initData = function() { - // FIXME: doesn't currently validate the time before trying to set it - // Determine the date/time from stored info, or by default don't - // have a set time - // FIXME: should normalize against whitespace on storedTime... for now - // just a lame hack - if(this.storedTime.split("T")[1] && this.storedTime!=" " && this.storedTime.split("T")[1]!="any") { - this.time = dojo.widget.TimePicker.util.fromRfcDateTime(this.storedTime, this.useDefaultMinutes); - } else if (this.useDefaultTime) { - this.time = dojo.widget.TimePicker.util.fromRfcDateTime("", this.useDefaultMinutes); - } else { - this.selectedTime.anyTime = true; - } - } - - this.initUI = function() { - // set UI to match the currently selected time - if(this.time) { - var amPmHour = dojo.widget.TimePicker.util.toAmPmHour(this.time.getHours()); - var hour = amPmHour[0]; - var isAm = amPmHour[1]; - var minute = this.time.getMinutes(); - var minuteIndex = parseInt(minute/5); - this.onSetSelectedHour(this.hourIndexMap[hour]); - this.onSetSelectedMinute(this.minuteIndexMap[minuteIndex]); - this.onSetSelectedAmPm(isAm); - } else { - this.onSetSelectedAnyTime(); - } - } - - this.setDateTime = function(rfcDate) { - this.storedTime = rfcDate; - } - - this.onClearSelectedHour = function(evt) { - this.clearSelectedHour(); - } - - this.onClearSelectedMinute = function(evt) { - this.clearSelectedMinute(); - } - - this.onClearSelectedAmPm = function(evt) { - this.clearSelectedAmPm(); - } - - this.onClearSelectedAnyTime = function(evt) { - this.clearSelectedAnyTime(); - if(this.selectedTime.anyTime) { - this.selectedTime.anyTime = false; - this.time = dojo.widget.TimePicker.util.fromRfcDateTime("", this.useDefaultMinutes); - this.initUI(); - } - } - - this.clearSelectedHour = function() { - var hourNodes = this.hourContainerNode.getElementsByTagName("td"); - for (var i=0; i= depth, no display or array or object internals. - depthLimit: 2 -}; - - - - - -//// PUBLIC METHODS - -// Get the state stored for the widget with the given ID, or undefined -// if none. -// -dojo.widget.html.stabile.getState = function(id){ - dojo.widget.html.stabile.setup(); - return dojo.widget.html.stabile.widgetState[id]; -} - - -// Set the state stored for the widget with the given ID. If isCommit -// is true, commits all widget state to more stable storage. -// -dojo.widget.html.stabile.setState = function(id, state, isCommit){ - dojo.widget.html.stabile.setup(); - dojo.widget.html.stabile.widgetState[id] = state; - if(isCommit){ - dojo.widget.html.stabile.commit(dojo.widget.html.stabile.widgetState); - } -} - - -// Sets up widgetState: a hash keyed by widgetId, maps to an object -// or array writable with "describe". If there is data in the widget -// storage area, use it, otherwise initialize an empty object. -// -dojo.widget.html.stabile.setup = function(){ - if(!dojo.widget.html.stabile.widgetState){ - var text = dojo.widget.html.stabile.getStorage().value; - dojo.widget.html.stabile.widgetState = text ? dj_eval("("+text+")") : {}; - } -} - - -// Commits all widget state to more stable storage, so if the user -// navigates away and returns, it can be restored. -// -dojo.widget.html.stabile.commit = function(state){ - dojo.widget.html.stabile.getStorage().value = dojo.widget.html.stabile.description(state); -} - - -// Return a JSON "description string" for the given value. -// Supports only core JavaScript types with literals, plus Date, -// and cyclic structures are unsupported. -// showAll defaults to false -- if true, this becomes a simple symbolic -// object dumper, but you cannot "eval" the output. -// -dojo.widget.html.stabile.description = function(v, showAll){ - // Save and later restore dojo.widget.html.stabile._depth; - var depth = dojo.widget.html.stabile._depth; - - try { - - if(v===void(0)){ - return "undefined"; - } - if(v===null){ - return "null"; - } - if(typeof(v)=="boolean" || typeof(v)=="number" - || v instanceof Boolean || v instanceof Number){ - return v.toString(); - } - - if(typeof(v)=="string" || v instanceof String){ - // Quote strings and their contents as required. - // Replacing by $& fails in IE 5.0 - var v1 = v.replace(dojo.widget.html.stabile._sqQuotables, "\\$1"); - v1 = v1.replace(/\n/g, "\\n"); - v1 = v1.replace(/\r/g, "\\r"); - // Any other important special cases? - return "'"+v1+"'"; - } - - if(v instanceof Date){ - // Create a data constructor. - return "new Date("+d.getFullYear+","+d.getMonth()+","+d.getDate()+")"; - } - - var d; - if(v instanceof Array || v.push){ - // "push" test needed for KHTML/Safari, don't know why -cp - - if(depth>=dojo.widget.html.stabile.depthLimit) - return "[ ... ]"; - - d = "["; - var first = true; - dojo.widget.html.stabile._depth++; - for(var i=0; i=dojo.widget.html.stabile.depthLimit) - return "{ ... }"; - - // Instanceof Hash is good, or if we just use Objects, - // we can say v.constructor==Object. - // IE (5?) lacks hasOwnProperty, but perhaps objects do not always - // have prototypes?? - if(typeof(v.hasOwnProperty)!="function" && v.prototype){ - throw new Error("description: "+v+" not supported by script engine"); - } - var first = true; - d = "{"; - dojo.widget.html.stabile._depth++; - for(var key in v){ - // Skip values that are functions or undefined. - if(v[key]==void(0) || typeof(v[key])=="function") - continue; - if(first){ - first = false; - }else{ - d += ", "; - } - kd = key; - // If the key is not a legal identifier, use its description. - // For strings this will quote the stirng. - if(!kd.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)){ - kd = arguments.callee(key, showAll); - } - d += kd+": "+arguments.callee(v[key], showAll); - } - return d+"}"; - } - - if(showAll){ - if(dojo.widget.html.stabile._recur){ - return objectToString.apply(v, []); - }else{ - dojo.widget.html.stabile._recur = true; - return v.toString(); - } - }else{ - // log("Description? "+v.toString()+", "+typeof(v)); - throw new Error("Unknown type: "+v); - return "'unknown'"; - } - - } finally { - // Always restore the global current depth. - dojo.widget.html.stabile._depth = depth; - } - -} - - - -//// PRIVATE TO MODULE - -// Gets an object (form field) with a read/write "value" property. -// -dojo.widget.html.stabile.getStorage = function(){ - if (dojo.widget.html.stabile.dataField) { - return dojo.widget.html.stabile.dataField; - } - var form = document.forms._dojo_form; - return dojo.widget.html.stabile.dataField = form ? form.stabile : {value: ""}; -} - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/svg/Chart.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/svg/Chart.js deleted file mode 100644 index 5b9067e35..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/svg/Chart.js +++ /dev/null @@ -1,534 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.widget.svg.Chart"); - -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.Chart"); -dojo.require("dojo.math"); -dojo.require("dojo.html"); -dojo.require("dojo.svg"); -dojo.require("dojo.graphics.color"); - -dojo.widget.svg.Chart=function(){ - dojo.widget.Chart.call(this); - dojo.widget.HtmlWidget.call(this); -}; -dojo.inherits(dojo.widget.svg.Chart, dojo.widget.HtmlWidget); -dojo.lang.extend(dojo.widget.svg.Chart, { - // widget props - templatePath:null, - templateCssPath:null, - - // state - _isInitialized:false, - hasData:false, - - // chart props - vectorNode:null, - plotArea:null, - dataGroup:null, - axisGroup:null, - - properties:{ - height:400, // defaults, will resize to the domNode. - width:600, - plotType:null, - padding:{ - top:10, - bottom:2, - left:60, - right:30 - }, - axes:{ - x:{ - plotAt:0, - label:"", - unitLabel:"", - unitType:Number, - nUnitsToShow:10, - range:{ - min:0, - max:200 - } - }, - y:{ - plotAt:0, - label:"", - unitLabel:"", - unitType:Number, - nUnitsToShow:10, - range:{ - min:0, - max:200 - } - } - } - }, - - fillInTemplate:function(args,frag){ - this.parseData(); - this.initialize(); - this.render(); - }, - parseData:function(){ - }, - initialize:function(){ - // begin by grabbing the table, and reading it in. - var table=this.domNode.getElementsByTagName("table")[0]; - if (!table) return; - - var bRangeX=false; - var bRangeY=false; - - // properties off the table - if (table.getAttribute("width")) this.properties.width=table.getAttribute("width"); - if (table.getAttribute("height")) this.properties.height=table.getAttribute("height"); - if (table.getAttribute("plotType")) this.properties.plotType=table.getAttribute("plotType"); - if (table.getAttribute("padding")){ - if (table.getAttribute("padding").indexOf(",") > -1) - var p=table.getAttribute("padding").split(","); - else var p=table.getAttribute("padding").split(" "); - if (p.length==1){ - var pad=parseFloat(p[0]); - this.properties.padding.top=pad; - this.properties.padding.right=pad; - this.properties.padding.bottom=pad; - this.properties.padding.left=pad; - } else if(p.length==2){ - var padV=parseFloat(p[0]); - var padH=parseFloat(p[1]); - this.properties.padding.top=padV; - this.properties.padding.right=padH; - this.properties.padding.bottom=padV; - this.properties.padding.left=padH; - } else if(p.length==4){ - this.properties.padding.top=parseFloat(p[0]); - this.properties.padding.right=parseFloat(p[1]); - this.properties.padding.bottom=parseFloat(p[2]); - this.properties.padding.left=parseFloat(p[3]); - } - } - if (table.getAttribute("rangeX")){ - var p=table.getAttribute("rangeX"); - if (p.indexOf(",")>-1) p=p.split(","); - else p=p.split(" "); - this.properties.axes.x.range.min=parseFloat(p[0]); - this.properties.axes.x.range.max=parseFloat(p[1]); - bRangeX=true; - } - if (table.getAttribute("rangeY")){ - var p=table.getAttribute("rangeY"); - if (p.indexOf(",")>-1) p=p.split(","); - else p=p.split(" "); - this.properties.axes.y.range.min=parseFloat(p[0]); - this.properties.axes.y.range.max=parseFloat(p[1]); - bRangeY=true; - } - - var thead=table.getElementsByTagName("thead")[0]; - var tbody=table.getElementsByTagName("tbody")[0]; - if(!(thead&&tbody)) dojo.raise("dojo.widget.Chart: supplied table must define a head and a body."); - - // set up the series. - var columns=thead.getElementsByTagName("tr")[0].getElementsByTagName("th"); // should be <..> - - // assume column 0 == X - for (var i=1; i-1) p=p.split(","); - else p=p.split(" "); - - // x axis - if (!isNaN(parseFloat(p[0]))){ - this.properties.axes.x.plotAt=parseFloat(p[0]); - } else if (p[0].toLowerCase()=="ymin"){ - this.properties.axes.x.plotAt=this.properties.axes.y.range.min; - } else if (p[0].toLowerCase()=="ymax"){ - this.properties.axes.x.plotAt=this.properties.axes.y.range.max; - } - - // y axis - if (!isNaN(parseFloat(p[1]))){ - this.properties.axes.y.plotAt=parseFloat(p[1]); - } else if (p[1].toLowerCase()=="xmin"){ - this.properties.axes.y.plotAt=this.properties.axes.x.range.min; - } else if (p[1].toLowerCase()=="xmax"){ - this.properties.axes.y.plotAt=this.properties.axes.x.range.max; - } - } else { - this.properties.axes.x.plotAt=this.properties.axes.y.range.min; - this.properties.axes.y.plotAt=this.properties.axes.x.range.min; - } - - // table values should be populated, now pop it off. - this.domNode.removeChild(table); - - // get the width and the height. -// this.properties.width=dojo.html.getInnerWidth(this.domNode); -// this.properties.height=dojo.html.getInnerHeight(this.domNode); - - // ok, lets create the chart itself. - dojo.svg.g.suspend(); - if(this.vectorNode) this.destroy(); - this.vectorNode=document.createElementNS(dojo.svg.xmlns.svg, "svg"); - this.vectorNode.setAttribute("width", this.properties.width); - this.vectorNode.setAttribute("height", this.properties.height); - - // set up the clip path for the plot area. - var defs = document.createElementNS(dojo.svg.xmlns.svg, "defs"); - var clip = document.createElementNS(dojo.svg.xmlns.svg, "clipPath"); - clip.setAttribute("id","plotClip"+this.widgetId); - var rect = document.createElementNS(dojo.svg.xmlns.svg, "rect"); - rect.setAttribute("x", this.properties.padding.left); - rect.setAttribute("y", this.properties.padding.top); - rect.setAttribute("width", this.properties.width-this.properties.padding.left-this.properties.padding.right); - rect.setAttribute("height", this.properties.height-this.properties.padding.bottom-this.properties.padding.bottom); - clip.appendChild(rect); - defs.appendChild(clip); - this.vectorNode.appendChild(defs); - - // the plot background. - this.plotArea = document.createElementNS(dojo.svg.xmlns.svg, "g"); - this.vectorNode.appendChild(this.plotArea); - var rect = document.createElementNS(dojo.svg.xmlns.svg, "rect"); - rect.setAttribute("x", this.properties.padding.left); - rect.setAttribute("y", this.properties.padding.top); - rect.setAttribute("width", this.properties.width-this.properties.padding.left-this.properties.padding.right); - rect.setAttribute("height", this.properties.height-this.properties.padding.bottom-this.properties.padding.bottom); - rect.setAttribute("fill", "#fff"); - this.plotArea.appendChild(rect); - - // data group - this.dataGroup = document.createElementNS(dojo.svg.xmlns.svg, "g"); - this.dataGroup.setAttribute("style","clip-path:url(#plotClip"+this.widgetId+");"); - this.plotArea.appendChild(this.dataGroup); - - // axis group - this.axisGroup = document.createElementNS(dojo.svg.xmlns.svg, "g"); - this.plotArea.appendChild(this.axisGroup); - - // x axis - var stroke=1; - var line = document.createElementNS(dojo.svg.xmlns.svg, "line"); - var y=dojo.widget.svg.Chart.Plotter.getY(this.properties.axes.x.plotAt, this); - line.setAttribute("y1", y); - line.setAttribute("y2", y); - line.setAttribute("x1",this.properties.padding.left-stroke); - line.setAttribute("x2",this.properties.width-this.properties.padding.right); - line.setAttribute("style","stroke:#000;stroke-width:"+stroke+";"); - this.axisGroup.appendChild(line); - - // x axis units. - // (min and max) - var textSize=10; - var text = document.createElementNS(dojo.svg.xmlns.svg, "text"); - text.setAttribute("x", this.properties.padding.left); - text.setAttribute("y", this.properties.height-this.properties.padding.bottom+textSize+2); - text.setAttribute("style", "text-anchor:middle;font-size:"+textSize+"px;fill:#000;"); - text.appendChild(document.createTextNode(dojo.math.round(parseFloat(this.properties.axes.x.range.min)),2)); - this.axisGroup.appendChild(text); - - var text = document.createElementNS(dojo.svg.xmlns.svg, "text"); - text.setAttribute("x", this.properties.width-this.properties.padding.right-(textSize/2)); - text.setAttribute("y", this.properties.height-this.properties.padding.bottom+textSize+2); - text.setAttribute("style", "text-anchor:middle;font-size:"+textSize+"px;fill:#000;"); - text.appendChild(document.createTextNode(dojo.math.round(parseFloat(this.properties.axes.x.range.max)),2)); - this.axisGroup.appendChild(text); - - // y axis - var line=document.createElementNS(dojo.svg.xmlns.svg, "line"); - var x=dojo.widget.svg.Chart.Plotter.getX(this.properties.axes.y.plotAt, this); - line.setAttribute("x1", x); - line.setAttribute("x2", x); - line.setAttribute("y1", this.properties.padding.top); - line.setAttribute("y2", this.properties.height-this.properties.padding.bottom); - line.setAttribute("style", "stroke:#000;stroke-width:"+stroke+";"); - this.axisGroup.appendChild(line); - - // y axis units - var text = document.createElementNS(dojo.svg.xmlns.svg, "text"); - text.setAttribute("x", this.properties.padding.left-4); - text.setAttribute("y", this.properties.height-this.properties.padding.bottom); - text.setAttribute("style", "text-anchor:end;font-size:"+textSize+"px;fill:#000;"); - text.appendChild(document.createTextNode(dojo.math.round(parseFloat(this.properties.axes.y.range.min)),2)); - this.axisGroup.appendChild(text); - - var text = document.createElementNS(dojo.svg.xmlns.svg, "text"); - text.setAttribute("x", this.properties.padding.left-4); - text.setAttribute("y", this.properties.padding.top+(textSize/2)); - text.setAttribute("style", "text-anchor:end;font-size:"+textSize+"px;fill:#000;"); - text.appendChild(document.createTextNode(dojo.math.round(parseFloat(this.properties.axes.y.range.max)),2)); - this.axisGroup.appendChild(text); - - this.domNode.appendChild(this.vectorNode); - dojo.svg.g.resume(); - - // this is last. - this.assignColors(); - this._isInitialized=true; - }, - destroy:function(){ - while(this.domNode.childNodes.length>0){ - this.domNode.removeChild(this.domNode.childNodes.item(0)); - } - this.vectorNode=this.plotArea=this.dataGroup=this.axisGroup=null; - }, - render:function(){ - dojo.svg.g.suspend(); - - if (this.dataGroup){ - while(this.dataGroup.childNodes.length>0){ - this.dataGroup.removeChild(this.dataGroup.childNodes.item(0)); - } - } else { - this.initialize(); - } - - // the remove/append is an attempt to streamline the rendering, it's totally optional -// var p=this.dataGroup.parentNode; -// p.removeChild(this.dataGroup); - for(var i=0; i0){ - dx=x-_this.getX(series.values[i-1].x, chart); - dy=_this.getY(series.values[i-1].value, chart); - } - - if (i==0) path.push("M"); - else { - path.push("C"); - var cx=x-(tension-1)*(dx/tension); - path.push(cx+","+dy); - cx=x-(dx/tension); - path.push(cx+","+y); - } - path.push(x+","+y); - } - line.setAttribute("d", path.join(" ")); - }; - plotters[types.Scatter]=function(series, chart){ - var r=7; - for (var i=0; i360) hue=hue-360; - if (hue<0) hue=hue+360; - if (hue<60) return (q1+(q2-q1)*hue/60); - else if (hue<180) return(q2); - else if (hue<240) return(q1+(q2-q1)*(240-hue)/60); - else return(q1); - } - this.rgb = rgb - - if (saturation==0) { - return [Math.round(light*255/100), Math.round(light*255/100), Math.round(light*255/100)]; - } else { - light = light/100; - saturation = saturation/100; - // check to see if light > 0.5 - if ((light)<0.5) { - var temp2 = (light)*(1.0+saturation) - } else { - var temp2 = (light+saturation-(light*saturation)) - } - temp1 = 2.0*light - temp2; - var rgbcolor = []; - rgbcolor[0] = Math.round(rgb(temp1,temp2,parseInt(hue)+120)*255); - rgbcolor[1] = Math.round(rgb(temp1,temp2,hue)*255); - rgbcolor[2] = Math.round(rgb(temp1,temp2,parseInt(hue)-120)*255); - return rgbcolor; - } - } -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/AccordionPanel.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/AccordionPanel.css deleted file mode 100644 index a6a367d8d..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/AccordionPanel.css +++ /dev/null @@ -1,24 +0,0 @@ -.AccordionPanel { - border: 0px; - margin: 0px; - padding: 0px; -} - -.AccordionPanelLabel { - cursor: pointer; - color: white; - background-color: #272937; - font-family: Verdana, Helvetica, sans-serif; - font-size: 0.8em; - border: 0px; - margin: 0px; - padding: 0px; -} - -.AccordionPanelInitialContent { - cursor: pointer; - background-color: #fffed0; - border: 0px; - margin: 0px; - padding: 0px; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/AccordionPanel.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/AccordionPanel.html deleted file mode 100644 index 455c2f85c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/AccordionPanel.html +++ /dev/null @@ -1,35 +0,0 @@ -
        -
        -
        -
        - -
        -
        - -
        -
        - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HslColorPicker.svg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HslColorPicker.svg deleted file mode 100644 index ce229649c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HslColorPicker.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButton2Template.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButton2Template.css deleted file mode 100644 index 94f0f53b7..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButton2Template.css +++ /dev/null @@ -1,59 +0,0 @@ -/* ---- button --- */ -.dojoButton { - padding: 0 0 0 0; - font-size: 8pt; - white-space: nowrap; - cursor: pointer; -} - -.dojoButton .dojoButtonContents { - padding: 2px 2px 2px 2px; - text-align: center; /* if icon and label are split across two lines, center icon */ - color: white; -} - -.dojoButtonLeftPart .dojoButtonContents { - padding-right: 8px; -} - -.dojoButtonDisabled { - cursor: url("images/no.gif"), default; -} - - -.dojoButtonContents img { - vertical-align: middle; /* if icon and label are on same line, center them */ -} - -/* -------- colors ------------ */ - -.dojoButtonHover .dojoButtonContents { -} - -.dojoButtonDepressed .dojoButtonContents { - font-style: italic; - color: yellow; -} - -.dojoButtonDisabled .dojoButtonContents { - color: #eeeeee; -} - - -/* ---------- drop down button specific ---------- */ - -/* border between label and arrow (for drop down buttons */ -.dojoButton .border { - width: 1px; - background: gray; -} - -/* button arrow */ -.dojoButton .downArrow { - padding-left: 10px; - text-align: center; -} - -.dojoButton.disabled .downArrow { - cursor : default; -} \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButton2Template.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButton2Template.html deleted file mode 100644 index 6310c1bb2..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButton2Template.html +++ /dev/null @@ -1,6 +0,0 @@ -
        -
        - - - -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButtonTemplate.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButtonTemplate.css deleted file mode 100644 index b92e97524..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButtonTemplate.css +++ /dev/null @@ -1,83 +0,0 @@ -/* ---- button --- */ -.dojoButton { - padding: 0 0 0 0; - margin: 0 0 0 0; - font-size: 8pt; - white-space: nowrap; - cursor: pointer; -} - -.dojoButton.dojoDisabled { - cursor: default; -} - -.dojoButton a { - color: black; - text-decoration: none; -} -.dojoButton.dojoDisabled a { - color: #999; -} - -.dojoButton .label { - padding-right: 5px; - text-align: center; /* if icon and label are split across two lines, center icon */ -} - -.dojoButton img { - vertical-align: middle; /* if icon and label are on same line, center them */ -} - -.dojoButton td, .dojoButtonWrapper td { - margin: 0 0 0 0; - padding: 0 0 0 0; - position: relative; -} -.dojoButton table { - padding: 0 0 0 0; - cell-spacing: 0px; - cell-padding: 0px; -} - -/* -------- colors ------------ */ -.dojoButtonNoHover { -} - -.dojoButtonHover { -} - -.dojoButton.disabled, .dojoButton.disabled * { - color : #999; - cursor : default; - background-color : #f4f4f4; -} - -/** ----- container for the button and stub to attach the menu below it ----- **/ -.dojoButtonWrapper { - border-spacing: 0px; - cell-spacing: 0px; - cell-padding: 0px; - margin: 0 0 0 0; - padding: 0 0 0 0; - display: inline; - margin-right: 10px; - text-decoration: none; -} - -/* ---------- drop down button specific ---------- */ - -/* border between label and arrow (for drop down buttons */ -.dojoButton .border { - width: 1px; - background: gray; -} - -/* button arrow */ -.dojoButton .downArrow { - padding-left: 10px; - text-align: center; -} - -.dojoButton.disabled .downArrow { - cursor : default; -} \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButtonTemplate.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButtonTemplate.html deleted file mode 100644 index 6dc7aa4fa..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlButtonTemplate.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlCiviCrmDatePicker.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlCiviCrmDatePicker.html deleted file mode 100644 index ba60d3921..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlCiviCrmDatePicker.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - -
        - -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboBox.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboBox.css deleted file mode 100644 index 2921a03ef..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboBox.css +++ /dev/null @@ -1,39 +0,0 @@ -input.comboBoxInput { - font-size: 0.8em; - border: 0px; -} - -.comboBoxOptions { - font-family: Verdana, Helvetica, Garamond, sans-serif; - font-size: 0.7em; - background-color: white; - border: 1px solid #afafaf; - position: absolute; - z-index: 1000; - overflow: auto; - -moz-opacity: 0; - cursor: default; -} - -table.dojoComboBox { - border: 1px solid #afafaf; -} - -.cbItem { - padding-left: 2px; - padding-top: 2px; - margin: 0px; -} - -.cbItemEven { - background-color: #f4f4f4; -} - -.cbItemOdd { - background-color: white; -} - -.cbItemHighlight { - background-color: #63709A; - color: white; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboBox.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboBox.html deleted file mode 100644 index cad92ee17..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboBox.html +++ /dev/null @@ -1,34 +0,0 @@ -
        - - - - - - - -
        - - - -
        -
        - -
        -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboButton2Template.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboButton2Template.html deleted file mode 100644 index 353306c60..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlComboButton2Template.html +++ /dev/null @@ -1,18 +0,0 @@ -
        - -
        -
        - - -
        - -
        - - - -
        - -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlContextMenuTemplate.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlContextMenuTemplate.html deleted file mode 100644 index 8c85c54ab..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlContextMenuTemplate.html +++ /dev/null @@ -1,3 +0,0 @@ -
          -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDatePicker.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDatePicker.css deleted file mode 100644 index 871ab21c5..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDatePicker.css +++ /dev/null @@ -1,77 +0,0 @@ -.datePickerContainer { - margin:0.5em 2em 0.5em 0; - width:10em; - float:left; -} - -.previousMonth { - background-color:#bbbbbb; -} - -.currentMonth { - background-color:#8f8f8f; -} - -.nextMonth { - background-color:#eeeeee; -} - -.currentDate { - text-decoration:underline; - font-style:italic; -} - -.selectedItem { - background-color:#3a3a3a; - color:#ffffff; -} - -.calendarContainer { - border-collapse:collapse; - border-spacing:0; - border-bottom:1px solid #e6e6e6; -} - -.calendarContainer thead{ - border-bottom:1px solid #e6e6e6; -} - -.calendarContainer td { - font-size:0.85em; - padding:0.15em; - text-align:center; - cursor:pointer;cursor:hand; -} - -.monthLabel { - font-size:0.9em; - font-weight:400; - margin:0; - text-align:center; -} - -.monthLabel .month { - padding:0 0.4em 0 0.4em; -} - -.yearLabel { - font-size:0.9em; - font-weight:400; - margin:0.25em 0 0 0; - text-align:right; - color:#a3a3a3; -} - -.yearLabel .selectedYear { - color:#000; - padding:0 0.2em; -} - -.nextYear, .previousYear { - cursor:pointer;cursor:hand; -} - -.incrementControl { - cursor:pointer;cursor:hand; - width:1em; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDatePicker.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDatePicker.html deleted file mode 100644 index 96a135a8d..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDatePicker.html +++ /dev/null @@ -1,110 +0,0 @@ -
        -

        - - - ↑ - - July - - ↓ - - -

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        SuMoTuWeThFrSa
        -

        - - - -

        -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDialog.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDialog.html deleted file mode 100644 index fdfe8ed9e..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDialog.html +++ /dev/null @@ -1,13 +0,0 @@ -
        - - - -
        - - - -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDropDownButtonTemplate.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDropDownButtonTemplate.html deleted file mode 100644 index 2453e1ad9..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlDropDownButtonTemplate.html +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlFisheyeList.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlFisheyeList.css deleted file mode 100644 index ca5ddde3c..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlFisheyeList.css +++ /dev/null @@ -1,27 +0,0 @@ -.dojoHtmlFisheyeListItemLabel { - font-family: Arial, Helvetica, sans-serif; - background-color: #eee; - border: 2px solid #666; - padding: 2px; - text-align: center; - position: absolute; - display: none; -} - -.dojoHtmlFisheyeListItemLabel.selected { - display: block; -} - -.dojoHtmlFisheyeListItemImage { - border: 0px; - position: absolute; -} - -.dojoHtmlFisheyeListItem { - position: absolute; - z-index: 2; -} - -.dojoHtmlFisheyeListBar { - position: relative; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlFloatingPane.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlFloatingPane.css deleted file mode 100644 index 11d71927f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlFloatingPane.css +++ /dev/null @@ -1,94 +0,0 @@ - -.dojoFloatingPane { - position: absolute; - border: 1px solid; - border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight; - overflow: visible; /* so drop shadow is displayed */ - z-index: 10; - background-color: ThreeDFace; -} - -.dojoTitleBarIcon { - height: 22px; - width: 22px; - vertical-align: middle; - margin-right: 5px; - margin-left: 5px; -} - -.dojoFloatingPaneActions{ - float: right; - position: absolute; - right: 2px; - top: 2px; - vertical-align: middle; -} - -.dojoFloatingPaneTitleBar { - vertical-align: top; - margin: 2px 4px 2px 2px; - color: CaptionText; - font: small-caption; -} -.dojoFloatingPaneActionItem { - vertical-align: middle; - margin-right: 1px; - height: 22px; - width: 22px; -} - -.dojoFloatingPaneDragbar { - z-index: 10; - margin: 2px 2px 0px 2px; - background-color: ActiveCaption; - cursor: default; - overflow: hidden; - white-space: nowrap; - border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight; - vertical-align: middle; -} - -/* background image for title bar */ -.dojoFloatingPaneDragbarBackground { - z-index: -1; -} -.dojoFloatingPaneDragbarForeground { - z-index: 1; -} - -/* bar at bottom of window that holds resize handle */ -.dojoFloatingPaneResizebar { - z-index: 10; - height: 13px; - background-color: ThreeDFace; -} - -.dojoFloatingPaneClient { - position: absolute; - z-index: 10; - border: 1px solid; - border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow; - margin: 2px; - background-color: ThreeDFace; - padding: 8px; - font-family: Verdana, Helvetica, Garamond, sans-serif; - font-size: 12px; - width: 100%; - overflow: auto; -} - -.dojoDropShadow { - position: absolute; - top: 10px; - left: 10px; - z-index: -1; - background: gray; -} - -.dojoCanvasShadow{ - position: absolute; - top: 15px; - left: -15px; - z-index: -1; - background: transparent; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlInlineEditBox.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlInlineEditBox.css deleted file mode 100644 index f4dde8b68..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlInlineEditBox.css +++ /dev/null @@ -1,24 +0,0 @@ -.editLabel { - font-size : small; - padding : 0 5px; - display : none; -} - -.editableRegion { - background-color : #ffc !important; - cursor : pointer; - _cursor : hand; -} - -.editableRegion .editLabel { - display : inline; -} - -.editableTextareaRegion .editLabel { - display : block; -} - -.inlineEditBox { - /*background-color : #ffc;*/ - display : inline; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlInlineEditBox.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlInlineEditBox.html deleted file mode 100644 index 5d07833fe..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlInlineEditBox.html +++ /dev/null @@ -1,9 +0,0 @@ -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlLayoutPane.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlLayoutPane.css deleted file mode 100644 index 4d07bff44..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlLayoutPane.css +++ /dev/null @@ -1,13 +0,0 @@ -.dojoLayoutPane { - display: block; - position: relative; -} - -.dojoAlignNone, .dojoAlignLeft, .dojoAlignRight, -.dojoAlignTop, .dojoAlignBottom { - overflow: hidden; -} - -.dojoAlignClient { - overflow: auto; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlMenu2.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlMenu2.css deleted file mode 100644 index 9c052ee20..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlMenu2.css +++ /dev/null @@ -1,129 +0,0 @@ - -.dojoPopupMenu2 { - position: absolute; - border: 1px solid; - border-color: ThreeDLightShadow ThreeDDarkShadow ThreeDDarkShadow ThreeDLightShadow; -} - -.dojoPopupMenu2Client { - border: 1px solid; - border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight; - background-color: ThreeDFace; - padding: 1px; -} - -.dojoMenuItem2 { - position: relative; - white-space: nowrap; - font: menu; - color: WindowText; - margin: 0; -} - -.dojoMenuItem2 span { - margin: 0; -} - -.dojoMenuItem2Hover { - background-color: Highlight; - color: HighlightText; -} - -.dojoMenuItem2Icon { - position: absolute; - background-position: center center; - background-repeat: no-repeat; - z-index: 1; -} - -.dojoMenuItem2Label { - position: absolute; - vertical-align: middle; - z-index: 1; -} - -.dojoMenuItem2Label span { - position: relative; - vertical-align: middle; - z-index: 2; -} - -.dojoMenuItem2Label span span { - position: absolute; - color: ThreeDHighlight; - display: none; - left: 1px; - top: 1px; - z-index: -2; -} - -.dojoMenuItem2Accel { - position: absolute; - vertical-align: middle; - z-index: 1; -} - -.dojoMenuItem2Accel span { - position: relative; - vertical-align: middle; - z-index: 2; -} - -.dojoMenuItem2Accel span span { - position: absolute; - color: ThreeDHighlight; - display: none; - left: 1px; - top: 1px; - z-index: -2; -} - -.dojoMenuItem2Disabled .dojoMenuItem2Label span, -.dojoMenuItem2Disabled .dojoMenuItem2Accel span { - color: ThreeDShadow; -} - -.dojoMenuItem2Disabled .dojoMenuItem2Label span span, -.dojoMenuItem2Disabled .dojoMenuItem2Accel span span { - color: ThreeDHighlight; - display: block; -} - -.dojoMenuItem2Hover .dojoMenuItem2Label span span, -.dojoMenuItem2Hover .dojoMenuItem2Accel span span { - display: none; -} - -.dojoMenuItem2Submenu { - position: absolute; - background-position: center center; - background-repeat: no-repeat; -} - -.dojoMenuItem2Target { - position: absolute; - z-index: 10; - font-size: 1px; - background-image: url('images/transparent.gif'); - cursor: pointer; - _cursor: hand; -} - -.dojoMenuSeparator2 { - font-size: 1px; - margin: 0; -} - -.dojoMenuSeparator2Top { - height: 50%; - border-bottom: 1px solid ThreeDShadow; - margin: 0px 2px; - font-size: 1px; -} - -.dojoMenuSeparator2Bottom { - height: 50%; - border-top: 1px solid ThreeDHighlight; - margin: 0px 2px; - font-size: 1px; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlMenuItemTemplate.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlMenuItemTemplate.html deleted file mode 100644 index 36249b1f0..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlMenuItemTemplate.html +++ /dev/null @@ -1,2 +0,0 @@ -
        -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizableTextarea.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizableTextarea.css deleted file mode 100644 index 8f0cf23fa..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizableTextarea.css +++ /dev/null @@ -1,15 +0,0 @@ -div.statusBar { - background-color: ThreeDFace; - height: 28px; - padding: 1px; - overflow: hidden; - font-size: 12px; -} - -div.statusPanel { - background-color: ThreeDFace; - border: 1px solid; - border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow; - margin: 1px; - padding: 2px 6px; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizableTextarea.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizableTextarea.html deleted file mode 100644 index 88827f717..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizableTextarea.html +++ /dev/null @@ -1,14 +0,0 @@ -
        -
        -
        -
        -
        -
        drag to resize
        -
        -
        -
        -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizeHandle.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizeHandle.css deleted file mode 100644 index 2a4d181e9..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlResizeHandle.css +++ /dev/null @@ -1,19 +0,0 @@ -.dojoHtmlResizeHandle { - position: absolute; - right: 2px; - bottom: 2px; - width: 13px; - height: 13px; - padding: 0px; - margin: 0px; - border: 0px; - z-index: 20; - background-color: ThreeDFace; - cursor: nw-resize; -} - -.dojoHtmlResizeHandle img { - position: absolute; - top: 0px; - left: 0px; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSimpleDropdownButtons.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSimpleDropdownButtons.css deleted file mode 100644 index e72afbd0e..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSimpleDropdownButtons.css +++ /dev/null @@ -1,100 +0,0 @@ -ul.dojoSimpleDropdownButtons { - margin : 0; - padding : 5px 0; -} - -ul.dojoSimpleDropdownButtons li { - display : inline; - margin-right : 5px; - padding : 2px 0; -} - -ul.dojoSimpleDropdownButtons li a { - padding : 2px 9px; - border : 2px outset #ccc; - border-right-width : 1px; - background : #f4f4f4; - color : #333; - text-decoration : none; -} - -ul.dojoSimpleDropdownButtons li ul { - display : none; -} - -ul.dojoSimpleDropdownButtons li a.disabled { - color : #999; - cursor : default; -} - -ul.dojoSimpleDropdownButtons li .downArrow { - display : inline; - padding : 2px 4px; - border : 2px outset #ccc; - border-left : 0; - background : #f4f4f4 url(images/dropdownButtonsArrow.gif) no-repeat 4px 9px; - text-decoration : none; - color : black; - cursor : pointer; - _cursor : hand; -} - -ul.dojoSimpleDropdownButtons li .downArrow.disabled { - background-image : url(images/dropdownButtonsArrow-disabled.gif); - cursor : default; -} - -ul.dojoSimpleDropdownButtons li a:hover, -ul.dojoSimpleDropdownButtons li span.downArrow:hover { - color : black; - background-color : #ddd; -} - -ul.dojoSimpleDropdownButtons li .downArrow.pressed, ul.dojoSimpleDropdownButtons li .downArrow:focus { - border-style : inset; - background-position : 5px 10px; - padding : 2px 4px; -} - -ul.dojoSimpleDropdownButtons li a.disabled:hover, -ul.dojoSimpleDropdownButtons li span.downArrow.disabled:hover { - color : #999; - background-color : #f4f4f4; -} - -ul.dojoSimpleDropdownButtons li a:focus { - padding : 3px 8px 1px 10px; - color : #333; - border-style : inset; -} - -/* Menu - ******************** */ -ul.dojoSimpleDropdownButtonsMenu { - position : absolute; - margin : 0; - _margin : -2px; - padding : 0; - display : none; - border : 1px solid #aaa; - background : #f4f4f4; - list-style : none; - z-index : 99; -} - -ul.dojoSimpleDropdownButtonsMenu li { - _display : inline; -} - -ul.dojoSimpleDropdownButtonsMenu a { - display : block; - padding : 2px 5px; - color : #333; - text-decoration : none; -} - -ul.dojoSimpleDropdownButtonsMenu a:hover { - background : #ddd; - color : black; -} - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSlideShow.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSlideShow.css deleted file mode 100644 index 02e97cd0f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSlideShow.css +++ /dev/null @@ -1,9 +0,0 @@ -.slideShowImg { - position: absolute; - left: 0px; - top: 0px; - border: 2px solid #4d4d4d; - padding: 0px; - margin: 0px; -} - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSlideShow.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSlideShow.html deleted file mode 100644 index 889b36c1a..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSlideShow.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -
        - -
        -
        - - -
        -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSplitPane.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSplitPane.css deleted file mode 100644 index 778890105..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlSplitPane.css +++ /dev/null @@ -1,45 +0,0 @@ -.dojoHtmlSplitPane{ - position: relative; - overflow: hidden; -} - -.dojoHtmlSplitterPanePanel{ - position: absolute; - background-color: ThreeDFace; - padding: 5px; - margin: 0; -} - -.dojoHtmlSplitPaneSizerH, -.dojoHtmlSplitPaneSizerV { - font-size: 1px; - cursor: move; - cursor: w-resize; - background-color: ThreeDFace; - border: 1px solid; - border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight; - margin: 0; -} - -.dojoHtmlSplitPaneSizerV { - - cursor: n-resize; -} - -.dojoHtmlSplitPaneVirtualSizerH, -.dojoHtmlSplitPaneVirtualSizerV { - - font-size: 1px; - cursor: move; - cursor: w-resize; - background-color: ThreeDShadow; - -moz-opacity: 0.5; - opacity: 0.5; - filter: Alpha(Opacity=50); - margin: 0; -} - -.dojoHtmlSplitPaneVirtualSizerV { - - cursor: n-resize; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTabPane.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTabPane.css deleted file mode 100644 index e5d1ded33..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTabPane.css +++ /dev/null @@ -1,69 +0,0 @@ -.dojoTabPane { - overflow: hidden; /* workaround firefox bug */ -} - -.dojoTabPanel { - padding : 10px; - border : 1px solid #765; - margin-top : -1px; - margin-bottom : 10px; - overflow : auto; -} - -.tabs { - margin : 0; - padding : 0; - list-style : none; -} - -.tabs li { - float : left; - padding-left : 9px; - border-bottom : 1px solid #765; - background : url(images/tab_left.gif) no-repeat left top; - cursor: pointer; -} - -.tabs li span { - display : block; - padding : 4px 15px 4px 6px; - background : url(images/tab_right.gif) no-repeat right top; - color : #333; - font-size : 90%; - text-decoration : none; -} - -.tabs li.current { - padding-bottom : 1px; - border-bottom : 0; - background-position : 0 -150px; -} - -.tabs li.current span { - padding-bottom : 5px; - margin-bottom : -1px; - background-position : 100% -150px; -} - -/* bottom tabs */ -.tabs.bottom { - border-top : 0; -} - -.tabs.bottom li { - border-bottom : 0; - background : url(images/tab_left_r.gif) no-repeat left bottom; -} - -.tabs.bottom li span { - background : url(images/tab_right_r.gif) no-repeat right bottom; -} - -.tabs.bottom li.current { - margin-top : -1px; - background-image : url(images/tab_left_r_curr.gif); -} - -.tabs.bottom li.current span { - background-image : url(images/tab_right_r_curr.gif); -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTabs.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTabs.css deleted file mode 100644 index 1261781d2..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTabs.css +++ /dev/null @@ -1,81 +0,0 @@ -.dojoTabPanelContainer { - width : 100%; - height : 20em; - padding : 10px; - border : 1px solid #765; - clear : both; - margin-top : -1px; - margin-bottom : 10px; - overflow : auto; - float : left; - box-sizing: border-box; - -moz-box-sizing: border-box; -} - -.dojoTabPanelContainer :first-child { - margin-top : 0; -} - -.tabs { - margin : 0; - padding : 0; - list-style : none; - _border : 1px solid white; -} - -.tabs li { - float : left; - padding-left : 9px; - border-bottom : 1px solid #765; - background : url(images/tab_left.gif) no-repeat left top; -} - -.tabs li a { - display : block; - padding : 4px 15px 4px 6px; - background : url(images/tab_right.gif) no-repeat right top; - color : #333; - font-size : 90%; - text-decoration : none; -} - -.tabs li.current { - padding-bottom : 1px; - border-bottom : 0; - background-position : 0 -150px; -} - -.tabs li.current a { - padding-bottom : 5px; - margin-bottom : -1px; - background-position : 100% -150px; -} - -/* bottom tabs */ -.tabs.bottom { - _border-top : 0; -} - -.tabs.bottom li { - border-bottom : 0; - background : url(images/tab_left_r.gif) no-repeat left bottom; -} - -.tabs.bottom li a { - background : url(images/tab_right_r.gif) no-repeat right bottom; -} - -.tabs.bottom li.current { - margin-top : -1px; - background-image : url(images/tab_left_r_curr.gif); -} - -.tabs.bottom li.current a { - background-image : url(images/tab_right_r_curr.gif); -} - -#tabsHere { - overflow : auto; - float : none; - margin : 0; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTaskBar.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTaskBar.css deleted file mode 100644 index 259dbc95b..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTaskBar.css +++ /dev/null @@ -1,27 +0,0 @@ -.dojoTaskBarItem { - background-color: ThreeDFace; - border: outset 2px; - display: inline; - margin-right: 5px; - cursor: pointer; - height: 35px; - width: 100px; - font-size: 10pt; - white-space: nowrap; - text-align: center; -} - -.dojoTaskBarItem img { - vertical-align: middle; - margin-right: 5px; - margin-left: 5px; - height: 32px; - width: 32px; -} - -.dojoTaskBarItem a { - color: black; - text-decoration: none; -} - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTaskBarItemTemplate.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTaskBarItemTemplate.html deleted file mode 100644 index ced4b3234..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTaskBarItemTemplate.html +++ /dev/null @@ -1,2 +0,0 @@ -
        -
        \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTimePicker.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTimePicker.css deleted file mode 100644 index 428db07d6..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTimePicker.css +++ /dev/null @@ -1,37 +0,0 @@ -.timePickerContainer { - margin:1.75em 0 0.5em 0; - width:10em; - float:left; -} - -.timeContainer { - border-collapse:collapse; - border-spacing:0; -} - -.timeContainer thead td{ - border-bottom:1px solid #e6e6e6; - padding:0 0.4em 0.2em 0.4em; -} - -.timeContainer td { - font-size:0.9em; - padding:0 0.25em 0 0.25em; - text-align:left; - cursor:pointer;cursor:hand; -} - -.timeContainer td.minutesHeading { - border-left:1px solid #e6e6e6; - border-right:1px solid #e6e6e6; -} - -.timeContainer .minutes { - border-left:1px solid #e6e6e6; - border-right:1px solid #e6e6e6; -} - -.selectedItem { - background-color:#3a3a3a; - color:#ffffff; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTimePicker.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTimePicker.html deleted file mode 100644 index b092b0ed4..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTimePicker.html +++ /dev/null @@ -1,99 +0,0 @@ -
        - - - - - - - - - - - - - - - - - - - - -
        HourMinute 
        - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        126
        17
        28
        39
        410
        511
        -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        0030
        0535
        1040
        1545
        2050
        2555
        -
        - - - - - - - - - -
        AM
        PM
        -
        -
        any
        -
        -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlToolbar.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlToolbar.css deleted file mode 100644 index b5fe8d5e3..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlToolbar.css +++ /dev/null @@ -1,54 +0,0 @@ -.toolbarContainer { - border-bottom : 0; - background-color : #def; - color : ButtonText; - font : Menu; - background-image: url(images/toolbar-bg.gif); -} - -.toolbar { - padding : 2px 4px; - min-height : 26px; - _height : 26px; -} - -.toolbarItem { - float : left; - padding : 1px 2px; - margin : 0 2px 1px 0; - cursor : pointer; -} - -.toolbarItem.selected, .toolbarItem.down { - margin : 1px 1px 0 1px; - padding : 0px 1px; - border : 1px solid #bbf; - background-color : #fafaff; -} - -.toolbarButton img { - vertical-align : bottom; -} - -.toolbarButton span { - line-height : 16px; - vertical-align : middle; -} - -.toolbarButton.hover { - padding : 0px 1px; - border : 1px solid #99c; -} - -.toolbarItem.disabled { - opacity : 0.3; - filter : alpha(opacity=30); - cursor : default; -} - -.toolbarSeparator { - cursor : default; -} - -.toolbarFlexibleSpace { -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTooltipTemplate.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTooltipTemplate.css deleted file mode 100644 index e9376790e..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTooltipTemplate.css +++ /dev/null @@ -1,10 +0,0 @@ -.dojoTooltip { - border: solid black 1px; - background: beige; - color: black; - position: absolute; - max-width: 200px; - font-size: small; - padding: 2px 2px 2px 2px; - z-index: 10; -} \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTooltipTemplate.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTooltipTemplate.html deleted file mode 100644 index c44cb847f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/HtmlTooltipTemplate.html +++ /dev/null @@ -1,2 +0,0 @@ - \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Menu.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Menu.css deleted file mode 100644 index 1419f6d09..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Menu.css +++ /dev/null @@ -1,60 +0,0 @@ -.dojoMenu { - border:1px solid #000000; - list-style-type:none; - margin:0; - padding:0; - padding-bottom: 1px; - background-color:#f4f4f4; - font-size: 8pt; -} - -.dojoMenuSeparator { - list-style-type:none; - margin:0; - padding:1px 0; - border-bottom:1px solid #000000; - line-height:1px; - height:1px; -} - -li:hover.dojoMenuSeparator { - background-color:#e5e5e5; - cursor:default; -} - - - - -.dojoContextMenu { - position: absolute; - display: none; - border: 2px solid; - border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight; - list-style-type: none; - margin: 0; - padding: 1px; - background-color: ThreeDFace; - font-size: 8pt; -} - -.dojoMenuItem { - white-space: nowrap; - padding: 2px; - font: menu; - color: WindowText; -} - -.dojoMenuItem a { - text-decoration: none; - color: WindowText; - font: inherit; -} - -.dojoMenuItemHover { - padding: 2px; - background-color: blue; - cursor: pointer; - _cursor: hand; - background-color: Highlight; - color: HighlightText; -} \ No newline at end of file diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/PopUpButton.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/PopUpButton.css deleted file mode 100644 index 780ea4349..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/PopUpButton.css +++ /dev/null @@ -1,35 +0,0 @@ -.PopUpButton { - padding : 2px 6px 2px 9px; - border : 1px outset #ccc; - background : #f4f4f4; - color : #333; - text-decoration : none; -} - -.PopUpButton .downArrow { - margin-left: 0.5em; - margin-bottom: 2px; -} - -.downArrow.disabled { - background-image : url(images/dropdownButtonsArrow-disabled.gif); - cursor : default; -} - -ul.dropdownButtons li a:hover, -ul.dropdownButtons li span.downArrow:hover { - color : black; - background-color : #ddd; -} - -ul.dropdownButtons li .downArrow.pressed, ul.dropdownButtons li .downArrow:focus { - border-style : inset; - background-position : 5px 10px; - padding : 2px 4px; -} - -ul.dropdownButtons li a.disabled:hover, -ul.dropdownButtons li span.downArrow.disabled:hover { - color : #999; - background-color : #f4f4f4; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Tree.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Tree.css deleted file mode 100644 index 0af721d4d..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Tree.css +++ /dev/null @@ -1,29 +0,0 @@ -.dojoTree { - font: caption; - font-size: 11px; - font-weight: normal; - overflow: auto; -} - -.dojoTreeNodeLabel { - padding: 1px 2px; - color: WindowText; - cursor: default; -} - -.dojoTreeNodeLabel:hover { - text-decoration: underline; -} - -.dojoTreeNodeLabelSelected { - background-color: Highlight; - color: HighlightText; -} - -.dojoTree div { - white-space: nowrap; -} - -.dojoTree img { - vertical-align: middle; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Wizard.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Wizard.css deleted file mode 100644 index ff12ef9ae..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Wizard.css +++ /dev/null @@ -1,72 +0,0 @@ -.WizardContainer { - background: #EEEEEE; - border: #798EC5 1px solid; - padding: 2px; -} - -.WizardTitle { - color: #003366; - padding: 8px 5px 15px 2px; - font-weight: bold; - font-size: x-small; - font-style: normal; - font-family: Verdana, Arial, Helvetica; - text-align: left; -} - -.WizardText { - color: #000033; - font-weight: normal; - font-size: xx-small; - font-family: Verdana, Arial, Helvetica; - padding: 2 50; text-align: justify; -} - -.WizardLightText { - color: #666666; - font-weight: normal; - font-size: xx-small; - font-family: verdana, arial, helvetica; - padding: 2px 50px; - text-align: justify; -} - -.WizardButtonHolder { - text-align: right; - padding: 10px 5px; -} - -.WizardButton { - color: #ffffff; - background: #798EC5; - font-size: xx-small; - font-family: verdana, arial, helvetica, sans-serif; - border-right: #000000 1px solid; - border-bottom: #000000 1px solid; - border-left: #666666 1px solid; - border-top: #666666 1px solid; - padding-right: 4px; - padding-left: 4px; - text-decoration: none; height: 18px; -} - -.WizardButton:hover { - cursor: pointer; -} - -.WizardButtonDisabled { - color: #eeeeee; - background-color: #999999; - font-size: xx-small; - FONT-FAMILY: verdana, arial, helvetica, sans-serif; - border-right: #000000 1px solid; - border-bottom: #000000 1px solid; - border-left: #798EC5 1px solid; - border-top: #798EC5 1px solid; - padding-right: 4px; - padding-left: 4px; - text-decoration: none; - height: 18px; -} - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Wizard.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Wizard.html deleted file mode 100644 index a91474ffe..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/Wizard.html +++ /dev/null @@ -1,11 +0,0 @@ -
        -
        -
        -
        - - - - -
        -
        - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/-.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/-.gif deleted file mode 100644 index eaed04a7a..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/-.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/backcolor.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/backcolor.gif deleted file mode 100644 index 90c0a5ba1..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/backcolor.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/bold.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/bold.gif deleted file mode 100644 index c6291f053..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/bold.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/cancel.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/cancel.gif deleted file mode 100644 index 7c5db93bc..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/cancel.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/copy.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/copy.gif deleted file mode 100644 index 975740a76..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/copy.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/createlink.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/createlink.gif deleted file mode 100644 index dad6feb91..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/createlink.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/cut.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/cut.gif deleted file mode 100644 index 206603890..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/cut.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/delete.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/delete.gif deleted file mode 100644 index 3c3df5b75..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/delete.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/forecolor.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/forecolor.gif deleted file mode 100644 index 148e188b3..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/forecolor.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/hilitecolor.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/hilitecolor.gif deleted file mode 100644 index 90c0a5ba1..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/hilitecolor.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/indent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/indent.gif deleted file mode 100644 index a67139d60..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/indent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/inserthorizontalrule.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/inserthorizontalrule.gif deleted file mode 100644 index 9f6e5e8bf..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/inserthorizontalrule.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertimage.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertimage.gif deleted file mode 100644 index f06067e05..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertimage.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertorderedlist.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertorderedlist.gif deleted file mode 100644 index 427839d7a..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertorderedlist.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/inserttable.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/inserttable.gif deleted file mode 100644 index 027f7c8f7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/inserttable.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertunorderedlist.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertunorderedlist.gif deleted file mode 100644 index caedfd233..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/insertunorderedlist.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/italic.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/italic.gif deleted file mode 100644 index 7bb67aa89..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/italic.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifycenter.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifycenter.gif deleted file mode 100644 index 9505db22f..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifycenter.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyfull.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyfull.gif deleted file mode 100644 index 29cf73185..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyfull.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyleft.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyleft.gif deleted file mode 100644 index d0356d4c1..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyleft.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyright.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyright.gif deleted file mode 100644 index b9f7a961f..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/justifyright.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/left_to_right.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/left_to_right.gif deleted file mode 100644 index 9edfa63e4..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/left_to_right.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_bullet_indent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_bullet_indent.gif deleted file mode 100644 index 4dd2bfb51..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_bullet_indent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_bullet_outdent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_bullet_outdent.gif deleted file mode 100644 index a5e7dac2f..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_bullet_outdent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_num_indent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_num_indent.gif deleted file mode 100644 index aa63b620f..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_num_indent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_num_outdent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_num_outdent.gif deleted file mode 100644 index 09f45734e..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/list_num_outdent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/outdent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/outdent.gif deleted file mode 100644 index f320b3e94..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/outdent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/paste.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/paste.gif deleted file mode 100644 index 13e2324cf..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/paste.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/redo.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/redo.gif deleted file mode 100644 index da4545d0e..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/redo.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/removeformat.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/removeformat.gif deleted file mode 100644 index 5d8ce2d9a..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/removeformat.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/right_to_left.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/right_to_left.gif deleted file mode 100644 index 231f18344..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/right_to_left.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/save.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/save.gif deleted file mode 100644 index 6ffb97582..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/save.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/space.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/space.gif deleted file mode 100644 index 5bfd67a2d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/space.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/strikethrough.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/strikethrough.gif deleted file mode 100644 index 0e00304dc..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/strikethrough.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/subscript.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/subscript.gif deleted file mode 100644 index effcf575e..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/subscript.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/superscript.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/superscript.gif deleted file mode 100644 index 1b6f4019c..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/superscript.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/underline.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/underline.gif deleted file mode 100644 index ef8c19e4b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/underline.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/undo.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/undo.gif deleted file mode 100644 index ef846e673..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/undo.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/wikiword.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/wikiword.gif deleted file mode 100644 index 88e7324d6..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/buttons/wikiword.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/check_off.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/check_off.gif deleted file mode 100644 index fd22f0438..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/check_off.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/check_on.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/check_on.gif deleted file mode 100644 index 6bd3f0a84..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/check_on.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/decrementMonth.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/decrementMonth.gif deleted file mode 100644 index da5d869a4..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/decrementMonth.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/decrementWeek.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/decrementWeek.gif deleted file mode 100644 index 1f2b8a0f6..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/decrementWeek.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/grabCorner.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/grabCorner.gif deleted file mode 100644 index f0ba3ee80..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/grabCorner.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/EditorTree.css b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/EditorTree.css deleted file mode 100644 index be5156460..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/EditorTree.css +++ /dev/null @@ -1,30 +0,0 @@ -.dojoTree { - font: caption; - font-size: 11px; - font-weight: normal; - overflow: auto; -} - - -.dojoTreeNodeLabelTitle { - padding-left: 2px; - color: WindowText; -} - -.dojoTreeNodeLabel { - cursor:hand; - cursor:pointer; -} - -.dojoTreeNodeLabelSelected { - background-color: Highlight; - color: HighlightText; -} - -.dojoTree div { - white-space: nowrap; -} - -.dojoTree img, .dojoTreeNodeLabel img { - vertical-align: middle; -} diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/blank.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/blank.gif deleted file mode 100644 index 15b86cf65..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/blank.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/closed.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/closed.gif deleted file mode 100644 index 7e911b924..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/closed.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/document.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/document.gif deleted file mode 100644 index 809a3f565..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/document.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/minus.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/minus.gif deleted file mode 100644 index fa3221527..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/minus.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/open.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/open.gif deleted file mode 100644 index 2cef26a8d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/open.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/plus.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/plus.gif deleted file mode 100644 index 9917a548c..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/plus.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_blank.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_blank.gif deleted file mode 100644 index 3b4587efc..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_blank.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_child.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_child.gif deleted file mode 100644 index ab5e1a4d7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_child.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_expand_minus.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_expand_minus.gif deleted file mode 100644 index d8542128b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_expand_minus.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_expand_plus.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_expand_plus.gif deleted file mode 100644 index ccc30ebaa..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_expand_plus.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_c.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_c.gif deleted file mode 100644 index 84d3d7e8b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_c.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_l.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_l.gif deleted file mode 100644 index fd1ecf104..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_l.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_p.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_p.gif deleted file mode 100644 index fd47bba1d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_p.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_t.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_t.gif deleted file mode 100644 index d1db9c5f4..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_t.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_v.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_v.gif deleted file mode 100644 index 307ec0e90..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_v.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_x.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_x.gif deleted file mode 100644 index 666ec67f6..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_x.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_y.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_y.gif deleted file mode 100644 index 64104f5ff..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_y.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_z.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_z.gif deleted file mode 100644 index c7aaba94d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_grid_z.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_loading.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_loading.gif deleted file mode 100644 index 7436a8dcc..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/EditorTree/treenode_loading.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/blank.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/blank.gif deleted file mode 100644 index e565824aa..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/blank.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/combo_box_arrow.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/combo_box_arrow.png deleted file mode 100644 index 1de92b7c2..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/combo_box_arrow.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/dropdownButtonsArrow-disabled.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/dropdownButtonsArrow-disabled.gif deleted file mode 100644 index 8ef6b2fbf..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/dropdownButtonsArrow-disabled.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/dropdownButtonsArrow.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/dropdownButtonsArrow.gif deleted file mode 100644 index ea60995e1..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/dropdownButtonsArrow.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneClose.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneClose.gif deleted file mode 100644 index e044bdbc7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneClose.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneMaximize.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneMaximize.gif deleted file mode 100644 index 1e3df4a6b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneMaximize.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneMinimize.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneMinimize.gif deleted file mode 100644 index f9ae347e7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneMinimize.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneRestore.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneRestore.gif deleted file mode 100644 index f13dd644c..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/floatingPaneRestore.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/hue.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/hue.png deleted file mode 100644 index 046e76783..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/hue.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/no.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/no.gif deleted file mode 100644 index 3d164778a..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/no.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/no.svg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/no.svg deleted file mode 100644 index 40e242662..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/no.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - Clipart by Nicu Buculei - nosmoke - - - - - roadsign - transportation - - - - - Nicu Buculei - - - - - Nicu Buculei - - - - - Nicu Buculei - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-c.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-c.gif deleted file mode 100644 index 54c63fcc6..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-c.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-l.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-l.gif deleted file mode 100644 index a56fa2695..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-l.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-r.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-r.gif deleted file mode 100644 index ed0633762..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji-r.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji_p_01.svg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji_p_01.svg deleted file mode 100644 index f84d87c86..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-blue_benji_p_01.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - pill-button-blue - - - - hash - - webpage - shape - button - computer - buttons - - - - - Benji Park - - - - - Benji Park - - - - - Benji Park - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-c.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-c.gif deleted file mode 100644 index b33ced5a4..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-c.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-l.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-l.gif deleted file mode 100644 index d9139adb3..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-l.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-r.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-r.gif deleted file mode 100644 index 620b0f57b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji-r.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji.svg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji.svg deleted file mode 100644 index 0848db3c1..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-gray_benji.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - pill-button-blue - - - - hash - - webpage - shape - button - computer - buttons - - - - - Benji Park - - - - - Benji Park - - - - - Benji Park - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-c.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-c.gif deleted file mode 100644 index 3e40bcb75..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-c.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-l.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-l.gif deleted file mode 100644 index b558e4186..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-l.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-r.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-r.gif deleted file mode 100644 index 8daac1023..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji-r.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji_01.svg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji_01.svg deleted file mode 100644 index 26a08f448..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-purple_benji_01.svg +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - pill-button-purple - - - - webpage - shape - button - - - - - Benji Park - - - - - Benji Park - - - - - Benji Park - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_ben_01.svg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_ben_01.svg deleted file mode 100644 index a379850e7..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_ben_01.svg +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - pill-button-seagreen - - - - webpage - shape - button - - - - - Benji Park - - - - - Benji Park - - - - - Benji Park - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-c.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-c.gif deleted file mode 100644 index 865d1783d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-c.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-l.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-l.gif deleted file mode 100644 index f41354713..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-l.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-r.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-r.gif deleted file mode 100644 index 0558bb5ac..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/pill-button-seagreen_benji-r.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowB.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowB.png deleted file mode 100644 index ccd873a06..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowB.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowBL.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowBL.png deleted file mode 100644 index 7fcab83d7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowBL.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowBR.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowBR.png deleted file mode 100644 index 83c31bc48..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowBR.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowL.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowL.png deleted file mode 100644 index 0b1591819..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowL.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowR.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowR.png deleted file mode 100644 index d4545ac4e..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowR.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowTR..png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowTR..png deleted file mode 100644 index 6049a16b7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowTR..png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowUL.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowUL.png deleted file mode 100644 index 80544b752..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowUL.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowUR.png b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowUR.png deleted file mode 100644 index 10db9cb93..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/shadowUR.png and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/submenu_off.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/submenu_off.gif deleted file mode 100644 index 8ffd1d692..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/submenu_off.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/submenu_on.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/submenu_on.gif deleted file mode 100644 index 876933fe0..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/submenu_on.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left.gif deleted file mode 100644 index 730d7e247..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left_r.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left_r.gif deleted file mode 100644 index 29f4be5d5..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left_r.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left_r_curr.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left_r_curr.gif deleted file mode 100644 index 2915d9bd8..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_left_r_curr.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right.gif deleted file mode 100644 index c17a8de59..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right_r.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right_r.gif deleted file mode 100644 index 2666ae8a6..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right_r.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right_r_curr.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right_r_curr.gif deleted file mode 100644 index e93cf84e7..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/tab_right_r_curr.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/titlebar-bg.jpg b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/titlebar-bg.jpg deleted file mode 100644 index d9d890e92..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/titlebar-bg.jpg and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/toolbar-bg.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/toolbar-bg.gif deleted file mode 100644 index e88d31a7c..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/toolbar-bg.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/transparent.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/transparent.gif deleted file mode 100644 index cb1dadbc0..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/transparent.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_blank.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_blank.gif deleted file mode 100644 index 3b4587efc..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_blank.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_expand_minus.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_expand_minus.gif deleted file mode 100644 index d8542128b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_expand_minus.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_expand_plus.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_expand_plus.gif deleted file mode 100644 index ccc30ebaa..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_expand_plus.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_c.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_c.gif deleted file mode 100644 index 84d3d7e8b..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_c.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_l.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_l.gif deleted file mode 100644 index fd1ecf104..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_l.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_p.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_p.gif deleted file mode 100644 index fd47bba1d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_p.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_t.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_t.gif deleted file mode 100644 index d1db9c5f4..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_t.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_v.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_v.gif deleted file mode 100644 index 307ec0e90..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_v.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_x.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_x.gif deleted file mode 100644 index 666ec67f6..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_x.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_y.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_y.gif deleted file mode 100644 index 64104f5ff..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_y.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_z.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_z.gif deleted file mode 100644 index c7aaba94d..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_grid_z.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_node.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_node.gif deleted file mode 100644 index 34f26d156..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/treenode_node.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/verticalbar.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/verticalbar.gif deleted file mode 100644 index 746029b02..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/verticalbar.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/whiteDownArrow.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/whiteDownArrow.gif deleted file mode 100644 index 20c1f6289..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/images/whiteDownArrow.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/incrementMonth.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/incrementMonth.gif deleted file mode 100644 index 42fe20dad..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/incrementMonth.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/incrementWeek.gif b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/incrementWeek.gif deleted file mode 100644 index 76f1b2555..000000000 Binary files a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/incrementWeek.gif and /dev/null differ diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js deleted file mode 100644 index 7c6f91dde..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js +++ /dev/null @@ -1,171 +0,0 @@ -/* - Copyright (c) 2004-2005, The Dojo Foundation - All Rights Reserved. - - Licensed under the Academic Free License version 2.1 or above OR the - modified BSD license. For more information on Dojo licensing, see: - - http://dojotoolkit.org/community/licensing.shtml -*/ - -dojo.provide("dojo.xml.Parse"); - -dojo.require("dojo.dom"); - -//TODO: determine dependencies -// currently has dependency on dojo.xml.DomUtil nodeTypes constants... - -/* generic method for taking a node and parsing it into an object - -TODO: WARNING: This comment is wrong! - -For example, the following xml fragment - - - - - -can be described as: - -dojo.???.foo = {} -dojo.???.foo.bar = {} -dojo.???.foo.bar.value = "bar"; -dojo.???.foo.baz = {} -dojo.???.foo.baz.xyzzy = {} -dojo.???.foo.baz.xyzzy.value = "xyzzy" - -*/ -// using documentFragment nomenclature to generalize in case we don't want to require passing a collection of nodes with a single parent -dojo.xml.Parse = function(){ - this.parseFragment = function(documentFragment) { - // handle parent element - var parsedFragment = {}; - // var tagName = dojo.xml.domUtil.getTagName(node); - var tagName = dojo.dom.getTagName(documentFragment); - // TODO: What if document fragment is just text... need to check for nodeType perhaps? - parsedFragment[tagName] = new Array(documentFragment.tagName); - var attributeSet = this.parseAttributes(documentFragment); - for(var attr in attributeSet){ - if(!parsedFragment[attr]){ - parsedFragment[attr] = []; - } - parsedFragment[attr][parsedFragment[attr].length] = attributeSet[attr]; - } - var nodes = documentFragment.childNodes; - for(var childNode in nodes){ - switch(nodes[childNode].nodeType){ - case dojo.dom.ELEMENT_NODE: // element nodes, call this function recursively - parsedFragment[tagName].push(this.parseElement(nodes[childNode])); - break; - case dojo.dom.TEXT_NODE: // if a single text node is the child, treat it as an attribute - if(nodes.length == 1){ - if(!parsedFragment[documentFragment.tagName]){ - parsedFragment[tagName] = []; - } - parsedFragment[tagName].push({ value: nodes[0].nodeValue }); - } - break; - } - } - - return parsedFragment; - } - - this.parseElement = function(node, hasParentNodeSet, optimizeForDojoML, thisIdx){ - // TODO: make this namespace aware - var parsedNodeSet = {}; - var tagName = dojo.dom.getTagName(node); - parsedNodeSet[tagName] = []; - if((!optimizeForDojoML)||(tagName.substr(0,4).toLowerCase()=="dojo")){ - var attributeSet = this.parseAttributes(node); - for(var attr in attributeSet){ - if((!parsedNodeSet[tagName][attr])||(typeof parsedNodeSet[tagName][attr] != "array")){ - parsedNodeSet[tagName][attr] = []; - } - parsedNodeSet[tagName][attr].push(attributeSet[attr]); - } - - // FIXME: we might want to make this optional or provide cloning instead of - // referencing, but for now, we include a node reference to allow - // instantiated components to figure out their "roots" - parsedNodeSet[tagName].nodeRef = node; - parsedNodeSet.tagName = tagName; - parsedNodeSet.index = thisIdx||0; - } - - var count = 0; - for(var i=0; i diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/Bind.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/Bind.js deleted file mode 100644 index 5fe107b45..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/Bind.js +++ /dev/null @@ -1,202 +0,0 @@ -dojo.provide("struts.widgets.Bind"); -dojo.provide("struts.widgets.HTMLBind"); - -dojo.require("dojo.io.*"); -dojo.require("dojo.event.*"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.xml.Parse"); - -dojo.require("struts.Util"); - -/* - * - */ - -struts.widgets.HTMLBind = function() { - - // inheritance - // see: http://www.cs.rit.edu/~atk/JavaScript/manuals/jsobj/ - dojo.widget.HtmlWidget.call(this); - var self = this; - - this.widgetType = "Bind"; - this.templatePath = dojo.uri.dojoUri("struts/widgets/Bind.html"); - - - // the name of the global javascript variable to associate with this widget instance - this.id = ""; - - // the id of the form object to bind to - this.formId = ""; - - // the url to bind to - this.href = ""; - - // javascript code to provide the href - will be evaluated each time before the data is loaded - this.getHref = "" - - // topics that will be notified with a "notify" message when the bind operation has completed successfully - this.notifyTopics = ""; - - // html to display when there is an error loading content - this.errorHtml = "Failed to load remote content"; - - // do we show transport errors - this.showTransportError = false; - - /** - * Bind Operation Outputs - * - * if evalResult = true the result will be eval'ed by bind (internally the content type will be set to etxt/javascript - * otherwise targetDiv and onLoad may both be specified, targetDiv will be filled first - */ - - // topics that this widget will listen to. Any message received on these topics will trigger a bind operation - this.listenTopics = ""; - - // the dom id of a target div to fill with the response - this.targetDiv = ""; - - // javascript code to be executed when data arrives - arguments are (eventType, data) - this.onLoad = ""; - - // if true, we set the bind mimetype to text/javascript to cause dojo to eval the result - this.evalResult = false; - - // does the bind call use the client side cache - NOTE : doesn't seem to make IE not use the cache :( - this.useCache = false; - - var trim = function(a) { - a = a.replace( /^\s+/g, "" );// strip leading - return a.replace( /\s+$/g, "" );// strip trailing - } - - this.fillInTemplate = function() { - // subscribe to out listenTopics - - var lt = self.listenTopics.split(","); - for (var i=0; i < lt.length; i++) { - var e = trim(lt[i]); - dojo.event.topic.subscribe( e, self, "bind" ); - } - - // associate the global instance for this widget - if (self.id != "") { - window[self.id] = self; - } - - - } - - this.bind = function() { - - var args = { - load: self.load, - error: self.error, - useCache: self.useCache - }; - - // the formId can either be a id or a form refrence - if (self.formId != "") { - if (typeof formId == "object") { - args.formNode = self.formId; - }else{ - args.formNode = document.getElementById(self.formId); - } - } - - - if (self.href != "") { - args.url = this.href; - } - if (self.getHref != "") { - args.url = eval(this.getHref); - } - - if (self.evalResult) { - args.mimetype = "text/javascript"; - } - - try { - dojo.io.bind(args); - } catch (e) { - dojo.debug("EXCEPTION: " + e); - - } - - } - - this.load = function(type, data) { - - if (self.targetDiv != "") { - var div = document.getElementById(self.targetDiv); - if (div) { - var d = struts.Util.nextId(); - - // IE seems to have major issues with setting div.innerHTML in this thread !! - window.setTimeout(function() { - div.innerHTML = data; - - // create widget components from the received html - try{ - var xmlParser = new dojo.xml.Parse(); - var frag = xmlParser.parseElement(div, null, true); - dojo.widget.getParser().createComponents(frag); - // eval any scripts being returned - var scripts = div.getElementsByTagName('script'); - for (var i=0; ishowHide"); - } - } else { - //moved here to support WW-1193 - if (self.onLoad != "") { - eval(self.onLoad); - } - } - - - // notify our listeners - if (self.notifyTopics != "") { - var nt = self.notifyTopics.split(","); - for (var i=0; i < nt.length; i++) { - var topic = trim(nt[i]); - dojo.debug('notifying [' + topic + ']'); - //dojo.event.topic.publish( topic, "notify" ); - dojo.event.topic.publish(topic, self.id); - } - } - - } - - this.error = function(type, error) { - if (self.showTransportError) { - alert(error.message); - }else{ - alert(self.errorHtml); - } - } - -} - -struts.widgets.HTMLBind = struts.widgets.HTMLBind; - -// complete the inheritance process -dojo.inherits(struts.widgets.HTMLBind, dojo.widget.HtmlWidget); - -// make it a tag -dojo.widget.tags.addParseTreeHandler("dojo:bind"); - -// HACK - register this module as a widget package - to be replaced when dojo implements a propper widget namspace manager -dojo.widget.manager.registerWidgetPackage('struts.widgets'); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindAnchor.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindAnchor.html deleted file mode 100644 index 2367ec965..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindAnchor.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindAnchor.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindAnchor.js deleted file mode 100644 index 8e9e63206..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindAnchor.js +++ /dev/null @@ -1,75 +0,0 @@ -dojo.provide("struts.widgets.BindAnchor"); -dojo.provide("struts.widgets.HTMLBindAnchor"); - -dojo.require("dojo.io.*"); -dojo.require("dojo.event.*"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.xml.Parse"); - -dojo.require("struts.Util"); -dojo.require("struts.widgets.HTMLBind"); - -/* - * Component to do remote updating of a DOM tree. - */ - -struts.widgets.HTMLBindAnchor = function() { - - // inheritance - // see: http://www.cs.rit.edu/~atk/JavaScript/manuals/jsobj/ - struts.widgets.HTMLBind.call(this); - var self = this; - - this.widgetType = "BindAnchor"; - this.templatePath = dojo.uri.dojoUri("struts/widgets/BindAnchor.html"); - - // the template anchor instance - this.anchor = null; - - //a snippet of js to invode before binding - this.preInvokeJS = ""; - - var super_fillInTemplate = this.fillInTemplate; - this.fillInTemplate = function(args, frag) { - super_fillInTemplate(args, frag); - - if (self.id) { - self.anchor.id = self.id; - } - - struts.Util.passThroughArgs(self.extraArgs, self.anchor); - self.anchor.href = "javascript:{}"; - dojo.event.kwConnect({ - srcObj: self.anchor, - srcFunc: "onclick", - adviceObj: self, - adviceFunc: "execute", - adviceType: 'before' - }); - - struts.Util.passThroughWidgetTagContent(self, frag, self.anchor); - } - this.execute = function() { - var executeConnect = true; - //If the user provided some preInvokeJS invoke it and store the results into the - //executeConnect var to determine if the connect should occur - if (self.preInvokeJS != "") { - dojo.debug('Evaluating js: ' + this.preInvokeJS); - executeConnect = eval(this.preInvokeJS); - } - if (executeConnect) { - this.bind(); - } - - - } -} - -// complete the inheritance process -dojo.inherits(struts.widgets.HTMLBindAnchor, struts.widgets.HTMLBind); - -// make it a tag -dojo.widget.tags.addParseTreeHandler("dojo:BindAnchor"); - -// HACK - register this module as a widget package - to be replaced when dojo implements a propper widget namspace manager -dojo.widget.manager.registerWidgetPackage('struts.widgets'); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindButton.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindButton.html deleted file mode 100644 index 556f63c92..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindButton.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindButton.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindButton.js deleted file mode 100644 index 4df0d0b24..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindButton.js +++ /dev/null @@ -1,69 +0,0 @@ -dojo.provide("struts.widgets.BindButton"); -dojo.provide("struts.widgets.HTMLBindButton"); - -dojo.require("dojo.io.*"); -dojo.require("dojo.event.*"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.xml.Parse"); - -dojo.require("struts.Util"); -dojo.require("struts.widgets.HTMLBind"); - -/* - * Component to do a remote submit of a HTML form. - */ - -struts.widgets.HTMLBindButton = function() { - - // inheritance - // see: http://www.cs.rit.edu/~atk/JavaScript/manuals/jsobj/ - struts.widgets.HTMLBind.call(this); - var self = this; - - this.widgetType = "BindButton"; - this.templatePath = dojo.uri.dojoUri("struts/widgets/BindButton.html"); - - // dom node in the template that will contain the remote content - this.attachBtn = null; - - //a snippet of js to invode before binding - this.preInvokeJS = ""; - - var super_fillInTemplate = this.fillInTemplate; - this.fillInTemplate = function(args, frag) { - super_fillInTemplate(args, frag); - - if (self.id) { - self.attachBtn.id = self.id; - } - - struts.Util.passThroughArgs(self.extraArgs, self.attachBtn); - } - - this.execute = function() { - var executeConnect = true; - - //If the user provided some preInvokeJS invoke it and store the results into the - //executeConnect var to determine if the connect should occur - if (self.preInvokeJS != "") { - dojo.debug('Evaluating js: ' + this.preInvokeJS); - executeConnect = eval(this.preInvokeJS); - } - if (executeConnect) { - try { - this.bind(); - } catch (e) { - dojo.debug("EXCEPTION: " + e); - - } - } - } -} - -dojo.inherits(struts.widgets.HTMLBindButton, struts.widgets.HTMLBind); - -// make it a tag -dojo.widget.tags.addParseTreeHandler("dojo:BindButton"); - -// HACK - register this module as a widget package - to be replaced when dojo implements a propper widget namspace manager -dojo.widget.manager.registerWidgetPackage('struts.widgets'); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindDiv.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindDiv.html deleted file mode 100644 index 0b4de9c34..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindDiv.html +++ /dev/null @@ -1,2 +0,0 @@ -
        - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindDiv.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindDiv.js deleted file mode 100644 index d5f9b4cbe..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/BindDiv.js +++ /dev/null @@ -1,157 +0,0 @@ -dojo.provide("struts.widgets.BindDiv"); -dojo.provide("struts.widgets.HTMLBindDiv"); - -dojo.require("dojo.io.*"); -dojo.require("dojo.event.*"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.xml.Parse"); - -dojo.require("struts.Util"); -dojo.require("struts.widgets.HTMLBind"); - -/* - * Component to do remote updating of a DOM tree. - */ - -struts.widgets.HTMLBindDiv = function() { - - // inheritance - // see: http://www.cs.rit.edu/~atk/JavaScript/manuals/jsobj/ - struts.widgets.HTMLBind.call(this); - var self = this; - - this.widgetType = "BindDiv"; - this.templatePath = dojo.uri.dojoUri("struts/widgets/BindDiv.html"); - - - // register a global object to use for window.setTimeout callbacks - this.callback = struts.Util.makeGlobalCallback(this); - - // - // default properties that can be provided by the widget user - // - - // html to display while loading remote content - this.loadingHtml = ""; - - // initial dealy before fetching content - this.delay = 0; - - // how often to update the content from the server, after the initial delay - this.refresh = 0; - - // does the timeout loop start automatically ? - this.autoStart = true; - - // dom node in the template that will contain the remote content - this.contentDiv = null; - - // support a toggelable div - each listenEvent will trigger a change in the display state - // the bind call will only happen when the remote div is displayed - this.toggle = false; - - this._nextTimeout = function(millis) { - struts.Util.setTimeout(self.callback, "afterTimeout", millis); - } - - var super_fillInTemplate = this.fillInTemplate; - this.fillInTemplate = function(args, frag) { - super_fillInTemplate(args, frag); - - if (self.id == "") { - self.contentDiv.id = struts.Util.nextId(); - }else { - self.contentDiv.id = self.id; - } - - self.targetDiv = self.contentDiv.id; - - struts.Util.passThroughArgs(self.extraArgs, self.contentDiv); - struts.Util.passThroughWidgetTagContent(self, frag, self.contentDiv); - - // hook into before the bind operation to display the loading message - // do this always - to allow for on the fuy changes to the loadingHtml - dojo.event.kwConnect({ - srcObj: self, - srcFunc: "bind", - adviceObj: self, - adviceFunc: "loading" - }); - - if (self.autoStart) { - self.start(); - } - - if (self.toggle) { - dojo.event.kwConnect({ - type: 'around', - srcObj: self, - srcFunc: "bind", - adviceObj: self, - adviceFunc: "__toggleInterceptor" - }); - } - - } - - this.__toggleInterceptor = function(invocation) { - var hidden = self.contentDiv.style.display == 'none'; - self.contentDiv.style.display = (hidden)?'':'none'; - if (hidden) { - invocation.proceed(); - } - } - - this.error = function(type, error) { - //for (a in error) dojo.debug("error." + a + ":" + error[a]); - if (self.showTransportError) { - self.contentDiv.innerHTML = error.message; - }else{ - self.contentDiv.innerHTML = self.errorHtml; - } - } - - this.loading = function() { - if( self.loadingHtml != "" ) { - self.contentDiv.innerHTML = self.loadingHtml; - } - } - - this.afterTimeout = function() { - if (running) { - - // do the bind - self.bind(); - - // setup the next timeout - if (self.refresh > 0) { - self._nextTimeout(self.refresh); - } - } - } - - - var running = false; - this.stop = function() { - if (!running) return; - running = false; - struts.Util.clearTimeout(self.callback); - } - - this.start = function() { - if (running) return; - running = true; - - if (self.delay > 0) { - self._nextTimeout(self.delay); - } - } - -} -dojo.inherits(struts.widgets.HTMLBindDiv, struts.widgets.HTMLBind); - -// make it a tag -dojo.widget.tags.addParseTreeHandler("dojo:BindDiv"); - -// HACK - register this module as a widget package - to be replaced when dojo implements a propper widget namspace manager -dojo.widget.manager.registerWidgetPackage('struts.widgets'); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js deleted file mode 100644 index dcee99425..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Struts2 - * ======= - * - * This is a simple DateTimeUtil used by Struts2 DatePicker and TimePicker. - * Its a pretty crude one, and there's lots of room for improvement. Please - * feel free to improve it if you like. - * - * It's main methods are :- - * - struts.widgets.DateTimeUtil.parseDate(date, format); - * - struts.widgets.DateTimeUtil.parseTime(date, format); - * - struts.widgets.DateTimeUtil.parseDateTime(date, format); - * - * which parse the 'date' string using the 'format' specifed and return a - * js Date object. If not parsing is possible, it will just return the current - * date as a Date object. - * - * version $Date$ $Id$ - */ -dojo.provide("struts.widgets.DateTimeUtil"); - -struts.widgets.DateTimeUtil.parseDate = function(date, format) { - var _d = new Date(); - struts.widgets.DateTimeUtil.tryToParseForDay(_d, date, format); - struts.widgets.DateTimeUtil.tryToParseForMonth(_d, date, format); - struts.widgets.DateTimeUtil.tryToParseForYear(_d, date, format); - return _d; -} - -struts.widgets.DateTimeUtil.parseTime = function(date, format) { - var _d = new Date(); - struts.widgets.DateTimeUtil.tryToParseForHours(_d, date, format); - struts.widgets.DateTimeUtil.tryToParseForMinutes(_d, date, format); - return _d; -} - -struts.widgets.DateTimeUtil.parseDateTime = function(date, format) { - var _d = new date(); - struts.widgets.DateTimeUtil.tryToParseForDay(_d, date, format); - struts.widgets.DateTimeUtil.tryToParseForMonth(_d, date, format); - struts.widgets.DateTimeUtil.tryToParseForYear(_d, date, format); - struts.widgets.DateTimeUtil.tryToParseForHours(_d, date, format); - struts.widgets.DateTimeUtil.tryToPraseForMinutes(_d, date, format); - return _d; -} - - -struts.widgets.DateTimeUtil.tryToParseForDay = function(dateObj, date, format) { - var tmp = format; - var _function; - - if (tmp.indexOf("#dd") > -1) { - tmp = tmp.replace(/#dd/g, "(\\d+)"); - _function = function(dateObject, day) { - dateObject.setDate(day); - } - } - else if (tmp.indexOf("#d") > -1) { - tmp = tmp.replace(/#d/g, "(\\d+)"); - _function = function(dateObject, day) { - dateObject.setDate(day); - } - } - - if (tmp.indexOf("#M") > -1) { - tmp = tmp.replace(/#MMMM/g, "\\w+"); - tmp = tmp.replace(/#MMM/g, "\\w+"); - tmp = tmp.replace(/#MM/g, "\\w+"); - tmp = tmp.replace(/#M/g, "\\w+"); - } - - if (tmp.indexOf("#y") > -1) { - tmp = tmp.replace(/#yyyy/g, "\\w+"); - tmp = tmp.replace(/#yy/g, "\\w+"); - tmp = tmp.replace(/#y/g, "\\w+"); - } - - var regexp = tmp; - var rg = new RegExp("\\b"+regexp+"\\b", "g"); - var r = rg.exec(date); - if (r && r.length >= 1 && _function) { - _function(dateObj, r[1]); - } -} - - -struts.widgets.DateTimeUtil.tryToParseForMonth = function(dateObj, date, format) { - var tmp = format; - var _function; - - if (tmp.indexOf("#MM") > -1) { - tmp = tmp.replace(/#MM/g, "(\\d+)"); - _function = function(dateObject, month) { - dateObject.setMonth(month - 1); - } - } - else if (tmp.indexOf("#M") > -1) { - tmp = tmp.replace(/#M/g, "(\\d+)"); - _function = function(dateObject, month) { - dateObject.setDate(month - 1); - } - } - - if (tmp.indexOf("#d") > -1) { - tmp = tmp.replace(/#dddd/g, "\\w+"); - tmp = tmp.replace(/#ddd/g, "\\w+"); - tmp = tmp.replace(/#dd/g, "\\w+"); - tmp = tmp.replace(/#d/g, "\\w+"); - } - - if (tmp.indexOf("#y") > -1) { - tmp = tmp.replace(/#yyyy/g, "\\w+"); - tmp = tmp.replace(/#yy/g, "\\w+"); - tmp = tmp.replace(/#y/g, "\\w+"); - } - - var regexp = tmp; - var rg = new RegExp("\\b"+regexp+"\\b", "g"); - var r = rg.exec(date); - if (r && r.length >= 1 && _function) { - _function(dateObj, r[1]); - } -} - - -struts.widgets.DateTimeUtil.tryToParseForYear = function(dateObj, date, format) { - var tmp = format; - var _function; - - if (tmp.indexOf("#yyyy") > -1) { - tmp = tmp.replace(/#yyyy/g, "(\\d+)"); - _function = function(dateObject, year) { - dateObject.setYear(year); - } - } - else if (tmp.indexOf("#yy") > -1) { - tmp = tmp.replace(/#yy/g, "(\\d+)"); - _function = function(dateObject, year) { - var _d = new Date(); - var _y = _d.getFullYear().substring(0, 2)+''+year; - dateObject.setYear(_y); - } - } - else if (tmp.indexOf("#y") > -1) { - tmp = tmp.replace(/#y/g, "(\\d+)"); - _function = function(dateObject, year) { - var _d = new Date(); - var _y = _d.getFullYear().substring(0, 3)+''+year; - dateObject.setYear(_y); - } - } - - if (tmp.indexOf("#d") > -1) { - tmp = tmp.replace(/#dddd/g, "\\w+"); - tmp = tmp.replace(/#ddd/g, "\\w+"); - tmp = tmp.replace(/#dd/g, "\\w+"); - tmp = tmp.replace(/#d/g, "\\w+"); - } - - if (tmp.indexOf("#M") > -1) { - tmp = tmp.replace(/#MMMM/g, "\\w+"); - tmp = tmp.replace(/#MMM/g, "\\w+"); - tmp = tmp.replace(/#MM/g, "\\w+"); - tmp = tmp.replace(/#M/g, "\\w+"); - } - - var regexp = tmp; - var rg = new RegExp("\\b"+regexp+"\\b", "g"); - var r = rg.exec(date); - if (r && r.length >= 1 && _function) { - _function(dateObj, r[1]); - } -} - - -struts.widgets.DateTimeUtil.tryToParseForHours = function(dateObj, date, format) { - var tmp = format; - var _function; - - if (tmp.indexOf("#h") > -1) { - tmp = tmp.replace(/#hh/g, "(\\d+)"); - tmp = tmp.replace(/#h/g, "(\\d+)"); - _function = function(dateObj, hour) { - dateObj.setHours(hour); - } - } - if (tmp.indexOf("#H") > -1) { - tmp = tmp.replace(/#HH/g, "(\\d+)"); - tmp = tmp.replace(/#H/g, "(\\d+)"); - _function = function(dateObj, hour) { - dateObj.setHours(hour); - } - } - if (tmp.indexOf("#m") > -1) { - tmp = tmp.replace(/#mm/g, "\\w+"); - tmp = tmp.replace(/#m/g, "\\w+"); - } - if (tmp.indexOf("#T") > -1) { - tmp = tmp.replace(/#TT/g, "\\w+"); - tmp = tmp.replace(/#T/g, "\\w+"); - } - if (tmp.indexOf("#t") > -1) { - tmp = tmp.replace(/#tt/g, "\\w+"); - tmp = tmp.replace(/#t/g, "\\w+"); - } - var regexp = tmp; - var rg = new RegExp("\\b"+tmp+"\\b", "g"); - var r = rg.exec(date); - if (r && r.length >= 1 && _function) { - _function(dateObj, r[1]); - } -} - -struts.widgets.DateTimeUtil.tryToParseForMinutes = function(dateObj, date, format) { - var tmp = format; - var _function; - - if (tmp.indexOf("#m") > -1) { - tmp = tmp.replace(/#mm/g, "(\\d+)"); - tmp = tmp.replace(/#m/g, "(\\d+)"); - _function = function(dateObj, minutes) { - dateObj.setMinutes(minutes); - } - } - if (tmp.indexOf("#H") > -1) { - tmp = tmp.replace(/#HH/g, "\\w+"); - tmp = tmp.replace(/#H/g, "\\w+"); - } - if (tmp.indexOf("#h") > -1) { - tmp = tmp.replace(/#hh/g, "\\w+"); - tmp = tmp.replace(/#h/g, "\\w+"); - } - if (tmp.indexOf("#T") > -1) { - tmp = tmp.replace(/#TT/g, "\\w+"); - tmp = tmp.replace(/#T/g, "\\w+"); - } - if (tmp.indexOf("#t") > -1) { - tmp = tmp.replace(/#tt/g, "\\w+"); - tmp = tmp.replace(/#t/g, "\\w+"); - } - var regexp = tmp; - var rg = new RegExp("\\b"+tmp+"\\b", "g"); - var r = rg.exec(date); - if (r && r.length >= 1 && _function) { - _function(dateObj, r[1]); - } -} - - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js deleted file mode 100644 index 1ca997e10..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js +++ /dev/null @@ -1,54 +0,0 @@ -dojo.provide("struts.widgets.DropDownDatePicker"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.DatePicker"); -dojo.require("dojo.event.*"); -dojo.require("dojo.html"); -dojo.require("struts.widgets.DropdownContainer"); -dojo.require("struts.widgets.DateTimeUtil"); - -struts.widgets.DropDownDatePicker = function () { - struts.widgets.DropdownContainer.call(this); - this.widgetType = "DropDownDatePicker"; - - this.initUI = function() { - var properties = { - widgetContainerId: this.widgetId - } - - this.subWidgetRef = dojo.widget.createWidget("DatePicker", properties, this.subWidgetNode); - dojo.event.connect(this.subWidgetRef, "onSetDate", this, "onPopulate"); - dojo.event.connect(this.valueInputNode, "onkeyup", this, "onInputChange"); - this.onUpdateDate = function(evt) { - this.storedDate = evt.storedDate; - } - this.onInputChange(); - } - - this.onPopulate = function() { - this.valueInputNode.value = dojo.date.toString(this.subWidgetRef.date, this.dateFormat); - } - - this.onInputChange = function(){ - //var test = new Date(this.valueInputNode.value); - var test = struts.widgets.DateTimeUtil.parseDate(this.valueInputNode.value, this.dateFormat); - this.subWidgetRef.date = test; - this.subWidgetRef.setDate(dojo.widget.DatePicker.util.toRfcDate(test)); - this.subWidgetRef.initUI(); - //this.onPopulate(); - } -} - -dojo.inherits(struts.widgets.DropDownDatePicker, struts.widgets.DropdownContainer); -dojo.widget.tags.addParseTreeHandler("dojo:dropdowndatepicker"); -dojo.lang.extend(struts.widgets.DropDownDatePicker, { - - // default attributes - dateFormat: "#MM/#dd/#yyyy", - iconPath: "/struts/dojo/struts/widgets/dateIcon.gif", - iconAlt: "date", - iconTitle: "Select a date", - inputWidth:"7em" - -}); - diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js deleted file mode 100644 index 35521576a..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js +++ /dev/null @@ -1,46 +0,0 @@ -dojo.provide("struts.widgets.DropDownTimePicker"); -dojo.require("struts.widgets.DropdownContainer"); -dojo.require("dojo.widget.html.TimePicker"); -dojo.require("struts.widgets.DateTimeUtil"); - -struts.widgets.DropDownTimePicker = function() { - struts.widgets.DropdownContainer.call(this); - this.widgetType = "DropDownTimePicker"; - var timeFormat = "#hh:#mm #TT"; - - this.initUI = function() { - var properties = { - widgetContainerId: this.widgetId - } - - this.subWidgetRef = dojo.widget.createWidget("TimePicker", properties, this.subWidgetNode); - dojo.event.connect(this.subWidgetRef, "onSetTime", this, "onPopulate"); - dojo.event.connect(this.valueInputNode, "onkeyup", this, "onInputChange"); - this.onInputChange(); - } - - this.onPopulate = function() { - this.valueInputNode.value = dojo.date.toString(this.subWidgetRef.time, this.timeFormat); - } - - this.onInputChange = function(){ - if (this.valueInputNode.value && this.valueInputNode.value.toString().length > 0) { - var test = struts.widgets.DateTimeUtil.parseTime(this.valueInputNode.value, this.timeFormat); - // test.setTime(this.valueInputNode.value); - this.subWidgetRef.time = test; - this.subWidgetRef.setDateTime(dojo.widget.TimePicker.util.toRfcDateTime(test)); - this.subWidgetRef.initUI(); - //this.onPopulate(); - } - } -} - -dojo.inherits(struts.widgets.DropDownTimePicker, struts.widgets.DropdownContainer); -dojo.widget.tags.addParseTreeHandler("dojo:dropdowntimepicker"); -dojo.lang.extend(struts.widgets.DropDownTimePicker, { - timeFormat: "#hh:#mm #TT", - iconPath: "/struts/dojo/struts/widgets/timeIcon.gif", - iconAlt: "time", - iconTitle: "Select a time", - inputWidth:"7em" -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js deleted file mode 100644 index 5b9cb541f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js +++ /dev/null @@ -1,75 +0,0 @@ -dojo.provide("struts.widgets.DropdownContainer"); -dojo.require("dojo.widget.*"); -dojo.require("dojo.widget.HtmlWidget"); -dojo.require("dojo.widget.DatePicker"); -dojo.require("dojo.event.*"); -dojo.require("dojo.html"); - -struts.widgets.DropdownContainer = function(){ - // this is just an interface that gets mixed in - dojo.widget.HtmlWidget.call(this); - this.widgetType = "DropdownContainer"; - - this.iconPath; - this.iconAlt; - this.iconTitle; - this.value; - - this.templatePath = dojo.uri.dojoUri("struts/widgets/dropdowncontainer.html"); - this.templateCssPath = dojo.uri.dojoUri("struts/widgets/dropdowncontainer.css"); - //this.templateString = '
        '; - //this.templateCssPath = ""; - - this.fillInTemplate = function(args, frag) { - try { - var source = this.getFragNodeRef(frag); - var txt = source.getElementsByTagName("input")[0]; - this.domNode.insertBefore(txt, this.valueInputNode); - this.domNode.removeChild(this.valueInputNode); - this.valueInputNode = txt - } catch (e) {alert("ex:"+e);} - - - this.subWidgetContainerNode.style.left = ""; - this.subWidgetContainerNode.style.top = ""; - - this.valueInputNode.style.width = this.inputWidth; - if (this.value) { - this.valueInputNode.value = this.value; - } - - this.containerDropdownNode.src = this.iconPath; - this.containerDropdownNode.alt = this.iconAlt; - this.containerDropdownNode.title = this.iconTitle; - - this.initUI(); - } - - this.initUI = function() { - // subclass should overrides this to init the UI in this container - } - - this.onPopulate = function() { - } - - this.onInputChange = function(){ - } - - this.onDropdown = function(evt) { - this.show(this.subWidgetContainerNode.style.display == "block"); - } - - this.show = function(bool) { - this.subWidgetContainerNode.style.display = (bool) ? "none" : "block"; - } - - this.onHide = function(evt) { - this.show(false); - } -} - -dojo.inherits(struts.widgets.DropdownContainer, dojo.widget.HtmlWidget); -dojo.widget.tags.addParseTreeHandler("dojo:dropdowncontainer"); -dojo.lang.extend(struts.widgets.DropdownContainer, { - -}); diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DynArchCalendar.html b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DynArchCalendar.html deleted file mode 100644 index 5a84db49f..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DynArchCalendar.html +++ /dev/null @@ -1,4 +0,0 @@ -
        -
        - -
        diff --git a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DynArchCalendar.js b/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DynArchCalendar.js deleted file mode 100644 index dddbed623..000000000 --- a/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DynArchCalendar.js +++ /dev/null @@ -1,151 +0,0 @@ -dojo.provide("struts.widgets.DynArchCalendar"); -dojo.provide("struts.widgets.HTMLDynArchCalendar"); - -dojo.require("dojo.io.*"); - -dojo.require("dojo.event.*"); - -dojo.require("dojo.xml.Parse"); -dojo.require("dojo.widget.*"); - -dojo.require("struts.Util"); - -/* - * Component to do remote updating of a DOM tree. - */ - -struts.widgets.HTMLDynArchCalendar = function() { - - dojo.widget.DomWidget.call(this); - dojo.widget.HTMLWidget.call(this); - - - this.templatePath = "struts/widgets/DynArchCalendar.html"; - this.widgetType = "DynArchCalendar"; - - var self = this; - - // default properties - - // the name of the global javascript variable to associate with this widget instance - this.id = ""; - - // the text input box - this.inputField = null; - this.inputFieldStyle = ""; - - this.controlsDiv = null; - - // the trigger button - this.button = null; - - // display the calendar as a flat control, or a popup control - this.flat = false; - - var argNames = [ - 'inputField', - 'displayArea', - 'button', - 'eventName', - 'ifFormat', - 'daFormat', - 'singleClick', - 'firstDay', - 'align', - 'range', - 'weekNumbers', - 'flat', - 'date', - 'showsTime', - 'timeFormat', - 'electric', - 'step', - 'position', - 'cache', - 'showOthers' - ]; - var functionArgs = [ - 'flatCallback', - 'disableFunc', - 'onSelect', - 'onClose', - 'onUpdate', - ] - - this.fillInTemplate = function(args, frag) { - - if (!Calendar) { - dojo.debug("DynArch Calendar Script not included"); - return; - } - - // expost this widget instance globally - if (self.id != "") window[self.id] = self; - - self.controlsDiv.id = struts.Util.nextId(); - - var params = {}; - - if (self.flat) { - params.flat = self.controlsDiv; - }else{ - self.inputField = document.createElement("input"); - self.inputField.type = 'text'; - self.inputField.id = struts.Util.nextId(); - - self.button = document.createElement("input"); - self.button.id = struts.Util.nextId(); - self.button.type = 'button'; - self.button.value = ' ... '; - - self.controlsDiv.appendChild(self.inputField); - self.controlsDiv.appendChild(self.button); - - if (self.inputFieldStyle != "") - self.inputField.style.cssText = self.inputFieldStyle; - - if (self.inputFieldClass != "") - self.inputField.className = self.inputFieldClass; - } - - - struts.Util.copyProperties(self.extraArgs, params); - - // fix the case of args - since they are all made lowercase by the fragment parser - for (var i=0; i