org.apache.wicket.extensions.ajax.markup.html
Class AjaxLazyLoadPanel

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.panel.Panel
                  extended by org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IConverterLocator, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public abstract class AjaxLazyLoadPanel
extends Panel

A panel where you can lazy load another panel. This can be used if you have a panel/component that is pretty heavy in creation and you first want to show the user the page and then replace the panel when it is ready.

Since:
1.3
Author:
jcompagner
See Also:
Serialized Form

Field Summary
static String LAZY_LOAD_COMPONENT_ID
          The component id which will be used to load the lazily loaded component.
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
AjaxLazyLoadPanel(String id)
          Constructor
AjaxLazyLoadPanel(String id, IModel<?> model)
          Constructor
 
Method Summary
abstract  Component getLazyLoadComponent(String markupId)
           
 Component getLoadingComponent(String markupId)
           
protected  void handleCallbackScript(IHeaderResponse response, CharSequence callbackScript, Component component)
          Allows subclasses to change the callback script if needed.
protected  void onBeforeRender()
          Called just before a component is rendered.
protected  void onComponentLoaded(Component target, AjaxRequestTarget component)
          Called when the placeholder component is replaced with the lazy loaded one.
protected  void updateAjaxAttributes(AjaxRequestAttributes attributes)
           
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest, getWebResponse, getWebSession
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LAZY_LOAD_COMPONENT_ID

public static final String LAZY_LOAD_COMPONENT_ID
The component id which will be used to load the lazily loaded component.

See Also:
Constant Field Values
Constructor Detail

AjaxLazyLoadPanel

public AjaxLazyLoadPanel(String id)
Constructor

Parameters:
id -

AjaxLazyLoadPanel

public AjaxLazyLoadPanel(String id,
                         IModel<?> model)
Constructor

Parameters:
id -
model -
Method Detail

updateAjaxAttributes

protected void updateAjaxAttributes(AjaxRequestAttributes attributes)

handleCallbackScript

protected void handleCallbackScript(IHeaderResponse response,
                                    CharSequence callbackScript,
                                    Component component)
Allows subclasses to change the callback script if needed.

Parameters:
response - the current response that writes to the header
callbackScript - the JavaScript to write in the header
component - the component which produced the callback script

onBeforeRender

protected void onBeforeRender()
Description copied from class: Component
Called just before a component is rendered.

NOTE: If you override this, you *must* call super.onBeforeRender() within your implementation. Because this method is responsible for cascading Component.onBeforeRender() call to its children it is strongly recommended that super call is made at the end of the override.

Overrides:
onBeforeRender in class Component
See Also:
Component.onBeforeRender()

getLazyLoadComponent

public abstract Component getLazyLoadComponent(String markupId)
Parameters:
markupId - The components markupid.
Returns:
The component that must be lazy created. You may call setRenderBodyOnly(true) on this component if you need the body only.

onComponentLoaded

protected void onComponentLoaded(Component target,
                                 AjaxRequestTarget component)
Called when the placeholder component is replaced with the lazy loaded one.

Parameters:
target - The Ajax request handler
component - The lazy loaded component.

getLoadingComponent

public Component getLoadingComponent(String markupId)
Parameters:
markupId - The components markupid.
Returns:
The component to show while the real component is being created.


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.