You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/05/04 23:34:16 UTC
svn commit: r399861 [2/3] - in /tapestry/tapestry4/trunk:
examples/TimeTracker/src/context/ examples/TimeTracker/src/context/WEB-INF/
examples/TimeTracker/src/context/css/
examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/
framework/sr...
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/DescriptionReceiver.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/DescriptionReceiver.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/DescriptionReceiver.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/DescriptionReceiver.java Thu May 4 14:34:07 2006
@@ -17,19 +17,20 @@
import java.util.Collection;
/**
- * An object that is provided with a description of another object. The receiver will format this
- * information.
+ * An object that is provided with a description of another object. The receiver
+ * will format this information.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface DescriptionReceiver
{
+
/**
* Invoke to describe another object instead of the current object.
*/
- public void describeAlternate(Object alternate);
+ void describeAlternate(Object alternate);
/**
* Provides a title for the object; usually the object's class name.
@@ -37,53 +38,54 @@
* @throws IllegalStateException
* if called more than once (for the same object)
*/
- public void title(String title);
+ void title(String title);
/**
- * Starts a new sub-section within the description. A description may have any number of
- * sections (but sections do not nest). A second title is only emitted when the firstproperty
- * within the section is emitted.
+ * Starts a new sub-section within the description. A description may have
+ * any number of sections (but sections do not nest). A second title is only
+ * emitted when the firstproperty within the section is emitted.
*
* @throws IllegalStateException
* if called before invoking {@link #title(String)}.
*/
- public void section(String section);
+ void section(String section);
/**
- * Emits a key/value pair, describing a property of the object. The value will itself be
- * described. This method is overridden for scalar property types.
+ * Emits a key/value pair, describing a property of the object. The value
+ * will itself be described. This method is overridden for scalar property
+ * types.
*
* @throws IllegalStateException
* if called before invoking {@link #title(String)}
*/
- public void property(String key, Object value);
+ void property(String key, Object value);
- public void property(String key, boolean value);
+ void property(String key, boolean value);
- public void property(String key, byte value);
+ void property(String key, byte value);
- public void property(String key, short value);
+ void property(String key, short value);
- public void property(String key, int value);
+ void property(String key, int value);
- public void property(String key, long value);
+ void property(String key, long value);
- public void property(String key, float value);
+ void property(String key, float value);
- public void property(String key, double value);
+ void property(String key, double value);
- public void property(String key, char value);
+ void property(String key, char value);
/**
- * Emits a list of values for the key. Each value will be described. Emits nothing if the array
- * is null.
+ * Emits a list of values for the key. Each value will be described. Emits
+ * nothing if the array is null.
*/
- public void array(String key, Object[] values);
+ void array(String key, Object[] values);
/**
- * As with {@link #array(String, Object[])}, but the values are in a collection (which may be
- * null, to emit nothing).
+ * As with {@link #array(String, Object[])}, but the values are in a
+ * collection (which may be null, to emit nothing).
*/
- public void collection(String key, Collection values);
-}
\ No newline at end of file
+ void collection(String key, Collection values);
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriberImpl.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriberImpl.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriberImpl.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriberImpl.java Thu May 4 14:34:07 2006
@@ -22,18 +22,21 @@
*/
public class HTMLDescriberImpl implements HTMLDescriber
{
+
private RootDescriptionReceiverFactory _receiverFactory;
public void describeObject(Object object, IMarkupWriter writer)
{
- RootDescriptionReciever dr = _receiverFactory.newRootDescriptionReceiver(writer);
+ RootDescriptionReciever dr = _receiverFactory
+ .newRootDescriptionReceiver(writer);
dr.describe(object);
}
- public void setReceiverFactory(RootDescriptionReceiverFactory receiverFactory)
+ public void setReceiverFactory(
+ RootDescriptionReceiverFactory receiverFactory)
{
_receiverFactory = receiverFactory;
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiver.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiver.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiver.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiver.java Thu May 4 14:34:07 2006
@@ -21,17 +21,18 @@
import org.apache.tapestry.IMarkupWriter;
/**
- * Implementation of {@link org.apache.tapestry.describe.DescriptionReceiver} that produces HTML
- * output using a {@link org.apache.tapestry.IMarkupWriter}.
+ * Implementation of {@link org.apache.tapestry.describe.DescriptionReceiver}
+ * that produces HTML output using a {@link org.apache.tapestry.IMarkupWriter}.
* <p>
- * TODO: Make {@link #describeAlternate(Object)} exclusive with the other methods
- * {@link #title(String)}, {@link #property(String, Object)}, etc.
+ * TODO: Make {@link #describeAlternate(Object)} exclusive with the other
+ * methods {@link #title(String)}, {@link #property(String, Object)}, etc.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class HTMLDescriptionReceiver implements RootDescriptionReciever
{
+
// Emitted for null values.
static final String NULL_VALUE = "<NULL>";
@@ -50,13 +51,14 @@
private boolean _even = true;
- public HTMLDescriptionReceiver(IMarkupWriter writer, DescribableStrategy adapter)
+ public HTMLDescriptionReceiver(IMarkupWriter writer,
+ DescribableStrategy adapter)
{
this(writer, adapter, new HTMLDescriptionReceiverStyles());
}
- public HTMLDescriptionReceiver(IMarkupWriter writer, DescribableStrategy strategy,
- HTMLDescriptionReceiverStyles styles)
+ public HTMLDescriptionReceiver(IMarkupWriter writer,
+ DescribableStrategy strategy, HTMLDescriptionReceiverStyles styles)
{
Defense.notNull(writer, "writer");
Defense.notNull(strategy, "strategy");
@@ -94,8 +96,7 @@
{
// When false, a <table> was started, which must be closed.
- if (!_emitDefault)
- _writer.end("table");
+ if (!_emitDefault) _writer.end("table");
_writer.println();
@@ -132,7 +133,8 @@
Defense.notNull(section, "section");
if (_title == null)
- throw new IllegalStateException(DescribeMessages.mustSetTitleBeforeSection());
+ throw new IllegalStateException(DescribeMessages
+ .mustSetTitleBeforeSection());
_section = section;
}
@@ -140,12 +142,13 @@
private void assertTitleSet()
{
if (_title == null)
- throw new IllegalStateException(DescribeMessages.mustSetTitleBeforeProperty());
+ throw new IllegalStateException(DescribeMessages
+ .mustSetTitleBeforeProperty());
}
/**
- * Invoked to ensure that the section portion has been output, before any properties within the
- * section are output.
+ * Invoked to ensure that the section portion has been output, before any
+ * properties within the section are output.
*/
private void emitSection()
@@ -237,7 +240,8 @@
return;
}
- new HTMLDescriptionReceiver(_writer, _strategy, _styles).describe(value);
+ new HTMLDescriptionReceiver(_writer, _strategy, _styles)
+ .describe(value);
}
public void property(String key, boolean value)
@@ -304,20 +308,18 @@
assertTitleSet();
- if (values == null || values.length == 0)
- return;
+ if (values == null || values.length == 0) return;
emitSection();
- for (int i = 0; i < values.length; i++)
+ for(int i = 0; i < values.length; i++)
{
_writer.begin("tr");
writeRowClass();
_writer.begin("th");
- if (i == 0)
- _writer.print(key);
+ if (i == 0) _writer.print(key);
_writer.end();
@@ -337,23 +339,21 @@
assertTitleSet();
- if (values == null || values.isEmpty())
- return;
+ if (values == null || values.isEmpty()) return;
emitSection();
Iterator i = values.iterator();
boolean first = true;
- while (i.hasNext())
+ while(i.hasNext())
{
_writer.begin("tr");
writeRowClass();
_writer.begin("th");
- if (first)
- _writer.print(key);
+ if (first) _writer.print(key);
_writer.end();
_writer.begin("td");
@@ -366,4 +366,4 @@
first = false;
}
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiverStyles.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiverStyles.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiverStyles.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiverStyles.java Thu May 4 14:34:07 2006
@@ -15,13 +15,15 @@
package org.apache.tapestry.describe;
/**
- * Holds the style information used by {@link org.apache.tapestry.describe.HTMLDescriptionReceiver}.
+ * Holds the style information used by
+ * {@link org.apache.tapestry.describe.HTMLDescriptionReceiver}.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class HTMLDescriptionReceiverStyles
{
+
private String _tableClass = "described-object";
private String _headerClass = "described-object-title";
@@ -57,4 +59,4 @@
{
_tableClass = tableClass;
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpServletRequestStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpServletRequestStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpServletRequestStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpServletRequestStrategy.java Thu May 4 14:34:07 2006
@@ -59,7 +59,7 @@
List keys = WebUtils.toSortedList(request.getParameterNames());
Iterator i = keys.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
String key = (String) i.next();
String[] values = request.getParameterValues(key);
@@ -70,7 +70,7 @@
receiver.section("Headers");
keys = WebUtils.toSortedList(request.getHeaderNames());
i = keys.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
String key = (String) i.next();
String value = request.getHeader(key);
@@ -81,7 +81,7 @@
receiver.section("Attributes");
keys = WebUtils.toSortedList(request.getAttributeNames());
i = keys.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
String key = (String) i.next();
Object value = request.getAttribute(key);
@@ -90,4 +90,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpSessionStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpSessionStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpSessionStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/HttpSessionStrategy.java Thu May 4 14:34:07 2006
@@ -38,17 +38,20 @@
receiver.property("creationTime", new Date(session.getCreationTime()));
receiver.property("id", session.getId());
- receiver.property("lastAccessedTime", new Date(session.getLastAccessedTime()));
- receiver.property("maxInactiveInterval", session.getMaxInactiveInterval());
+ receiver.property("lastAccessedTime", new Date(session
+ .getLastAccessedTime()));
+ receiver.property("maxInactiveInterval", session
+ .getMaxInactiveInterval());
receiver.property("new", session.isNew());
receiver.section("Attributes");
- Iterator i = WebUtils.toSortedList(session.getAttributeNames()).iterator();
- while (i.hasNext())
+ Iterator i = WebUtils.toSortedList(session.getAttributeNames())
+ .iterator();
+ while(i.hasNext())
{
String key = (String) i.next();
receiver.property(key, session.getAttribute(key));
}
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/LocationRenderStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/LocationRenderStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/LocationRenderStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/LocationRenderStrategy.java Thu May 4 14:34:07 2006
@@ -26,21 +26,24 @@
import org.apache.tapestry.IRequestCycle;
/**
- * Adapter for displaying {@link org.apache.hivemind.Location} objects as HTML. This may
- * include showing the content of the {@link org.apache.hivemind.Resource}, with the line indicated
- * in the Location highlighted.
+ * Adapter for displaying {@link org.apache.hivemind.Location} objects as
+ * HTML. This may include showing the content of the
+ * {@link org.apache.hivemind.Resource}, with the line indicated in the
+ * Location highlighted.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class LocationRenderStrategy implements RenderStrategy
{
+
/**
* Lines before and after the actual location to display.
*/
private static final int RANGE = 5;
- public void renderObject(Object object, IMarkupWriter writer, IRequestCycle cycle)
+ public void renderObject(Object object, IMarkupWriter writer,
+ IRequestCycle cycle)
{
Location l = (Location) object;
@@ -50,18 +53,17 @@
int lineNumber = l.getLineNumber();
- if (lineNumber < 1)
- return;
+ if (lineNumber < 1) return;
URL url = l.getResource().getResourceURL();
- if (url == null)
- return;
+ if (url == null) return;
writeResourceContent(writer, url, lineNumber);
}
- private void writeResourceContent(IMarkupWriter writer, URL url, int lineNumber)
+ private void writeResourceContent(IMarkupWriter writer, URL url,
+ int lineNumber)
{
LineNumberReader reader = null;
@@ -74,20 +76,17 @@
writer.begin("table");
writer.attribute("class", "location-content");
- while (true)
+ while(true)
{
String line = reader.readLine();
- if (line == null)
- break;
+ if (line == null) break;
int currentLine = reader.getLineNumber();
- if (currentLine > lineNumber + RANGE)
- break;
+ if (currentLine > lineNumber + RANGE) break;
- if (currentLine < lineNumber - RANGE)
- continue;
+ if (currentLine < lineNumber - RANGE) continue;
writer.begin("tr");
@@ -123,8 +122,7 @@
{
try
{
- if (reader != null)
- reader.close();
+ if (reader != null) reader.close();
}
catch (IOException ex)
{
@@ -132,4 +130,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/NativeStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/NativeStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/NativeStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/NativeStrategy.java Thu May 4 14:34:07 2006
@@ -31,4 +31,4 @@
d.describeTo(receiver);
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderBridge.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderBridge.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderBridge.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderBridge.java Thu May 4 14:34:07 2006
@@ -28,6 +28,7 @@
*/
public class RenderBridge implements IRender
{
+
private Object _object;
private RenderStrategy _strategy;
@@ -44,4 +45,4 @@
{
_strategy.renderObject(_object, writer, cycle);
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderStrategy.java Thu May 4 14:34:07 2006
@@ -26,5 +26,7 @@
*/
public interface RenderStrategy
{
- public void renderObject(Object object, IMarkupWriter writer, IRequestCycle cycle);
-}
\ No newline at end of file
+
+ void renderObject(Object object, IMarkupWriter writer,
+ IRequestCycle cycle);
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactory.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactory.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactory.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactory.java Thu May 4 14:34:07 2006
@@ -17,8 +17,8 @@
import org.apache.tapestry.IRender;
/**
- * A source of light-weight objects that can render a particular object. This is a more pure
- * implementation of the GoF Adapter pattern, based on wrapping a
+ * A source of light-weight objects that can render a particular object. This is
+ * a more pure implementation of the GoF Adapter pattern, based on wrapping a
* {@link org.apache.tapestry.describe.RenderStrategy}.
*
* @author Howard M. Lewis Ship
@@ -26,9 +26,11 @@
*/
public interface RenderableAdapterFactory
{
+
/**
- * Returns an object that can render the input object. Simple implementations will just just
- * output a string; complex implementations may output complex markup.
+ * Returns an object that can render the input object. Simple
+ * implementations will just just output a string; complex implementations
+ * may output complex markup.
*/
- public IRender getRenderableAdaptor(Object object);
-}
\ No newline at end of file
+ IRender getRenderableAdaptor(Object object);
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactoryImpl.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactoryImpl.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactoryImpl.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RenderableAdapterFactoryImpl.java Thu May 4 14:34:07 2006
@@ -22,6 +22,7 @@
*/
public class RenderableAdapterFactoryImpl implements RenderableAdapterFactory
{
+
private RenderStrategy _strategy;
/**
@@ -36,4 +37,4 @@
{
_strategy = adapter;
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ReportStatusHub.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ReportStatusHub.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ReportStatusHub.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ReportStatusHub.java Thu May 4 14:34:07 2006
@@ -18,34 +18,39 @@
import org.apache.tapestry.event.ReportStatusListener;
/**
- * Service for collecting together status information across the framework; service implementations
- * implement the {@link org.apache.tapestry.event.ReportStatusListener} interface and register
- * themselves as listeners here. When desired, the {@link #fireReportStatus(IMarkupWriter)} event
- * will invoke the listener method on each registered object.
+ * Service for collecting together status information across the framework;
+ * service implementations implement the
+ * {@link org.apache.tapestry.event.ReportStatusListener} interface and register
+ * themselves as listeners here. When desired, the
+ * {@link #fireReportStatus(IMarkupWriter)} event will invoke the listener
+ * method on each registered object.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface ReportStatusHub
{
+
/**
- * Adds the listener; listeners will be invoked in the order in which they are added.
- * <strong>Note: only service implementation that are singletons should be report status
- * listeners. Threaded or pooled implementations should not be added; or should be careful to
- * add and remove themselves from the hub directly.</strong>
+ * Adds the listener; listeners will be invoked in the order in which they
+ * are added. <strong>Note: only service implementation that are singletons
+ * should be report status listeners. Threaded or pooled implementations
+ * should not be added; or should be careful to add and remove themselves
+ * from the hub directly.</strong>
*
* @param listener
*/
- public void addReportStatusListener(ReportStatusListener listener);
+ void addReportStatusListener(ReportStatusListener listener);
- public void removeReportStatusListener(ReportStatusListener listener);
+ void removeReportStatusListener(ReportStatusListener listener);
/**
* Generates an HTML status report by invoking
- * {@link ReportStatusListener#reportStatus(ReportStatusEvent)} on each registered listener.
+ * {@link ReportStatusListener#reportStatus(ReportStatusEvent)} on each
+ * registered listener.
*
* @param writer
* a markup writer to send the report to.
*/
- public void fireReportStatus(IMarkupWriter writer);
+ void fireReportStatus(IMarkupWriter writer);
}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReceiverFactory.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReceiverFactory.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReceiverFactory.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReceiverFactory.java Thu May 4 14:34:07 2006
@@ -17,7 +17,8 @@
import org.apache.tapestry.IMarkupWriter;
/**
- * Creates a new instance of {@link org.apache.tapestry.describe.HTMLDescriptionReceiver} around a
+ * Creates a new instance of
+ * {@link org.apache.tapestry.describe.HTMLDescriptionReceiver} around a
* provided {@link org.apache.tapestry.IMarkupWriter}.
*
* @author Howard M. Lewis Ship
@@ -25,5 +26,7 @@
*/
public interface RootDescriptionReceiverFactory
{
- public RootDescriptionReciever newRootDescriptionReceiver(IMarkupWriter writer);
+
+ RootDescriptionReciever newRootDescriptionReceiver(
+ IMarkupWriter writer);
}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReciever.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReciever.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReciever.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/RootDescriptionReciever.java Thu May 4 14:34:07 2006
@@ -15,9 +15,10 @@
package org.apache.tapestry.describe;
/**
- * Extended version of {@link org.apache.tapestry.describe.DescriptionReceiver} that adds the
- * ability to describe the root object, and to finish the description of an object (allowing the
- * same receiver to be used to describe several objects).
+ * Extended version of {@link org.apache.tapestry.describe.DescriptionReceiver}
+ * that adds the ability to describe the root object, and to finish the
+ * description of an object (allowing the same receiver to be used to describe
+ * several objects).
*
* @author Howard M. Lewis Ship
*/
@@ -25,8 +26,9 @@
{
/**
- * Describes the object, using a {@link DescribableStrategy}, or just the object's toString()
- * if there is no strategy for the object. Automatically invokes {@link #finishUp()} when done.
+ * Describes the object, using a {@link DescribableStrategy}, or just the
+ * object's toString() if there is no strategy for the object. Automatically
+ * invokes {@link #finishUp()} when done.
*
* @param object
* to be described, which may be null
@@ -34,9 +36,9 @@
void describe(Object object);
/**
- * Invoked after one object has been fully described. Ends a <table>, if one has been
- * started, and resets the receiver to begin a new object.
+ * Invoked after one object has been fully described. Ends a <table>,
+ * if one has been started, and resets the receiver to begin a new object.
*/
void finishUp();
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletContextStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletContextStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletContextStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletContextStrategy.java Thu May 4 14:34:07 2006
@@ -36,12 +36,14 @@
receiver.title("ServletContext");
receiver.property("serverInfo", context.getServerInfo());
- receiver.property("version", context.getMajorVersion() + "." + context.getMinorVersion());
+ receiver.property("version", context.getMajorVersion() + "."
+ + context.getMinorVersion());
receiver.section("Attributes");
- Iterator i = WebUtils.toSortedList(context.getAttributeNames()).iterator();
- while (i.hasNext())
+ Iterator i = WebUtils.toSortedList(context.getAttributeNames())
+ .iterator();
+ while(i.hasNext())
{
String key = (String) i.next();
@@ -50,7 +52,7 @@
receiver.section("Initialization Parameters");
i = WebUtils.toSortedList(context.getInitParameterNames()).iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
String key = (String) i.next();
@@ -59,4 +61,4 @@
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletStrategy.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletStrategy.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletStrategy.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/describe/ServletStrategy.java Thu May 4 14:34:07 2006
@@ -39,8 +39,9 @@
receiver.section("Initialization Parameters");
- Iterator i = WebUtils.toSortedList(config.getInitParameterNames()).iterator();
- while (i.hasNext())
+ Iterator i = WebUtils.toSortedList(config.getInitParameterNames())
+ .iterator();
+ while(i.hasNext())
{
String key = (String) i.next();
@@ -48,4 +49,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java Thu May 4 14:34:07 2006
@@ -43,6 +43,8 @@
// first configure dojo, has to happen before package include
StringBuffer str = new StringBuffer("<script type=\"text/javascript\">");
str.append("djConfig = { isDebug: true,")
+ .append(" debugContainerId:'debug',")
+ .append(" debugAtAllCosts:true,")
.append(" baseRelativePath:\"")
.append(_assetService.getLink(true,
_dojoPath.getResourceLocation().getPath()).getAbsoluteURL())
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/IWidget.java Thu May 4 14:34:07 2006
@@ -26,7 +26,6 @@
*/
public interface IWidget
{
-
/**
* Similar to the semantics involved with normal <code>AbstractComponent.renderComponent</code>
* method writing component state to the output stream.
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/AbstractFormWidget.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/AbstractFormWidget.java?rev=399861&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/AbstractFormWidget.java (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/AbstractFormWidget.java Thu May 4 14:34:07 2006
@@ -0,0 +1,75 @@
+// Copyright May 4, 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.dojo.form;
+
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.form.AbstractFormComponent;
+
+
+/**
+ * Represents a dojo widget that manages an html form input
+ * field.
+ *
+ * @author jkuhnert
+ * @since 4.1
+ */
+public abstract class AbstractFormWidget extends AbstractFormComponent implements IFormWidget
+{
+ /**
+ * {@inheritDoc}
+ */
+ public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ renderComponent(writer, cycle);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ renderFormWidget(writer, cycle);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ rewindFormWidget(writer, cycle);
+ }
+
+ /**
+ * Called when rendering a form widget.
+ *
+ * @param writer
+ * The markup writer to render with.
+ * @param cycle
+ * The cycle associated with request.
+ */
+ protected abstract void renderFormWidget(IMarkupWriter writer, IRequestCycle cycle);
+
+ /**
+ * Called during form submission to retrieve submitted input values.
+ * Components should do any validation/retrieval of values in this method.
+ *
+ * @param writer
+ * The passed in {@link IMarkupWriter} will be a {@link NullMarkupWriter}, making
+ * any content written ignored.
+ * @param cycle
+ * Typically used to retrieve submitted value via <code>cycle.getParameter(getName())</code>.
+ */
+ protected abstract void rewindFormWidget(IMarkupWriter writer, IRequestCycle cycle);
+}
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java?rev=399861&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java Thu May 4 14:34:07 2006
@@ -0,0 +1,211 @@
+// Copyright May 4, 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.dojo.form;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tapestry.IDirect;
+import org.apache.tapestry.IJSONRender;
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.IScript;
+import org.apache.tapestry.PageRenderSupport;
+import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.dojo.IWidget;
+import org.apache.tapestry.engine.DirectServiceParameter;
+import org.apache.tapestry.engine.IEngineService;
+import org.apache.tapestry.engine.ILink;
+import org.apache.tapestry.form.IPropertySelectionModel;
+import org.apache.tapestry.form.ValidatableField;
+import org.apache.tapestry.form.ValidatableFieldSupport;
+import org.apache.tapestry.json.IJSONWriter;
+import org.apache.tapestry.valid.ValidatorException;
+
+/**
+ * An html field similar to a <code>select</code> input field that
+ * is wrapped by a dojo ComboBox widget.
+ *
+ * @author jkuhnert
+ */
+public abstract class Autocompleter extends AbstractFormWidget
+ implements ValidatableField, IJSONRender, IDirect, IWidget
+{
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected void renderFormWidget(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ renderDelegatePrefix(writer, cycle);
+
+ writer.begin("select");
+ writer.attribute("name", getName());
+
+ if (isDisabled())
+ writer.attribute("disabled", "disabled");
+
+ if (getSubmitOnChange())
+ writer.attribute("onchange", "javascript: this.form.events.submit();");
+
+ renderIdAttribute(writer, cycle);
+
+ renderDelegateAttributes(writer, cycle);
+
+ getValidatableFieldSupport().renderContributions(this, writer, cycle);
+
+ // Apply informal attributes.
+ renderInformalParameters(writer, cycle);
+
+ writer.end();
+ renderDelegateSuffix(writer, cycle);
+
+ DirectServiceParameter dsp =
+ new DirectServiceParameter(this, new Object[]{},
+ new String[]{getId()}, true);
+ ILink link = getDirectService().getLink(true, dsp);
+
+ Map parms = new HashMap();
+ parms.put("id", getClientId());
+
+ StringBuffer str = new StringBuffer("{");
+ str.append("dataUrl:'").append(link.getURL()).append("&filter=%{searchString}',")
+ .append("mode:'remote',")
+ .append("forceValidOption:true,")
+ .append("name:'").append(getName()).append("'")
+ .append("}");
+
+ parms.put("props", str.toString());
+
+ PageRenderSupport prs = TapestryUtils.getPageRenderSupport(cycle, this);
+ getScript().execute(cycle, prs, parms);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void renderComponent(IJSONWriter writer, IRequestCycle cycle)
+ {
+ IPropertySelectionModel model = getModel();
+
+ if (model == null)
+ throw Tapestry.createRequiredParameterException(this, "model");
+
+ int count = model.getOptionCount();
+
+ for (int i = 0; i < count; i++)
+ {
+ String value = model.getValue(i);
+ String label = model.getLabel(i);
+
+ if (getFilter() == null || getFilter().trim().length() <= 0) {
+ writer.put(value, label);
+ continue;
+ }
+
+ // primitive filter, for now
+ // TODO: Create filter interface in IPropertySelectionModel
+ if (getFilter() != null
+ && label.toLowerCase().indexOf(getFilter().toLowerCase()) > -1) {
+ writer.put(value, label);
+ }
+ }
+ }
+
+ /**
+ * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+ */
+ protected void rewindFormWidget(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ String value = cycle.getParameter(getName() + "_selected");
+
+ Object object = getModel().translateValue(value);
+
+ try
+ {
+ getValidatableFieldSupport().validate(this, writer, cycle, object);
+
+ setValue(object);
+ }
+ catch (ValidatorException e)
+ {
+ getForm().getDelegate().record(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isStateful()
+ {
+ return false;
+ }
+
+ /**
+ * Triggerd by using filterOnChange logic.
+ *
+ * {@inheritDoc}
+ */
+ public void trigger(IRequestCycle cycle)
+ {
+ setFilter(cycle.getParameter("filter"));
+ }
+
+ public abstract IPropertySelectionModel getModel();
+
+ /** @since 4.1 */
+ public abstract boolean isFilterOnChange();
+
+ /** @since 2.2 * */
+ public abstract boolean getSubmitOnChange();
+
+ /** @since 2.2 * */
+ public abstract Object getValue();
+
+ /** @since 2.2 * */
+ public abstract void setValue(Object value);
+
+ /** @since 4.1 */
+ public abstract void setFilter(String value);
+
+ /** @since 4.1 */
+ public abstract String getFilter();
+
+ /**
+ * Injected.
+ */
+ public abstract ValidatableFieldSupport getValidatableFieldSupport();
+
+ /**
+ * Injected.
+ * @return
+ */
+ public abstract IEngineService getDirectService();
+
+ /**
+ * Injected.
+ * @return
+ */
+ public abstract IScript getScript();
+
+ /**
+ * @see org.apache.tapestry.form.AbstractFormComponent#isRequired()
+ */
+ public boolean isRequired()
+ {
+ return getValidatableFieldSupport().isRequired(this);
+ }
+}
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.jwc
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.jwc?rev=399861&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.jwc (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.jwc Thu May 4 14:34:07 2006
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE component-specification PUBLIC
+ "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
+ "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
+
+<component-specification class="org.apache.tapestry.dojo.form.Autocompleter"
+ allow-body="no"
+ allow-informal-parameters="yes">
+
+ <description>
+ Creates an HTML select to choose a single property from a list of options.
+ </description>
+
+ <parameter name="value" required="yes"/>
+
+ <parameter name="model" required="yes"/>
+
+ <parameter name="disabled"/>
+
+ <parameter name="filterOnChange" default-value="false" />
+
+ <parameter name="submitOnChange" deprecated="true">
+ <description>
+ Enables logic to submit containing form when value changes.
+ </description>
+ </parameter>
+
+ <parameter name="displayName"/>
+ <parameter name="validators"/>
+
+ <parameter name="id" property="idParameter" default-value="id"/>
+
+ <reserved-parameter name="name"/>
+
+ <inject property="validatableFieldSupport" object="service:tapestry.form.ValidatableFieldSupport"/>
+
+ <inject property="directService" object="service:tapestry.services.Direct"/>
+ <inject property="script" type="script" object="Autocompleter.script"/>
+
+</component-specification>
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.script
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.script?rev=399861&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.script (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.script Thu May 4 14:34:07 2006
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE script PUBLIC
+ "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
+ "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
+<script>
+<include-script resource-path="/org/apache/tapestry/dojo/Widget.js"/>
+
+<input-symbol key="id" required="yes" />
+<input-symbol key="props" required="yes" />
+ <body>
+ <unique>
+ dojo.require("dojo.io");
+ dojo.require("dojo.json");
+ dojo.require("dojo.event");
+ dojo.require("dojo.widget.ComboBox");
+ </unique>
+ </body>
+ <initialization>
+ tapestry.widget.synchronizeWidgetState("${id}", "combobox", ${props});
+ </initialization>
+</script>
\ No newline at end of file
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/IFormWidget.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/IFormWidget.java?rev=399861&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/IFormWidget.java (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/IFormWidget.java Thu May 4 14:34:07 2006
@@ -0,0 +1,29 @@
+// Copyright May 4, 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.dojo.form;
+
+import org.apache.tapestry.dojo.IWidget;
+
+
+/**
+ * Represents an html input field managed by a dojo widget.
+ *
+ * @author jkuhnert
+ */
+public interface IFormWidget extends IWidget
+{
+
+
+
+}
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/package.html
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/package.html?rev=399861&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/package.html (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/form/package.html Thu May 4 14:34:07 2006
@@ -0,0 +1,15 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Tapestry: Web Application Framework</title>
+</head>
+<body>
+
+<p>
+Form related components that are wrapped by dojo widgets.
+</p>
+
+@author Jesse Kuhnert <a href="mailto:jkuhnert@apache.org">jkuhnert@apache.org</a>
+
+</body>
+</html>
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.java Thu May 4 14:34:07 2006
@@ -14,22 +14,9 @@
package org.apache.tapestry.form;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tapestry.IDirect;
-import org.apache.tapestry.IJSONRender;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.IScript;
-import org.apache.tapestry.PageRenderSupport;
import org.apache.tapestry.Tapestry;
-import org.apache.tapestry.TapestryUtils;
-import org.apache.tapestry.dojo.IWidget;
-import org.apache.tapestry.engine.DirectServiceParameter;
-import org.apache.tapestry.engine.IEngineService;
-import org.apache.tapestry.engine.ILink;
-import org.apache.tapestry.json.IJSONWriter;
import org.apache.tapestry.valid.ValidatorException;
/**
@@ -59,7 +46,7 @@
* @author Jesse Kuhnert
*/
public abstract class PropertySelection extends AbstractFormComponent
- implements ValidatableField, IJSONRender, IDirect, IWidget
+ implements ValidatableField
{
/**
* @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
@@ -75,7 +62,7 @@
writer.attribute("disabled", "disabled");
if (getSubmitOnChange())
- writer.attribute("onchange", "javascript: this.form.events.submit();");
+ writer.attribute("onchange", "javascript: this.form.events.submit();");
renderIdAttribute(writer, cycle);
@@ -86,46 +73,40 @@
// Apply informal attributes.
renderInformalParameters(writer, cycle);
- if (isFilterOnChange()) {
- renderWidget(writer, cycle);
- } else {
-
- writer.println();
-
- IPropertySelectionModel model = getModel();
-
- if (model == null)
- throw Tapestry.createRequiredParameterException(this, "model");
-
- int count = model.getOptionCount();
- boolean foundSelected = false;
- Object value = getValue();
+ writer.println();
+
+ IPropertySelectionModel model = getModel();
+
+ if (model == null)
+ throw Tapestry.createRequiredParameterException(this, "model");
+
+ int count = model.getOptionCount();
+ boolean foundSelected = false;
+ Object value = getValue();
+
+ for (int i = 0; i < count; i++)
+ {
+ Object option = model.getOption(i);
- for (int i = 0; i < count; i++)
- {
- Object option = model.getOption(i);
+ writer.begin("option");
+ writer.attribute("value", model.getValue(i));
- writer.begin("option");
- writer.attribute("value", model.getValue(i));
+ if (!foundSelected && isEqual(option, value))
+ {
+ writer.attribute("selected", "selected");
- if (!foundSelected && isEqual(option, value))
- {
- writer.attribute("selected", "selected");
+ foundSelected = true;
+ }
- foundSelected = true;
- }
+ writer.print(model.getLabel(i));
- writer.print(model.getLabel(i));
+ writer.end();
- writer.end();
+ writer.println();
+ }
- writer.println();
- }
+ writer.end(); // <select>
- writer.end(); // <select>
-
- }
-
renderDelegateSuffix(writer, cycle);
}
@@ -150,76 +131,6 @@
}
}
- /**
- * {@inheritDoc}
- */
- public void renderComponent(IJSONWriter writer, IRequestCycle cycle)
- {
- IPropertySelectionModel model = getModel();
-
- if (model == null)
- throw Tapestry.createRequiredParameterException(this, "model");
-
- int count = model.getOptionCount();
-
- for (int i = 0; i < count; i++)
- {
- String value = model.getValue(i);
- String label = model.getLabel(i);
-
- if (getFilter() == null || getFilter().trim().length() <= 0) {
- writer.put(value, label);
- continue;
- }
-
- // primitive filter, for now
- // TODO: Create filter interface in IPropertySelectionModel
- if (getFilter() != null
- && label.toLowerCase().indexOf(getFilter().toLowerCase()) > -1) {
- writer.put(value, label);
- }
- }
- }
-
- /**
- *
- * {@inheritDoc}
- */
- public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
- {
- if (cycle.isRewinding()) return;
-
- DirectServiceParameter dsp =
- new DirectServiceParameter(this, new Object[]{},
- new String[]{getId()}, true);
- ILink link = getDirectService().getLink(true, dsp);
-
- Map parms = new HashMap();
- parms.put("id", this.getClientId());
- parms.put("props", "{dataUrl:'" + link.getURL() + "&filter=%{searchString}', mode: 'remote', forceValidOption:true}");
-
- PageRenderSupport prs = TapestryUtils.getPageRenderSupport(cycle, this);
- getScript().execute(cycle, prs, parms);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isStateful()
- {
- return false;
- }
-
- /**
- * Triggerd by using filterOnChange logic.
- *
- * {@inheritDoc}
- */
- public void trigger(IRequestCycle cycle)
- {
- setFilter(cycle.getParameter("filter"));
- }
-
private boolean isEqual(Object left, Object right)
{
// Both null, or same object, then are equal
@@ -239,9 +150,6 @@
public abstract IPropertySelectionModel getModel();
- /** @since 4.1 */
- public abstract boolean isFilterOnChange();
-
/** @since 2.2 * */
public abstract boolean getSubmitOnChange();
@@ -251,28 +159,10 @@
/** @since 2.2 * */
public abstract void setValue(Object value);
- /** @since 4.1 */
- public abstract void setFilter(String value);
-
- /** @since 4.1 */
- public abstract String getFilter();
-
/**
* Injected.
*/
public abstract ValidatableFieldSupport getValidatableFieldSupport();
-
- /**
- * Injected.
- * @return
- */
- public abstract IEngineService getDirectService();
-
- /**
- * Injected.
- * @return
- */
- public abstract IScript getScript();
/**
* @see org.apache.tapestry.form.AbstractFormComponent#isRequired()
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.jwc
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.jwc?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.jwc (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/PropertySelection.jwc Thu May 4 14:34:07 2006
@@ -32,15 +32,7 @@
<parameter name="model" required="yes"/>
<parameter name="disabled"/>
-
- <parameter name="renderer">
- <description>
- An alternate rendered for the property selection.
- </description>
- </parameter>
-
- <parameter name="filterOnChange" default-value="false" />
-
+
<parameter name="submitOnChange" deprecated="true">
<description>
Enables logic to submit containing form when value changes.
@@ -55,8 +47,5 @@
<reserved-parameter name="name"/>
<inject property="validatableFieldSupport" object="service:tapestry.form.ValidatableFieldSupport"/>
-
- <inject property="directService" object="service:tapestry.services.Direct"/>
- <inject property="script" type="script" object="PropertySelection.script"/>
</component-specification>
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/ExternalLink.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/ExternalLink.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/ExternalLink.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/ExternalLink.java Thu May 4 14:34:07 2006
@@ -20,9 +20,10 @@
import org.apache.tapestry.engine.ILink;
/**
- * A component for creating a link to {@link org.apache.tapestry.IExternalPage}using the
- * {@link org.apache.tapestry.engine.ExternalService}. [ <a
- * href="../../../../../ComponentReference/ExternalLink.html">Component Reference </a>]
+ * A component for creating a link to {@link org.apache.tapestry.IExternalPage}using
+ * the {@link org.apache.tapestry.engine.ExternalService}. [ <a
+ * href="../../../../../ComponentReference/ExternalLink.html">Component
+ * Reference </a>]
*
* @see org.apache.tapestry.IExternalPage
* @see org.apache.tapestry.engine.ExternalService
@@ -31,14 +32,16 @@
public abstract class ExternalLink extends AbstractLinkComponent
{
+
public abstract IEngineService getExternalService();
public ILink getLink(IRequestCycle cycle)
{
- Object[] serviceParameters = DirectLink.constructServiceParameters(getParameters());
+ Object[] serviceParameters = DirectLink
+ .constructServiceParameters(getParameters());
- ExternalServiceParameter esp = new ExternalServiceParameter(getTargetPage(),
- serviceParameters);
+ ExternalServiceParameter esp = new ExternalServiceParameter(
+ getTargetPage(), serviceParameters);
return getExternalService().getLink(false, esp);
}
@@ -46,4 +49,4 @@
public abstract Object getParameters();
public abstract String getTargetPage();
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/GenericLink.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/GenericLink.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/GenericLink.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/GenericLink.java Thu May 4 14:34:07 2006
@@ -18,25 +18,22 @@
import org.apache.tapestry.engine.ILink;
/**
- * An implementation of {@link org.apache.tapestry.components.ILinkComponent}
- * that allows
- * the exact HREF to be specified, usually used for client side
- * scripting.
+ * An implementation of {@link org.apache.tapestry.components.ILinkComponent}
+ * that allows the exact HREF to be specified, usually used for client side
+ * scripting. [<a
+ * href="../../../../../ComponentReference/GenericLink.html">Component Reference</a>]
*
- * [<a href="../../../../../ComponentReference/GenericLink.html">Component Reference</a>]
- *
- *
- * @author Howard Lewis Ship
- * @since 2.0.2
- *
- **/
+ * @author Howard Lewis Ship
+ * @since 2.0.2
+ */
public abstract class GenericLink extends AbstractLinkComponent
{
+
public abstract String getHref();
public ILink getLink(IRequestCycle cycle)
{
return new StaticLink(getHref());
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/LinkMessages.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/LinkMessages.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/LinkMessages.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/LinkMessages.java Thu May 4 14:34:07 2006
@@ -22,10 +22,15 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class LinkMessages
+public final class LinkMessages
{
- private static final MessageFormatter _formatter = new MessageFormatter(LinkMessages.class);
+ private static final MessageFormatter _formatter = new MessageFormatter(
+ LinkMessages.class);
+
+ /* defeat instantiation */
+ private LinkMessages() { }
+
public static String noNesting()
{
return _formatter.getMessage("no-nesting");
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/PageLink.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/PageLink.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/PageLink.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/link/PageLink.java Thu May 4 14:34:07 2006
@@ -20,14 +20,17 @@
import org.apache.tapestry.engine.ILink;
/**
- * A component for creating a navigation link to another page, using the page service. [ <a
- * href="../../../../../ComponentReference/PageLink.html">Component Reference </a>]
+ * A component for creating a navigation link to another page, using the page
+ * service. [ <a
+ * href="../../../../../ComponentReference/PageLink.html">Component Reference
+ * </a>]
*
* @author Howard Ship
*/
public abstract class PageLink extends AbstractLinkComponent
{
+
public abstract IEngineService getPageService();
public ILink getLink(IRequestCycle cycle)
@@ -38,8 +41,7 @@
if (namespace == null)
parameter = targetPage;
- else
- parameter = namespace.constructQualifiedName(targetPage);
+ else parameter = namespace.constructQualifiedName(targetPage);
return getPageService().getLink(false, parameter);
}
@@ -49,4 +51,4 @@
/** @since 2.2 * */
public abstract INamespace getTargetNamespace();
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerFilter.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerFilter.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerFilter.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerFilter.java Thu May 4 14:34:07 2006
@@ -19,15 +19,17 @@
import org.apache.tapestry.IRequestCycle;
/**
- * Filter interface used with {@link org.apache.tapestry.listener.ListenerInvoker}. Implementations
- * of this filter interface may be plugged into the listener method invocation pipeline. Typical
- * applications involve handling transactions.
+ * Filter interface used with
+ * {@link org.apache.tapestry.listener.ListenerInvoker}. Implementations of
+ * this filter interface may be plugged into the listener method invocation
+ * pipeline. Typical applications involve handling transactions.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface ListenerInvokerFilter
{
- public void invokeListener(IActionListener listener, IComponent source, IRequestCycle cycle,
- ListenerInvoker delegate);
+
+ void invokeListener(IActionListener listener, IComponent source,
+ IRequestCycle cycle, ListenerInvoker delegate);
}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerTerminator.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerTerminator.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerTerminator.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerInvokerTerminator.java Thu May 4 14:34:07 2006
@@ -20,8 +20,8 @@
import org.apache.tapestry.IRequestCycle;
/**
- * Terminator implementation for the tapestry.listener.InvokeListener pipeline; this is what finally
- * turns around and invokes
+ * Terminator implementation for the tapestry.listener.InvokeListener pipeline;
+ * this is what finally turns around and invokes
* {@link org.apache.tapestry.IActionListener#actionTriggered(IComponent, IRequestCycle)}.
*
* @author Howard M. Lewis Ship
@@ -32,23 +32,23 @@
/**
* @param listener
- * to be invoked, may be null if no listener is found (a convienience for all the
- * places where listeners are optional)
+ * to be invoked, may be null if no listener is found (a
+ * convienience for all the places where listeners are optional)
* @param source
- * the component generating the listener "event", to be passed to the listener. Not
- * generally used, but may not be null.
+ * the component generating the listener "event", to be passed to
+ * the listener. Not generally used, but may not be null.
* @param cycle
* the current request cycle, to be passed to the listener.
* @param delegate
* the next invoker in the pipeline
*/
- public void invokeListener(IActionListener listener, IComponent source, IRequestCycle cycle)
+ public void invokeListener(IActionListener listener, IComponent source,
+ IRequestCycle cycle)
{
Defense.notNull(source, "source");
Defense.notNull(cycle, "cycle");
- if (listener != null)
- listener.actionTriggered(source, cycle);
+ if (listener != null) listener.actionTriggered(source, cycle);
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMap.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMap.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMap.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMap.java Thu May 4 14:34:07 2006
@@ -23,32 +23,36 @@
*/
public interface ListenerMap
{
+
/**
- * Gets a listener for the given name (which is both a property name and a method name). The
- * listener is created as needed, but is also cached for later use. The returned object
- * implements the {@link org.apache.tapestry.IActionListener}.
+ * Gets a listener for the given name (which is both a property name and a
+ * method name). The listener is created as needed, but is also cached for
+ * later use. The returned object implements the
+ * {@link org.apache.tapestry.IActionListener}.
*
* @param name
- * the name of the method to invoke (the most appropriate method will be selected if
- * there are multiple overloadings of the same method name)
+ * the name of the method to invoke (the most appropriate method
+ * will be selected if there are multiple overloadings of the
+ * same method name)
* @returns an object implementing {@link IActionListener}.
* @throws ApplicationRuntimeException
* if the listener can not be created.
*/
- public IActionListener getListener(String name);
+ IActionListener getListener(String name);
/**
- * Returns an unmodifiable collection of the names of the listeners implemented by the target
- * class.
+ * Returns an unmodifiable collection of the names of the listeners
+ * implemented by the target class.
*
* @since 1.0.6
*/
- public Collection getListenerNames();
+ Collection getListenerNames();
/**
- * Returns true if this ListenerMapImpl can provide a listener with the given name.
+ * Returns true if this ListenerMapImpl can provide a listener with the
+ * given name.
*
* @since 2.2
*/
- public boolean canProvideListener(String name);
-}
\ No newline at end of file
+ boolean canProvideListener(String name);
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapImpl.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapImpl.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapImpl.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapImpl.java Thu May 4 14:34:07 2006
@@ -29,6 +29,7 @@
*/
public class ListenerMapImpl implements ListenerMap
{
+
private final Object _target;
/**
@@ -69,12 +70,12 @@
private IActionListener createListener(String name)
{
- ListenerMethodInvoker invoker = (ListenerMethodInvoker) _invokers.get(name);
+ ListenerMethodInvoker invoker = (ListenerMethodInvoker) _invokers
+ .get(name);
if (invoker == null)
- throw new ApplicationRuntimeException(ListenerMessages.objectMissingMethod(
- _target,
- name), _target, null, null);
+ throw new ApplicationRuntimeException(ListenerMessages
+ .objectMissingMethod(_target, name), _target, null, null);
return new SyntheticListener(_target, invoker);
}
@@ -83,4 +84,4 @@
{
return Collections.unmodifiableCollection(_invokers.keySet());
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapPropertyAccessor.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapPropertyAccessor.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapPropertyAccessor.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapPropertyAccessor.java Thu May 4 14:34:07 2006
@@ -20,8 +20,9 @@
import ognl.OgnlException;
/**
- * Exposes {@link org.apache.tapestry.IActionListener} listeners provided by the
- * {@link org.apache.tapestry.listener.ListenerMap} as read-only properties of the map.
+ * Exposes {@link org.apache.tapestry.IActionListener} listeners provided
+ * by the {@link org.apache.tapestry.listener.ListenerMap} as read-only
+ * properties of the map.
*
* @author Howard Lewis Ship
* @since 2.2
@@ -29,12 +30,15 @@
public class ListenerMapPropertyAccessor extends ObjectPropertyAccessor
{
+
/**
- * Checks to see if the ListenerMapImpl provides the named listener, returning the listener if
- * it does. Otherwise, invokes the super implementation.
+ * Checks to see if the ListenerMapImpl provides the named listener,
+ * returning the listener if it does. Otherwise, invokes the super
+ * implementation.
*/
- public Object getProperty(Map context, Object target, Object name) throws OgnlException
+ public Object getProperty(Map context, Object target, Object name)
+ throws OgnlException
{
ListenerMap map = (ListenerMap) target;
String listenerName = (String) name;
@@ -46,19 +50,19 @@
}
/**
- * Returns true if the ListenerMap contains the named listener, otherwise invokes
- * super-implementation.
+ * Returns true if the ListenerMap contains the named listener, otherwise
+ * invokes super-implementation.
*/
- public boolean hasGetProperty(Map context, Object target, Object oname) throws OgnlException
+ public boolean hasGetProperty(Map context, Object target, Object oname)
+ throws OgnlException
{
ListenerMap map = (ListenerMap) target;
String listenerName = (String) oname;
- if (map.canProvideListener(listenerName))
- return true;
+ if (map.canProvideListener(listenerName)) return true;
return super.hasGetProperty(context, target, oname);
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSource.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSource.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSource.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSource.java Thu May 4 14:34:07 2006
@@ -15,21 +15,23 @@
package org.apache.tapestry.listener;
/**
- * A service which provides access to {@link org.apache.tapestry.listener.ListenerMap}
- * objects.
+ * A service which provides access to
+ * {@link org.apache.tapestry.listener.ListenerMap} objects.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface ListenerMapSource
{
+
/**
- * Constructs a listener map for the provided object, which must not be null.
+ * Constructs a listener map for the provided object, which must not be
+ * null.
*
* @param object
* the object to provide a map for
* @return a ListenerMap configured for the object
*/
- public ListenerMap getListenerMapForObject(Object object);
-}
\ No newline at end of file
+ ListenerMap getListenerMapForObject(Object object);
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSourceImpl.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSourceImpl.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSourceImpl.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMapSourceImpl.java Thu May 4 14:34:07 2006
@@ -33,27 +33,32 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class ListenerMapSourceImpl implements ListenerMapSource, ResetEventListener
+public class ListenerMapSourceImpl implements ListenerMapSource,
+ ResetEventListener
{
+
/**
* Sorts {@link Method}s into descending order by parameter count.
*/
private static class ParameterCountComparator implements Comparator
{
+
public int compare(Object o1, Object o2)
{
Method m1 = (Method) o1;
Method m2 = (Method) o2;
- return m2.getParameterTypes().length - m1.getParameterTypes().length;
+ return m2.getParameterTypes().length
+ - m1.getParameterTypes().length;
}
}
/**
- * Keyed on Class, value is a Map. The inner Map is an invoker map ... keyed on listener method
- * name, value is {@link org.apache.tapestry.listener.ListenerMethodInvoker}.
+ * Keyed on Class, value is a Map. The inner Map is an invoker map ... keyed
+ * on listener method name, value is
+ * {@link org.apache.tapestry.listener.ListenerMethodInvoker}.
*/
private final Map _classToInvokerMap = new HashMap();
@@ -103,15 +108,13 @@
Arrays.sort(methods, new ParameterCountComparator());
- for (int i = 0; i < methods.length; i++)
+ for(int i = 0; i < methods.length; i++)
{
Method m = methods[i];
- if (!isAcceptibleListenerMethodReturnType(m))
- continue;
+ if (!isAcceptibleListenerMethodReturnType(m)) continue;
- if (Modifier.isStatic(m.getModifiers()))
- continue;
+ if (Modifier.isStatic(m.getModifiers())) continue;
String name = m.getName();
@@ -128,7 +131,8 @@
if (returnType == void.class || returnType == String.class)
return true;
- return IPage.class.isAssignableFrom(returnType) || ILink.class.isAssignableFrom(returnType);
+ return IPage.class.isAssignableFrom(returnType)
+ || ILink.class.isAssignableFrom(returnType);
}
private Map convertMethodListMapToInvokerMap(Map map)
@@ -136,7 +140,7 @@
Map result = new HashMap();
Iterator i = map.entrySet().iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
Map.Entry e = (Map.Entry) i.next();
@@ -145,7 +149,8 @@
Method[] methods = convertMethodListToArray(methodList);
- ListenerMethodInvoker invoker = createListenerMethodInvoker(name, methods);
+ ListenerMethodInvoker invoker = createListenerMethodInvoker(name,
+ methods);
result.put(name, invoker);
}
@@ -154,11 +159,12 @@
}
/**
- * This implementation returns a new {@link ListenerMethodInvoker}. Subclasses can override to
- * provide their own implementation.
+ * This implementation returns a new {@link ListenerMethodInvoker}.
+ * Subclasses can override to provide their own implementation.
*/
- protected ListenerMethodInvoker createListenerMethodInvoker(String name, Method[] methods)
+ protected ListenerMethodInvoker createListenerMethodInvoker(String name,
+ Method[] methods)
{
return new ListenerMethodInvokerImpl(name, methods);
}
@@ -183,4 +189,4 @@
l.add(m);
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMessages.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMessages.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMessages.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMessages.java Thu May 4 14:34:07 2006
@@ -23,10 +23,13 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-class ListenerMessages
+final class ListenerMessages
{
private static final MessageFormatter _formatter = new MessageFormatter(ListenerMessages.class);
+ /* defeat instantiation */
+ private ListenerMessages() { }
+
static String objectMissingMethod(Object target, String name)
{
return _formatter.format("object-missing-method", target, name);
@@ -47,4 +50,4 @@
return _formatter.format("no-listener-method-found", name, new Integer(Tapestry
.size(serviceParameters)), target);
}
-}
\ No newline at end of file
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMethodInvoker.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMethodInvoker.java?rev=399861&r1=399860&r2=399861&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMethodInvoker.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/listener/ListenerMethodInvoker.java Thu May 4 14:34:07 2006
@@ -17,13 +17,14 @@
import org.apache.tapestry.IRequestCycle;
/**
- * An object, used by a {@link org.apache.tapestry.listener.ListenerMap}, to match requests
- * (possibly with service parameters) to methods (possibly with arguments). Given a request, a
- * (possibly null or empty) array of service parameters, and a target object (and its set of public
- * void methods), the mapping will search for the mostly likely mapping. In order:
+ * An object, used by a {@link org.apache.tapestry.listener.ListenerMap}, to
+ * match requests (possibly with service parameters) to methods (possibly with
+ * arguments). Given a request, a (possibly null or empty) array of service
+ * parameters, and a target object (and its set of public void methods), the
+ * mapping will search for the mostly likely mapping. In order:
* <ul>
- * <li>public void method(params) (where the method takes the same number of parameters as there
- * are service parameters)
+ * <li>public void method(params) (where the method takes the same number of
+ * parameters as there are service parameters)
* <li>public void method(IRequestCycle, params)
* <li>public void method()
* <li>public void method(IRequestCycle)
@@ -34,5 +35,6 @@
*/
public interface ListenerMethodInvoker
{
- public void invokeListenerMethod(Object target, IRequestCycle cycle);
-}
\ No newline at end of file
+
+ void invokeListenerMethod(Object target, IRequestCycle cycle);
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org