Package org.apache.ecs.html

Examples of org.apache.ecs.html.Select


        } catch ( Exception e ) {
            logger.error("Exception",  e);
            return new StringElement( "Can't use this provider: " + e.getMessage() );
        }
       
        Select select = new Select();
        select.setName( "topic" );

        //entry topics
        Entry[] topics = content.getChannel().getTopics().getEntry();
       
        //populate the select box
        for ( int i = 0; i < topics.length; ++i ) {
            String name = topics[i].getName();
            select.addElement( new Option( name ).addElement( name ) );
        }

       
        //fix me... this needs to be a SELECT box
        table.addElement( getRow( "Topic: ", select ) );
View Full Code Here


    public String getContent(RunData data, String name, String value, Map parms)
    {

        init(data);

        Select select = null;
        if ( layout.equalsIgnoreCase(LAYOUT_LIST) )
        {
            select = new Select(name, new Integer(size).intValue());
        } else
        {
            select = new Select(name);
        }

        if ( multiple )
        {
            select.setMultiple(multiple);
        }

        if ( items != null )
        {

            boolean sort = new Boolean((String)this.getParm(SORT, "false")).booleanValue();
            if ( sort )
            {
                Arrays.sort(items);
            }

            for ( int i=0; i < items.length; i++ )
            {
                Option option = new Option(items[i]).addElement(items[i]);
                if (multiple)
                {
                    option.setSelected(value.indexOf(items[i]) >= 0);
                }
                else
                {
                    option.setSelected(items[i].equalsIgnoreCase(value));
                }
                select.addElement(option);
            }
        }

        // If no items to display, do not display empty control
        boolean nullIfEmpty = new Boolean((String)this.getParm(NULL_IF_EMPTY, "false")).booleanValue();
        if ( this.items == null || (nullIfEmpty && items.length == 0) )
        {
            return null;
        }

        return select.toString();

    }
View Full Code Here

        } catch ( Exception e ) {
            logger.error("Exception",  e);
            return new StringElement( "Can't use this provider: " + e.getMessage() );
        }
       
        Select select = new Select();
        select.setName( "topic" );

        //entry topics
        Entry[] topics = content.getChannel().getTopics().getEntry();
       
        //populate the select box
        for ( int i = 0; i < topics.length; ++i ) {
            String name = topics[i].getName();
            select.addElement( new Option( name ).addElement( name ) );
        }

       
        //fix me... this needs to be a SELECT box
        table.addElement( getRow( "Topic: ", select ) );
View Full Code Here

    public String getContent(RunData data, String name, String value, Map parms)
    {

        init(data);

        Select select = null;
        if ( layout.equalsIgnoreCase(this.LAYOUT_LIST) )
        {
            select = new Select(name, new Integer(size).intValue());
        } else
        {
            select = new Select(name);
        }

        if ( multiple )
        {
            select.setMultiple(multiple);
        }

        if ( items != null )
        {

            boolean sort = new Boolean((String)this.getParm(this.SORT, "false")).booleanValue();
            if ( sort )
            {
                Arrays.sort(items);
            }

            for ( int i=0; i < items.length; i++ )
            {
                Option option = new Option(items[i]).addElement(items[i]);
                option.setSelected(items[i].equalsIgnoreCase(value));
                select.addElement(option);
            }
        }

        // If no items to display, do not display empty control
        boolean nullIfEmpty = new Boolean((String)this.getParm(this.NULL_IF_EMPTY, "false")).booleanValue();
        if ( this.items == null || (nullIfEmpty && items.length == 0) )
        {
            return null;
        }

        return select.toString();

    }
View Full Code Here

        } catch ( Exception e ) {
            Log.error( e );
            return new StringElement( "Can't use this provider: " + e.getMessage() );
        }
       
        Select select = new Select();
        select.setName( "topic" );

        //entry topics
        Entry[] topics = content.getChannel().getTopics().getEntry();
       
        //populate the select box
        for ( int i = 0; i < topics.length; ++i ) {
            String name = topics[i].getName();
            select.addElement( new Option( name ).addElement( name ) );
        }

       
        //fix me... this needs to be a SELECT box
        table.addElement( getRow( "Topic: ", select ) );
