Package javax.faces.component

Examples of javax.faces.component.UISelectItems


        };
       
        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


    }

    protected void setProperties(UIComponent component) {
        super.setProperties(component);

        UISelectItems selectItems;
        try {
            selectItems = (UISelectItems) component;
        } catch (ClassCastException cce) {
            throw new FacesException("Tag <" + getClass().getName() + "> expected UISelectItems. " +
                                     "Got <" + component.getClass().getName() + ">");
        }

        if (value != null) {
            if (FacesUtils.isExpression(value)) {
                selectItems.setValueBinding("value", createValueBinding(value));
            } else {
                selectItems.setValue(value);
            }
        }
    }
View Full Code Here

                                            UIComponent component,
                                            String componentType,
                                            String value, String valueType) {
        Application application = context.getApplication();
        Converter converter = null;
        UISelectItems items = null;

        // if we need a converter, and can have a converter
        if (!valueType.equals("java.lang.String") &&
            component instanceof ValueHolder) {
            // if so create it,
            try {
                converter =
                    application.createConverter(CarStore.loadClass(valueType,
                                                                   this));
            } catch (ClassNotFoundException cne) {
                FacesMessage errMsg = MessageFactory.getMessage(
                    CONVERTER_ERROR_MESSAGE_ID,
                    (new Object[]{valueType}));
                throw new IllegalStateException(errMsg.getSummary());
            }
            // add it to our component,
            ((ValueHolder) component).setConverter(converter);
        }

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

    }

    protected void setProperties(UIComponent component) {
        super.setProperties(component);

        UISelectItems selectItems;
        try {
            selectItems = (UISelectItems) component;
        } catch (ClassCastException cce) {
            throw new FacesException("Tag <" + getClass().getName() + "> expected UISelectItems. " +
                                     "Got <" + component.getClass().getName() + ">");
        }

        if (value != null) {
            if (FacesUtils.isExpression(value)) {
                selectItems.setValueBinding("value", createValueBinding(value));
            } else {
                selectItems.setValue(value);
            }
        }
    }
View Full Code Here

                                      ui.isNoSelectionOption());
            }
            updateSingeItemIterator(item);
            items = singleItemIterator;
        } else if (kid instanceof UISelectItems) {
            UISelectItems ui = (UISelectItems) kid;
            Object value = ui.getValue();
            if (value != null) {
                if (value instanceof SelectItem) {
                    updateSingeItemIterator((SelectItem) value);
                    items = singleItemIterator;
                } else if (value.getClass().isArray()) {
View Full Code Here

                        ui.isNoSelectionOption());
            }
            updateSingeItemIterator(item);
            items = singleItemIterator;
        } else if (kid instanceof UISelectItems) {
            UISelectItems ui = (UISelectItems) kid;
            Object value = ui.getValue();
            if (value != null) {
                if (value instanceof SelectItem) {
                    updateSingeItemIterator((SelectItem) value);
                    items = singleItemIterator;
                } else if (value.getClass().isArray()) {
View Full Code Here

    if (LOG.isDebugEnabled()) {
      for (Object o : component.getChildren()) {
        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

      )
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
      Application application = facesContext.getApplication();
     
      UISelectItems selectItems = (UISelectItems) application.createComponent(UISelectItems.COMPONENT_TYPE);
     
      selectItems.setId("selectItems_" + displayValue)
      selectItems.setTransient(true);
     
      selectItems.setValueExpression("value", (ValueExpression) Utils.resolveExpression(bindingValue))
     
      return selectItems;
     
    }
View Full Code Here

    @Override
    public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String rawValue) {
        Corporation result = null;
        if (uiComponent instanceof HtmlSelectOneMenu) {
            HtmlSelectOneMenu menu = (HtmlSelectOneMenu) uiComponent;
            UISelectItems items = (UISelectItems) menu.getChildren().get(0);
            List obj = (List) items.getValue();
            for (Iterator it = obj.iterator(); it.hasNext();) {
                Corporation corpo = (Corporation) it.next();
                if (corpo.getId().equals(Long.valueOf(rawValue))) {
                    result = corpo;
                    break;
View Full Code Here

    assertThat(item.getLabel(), is(value));
  }

  @Test
  public void shouldBuildFromUISelectItemsWithItemValue() throws Exception {
    UISelectItems selectItems = setupUISelectItems("a");
    selectItems.getAttributes().put("itemValue", "b");
    SelectItem item = getSingleSelectItems();
    assertThat(item.getValue(), is((Object) "b"));
    assertThat(item.getLabel(), is("b"));
  }
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.