Package org.apache.click

Examples of org.apache.click.Context


     *
     * @see Page#onInit()
     */
    public void onInit() {
        addModel("mode", getMode());
        Context context = getContext();
        if (getError() != null) {
            ErrorReport errorReport =
                new ErrorReport(error,
                                getPageClass(),
                                false,
                                context.getRequest(),
                                context.getServletContext());

            addModel("errorReport", errorReport);
        }
    }
View Full Code Here


     *
     * @param buffer the buffer to append the output to
     */
    protected void renderContent(HtmlStringBuffer buffer) {
        if (getTemplate() != null) {
            Context context = getContext();

            Map templateModel = getModel();
            if (templateModel == null) {
                templateModel = new HashMap();
            }
            buffer.append(context.renderTemplate(getTemplate(), templateModel));

        }

        if (getContent() != null) {
            buffer.append(getContent());
View Full Code Here

     *
     * @param buffer the buffer to render output to
     */
    public void render(HtmlStringBuffer buffer) {

        Context context = getContext();
        boolean isAjaxRequest = context.isAjaxRequest();

        // Render IE conditional comment if conditional comment was set
        renderConditionalCommentPrefix(buffer);

        buffer.elementStart(getTag());
View Full Code Here

     * @param href the new href attribute
     */
    public void setHref(String href) {
        if (href != null) {
            if (href.charAt(0) == '/') {
                Context context = getContext();
                String contextPath = context.getRequest().getContextPath();

                // Guard against adding duplicate context path
                if (!href.startsWith(contextPath + '/')) {
                    HtmlStringBuffer buffer =
                        new HtmlStringBuffer(contextPath.length() + href.length());
View Full Code Here

            // Include the prototype.js library which is made available under
            // the web folder "/click/prototype/"
            headElements.add(new JsImport("/click/prototype/prototype.js"));

            Context context = getContext();

            // Create a model to pass to the Page JavaScript template. The
            // template recognizes the following Velocity variables:
            // $context, $path, $selector and $target
            Map model = ClickUtils.createTemplateModel(this, context);

            // Set path to the AjaxCustomer Page path
            model.put("path", context.getPagePath(AjaxCustomer.class));

            // Add a CSS selector, in this case the customerSelect ID attribute
            model.put("selector", customerSelect.getId());

            // Add the ID of a target element in the Page template to replace
View Full Code Here

            // Add the JQuery library to the Page
            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));

            // Add a JQuery template which adds a 'click' listener to the link
            // that will show/hide the field
            Context context = getContext();

            // Create a template model and pass in the linkId
            Map jsModel = ClickUtils.createTemplateModel(this, context);
            jsModel.put("linkId", '#' + link.getId());

            String content =
                context.renderTemplate("/general/page-head-demo.js", jsModel);

            headElements.add(new JsScript(content));
        }
        return headElements;
    }
View Full Code Here

            // Include the prototype.js library which is made available under
            // the web folder "/click/prototype/"
            headElements.add(new JsImport("/click/prototype/prototype.js"));

            Context context = getContext();

            // Create a model to pass to the Page JavaScript template. The
            // template recognizes the following Velocity variables:
            // $context, $path, $selector and $target
            Map model = ClickUtils.createTemplateModel(this, context);

            // Set path to the AjaxCustomer Page path
            model.put("path", context.getPagePath(AjaxCustomer.class));

            // Add a CSS selector, in this case the customerSelect ID attribute
            model.put("selector", customerSelect.getId());

            // Add the ID of a target element in the Page template to replace
View Full Code Here

     * representation to
     */
    protected void renderCalendarButton(HtmlStringBuffer buffer) {

        if (!isReadonly() && !isDisabled()) {
            Context context = getContext();
            buffer.append("<img align=\"top\" ");
            buffer.append("style=\"cursor:hand\" src=\"");
            buffer.append(context.getRequest().getContextPath());
            buffer.append("/click/calendar/calendar");
            buffer.append(ClickUtils.getResourceVersionIndicator(context));
            buffer.append(".gif\"");
            String id = getId();
            if (id != null) {
View Full Code Here

     * @see org.apache.click.Control#getHtmlImports()
     *
     * @return the HTML head import statements for the control
     */
    public String getHtmlImports() {
        Context context = getContext();
        HtmlStringBuffer buffer = new HtmlStringBuffer(256);
        if (isJavascriptEnabled()) {
            buffer.append(ClickUtils.createHtmlImport(JAVASCRIPT_IMPORTS,
                context));
            if (javascriptPolicy == JAVASCRIPT_COOKIE_POLICY) {
View Full Code Here

     * <p/>
     * <b>Note</b> Tree only stores a value in the Session when JavaScript
     * is enabled and set to {@link #JAVASCRIPT_SESSION_POLICY}.
     */
    public void cleanupSession() {
        Context context = getContext();
        if (context.hasSession()) {
            context.getSession().removeAttribute(SessionHandler.JS_HANDLER_SESSION_KEY);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.click.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.