You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2007/09/01 19:42:52 UTC
svn commit: r571837 - in
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket: ./ ajax/
feedback/ markup/html/panel/ request/target/component/
Author: knopp
Date: Sat Sep 1 10:42:51 2007
New Revision: 571837
URL: http://svn.apache.org/viewvc?rev=571837&view=rev
Log:
WICKET-836
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/IFeedback.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/ComponentRequestTarget.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java Sat Sep 1 10:42:51 2007
@@ -30,6 +30,7 @@
import org.apache.wicket.authorization.UnauthorizedActionException;
import org.apache.wicket.behavior.IBehavior;
import org.apache.wicket.feedback.FeedbackMessage;
+import org.apache.wicket.feedback.IFeedback;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupException;
import org.apache.wicket.markup.MarkupStream;
@@ -792,11 +793,7 @@
internalAttach2();
}
- /**
- * Called for every component when the page is getting to be rendered. it will call
- * onBeforeRender for this component and all the child components
- */
- public final void beforeRender()
+ private final void internalBeforeRender()
{
if (isVisible() && !getFlag(FLAG_RENDERING) && !getFlag(FLAG_PREPARED_FOR_RENDER))
{
@@ -815,6 +812,42 @@
}
/**
+ * We need to postpone calling beforeRender() on components that implement IFeedback, to be sure
+ * that all other component's beforeRender() has been already called, so that IFeedbacks can
+ * collect all feedback messages. This is the key under list of postponed IFeedback is stored to
+ * request cycle metadata. The List is then iterated over in {@link #prepareForRender()} after
+ * calling {@link #beforeRender()}, to initialize postponed components.
+ */
+ private static final MetaDataKey FEEDBACK_LIST = new MetaDataKey(List.class)
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ /**
+ * Called for every component when the page is getting to be rendered. it will call
+ * onBeforeRender for this component and all the child components
+ */
+ public final void beforeRender()
+ {
+ if (!(this instanceof IFeedback))
+ {
+ internalBeforeRender();
+ }
+ else
+ {
+ // this component is a feedback. Feedback must be initialized last, so that
+ // they can collect messages from other components
+ List feedbacks = (List)getRequestCycle().getMetaData(FEEDBACK_LIST);
+ if (feedbacks == null)
+ {
+ feedbacks = new ArrayList();
+ getRequestCycle().setMetaData(FEEDBACK_LIST, (Serializable)feedbacks);
+ }
+ feedbacks.add(this);
+ }
+ }
+
+ /**
* Redirects to any intercept page previously specified by a call to redirectToInterceptPage.
*
* @return True if an original destination was redirected to
@@ -1803,6 +1836,16 @@
public void prepareForRender()
{
beforeRender();
+ List feedbacks = (List)getRequestCycle().getMetaData(FEEDBACK_LIST);
+ if (feedbacks != null)
+ {
+ for (Iterator i = feedbacks.iterator(); i.hasNext();)
+ {
+ Component feedback = (Component)i.next();
+ feedback.internalBeforeRender();
+ }
+ }
+ getRequestCycle().setMetaData(FEEDBACK_LIST, null);
markRendering();
}
@@ -2020,8 +2063,7 @@
// Make sure that while rendering the markup stream is found
parent.setMarkupStream(markupStream);
- beforeRender();
- markRendering();
+ prepareForRender();
// check authorization
// first the component itself
// (after attach as otherwise list views etc wont work)
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Sat Sep 1 10:42:51 2007
@@ -208,8 +208,7 @@
this.remove(component);
}
add(component);
- component.beforeRender();
- component.markRendering();
+ component.prepareForRender();
if (markupStream == null)
{
component.render();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java Sat Sep 1 10:42:51 2007
@@ -28,7 +28,6 @@
import org.apache.wicket.authorization.IAuthorizationStrategy;
import org.apache.wicket.authorization.UnauthorizedActionException;
import org.apache.wicket.authorization.strategies.page.SimplePageAuthorizationStrategy;
-import org.apache.wicket.feedback.IFeedback;
import org.apache.wicket.markup.MarkupException;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.WebPage;
@@ -49,72 +48,61 @@
/**
- * Abstract base class for pages. As a MarkupContainer subclass, a Page can
- * contain a component hierarchy and markup in some markup language such as
- * HTML. Users of the framework should not attempt to subclass Page directly.
- * Instead they should subclass a subclass of Page that is appropriate to the
- * markup type they are using, such as WebPage (for HTML markup).
+ * Abstract base class for pages. As a MarkupContainer subclass, a Page can contain a component
+ * hierarchy and markup in some markup language such as HTML. Users of the framework should not
+ * attempt to subclass Page directly. Instead they should subclass a subclass of Page that is
+ * appropriate to the markup type they are using, such as WebPage (for HTML markup).
* <ul>
- * <li><b>Construction </b>- When a page is constructed, it is automatically
- * added to the current PageMap in the Session. When a Page is added to the
- * Session's PageMap, the PageMap assigns the Page an id. A PageMap is roughly
- * equivalent to a browser window and encapsulates a set of pages accessible
- * through that window. When a popup window is created, a new PageMap is created
- * for the popup.
+ * <li><b>Construction </b>- When a page is constructed, it is automatically added to the current
+ * PageMap in the Session. When a Page is added to the Session's PageMap, the PageMap assigns the
+ * Page an id. A PageMap is roughly equivalent to a browser window and encapsulates a set of pages
+ * accessible through that window. When a popup window is created, a new PageMap is created for the
+ * popup.
*
- * <li><b>Identity </b>- The Session that a Page is contained in can be
- * retrieved by calling Page.getSession(). Page identifiers start at 0 for each
- * PageMap in the Session and increment as new pages are added to the map. The
- * PageMap-(and Session)-unique identifier assigned to a given Page can be
- * retrieved by calling getId(). So, the first Page added to a new user Session
- * will always be named "0".
+ * <li><b>Identity </b>- The Session that a Page is contained in can be retrieved by calling
+ * Page.getSession(). Page identifiers start at 0 for each PageMap in the Session and increment as
+ * new pages are added to the map. The PageMap-(and Session)-unique identifier assigned to a given
+ * Page can be retrieved by calling getId(). So, the first Page added to a new user Session will
+ * always be named "0".
*
- * <li><b>LifeCycle </b>- Subclasses of Page which are interested in lifecycle
- * events can override onBeginRequest, onEndRequest() and onModelChanged(). The
- * onBeginRequest() method is inherited from Component. A call to
- * onBeginRequest() is made for every Component on a Page before page rendering
- * begins. At the end of a request (when rendering has completed) to a Page, the
+ * <li><b>LifeCycle </b>- Subclasses of Page which are interested in lifecycle events can override
+ * onBeginRequest, onEndRequest() and onModelChanged(). The onBeginRequest() method is inherited
+ * from Component. A call to onBeginRequest() is made for every Component on a Page before page
+ * rendering begins. At the end of a request (when rendering has completed) to a Page, the
* onEndRequest() method is called for every Component on the Page.
*
- * <li><b>Nested Component Hierarchy </b>- The Page class is a subclass of
- * MarkupContainer. All MarkupContainers can have "associated markup", which
- * resides alongside the Java code by default. All MarkupContainers are also
- * Component containers. Through nesting, of containers, a Page can contain any
- * arbitrary tree of Components. For more details on MarkupContainers, see
+ * <li><b>Nested Component Hierarchy </b>- The Page class is a subclass of MarkupContainer. All
+ * MarkupContainers can have "associated markup", which resides alongside the Java code by default.
+ * All MarkupContainers are also Component containers. Through nesting, of containers, a Page can
+ * contain any arbitrary tree of Components. For more details on MarkupContainers, see
* {@link org.apache.wicket.MarkupContainer}.
*
- * <li><b>Bookmarkable Pages </b>- Pages can be constructed with any
- * constructor when they are being used in a Wicket session, but if you wish to
- * link to a Page using a URL that is "bookmarkable" (which implies that the URL
- * will not have any session information encoded in it, and that you can call
- * this page directly without having a session first directly from your
- * browser), you need to implement your Page with a no-arg constructor or with a
- * constructor that accepts a PageParameters argument (which wraps any query
- * string parameters for a request). In case the page has both constructors, the
- * constructor with PageParameters will be used.
+ * <li><b>Bookmarkable Pages </b>- Pages can be constructed with any constructor when they are
+ * being used in a Wicket session, but if you wish to link to a Page using a URL that is
+ * "bookmarkable" (which implies that the URL will not have any session information encoded in it,
+ * and that you can call this page directly without having a session first directly from your
+ * browser), you need to implement your Page with a no-arg constructor or with a constructor that
+ * accepts a PageParameters argument (which wraps any query string parameters for a request). In
+ * case the page has both constructors, the constructor with PageParameters will be used.
*
- * <li><b>Models </b>- Pages, like other Components, can have models (see
- * {@link IModel}). A Page can be assigned a model by passing one to the Page's
- * constructor, by overriding initModel() or with an explicit invocation of
- * setModel(). If the model is a
- * {@link org.apache.wicket.model.CompoundPropertyModel}, Components on the
- * Page can use the Page's model implicitly via container inheritance. If a
- * Component is not assigned a model, the initModel() override in Component will
- * cause that Component to use the nearest CompoundModel in the parent chain, in
- * this case, the Page's model. For basic CompoundModels, the name of the
- * Component determines which property of the implicit page model the component
- * is bound to. If more control is desired over the binding of Components to the
- * page model (for example, if you want to specify some property expression
- * other than the component's name for retrieving the model object),
- * BoundCompoundPropertyModel can be used.
+ * <li><b>Models </b>- Pages, like other Components, can have models (see {@link IModel}). A Page
+ * can be assigned a model by passing one to the Page's constructor, by overriding initModel() or
+ * with an explicit invocation of setModel(). If the model is a
+ * {@link org.apache.wicket.model.CompoundPropertyModel}, Components on the Page can use the Page's
+ * model implicitly via container inheritance. If a Component is not assigned a model, the
+ * initModel() override in Component will cause that Component to use the nearest CompoundModel in
+ * the parent chain, in this case, the Page's model. For basic CompoundModels, the name of the
+ * Component determines which property of the implicit page model the component is bound to. If more
+ * control is desired over the binding of Components to the page model (for example, if you want to
+ * specify some property expression other than the component's name for retrieving the model
+ * object), BoundCompoundPropertyModel can be used.
*
- * <li><b>Back Button </b>- Pages can support the back button by enabling
- * versioning with a call to setVersioned(boolean). If a Page is versioned and
- * changes occur to it which need to be tracked, a verison manager will be
- * installed using the overridable factory method newVersionManager(). The
- * default version manager returned by the base implementation of this method is
- * an instance of UndoPageVersionManager, which manages versions of a page by
- * keeping change records that can be reversed at a later time.
+ * <li><b>Back Button </b>- Pages can support the back button by enabling versioning with a call to
+ * setVersioned(boolean). If a Page is versioned and changes occur to it which need to be tracked, a
+ * verison manager will be installed using the overridable factory method newVersionManager(). The
+ * default version manager returned by the base implementation of this method is an instance of
+ * UndoPageVersionManager, which manages versions of a page by keeping change records that can be
+ * reversed at a later time.
*
* <li><b>Security </b>- See {@link IAuthorizationStrategy},
* {@link SimplePageAuthorizationStrategy}
@@ -135,11 +123,9 @@
public abstract class Page extends MarkupContainer implements IRedirectListener, IPageMapEntry
{
/**
- * You can set implementation of the interface in the
- * {@link Page#serializer} then that implementation will handle the
- * serialization of this page. The serializePage method is called from the
- * writeObject method then the implementation override the default
- * serialization.
+ * You can set implementation of the interface in the {@link Page#serializer} then that
+ * implementation will handle the serialization of this page. The serializePage method is called
+ * from the writeObject method then the implementation override the default serialization.
*
* @author jcompagner
*/
@@ -175,15 +161,14 @@
}
/**
- * When passed to {@link Page#getVersion(int)} the latest page version is
- * returned.
+ * When passed to {@link Page#getVersion(int)} the latest page version is returned.
*/
public static final int LATEST_VERSION = -1;
/**
- * This is a thread local that is used for serializing page references in
- * this page.It stores a {@link IPageSerializer} which can be set by the
- * outside world to do the serialization of this page.
+ * This is a thread local that is used for serializing page references in this page.It stores a
+ * {@link IPageSerializer} which can be set by the outside world to do the serialization of this
+ * page.
*/
public static final ThreadLocal serializer = new ThreadLocal();
@@ -225,8 +210,8 @@
private transient Set renderedComponents;
/**
- * Boolean if the page is stateless, so it doesn't have to be in the page
- * map, will be set in urlFor
+ * Boolean if the page is stateless, so it doesn't have to be in the page map, will be set in
+ * urlFor
*/
private transient Boolean stateless = null;
@@ -304,10 +289,9 @@
}
/**
- * Called right after a component's listener method (the provided method
- * argument) was called. This method may be used to clean up dependencies,
- * do logging, etc. NOTE: this method will also be called when
- * {@link WebPage#beforeCallComponent(Component, RequestListenerInterface)}
+ * Called right after a component's listener method (the provided method argument) was called.
+ * This method may be used to clean up dependencies, do logging, etc. NOTE: this method will
+ * also be called when {@link WebPage#beforeCallComponent(Component, RequestListenerInterface)}
* or the method invocation itself failed.
*
* @param component
@@ -325,12 +309,11 @@
}
/**
- * Called just before a component's listener method (the provided method
- * argument) is called. This method may be used to set up dependencies,
- * enforce authorization, etc. NOTE: if this method fails, the method will
- * not be excuted. Method
- * {@link WebPage#afterCallComponent(Component, RequestListenerInterface)}
- * will always be called.
+ * Called just before a component's listener method (the provided method argument) is called.
+ * This method may be used to set up dependencies, enforce authorization, etc. NOTE: if this
+ * method fails, the method will not be excuted. Method
+ * {@link WebPage#afterCallComponent(Component, RequestListenerInterface)} will always be
+ * called.
*
* @param component
* the component that is to be called
@@ -412,8 +395,8 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL.
*
- * This method is called when a component was rendered standalone. If it is
- * a markupcontainer then the rendering for that container is checked.
+ * This method is called when a component was rendered standalone. If it is a markupcontainer
+ * then the rendering for that container is checked.
*
* @param component
*
@@ -462,10 +445,9 @@
}
/**
- * @return The current version number of this page. If the page has been
- * changed once, the return value will be 1. If the page has not yet
- * been revised, the version returned will be 0, indicating that the
- * page is still in its original state.
+ * @return The current version number of this page. If the page has been changed once, the
+ * return value will be 1. If the page has not yet been revised, the version returned
+ * will be 0, indicating that the page is still in its original state.
*/
public final int getCurrentVersionNumber()
{
@@ -511,10 +493,9 @@
}
/**
- * @return Get a page map entry for this page. By default, this is the page
- * itself. But if you know of some way to compress the state for the
- * page, you can return a custom implementation that produces the
- * page on-the-fly.
+ * @return Get a page map entry for this page. By default, this is the page itself. But if you
+ * know of some way to compress the state for the page, you can return a custom
+ * implementation that produces the page on-the-fly.
*/
public IPageMapEntry getPageMapEntry()
{
@@ -539,9 +520,9 @@
}
/**
- * Returns whether the page should try to be stateless. To be stateless,
- * getStatelessHint() of every component on page (and it's behavior) must
- * return true and the page must be bookmarkable.
+ * Returns whether the page should try to be stateless. To be stateless, getStatelessHint() of
+ * every component on page (and it's behavior) must return true and the page must be
+ * bookmarkable.
*
* @see org.apache.wicket.Component#getStatelessHint()
*/
@@ -551,14 +532,13 @@
}
/**
- * Override this method to implement a custom way of producing a version of
- * a Page when it cannot be found in the Session.
+ * Override this method to implement a custom way of producing a version of a Page when it
+ * cannot be found in the Session.
*
* @param versionNumber
* The version desired
- * @return A Page object with the component/model hierarchy that was
- * attached to this page at the time represented by the requested
- * version.
+ * @return A Page object with the component/model hierarchy that was attached to this page at
+ * the time represented by the requested version.
*/
public Page getVersion(final int versionNumber)
{
@@ -650,14 +630,13 @@
}
/**
- * Call this method when the current (ajax) request shouldn't merge the
- * changes that are happening to the page with the previous version.
+ * Call this method when the current (ajax) request shouldn't merge the changes that are
+ * happening to the page with the previous version.
*
- * This is for example needed when you want to redirect to this page in an
- * ajax request and then you do want to version normally..
+ * This is for example needed when you want to redirect to this page in an ajax request and then
+ * you do want to version normally..
*
- * This method doesn't do anything if the getRequest().mergeVersion doesn't
- * return true.
+ * This method doesn't do anything if the getRequest().mergeVersion doesn't return true.
*/
public final void ignoreVersionMerge()
{
@@ -714,12 +693,10 @@
}
/**
- * Override this method and return true if your page is used to display
- * Wicket errors. This can help the framework prevent infinite failure
- * loops.
+ * Override this method and return true if your page is used to display Wicket errors. This can
+ * help the framework prevent infinite failure loops.
*
- * @return True if this page is intended to display an error to the end
- * user.
+ * @return True if this page is intended to display an error to the end user.
*/
public boolean isErrorPage()
{
@@ -727,10 +704,9 @@
}
/**
- * Gets whether the page is stateless. Components on stateless page must not
- * render any statefull urls, and components on statefull page must not
- * render any stateless urls. Statefull urls are urls, which refer to a
- * certain (current) page instance.
+ * Gets whether the page is stateless. Components on stateless page must not render any
+ * statefull urls, and components on statefull page must not render any stateless urls.
+ * Statefull urls are urls, which refer to a certain (current) page instance.
*
* @return Whether to page is stateless
*/
@@ -791,16 +767,16 @@
}
/**
- * Convenience method. Search for children of type fromClass and invoke
- * their respective removePersistedFormData() methods.
+ * Convenience method. Search for children of type fromClass and invoke their respective
+ * removePersistedFormData() methods.
*
* @see Form#removePersistentFormComponentValues(boolean)
*
* @param formClass
* Form to be selected. Pages may have more than one Form.
* @param disablePersistence
- * if true, disable persistence for all FormComponents on that
- * page. If false, it will remain unchanged.
+ * if true, disable persistence for all FormComponents on that page. If false, it
+ * will remain unchanged.
*/
public final void removePersistedFormData(final Class formClass,
final boolean disablePersistence)
@@ -858,23 +834,6 @@
// Set form component values from cookies
setFormComponentValuesFromCookies();
- // First, give priority to IFeedback instances, as they have to
- // collect their messages before components like ListViews
- // remove any child components
- visitChildren(IFeedback.class, new IVisitor()
- {
- public Object component(Component component)
- {
- ((IFeedback)component).updateFeedback();
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
-
- if (this instanceof IFeedback)
- {
- ((IFeedback)this).updateFeedback();
- }
-
try
{
prepareForRender();
@@ -953,8 +912,8 @@
}
/**
- * This returns a page instance that is rollbacked the number of versions
- * that is specified compared to the current page.
+ * This returns a page instance that is rollbacked the number of versions that is specified
+ * compared to the current page.
*
* This is a rollback including ajax versions.
*
@@ -972,9 +931,8 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL.
*
- * Set the id for this Page. This method is called by PageMap when a Page is
- * added because the id, which is assigned by PageMap, is not known until
- * this time.
+ * Set the id for this Page. This method is called by PageMap when a Page is added because the
+ * id, which is assigned by PageMap, is not known until this time.
*
* @param id
* The id
@@ -985,9 +943,9 @@
}
/**
- * Sets whether the page should try to be stateless. To be stateless,
- * getStatelessHint() of every component on page (and it's behavior) must
- * return true and the page must be bookmarkable.
+ * Sets whether the page should try to be stateless. To be stateless, getStatelessHint() of
+ * every component on page (and it's behavior) must return true and the page must be
+ * bookmarkable.
*
* @param value
* whether the page should try to be stateless
@@ -1040,8 +998,8 @@
* Throw an exception if not all components rendered.
*
* @param renderedContainer
- * The page itself if it was a full page render or the container
- * that was rendered standalone
+ * The page itself if it was a full page render or the container that was rendered
+ * standalone
*/
private final void checkRendering(final MarkupContainer renderedContainer)
{
@@ -1125,8 +1083,7 @@
}
/**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
- * OVERRIDE.
+ * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
*
*/
private final void endVersion()
@@ -1306,21 +1263,18 @@
}
/**
- * Set-up response with appropriate content type, locale and encoding. The
- * locale is set equal to the session's locale. The content type header
- * contains information about the markup type (@see #getMarkupType()) and
- * the encoding. The response (and request) encoding is determined by an
- * application setting (@see
- * ApplicationSettings#getResponseRequestEncoding()). In addition, if the
- * page's markup contains a xml declaration like <?xml ... ?> an xml
- * declaration with proper encoding information is written to the output as
- * well, provided it is not disabled by an applicaton setting (@see
+ * Set-up response with appropriate content type, locale and encoding. The locale is set equal
+ * to the session's locale. The content type header contains information about the markup type
+ * (@see #getMarkupType()) and the encoding. The response (and request) encoding is determined
+ * by an application setting (@see ApplicationSettings#getResponseRequestEncoding()). In
+ * addition, if the page's markup contains a xml declaration like <?xml ... ?> an xml
+ * declaration with proper encoding information is written to the output as well, provided it is
+ * not disabled by an applicaton setting (@see
* ApplicationSettings#getStripXmlDeclarationFromOutput()).
* <p>
- * Note: Prior to Wicket 1.1 the output encoding was determined by the
- * page's markup encoding. Because this caused uncertainties about the
- * /request/ encoding, it has been changed in favour of the new, much safer,
- * approach. Please see the Wiki for more details.
+ * Note: Prior to Wicket 1.1 the output encoding was determined by the page's markup encoding.
+ * Because this caused uncertainties about the /request/ encoding, it has been changed in favour
+ * of the new, much safer, approach. Please see the Wiki for more details.
*/
protected void configureResponse()
{
@@ -1350,8 +1304,7 @@
}
/**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
- * OVERRIDE.
+ * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
*
* @see org.apache.wicket.Component#internalOnModelChanged()
*/
@@ -1372,8 +1325,7 @@
}
/**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
- * OVERRIDE.
+ * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
*
* @param map
*/
@@ -1507,8 +1459,8 @@
/**
* @param pageMap
- * Sets this page into the page map with the given name. If the
- * page map does not yet exist, it is automatically created.
+ * Sets this page into the page map with the given name. If the page map does not yet
+ * exist, it is automatically created.
*/
final void setPageMap(final IPageMap pageMap)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java Sat Sep 1 10:42:51 2007
@@ -584,34 +584,6 @@
// process feedback
- // TODO do we need these special pre-attach feedback traversals all over
- // the place?
- it = markupIdToComponent.values().iterator();
- while (it.hasNext())
- {
- final Component component = (Component)it.next();
-
- if (component instanceof MarkupContainer)
- {
- MarkupContainer container = (MarkupContainer)component;
-
- // collect feedback
- container.visitChildren(IFeedback.class, new IVisitor()
- {
- public Object component(Component component)
- {
- ((IFeedback)component).updateFeedback();
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
- }
-
- if (component instanceof IFeedback)
- {
- ((IFeedback)component).updateFeedback();
- }
- }
-
// we need to attach feedback components here because they are not
// attached in MarkupContainer#attachChildren()
it = markupIdToComponent.values().iterator();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java Sat Sep 1 10:42:51 2007
@@ -49,9 +49,8 @@
* Constructor. Creates a model for all feedback messages on the page.
*
* @param component
- * The component where the page will be get from for which
- * messages will be displayed usually the same page as the one
- * feedbackpanel is attached to
+ * The component where the page will be get from for which messages will be displayed
+ * usually the same page as the one feedbackpanel is attached to
*/
public FeedbackMessagesModel(Component component)
{
@@ -62,14 +61,13 @@
}
/**
- * Constructor. Creates a model for all feedback messags accepted by the
- * given filter.
+ * Constructor. Creates a model for all feedback messags accepted by the given filter.
*
* @param filter
* The filter to apply
* @param page
- * Page for which messages will be displayed - usually the same
- * page as the one feedbackpanel is attached to
+ * Page for which messages will be displayed - usually the same page as the one
+ * feedbackpanel is attached to
*
*/
public FeedbackMessagesModel(Page page, IFeedbackMessageFilter filter)
@@ -152,8 +150,7 @@
* Override this method to post process to the FeedbackMessage list.
*
* @param messages
- * List of sorted and filtered FeedbackMessages for further
- * processing
+ * List of sorted and filtered FeedbackMessages for further processing
* @return The processed FeedbackMessage list
*/
protected List processMessages(final List messages)
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/IFeedback.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/IFeedback.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/IFeedback.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/IFeedback.java Sat Sep 1 10:42:51 2007
@@ -17,18 +17,15 @@
package org.apache.wicket.feedback;
/**
- * Interface for components that present some kind of feedback to the user,
- * normally based on the feedback messages attached to various components on a
- * given page.
+ * Interface for components that present some kind of feedback to the user, normally based on the
+ * feedback messages attached to various components on a given page.
+ *
+ * This is basically a marker interface that tells Wicket that this component's onBeforeRender
+ * method must be called after all non feedback components have been initialized.
*
* @author Jonathan Locke
* @author Eelco Hillenius
*/
public interface IFeedback
{
- /**
- * This method is called on any component implementing IFeedback when it is
- * time for the component to update its feedback display
- */
- void updateFeedback();
}
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java Sat Sep 1 10:42:51 2007
@@ -36,9 +36,8 @@
/**
- * A panel that displays {@link org.apache.wicket.feedback.FeedbackMessage}s in
- * a list view. The maximum number of messages to show can be set with
- * setMaxMessages().
+ * A panel that displays {@link org.apache.wicket.feedback.FeedbackMessage}s in a list view. The
+ * maximum number of messages to show can be set with setMaxMessages().
*
* @see org.apache.wicket.feedback.FeedbackMessage
* @see org.apache.wicket.feedback.FeedbackMessages
@@ -75,9 +74,8 @@
private static final long serialVersionUID = 1L;
/**
- * Returns feedbackPanel + the message level, eg
- * 'feedbackPanelERROR'. This is used as the class of the li /
- * span elements.
+ * Returns feedbackPanel + the message level, eg 'feedbackPanelERROR'. This is used
+ * as the class of the li / span elements.
*
* @see org.apache.wicket.model.IModel#getObject()
*/
@@ -110,6 +108,9 @@
/**
* @see org.apache.wicket.Component#Component(String)
+ *
+ * @param id
+ * @param filter
*/
public FeedbackPanel(final String id, IFeedbackMessageFilter filter)
{
@@ -124,7 +125,7 @@
}
};
add(messagesContainer);
- this.messageListView = new MessageListView("messages");
+ messageListView = new MessageListView("messages");
messageListView.setVersioned(false);
messagesContainer.add(messageListView);
@@ -136,9 +137,8 @@
/**
- * Search messages that this panel will render, and see if there is any
- * message of level ERROR or up. This is a convenience method; same as
- * calling 'anyMessage(FeedbackMessage.ERROR)'.
+ * Search messages that this panel will render, and see if there is any message of level ERROR
+ * or up. This is a convenience method; same as calling 'anyMessage(FeedbackMessage.ERROR)'.
*
* @return whether there is any message for this panel of level ERROR or up
*/
@@ -148,8 +148,7 @@
}
/**
- * Search messages that this panel will render, and see if there is any
- * message.
+ * Search messages that this panel will render, and see if there is any message.
*
* @return whether there is any message for this panel
*/
@@ -159,8 +158,8 @@
}
/**
- * Search messages that this panel will render, and see if there is any
- * message of the given level.
+ * Search messages that this panel will render, and see if there is any message of the given
+ * level.
*
* @param level
* the level, see FeedbackMessage
@@ -195,8 +194,7 @@
}
/**
- * @return Model for feedback messages on which you can install filters and
- * other properties
+ * @return Model for feedback messages on which you can install filters and other properties
*/
public final FeedbackMessagesModel getFeedbackMessagesModel()
{
@@ -253,12 +251,12 @@
/**
* @param maxMessages
- * The maximum number of feedback messages that this feedback
- * panel should show at one time
+ * The maximum number of feedback messages that this feedback panel should show at
+ * one time
*/
public final void setMaxMessages(int maxMessages)
{
- this.messageListView.setViewSize(maxMessages);
+ messageListView.setViewSize(maxMessages);
}
/**
@@ -278,7 +276,7 @@
public void updateFeedback()
{
// Force model to load
- messageListView.getModelObject();
+ // getFeedbackMessagesModel().preloadMessages();
}
/**
@@ -286,9 +284,8 @@
*
* @param message
* the message
- * @return the css class; by default, this returns feedbackPanel + the
- * message level, eg 'feedbackPanelERROR', but you can override this
- * method to provide your own
+ * @return the css class; by default, this returns feedbackPanel + the message level, eg
+ * 'feedbackPanelERROR', but you can override this method to provide your own
*/
protected String getCSSClass(final FeedbackMessage message)
{
@@ -317,9 +314,8 @@
}
/**
- * Generates a component that is used to display the message inside the
- * feedback panel. This component must handle being attached to
- * <code>span</code> tags.
+ * Generates a component that is used to display the message inside the feedback panel. This
+ * component must handle being attached to <code>span</code> tags.
*
* By default a {@link Label} is used.
*
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/ComponentRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/ComponentRequestTarget.java?rev=571837&r1=571836&r2=571837&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/ComponentRequestTarget.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/ComponentRequestTarget.java Sat Sep 1 10:42:51 2007
@@ -17,15 +17,13 @@
package org.apache.wicket.request.target.component;
import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;
import org.apache.wicket.RequestCycle;
-import org.apache.wicket.Component.IVisitor;
-import org.apache.wicket.feedback.IFeedback;
/**
- * Default implementation of {@link org.apache.wicket.request.target.component.IComponentRequestTarget}.
- * Target that denotes a single component instance.
+ * Default implementation of
+ * {@link org.apache.wicket.request.target.component.IComponentRequestTarget}. Target that denotes
+ * a single component instance.
*
* @author Eelco Hillenius
*/
@@ -73,26 +71,6 @@
// Render the component
try
{
- // collect feedback
- if (component instanceof MarkupContainer)
- {
- MarkupContainer container = (MarkupContainer)component;
-
- container.visitChildren(IFeedback.class, new IVisitor()
- {
- public Object component(Component component)
- {
- ((IFeedback)component).updateFeedback();
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
- }
-
- if (component instanceof IFeedback)
- {
- ((IFeedback)component).updateFeedback();
- }
-
// attach
component.attach();