Hi All,

Yet another great contribution and also a great component to facniate me.
Thank you all for the effort done and for the tapestry team to create such a
dynamic framework :)

Now to the component. Here it is for fast reference:
(I removed the package declaration and the imports)

/**

 * Append a loader icon to wait for zone update completion.

 */

public class AjaxLoader {

/**

 * The class of the element that shows the ajax loader image

 */

@Parameter(value = "loading", defaultPrefix = BindingConstants.LITERAL)

private String loaderClass;


> /**

 * The element to render. The default is derived from the
> component template.

 */

@Parameter(defaultPrefix = BindingConstants.LITERAL)

private String element;


> /**

 * The zone to observe.

 */

@Parameter(required = true, allowNull = false, defaultPrefix =
> BindingConstants.LITERAL)

private String zone;


> /**

 * The id of the element that triggers the zone update.

 */

@Parameter(required = true, allowNull = false, defaultPrefix =
> BindingConstants.LITERAL)

private String trigger;


> @Inject

private JavaScriptSupport javascriptSupport;


> @Inject

private ComponentResources resources;


> private String loader;


> String defaultElement() {

return resources.getElementName("div");

}


> @BeginRender

void initAjaxLoader(MarkupWriter writer) {

loader = javascriptSupport.allocateClientId("loader");


> JSONObject data = new JSONObject();

data.put("zone", zone);

data.put("trigger", trigger);

data.put("loader", loader);

System.out.println(data);

javascriptSupport.addInitializerCall(InitializationPriority.LATE,
> "initAjaxLoader", data);

}


> @AfterRender

void writeAjaxLoader(MarkupWriter writer) {

writer.element(element, "id", loader, "class", this.loaderClass, "style",
> "display:none;");

writer.end();

}

}


* After porting this component to my application, I applied it to a link.
The image is shown and hidden well. But I found out that the method the link
calls, is being called many times. The JS console says what's supposed to
mean that the call stack exploded due to numerous method calls.
* I'm not sure If I fully understand the @Environmental annotation but
shouldn't JavaScriptSupport here be annotated as environmental ?
* About the "defaultElement()" method. After reading the documentation I
understood it's supposed to return the tag name of the component. In our
case it's "span", "div" is simply ignored.

a.who calls this method, when and why ?
b.why did we provide div ? In case the component exists solely without a
container ? Although I can't currently imagine if that's possible, may be it
is.


Thank you for your time :)
-- 
*Regards,*
*Muhammad Gelbana
Java Software Programmer*

Reply via email to