Package org.apache.ecs

Examples of org.apache.ecs.ElementContainer


     * @exception Exception, a generic exception.
     */
    public ConcreteElement doBuild(RunData data)
            throws Exception
    {
        ElementContainer body = new ElementContainer();
        ElementContainer message = new ElementContainer();

        StringBuffer sb = new StringBuffer();
        sb.append("<b>There has been an error.</b>")
                .append("<p>")
                .append("- If you used the browser \"Back\" or \"Reload\"")
                .append(" buttons please use the navigation buttons we provide")
                .append(" within the screen.")
                .append("<p>")
                .append("Please click ");

        message.addElement(sb.toString());
        ParameterParser pp;
        pp = (ParameterParser) data.getUser().getTemp("prev_parameters");
        pp.remove("_session_access_counter");

        TurbineURI back = new TurbineURI(data,(String) data.getUser().getTemp("prev_screen"));
        back.addPathInfo(pp);
        message.addElement(new A().setHref(back.getRelativeLink()).addElement("here"));

        message.addElement(" to return the the screen you were working on.");

        body.addElement(message);
        return body;
    }
View Full Code Here


        if (onChangeSet)
        {
            monthSelect.setOnChange(onChange);
            yearSelect.setOnChange(onChange);
        }
        ElementContainer ec = new ElementContainer();
        // ec.addElement(new Comment("== BEGIN org.apache.turbine.util.DateSelector.ecsOutput() =="));
        ec.addElement(monthSelect);
        ec.addElement(daySelect);
        ec.addElement(yearSelect);
        // ec.addElement(new Comment("== END org.apache.turbine.util.DateSelector.ecsOutput() =="));
        return (ec);
    }
View Full Code Here

                           TurbineConstants.SCREEN_DEFAULT_DEFAULT,
                           TurbineConstants.ACTION_LOGOUT_DEFAULT,
                           true).getRelativeLink(),
            Form.POST).addElement(new Input("SUBMIT", "Logout", "Logout"));

        ElementContainer body = new ElementContainer()
                .addElement(new HR().setSize(1).setNoShade(true))
                .addElement(
                    new B().addElement(
                        new Font().setColor(HtmlColor.green).setSize(
                            2).addElement(
                            txt)))
                .addElement(form);

        if (DEBUG && data.getUser() != null)
        {
            TD perm = new TD().setVAlign(AlignType.TOP);
            TD temp = new TD().setVAlign(AlignType.TOP);

            perm.addElement("Perm values:").addElement(new BR());
            for (Iterator it = data.getUser().getPermStorage().keySet().iterator();
                 it.hasNext();)
            {
                String key = (String) it.next();
                String value = data.getUser().getPerm(key).toString();
                perm.addElement(key + "=" + value).addElement(new BR());
            }

            temp.addElement("Temp values:").addElement(new BR());
            for (Iterator it = data.getUser().getTempStorage().keySet().iterator();
                 it.hasNext();)
            {
                String key = (String) it.next();
                String value = data.getUser().getTemp(key).toString();
                temp.addElement(key + "=" + value).addElement(new BR());
            }

            body.addElement(new BR()).addElement(new BR()).addElement(
                new Table().setBorder(2).setCellPadding(10).addElement(
                    new TR().addElement(perm).addElement(temp)));
        }
        if (DEBUG)
        {
            // If there are GET/POST/PATH_INFO variables put them into
            // a <PRE></PRE> tag so that they can be displayed on the
            // page. This is of course only for example purposes.
            PRE pre = new PRE();
           
            for (Iterator it = data.getParameters().keySet().iterator();
                 it.hasNext();)
            {
                String key = (String) it.next();
                String[] values = data.getParameters().getStrings(key);
                if (values.length == 1)
                {
                    pre.addElement(key + " = " + values[0] + "\n");
                }
                else
                {
                    pre.addElement(key + " = ");
                    for (int i = 0; i < values.length; i++)
                    {
                        pre.addElement(values[i] + " ");
                    }
                    pre.addElement("\n");
                }
            }
            body
                .addElement(new B("Query/PathInfo Parameters"))
                .addElement(new BR())
                .addElement(pre);

            Table table2 = new Table().setBorder(0);
            Map varDebug = data.getDebugVariables();

            boolean hasValues2 = false;

            for (Iterator i = varDebug.keySet().iterator(); i.hasNext();)
            {
                String key = (String) i.next();
                String value = varDebug.get(key).toString();
                TR tr =
                    new TR().addElement(
                        new TD().addElement(new B(key))).addElement(
                        new TD().addElement(" = " + value));
                table2.addElement(tr);
                hasValues2 = true;
            }
            if (hasValues2)
            {
                body.addElement(new H4().addElement("Debugging Data:"));
                body.addElement(table2);
            }
        }

        if (DEBUG && data.getACL() != null)
        {
            // Print out user's permissions.
            PRE pre = new PRE();
            for (Iterator rs = data.getACL().getRoles().iterator();
                rs.hasNext();
                )
            {
                String roleName = ((Role) rs.next()).getName();
                pre.addElement(roleName + "\n");
            }
            body
                .addElement(new BR())
                .addElement(new B("ROLES"))
                .addElement(new BR())
                .addElement(pre);

            pre = new PRE();
            for (Iterator ps = data.getACL().getPermissions().iterator();
                ps.hasNext();
                )
            {
                String permissionName = ((Permission) ps.next()).getName();
                pre.addElement(permissionName + "\n");
            }
            body
                .addElement(new BR())
                .addElement(new B("PERMISSIONS"))
                .addElement(new BR())
                .addElement(pre);
        }
