Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // Copyright 2009, 2010 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
  // 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.tapestry5.corelib.components;
A component used to implement the progressive enhancement web design strategy; the component renders itself with a simplified initial content (i.e., "loading ...") and an Ajax request then supplies the component's true body. This results in much faster page loads. You can even nest these!

The component simply does not render its body on initial render. On the subsequent action event request, it fires a org.apache.tapestry5.EventConstants.PROGRESSIVE_DISPLAY event to inform the container about the (optional) event context. The event handler method may return a renderable object; if not then the component's body is rendered as the partial markup response.

 public class ProgressiveDisplay
The initial content to display until the real content arrives. Defaults to "Loading ..." and an Ajax activity icon.
     @Parameter(defaultPrefix = ., value = "block:defaultInitial")
     private Block initial;

If provided, this is the event context, which will be provided via the event.
     private Object[] context;
     private ComponentResources resources;
     private JavaScriptSupport jsSupport;
Name of a function on the client-side Tapestry.ElementEffect object that is invoked after the elements's body content has been updated. If not specified, then the basic "highlight" method is used, which performs a classic "yellow fade" to indicate to the user that and update has taken place.
     @Parameter(defaultPrefix = .)
     private String update;
     Block beginRender(MarkupWriter writer)
         String clientId = .allocateClientId();
         String elementName = .getElementName("div");
        Element e = writer.element(elementName"id"clientId);
        JSONObject spec = new JSONObject();
        if (InternalUtils.isNonBlank())
        return ;
    Object onAction(EventContext contextthrows IOException
        if (.isAborted())
            return null;
        return getBody();
    boolean beforeRenderBody()
        return false;
    void afterRender(MarkupWriter writer)

Returns the body of the ProgressiveDisplay, which is sometimes (in the context of a multi-zone update) the content to be included.

body of component
    public Block getBody()
        return .getBody();
New to GrepCode? Check out our FAQ X