You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by cr...@apache.org on 2006/07/03 22:58:38 UTC
svn commit: r418848 [1/2] - in
/struts/shale/trunk/shale-core/src/main/java/org/apache/shale: application/
component/ dialog/ dialog/config/ dialog/impl/ faces/ taglib/ util/
validator/ view/ view/faces/ view/impl/
Author: craigmcc
Date: Mon Jul 3 13:58:36 2006
New Revision: 418848
URL: http://svn.apache.org/viewvc?rev=418848&view=rev
Log:
Knock off about 600 of the simplest Checkstyle reported violations on
the core library ... but only about half way through the inital reports.
Modified:
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/application/RemoteAddrFilter.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Token.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Dialog.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/State.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Status.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/config/ConfigurationParser.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/AbstractState.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ActionStateImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/DialogImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/EndStateImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/SubdialogStateImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/TransitionImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ViewStateImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/faces/ValidatorRenderKit.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/CommonsValidatorTag.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/SubviewTag.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/TokenTag.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/ValidatorVarTag.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/LoadBundle.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/Tags.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/TokenProcessor.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/validator/CommonsValidator.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/AbstractFacesBean.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/AbstractRequestBean.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/Constants.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/ViewController.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/ViewControllerMapper.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/faces/CallbacksFactory.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ExceptionHandlerFactory.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ExceptionHandlerImpl.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/faces/LifecycleListener.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewActionListener.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewControllerCallbacks.java
struts/shale/trunk/shale-core/src/main/java/org/apache/shale/view/impl/DefaultViewControllerMapper.java
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/application/RemoteAddrFilter.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/application/RemoteAddrFilter.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/application/RemoteAddrFilter.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/application/RemoteAddrFilter.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@
* @see AbstractRegExpFilter
*/
public class RemoteAddrFilter extends AbstractRegExpFilter {
-
+
// ------------------------------------------------------- Protected Methods
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,11 +40,11 @@
* $Id$
*/
public class Subview extends UINamingContainer {
-
-
+
+
// -------------------------------------------------------- Static Variables
-
+
/**
* <p>Log instance for this class.</p>
*/
@@ -175,9 +175,9 @@
/**
- * <p>Return the <code>ViewControllerCallbacks</code. instance to be used
+ * <p>Return the <code>ViewControllerCallbacks</code> instance to be used
* to forward prerender and preprocess callbacks to our view controller,
- * whether or not it implements the <code>ViewController</code. interface
+ * whether or not it implements the <code>ViewController</code> interface
* (it may not if it is using the <code>@View</code> annotation from the
* shale-tiger module).</p>
*
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Token.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Token.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Token.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/component/Token.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@
* $Id$
*/
public class Token extends UIInput {
-
+
// -------------------------------------------------------- Static Variables
@@ -55,8 +55,8 @@
* <p>The resource bundle <code>messageDetail</code> key.</p>
*/
private static final String MESSAGE_DETAIL_KEY = "token.detail.invalid";
-
-
+
+
/**
* <p>Local component attribute under which we store the token value
* the first time it is generated.</p>
@@ -65,7 +65,7 @@
/**
- * <p>Message resources for this class
+ * <p>Message resources for this class.</p>
*/
private static Messages messages =
new Messages("org.apache.shale.resources.Bundle",
@@ -75,63 +75,71 @@
// ------------------------------------------------------------ Constructors
/**
- * <p>A validation message summary override that can be used to change the default
+ * <p>A validation message summary override that can be used to change the default
* validation message summary when the token verification fails.</p>
*/
private String messageSummary = null;
-
+
/**
- * <p>Returns the validation <code>messageSummary</code> used to create a
+ * <p>Returns the validation <code>messageSummary</code> used to create a
* <code>FacesMessage.SEVERITY_ERROR</code>.</p>
*/
public String getMessageSummary() {
- if (null != messageSummary)
+ if (null != messageSummary) {
return messageSummary;
+ }
ValueBinding valuebinding = getValueBinding("messageSummary");
- if (valuebinding != null)
+ if (valuebinding != null) {
return (String) valuebinding.getValue(getFacesContext());
- else
+ } else {
return null;
+ }
}
-
+
/**
* <p>Sets a <code>messageSummary</code> override used when reporting
* a token verification failure.</p>
+ *
+ * @param message The new message summary
*/
public void setMessageSummary(String message) {
this.messageSummary = message;
}
-
+
/**
- * <p>A validation message detail override that can be used to change the default
+ * <p>A validation message detail override that can be used to change the default
* validation message detail when the token verification fails.</p>
*/
private String messageDetail = null;
-
+
/**
- * <p>Returns the validation <code>messageDetail</code> used to create a
+ * <p>Returns the validation <code>messageDetail</code> used to create a
* <code>FacesMessage.SEVERITY_ERROR</code>.</p>
*/
public String getMessageDetail() {
- if (null != messageDetail)
+ if (null != messageDetail) {
return messageDetail;
+ }
ValueBinding valuebinding = getValueBinding("messageDetail");
- if (valuebinding != null)
+ if (valuebinding != null) {
return (String) valuebinding.getValue(getFacesContext());
- else
+ } else {
return null;
+ }
}
-
+
/**
* <p>Sets a <code>messageDetail</code> override used when reporting
* a token verification failure.</p>
+ *
+ * @param message The new message detail
*/
public void setMessageDetail(String message) {
this.messageDetail = message;
}
-
-
+
+
/**
* <p>Create a default instance of this component.</p>
*/
@@ -193,82 +201,87 @@
}
}
-
+
/**
- * <p>Returns the validation summary message.
- * The validation <code>messageSummary</code> is evaluated in the following order:
+ * <p>Returns the validation summary message. The validation
+ * <code>messageSummary</code> is evaluated in the following order:</p>
* <ol>
- * <li><p>The <code>messageSummary</code> property on the {@link Token} component is the
- * first order of override.</p></li>
- * <li><p>The next level of override is a custom resource bundled registered
- * in the faces-config.xml using the message key of <strong>token.summary.invalid</strong>.
- * <br/><br/>
+ * <li>The <code>messageSummary</code> property on the {@link Token}
+ * component</li>
+ * <li>A custom resource bundled registered in
+ * <code>faces-config.xml</code> using the message key of
+ * <strong>token.summary.invalid</strong>.
* <p><blockquote><pre>
* <application>
* <messageSummary-bundle>org.acme.resources.Bundle</messageSummary-bundle>
* </application>
*</pre></blockquote></p></li>
- *<li>The default will be taken from <strong>org.apache.shale.resources.Bundle</strong>
- *packaged in the core shale java archive. The default message summary is
- *"<strong>Invalid resubmit of the same form</strong>".</p></li>
- *</ol></p>
+ * <li>The default will be taken from
+ * <strong>org.apache.shale.resources.Bundle</strong> packaged
+ * in the core Shale java archive. The default message summary
+ * is "<strong>Invalid resubmit of the same form</strong>".</li>
+ *</ol>
*
* @param context faces context
* @return invalid token message
*/
private String getErrorSummaryMessage(FacesContext context) {
- String msg = null;
- if ((msg = getMessageSummary()) == null) {
- String bundleName = null;
- if ((bundleName = context.getApplication().getMessageBundle()) != null) {
- LoadBundle loadBundle = new LoadBundle(bundleName);
- msg = (String) loadBundle.getMap().get(MESSAGE_SUMMARY_KEY);
- }
- }
-
- if (msg == null)
- msg = messages.getMessage(MESSAGE_SUMMARY_KEY);
-
- return msg;
+
+ String msg = getMessageSummary();
+ if (msg == null) {
+ String bundleName = context.getApplication().getMessageBundle();
+ if (bundleName != null) {
+ LoadBundle loadBundle = new LoadBundle(bundleName);
+ msg = (String) loadBundle.getMap().get(MESSAGE_SUMMARY_KEY);
+ }
+ }
+ if (msg == null) {
+ msg = messages.getMessage(MESSAGE_SUMMARY_KEY);
+ }
+ return msg;
+
}
-
+
/**
- * <p>Returns the validation detail message.
- * The validation <code>messageDetail</code> is evaluated in the following order:
+ * <p>Returns the validation detail message. The validation
+ * <code>messageDetail</code> is evaluated in the following order:</p>
* <ol>
- * <li><p>The <code>messageDetail</code> property on the {@link Token} component is the
- * first order of override.</p></li>
- * <li><p>The next level of override is a custom resource bundled registered
- * in the faces-config.xml using the message key of <strong>token.detail.invalid</strong>.
- * <br/><br/>
+ * <li>The <code>messageDetail</code> property on the {@link Token}
+ * component</li>
+ * <li>A custom resource bundled registered in
+ * <code>faces-config.xml</code> using the message key of
+ * <strong>token.detail.invalid</strong>.
* <p><blockquote><pre>
* <application>
* <messageSummary-bundle>org.acme.resources.Bundle</messageSummary-bundle>
* </application>
- *</pre></blockquote></p></li>
- *<li>The default will be taken from <strong>org.apache.shale.resources.Bundle</strong>
- *packaged in the core shale java archive. The default message detail is
- *an empty string, "".</p></li>
- *</ol></p>
+ * </pre></blockquote></p></li>
+ * <li>The default will be taken from
+ * <strong>org.apache.shale.resources.Bundle</strong>
+ * packaged in the core Shale java archive.</li>
+ * <li>The default message detail is
+ * an empty string, ""</li>
+ *</ol>
*
* @param context faces context
* @return invalid token message
*/
private String getErrorDetailMessage(FacesContext context) {
- String msg = null;
- if ((msg = getMessageDetail()) == null) {
- String bundleName = null;
- if ((bundleName = context.getApplication().getMessageBundle()) != null) {
- LoadBundle loadBundle = new LoadBundle(bundleName);
- msg = (String) loadBundle.getMap().get(MESSAGE_DETAIL_KEY);
- }
- }
-
- if (msg == null)
- msg = messages.getMessage(MESSAGE_DETAIL_KEY);
-
- return msg;
+
+ String msg = getMessageDetail();
+ if (msg == null) {
+ String bundleName = context.getApplication().getMessageBundle();
+ if (bundleName != null) {
+ LoadBundle loadBundle = new LoadBundle(bundleName);
+ msg = (String) loadBundle.getMap().get(MESSAGE_DETAIL_KEY);
+ }
+ }
+ if (msg == null) {
+ msg = messages.getMessage(MESSAGE_DETAIL_KEY);
+ }
+ return msg;
+
}
@@ -326,24 +339,29 @@
/**
* <p>Restores the components state.</p>
+ *
+ * @param context FacesContext for the current request
+ * @param obj State to be restored
*/
public void restoreState(FacesContext context, Object obj) {
Object[] aobj = (Object[]) obj;
super.restoreState(context, aobj[0]);
-
+
messageSummary = ((String) aobj[1]);
messageDetail = ((String) aobj[2]);
}
/**
* <p>Saves the components state.</p>
+ *
+ * @param context FacesContext for the current request
*/
public Object saveState(FacesContext context) {
Object[] aobj = new Object[3];
aobj[0] = super.saveState(context);
aobj[1] = messageSummary;
aobj[2] = messageDetail;
-
+
return aobj;
}
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Dialog.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Dialog.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Dialog.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Dialog.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,7 +42,7 @@
*/
public interface Dialog {
-
+
// -------------------------------------------------------------- Properties
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/State.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/State.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/State.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/State.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,7 @@
*/
public interface State {
-
+
// -------------------------------------------------------------- Properties
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Status.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Status.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Status.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/Status.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@
*/
public interface Status extends Serializable {
-
+
// -------------------------------------------------------------- Properties
@@ -89,7 +89,7 @@
* @exception IllegalStateException if there is no currently executing
* dialog
*/
- public Position pop();
+ public Position pop() throws IllegalStateException;
/**
@@ -101,7 +101,7 @@
* @exception IllegalArgumentException if <code>position</code>
* is <code>null</code>
*/
- public void push(Position position);
+ public void push(Position position) throws IllegalArgumentException;
/**
@@ -113,7 +113,7 @@
* @exception IllegalStateException if there is no currently executing
* dialog
*/
- public void transition(String stateName);
+ public void transition(String stateName) throws IllegalStateException;
// --------------------------------------------------- Position Nested Class
@@ -137,7 +137,14 @@
this.stateName = stateName;
}
+ /**
+ * <p>The dialog name of this position.</p>
+ */
private String dialogName = null;
+
+ /**
+ * <p>The state name of this position.</p>
+ */
private String stateName = null;
/**
@@ -156,6 +163,8 @@
/**
* <p>Set the state name corresponding to this position.</p>
+ *
+ * @param stateName The new state name
*/
public void setStateName(String stateName) {
this.stateName = stateName;
@@ -179,8 +188,8 @@
public boolean equals(Object o) {
if (o instanceof Position) {
Position p = (Position) o;
- return this.dialogName.equals(p.getDialogName()) &&
- this.stateName.equals(p.getStateName());
+ return this.dialogName.equals(p.getDialogName())
+ && this.stateName.equals(p.getStateName());
} else {
return false;
}
@@ -191,8 +200,8 @@
* <p>Return a string representation of this position.</p>
*/
public String toString() {
- return "Position[dialogName=" + this.dialogName + ",stateName=" +
- this.stateName + "]";
+ return "Position[dialogName=" + this.dialogName
+ + ",stateName=" + this.stateName + "]";
}
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/config/ConfigurationParser.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/config/ConfigurationParser.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/config/ConfigurationParser.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/config/ConfigurationParser.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,7 +45,7 @@
*/
public class ConfigurationParser {
-
+
// ------------------------------------------------------ Instance Variables
@@ -180,7 +180,7 @@
// Register local copy of our DTDs
for (int i = 0; i < REGISTRATIONS.length; i += 2) {
- URL url = this.getClass().getResource(REGISTRATIONS[i+1]);
+ URL url = this.getClass().getResource(REGISTRATIONS[i + 1]);
digester.register(REGISTRATIONS[i], url.toString());
}
@@ -272,8 +272,19 @@
// -------------------------------------------- Private Rule Implementations
+ /**
+ * <p>Custom <code>Digester</code> rule to add a dialog.</p>
+ */
static class AddDialogRule extends Rule {
+ /**
+ * <p>Process the "end" event for this rule.</p>
+ *
+ * @param namespace XML namespace of this element
+ * @param name Name of this element
+ *
+ * @exception Exception if a processing exception occurs
+ */
public void end(String namespace, String name) throws Exception {
Dialog dialog = (Dialog) getDigester().peek();
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/AbstractState.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/AbstractState.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/AbstractState.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/AbstractState.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@
*/
public abstract class AbstractState implements State {
-
+
// ------------------------------------------------------ Instance Variables
@@ -131,7 +131,7 @@
* @exception IllegalArgumentException if the specified {@link Transition}
* cannot be added to this {@link State}
*/
- public void addTransition(Transition transition) {
+ public void addTransition(Transition transition) throws IllegalArgumentException {
// FIXME - addTransition() - ignore duplicate outcomes for now
transitions.put(transition.getOutcome(), transition);
@@ -157,9 +157,6 @@
* <p>Set the {@link Dialog} that owns this {@link State}.</p>
*
* @param dialog New owning {@link Dialog}
- *
- * @exception IllegalArgumentException if this {@link State} cannot be
- * added to the specified {@link Dialog}
*/
public void setDialog(Dialog dialog) {
@@ -174,9 +171,6 @@
* among the {@link State}s owned by the same {@link Dialog}.</p>
*
* @param name New identifier
- *
- * @exception IllegalArgumentException if this {@link State} cannot be
- * added to the specified {@link Dialog}
*/
public void setName(String name) {
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ActionStateImpl.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ActionStateImpl.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ActionStateImpl.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ActionStateImpl.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/DialogImpl.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/DialogImpl.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/DialogImpl.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/DialogImpl.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -163,7 +163,7 @@
* @exception IllegalArgumentException if there is already a {@link State}
* with the specified <code>id</code> owned by this {@link Dialog}
*/
- public void addState(State state) {
+ public void addState(State state) throws IllegalArgumentException {
if (states.containsKey(state.getName())) {
throw new IllegalArgumentException(state.getName());
@@ -185,7 +185,7 @@
* @exception IllegalArgumentException if the specified {@link Transition}
* cannot be added to this {@link State}
*/
- public void addTransition(Transition transition) {
+ public void addTransition(Transition transition) throws IllegalArgumentException {
// FIXME - addTransition() - ignore duplicate outcomes for now
transitions.put(transition.getOutcome(), transition);
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/EndStateImpl.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/EndStateImpl.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/EndStateImpl.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/EndStateImpl.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@
*/
public class EndStateImpl extends ViewStateImpl implements EndState {
-
+
// ---------------------------------------------------------- Public Methods
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/SubdialogStateImpl.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/SubdialogStateImpl.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/SubdialogStateImpl.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/SubdialogStateImpl.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@
*/
public class SubdialogStateImpl extends AbstractState implements SubdialogState {
-
+
// ------------------------------------------------------ Instance Variables
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/TransitionImpl.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/TransitionImpl.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/TransitionImpl.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/TransitionImpl.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@
*/
public class TransitionImpl implements Transition {
-
+
// ------------------------------------------------------ Instance Variables
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ViewStateImpl.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ViewStateImpl.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ViewStateImpl.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/dialog/impl/ViewStateImpl.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@
*/
public class ViewStateImpl extends AbstractState implements ViewState {
-
+
// ------------------------------------------------------ Instance Variables
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/faces/ValidatorRenderKit.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/faces/ValidatorRenderKit.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/faces/ValidatorRenderKit.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/faces/ValidatorRenderKit.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,55 +32,57 @@
/**
* <p>Decorates the original <code>RenderKit</code> passed by the
* overloaded constructor in the {@link org.apache.shale.view.faces.ViewViewHandler}.
- * The majority of the implementation is passed on the the original
- * <code>RenderKit</code> but requests for renderers registered with the
+ * The majority of the implementation is passed on the the original
+ * <code>RenderKit</code> but requests for renderers registered with the
* "javax.faces.Command" and "javax.faces.Input" families are decorated.
- * Only renderers in the "javax.faces.Command" family of types
+ * Only renderers in the "javax.faces.Command" family of types
* "javax.faces.Link" and "javax.faces.Button" are considered. These are
- * renderers from the vanilla JSF runtime that have predictable behavior.
- * The wrapper adds special behavior for the
+ * renderers from the vanilla JSF runtime that have predictable behavior.
+ * The wrapper adds special behavior for the
* {@link org.apache.shale.validator.CommonsValidator} validator and
* {@link org.apache.shale.component.ValidatorScript} component.</p>
*/
public class ValidatorRenderKit extends RenderKit {
- private static String COMMAND_FAMILY = "javax.faces.Command";
- private static String INPUT_FAMILY = "javax.faces.Input";
-
- private static String COMMAND_LINK_TYPE = "javax.faces.Link";
- private static String COMMAND_BUTTON_TYPE = "javax.faces.Button";
-
+ private static final String COMMAND_FAMILY = "javax.faces.Command";
+ private static final String INPUT_FAMILY = "javax.faces.Input";
+ private static final String COMMAND_LINK_TYPE = "javax.faces.Link";
+ private static final String COMMAND_BUTTON_TYPE = "javax.faces.Button";
+
+
/**
* <p>The original RenderKit.</p>
*/
private RenderKit defaultRenderKit = null;
/**
* <p>This constructor is overloaded to pass the original
- * <code>RenderKit</p>.
+ * <code>RenderKit</code></p>.
+ *
+ * @param defaultRenderKit The default RenderKit that we will be wrapping
*/
public ValidatorRenderKit(RenderKit defaultRenderKit) {
- this.defaultRenderKit = defaultRenderKit;
+ this.defaultRenderKit = defaultRenderKit;
}
-
+
// Specified by default RenderKit
public void addRenderer(String componentFamily, String rendererType, Renderer renderer) {
- this.defaultRenderKit.addRenderer(componentFamily, rendererType, renderer);
+ this.defaultRenderKit.addRenderer(componentFamily, rendererType, renderer);
}
/**
* <p>If the component family is not "javax.faces.Command" or
- * "javax.faces.Input", the <code>defaultRenderKit</code> handles the
+ * "javax.faces.Input", the <code>defaultRenderKit</code> handles the
* request. If the family is "javax.faces.Command", and the renderer type
* is "javax.faces.Link" or "javax.faces.Button" the default
- * renderer is decorated with {@link org.apache.shale.renderer.ValidatorCommandRenderer}.
- * If the component family is "javax.faces.Input", the default
+ * renderer is decorated with {@link org.apache.shale.renderer.ValidatorCommandRenderer}.
+ * If the component family is "javax.faces.Input", the default
* renderer is decorated with {@link org.apache.shale.renderer.ValidatorInputRenderer}.
*/
public Renderer getRenderer(String componentFamily, String rendererType) {
Renderer target = defaultRenderKit.getRenderer(componentFamily, rendererType);
- if (componentFamily.equals(COMMAND_FAMILY) &&
- (rendererType.equals(COMMAND_LINK_TYPE) ||
+ if (componentFamily.equals(COMMAND_FAMILY) &&
+ (rendererType.equals(COMMAND_LINK_TYPE) ||
rendererType.equals(COMMAND_BUTTON_TYPE))) {
if (!(target instanceof ValidatorCommandRenderer)) {
target = new ValidatorCommandRenderer(target);
@@ -104,7 +106,7 @@
// Specified by default RenderKit
public ResponseWriter createResponseWriter(Writer writer,
String contentTypeList,
- String characterEncoding){
+ String characterEncoding) {
return defaultRenderKit.createResponseWriter(writer, contentTypeList, characterEncoding);
}
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/CommonsValidatorTag.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/CommonsValidatorTag.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/CommonsValidatorTag.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/CommonsValidatorTag.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -121,7 +121,7 @@
public CommonsValidatorTag() {
setValidatorId("org.apache.shale.CommonsValidator");
FacesContext context = FacesContext.getCurrentInstance();
- tagUtils = (org.apache.shale.util.Tags)context
+ tagUtils = (org.apache.shale.util.Tags) context
.getApplication()
.getVariableResolver()
.resolveVariable(context, ShaleConstants.TAG_UTILITY_BEAN);
@@ -130,6 +130,8 @@
/**
* <p>Setter method for the <code>type</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setType(String newValue) {
type = newValue;
@@ -138,6 +140,8 @@
/**
* <p>Setter method for the <code>min</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setMin(String newValue) {
min = newValue;
@@ -146,6 +150,8 @@
/**
* <p>Setter method for the <code>max</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setMax(String newValue) {
max = newValue;
@@ -154,6 +160,8 @@
/**
* <p>Setter method for the <code>minlength</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setMinlength(String newValue) {
minlength = newValue;
@@ -162,6 +170,8 @@
/**
* <p>Setter method for the <code>maxlength</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setMaxlength(String newValue) {
maxlength = newValue;
@@ -170,6 +180,8 @@
/**
* <p>Setter method for the <code>setDatePatternStrict</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setDatePatternStrict(String newValue) {
datePatternStrict = newValue;
@@ -178,6 +190,8 @@
/**
* <p>Setter method for the <code>mask</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setMask(String newValue) {
mask = newValue;
@@ -186,6 +200,8 @@
/**
* <p>Setter method for the <code>message</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setMessage(String newValue) {
message = newValue;
@@ -194,6 +210,8 @@
/**
* <p>Setter method for the <code>arg</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setArg(String newValue) {
arg = newValue;
@@ -202,6 +220,8 @@
/**
* <p>Setter method for the <code>client</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setClient(String newValue) {
client = newValue;
@@ -210,6 +230,8 @@
/**
* <p>Setter method for the <code>server</code> attribute.
+ *
+ * @param newValue the new attribute value
*/
public void setServer(String newValue) {
server = newValue;
@@ -243,6 +265,8 @@
/**
* <p>Executes the code that was skipped in the <code>doStartTag()</code>
* override.</p>
+ *
+ * @exception JspException if a JSP processing error occurs
*/
public int doEndTag() throws JspException {
super.doStartTag();
@@ -254,6 +278,8 @@
* <p>Create a validator by calling <code>super.createValidator()</code>.
* This method initializes that validator with the tag's attribute
* values.
+ *
+ * @exception JspException if a JSP processing error occurs
*/
public Validator createValidator() throws JspException {
CommonsValidator validator = (CommonsValidator) super.createValidator();
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/SubviewTag.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/SubviewTag.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/SubviewTag.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/SubviewTag.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@
* $Id$
*/
public class SubviewTag extends UIComponentTag {
-
+
/**
* <p>Return the required component type.</p>
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/TokenTag.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/TokenTag.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/TokenTag.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/TokenTag.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,34 +29,37 @@
* $Id$
*/
public class TokenTag extends UIComponentTag {
-
+
/**
- * <p>Pushs the tag attributes to the {@link Token}'s
+ * <p>Pushs the tag attributes to the {@link Token}'s
* component properties.</p>
+ *
+ * @param component Component for which to set properties
*/
protected void setProperties(UIComponent component) {
super.setProperties(component);
-
+
FacesContext context = getFacesContext();
-
+
if (messageSummary != null) {
if (this.isValueReference(messageSummary)) {
ValueBinding vb = context.getApplication().createValueBinding(messageSummary);
component.setValueBinding("messageSummary", vb);
- } else
- component.getAttributes().put("messageSummary", messageSummary);
+ } else {
+ component.getAttributes().put("messageSummary", messageSummary);
+ }
}
if (messageDetail != null) {
if (this.isValueReference(messageDetail)) {
ValueBinding vb = context.getApplication().createValueBinding(messageDetail);
component.setValueBinding("messageDetail", vb);
- } else
- component.getAttributes().put("messageDetail", messageDetail);
+ } else {
+ component.getAttributes().put("messageDetail", messageDetail);
+ }
}
-
}
@@ -76,17 +79,19 @@
}
/**
- * <p>A validation messageSummary override that can be used to change the default
+ * <p>A validation messageSummary override that can be used to change the default
* validation messageSummary when the token verification fails.</p>
*/
private String messageSummary = null;
-
+
/**
* <p>Sets a <code>messageSummary</code> override used when reporting
* a {@link org.apache.shale.component.Token} verification failure.</p>
+ *
+ * @param message The new message summary
*/
public void setMessageSummary(String message) {
- this.messageSummary = message;
+ this.messageSummary = message;
}
/**
@@ -94,22 +99,24 @@
* a {@link org.apache.shale.component.Token} verification failure.</p>
*/
public String getMessageSummary() {
- return messageSummary;
+ return messageSummary;
}
-
+
/**
- * <p>A validation messageDetail override that can be used to change the default
+ * <p>A validation messageDetail override that can be used to change the default
* validation messageDetail when the token verification fails.</p>
*/
private String messageDetail = null;
-
+
/**
* <p>Sets a <code>messageDetail</code> override used when reporting
* a {@link org.apache.shale.component.Token} verification failure.</p>
+ *
+ * @param message The new message detail
*/
public void setMessageDetail(String message) {
- this.messageDetail = message;
+ this.messageDetail = message;
}
/**
@@ -117,8 +124,8 @@
* a {@link org.apache.shale.component.Token} verification failure.</p>
*/
public String getMessageDetail() {
- return messageDetail;
+ return messageDetail;
}
-
+
}
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/ValidatorVarTag.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/ValidatorVarTag.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/ValidatorVarTag.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/taglib/ValidatorVarTag.java Mon Jul 3 13:58:36 2006
@@ -32,7 +32,7 @@
/**
* The parent validator tag.
*/
- CommonsValidatorTag commonsValidatorTag = null;
+ private CommonsValidatorTag commonsValidatorTag = null;
/**
@@ -45,7 +45,7 @@
* The value of the var to pass to the validator.
*/
private String value;
-
+
/**
* Keeps track of the <s:commonsValidator> tag.
@@ -67,6 +67,9 @@
/**
* Pass the validation parameter to the commonsValidatorTag that immediately
* surrounds this tag.
+ *
+ * @exception JspException if a JSP processing error occurs
+ * @return Request to evaluate the page
*/
public int doEndTag() throws JspException {
commonsValidatorTag.addParam(name, value);
@@ -79,6 +82,8 @@
/**
* The var name.
+ *
+ * @param name The variable name
*/
public void setName(String name) {
this.name = name;
@@ -87,6 +92,8 @@
/**
* The var value.
+ *
+ * @param value The variable value
*/
public void setValue(String value) {
this.value = value;
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/LoadBundle.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/LoadBundle.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/LoadBundle.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/LoadBundle.java Mon Jul 3 13:58:36 2006
@@ -79,7 +79,7 @@
// ------------------------------------------------------------- Constructors
- /** Creates a new instance of LoadBundle */
+ /** Creates a new instance of LoadBundle. */
public LoadBundle() {
this(null);
}
@@ -124,6 +124,8 @@
/**
* <p>Set the base resource bundle name for this <code>LoadBundle</code>
* instance.</p>
+ *
+ * @param basename The new base resource bundle name
*/
public void setBasename(String basename) {
this.basename = basename;
@@ -142,7 +144,7 @@
* @exception IllegalStateException if we are not inside a Faces request,
* or if there is not a current view root with a valid locale
*/
- public Map getMap() {
+ public Map getMap() throws IllegalStateException {
// Validate our current state
if (basename == null) {
@@ -155,7 +157,7 @@
UIViewRoot root = null;
Locale locale = null;
if (context != null) {
- root = context.getViewRoot();
+ root = context.getViewRoot();
}
if (root != null) {
locale = root.getLocale();
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/Tags.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/Tags.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/Tags.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/Tags.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
package org.apache.shale.util;
import java.io.Serializable;
-
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -30,342 +29,380 @@
/**
* <p>A utility class for JSF tags. An instance of this class is
* specified as an application-scoped managed bean in <code>
- * faces-config.xml</code>, under the name
+ * faces-config.xml</code>, under the name
* <code>org.apache.shale.TAG_UTILITY_BEAN</code>.
* The <code>org.apache.shale.taglib.CommonsValidatorTag</code>
- * uses that managed bean.
+ * uses that managed bean.</p>
* <p>Nearly all of the methods of this class set a component attribute or
- * create a value- or method-binding, given a String representation
- * of the value. The methods check to see whether the value is a value
- * reference (ie. <code>#{...}</code>); if so, the methods set value
- * bindings or method bindings, as appropriate, for the component.
+ * create a value- or method-binding, given a String representation
+ * of the value. The methods check to see whether the value is a value
+ * reference (ie. <code>#{...}</code>); if so, the methods set value
+ * bindings or method bindings, as appropriate, for the component.</p>
*
* $Id$
*/
public class Tags {
- /**
- * <p>Sets the component's <code>attributeName</code> with the
- * given <code>attributeValue</code> as a <code>String</code>.
- *
- * <p>If the <code>attributeValue</code> is <code>null</code>, do
- * nothing. If <code>attributeValue</code> is a value reference,
- * set a value binding for the component. Otherwise, store the
- * <code>attributeValue</code> in the component's attribute map.
- *
- * @param component The JSF component
- * @param attributeName The name of the attribute to set
- * @param attributeValue The value of the attribute
- */
- public void setString(UIComponent component, String attributeName,
- String attributeValue) {
- if (attributeValue == null)
- return;
- if (UIComponentTag.isValueReference(attributeValue))
- setValueBinding(component, attributeName, attributeValue);
- else
- component.getAttributes().put(attributeName, attributeValue);
- }
-
-
- /**
- * <p>Sets the component's <code>attributeName</code> with the
- * given <code>attributeValue</code> as a <code>Integer</code>.
- *
- * <p>If the <code>attributeValue</code> is <code>null</code>, do
- * nothing. If <code>attributeValue</code> is a value reference,
- * set a value binding for the component. Otherwise, store the
- * <code>attributeValue</code> in the component's attribute map.
- *
- * @param component The JSF component
- * @param attributeName The name of the attribute to set
- * @param attributeValue The value of the attribute
- */
-
- public void setInteger(UIComponent component,
- String attributeName, String attributeValue) {
- if (attributeValue == null) return;
- if (UIComponentTag.isValueReference(attributeValue))
- setValueBinding(component, attributeName, attributeValue);
- else
- component.getAttributes().put(attributeName,
- new Integer(attributeValue));
- }
-
-
- /**
- * <p>Sets the component's <code>attributeName</code> with the
- * given <code>attributeValue</code> as a <code>Double</code>.
- *
- * <p>If the <code>attributeValue</code> is <code>null</code>, do
- * nothing. If <code>attributeValue</code> is a value reference,
- * set a value binding for the component. Otherwise, store the
- * <code>attributeValue</code> in the component's attribute map.
- *
- * @param component The JSF component
- * @param attributeName The name of the attribute to set
- * @param attributeValue The value of the attribute
- */
- public void setDouble(UIComponent component,
- String attributeName, String attributeValue) {
- if (attributeValue == null) return;
- if (UIComponentTag.isValueReference(attributeValue))
- setValueBinding(component, attributeName, attributeValue);
- else
- component.getAttributes().put(attributeName,
- new Double(attributeValue));
- }
-
-
- /**
- * <p>Sets the component's <code>attributeName</code> with the
- * given <code>attributeValue</code> as a <code>Boolean</code>.
- *
- * <p>If the <code>attributeValue</code> is <code>null</code>, do
- * nothing. If <code>attributeValue</code> is a value reference,
- * set a value binding for the component. Otherwise, store the
- * <code>attributeValue</code> in the component's attribute map.
- *
- * @param component The JSF component
- * @param attributeName The name of the attribute to set
- * @param attributeValue The value of the attribute
- */
- public void setBoolean(UIComponent component,
- String attributeName, String attributeValue) {
- if (attributeValue == null) return;
- if (UIComponentTag.isValueReference(attributeValue))
- setValueBinding(component, attributeName, attributeValue);
- else
- component.getAttributes().put(attributeName,
- new Boolean(attributeValue));
- }
-
-
- /**
- * <p>Sets the component's <code>attributeName</code> with the
- * given <code>attributeValue</code> as a <code>ValueBinding</code>.
- *
- * <p>If the <code>attributeValue</code> is <code>null</code>, do
- * nothing. If <code>attributeValue</code> is a value reference,
- * set a value binding for the component. Otherwise, store the
- * <code>attributeValue</code> in the component's attribute map.
- *
- * @param component The JSF component
- * @param attributeName The name of the attribute to set
- * @param attributeValue The value of the attribute
- */
-
- public void setValueBinding(UIComponent component, String attributeName,
- String attributeValue) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- ValueBinding vb = app.createValueBinding(attributeValue);
- component.setValueBinding(attributeName, vb);
- }
-
-
- /**
- * <p>Sets the component's <code>ActionListener</code>
- * by setting a method binding with the given attribute
- * value.
- *
- * @param component The JSF component
- * @param attributeValue The value of the attribute
- */
-
- public void setActionListener(UIComponent component, String attributeValue) {
- setMethodBinding(component, "actionListener", attributeValue,
- new Class[] { ActionEvent.class });
- }
-
-
- /**
- * <p>Sets the component's <code>ValueChangeListener</code>
- * by setting a method binding with the given attribute
- * value.
- *
- * @param component The JSF component
- * @param attributeValue The value of the attribute
- */
-
- public void setValueChangeListener(UIComponent component,
- String attributeValue) {
- setMethodBinding(component, "valueChangeListener", attributeValue,
- new Class[] { ValueChangeEvent.class });
- }
-
-
- /**
- * <p>Sets the component's <code>Validator</code>
- * by setting a method binding with the given attribute
- * value.
- *
- * @param component The JSF component
- * @param attributeValue The value of the attribute
- */
- public void setValidator(UIComponent component,
- String attributeValue) {
- setMethodBinding(component, "validator", attributeValue,
- new Class[] { FacesContext.class, UIComponent.class, Object.class });
- }
-
-
- /**
- * <p>Sets the component's <code>Action</code>
- * by setting a method binding with the given attribute
- * value.
- *
- * @param component The JSF component
- * @param attributeValue The value of the attribute
- */
- public void setAction(UIComponent component, String attributeValue) {
- if (attributeValue == null) return;
- if (UIComponentTag.isValueReference(attributeValue))
- setMethodBinding(component, "action", attributeValue,
- new Class[] {});
- else {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- MethodBinding mb = new ActionMethodBinding(attributeValue);
- component.getAttributes().put("action", mb);
- }
- }
-
-
- /**
- * <p>Sets the component's <code>attributeName</code> with the
- * given <code>attributeValue</code> as a <code>MethodBinding</code>.
- *
- * <p>If the <code>attributeValue</code> is <code>null</code>, do
- * nothing. If <code>attributeValue</code> is a value reference,
- * set a value binding for the component. Otherwise, store the
- * <code>attributeValue</code> in the component's attribute map.
- *
- * @param component The JSF component
- * @param attributeName The name of the attribute to set
- * @param attributeValue The value of the attribute
- */
-
- public void setMethodBinding(UIComponent component, String attributeName,
- String attributeValue, Class[] paramTypes) {
- if (attributeValue == null)
- return;
- if (UIComponentTag.isValueReference(attributeValue)) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- MethodBinding mb = app.createMethodBinding(attributeValue, paramTypes);
- component.getAttributes().put(attributeName, mb);
- }
- }
-
-
- /**
- * <p>Evaluate the <code>expression</code>. If it's a value reference,
- * get the reference's value.
- * Otherwise, return the <code>expression</code>.
- *
- * @param expression The expression
- */
- public Object eval(String expression) {
- if (expression == null) return null;
- if (UIComponentTag.isValueReference(expression)) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- return app.createValueBinding(expression).getValue(context);
- }
- else return expression;
- }
-
-
- /**
- * <p>Evaluate the <code>expression</code>. If it's a value reference,
- * get the reference's value as a String.
- * Otherwise, return the <code>expression</code>.
- *
- * @param expression The expression
- */
- public String evalString(String expression) {
- if (expression == null) return null;
- if (UIComponentTag.isValueReference(expression)) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- return "" + app.createValueBinding(expression).getValue(context);
- }
- else return expression;
- }
-
-
- /**
- * <p>Evaluate the <code>expression</code> and return an <code>Integer</code>.
- *
- * @param expression The expression
- */
- public Integer evalInteger(String expression) {
- if (expression == null) return null;
- if (UIComponentTag.isValueReference(expression)) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- Object r = app.createValueBinding(expression).getValue(context);
- if (r == null) return null;
- else if (r instanceof Integer) return (Integer) r;
- else return new Integer(r.toString());
- }
- else return new Integer(expression);
- }
-
-
- /**
- * <p>Evaluate the <code>expression</code> and return a <code>Double</code>.
- *
- * @param expression The expression
- */
- public Double evalDouble(String expression) {
- if (expression == null) return null;
- if (UIComponentTag.isValueReference(expression)) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- Object r = app.createValueBinding(expression).getValue(context);
- if (r == null) return null;
- else if (r instanceof Double) return (Double) r;
- else return new Double(r.toString());
- }
- else return new Double(expression);
- }
-
-
- /**
- * <p>Evaluate the <code>expression</code> and return a <code>Boolean</code>.
- *
- * @param expression The expression
- */
- public Boolean evalBoolean(String expression) {
- if (expression == null) return null;
- if (UIComponentTag.isValueReference(expression)) {
- FacesContext context = FacesContext.getCurrentInstance();
- Application app = context.getApplication();
- Object r = app.createValueBinding(expression).getValue(context);
- if (r == null) return null;
- else if (r instanceof Boolean) return (Boolean) r;
- else return new Boolean(r.toString());
- }
- else return new Boolean(expression);
- }
-
-
- /**
- * <p>A method binding whose result is a canned string.
- *
- */
- private static class ActionMethodBinding
- extends MethodBinding implements Serializable {
- private String result;
-
- public ActionMethodBinding(String result) { this.result = result; }
- public Object invoke(FacesContext context, Object params[]) {
- return result;
- }
- public String getExpressionString() { return result; }
- public Class getType(FacesContext context) { return String.class; }
- }
+ /**
+ * <p>Sets the component's <code>attributeName</code> with the
+ * given <code>attributeValue</code> as a <code>String</code>.</p>
+ *
+ * <p>If the <code>attributeValue</code> is <code>null</code>, do
+ * nothing. If <code>attributeValue</code> is a value reference,
+ * set a value binding for the component. Otherwise, store the
+ * <code>attributeValue</code> in the component's attribute map.</p>
+ *
+ * @param component The JSF component
+ * @param attributeName The name of the attribute to set
+ * @param attributeValue The value of the attribute
+ */
+ public void setString(UIComponent component, String attributeName,
+ String attributeValue) {
+ if (attributeValue == null) {
+ return;
+ }
+ if (UIComponentTag.isValueReference(attributeValue)) {
+ setValueBinding(component, attributeName, attributeValue);
+ } else {
+ component.getAttributes().put(attributeName, attributeValue);
+ }
+ }
+
+
+ /**
+ * <p>Sets the component's <code>attributeName</code> with the
+ * given <code>attributeValue</code> as a <code>Integer</code>.</p>
+ *
+ * <p>If the <code>attributeValue</code> is <code>null</code>, do
+ * nothing. If <code>attributeValue</code> is a value reference,
+ * set a value binding for the component. Otherwise, store the
+ * <code>attributeValue</code> in the component's attribute map.</p>
+ *
+ * @param component The JSF component
+ * @param attributeName The name of the attribute to set
+ * @param attributeValue The value of the attribute
+ */
+ public void setInteger(UIComponent component,
+ String attributeName, String attributeValue) {
+ if (attributeValue == null) {
+ return;
+ }
+ if (UIComponentTag.isValueReference(attributeValue)) {
+ setValueBinding(component, attributeName, attributeValue);
+ } else {
+ component.getAttributes().put(attributeName,
+ new Integer(attributeValue));
+ }
+ }
+
+
+ /**
+ * <p>Sets the component's <code>attributeName</code> with the
+ * given <code>attributeValue</code> as a <code>Double</code>.</p>
+ *
+ * <p>If the <code>attributeValue</code> is <code>null</code>, do
+ * nothing. If <code>attributeValue</code> is a value reference,
+ * set a value binding for the component. Otherwise, store the
+ * <code>attributeValue</code> in the component's attribute map.</p>
+ *
+ * @param component The JSF component
+ * @param attributeName The name of the attribute to set
+ * @param attributeValue The value of the attribute
+ */
+ public void setDouble(UIComponent component,
+ String attributeName, String attributeValue) {
+ if (attributeValue == null) {
+ return;
+ }
+ if (UIComponentTag.isValueReference(attributeValue)) {
+ setValueBinding(component, attributeName, attributeValue);
+ } else {
+ component.getAttributes().put(attributeName,
+ new Double(attributeValue));
+ }
+ }
+
+
+ /**
+ * <p>Sets the component's <code>attributeName</code> with the
+ * given <code>attributeValue</code> as a <code>Boolean</code>.</p>
+ *
+ * <p>If the <code>attributeValue</code> is <code>null</code>, do
+ * nothing. If <code>attributeValue</code> is a value reference,
+ * set a value binding for the component. Otherwise, store the
+ * <code>attributeValue</code> in the component's attribute map.</p>
+ *
+ * @param component The JSF component
+ * @param attributeName The name of the attribute to set
+ * @param attributeValue The value of the attribute
+ */
+ public void setBoolean(UIComponent component,
+ String attributeName, String attributeValue) {
+ if (attributeValue == null) {
+ return;
+ }
+ if (UIComponentTag.isValueReference(attributeValue)) {
+ setValueBinding(component, attributeName, attributeValue);
+ } else {
+ component.getAttributes().put(attributeName,
+ new Boolean(attributeValue));
+ }
+ }
+
+
+ /**
+ * <p>Sets the component's <code>attributeName</code> with the
+ * given <code>attributeValue</code> as a <code>ValueBinding</code>.</p>
+ *
+ * <p>If the <code>attributeValue</code> is <code>null</code>, do
+ * nothing. If <code>attributeValue</code> is a value reference,
+ * set a value binding for the component. Otherwise, store the
+ * <code>attributeValue</code> in the component's attribute map.</p>
+ *
+ * @param component The JSF component
+ * @param attributeName The name of the attribute to set
+ * @param attributeValue The value of the attribute
+ */
+ public void setValueBinding(UIComponent component, String attributeName,
+ String attributeValue) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ ValueBinding vb = app.createValueBinding(attributeValue);
+ component.setValueBinding(attributeName, vb);
+ }
+
+
+ /**
+ * <p>Sets the component's <code>ActionListener</code>
+ * by setting a method binding with the given attribute
+ * value.</p>
+ *
+ * @param component The JSF component
+ * @param attributeValue The value of the attribute
+ */
+ public void setActionListener(UIComponent component, String attributeValue) {
+ setMethodBinding(component, "actionListener", attributeValue,
+ new Class[] { ActionEvent.class });
+ }
+
+
+ /**
+ * <p>Sets the component's <code>ValueChangeListener</code>
+ * by setting a method binding with the given attribute
+ * value.</p>
+ *
+ * @param component The JSF component
+ * @param attributeValue The value of the attribute
+ */
+ public void setValueChangeListener(UIComponent component,
+ String attributeValue) {
+ setMethodBinding(component, "valueChangeListener", attributeValue,
+ new Class[] { ValueChangeEvent.class });
+ }
+
+
+ /**
+ * <p>Sets the component's <code>Validator</code>
+ * by setting a method binding with the given attribute
+ * value.</p>
+ *
+ * @param component The JSF component
+ * @param attributeValue The value of the attribute
+ */
+ public void setValidator(UIComponent component,
+ String attributeValue) {
+ setMethodBinding(component, "validator", attributeValue,
+ new Class[] { FacesContext.class, UIComponent.class, Object.class });
+ }
+
+
+ /**
+ * <p>Sets the component's <code>Action</code>
+ * by setting a method binding with the given attribute
+ * value.</p>
+ *
+ * @param component The JSF component
+ * @param attributeValue The value of the attribute
+ */
+ public void setAction(UIComponent component, String attributeValue) {
+ if (attributeValue == null) {
+ return;
+ }
+ if (UIComponentTag.isValueReference(attributeValue)) {
+ setMethodBinding(component, "action", attributeValue,
+ new Class[] {});
+ } else {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ MethodBinding mb = new ActionMethodBinding(attributeValue);
+ component.getAttributes().put("action", mb);
+ }
+ }
+
+
+ /**
+ * <p>Sets the component's <code>attributeName</code> with the
+ * given <code>attributeValue</code> as a <code>MethodBinding</code>.</p>
+ *
+ * <p>If the <code>attributeValue</code> is <code>null</code>, do
+ * nothing. If <code>attributeValue</code> is a value reference,
+ * set a value binding for the component. Otherwise, store the
+ * <code>attributeValue</code> in the component's attribute map.</p>
+ *
+ * @param component The JSF component
+ * @param attributeName The name of the attribute to set
+ * @param attributeValue The value of the attribute
+ * @param paramTypes Signature for method parameters
+ */
+ public void setMethodBinding(UIComponent component, String attributeName,
+ String attributeValue, Class[] paramTypes) {
+ if (attributeValue == null) {
+ return;
+ }
+ if (UIComponentTag.isValueReference(attributeValue)) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ MethodBinding mb = app.createMethodBinding(attributeValue, paramTypes);
+ component.getAttributes().put(attributeName, mb);
+ }
+ }
+
+
+ /**
+ * <p>Evaluate the <code>expression</code>. If it's a value reference,
+ * get the reference's value.
+ * Otherwise, return the <code>expression</code>.</p>
+ *
+ * @param expression The expression
+ */
+ public Object eval(String expression) {
+ if (expression == null) {
+ return null;
+ }
+ if (UIComponentTag.isValueReference(expression)) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ return app.createValueBinding(expression).getValue(context);
+ } else {
+ return expression;
+ }
+ }
+
+
+ /**
+ * <p>Evaluate the <code>expression</code>. If it's a value reference,
+ * get the reference's value as a String.
+ * Otherwise, return the <code>expression</code>.</p>
+ *
+ * @param expression The expression
+ */
+ public String evalString(String expression) {
+ if (expression == null) {
+ return null;
+ }
+ if (UIComponentTag.isValueReference(expression)) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ return "" + app.createValueBinding(expression).getValue(context);
+ } else {
+ return expression;
+ }
+ }
+
+
+ /**
+ * <p>Evaluate the <code>expression</code> and return an <code>Integer</code>.</p>
+ *
+ * @param expression The expression
+ */
+ public Integer evalInteger(String expression) {
+ if (expression == null) {
+ return null;
+ }
+ if (UIComponentTag.isValueReference(expression)) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ Object r = app.createValueBinding(expression).getValue(context);
+ if (r == null) {
+ return null;
+ } else if (r instanceof Integer) {
+ return (Integer) r;
+ } else {
+ return new Integer(r.toString());
+ }
+ } else {
+ return new Integer(expression);
+ }
+ }
+
+
+ /**
+ * <p>Evaluate the <code>expression</code> and return a <code>Double</code>.</p>
+ *
+ * @param expression The expression
+ */
+ public Double evalDouble(String expression) {
+ if (expression == null) {
+ return null;
+ }
+ if (UIComponentTag.isValueReference(expression)) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ Object r = app.createValueBinding(expression).getValue(context);
+ if (r == null) {
+ return null;
+ } else if (r instanceof Double) {
+ return (Double) r;
+ } else {
+ return new Double(r.toString());
+ }
+ } else {
+ return new Double(expression);
+ }
+ }
+
+
+ /**
+ * <p>Evaluate the <code>expression</code> and return a <code>Boolean</code>.</p>
+ *
+ * @param expression The expression
+ */
+ public Boolean evalBoolean(String expression) {
+ if (expression == null) {
+ return null;
+ }
+ if (UIComponentTag.isValueReference(expression)) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application app = context.getApplication();
+ Object r = app.createValueBinding(expression).getValue(context);
+ if (r == null) {
+ return null;
+ } else if (r instanceof Boolean) {
+ return (Boolean) r;
+ } else {
+ return new Boolean(r.toString());
+ }
+ } else {
+ return new Boolean(expression);
+ }
+ }
+
+
+ /**
+ * <p>A method binding whose result is a canned string.</p>
+ *
+ */
+ private static class ActionMethodBinding
+ extends MethodBinding implements Serializable {
+ private String result;
+
+ public ActionMethodBinding(String result) { this.result = result; }
+ public Object invoke(FacesContext context, Object params[]) {
+ return result;
+ }
+ public String getExpressionString() { return result; }
+ public Class getType(FacesContext context) { return String.class; }
+ }
+
}
Modified: struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/TokenProcessor.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/TokenProcessor.java?rev=418848&r1=418847&r2=418848&view=diff
==============================================================================
--- struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/TokenProcessor.java (original)
+++ struts/shale/trunk/shale-core/src/main/java/org/apache/shale/util/TokenProcessor.java Mon Jul 3 13:58:36 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,8 +34,8 @@
* $Id$
*/
public class TokenProcessor {
-
-
+
+
// ------------------------------------------------------ Instance Variables