Package javax.faces.component

Examples of javax.faces.component.UISelectItems


        UISelectOne uiSelectOne = new UISelectOne();
        uiSelectOne.setId("id1");
        uiSelectOne.setValueBinding("value", new ValueBindingImpl(_application,
                                                                  "#{bean.countryCode}"));

        UISelectItems uiSelectItems = new UISelectItems();
        uiSelectItems.setId("id2");
        uiSelectItems.setValueBinding("value", new ValueBindingImpl(_application,
                                                                  "#{bean.countrySelectItems}"));

        uiSelectOne.getChildren().add(uiSelectItems);

        List lst = RendererUtils.getSelectItemList(uiSelectOne);
View Full Code Here


          throw new IllegalArgumentException(String.format(ERROR_UNKNOWN_SELECT_TYPE, value.getClass().toString()));
        }

      } else if (child instanceof UISelectItems) {

        UISelectItems uiSelectItems = (UISelectItems) child;
        Object value = uiSelectItems.getValue();

        if (value instanceof SelectItem) {

          // A single SelectItem can be added directly without any further processing
          selectItems.add((SelectItem) value);
View Full Code Here

    if (LOG.isDebugEnabled()) {
      for (Iterator i = component.getChildren().iterator(); i.hasNext();) {
        Object o = i.next();
        LOG.debug("ITEMS " + o);
        if (o instanceof UISelectItems) {
          UISelectItems uiitems = (UISelectItems) o;
          Object v = uiitems.getValue();
          LOG.debug("VALUE " + v);
          if (v != null) {
            LOG.debug("VALUE " + v.getClass().getName());
          }
        }
View Full Code Here

        };
       
        List<SelectItem> items = new ArrayList<SelectItem>();
        items.add(new SelectItem("mars"));

        UISelectItems selectItems = new UISelectItems();
        selectItems.setValue(items);

        selectOneRadio.getChildren().add(selectItems);

        HtmlCheckAttributesUtil.checkRenderedAttributes(
                selectOneRadio, facesContext, writer, attrs);
View Full Code Here

        }

        // if this component is a SelectOne or SelectMany, take special action
        if (isMultiValue(componentType)) {
            // create a UISelectItems instance
            UISelectItems items = new UISelectItems();
            items.setValue(parseStringIntoArrayList(value, converter));
            // add it to the component
            component.getChildren().add(items);
        } else {
            // we have a single value
            if (null != converter) {
View Full Code Here

    item3.setValue(new SelectItem("Indianapolis"));
     
    UISelectItem item4 = new UISelectItem();
    item4.setValue(new SelectItem("New York"));
      
      UISelectItems items = new UISelectItems();
      items.setValueExpression("value",new MockValueExpression(selectItems));
     
      iselect.getChildren().add(items);
      iselect.getChildren().add(item1);
      iselect.getChildren().add(item2);
      iselect.getChildren().add(item3);
View Full Code Here

      iselect.getChildren().add(item1);
      iselect.getChildren().add(item2);
      iselect.getChildren().add(item3);
      iselect.getChildren().add(item4);
     
      UISelectItems items = new UISelectItems();
      items.setValue(selectItems);
      iselect.getChildren().add(items);
    iselect.setValue("New York");
     
    form.getChildren().add(iselect);
  }
View Full Code Here

        Map<String,String> selectItemMap = new LinkedHashMap<String,String>(2);
        selectItemMap.put("label", "value");
        selectItemMap.put("label2", "value2");

        // test arrays
        UISelectItems items = new UISelectItems();
        items.setValue(itemsArray);
        UISelectOne selectOne = new UISelectOne();
        selectOne.getChildren().add(items);
        Iterator iterator = RenderKitUtils.getSelectItems(getFacesContext(),
                                                          selectOne).iterator();
        assertTrue(item1.equals(iterator.next()));
        assertTrue(item2.equals(iterator.next()));

        items.setValue(itemsCollection);
        iterator = RenderKitUtils.getSelectItems(getFacesContext(),
                                                 selectOne).iterator();
        assertTrue(item1.equals(iterator.next()));
        assertTrue(item2.equals(iterator.next()));

        items.setValue(selectItemMap);
        iterator = RenderKitUtils.getSelectItems(getFacesContext(),
                                                 selectOne).iterator();
        SelectItem i = (SelectItem) iterator.next();
        assertTrue(item1.getLabel().equals(i.getLabel())
                    && item1.getValue().equals(i.getValue()));
View Full Code Here

        uiSelectOne.getAttributes().put("enabledClass", "enabledClass");
        uiSelectOne.getAttributes().put("disabledClass", "disabledClass");
        uiSelectOne.getAttributes().put("styleClass", "styleClass");
        uiSelectOne.getAttributes().put("tabindex", new Integer(5));
        uiSelectOne.getAttributes().put("title", "title");
        UISelectItems uiSelectItems = new UISelectItems();
        uiSelectOne.setId("radioRenderer");
        root.getChildren().add(uiSelectOne);

        SelectItem item1 = new SelectItem("One", "One", null);
        item1.setDisabled(true);
        SelectItem item2 = new SelectItem("Two", "Two", null);
        SelectItem item3 = new SelectItem("Three", "Three", null);

        SelectItem item4 = new SelectItem("Four", "Four", null);
        SelectItem item5 = new SelectItem("Five", "Five", null);
        SelectItem[] itemsArray = {item4, item5};
        SelectItemGroup itemGroup = new SelectItemGroup("group", null, true,
                                                        itemsArray);
        SelectItem[] items = {item1, item2, item3, itemGroup};
        uiSelectItems.setValue(items);
        uiSelectItems.setId("items");
        uiSelectOne.getChildren().add(uiSelectItems);

        UIParameter param = new UIParameter();
        param.setName("foo");
        param.setValue("foovalue");
View Full Code Here

   
    public void testSelectManyListboxRenderer(UIComponent root)
    throws IOException {
        System.out.println("Testing SelectManyListboxRenderer");
        UISelectMany selectMany = new UISelectMany();
        UISelectItems uiSelectItems = new UISelectItems();
        selectMany.setValue(null);
        selectMany.setId("myListbox");
        SelectItem item1 = new SelectItem("Red", "Red", null);
        SelectItem item2 = new SelectItem("Blue", "Blue", null);
       
        SelectItem item3 = new SelectItem("Green", "Green", null);
        SelectItem item4 = new SelectItem("Yellow", "Yellow", null);
        SelectItem[] itemsArray = {item3, item4};
        SelectItemGroup itemGroup = new SelectItemGroup("group", null, true,
                itemsArray);
        SelectItem[] selectItems = {item1, item2, itemGroup};
        Object selectedValues[] = null;
        uiSelectItems.setValue(selectItems);
        uiSelectItems.setId("manyListitems");
        selectMany.getChildren().add(uiSelectItems);
        root.getChildren().add(selectMany);
       
        ListboxRenderer selectManyListboxRenderer =
                new ListboxRenderer();
View Full Code Here

TOP

Related Classes of javax.faces.component.UISelectItems

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.