View Full Code Here

     * @return A select object with second options.
     */
    public static Select getSecondSelector(String name, Calendar now,
                                           int interval)
    {
        Select secondSelect = new Select().setName(name);

        for (int currentSecond = 0; currentSecond <= 59; currentSecond += interval)
        {
            Option o = new Option();
            o.addElement(nbrFmt.format(currentSecond));
            o.setValue(currentSecond);
            int nearestSecond =
                    ((now.get(Calendar.SECOND) / interval) * interval);

            if (nearestSecond == currentSecond)
            {
                o.setSelected(true);
            }
            secondSelect.addElement(o);
        }
        return (secondSelect);
    }
View Full Code Here

     * @return A select object with minute options.
     */
    public static Select getMinuteSelector(String name, Calendar now,
                                           int interval)
    {
        Select minuteSelect = new Select().setName(name);

        for (int curMinute = 0; curMinute <= 59; curMinute += interval)
        {
            Option o = new Option();
            o.addElement(nbrFmt.format(curMinute));
            o.setValue(curMinute);
            int nearestMinute =
                    ((now.get(Calendar.MINUTE)) / interval) * interval;

            if (nearestMinute == curMinute)
            {
                o.setSelected(true);
            }
            minuteSelect.addElement(o);
        }
        return (minuteSelect);
    }
View Full Code Here

     * @param format Time format.
     * @return A select object with all the hours.
     */
    public static Select getHourSelector(String name, Calendar now, int format)
    {
        Select hourSelect = new Select().setName(name);

        if (format == TWENTY_FOUR_HOUR)
        {
            for (int currentHour = 0; currentHour <= 23; currentHour++)
            {
                Option o = new Option();
                o.addElement(nbrFmt.format(currentHour));
                o.setValue(currentHour);
                if (now.get(Calendar.HOUR_OF_DAY) == currentHour)
                {
                    o.setSelected(true);
                }
                hourSelect.addElement(o);
            }
        }
        else
        {
            for (int curHour = 1; curHour <= 12; curHour++)
            {
                Option o = new Option();

                o.addElement(nbrFmt.format((long) curHour));
                o.setValue(curHour);
                if (now.get(Calendar.AM_PM) == Calendar.AM)
                {
                    if (((now.get(Calendar.HOUR_OF_DAY)) == 0) &&
                            (curHour == 12))
                    {
                        o.setSelected(true);
                    }
                    else
                    {
                        if (now.get(Calendar.HOUR_OF_DAY) == curHour)
                        {
                            o.setSelected(true);
                        }
                    }
                }
                else
                {
                    if (((now.get(Calendar.HOUR_OF_DAY)) == 12) &&
                            (curHour == 12))
                    {
                        o.setSelected(true);
                    }
                    else
                    {
                        if (now.get(Calendar.HOUR_OF_DAY) == curHour + 12)
                        {
                            o.setSelected(true);
                        }
                    }
                }
                hourSelect.addElement(o);
            }
        }
        return (hourSelect);
    }
View Full Code Here

     * @return A select object with am/pm.
     */
    public static Select getAMPMSelector(String name,
                                         Calendar now)
    {
        Select ampmSelect = new Select().setName(name);

        Option o = new Option();
        o.addElement("am");
        o.setValue(Calendar.AM);
        if (now.get(Calendar.AM_PM) == Calendar.AM)
        {
            o.setSelected(true);
        }
        ampmSelect.addElement(o);

        o = new Option();
        o.addElement("pm");
        o.setValue(Calendar.PM);
        if (now.get(Calendar.AM_PM) == Calendar.PM)
        {
            o.setSelected(true);
        }
        ampmSelect.addElement(o);

        return (ampmSelect);
    }
View Full Code Here

            this.useDate.setTime(new Date());
        }

        ConcreteElement secondSelect = null;

        Select ampmSelect = getAMPMSelector(selName + AMPM_SUFFIX, useDate);

        Select hourSelect = getHourSelector(selName + HOUR_SUFFIX,
                useDate, this.timeFormat);

        Select minuteSelect = getMinuteSelector(selName + MINUTE_SUFFIX,
                useDate, this.minuteInterval);

        if (this.showSeconds)
        {
            Select tmp = getSecondSelector(selName + SECOND_SUFFIX, useDate,
                    this.secondInterval);
            if (onChangeSet)
                tmp.setOnChange(onChange);
            secondSelect = tmp;
        }
        else
        {
            secondSelect = new Input(Input.hidden,
View Full Code Here

TOP

Related Classes of org.apache.ecs.html.Select

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.