Package org.apache.empire.commons

Examples of org.apache.empire.commons.OptionEntry


    public void initOptions(HtmlSelectOneMenu input, TextResolver textResolver, Options options, boolean addEmpty, String nullText)
    {
        if (addEmpty)
        {   // Empty entry
            addSelectItem(input, textResolver, new OptionEntry("", nullText));
        }
        if (options!=null && options.size()>0)
        {   // Add options
            for (OptionEntry e : options)
            { // Option entries
View Full Code Here


   
    public void syncOptions(HtmlSelectOneMenu input, TextResolver textResolver, Options options, boolean hasEmpty, String nullText)
    {
        // Compare child-items with options
        Iterator<OptionEntry> ioe = options.iterator();
        OptionEntry oe =(ioe.hasNext() ? ioe.next() : null);
        List<UIComponent> childList = input.getChildren();
        Iterator<UIComponent> ico = childList.iterator();
        int lastIndex = 0;
        while (ico.hasNext())
        {
            lastIndex++;
            UIComponent co = ico.next();
            if (!(co instanceof UISelectItem))
                continue;
            UISelectItem si = (UISelectItem)co;
            Object ov = si.getItemValue();
            if (ObjectUtils.isEmpty(ov) && hasEmpty)
                continue;
            if (oe==null)
            {   // remove obsolete items
                lastIndex--;
                for (int index = childList.size()-1; index>=lastIndex; index--)
                    childList.remove(index);
                // done
                return;
            }   
            if (ObjectUtils.compareEqual(ov, oe.getValue()))
            {   // next
                oe =(ioe.hasNext() ? ioe.next() : null);
                continue;
            }   
            // Not equal - do a full reload
            input.getChildren().clear();
            if (hasEmpty)
                addSelectItem(input, textResolver, new OptionEntry("", nullText));
            for (OptionEntry e : options)
            {   // Option entries
                addSelectItem(input, textResolver, e);
            }
            // done
View Full Code Here

    }

    public Options getLanguages()
    {
        Options o = new Options();
        o.add(new OptionEntry(Locale.ENGLISH, Locale.ENGLISH.getDisplayLanguage()));
        o.add(new OptionEntry(Locale.GERMAN, Locale.GERMAN.getDisplayLanguage()));
        return o;
    }
View Full Code Here

    }

    public Options getLanguages()
    {
        Options o = new Options();
        o.add(new OptionEntry(Locale.ENGLISH, Locale.ENGLISH.getDisplayLanguage()));
        o.add(new OptionEntry(Locale.GERMAN, Locale.GERMAN.getDisplayLanguage()));
        return o;
    }
View Full Code Here

    }

    public Options getLanguages()
    {
        Options o = new Options();
        o.add(new OptionEntry(Locale.ENGLISH, Locale.ENGLISH.getDisplayLanguage()));
        o.add(new OptionEntry(Locale.GERMAN, Locale.GERMAN.getDisplayLanguage()));
        return o;
    }
View Full Code Here

    {
      Options opts = new Options();
      List<Department> _deps = context.getEmployeeServiceClient().getDepartments();
      for(Department d: _deps)
      {
        opts.add(new OptionEntry(d.getDepartmentId(),d.getName()));
      }
      return opts;
    }
View Full Code Here

    }

    public Options getLanguages()
    {
        Options o = new Options();
        o.add(new OptionEntry(Locale.ENGLISH, Locale.ENGLISH.getDisplayLanguage()));
        o.add(new OptionEntry(Locale.GERMAN, Locale.GERMAN.getDisplayLanguage()));
        return o;
    }
View Full Code Here

    {
      Options opts = new Options();
      List<Department> _deps = context.getEmployeeServiceClient().getDepartments();
      for(Department d: _deps)
      {
        opts.add(new OptionEntry(d.getDepartmentId(),d.getName()));
      }
      return opts;
    }
View Full Code Here

        // Options
        Options options = getOptionList();
        if (isAllowNull())
        { // Empty entry
            options = new Options(options);
            addSelectItem(input, textResolver, new OptionEntry("", getNullText()));
        }
        for (OptionEntry e : options)
        { // Option entries
            addSelectItem(input, textResolver, e);
        }
View Full Code Here

        Options options = ii.getOptions();
        if (ii.isRequired()==false)
        {   // Empty entry
            options = new Options(options);
            addSelectItem(input, ii, new OptionEntry("", getNullText(ii)));
        }
        if (options!=null && options.size()>0)
        {   // Add options
            for (OptionEntry e : options)
            { // Option entries
View Full Code Here

TOP

Related Classes of org.apache.empire.commons.OptionEntry

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.