Examples of ElementContainer


Examples of org.apache.ecs.ElementContainer

        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

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

Examples of org.apache.ecs.ElementContainer

                           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

Examples of org.apache.ecs.ElementContainer

        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

Examples of org.apache.ecs.ElementContainer

    /**
    */
    public ConcreteElement getContent( RunData rundata )
    {
        ElementContainer content = new ElementContainer();
        try
        {
            rundata = setParams( rundata );
            content.addElement( new Comment( "BEGIN TurbineScreenPortlet" ) );
            content.addElement( ScreenLoader.getInstance().eval( rundata, screen ) );
            content.addElement( new Comment( "END TurbineScreenPortlet" ) );
        }
        catch ( Exception e )
        {
            String message = "TurbineScreenPortlet: " + e.getMessage();
            logger.error( message, e );
            content.addElement( message );
        }
        return ( content );
    }
View Full Code Here

Examples of org.apache.ecs.ElementContainer

            rundata.getParameters().remove( RETRY_URL );
        }


       
        ElementContainer root = new ElementContainer();

        List urls = URLManager.list( URLManagerService.STATUS_BAD );
       
        root.addElement( "The following " +
                         urls.size() +
                         " URL(s) are considered bad: " );

        root.addElement( new BR() );
       
        root.addElement( "Click on a url to take it out of the list" +
                         " and retry it in when requested. " );

        root.addElement( new BR() );
       
        UL ul = new UL();
        //FIXME: the getReason() call has to be escaped from HTML markup, CR&LF
        DynamicURI uri = new DynamicURI( rundata );
       
        ParameterParser params = rundata.getParameters();
        uri.addQueryData( params );
       
        Iterator i = urls.iterator();
       
        while ( i.hasNext() ) {
            URLInfo info = URLManager.getInfo( (String)i.next() );
            /* It can happen that url is no longer in list while
               we are processing */
            if( info != null ) {
                uri.removeQueryData( RETRY_URL );
                uri.addQueryData(RETRY_URL, info.getURL());
                ul.addElement( new LI()
                    .addElement( new A(uri.toString() )
                        .addElement( info.getURL() ) )
                    .addElement( new B( info.getMessage() ) ) );
            }
        }
       
        root.addElement( ul );

        java.util.Hashtable rt = URLFetcher.getRealtimeURLs();

        root.addElement( "The following " +
                         rt.size() +
                         " URL(s) are being loaded: " );

        root.addElement( new BR() );
        ul = new UL();
       
        java.util.Enumeration en = rt.keys();
        while (en.hasMoreElements()) {
            String key = (String)en.nextElement();
            LI li = new LI().addElement( key )
                .addElement( " - by " );
            if (rt.get(key) != null )
                li.addElement( String.valueOf(((Vector)rt.get(key)).size()) )
                    .addElement( " threads." );
            ul.addElement( li );
        }
       
        root.addElement( ul );
       

       
        return root;
    }
View Full Code Here

Examples of org.apache.ecs.ElementContainer

     * @return ConcreteElement
     */   
    public ConcreteElement getContent( RunData rundata ) {

       
        ElementContainer ec = new ElementContainer();

        this.createCategory( ec, "Memory" );

        ec.addElement( this.getEntry( "Free Memory (K)",
                                      Long.toString( Runtime.getRuntime().freeMemory()/1024 ) ) );
        ec.addElement( this.getEntry( "Total Memory (K)",
                                      Long.toString( Runtime.getRuntime().totalMemory()/1024 ) ) );
       
        JetspeedThreadPoolService service =
            ( JetspeedThreadPoolService ) TurbineServices
            .getInstance()
            .getService( ThreadPoolService.SERVICE_NAME );
       
        this.createCategory( ec, "Thread Pool" );

        ec.addElement( this.getEntry( "Available threads: ",
                            service.getAvailableThreadCount() ) );
       
        ec.addElement( this.getEntry( "Total threads: ",
                            service.getThreadCount() ) );

        ec.addElement( this.getEntry( "Runnable queue length: ",
                            service.getQueueLength() ) );

        ec.addElement( this.getEntry( "Processed thread count: ",
                            service.getThreadProcessedCount() ) );

        this.createCategory( ec, "PortletRegistry" );

        ec.addElement( this.getEntry( "Number of entries: ",
                            Registry.get(Registry.PORTLET).getEntryCount() ) );

        this.createCategory( ec, "Resource Manager" );

        ec.addElement( this.getEntry( "Entries in Manager",
                                      URLManager.list( URLManagerService.STATUS_ANY ).size() ) );
        ec.addElement( this.getEntry( "Bad Entries",
                                      URLManager.list( URLManagerService.STATUS_BAD ).size() ) );
        ec.addElement( this.getEntry( "URLs Loading/Refreshing",
                                      URLFetcher.getRealtimeURLs().size() ) );

        this.createCategory( ec, "Global Memory Cache" );
        ec.addElement( this.getEntry( "Objects in Cache",
          GlobalCache.getNumberOfObjects()));

        return ec;
       
    }
View Full Code Here

Examples of org.apache.ecs.ElementContainer

    }
   
    private ConcreteElement getEntry( String title,
                                      String value ) {
       
        ElementContainer ec = new ElementContainer();
       
        ec.addElement( title );
        ec.addElement( " -> " );
        ec.addElement( value );
        ec.addElement( new BR() );
       
        return ec;
    }
View Full Code Here

Examples of org.apache.ecs.ElementContainer

        this.setTitle("Properties");
        this.setDescription("Jetspeed Properties");


        ElementContainer root = new ElementContainer();
        Table table = new Table().setWidth("100%");

        Iterator i = JetspeedResources.getKeys();

        root.addElement( new B( "Jetspeed properties: " ) );
       
        while ( i.hasNext() ) {
            String key = (String)i.next();
            try {
                Object value = JetspeedResources.getString(key);
                TR row = new TR();
                row.addElement( new TD().addElement( key ) );
               
                if (value == null) {
                    value = "";
                }
                row.addElement( new TD()
                    .addElement( new Input( "text",
                                            "nothing",
                                            value.toString() )
                        .setSize( INPUT_SIZE ) ) );
               
                table.addElement( row );
            } catch (Throwable t) {
               
            }
         
        }

        root.addElement( new Center( table ) );
       
        //wrap it in a basic form so Netscape is smart enough to render the
        //width.
        this.setContent( new Form( root ) );
View Full Code Here

Examples of org.apache.ecs.ElementContainer

    */
    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
TOP
Copyright © 2018 www.massapi.com. 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.