You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2004/10/05 20:33:13 UTC
cvs commit: jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/lib Dumper.java
hlship 2004/10/05 11:33:13
Modified: junit/src/org/apache/tapestry/junit/mock/app Guard.java
framework/src/java/org/apache/tapestry/enhance
CreateAccessorUtils.java
CreatePropertyEnhancer.java
framework/src/java/org/apache/tapestry Tapestry.java
AbstractComponent.java
contrib/src/java/org/apache/tapestry/contrib/tree/components
TreeView.java
junit/src/org/apache/tapestry/junit/mock/c11
PersistentSelectPage.java
junit/src/org/apache/tapestry/junit/mock/c6 Home.java
Nested.java Four.java
junit/src/org/apache/tapestry/junit/mock/lib Dumper.java
Log:
Remove some deprecated methods.
Revision Changes Path
1.6 +3 -3 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/app/Guard.java
Index: Guard.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/app/Guard.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Guard.java 16 Sep 2004 00:26:25 -0000 1.5
+++ Guard.java 5 Oct 2004 18:33:04 -0000 1.6
@@ -15,6 +15,7 @@
package org.apache.tapestry.junit.mock.app;
import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.callback.ICallback;
import org.apache.tapestry.html.BasePage;
@@ -23,7 +24,6 @@
* if false, redirects to this page.
*
* @author Howard Lewis Ship
- * @version $Id$
* @since 2.3
*
**/
@@ -54,13 +54,13 @@
public void setCallback(ICallback callback)
{
_callback = callback;
- fireObservedChange("callback", callback);
+ Tapestry.fireObservedChange(this, "callback", callback);
}
public void setVisited(boolean visited)
{
_visited = visited;
- fireObservedChange("visited", visited);
+ Tapestry.fireObservedChange(this, "visited", new Boolean(visited));
}
public void linkClicked(IRequestCycle cycle)
1.3 +46 -51 jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/CreateAccessorUtils.java
Index: CreateAccessorUtils.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/CreateAccessorUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CreateAccessorUtils.java 16 Sep 2004 00:26:17 -0000 1.2
+++ CreateAccessorUtils.java 5 Oct 2004 18:33:08 -0000 1.3
@@ -33,34 +33,32 @@
private static final Log LOG = LogFactory.getLog(CreateAccessorUtils.class);
/**
- * The code template for the standard property accessor method.
- * <p>
- * Legend: <br>
- * {0} = property field name <br>
+ * The code template for the standard property accessor method.
+ * <p>
+ * Legend: <br>
+ * {0} = property field name <br>
*/
private static final String PROPERTY_ACCESSOR_TEMPLATE = "" + "'{'" + " return {0}; " + "'}'";
/**
- * The code template for the standard property mutator method.
- * <p>
- * Legend: <br>
- * {0} = property field name <br>
+ * The code template for the standard property mutator method.
+ * <p>
+ * Legend: <br>
+ * {0} = property field name <br>
*/
private static final String PROPERTY_MUTATOR_TEMPLATE = "" + "'{'" + " {0} = $1; " + "'}'";
/**
- * The code template for the standard persistent property mutator method.
- * <p>
- * Legend: <br>
- * {0} = property field name <br>
- * {1} = property name <br>
+ * The code template for the standard persistent property mutator method.
+ * <p>
+ * Legend: <br>
+ * {0} = property field name <br>
+ * {1} = property name <br>
*/
- private static final String PERSISTENT_PROPERTY_MUTATOR_TEMPLATE =
- "" + "'{'" + " {0} = $1;" + " fireObservedChange(\"{1}\", {0}); " + "'}'";
+ private static final String PERSISTENT_PROPERTY_MUTATOR_TEMPLATE = "'{' {0} = $1; org.apache.tapestry.Tapestry#fireObservedChange(this, \"{1}\", ($w) {0}); '}'";
/**
- * Constructs an accessor method name.
- *
+ * Constructs an accessor method name.
*/
public static String buildMethodName(String prefix, String propertyName)
@@ -77,26 +75,23 @@
}
/**
- * Creates an accessor (getter) method for the property.
- *
- * @param fieldType the return type for the method
- * @param fieldName the name of the field (not the name of the property)
- * @param propertyName the name of the property (used to build the name of the method)
- * @param readMethodName if not null, the name of the method to use
+ * Creates an accessor (getter) method for the property.
*
+ * @param fieldType
+ * the return type for the method
+ * @param fieldName
+ * the name of the field (not the name of the property)
+ * @param propertyName
+ * the name of the property (used to build the name of the method)
+ * @param readMethodName
+ * if not null, the name of the method to use
*/
- public static void createPropertyAccessor(
- ClassFab classFab,
- Class fieldType,
- String fieldName,
- String propertyName,
- String methodName)
+ public static void createPropertyAccessor(ClassFab classFab, Class fieldType, String fieldName,
+ String propertyName, String methodName)
{
- String body =
- MessageFormat.format(
- PROPERTY_ACCESSOR_TEMPLATE,
- new Object[] { fieldName, propertyName });
+ String body = MessageFormat.format(PROPERTY_ACCESSOR_TEMPLATE, new Object[]
+ { fieldName, propertyName });
MethodSignature sig = new MethodSignature(fieldType, methodName, null, null);
@@ -104,31 +99,31 @@
}
/**
- * Creates a mutator (aka "setter") method.
- *
- * @param fieldType type of field value (and type of parameter value)
- * @param fieldName name of field (not property!)
- * @param propertyName name of property (used to construct method name)
- * @param isPersistent if true, adds a call to fireObservedChange()
+ * Creates a mutator (aka "setter") method.
*
+ * @param fieldType
+ * type of field value (and type of parameter value)
+ * @param fieldName
+ * name of field (not property!)
+ * @param propertyName
+ * name of property (used to construct method name)
+ * @param isPersistent
+ * if true, adds a call to fireObservedChange()
*/
- public static void createPropertyMutator(
- ClassFab classFab,
- Class fieldType,
- String fieldName,
- String propertyName,
- boolean isPersistent)
+ public static void createPropertyMutator(ClassFab classFab, Class fieldType, String fieldName,
+ String propertyName, boolean isPersistent)
{
- String bodyTemplate =
- isPersistent ? PERSISTENT_PROPERTY_MUTATOR_TEMPLATE : PROPERTY_MUTATOR_TEMPLATE;
+ String bodyTemplate = isPersistent ? PERSISTENT_PROPERTY_MUTATOR_TEMPLATE
+ : PROPERTY_MUTATOR_TEMPLATE;
- String body = MessageFormat.format(bodyTemplate, new Object[] { fieldName, propertyName });
+ String body = MessageFormat.format(bodyTemplate, new Object[]
+ { fieldName, propertyName });
String methodName = buildMethodName("set", propertyName);
- MethodSignature sig =
- new MethodSignature(void.class, methodName, new Class[] { fieldType }, null);
+ MethodSignature sig = new MethodSignature(void.class, methodName, new Class[]
+ { fieldType }, null);
classFab.addMethod(Modifier.PUBLIC | Modifier.FINAL, sig, body);
}
-}
+}
\ No newline at end of file
1.3 +22 -26 jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/CreatePropertyEnhancer.java
Index: CreatePropertyEnhancer.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/CreatePropertyEnhancer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CreatePropertyEnhancer.java 16 Sep 2004 00:26:17 -0000 1.2
+++ CreatePropertyEnhancer.java 5 Oct 2004 18:33:10 -0000 1.3
@@ -18,7 +18,6 @@
import org.apache.tapestry.Tapestry;
/**
- *
* Adds a transient or persistent property to a class.
*
* @author Mindbridge
@@ -27,29 +26,26 @@
public class CreatePropertyEnhancer implements IEnhancer
{
private String _propertyName;
+
private Class _propertyType;
+
private boolean _persistent;
+
private String _readMethodName;
public CreatePropertyEnhancer(String propertyName, Class propertyType)
{
- this(
- propertyName,
- propertyType,
- CreateAccessorUtils.buildMethodName("get", propertyName),
- false);
+ this(propertyName, propertyType, CreateAccessorUtils.buildMethodName("get", propertyName),
+ false);
}
- public CreatePropertyEnhancer(
- String propertyName,
- Class propertyType,
- String readMethodName,
- boolean persistent)
+ public CreatePropertyEnhancer(String propertyName, Class propertyType, String readMethodName,
+ boolean persistent)
{
- Tapestry.notNull(propertyName, "propertyName");
- Tapestry.notNull(propertyType, "propertyType");
- Tapestry.notNull(readMethodName, "readMethodName");
-
+ Tapestry.notNull(propertyName, "propertyName");
+ Tapestry.notNull(propertyType, "propertyType");
+ Tapestry.notNull(readMethodName, "readMethodName");
+
_propertyName = propertyName;
_propertyType = propertyType;
_readMethodName = readMethodName;
@@ -63,17 +59,17 @@
classFab.addField(fieldName, _propertyType);
CreateAccessorUtils.createPropertyAccessor(
- classFab,
- _propertyType,
- fieldName,
- _propertyName,
- _readMethodName);
+ classFab,
+ _propertyType,
+ fieldName,
+ _propertyName,
+ _readMethodName);
CreateAccessorUtils.createPropertyMutator(
- classFab,
- _propertyType,
- fieldName,
- _propertyName,
- _persistent);
+ classFab,
+ _propertyType,
+ fieldName,
+ _propertyName,
+ _persistent);
}
-}
+}
\ No newline at end of file
1.6 +373 -656 jakarta-tapestry/framework/src/java/org/apache/tapestry/Tapestry.java
Index: Tapestry.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/Tapestry.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Tapestry.java 16 Sep 2004 00:26:23 -0000 1.5
+++ Tapestry.java 5 Oct 2004 18:33:13 -0000 1.6
@@ -44,255 +44,212 @@
import org.apache.tapestry.util.StringSplitter;
/**
- * A placeholder for a number of (static) methods that don't belong elsewhere, as well
- * as a global location for static constants.
- *
- * @since 1.0.1
- * @author Howard Lewis Ship
- *
- **/
+ * A placeholder for a number of (static) methods that don't belong elsewhere, as well as a global
+ * location for static constants.
+ *
+ * @since 1.0.1
+ * @author Howard Lewis Ship
+ */
public final class Tapestry
{
/**
- * Name of a request attribute used with the
- * {@link #TAGSUPPORT_SERVICE} service. The attribute
- * defines the underlying service to for which a URL will be generated.
- *
- * @since 3.0
- *
- **/
-
- public final static String TAG_SUPPORT_SERVICE_ATTRIBUTE =
- "org.apache.tapestry.tagsupport.service";
-
- /**
- * Name of a request attribute used with the
- * {@link #TAGSUPPORT_SERVICE} service. The attribute
- * defines the correct servlet path for the
- * Tapestry application (which, for the odd-man-out TAGSUPPORT_SERVICE
- * may not match HttpServletRequest.getServletPath() because of
- * the use of an include.
- *
+ * Name of a request attribute used with the {@link #TAGSUPPORT_SERVICE}service. The attribute
+ * defines the underlying service to for which a URL will be generated.
+ *
+ * @since 3.0
+ */
+
+ public final static String TAG_SUPPORT_SERVICE_ATTRIBUTE = "org.apache.tapestry.tagsupport.service";
+
+ /**
+ * Name of a request attribute used with the {@link #TAGSUPPORT_SERVICE}service. The attribute
+ * defines the correct servlet path for the Tapestry application (which, for the odd-man-out
+ * TAGSUPPORT_SERVICE may not match HttpServletRequest.getServletPath() because of the use of an
+ * include.
+ *
* @since 3.0
*/
- public final static String TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE =
- "org.apache.tapestry.tagsupport.servlet-path";
-
- /**
- * Name of a request attribute used with the
- * {@link #TAGSUPPORT_SERVICE} service. The attribute
- * defines an array of objects to be converted into
- * service parameters (i.e., for use with the
- * {@link #EXTERNAL_SERVICE}).
- *
- * @since 3.0
- *
- **/
-
- public final static String TAG_SUPPORT_PARAMETERS_ATTRIBUTE =
- "org.apache.tapestry.tagsupport.parameters";
-
- /**
- * Service used to support rendering of JSP tags. tagsupport is provided
- * with a service and service parameters via request attributes
- * and creates a URI from the result, which is output to the response.
- *
- * @since 3.0
- *
- **/
+ public final static String TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE = "org.apache.tapestry.tagsupport.servlet-path";
+
+ /**
+ * Name of a request attribute used with the {@link #TAGSUPPORT_SERVICE}service. The attribute
+ * defines an array of objects to be converted into service parameters (i.e., for use with the
+ * {@link #EXTERNAL_SERVICE}).
+ *
+ * @since 3.0
+ */
+
+ public final static String TAG_SUPPORT_PARAMETERS_ATTRIBUTE = "org.apache.tapestry.tagsupport.parameters";
+
+ /**
+ * Service used to support rendering of JSP tags. tagsupport is provided with a service and
+ * service parameters via request attributes and creates a URI from the result, which is output
+ * to the response.
+ *
+ * @since 3.0
+ */
public static final String TAGSUPPORT_SERVICE = "tagsupport";
/**
- * The name ("action") of a service that allows behavior to be associated with
- * an {@link IAction} component, such as {@link org.apache.tapestry.link.ActionLink} or
- * {@link org.apache.tapestry.form.Form}.
- *
- * <p>This service is used with actions that are tied to the
- * dynamic state of the page, and which require a rewind of the page.
- *
- **/
+ * The name ("action") of a service that allows behavior to be associated with an
+ * {@link IAction}component, such as {@link org.apache.tapestry.link.ActionLink}or
+ * {@link org.apache.tapestry.form.Form}.
+ * <p>
+ * This service is used with actions that are tied to the dynamic state of the page, and which
+ * require a rewind of the page.
+ */
public final static String ACTION_SERVICE = "action";
/**
- * The name ("direct") of a service that allows stateless behavior for an {@link
- * org.apache.tapestry.link.DirectLink} component.
- *
- * <p>This service rolls back the state of the page but doesn't
- * rewind the the dynamic state of the page the was the action
- * service does, which is more efficient but less powerful.
- *
- * <p>An array of String parameters may be included with the
- * service URL; these will be made available to the {@link org.apache.tapestry.link.DirectLink}
- * component's listener.
- *
- **/
+ * The name ("direct") of a service that allows stateless behavior for an {@link
+ * org.apache.tapestry.link.DirectLink} component.
+ * <p>
+ * This service rolls back the state of the page but doesn't rewind the the dynamic state of the
+ * page the was the action service does, which is more efficient but less powerful.
+ * <p>
+ * An array of String parameters may be included with the service URL; these will be made
+ * available to the {@link org.apache.tapestry.link.DirectLink}component's listener.
+ */
public final static String DIRECT_SERVICE = "direct";
/**
- * The name ("external") of a service that a allows {@link IExternalPage} to be selected.
- * Associated with a {@link org.apache.tapestry.link.ExternalLink} component.
- *
- * <p>This service enables {@link IExternalPage}s to be accessed via a URL.
- * External pages may be booked marked using their URL for future reference.
- *
- * <p>An array of Object parameters may be included with the
- * service URL; these will be passed to the
- * {@link IExternalPage#activateExternalPage(Object[], IRequestCycle)} method.
- *
- **/
+ * The name ("external") of a service that a allows {@link IExternalPage}to be selected.
+ * Associated with a {@link org.apache.tapestry.link.ExternalLink}component.
+ * <p>
+ * This service enables {@link IExternalPage}s to be accessed via a URL. External pages may be
+ * booked marked using their URL for future reference.
+ * <p>
+ * An array of Object parameters may be included with the service URL; these will be passed to
+ * the {@link IExternalPage#activateExternalPage(Object[], IRequestCycle)}method.
+ */
public final static String EXTERNAL_SERVICE = "external";
/**
- * The name ("page") of a service that allows a new page to be selected.
- * Associated with a {@link org.apache.tapestry.link.PageLink} component.
- *
- * <p>The service requires a single parameter: the name of the target page.
- **/
+ * The name ("page") of a service that allows a new page to be selected. Associated with a
+ * {@link org.apache.tapestry.link.PageLink}component.
+ * <p>
+ * The service requires a single parameter: the name of the target page.
+ */
public final static String PAGE_SERVICE = "page";
/**
- * The name ("home") of a service that jumps to the home page. A stand-in for
- * when no service is provided, which is typically the entrypoint
- * to the application.
- *
- **/
+ * The name ("home") of a service that jumps to the home page. A stand-in for when no service is
+ * provided, which is typically the entrypoint to the application.
+ */
public final static String HOME_SERVICE = "home";
/**
- * The name ("restart") of a service that invalidates the session and restarts
- * the application. Typically used just
- * to recover from an exception.
- *
- **/
+ * The name ("restart") of a service that invalidates the session and restarts the application.
+ * Typically used just to recover from an exception.
+ */
public static final String RESTART_SERVICE = "restart";
/**
- * The name ("asset") of a service used to access internal assets.
- *
- **/
+ * The name ("asset") of a service used to access internal assets.
+ */
public static final String ASSET_SERVICE = "asset";
/**
- * The name ("reset") of a service used to clear cached template
- * and specification data and remove all pooled pages.
- * This is only used when debugging as
- * a quick way to clear the out cached data, to allow updated
- * versions of specifications and templates to be loaded (without
- * stopping and restarting the servlet container).
- *
- * <p>This service is only available if the Java system property
- * <code>org.apache.tapestry.enable-reset-service</code>
- * is set to <code>true</code>.
- *
- **/
+ * The name ("reset") of a service used to clear cached template and specification data and
+ * remove all pooled pages. This is only used when debugging as a quick way to clear the out
+ * cached data, to allow updated versions of specifications and templates to be loaded (without
+ * stopping and restarting the servlet container).
+ * <p>
+ * This service is only available if the Java system property
+ * <code>org.apache.tapestry.enable-reset-service</code> is set to <code>true</code>.
+ */
public static final String RESET_SERVICE = "reset";
/**
- * Query parameter that identfies the service for the
- * request.
- *
- * @since 1.0.3
- *
- **/
+ * Query parameter that identfies the service for the request.
+ *
+ * @since 1.0.3
+ */
public static final String SERVICE_QUERY_PARAMETER_NAME = "service";
/**
- * The query parameter for application specific parameters to the
- * service (this is used with the direct service). Each of these
- * values is encoded with {@link java.net.URLEncoder#encode(String)} before
- * being added to the URL. Multiple values are handle by repeatedly
- * establishing key/value pairs (this is a change from behavior in
- * 2.1 and earlier).
- *
- * @since 1.0.3
- *
- **/
+ * The query parameter for application specific parameters to the service (this is used with the
+ * direct service). Each of these values is encoded with
+ * {@link java.net.URLEncoder#encode(String)}before being added to the URL. Multiple values are
+ * handle by repeatedly establishing key/value pairs (this is a change from behavior in 2.1 and
+ * earlier).
+ *
+ * @since 1.0.3
+ */
public static final String PARAMETERS_QUERY_PARAMETER_NAME = "sp";
/**
- * Property name used to get the extension used for templates. This
- * may be set in the page or component specification, or in the page (or
- * component's) immediate container (library or application specification).
- * Unlike most properties, value isn't inherited all the way up the chain.
- * The default template extension is "html".
- *
- * @since 3.0
- *
- **/
-
- public static final String TEMPLATE_EXTENSION_PROPERTY =
- "org.apache.tapestry.template-extension";
-
- /**
- * The default extension for templates, "html".
- *
- * @since 3.0
- *
- **/
+ * Property name used to get the extension used for templates. This may be set in the page or
+ * component specification, or in the page (or component's) immediate container (library or
+ * application specification). Unlike most properties, value isn't inherited all the way up the
+ * chain. The default template extension is "html".
+ *
+ * @since 3.0
+ */
+
+ public static final String TEMPLATE_EXTENSION_PROPERTY = "org.apache.tapestry.template-extension";
+
+ /**
+ * The default extension for templates, "html".
+ *
+ * @since 3.0
+ */
public static final String DEFAULT_TEMPLATE_EXTENSION = "html";
/**
- * The name of an {@link org.apache.tapestry.IRequestCycle} attribute in which the
- * currently rendering {@link org.apache.tapestry.components.ILinkComponent}
- * is stored. Link components do not nest.
- *
- **/
-
- public static final String LINK_COMPONENT_ATTRIBUTE_NAME =
- "org.apache.tapestry.active-link-component";
-
- /**
- * Suffix appended to a parameter name to form the name of a property that stores the
- * binding for the parameter.
- *
- * @since 3.0
- *
- **/
+ * The name of an {@link org.apache.tapestry.IRequestCycle}attribute in which the currently
+ * rendering {@link org.apache.tapestry.components.ILinkComponent}is stored. Link components do
+ * not nest.
+ */
+
+ public static final String LINK_COMPONENT_ATTRIBUTE_NAME = "org.apache.tapestry.active-link-component";
+
+ /**
+ * Suffix appended to a parameter name to form the name of a property that stores the binding
+ * for the parameter.
+ *
+ * @since 3.0
+ */
public static final String PARAMETER_PROPERTY_NAME_SUFFIX = "Binding";
/**
- * Key used to obtain an extension from the application specification. The extension,
- * if it exists, implements {@link org.apache.tapestry.request.IRequestDecoder}.
- *
- * @since 2.2
- *
- **/
-
- public static final String REQUEST_DECODER_EXTENSION_NAME =
- "org.apache.tapestry.request-decoder";
-
- /**
- * Name of optional application extension for the multipart decoder
- * used by the application. The extension must implement
- * {@link org.apache.tapestry.multipart.IMultipartDecoder}
- * (and is generally a configured instance of
- * {@link org.apache.tapestry.multipart.DefaultMultipartDecoder}).
- *
- * @since 3.0
- *
- **/
+ * Key used to obtain an extension from the application specification. The extension, if it
+ * exists, implements {@link org.apache.tapestry.request.IRequestDecoder}.
+ *
+ * @since 2.2
+ */
+
+ public static final String REQUEST_DECODER_EXTENSION_NAME = "org.apache.tapestry.request-decoder";
+
+ /**
+ * Name of optional application extension for the multipart decoder used by the application. The
+ * extension must implement {@link org.apache.tapestry.multipart.IMultipartDecoder}(and is
+ * generally a configured instance of
+ * {@link org.apache.tapestry.multipart.DefaultMultipartDecoder}).
+ *
+ * @since 3.0
+ */
- public static final String MULTIPART_DECODER_EXTENSION_NAME =
- "org.apache.tapestry.multipart-decoder";
+ public static final String MULTIPART_DECODER_EXTENSION_NAME = "org.apache.tapestry.multipart-decoder";
/**
- * Method id used to check that {@link IPage#validate(IRequestCycle)}
- * is invoked.
+ * Method id used to check that {@link IPage#validate(IRequestCycle)}is invoked.
+ *
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
*/
@@ -300,7 +257,8 @@
public static final String ABSTRACTPAGE_VALIDATE_METHOD_ID = "AbstractPage.validate()";
/**
- * Method id used to check that {@link IPage#detach()} is invoked.
+ * Method id used to check that {@link IPage#detach()}is invoked.
+ *
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
*/
@@ -308,68 +266,62 @@
public static final String ABSTRACTPAGE_DETACH_METHOD_ID = "AbstractPage.detach()";
/**
- * Regular expression defining a simple property name. Used by several different
- * parsers. Simple property names match Java variable names; a leading letter
- * (or underscore), followed by letters, numbers and underscores.
- *
- * @since 3.0
- *
- **/
+ * Regular expression defining a simple property name. Used by several different parsers. Simple
+ * property names match Java variable names; a leading letter (or underscore), followed by
+ * letters, numbers and underscores.
+ *
+ * @since 3.0
+ */
public static final String SIMPLE_PROPERTY_NAME_PATTERN = "^_?[a-zA-Z]\\w*$";
/**
* Name of an application extension used as a factory for
- * {@link org.apache.tapestry.engine.IMonitor} instances. The extension
- * must implement {@link org.apache.tapestry.engine.IMonitorFactory}.
- *
+ * {@link org.apache.tapestry.engine.IMonitor}instances. The extension must implement
+ * {@link org.apache.tapestry.engine.IMonitorFactory}.
+ *
* @since 3.0
*/
- public static final String MONITOR_FACTORY_EXTENSION_NAME =
- "org.apache.tapestry.monitor-factory";
+ public static final String MONITOR_FACTORY_EXTENSION_NAME = "org.apache.tapestry.monitor-factory";
/**
- * Class name of an {@link ognl.TypeConverter} implementing class
- * to use as a type converter for {@link org.apache.tapestry.binding.ExpressionBinding}
+ * Class name of an {@link ognl.TypeConverter}implementing class to use as a type converter for
+ * {@link org.apache.tapestry.binding.ExpressionBinding}
*/
public static final String OGNL_TYPE_CONVERTER = "org.apache.tapestry.ognl-type-converter";
/**
- * Prevent instantiation.
- *
- **/
+ * Prevent instantiation.
+ */
private Tapestry()
{
}
/**
- * The version of the framework; this is updated for major releases.
- *
- **/
+ * The version of the framework; this is updated for major releases.
+ */
public static final String VERSION = readVersion();
/**
- * Contains strings loaded from TapestryStrings.properties.
- *
- * @since 1.0.8
- *
- **/
+ * Contains strings loaded from TapestryStrings.properties.
+ *
+ * @since 1.0.8
+ */
private static ResourceBundle _strings;
/**
- * A {@link Map} that links Locale names (as in {@link Locale#toString()} to
- * {@link Locale} instances. This prevents needless duplication
- * of Locales.
- *
- **/
+ * A {@link Map}that links Locale names (as in {@link Locale#toString()}to {@link Locale}
+ * instances. This prevents needless duplication of Locales.
+ */
private static final Map _localeMap = new HashMap();
- static {
+ static
+ {
Locale[] locales = Locale.getAvailableLocales();
for (int i = 0; i < locales.length; i++)
{
@@ -378,26 +330,25 @@
}
/**
- * Used for tracking if a particular super-class method has been invoked.
+ * Used for tracking if a particular super-class method has been invoked.
*/
private static final ThreadLocal _invokedMethodIds = new ThreadLocal();
/**
- * A {@link org.apache.tapestry.util.AdaptorRegistry} used to coerce arbitrary objects
- * to boolean values.
- *
- * @see #evaluateBoolean(Object)
- **/
+ * A {@link org.apache.tapestry.util.AdaptorRegistry}used to coerce arbitrary objects to
+ * boolean values.
+ *
+ * @see #evaluateBoolean(Object)
+ */
private static final AdaptorRegistry _booleanAdaptors = new AdaptorRegistry();
private static abstract class BoolAdaptor
{
/**
- * Implemented by subclasses to coerce an object to a boolean.
- *
- **/
+ * Implemented by subclasses to coerce an object to a boolean.
+ */
public abstract boolean coerce(Object value);
}
@@ -454,7 +405,8 @@
}
}
- static {
+ static
+ {
_booleanAdaptors.register(Boolean.class, new BooleanAdaptor());
_booleanAdaptors.register(Number.class, new NumberAdaptor());
_booleanAdaptors.register(Collection.class, new CollectionAdaptor());
@@ -472,19 +424,16 @@
}
/**
- * {@link AdaptorRegistry} used to extract an {@link Iterator} from
- * an arbitrary object.
- *
- **/
+ * {@link AdaptorRegistry}used to extract an {@link Iterator}from an arbitrary object.
+ */
private static AdaptorRegistry _iteratorAdaptors = new AdaptorRegistry();
private abstract static class IteratorAdaptor
{
/**
- * Coeerces the object into an {@link Iterator}.
- *
- **/
+ * Coeerces the object into an {@link Iterator}.
+ */
abstract public Iterator coerce(Object value);
}
@@ -676,7 +625,8 @@
}
}
- static {
+ static
+ {
_iteratorAdaptors.register(Iterator.class, new DefaultIteratorAdaptor());
_iteratorAdaptors.register(Collection.class, new CollectionIteratorAdaptor());
_iteratorAdaptors.register(Object.class, new ObjectIteratorAdaptor());
@@ -692,14 +642,10 @@
}
/**
- * Copys all informal {@link IBinding bindings} from a source component
- * to the destination component. Informal bindings are bindings for
- * informal parameters. This will overwrite parameters (formal or
- * informal) in the
- * destination component if there is a naming conflict.
- *
- *
- **/
+ * Copys all informal {@link IBinding bindings}from a source component to the destination
+ * component. Informal bindings are bindings for informal parameters. This will overwrite
+ * parameters (formal or informal) in the destination component if there is a naming conflict.
+ */
public static void copyInformalBindings(IComponent source, IComponent destination)
{
@@ -727,34 +673,34 @@
}
/**
- * Evaluates an object to determine its boolean value.
- *
- * <table border=1>
- * <tr> <th>Class</th> <th>Test</th> </tr>
- * <tr>
- * <td>{@link Boolean}</td>
- * <td>Self explanatory.</td>
- * </tr>
- * <tr> <td>{@link Number}</td>
- * <td>True if non-zero, false otherwise.</td>
- * </tr>
- * <tr>
- * <td>{@link Collection}</td>
- * <td>True if contains any elements (non-zero size), false otherwise.</td>
- * </tr>
- * <tr>
- * <td>{@link String}</td>
- * <td>True if contains any non-whitespace characters, false otherwise.</td>
- * </tr>
- * <tr>
- * <td>Any Object array type</td>
- * <td>True if contains any elements (non-zero length), false otherwise.</td>
- * <tr>
- *</table>
- *
- * <p>Any other non-null object evaluates to true.
- *
- **/
+ * Evaluates an object to determine its boolean value. <table border=1>
+ * <tr>
+ * <th>Class</th>
+ * <th>Test</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Boolean}</td>
+ * <td>Self explanatory.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link Number}</td>
+ * <td>True if non-zero, false otherwise.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link Collection}</td>
+ * <td>True if contains any elements (non-zero size), false otherwise.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link String}</td>
+ * <td>True if contains any non-whitespace characters, false otherwise.</td>
+ * </tr>
+ * <tr>
+ * <td>Any Object array type</td>
+ * <td>True if contains any elements (non-zero length), false otherwise.</td>
+ * <tr></table>
+ * <p>
+ * Any other non-null object evaluates to true.
+ */
public static boolean evaluateBoolean(Object value)
{
@@ -775,23 +721,33 @@
}
/**
- * Converts an Object into an {@link Iterator}, following some basic rules.
- *
- * <table border=1>
- * <tr><th>Input Class</th> <th>Result</th> </tr>
- * <tr><td>array</td> <td>Converted to a {@link List} and iterator returned.
- * null returned if the array is empty. This works with both object arrays and
- * arrays of scalars. </td>
+ * Converts an Object into an {@link Iterator}, following some basic rules. <table border=1>
+ * <tr>
+ * <th>Input Class</th>
+ * <th>Result</th>
+ * </tr>
+ * <tr>
+ * <td>array</td>
+ * <td>Converted to a {@link List}and iterator returned. null returned if the array is empty.
+ * This works with both object arrays and arrays of scalars.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link Iterator}</td>
+ * <td>Returned as-is.</td>
+ * <tr>
+ * <td>{@link Collection}</td>
+ * <td>Iterator returned, or null if the Collection is empty</td>
+ * </tr>
+ * <tr>
+ * <td>Any other</td>
+ * <td>{@link Iterator}for singleton collection returned</td>
+ * </tr>
+ * <tr>
+ * <td>null</td>
+ * <td>null returned</td>
* </tr>
- * <tr><td>{@link Iterator}</td> <td>Returned as-is.</td>
- * <tr><td>{@link Collection}</td> <td>Iterator returned, or null
- * if the Collection is empty</td> </tr>
-
- * <tr><td>Any other</td> <td>{@link Iterator} for singleton collection returned</td> </tr>
- * <tr><td>null</td> <td>null returned</td> </tr>
* </table>
- *
- **/
+ */
public static Iterator coerceToIterator(Object value)
{
@@ -804,12 +760,10 @@
}
/**
- * Gets the {@link Locale} for the given string, which is the result
- * of {@link Locale#toString()}. If no such locale is already registered,
- * a new instance is created, registered and returned.
- *
- *
- **/
+ * Gets the {@link Locale}for the given string, which is the result of
+ * {@link Locale#toString()}. If no such locale is already registered, a new instance is
+ * created, registered and returned.
+ */
public static Locale getLocale(String s)
{
@@ -827,25 +781,24 @@
switch (terms.length)
{
- case 1 :
+ case 1:
result = new Locale(terms[0], "");
break;
- case 2 :
+ case 2:
result = new Locale(terms[0], terms[1]);
break;
- case 3 :
+ case 3:
result = new Locale(terms[0], terms[1], terms[2]);
break;
- default :
+ default:
- throw new IllegalArgumentException(
- "Unable to convert '" + s + "' to a Locale.");
+ throw new IllegalArgumentException("Unable to convert '" + s + "' to a Locale.");
}
synchronized (_localeMap)
@@ -860,11 +813,10 @@
}
/**
- * Closes the stream (if not null), ignoring any {@link IOException} thrown.
- *
- * @since 1.0.2
- *
- **/
+ * Closes the stream (if not null), ignoring any {@link IOException}thrown.
+ *
+ * @since 1.0.2
+ */
public static void close(InputStream stream)
{
@@ -882,13 +834,11 @@
}
/**
- * Gets a string from the TapestryStrings resource bundle.
- * The string in the bundle
- * is treated as a pattern for {@link MessageFormat#format(java.lang.String, java.lang.Object[])}.
- *
- * @since 1.0.8
- *
- **/
+ * Gets a string from the TapestryStrings resource bundle. The string in the bundle is treated
+ * as a pattern for {@link MessageFormat#format(java.lang.String, java.lang.Object[])}.
+ *
+ * @since 1.0.8
+ */
public static String format(String key, Object[] args)
{
@@ -904,10 +854,10 @@
}
/**
- * Convienience method for invoking {@link #format(String, Object[])}.
- *
- * @since 3.0
- **/
+ * Convienience method for invoking {@link #format(String, Object[])}.
+ *
+ * @since 3.0
+ */
public static String getMessage(String key)
{
@@ -915,46 +865,46 @@
}
/**
- * Convienience method for invoking {@link #format(String, Object[])}.
- *
- * @since 3.0
- **/
+ * Convienience method for invoking {@link #format(String, Object[])}.
+ *
+ * @since 3.0
+ */
public static String format(String key, Object arg)
{
- return format(key, new Object[] { arg });
+ return format(key, new Object[]
+ { arg });
}
/**
- * Convienience method for invoking {@link #format(String, Object[])}.
- *
- * @since 3.0
- *
- **/
+ * Convienience method for invoking {@link #format(String, Object[])}.
+ *
+ * @since 3.0
+ */
public static String format(String key, Object arg1, Object arg2)
{
- return format(key, new Object[] { arg1, arg2 });
+ return format(key, new Object[]
+ { arg1, arg2 });
}
/**
- * Convienience method for invoking {@link #format(String, Object[])}.
- *
- * @since 3.0
- *
- **/
+ * Convienience method for invoking {@link #format(String, Object[])}.
+ *
+ * @since 3.0
+ */
public static String format(String key, Object arg1, Object arg2, Object arg3)
{
- return format(key, new Object[] { arg1, arg2, arg3 });
+ return format(key, new Object[]
+ { arg1, arg2, arg3 });
}
private static final String UNKNOWN_VERSION = "Unknown";
/**
- * Invoked when the class is initialized to read the current version file.
- *
- **/
+ * Invoked when the class is initialized to read the current version file.
+ */
private static final String readVersion()
{
@@ -981,11 +931,10 @@
}
/**
- * Returns the size of a collection, or zero if the collection is null.
- *
- * @since 2.2
- *
- **/
+ * Returns the size of a collection, or zero if the collection is null.
+ *
+ * @since 2.2
+ */
public static int size(Collection c)
{
@@ -996,11 +945,10 @@
}
/**
- * Returns the length of the array, or 0 if the array is null.
- *
- * @since 2.2
- *
- **/
+ * Returns the length of the array, or 0 if the array is null.
+ *
+ * @since 2.2
+ */
public static int size(Object[] array)
{
@@ -1011,11 +959,10 @@
}
/**
- * Returns true if the Map is null or empty.
- *
- * @since 3.0
- *
- **/
+ * Returns true if the Map is null or empty.
+ *
+ * @since 3.0
+ */
public static boolean isEmpty(Map map)
{
@@ -1023,11 +970,10 @@
}
/**
- * Returns true if the Collection is null or empty.
- *
- * @since 3.0
- *
- **/
+ * Returns true if the Collection is null or empty.
+ *
+ * @since 3.0
+ */
public static boolean isEmpty(Collection c)
{
@@ -1035,19 +981,16 @@
}
/**
- * Converts a {@link Map} to an even-sized array of key/value
- * pairs. This may be useful when using a Map as service parameters
- * (with {@link org.apache.tapestry.link.DirectLink}. Assuming the keys
- * and values are simple objects (String, Boolean, Integer, etc.), then
- * the representation as an array will encode more efficiently
- * (via {@link org.apache.tapestry.util.io.DataSqueezerImpl} than
- * serializing the Map and its contents.
- *
- * @return the array of keys and values, or null if the input
- * Map is null or empty
- *
- * @since 2.2
- **/
+ * Converts a {@link Map}to an even-sized array of key/value pairs. This may be useful when
+ * using a Map as service parameters (with {@link org.apache.tapestry.link.DirectLink}.
+ * Assuming the keys and values are simple objects (String, Boolean, Integer, etc.), then the
+ * representation as an array will encode more efficiently (via
+ * {@link org.apache.tapestry.util.io.DataSqueezerImpl}than serializing the Map and its
+ * contents.
+ *
+ * @return the array of keys and values, or null if the input Map is null or empty
+ * @since 2.2
+ */
public static Object[] convertMapToArray(Map map)
{
@@ -1072,14 +1015,12 @@
}
/**
- * Converts an even-sized array of objects back
- * into a {@link Map}.
- *
- * @see #convertMapToArray(Map)
- * @return a Map, or null if the array is null or empty
- * @since 2.2
- *
- **/
+ * Converts an even-sized array of objects back into a {@link Map}.
+ *
+ * @see #convertMapToArray(Map)
+ * @return a Map, or null if the array is null or empty
+ * @since 2.2
+ */
public static Map convertArrayToMap(Object[] array)
{
@@ -1104,13 +1045,11 @@
}
/**
- * Returns the application root location, which is in the
- * {@link javax.servlet.ServletContext}, based on
- * the {@link javax.servlet.http.HttpServletRequest#getServletPath() servlet path}.
- *
- * @since 3.0
- *
- **/
+ * Returns the application root location, which is in the {@link javax.servlet.ServletContext},
+ * based on the {@link javax.servlet.http.HttpServletRequest#getServletPath() servlet path}.
+ *
+ * @since 3.0
+ */
public static Resource getApplicationRootLocation(IRequestCycle cycle)
{
@@ -1125,9 +1064,9 @@
}
/**
- * Given a Class, creates a presentable name for the class, even if the
- * class is a scalar type or Array type.
- *
+ * Given a Class, creates a presentable name for the class, even if the class is a scalar type
+ * or Array type.
+ *
* @since 3.0
*/
@@ -1140,62 +1079,49 @@
}
/**
- * Creates an exception indicating the binding value is null.
- *
- * @since 3.0
- *
- **/
+ * Creates an exception indicating the binding value is null.
+ *
+ * @since 3.0
+ */
public static BindingException createNullBindingException(IBinding binding)
{
return new BindingException(getMessage("null-value-for-binding"), binding);
}
- /** @since 3.0 **/
+ /** @since 3.0 * */
- public static ApplicationRuntimeException createNoSuchComponentException(
- IComponent component,
- String id,
- Location location)
+ public static ApplicationRuntimeException createNoSuchComponentException(IComponent component,
+ String id, Location location)
{
- return new ApplicationRuntimeException(
- format("no-such-component", component.getExtendedId(), id),
- component,
- location,
- null);
+ return new ApplicationRuntimeException(format("no-such-component", component
+ .getExtendedId(), id), component, location, null);
}
- /** @since 3.0 **/
+ /** @since 3.0 * */
- public static BindingException createRequiredParameterException(
- IComponent component,
- String parameterName)
+ public static BindingException createRequiredParameterException(IComponent component,
+ String parameterName)
{
- return new BindingException(
- format("required-parameter", parameterName, component.getExtendedId()),
- component,
- null,
- component.getBinding(parameterName),
- null);
+ return new BindingException(format("required-parameter", parameterName, component
+ .getExtendedId()), component, null, component.getBinding(parameterName), null);
}
- /** @since 3.0 **/
+ /** @since 3.0 * */
public static ApplicationRuntimeException createRenderOnlyPropertyException(
- IComponent component,
- String propertyName)
+ IComponent component, String propertyName)
{
- return new ApplicationRuntimeException(
- format("render-only-property", propertyName, component.getExtendedId()),
- component,
- null,
- null);
+ return new ApplicationRuntimeException(format(
+ "render-only-property",
+ propertyName,
+ component.getExtendedId()), component, null, null);
}
/**
* Clears the list of method invocations.
+ *
* @see #checkMethodInvocation(Object, String, Object)
- *
* @since 3.0
*/
@@ -1205,12 +1131,11 @@
}
/**
- * Adds a method invocation to the list of invocations. This is done
- * in a super-class implementations.
- *
+ * Adds a method invocation to the list of invocations. This is done in a super-class
+ * implementations.
+ *
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
- *
*/
public static void addMethodInvocation(Object methodId)
@@ -1227,19 +1152,16 @@
}
/**
- * Checks to see if a particular method has been invoked. The method is identified by a
- * methodId (usually a String). The methodName and object are used to create an
- * error message.
- *
+ * Checks to see if a particular method has been invoked. The method is identified by a methodId
+ * (usually a String). The methodName and object are used to create an error message.
* <p>
- * The caller should invoke {@link #clearMethodInvocations()}, then invoke a method on
- * the object. The super-class implementation should invoke {@link #addMethodInvocation(Object)}
- * to indicate that it was, in fact, invoked. The caller then invokes
- * this method to vlaidate that the super-class implementation was invoked.
- *
+ * The caller should invoke {@link #clearMethodInvocations()}, then invoke a method on the
+ * object. The super-class implementation should invoke {@link #addMethodInvocation(Object)}to
+ * indicate that it was, in fact, invoked. The caller then invokes this method to vlaidate that
+ * the super-class implementation was invoked.
* <p>
- * The list of method invocations is stored in a {@link ThreadLocal} variable.
- *
+ * The list of method invocations is stored in a {@link ThreadLocal}variable.
+ *
* @since 3.0
*/
@@ -1250,27 +1172,24 @@
if (methodIds != null && methodIds.contains(methodId))
return;
- throw new ApplicationRuntimeException(
- Tapestry.format(
+ throw new ApplicationRuntimeException(Tapestry.format(
"Tapestry.missing-method-invocation",
object.getClass().getName(),
methodName));
}
/**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
+ * Method used by pages and components to send notifications about property changes.
+ *
+ * @param component
+ * the component containing the property
+ * @param propertyName
+ * the name of the property which changed
+ * @param newValue
+ * the new value for the property
* @since 3.0
*/
- public static void fireObservedChange(
- IComponent component,
- String propertyName,
- Object newValue)
+ public static void fireObservedChange(IComponent component, String propertyName, Object newValue)
{
ChangeObserver observer = component.getPage().getChangeObserver();
@@ -1283,211 +1202,10 @@
}
/**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(
- IComponent component,
- String propertyName,
- boolean newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(
- component,
- propertyName,
- newValue ? Boolean.TRUE : Boolean.FALSE);
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(
- IComponent component,
- String propertyName,
- double newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Double(newValue));
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(
- IComponent component,
- String propertyName,
- float newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Float(newValue));
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(IComponent component, String propertyName, int newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Integer(newValue));
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(IComponent component, String propertyName, long newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Long(newValue));
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(IComponent component, String propertyName, char newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Character(newValue));
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(IComponent component, String propertyName, byte newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Byte(newValue));
-
- observer.observeChange(event);
- }
-
- /**
- * Method used by pages and components to send notifications about
- * property changes.
- *
- * @param component the component containing the property
- * @param propertyName the name of the property which changed
- * @param newValue the new value for the property
- *
- * @since 3.0
- */
- public static void fireObservedChange(
- IComponent component,
- String propertyName,
- short newValue)
- {
- ChangeObserver observer = component.getPage().getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event =
- new ObservedChangeEvent(component, propertyName, new Short(newValue));
-
- observer.observeChange(event);
- }
-
- /**
* Returns true if the input is null or contains only whitespace.
- *
* <p>
- * Note: Yes, you'd think we'd use <code>StringUtils</code>, but with
- * the change in names and behavior between releases, it is smarter
- * to just implement our own little method!
+ * Note: Yes, you'd think we'd use <code>StringUtils</code>, but with the change in names and
+ * behavior between releases, it is smarter to just implement our own little method!
*
* @since 3.0
*/
@@ -1504,7 +1222,6 @@
* Returns true if the input is not null and not empty (or only whitespace).
*
* @since 3.0
- *
*/
public static boolean isNonBlank(String input)
@@ -1512,9 +1229,9 @@
return !isBlank(input);
}
- /**
- * Defensive programming: check for null parameter where it is not acceptible.
- */
+ /**
+ * Defensive programming: check for null parameter where it is not acceptible.
+ */
public static void notNull(Object parameter, String parameterName)
{
if (parameter == null)
1.4 +0 -91 jakarta-tapestry/framework/src/java/org/apache/tapestry/AbstractComponent.java
Index: AbstractComponent.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/AbstractComponent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractComponent.java 16 Sep 2004 14:58:33 -0000 1.3
+++ AbstractComponent.java 5 Oct 2004 18:33:13 -0000 1.4
@@ -259,97 +259,6 @@
}
/**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, int)}instead.
- */
- protected void fireObservedChange(String propertyName, int newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, Object)}instead.
- */
- protected void fireObservedChange(String propertyName, Object newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, boolean)}instead.
- */
- protected void fireObservedChange(String propertyName, boolean newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, double)}instead.
- */
- protected void fireObservedChange(String propertyName, double newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, float)}instead.
- */
- protected void fireObservedChange(String propertyName, float newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, long)}instead.
- */
- protected void fireObservedChange(String propertyName, long newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, char)}instead.
- */
- protected void fireObservedChange(String propertyName, char newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, byte)}instead.
- */
- protected void fireObservedChange(String propertyName, byte newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link Tapestry#fireObservedChange(IComponent, String, short)}instead.
- */
- protected void fireObservedChange(String propertyName, short newValue)
- {
- Tapestry.fireObservedChange(this, propertyName, newValue);
- }
-
- /**
- * @deprecated To be removed in 3.1. Use
- * {@link #renderInformalParameters(IMarkupWriter, IRequestCycle)}instead.
- */
-
- protected void generateAttributes(IMarkupWriter writer, IRequestCycle cycle)
- {
- renderInformalParameters(writer, cycle);
- }
-
- /**
* Converts informal parameters into additional attributes on the curently open tag.
* <p>
* Invoked from subclasses to allow additional attributes to be specified within a tag (this
1.3 +2 -1 jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/tree/components/TreeView.java
Index: TreeView.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/tree/components/TreeView.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TreeView.java 25 Aug 2004 19:43:24 -0000 1.2
+++ TreeView.java 5 Oct 2004 18:33:13 -0000 1.3
@@ -20,6 +20,7 @@
import org.apache.tapestry.IBinding;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.contrib.tree.model.ISessionStoreManager;
import org.apache.tapestry.contrib.tree.model.ITreeModel;
import org.apache.tapestry.contrib.tree.model.ITreeModelSource;
@@ -196,7 +197,7 @@
ISessionStoreManager objHolder = getSessionStoreManager();
if (objHolder == null) {
- fireObservedChange("treeSessionState", objSessionState);
+ Tapestry.fireObservedChange(this, "treeSessionState", objSessionState);
} else {
//String strPath = "treeSessionState";
String strPath = getExtendedId();
1.5 +5 -4 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c11/PersistentSelectPage.java
Index: PersistentSelectPage.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c11/PersistentSelectPage.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PersistentSelectPage.java 16 Sep 2004 00:26:30 -0000 1.4
+++ PersistentSelectPage.java 5 Oct 2004 18:33:13 -0000 1.5
@@ -14,12 +14,13 @@
package org.apache.tapestry.junit.mock.c11;
+import org.apache.tapestry.Tapestry;
+
/**
* Makes the three properties persistent.
*
* @author Howard Lewis Ship
- * @version $Id$
* @since 3.0
**/
@@ -29,7 +30,7 @@
{
super.setAnimal(animal);
- fireObservedChange("animal", animal);
+ Tapestry.fireObservedChange(this, "animal", new Boolean(animal));
}
@@ -37,7 +38,7 @@
{
super.setMineral(mineral);
- fireObservedChange("mineral", mineral);
+ Tapestry.fireObservedChange(this, "mineral", new Boolean(mineral));
}
@@ -45,7 +46,7 @@
{
super.setVegetable(vegetable);
- fireObservedChange("vegetable", vegetable);
+ Tapestry.fireObservedChange(this, "vegetable", new Boolean(vegetable));
}
1.6 +3 -2 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c6/Home.java
Index: Home.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c6/Home.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Home.java 16 Sep 2004 00:26:28 -0000 1.5
+++ Home.java 5 Oct 2004 18:33:13 -0000 1.6
@@ -15,6 +15,7 @@
package org.apache.tapestry.junit.mock.c6;
import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.html.BasePage;
/**
@@ -44,7 +45,7 @@
{
_message = message;
- fireObservedChange("message", message);
+ Tapestry.fireObservedChange(this, "message", message);
}
public void updateMessage(IRequestCycle cycle)
1.6 +3 -2 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c6/Nested.java
Index: Nested.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c6/Nested.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Nested.java 16 Sep 2004 00:26:28 -0000 1.5
+++ Nested.java 5 Oct 2004 18:33:13 -0000 1.6
@@ -16,6 +16,7 @@
import org.apache.tapestry.BaseComponent;
import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.event.PageDetachListener;
import org.apache.tapestry.event.PageEvent;
@@ -46,7 +47,7 @@
{
_message = message;
- fireObservedChange("message", message);
+ Tapestry.fireObservedChange(this, "message", message);
}
public void updateMessage(IRequestCycle cycle)
1.6 +47 -40 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c6/Four.java
Index: Four.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c6/Four.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Four.java 16 Sep 2004 00:26:28 -0000 1.5
+++ Four.java 5 Oct 2004 18:33:13 -0000 1.6
@@ -15,42 +15,49 @@
package org.apache.tapestry.junit.mock.c6;
import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.html.BasePage;
/**
- * Test a number of different property value types.
- *
- * @author Howard Lewis Ship
- * @version $Id$
- * @since 3.0
- *
- **/
+ * Test a number of different property value types.
+ *
+ * @author Howard Lewis Ship
+ * @since 3.0
+ */
public class Four extends BasePage
{
private boolean _booleanValue;
+
private byte _byteValue;
+
private short _shortValue;
+
private long _longValue;
+
private float _floatValue;
+
private double _doubleValue;
+
private char _charValue;
+
private int _intValue;
+
private StringHolder _stringHolder;
-
+
public void initialize()
{
- _booleanValue = false;
- _byteValue = 0;
- _shortValue = 0;
- _longValue = 0;
- _floatValue = 0;
- _doubleValue = 0;
- _charValue = ' ';
- _intValue = 0;
- _stringHolder = null;
- }
-
+ _booleanValue = false;
+ _byteValue = 0;
+ _shortValue = 0;
+ _longValue = 0;
+ _floatValue = 0;
+ _doubleValue = 0;
+ _charValue = ' ';
+ _intValue = 0;
+ _stringHolder = null;
+ }
+
public boolean getBooleanValue()
{
return _booleanValue;
@@ -79,36 +86,36 @@
public void setBooleanValue(boolean booleanValue)
{
_booleanValue = booleanValue;
-
- fireObservedChange("booleanValue", booleanValue);
+
+ Tapestry.fireObservedChange(this, "booleanValue", new Boolean(booleanValue));
}
public void setDoubleValue(double doubleValue)
{
_doubleValue = doubleValue;
-
- fireObservedChange("doubleValue", _doubleValue);
+
+ Tapestry.fireObservedChange(this, "doubleValue", new Double(_doubleValue));
}
public void setFloatValue(float floatValue)
{
_floatValue = floatValue;
-
- fireObservedChange("floatValue", _floatValue);
+
+ Tapestry.fireObservedChange(this, "floatValue", new Float(_floatValue));
}
public void setLongValue(long longValue)
{
_longValue = longValue;
-
- fireObservedChange("longValue", _longValue);
+
+ Tapestry.fireObservedChange(this, "longValue", new Long(_longValue));
}
public void setShortValue(short shortValue)
{
_shortValue = shortValue;
-
- fireObservedChange("shortValue", _shortValue);
+
+ Tapestry.fireObservedChange(this, "shortValue", new Short(_shortValue));
}
public char getCharValue()
@@ -119,8 +126,8 @@
public void setCharValue(char charValue)
{
_charValue = charValue;
-
- fireObservedChange("charValue", charValue);
+
+ Tapestry.fireObservedChange(this, "charValue", new Character(charValue));
}
public void change(IRequestCycle cycle)
@@ -130,8 +137,8 @@
setLongValue(1234567890123l);
setFloatValue(-1.5f);
setDoubleValue(22. / 7.);
- setShortValue((short)127);
- setByteValue((byte)27);
+ setShortValue((short) 127);
+ setByteValue((byte) 27);
setIntValue(23);
setStringHolder(new StringHolder("Surprise!"));
}
@@ -144,8 +151,8 @@
public void setByteValue(byte byteValue)
{
_byteValue = byteValue;
-
- fireObservedChange("byteValue", byteValue);
+
+ Tapestry.fireObservedChange(this, "byteValue", new Byte(byteValue));
}
public int getIntValue()
@@ -156,8 +163,8 @@
public void setIntValue(int intValue)
{
_intValue = intValue;
-
- fireObservedChange("intValue", intValue);
+
+ Tapestry.fireObservedChange(this, "intValue", new Integer(intValue));
}
public StringHolder getStringHolder()
@@ -168,8 +175,8 @@
public void setStringHolder(StringHolder stringHolder)
{
_stringHolder = stringHolder;
-
- fireObservedChange("stringHolder", stringHolder);
+
+ Tapestry.fireObservedChange(this, "stringHolder", stringHolder);
}
-}
+}
\ No newline at end of file
1.5 +19 -21 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/lib/Dumper.java
Index: Dumper.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/lib/Dumper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Dumper.java 16 Sep 2004 00:26:39 -0000 1.4
+++ Dumper.java 5 Oct 2004 18:33:13 -0000 1.5
@@ -14,42 +14,41 @@
package org.apache.tapestry.junit.mock.lib;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.html.BasePage;
/**
- * Dumps out an array of objects.
- *
- *
- * @author Howard Lewis Ship
- * @version $Id$
- *
- **/
+ * Dumps out an array of objects.
+ *
+ * @author Howard Lewis Ship
+ */
public class Dumper extends BasePage
{
private Object[] _objects;
+
private Object _currentObject;
-
+
public void detach()
{
_objects = null;
_currentObject = null;
-
+
super.detach();
}
-
+
public Object[] getObjects()
{
return _objects;
}
-
+
public void setObjects(Object[] objects)
{
_objects = objects;
-
- fireObservedChange("objects", _objects);
+
+ Tapestry.fireObservedChange(this, "objects", _objects);
}
-
+
public Object getCurrentObject()
{
return _currentObject;
@@ -61,16 +60,15 @@
}
/**
- * Returns the class name of the current object. OGNL has trouble
- * getting properties from Class objects.
- *
- **/
-
+ * Returns the class name of the current object. OGNL has trouble getting properties from Class
+ * objects.
+ */
+
public String getClassName()
{
if (_currentObject == null)
return "<Null>";
-
+
return _currentObject.getClass().getName();
}
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org