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 2003/08/10 01:27:13 UTC
cvs commit: jakarta-tapestry/web new.html
hlship 2003/08/09 16:27:13
Modified: framework/src/org/apache/tapestry/event
ObservedChangeEvent.java
framework/src/org/apache/tapestry AbstractComponent.java
Tapestry.java
web new.html
Log:
Deprecate fireObservedChange() methods in AbstractComponent and move them to static methods on Tapestry.
Revision Changes Path
1.4 +27 -3 jakarta-tapestry/framework/src/org/apache/tapestry/event/ObservedChangeEvent.java
Index: ObservedChangeEvent.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/event/ObservedChangeEvent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ObservedChangeEvent.java 28 May 2003 13:41:48 -0000 1.3
+++ ObservedChangeEvent.java 9 Aug 2003 23:27:13 -0000 1.4
@@ -74,37 +74,58 @@
private String _propertyName;
private Object _newValue;
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
public ObservedChangeEvent(IComponent component, String propertyName, char newValue)
{
this(component, propertyName, new Character(newValue));
}
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
public ObservedChangeEvent(IComponent component, String propertyName, byte newValue)
{
this(component, propertyName, new Byte(newValue));
}
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
public ObservedChangeEvent(IComponent component, String propertyName, short newValue)
{
this(component, propertyName, new Short(newValue));
}
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
public ObservedChangeEvent(IComponent component, String propertyName, int newValue)
{
this(component, propertyName, new Integer(newValue));
}
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
public ObservedChangeEvent(IComponent component, String propertyName, long newValue)
{
this(component, propertyName, new Long(newValue));
}
- public ObservedChangeEvent(IComponent component, String propertyName, double newValue)
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
+ public ObservedChangeEvent(IComponent component, String propertyName, double newValue)
{
this(component, propertyName, new Double(newValue));
}
- public ObservedChangeEvent(IComponent component, String propertyName, float newValue)
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
+ public ObservedChangeEvent(IComponent component, String propertyName, float newValue)
{
this(component, propertyName, new Float(newValue));
}
@@ -137,6 +158,9 @@
_newValue = newValue;
}
+ /**
+ * @deprecated To be removed in 3.1. Use {@link #ObservedChangeEvent(IComponent, String, Object) instead.
+ */
public ObservedChangeEvent(IComponent component, String propertyName, boolean newValue)
{
this(component, propertyName, newValue ? Boolean.TRUE : Boolean.FALSE);
1.15 +70 -98 jakarta-tapestry/framework/src/org/apache/tapestry/AbstractComponent.java
Index: AbstractComponent.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/AbstractComponent.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AbstractComponent.java 6 Aug 2003 14:28:48 -0000 1.14
+++ AbstractComponent.java 9 Aug 2003 23:27:13 -0000 1.15
@@ -69,7 +69,6 @@
import org.apache.tapestry.bean.BeanProviderPropertyAccessor;
import org.apache.tapestry.engine.IPageLoader;
import org.apache.tapestry.event.ChangeObserver;
-import org.apache.tapestry.event.ObservedChangeEvent;
import org.apache.tapestry.event.PageDetachListener;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.event.PageRenderListener;
@@ -326,112 +325,85 @@
finishLoad();
}
+ /**
+ * @deprecated To be removed in 3.1.
+ * Use {@link Tapestry#fireObservedChange(IComponent, String, int)} instead.
+ */
protected void fireObservedChange(String propertyName, int newValue)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ 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)
{
- ChangeObserver observer = getChangeObserver();
-
- if (observer == null)
- return;
-
- ObservedChangeEvent event = new ObservedChangeEvent(this, propertyName, newValue);
-
- observer.observeChange(event);
+ Tapestry.fireObservedChange(this, propertyName, newValue);
}
/**
@@ -517,14 +489,14 @@
}
/**
- * Returns an object used to resolve classes.
+ * Returns an object used to resolve classes.
* @since 3.0
- *
- **/
+ *
+ **/
private IResourceResolver getResourceResolver()
{
- return getPage().getEngine().getResourceResolver();
- }
+ return getPage().getEngine().getResourceResolver();
+ }
/**
* Returns the named binding, or null if it doesn't exist.
@@ -559,7 +531,7 @@
* will be an {@link IPageRecorder}.
*
* @see IPage#getChangeObserver()
- *
+ * @deprecated To be removed in 3.1; use {@link IPage#getChangeObserver()}.
**/
public ChangeObserver getChangeObserver()
@@ -1174,24 +1146,24 @@
{
}
- /**
- * Sets a property of a component.
- * @see IComponent
+ /**
+ * Sets a property of a component.
+ * @see IComponent
* @since 3.0
- */
- public void setProperty(String propertyName, Object value)
- {
- IResourceResolver resolver = getResourceResolver();
- OgnlUtils.set(propertyName, resolver, this, value);
-}
- /**
- * Gets a property of a component.
- * @see IComponent
+ */
+ public void setProperty(String propertyName, Object value)
+ {
+ IResourceResolver resolver = getResourceResolver();
+ OgnlUtils.set(propertyName, resolver, this, value);
+ }
+ /**
+ * Gets a property of a component.
+ * @see IComponent
* @since 3.0
- */
- public Object getProperty(String propertyName)
- {
- IResourceResolver resolver = getResourceResolver();
- return OgnlUtils.get(propertyName, resolver, this);
- }
+ */
+ public Object getProperty(String propertyName)
+ {
+ IResourceResolver resolver = getResourceResolver();
+ return OgnlUtils.get(propertyName, resolver, this);
+ }
}
1.17 +227 -1 jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java
Index: Tapestry.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Tapestry.java 6 Aug 2003 14:28:48 -0000 1.16
+++ Tapestry.java 9 Aug 2003 23:27:13 -0000 1.17
@@ -73,6 +73,8 @@
import javax.servlet.ServletContext;
+import org.apache.tapestry.event.ChangeObserver;
+import org.apache.tapestry.event.ObservedChangeEvent;
import org.apache.tapestry.request.RequestContext;
import org.apache.tapestry.resource.ContextResourceLocation;
import org.apache.tapestry.spec.IComponentSpecification;
@@ -1349,5 +1351,229 @@
"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
+ *
+ * @since 3.0
+ */
+ public static void fireObservedChange(
+ IComponent component,
+ String propertyName,
+ Object newValue)
+ {
+ ChangeObserver observer = component.getPage().getChangeObserver();
+
+ if (observer == null)
+ return;
+
+ ObservedChangeEvent event = new ObservedChangeEvent(component, propertyName, 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,
+ 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);
}
}
1.195 +3 -1 jakarta-tapestry/web/new.html
Index: new.html
===================================================================
RCS file: /home/cvs/jakarta-tapestry/web/new.html,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- new.html 6 Aug 2003 14:28:50 -0000 1.194
+++ new.html 9 Aug 2003 23:27:13 -0000 1.195
@@ -18,6 +18,8 @@
<li>Add some new FAQs. [hlship]</li>
<li>Removed the errant selected parameter from Button (a bad cut-and-paste from Submit), and fix the Button
component reference page. [hlship]</li>
+<li>Deprecated the <code>fireObservedChange()</code> methods on AbstractComponent and implemented
+ them as static methods on <code>Tapestry</code>. [hlship]</li>
</ul>
<pre>