View Full Code Here

    public ConcreteElement getContent(RunData rundata)
    {
        Portlet portlet = getPortlet();
        if (portlet == null)
        {
            return new ElementContainer();
        }
       
        // Check to see if the portlet allows view
        // If the current security context disallows view,
        // do not display the portlet OR the control decorator
View Full Code Here

    /**
    Get the content for this PortletController
    */
    public ConcreteElement getContent( RunData rundata ) {

        ElementContainer base = new ElementContainer();

        try
        {
        PortletSet portlets = getPortlets();
        PortletConfig pc = portlets.getPortletConfig();

        // first get the number of columns and rows to display
        Enumeration en = portlets.getPortlets();
     
        //see if any or the Portlets you want to add have a larger column or
        //row number than that defined in PSML
        while ( en.hasMoreElements() ) {

            Portlet portlet = (Portlet)en.nextElement();

            calculateControllerLayout( portlet );
           
        }

        setWidth( pc.getLayout( "width", getWidth() ) );

        int rows = getRow();
        int cols = getColumn();

        if (0 == rows || 0 == cols)
            return base; // empty container

        Table t = new Table()
                       .setWidth( this.getWidth() )
                       .setCellPadding( this.getPadding() )
                       .setAlign("center");

        base.addElement( t );

        ElementContainer[][] elements = new ElementContainer[rows][cols];

        for( int i = 0; i < rows; i++ )  {
            for ( int j = 0 ; j < cols; j++ ) {
                elements[i][j]=new ElementContainer();
            }
        }

        // populate the elements array
        en = portlets.getPortlets();
View Full Code Here

     * Returns presentation control
     */
    public String getContent(RunData data, String name, String value, Map parms)
    {

        ElementContainer result = new ElementContainer();
        String items = (String)parms.get(ITEMS);
        String layout = (String)parms.get(LAYOUT);
        String prefix = (String)parms.get(PREFIX);
        if (prefix == null)
        {
            prefix = PREFIX_DEFAULT;
        }

        StringTokenizer st = new StringTokenizer(items, ",");
        Vector v = new Vector();
        while ( st.hasMoreTokens() )
        {
            String token = st.nextToken().trim();
            if ( !token.equalsIgnoreCase("") )
            {
                v.add(token);
            }
        }

        Table t = new Table();

        for ( Enumeration e = v.elements(); e.hasMoreElements(); )
        {
            String item = ((String)e.nextElement()).trim();
            Input cb = new Input(Input.CHECKBOX, prefix + item, item);
            cb.setChecked(value.indexOf(item) >= 0);
            cb.setOnClick(getJavascript(name, v, prefix));
            ElementContainer temp = new ElementContainer();
            temp.addElement(cb).addElement("&nbsp;").addElement(item);
            if ( layout.equalsIgnoreCase(LAYOUT_NS) )
            {
                t.addElement(new TR().addElement(new TD(temp)));
            } else
            {
View Full Code Here

     * Method returning HTML markup for a date list box
     */
    public String getContent(RunData data, String name, String value, Map parms)
    {

        ElementContainer container = new ElementContainer();

        if ( value.equals("$today") )
        {
            Date dt = new Date(System.currentTimeMillis());
            value = new SimpleDateFormat("M/d/yyyy").format(dt);
        }

        container.addElement(new Script().setLanguage("JavaScript").setSrc("javascript/PopupCalendar.js"));

        container.addElement(new Input(Input.TEXT, name, value));

        IMG img = new IMG("images/cal.gif").setAlt("Click here for popup calendar").setBorder(0);
        A a = new A(this.getJavaScript(name), img);

        container.addElement(a);

        return container.toString();
    }
View Full Code Here

    */
    public ConcreteElement getContent( RunData rundata ) {

        String myContent = null;

        ElementContainer content = new ElementContainer();
       
        // Strip all PIs and XML declaration from the input XML content URL
        try {

            ByteArrayOutputStream bos= new ByteArrayOutputStream();

            String url = JetspeedDiskCache.getInstance().getEntry( getPortletConfig().getURL() ).getURL();

            new SAXPIFilter(new PrintWriter(bos),true).print( url );
            myContent = bos.toString();

        } catch (Exception e) {

           
            logger.error( "Could not parse the following URL:  " + this.getPortletConfig().getURL(), e );
            return content;
        }

        // If parsing is OK, wraps content in ECS element
        if (myContent!=null) {
            content = new ElementContainer();

            content.addElement( new Comment( "BEGIN PORTLET" ) );
            content.addElement( new StringElement( myContent ) );
            content.addElement( new Comment( "END PORTLET" ) );
        }

        return content;
    }
View Full Code Here

            hourSelect.setOnChange(onChange);
            minuteSelect.setOnChange(onChange);
            ampmSelect.setOnChange(onChange);
        }

        ElementContainer ec = new ElementContainer();
        ec.addElement(new Comment(
            "== BEGIN org.apache.turbine.util.TimeSelector.ecsOutput() =="));
        ec.addElement(hourSelect);
        ec.addElement(":");
        ec.addElement(minuteSelect);
        if (this.showSeconds == true)
            ec.addElement(":");
        ec.addElement(secondSelect);
        if (this.timeFormat == this.TWELVE_HOUR)
        {
            ec.addElement(ampmSelect);
        }
        ec.addElement(new Comment(
            "== END org.apache.turbine.util.TimeSelector.ecsOutput() =="));
        return (ec);
    }
View Full Code Here

        if (onChangeSet)
        {
            monthSelect.setOnChange(onChange);
            yearSelect.setOnChange(onChange);
        }
        ElementContainer ec = new ElementContainer();
        // ec.addElement(new Comment("== BEGIN org.apache.turbine.util.DateSelector.ecsOutput() =="));
        ec.addElement(monthSelect);
        ec.addElement(daySelect);
        ec.addElement(yearSelect);
        // ec.addElement(new Comment("== END org.apache.turbine.util.DateSelector.ecsOutput() =="));
        return (ec);
    }
View Full Code Here

TOP

Related Classes of org.apache.ecs.ElementContainer

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.