Package org.apache.click.util

Examples of org.apache.click.util.HtmlStringBuffer


            shutdownException = e;
        } finally {

            if (directory.exists()) {
                System.err.println("=======================================================================");
                HtmlStringBuffer buffer = new HtmlStringBuffer();
                buffer.append("    WARNING: could not delete all files ");
                buffer.append("in the temporary directory: '");
                buffer.append(directory.getAbsolutePath());
                buffer.append("'.\n");
                buffer.append("    This can occur (especially on a Windows OS) when some of the files in the ");
                buffer.append("directory are locked by another process. ");
                buffer.append("You can delete this directory manually.");
                System.err.println(buffer.toString());
                System.err.println("=======================================================================\n");
                if (shutdownException != null) {
                    shutdownException.printStackTrace(System.err);
                }
View Full Code Here


    protected void log(int level, String message, Throwable error) {
        if (level < logLevel) {
            return;
        }

        HtmlStringBuffer buffer = new HtmlStringBuffer();

        buffer.append("[");
        buffer.append(name);
        buffer.append("]");

        buffer.append(LEVELS[level + 1]);
        buffer.append(message);

        if (error != null) {
            System.out.print(buffer.toString());
            error.printStackTrace(System.out);
        } else {
            System.out.println(buffer.toString());
        }
    }
View Full Code Here

                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());

                    // Append the context path
                    buffer.append(contextPath);
                    buffer.append(href);
                    href = buffer.toString();
                }
            }
        }
        setAttribute("href", href);
    }
View Full Code Here

     * Return an HTML representation of the wizard steps as an Html List <ul>.
     * The current step is assigned a special CSS class so it can be highlighted
     * through CSS.
     */
    private String getHeading() {
        HtmlStringBuffer buffer = new HtmlStringBuffer();
        buffer.append("<ul id=\"steps\">");
        for (Step step : steps) {
            buffer.elementStart("li");
            if (step == currentStep) {
                buffer.appendAttribute("class", "current");
            }
            buffer.closeTag();
            buffer.append(step.getDescription());
            buffer.elementStart("span");
            buffer.closeTag();
            buffer.append(step.getLabel());
            buffer.elementEnd("span");
            buffer.elementEnd("li");
        }
        buffer.append("</ul>");
        return buffer.toString();
    }
View Full Code Here

        // Render action controls based on users permission
        actionColumn.setDecorator(new Decorator() {
            public String render(Object object, Context context) {
                JobAndSimpleTrigger jobAndTrigger = (JobAndSimpleTrigger) object;

                HtmlStringBuffer buffer = new HtmlStringBuffer();

                editLink.setParameter("job.name", jobAndTrigger.getJob().getName());
                editLink.render(buffer);

                buffer.append(" | ");
                deleteLink.setValue(jobAndTrigger.getJob().getName());
                deleteLink.render(buffer);

                if (!getSchedulerService().isPaused()) {

                    if (jobAndTrigger.getTriggerState() == Trigger.STATE_PAUSED) {
                        buffer.append(" | ");
                        resumeLink.setValue(jobAndTrigger.getJob().getName());
                        resumeLink.render(buffer);

                    } else {
                        buffer.append(" | ");
                        pauseLink.setValue(jobAndTrigger.getJob().getName());
                        pauseLink.render(buffer);
                    }

                    buffer.append(" | ");
                    triggerLink.setValue(jobAndTrigger.getJob().getName());
                    triggerLink.render(buffer);

                    if (jobAndTrigger.getTriggerState() == Trigger.STATE_BLOCKED) {
                        buffer.append(" | ");
                        interruptLink.setValue(jobAndTrigger.getJob().getName());
                        interruptLink.render(buffer);
                    }
                }

                return buffer.toString();
            }

        });
        actionColumn.setSortable(false);
        table.addColumn(actionColumn);
View Full Code Here

        }

        BufferedReader reader =
            new BufferedReader(new InputStreamReader(inputStream));

        HtmlStringBuffer buffer = new HtmlStringBuffer();

        // Filter out the license from displaying
        skipLicense(reader, buffer);

        String line = reader.readLine();

        while (line != null) {
            buffer.append(getEncodedLine(line));
            buffer.append("\n");
            line = reader.readLine();
        }

        addModel("source", buffer.toString());

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

     * The string will print all attributes of the session.
     *
     * @return string representation of the session
     */
    public String toString() {
        HtmlStringBuffer buffer = new HtmlStringBuffer();
        buffer.append("Session attributes {");
        for (Enumeration en = getAttributeNames(); en.hasMoreElements();) {
            String name = (String) en.nextElement();
            Object value = getAttribute(name);
            buffer.append(name);
            buffer.append("=");
            buffer.append(value);
            if (en.hasMoreElements()) {
                buffer.append(", ");
            }
        }
        buffer.append("}");
        return buffer.toString();
    }
View Full Code Here

        }

        long startTime = System.currentTimeMillis();

        if (logger.isDebugEnabled()) {
            HtmlStringBuffer buffer = new HtmlStringBuffer(200);
            buffer.append(request.getMethod());
            if (ServletFileUpload.isMultipartContent(request)) {
                buffer.append(" (multipart) ");
            } else {
                buffer.append(" ");
            }
            buffer.append(request.getRequestURL());
            logger.debug(buffer);
        }

        // Handle click page requests
        Page page = null;
View Full Code Here

        }

        configService.getTemplateService().renderTemplate(page, model, writer);

        if (!configService.isProductionMode()) {
            HtmlStringBuffer buffer = new HtmlStringBuffer(50);
            if (logger.isTraceEnabled()) {
                buffer.append("   ");
            }
            buffer.append("renderTemplate: ");
            if (!page.getTemplate().equals(page.getPath())) {
                buffer.append(page.getPath());
                buffer.append(",");
            }
            buffer.append(page.getTemplate());
            buffer.append(" - ");
            buffer.append(System.currentTimeMillis() - startTime);
            buffer.append(" ms");
            logger.info(buffer);
        }
    }
View Full Code Here

        }

        dispatcher.forward(request, response);

        if (!configService.isProductionMode()) {
            HtmlStringBuffer buffer = new HtmlStringBuffer(50);
            buffer.append("renderJSP: ");
            if (!page.getTemplate().equals(page.getForward())) {
                buffer.append(page.getTemplate());
                buffer.append(",");
            }
            buffer.append(page.getForward());
            buffer.append(" - ");
            buffer.append(System.currentTimeMillis() - startTime);
            buffer.append(" ms");
            logger.info(buffer);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.click.util.HtmlStringBuffer

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.