Search in sources :

Example 1 with SetupRender

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

the class RenderableProvider method setup.

@SetupRender
void setup() {
    Renderable r = new Renderable() {

        public void render(MarkupWriter writer) {
            writer.element("strong");
            writer.write("A message provided by the RenderableProvider component.");
            writer.end();
        }
    };
    environment.push(Renderable.class, r);
}
Also used : Renderable(org.apache.tapestry5.Renderable) MarkupWriter(org.apache.tapestry5.MarkupWriter) SetupRender(org.apache.tapestry5.annotations.SetupRender)

Example 2 with SetupRender

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

the class ImportWorker method processClassAnnotationAtSetupRenderPhase.

private void processClassAnnotationAtSetupRenderPhase(PlasticClass componentClass, MutableComponentModel model) {
    Import annotation = componentClass.getAnnotation(Import.class);
    if (annotation != null) {
        PlasticMethod setupRender = componentClass.introduceMethod(TransformConstants.SETUP_RENDER_DESCRIPTION);
        decorateMethod(componentClass, model, setupRender, annotation);
        model.addRenderPhase(SetupRender.class);
    }
}
Also used : Import(org.apache.tapestry5.annotations.Import)

Example 3 with SetupRender

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

the class ExceptionDisplay method setupRender.

void setupRender() {
    ExceptionAnalysis analysis = analyzer.analyze(exception);
    stack = analysis.getExceptionInfos();
}
Also used : ExceptionAnalysis(org.apache.tapestry5.ioc.services.ExceptionAnalysis)

Example 4 with SetupRender

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

the class GridRows method setupRender.

void setupRender() {
    GridDataSource dataSource = gridModel.getDataSource();
    int numberOfRowsRequiredToShowCurrentPage = 1 + (currentPage - 1) * rowsPerPage;
    int numberOfRowsRequiredToFillCurrentPage = currentPage * rowsPerPage;
    int availableRowsWithLimit = dataSource.getAvailableRows(numberOfRowsRequiredToFillCurrentPage);
    if (numberOfRowsRequiredToShowCurrentPage > availableRowsWithLimit) {
        int maxPages = ((availableRowsWithLimit - 1) / rowsPerPage) + 1;
        currentPage = maxPages;
    }
    startRow = (currentPage - 1) * rowsPerPage;
    endRow = Math.min(availableRowsWithLimit - 1, startRow + rowsPerPage - 1);
    dataRowIndex = startRow;
    boolean recordingStateInsideForm = !volatileState && formSupport != null;
    recordStateByIndex = recordingStateInsideForm && (encoder == null);
    recordStateByEncoder = recordingStateInsideForm && (encoder != null);
}
Also used : GridDataSource(org.apache.tapestry5.grid.GridDataSource)

Example 5 with SetupRender

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

the class AjaxFormLoop method setupRender.

void setupRender(MarkupWriter writer) {
    pushContext();
    iterator = source == null ? Collections.EMPTY_LIST.iterator() : source.iterator();
    Link removeRowLink = resources.createEventLink("triggerRemoveRow", context);
    Link injectRowLink = resources.createEventLink("injectRow", context);
    injectRowLink.addParameter(RequestConstants.FORM_CLIENTID_PARAMETER, formSupport.getClientId());
    injectRowLink.addParameter(RequestConstants.FORM_COMPONENTID_PARAMETER, formSupport.getFormComponentId());
    // Fix for TAP5-227 - AjaxFormLoop dont work well inside a table tag
    Element element = writer.getElement();
    this.wrapper = element.getAttribute("data-container-type") != null || element.getAttribute("data-remove-row-url") != null || element.getAttribute("data-inject-row-url") != null ? writer.element("div") : null;
    writer.attributes("data-container-type", "core/AjaxFormLoop", "data-remove-row-url", removeRowLink, "data-inject-row-url", injectRowLink);
}
Also used : Element(org.apache.tapestry5.dom.Element) Link(org.apache.tapestry5.http.Link)

Aggregations

MarkupWriter (org.apache.tapestry5.MarkupWriter)1 Renderable (org.apache.tapestry5.Renderable)1 Import (org.apache.tapestry5.annotations.Import)1 SetupRender (org.apache.tapestry5.annotations.SetupRender)1 Element (org.apache.tapestry5.dom.Element)1 GridDataSource (org.apache.tapestry5.grid.GridDataSource)1 Link (org.apache.tapestry5.http.Link)1 ExceptionAnalysis (org.apache.tapestry5.ioc.services.ExceptionAnalysis)1