Search in sources :

Example 1 with AfterRender

use of org.apache.tapestry5.annotations.AfterRender in project flowlogix by flowlogix.

the class SessionMonitor method afterRender.

@AfterRender
public void afterRender() {
    Link link = componentResources.createEventLink(eventName);
    String baseURI = link.toAbsoluteURI(request.isSecure());
    int index = baseURI.indexOf(":" + eventName);
    String defaultURIparameters = baseURI.substring(index + eventName.length() + 1);
    defaultURIparameters += "".equals(defaultURIparameters) ? "?" : "&";
    defaultURIparameters += KEEPALIVE_NAME + "=";
    baseURI = baseURI.substring(0, index + 1);
    JSONObject spec = new JSONObject();
    spec.put("contextPath", request.getContextPath());
    spec.put("baseURI", baseURI);
    spec.put("defaultURIparameters", defaultURIparameters);
    spec.put("keepAlive", keepAlive);
    spec.put("endOnClose", true);
    spec.put("idleCheckSeconds", idleCheck);
    spec.put("endedHandler", _endedHandler);
    jsSupport.addInitializerCall("sessionMonitor", spec);
}
Also used : JSONObject(org.apache.tapestry5.json.JSONObject) Link(org.apache.tapestry5.Link)

Example 2 with AfterRender

use of org.apache.tapestry5.annotations.AfterRender in project flowlogix by flowlogix.

the class PeriodicUpdater method afterRender.

@AfterRender
void afterRender() {
    final String id = zone.getClientId();
    Link link;
    if (context == null) {
        link = resources.createEventLink(event);
    } else {
        link = resources.createEventLink(event, context);
    }
    final JSONObject spec = new JSONObject();
    spec.put("period", period);
    spec.put("elementId", id);
    spec.put("uri", link.toAbsoluteURI());
    jsSupport.addInitializerCall("periodicUpdater", spec);
}
Also used : JSONObject(org.apache.tapestry5.json.JSONObject) Link(org.apache.tapestry5.Link) AfterRender(org.apache.tapestry5.annotations.AfterRender)

Example 3 with AfterRender

use of org.apache.tapestry5.annotations.AfterRender in project tapestry-5 by apache.

the class OverrideMixin method afterRender.

void afterRender(MarkupWriter writer) {
    final Element element = writer.getDocument().getElementById(clientElement.getClientId());
    element.element("span", "id", "overrideMixin").text(" [Override mixin]");
}
Also used : ClientElement(org.apache.tapestry5.ClientElement) Element(org.apache.tapestry5.dom.Element)

Example 4 with AfterRender

use of org.apache.tapestry5.annotations.AfterRender in project tapestry-5 by apache.

the class Autocomplete method afterRender.

@Import(stylesheet = "typeahead-bootstrap3.css")
void afterRender() {
    Link link = resources.createEventLink(EVENT_NAME, context);
    JSONObject spec = new JSONObject("id", field.getClientId(), "url", link.toString()).put("minChars", minChars).put("limit", maxSuggestions);
    jsSupport.require("t5/core/autocomplete").with(spec);
}
Also used : JSONObject(org.apache.tapestry5.json.JSONObject) Link(org.apache.tapestry5.http.Link)

Example 5 with AfterRender

use of org.apache.tapestry5.annotations.AfterRender in project tapestry-5 by apache.

the class AssetDemo method afterRender.

@Import(stylesheet = "context:css/via-import.css")
void afterRender() {
    javascriptSupport.importStylesheet(new StylesheetLink(ieOnly, new StylesheetOptions(null, "IE")));
    javascriptSupport.importJavaScriptLibrary(getAssetWithWrongChecksumUrl());
}
Also used : StylesheetLink(org.apache.tapestry5.services.javascript.StylesheetLink) StylesheetOptions(org.apache.tapestry5.services.javascript.StylesheetOptions) Import(org.apache.tapestry5.annotations.Import)

Aggregations

Element (org.apache.tapestry5.dom.Element)4 Link (org.apache.tapestry5.Link)3 AfterRender (org.apache.tapestry5.annotations.AfterRender)3 JSONObject (org.apache.tapestry5.json.JSONObject)3 ClientElement (org.apache.tapestry5.ClientElement)2 Link (org.apache.tapestry5.http.Link)2 ExternalPageLink (com.flowlogix.web.services.ExternalPageLink)1 Import (org.apache.tapestry5.annotations.Import)1 StylesheetLink (org.apache.tapestry5.services.javascript.StylesheetLink)1 StylesheetOptions (org.apache.tapestry5.services.javascript.StylesheetOptions)1