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/10/11 21:40:31 UTC
svn commit: r583928 - in
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket: ./ ajax/
markup/html/tree/ markup/repeater/ protocol/http/request/
request/target/component/ util/tester/
Author: knopp
Date: Thu Oct 11 12:40:22 2007
New Revision: 583928
URL: http://svn.apache.org/viewvc?rev=583928&view=rev
Log:
WICKET-1059
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/Page.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.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/markup/html/tree/AbstractTree.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/ComponentRequestTarget.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.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=583928&r1=583927&r2=583928&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 Thu Oct 11 12:40:22 2007
@@ -42,6 +42,7 @@
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.IModelComparator;
import org.apache.wicket.model.IWrapModel;
+import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.settings.IDebugSettings;
import org.apache.wicket.util.convert.IConverter;
import org.apache.wicket.util.lang.Classes;
@@ -635,12 +636,12 @@
private static final long serialVersionUID = 1L;
};
- static final int FLAG_ATTACH_SUPER_CALL_VERIFIED = 0x10000000;
+ // static final int FLAG_ATTACH_SUPER_CALL_VERIFIED = 0x10000000;
static final int FLAG_ATTACHED = 0x20000000;
- static final int FLAG_ATTACHING = 0x40000000;
+ // static final int FLAG_ATTACHING = 0x40000000;
/**
* Flag that makes we are in before-render callback phase Set after component.onBeforeRender is
@@ -785,15 +786,6 @@
}
}
- /**
- * Attaches the component. This is called when the page is starting to be used for rendering or
- * when a component listener call is executed on it.
- */
- public final void attach()
- {
- internalAttach2();
- }
-
private final void internalBeforeRender()
{
if (isVisible() && !getFlag(FLAG_RENDERING) && !getFlag(FLAG_PREPARED_FOR_RENDER))
@@ -850,7 +842,7 @@
// If any of the components on page is not stateless, we need to bind the session
// before we start rendering components, as then jsessionid won't be appended
// for links rendered before first stateful component
- if (isStateless() && getSession().isTemporary())
+ if (!isStateless() && getSession().isTemporary())
{
getSession().bind();
}
@@ -2931,13 +2923,6 @@
throw new WicketRuntimeException(
"Cannot modify component hierarchy during render phase");
}
-
- // Throw exception if modification is attempted during attach
- if (getFlag(FLAG_ATTACHING))
- {
- throw new WicketRuntimeException(
- "Cannot modify component hierarchy during attach phase");
- }
}
/**
@@ -3175,6 +3160,16 @@
}
/**
+ * Convenience method that sets the attached flags.
+ *
+ * @param attached
+ */
+ protected final void markAttached(boolean attached)
+ {
+ setFlag(FLAG_ATTACHED, attached);
+ }
+
+ /**
* @return true if this component is attached
*/
protected final boolean isAttached()
@@ -3227,15 +3222,20 @@
}
/**
- * Called to allow a component to attach resources for use.
- *
- * Overrides of this method MUST call the super implementation, the most logical place to do
- * this is the first line of the override method.
+ * The onAttach method is no longer available.
+ * <p>
+ * If you need to initialize component before it is rendered, either use
+ * {@link #onBeforeRender()} or do the initialization lazily (on first demand, such as
+ * {@link LoadableDetachableModel} does.
+ * <p>
+ * If you need to get notification when page is taken out of Session (before calling the even
+ * listener), you can use the {@link Page#onPageAttached()} method.
*
+ * @deprecated
*/
- protected void onAttach()
+ protected final void onAttach()
{
- setFlag(FLAG_ATTACH_SUPER_CALL_VERIFIED, true);
+
}
/**
@@ -3570,35 +3570,6 @@
final boolean hasMarkupIdMetaData()
{
return getMetaData(MARKUP_ID_KEY) != null;
- }
-
- /**
- * Attaches any child components
- *
- * This method is here only for {@link MarkupContainer}. It is broken out of
- * {@link #onBeforeRender()} so we can guarantee that it executes as the last in onAttach()
- * chain no matter where user places the <code>super.onAttach()</code> call
- */
- void internalAttach2()
- {
- if (!getFlag(FLAG_ATTACHED))
- {
- setFlag(FLAG_ATTACHING, true);
- setFlag(FLAG_ATTACH_SUPER_CALL_VERIFIED, false);
- onAttach();
- if (!getFlag(FLAG_ATTACH_SUPER_CALL_VERIFIED))
- {
- throw new IllegalStateException(
- "Component " +
- this +
- " of type " +
- getClass().getName() +
- " has not been properly attached. " +
- "Something in its class hierarchy has failed to call super.onAttach() in an override of onAttach() method");
- }
- setFlag(FLAG_ATTACHING, false);
- setFlag(FLAG_ATTACHED, true);
- }
}
void internalMarkRendering()
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=583928&r1=583927&r2=583928&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 Thu Oct 11 12:40:22 2007
@@ -810,11 +810,6 @@
*/
public final void renderPage()
{
- // if not attached then attach the whole page.
- if (!isAttached())
- {
- attach();
- }
// first try to check if the page can be rendered:
if (!isActionAuthorized(RENDER))
{
@@ -1461,5 +1456,13 @@
void setPageStateless(Boolean stateless)
{
this.stateless = stateless;
+ }
+
+ /**
+ * Called when the page is retrieved from Session.
+ */
+ public void onPageAttached()
+ {
+
}
}
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java?rev=583928&r1=583927&r2=583928&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java Thu Oct 11 12:40:22 2007
@@ -44,42 +44,37 @@
/**
- * Holds information about a user session, including some fixed number of most
- * recent pages (and all their nested component information).
+ * Holds information about a user session, including some fixed number of most recent pages (and all
+ * their nested component information).
* <ul>
- * <li><b>Access via RequestCycle </b>- The Session for a {@link RequestCycle}
- * can be retrieved by calling {@link RequestCycle#getSession()}.
+ * <li><b>Access via RequestCycle </b>- The Session for a {@link RequestCycle} can be retrieved by
+ * calling {@link RequestCycle#getSession()}.
*
- * <li><b>Access via Component </b>- If a RequestCycle object is not available,
- * the Session can be retrieved for a Component by calling
- * {@link Component#getSession()}. As currently implemented, each Component
- * does not itself have a reference to the session that contains it. However,
- * the Page component at the root of the containment hierarchy does have a
- * reference to the Session that holds the Page. So
- * {@link Component#getSession()} traverses the component hierarchy to the root
+ * <li><b>Access via Component </b>- If a RequestCycle object is not available, the Session can be
+ * retrieved for a Component by calling {@link Component#getSession()}. As currently implemented,
+ * each Component does not itself have a reference to the session that contains it. However, the
+ * Page component at the root of the containment hierarchy does have a reference to the Session that
+ * holds the Page. So {@link Component#getSession()} traverses the component hierarchy to the root
* Page and then calls {@link Page#getSession()}.
*
- * <li><b>Access via Thread Local </b>- In the odd case where neither a
- * RequestCycle nor a Component is available, the currently active Session for
- * the calling thread can be retrieved by calling the static method
- * Session.get(). This last form should only be used if the first two forms
- * cannot be used since thread local access can involve a potentially more
- * expensive hash map lookup.
+ * <li><b>Access via Thread Local </b>- In the odd case where neither a RequestCycle nor a
+ * Component is available, the currently active Session for the calling thread can be retrieved by
+ * calling the static method Session.get(). This last form should only be used if the first two
+ * forms cannot be used since thread local access can involve a potentially more expensive hash map
+ * lookup.
*
- * <li><b>Locale </b>- A session has a Locale property to support localization.
- * The Locale for a session can be set by calling
- * {@link Session#setLocale(Locale)}. The Locale for a Session determines how
- * localized resources are found and loaded.
+ * <li><b>Locale </b>- A session has a Locale property to support localization. The Locale for a
+ * session can be set by calling {@link Session#setLocale(Locale)}. The Locale for a Session
+ * determines how localized resources are found and loaded.
*
- * <li><b>Style </b>- Besides having an appearance based on locale, resources
- * can also have different looks in the same locale (a.k.a. "skins"). The style
- * for a session determines the look which is used within the appopriate locale.
- * The session style ("skin") can be set with the setStyle() method.
+ * <li><b>Style </b>- Besides having an appearance based on locale, resources can also have
+ * different looks in the same locale (a.k.a. "skins"). The style for a session determines the look
+ * which is used within the appopriate locale. The session style ("skin") can be set with the
+ * setStyle() method.
*
- * <li><b>Resource Loading </b>- Based on the Session locale and style,
- * searching for resources occurs in the following order (where sourcePath is
- * set via the ApplicationSettings object for the current Application, and style
- * and locale are Session properties):
+ * <li><b>Resource Loading </b>- Based on the Session locale and style, searching for resources
+ * occurs in the following order (where sourcePath is set via the ApplicationSettings object for the
+ * current Application, and style and locale are Session properties):
* <ul>
* 1. [sourcePath]/name[style][locale].[extension] <br>
* 2. [sourcePath]/name[locale].[extension] <br>
@@ -91,30 +86,26 @@
* 8. [classPath]/name.[extension] <br>
* </ul>
*
- * <li><b>Session Properties </b>- Arbitrary objects can be attached to a
- * Session by installing a session factory on your Application class which
- * creates custom Session subclasses that have typesafe properties specific to
- * the application (see {@link Application} for details). To discourage
- * non-typesafe access to Session properties, no setProperty() or getProperty()
- * method is provided. In a clustered environment, you should take care to call
- * the dirty() method when you change a property or youre own. This way the
- * session will be reset again in the http session so that the http session
- * knows the session is changed.
+ * <li><b>Session Properties </b>- Arbitrary objects can be attached to a Session by installing a
+ * session factory on your Application class which creates custom Session subclasses that have
+ * typesafe properties specific to the application (see {@link Application} for details). To
+ * discourage non-typesafe access to Session properties, no setProperty() or getProperty() method is
+ * provided. In a clustered environment, you should take care to call the dirty() method when you
+ * change a property or youre own. This way the session will be reset again in the http session so
+ * that the http session knows the session is changed.
*
- * <li><b>Class Resolver </b>- Sessions have a class resolver (
- * {@link IClassResolver}) implementation that is used to locate classes for
- * components such as pages.
+ * <li><b>Class Resolver </b>- Sessions have a class resolver ( {@link IClassResolver})
+ * implementation that is used to locate classes for components such as pages.
*
- * <li><b>Page Factory </b>- A pluggable implementation of {@link IPageFactory}
- * is used to instantiate pages for the session.
+ * <li><b>Page Factory </b>- A pluggable implementation of {@link IPageFactory} is used to
+ * instantiate pages for the session.
*
- * <li><b>Removal </b>- Pages can be removed from the Session forcibly by
- * calling remove(Page) or removeAll(), although such an action should rarely be
- * necessary.
+ * <li><b>Removal </b>- Pages can be removed from the Session forcibly by calling remove(Page) or
+ * removeAll(), although such an action should rarely be necessary.
*
- * <li><b>Flash Messages</b>- Flash messages are messages that are stored in
- * session and are removed after they are displayed to the user. Session acts as
- * a store for these messages because they can last across requests.
+ * <li><b>Flash Messages</b>- Flash messages are messages that are stored in session and are
+ * removed after they are displayed to the user. Session acts as a store for these messages because
+ * they can last across requests.
*
* @author Jonathan Locke
* @author Eelco Hillenius
@@ -148,8 +139,7 @@
/**
* @param pagemap
* the pagemap to add as used.
- * @return the boolean if it was added (didn't already contain the
- * pagemap)
+ * @return the boolean if it was added (didn't already contain the pagemap)
*/
public boolean add(IPageMap pagemap)
{
@@ -190,8 +180,7 @@
/**
* Checks if the <code>Session</code> threadlocal is set in this thread
*
- * @return true if {@link Session#get()} can return the instance of session,
- * false otherwise
+ * @return true if {@link Session#get()} can return the instance of session, false otherwise
*/
public static boolean exists()
{
@@ -199,12 +188,10 @@
}
/**
- * Locate the session for the client of this request in the
- * {@link ISessionStore} or create a new one and attach it when none could
- * be located and sets it as the current instance for this thread.
- * Typically, clients never touch this method, but rather use
- * {@link Session#get()}, which does the locating implicitly when not yet
- * set as a thread local.
+ * Locate the session for the client of this request in the {@link ISessionStore} or create a
+ * new one and attach it when none could be located and sets it as the current instance for this
+ * thread. Typically, clients never touch this method, but rather use {@link Session#get()},
+ * which does the locating implicitly when not yet set as a thread local.
*
* @return The session for the client of this request or a new, unbound
*/
@@ -262,8 +249,7 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
* <p>
- * Sets session for calling thread. Also triggers {@link #attach()} being
- * called.
+ * Sets session for calling thread. Also triggers {@link #attach()} being called.
*
* @param session
* The session
@@ -317,8 +303,7 @@
private MetaDataEntry[] metaData;
/**
- * We need to know both thread that keeps the pagemap lock and the
- * RequestCycle
+ * We need to know both thread that keeps the pagemap lock and the RequestCycle
*/
private static class PageMapsUsedInRequestEntry
{
@@ -332,8 +317,8 @@
private transient boolean sessionInvalidated = false;
/**
- * Temporary instance of the session store. Should be set on each request as
- * it is not supposed to go in the session.
+ * Temporary instance of the session store. Should be set on each request as it is not supposed
+ * to go in the session.
*/
private transient ISessionStore sessionStore;
@@ -341,12 +326,12 @@
private String style;
/**
- * Holds attributes for sessions that are still temporary/ not bound to a
- * session store. Only used when {@link #isTemporary()} is true.
+ * Holds attributes for sessions that are still temporary/ not bound to a session store. Only
+ * used when {@link #isTemporary()} is true.
* <p>
- * Note: this doesn't have to be synchronized, as the only time when this
- * map is used is when a session is temporary, in which case it won't be
- * shared between requests (it's a per request instance).
+ * Note: this doesn't have to be synchronized, as the only time when this map is used is when a
+ * session is temporary, in which case it won't be shared between requests (it's a per request
+ * instance).
* </p>
*/
private transient Map temporarySessionAttributes;
@@ -355,8 +340,7 @@
private final LinkedList/* <IPageMap> */usedPageMaps = new LinkedList();
/**
- * Constructor. Note that {@link RequestCycle} is not available until this
- * constructor returns.
+ * Constructor. Note that {@link RequestCycle} is not available until this constructor returns.
*
* @param request
* The current request
@@ -371,8 +355,7 @@
}
/**
- * Constructor. Note that {@link RequestCycle} is not available until this
- * constructor returns.
+ * Constructor. Note that {@link RequestCycle} is not available until this constructor returns.
*
* @deprecated Use #Session(Request)
*
@@ -387,21 +370,19 @@
}
/**
- * Force binding this session to the application's
- * {@link ISessionStore session store} if not already done so.
+ * Force binding this session to the application's {@link ISessionStore session store} if not
+ * already done so.
* <p>
- * A Wicket application can operate in a session-less mode as long as
- * stateless pages are used. Session objects will be then created for each
- * request, but they will only live for that request. You can recognize
- * temporary sessions by calling {@link #isTemporary()} which basically
- * checks whether the session's id is null. Hence, temporary sessions have
- * no session id.
+ * A Wicket application can operate in a session-less mode as long as stateless pages are used.
+ * Session objects will be then created for each request, but they will only live for that
+ * request. You can recognize temporary sessions by calling {@link #isTemporary()} which
+ * basically checks whether the session's id is null. Hence, temporary sessions have no session
+ * id.
* </p>
* <p>
- * By calling this method, the session will be bound (made not-temporary) if
- * it was not bound yet. It is useful for cases where you want to be
- * absolutely sure this session object will be available in next requests.
- * If the session was already bound ({@link ISessionStore#lookup(Request) returns a session}),
+ * By calling this method, the session will be bound (made not-temporary) if it was not bound
+ * yet. It is useful for cases where you want to be absolutely sure this session object will be
+ * available in next requests. If the session was already bound ({@link ISessionStore#lookup(Request) returns a session}),
* this call will be a noop.
* </p>
*/
@@ -429,15 +410,15 @@
}
/**
- * Cleans up all rendered feedback messages and any unrendered, dangling
- * feedback messages there may be left after that.
+ * Cleans up all rendered feedback messages and any unrendered, dangling feedback messages there
+ * may be left after that.
*/
public abstract void cleanupFeedbackMessages();
/**
- * Removes all pages from the session. Although this method should rarely be
- * needed, it is available (possibly for security reasons).
+ * Removes all pages from the session. Although this method should rarely be needed, it is
+ * available (possibly for security reasons).
*/
public final void clear()
{
@@ -471,9 +452,8 @@
}
/**
- * With this call you can create a pagemap name but not create the pagemap
- * itself already. It will give the first pagemap name where it couldn't
- * find a current pagemap for.
+ * With this call you can create a pagemap name but not create the pagemap itself already. It
+ * will give the first pagemap name where it couldn't find a current pagemap for.
*
* It will return the same name if you call it 2 times in a row.
*
@@ -481,14 +461,14 @@
*/
public synchronized final String createAutoPageMapName()
{
- String name = getAutoPageMapNamePrefix() + currentCreateAutoPageMapCounter()
- + getAutoPageMapNameSuffix();
+ String name = getAutoPageMapNamePrefix() + currentCreateAutoPageMapCounter() +
+ getAutoPageMapNameSuffix();
IPageMap pm = pageMapForName(name, false);
while (pm != null)
{
incrementCreateAutoPageMapCounter();
- name = getAutoPageMapNamePrefix() + currentCreateAutoPageMapCounter()
- + getAutoPageMapNameSuffix();
+ name = getAutoPageMapNamePrefix() + currentCreateAutoPageMapCounter() +
+ getAutoPageMapNameSuffix();
pm = pageMapForName(name, false);
}
return name;
@@ -548,13 +528,12 @@
}
/**
- * Gets the client info object for this session. This method lazily gets the
- * new agent info object for this session. It uses any cached or set ({@link #setClientInfo(ClientInfo)})
- * client info object or uses {@link RequestCycle#newClientInfo()} to get
- * the info object based on the current request when no client info object
- * was set yet, and then caches the returned object; we can expect the
- * client to stay the same for the whole session, and implementations of
- * {@link RequestCycle#newClientInfo()} might be relatively expensive.
+ * Gets the client info object for this session. This method lazily gets the new agent info
+ * object for this session. It uses any cached or set ({@link #setClientInfo(ClientInfo)})
+ * client info object or uses {@link RequestCycle#newClientInfo()} to get the info object based
+ * on the current request when no client info object was set yet, and then caches the returned
+ * object; we can expect the client to stay the same for the whole session, and implementations
+ * of {@link RequestCycle#newClientInfo()} might be relatively expensive.
*
* @return the client info object based on this request
*/
@@ -586,11 +565,10 @@
}
/**
- * Gets the unique id for this session from the underlying SessionStore. May
- * be null if a concrete session is not yet created.
+ * Gets the unique id for this session from the underlying SessionStore. May be null if a
+ * concrete session is not yet created.
*
- * @return The unique id for this session or null if it is a temporary
- * session
+ * @return The unique id for this session or null if it is a temporary session
*/
public final String getId()
{
@@ -631,8 +609,8 @@
}
/**
- * When a regular request on certain page with certain version is being
- * processed, we don't allow ajax requests to same page and version.
+ * When a regular request on certain page with certain version is being processed, we don't
+ * allow ajax requests to same page and version.
*
* @param lockedRequestCycle
* @return whether current request is valid or sould be discarded
@@ -645,8 +623,8 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
*
- * Returns the page with given id and versionNumber. It keeps asking
- * pageMaps for given page until it finds one that contains it.
+ * Returns the page with given id and versionNumber. It keeps asking pageMaps for given page
+ * until it finds one that contains it.
*
* @param pageId
* @param versionNumber
@@ -685,8 +663,8 @@
* Component path
* @param versionNumber
* The version of the page required
- * @return The page based on the first path component (the page id), or null
- * if the requested version of the page cannot be found.
+ * @return The page based on the first path component (the page id), or null if the requested
+ * version of the page cannot be found.
*/
public final Page getPage(final String pageMapName, final String path, final int versionNumber)
{
@@ -743,15 +721,15 @@
entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest.get(pageMap);
t = entry != null ? entry.thread : null;
- if (t != null && t != Thread.currentThread()
- && (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
+ if (t != null && t != Thread.currentThread() &&
+ (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
{
// if it is still not the right thread..
// This either points to long running code (a report
// page?) or a deadlock or such
- throw new WicketRuntimeException("After " + timeout + " the Pagemap "
- + pageMapName + " is still locked by: " + t
- + ", giving up trying to get the page for path: " + path);
+ throw new WicketRuntimeException("After " + timeout + " the Pagemap " +
+ pageMapName + " is still locked by: " + t +
+ ", giving up trying to get the page for path: " + path);
}
}
@@ -769,7 +747,7 @@
else
{
// attach the page now.
- page.attach();
+ page.onPageAttached();
touch(page);
}
return page;
@@ -789,8 +767,7 @@
/**
* @param page
* The page, or null if no page context is available
- * @return The page factory for the page, or the default page factory if
- * page was null
+ * @return The page factory for the page, or the default page factory if page was null
*/
public final IPageFactory getPageFactory(final Page page)
{
@@ -854,10 +831,10 @@
}
/**
- * Invalidates this session at the end of the current request. If you need
- * to invalidate the session immediately, you can do this by calling
- * invalidateNow(), however this will remove all Wicket components from this
- * session, which means that you will no longer be able to work with them.
+ * Invalidates this session at the end of the current request. If you need to invalidate the
+ * session immediately, you can do this by calling invalidateNow(), however this will remove all
+ * Wicket components from this session, which means that you will no longer be able to work with
+ * them.
*/
public void invalidate()
{
@@ -865,9 +842,8 @@
}
/**
- * Invalidates this session immediately. Calling this method will remove all
- * Wicket components from this session, which means that you will no longer
- * be able to work with them.
+ * Invalidates this session immediately. Calling this method will remove all Wicket components
+ * from this session, which means that you will no longer be able to work with them.
*/
public void invalidateNow()
{
@@ -876,8 +852,8 @@
}
/**
- * Whether the session is invalid now, or will be invalidated by the end of
- * the request. Clients should rarely need to use this method if ever.
+ * Whether the session is invalid now, or will be invalidated by the end of the request. Clients
+ * should rarely need to use this method if ever.
*
* @return Whether the session is invalid when the current request is done
*
@@ -890,12 +866,11 @@
}
/**
- * Whether this session is temporary. A Wicket application can operate in a
- * session-less mode as long as stateless pages are used. If this session
- * object is temporary, it will not be available on a next request.
+ * Whether this session is temporary. A Wicket application can operate in a session-less mode as
+ * long as stateless pages are used. If this session object is temporary, it will not be
+ * available on a next request.
*
- * @return Whether this session is temporary (which is the same as it's id
- * being null)
+ * @return Whether this session is temporary (which is the same as it's id being null)
*/
public final boolean isTemporary()
{
@@ -935,8 +910,7 @@
* @param pageMapName
* Name of page map, or null for default page map
* @param autoCreate
- * True if the page map should be automatically created if it
- * does not exist
+ * True if the page map should be automatically created if it does not exist
* @return PageMap for name
*/
public final IPageMap pageMapForName(String pageMapName, final boolean autoCreate)
@@ -1015,10 +989,9 @@
}
/**
- * Sets the metadata for this session using the given key. If the metadata
- * object is not of the correct type for the metadata key, an
- * IllegalArgumentException will be thrown. For information on creating
- * MetaDataKeys, see {@link MetaDataKey}.
+ * Sets the metadata for this session using the given key. If the metadata object is not of the
+ * correct type for the metadata key, an IllegalArgumentException will be thrown. For
+ * information on creating MetaDataKeys, see {@link MetaDataKey}.
*
* @param key
* The singleton key for the metadata
@@ -1049,9 +1022,8 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
* <p>
- * The page will be 'touched' in the session. If it wasn't added yet to the
- * pagemap, it will be added to the page map else it will set this page to
- * the front.
+ * The page will be 'touched' in the session. If it wasn't added yet to the pagemap, it will be
+ * added to the page map else it will set this page to the front.
*
* If another page was removed because of this it will be cleaned up.
*
@@ -1142,17 +1114,15 @@
}
/**
- * Any attach logic for session subclasses. Called when a session is set for
- * the thread.
+ * Any attach logic for session subclasses. Called when a session is set for the thread.
*/
protected void attach()
{
}
/**
- * Any detach logic for session subclasses. This is called on the end of
- * handling a request, when the RequestCycle is about to be detached from
- * the current thread.
+ * Any detach logic for session subclasses. This is called on the end of handling a request,
+ * when the RequestCycle is about to be detached from the current thread.
*/
protected void detach()
{
@@ -1163,8 +1133,7 @@
}
/**
- * Marks session state as dirty so that it will be flushed at the end of the
- * request.
+ * Marks session state as dirty so that it will be flushed at the end of the request.
*/
public final void dirty()
{
@@ -1316,8 +1285,8 @@
/**
* NOT TO BE CALLED BY FRAMEWORK USERS.
*
- * @deprecated obsolete method (was meant for internal book keeping really).
- * Clients should override {@link #detach()} instead.
+ * @deprecated obsolete method (was meant for internal book keeping really). Clients should
+ * override {@link #detach()} instead.
*/
protected final void update()
{
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=583928&r1=583927&r2=583928&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 Thu Oct 11 12:40:22 2007
@@ -35,8 +35,6 @@
import org.apache.wicket.ResourceReference;
import org.apache.wicket.Response;
import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.Component.IVisitor;
-import org.apache.wicket.feedback.IFeedback;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.internal.HeaderResponse;
import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
@@ -592,44 +590,8 @@
{
Iterator it;
- // process feedback
+ // TODO: We might need to call prepareRender on all components upfront
- // we need to attach feedback components here because they are not
- // attached in MarkupContainer#attachChildren()
- it = markupIdToComponent.values().iterator();
- while (it.hasNext())
- {
- final Component component = (Component)it.next();
-
- if (component instanceof IFeedback)
- {
- component.attach();
- }
-
- if (component instanceof MarkupContainer)
- {
- MarkupContainer container = (MarkupContainer)component;
-
- // collect feedback
- container.visitChildren(IFeedback.class, new IVisitor()
- {
- public Object component(Component component)
- {
- component.attach();
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
- }
-
- }
-
-
- // attach components
- it = markupIdToComponent.values().iterator();
- while (it.hasNext())
- {
- ((Component)it.next()).attach();
- }
// process component markup
it = markupIdToComponent.entrySet().iterator();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java?rev=583928&r1=583927&r2=583928&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java Thu Oct 11 12:40:22 2007
@@ -258,23 +258,6 @@
setFlag(FLAG_RENDER_CHILDREN, value);
}
- protected void onAttach()
- {
- super.onAttach();
-
- if (isRenderChildren())
- {
- // visit every child
- visitItemChildren(this, new IItemCallback()
- {
- public void visitItem(TreeItem item)
- {
- item.attach();
- }
- });
- }
- }
-
protected void onDetach()
{
super.onDetach();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java?rev=583928&r1=583927&r2=583928&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java Thu Oct 11 12:40:22 2007
@@ -103,13 +103,6 @@
return models;
}
-
- protected void onAttach()
- {
- clearCachedItemCount();
- super.onAttach();
- }
-
protected void onBeforeRender()
{
clearCachedItemCount();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?rev=583928&r1=583927&r2=583928&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Thu Oct 11 12:40:22 2007
@@ -195,8 +195,7 @@
final RequestParameters parameters = new RequestParameters();
final String pathInfo = getRequestPath(request);
parameters.setPath(pathInfo);
- parameters.setPageMapName(WebRequestCodingStrategy.decodePageMapName(request
- .getParameter(PAGEMAP)));
+ parameters.setPageMapName(request.getParameter(PAGEMAP));
addInterfaceParameters(request, parameters);
addBookmarkablePageParameters(request, parameters);
addResourceParameters(request, parameters);
@@ -239,18 +238,20 @@
RequestContext requestContext = RequestContext.get();
boolean portletRequest = requestContext.isPortletRequest();
boolean sharedResourceURL = false;
-
+
if (url != null && !portletRequest)
{
// Do nothing - we've found the URL and it's mounted.
}
else if (requestTarget instanceof IBookmarkablePageRequestTarget)
{
- url = requestContext.encodeRenderURL(url == null ? encode(requestCycle, (IBookmarkablePageRequestTarget)requestTarget) : url);
+ url = requestContext.encodeRenderURL(url == null ? encode(requestCycle,
+ (IBookmarkablePageRequestTarget)requestTarget) : url);
}
else if (requestTarget instanceof ISharedResourceRequestTarget)
{
- url = requestContext.encodeSharedResourceURL(url == null ? encode(requestCycle, (ISharedResourceRequestTarget)requestTarget) : url);
+ url = requestContext.encodeSharedResourceURL(url == null ? encode(requestCycle,
+ (ISharedResourceRequestTarget)requestTarget) : url);
sharedResourceURL = true;
}
else if (requestTarget instanceof IListenerInterfaceRequestTarget)
@@ -263,18 +264,22 @@
{
IListenerInterfaceRequestTarget iliRequestTarget = (IListenerInterfaceRequestTarget)requestTarget;
RequestListenerInterface rli = iliRequestTarget.getRequestListenerInterface();
- if (IResourceListener.class.isAssignableFrom(rli.getMethod().getDeclaringClass())
- || IBehaviorListener.class.isAssignableFrom(rli.getMethod().getDeclaringClass()))
+ if (IResourceListener.class.isAssignableFrom(rli.getMethod().getDeclaringClass()) ||
+ IBehaviorListener.class.isAssignableFrom(rli.getMethod()
+ .getDeclaringClass()))
{
url = requestContext.encodeResourceURL(url);
}
- else if (IRedirectListener.class.isAssignableFrom(rli.getMethod().getDeclaringClass()))
+ else if (IRedirectListener.class.isAssignableFrom(rli.getMethod()
+ .getDeclaringClass()))
{
if (((WebRequestCycle)requestCycle).getWebRequest().isAjax())
{
- // TODO: Probably not all Ajax based redirects need to break out of ResourceURL encoding
- // Need to findout and/or provide some kind of extension how to indicate this
- url = ((PortletRequestContext)requestContext).encodeRenderURL(url,true);
+ // TODO: Probably not all Ajax based redirects need to break out of
+ // ResourceURL encoding
+ // Need to findout and/or provide some kind of extension how to indicate
+ // this
+ url = ((PortletRequestContext)requestContext).encodeRenderURL(url, true);
}
else
{
@@ -288,9 +293,10 @@
if (forceActionURL)
{
List behaviors = iliRequestTarget.getTarget().getBehaviors();
- for (int i = 0, size = behaviors.size(); i<size; i++)
+ for (int i = 0, size = behaviors.size(); i < size; i++)
{
- if (AbstractAjaxBehavior.class.isAssignableFrom(behaviors.get(i).getClass()))
+ if (AbstractAjaxBehavior.class.isAssignableFrom(behaviors.get(i)
+ .getClass()))
{
forceActionURL = false;
break;
@@ -321,7 +327,7 @@
if (url != null)
{
String result = null;
-
+
if (!sharedResourceURL && portletRequest)
{
result = url.toString();
@@ -329,7 +335,7 @@
else
{
// Add the actual URL. This will be relative to the Wicket
- // Servlet/Filter, with no leading '/'.
+ // Servlet/Filter, with no leading '/'.
PrependingStringBuffer prepender = new PrependingStringBuffer(url.toString());
// Prepend prefix to the URL to make it relative to the current
@@ -366,7 +372,7 @@
*/
public IRequestTargetUrlCodingStrategy[] listMounts()
{
- synchronized(mountsOnPath)
+ synchronized (mountsOnPath)
{
return (IRequestTargetUrlCodingStrategy[])mountsOnPath.strategies().toArray(
new IRequestTargetUrlCodingStrategy[mountsOnPath.size()]);
@@ -378,7 +384,7 @@
*/
public final IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(String path)
{
- synchronized(mountsOnPath)
+ synchronized (mountsOnPath)
{
if (path == null)
{
@@ -398,7 +404,7 @@
/**
* @see org.apache.wicket.request.IRequestTargetMounter#mount(
- org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy)
+ * org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy)
*/
public final void mount(IRequestTargetUrlCodingStrategy encoder)
{
@@ -426,7 +432,7 @@
path = path.substring(1);
}
- synchronized(mountsOnPath)
+ synchronized (mountsOnPath)
{
if (mountsOnPath.strategyForMount(path) != null)
{
@@ -481,7 +487,7 @@
path = path.substring(1);
}
- synchronized(mountsOnPath)
+ synchronized (mountsOnPath)
{
mountsOnPath.unmount(path);
}
@@ -904,7 +910,8 @@
if (IActivePageBehaviorListener.INTERFACE.getName().equals(listenerName))
{
- url.append(url.indexOf("?") > -1 ? "&" : "?").append(IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME).append("=true");
+ url.append(url.indexOf("?") > -1 ? "&" : "?").append(
+ IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME).append("=true");
}
return url;
}
@@ -942,7 +949,7 @@
*/
protected IRequestTargetUrlCodingStrategy getMountEncoder(IRequestTarget requestTarget)
{
- synchronized(mountsOnPath)
+ synchronized (mountsOnPath)
{
// TODO Post 1.2: Performance: Optimize algorithm if possible and/ or
// cache lookup results
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=583928&r1=583927&r2=583928&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 Thu Oct 11 12:40:22 2007
@@ -71,9 +71,6 @@
// Render the component
try
{
- // attach
- component.attach();
-
// Render the component
component.renderComponent();
}
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java?rev=583928&r1=583927&r2=583928&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java Thu Oct 11 12:40:22 2007
@@ -413,7 +413,6 @@
*/
public void startComponent(Component component)
{
- component.attach();
if (component instanceof FormComponent)
{
((FormComponent)component).processInput();