Package javax.faces.component

Examples of javax.faces.component.UISelectOne$ArrayIterator


        .getAttributes().get("annotatedAttributes"));
  }

  public void encodeChildren(FacesContext facesContext, UIComponent component)
      throws IOException {   
    UISelectOne selectOne = (UISelectOne) component;
    Iterator children = selectOne.getChildren().iterator();
    while(children.hasNext()){
      UIComponent child = (UIComponent) children.next();
      if( (child instanceof UISelectItem) || (child instanceof UISelectItems)){
        renderUISelectItem(facesContext, selectOne, child);       
      }
View Full Code Here


          values.add(selectedValues[i]);
        }
      }
    }
    else{
      UISelectOne selectOne = (UISelectOne) component;     
      values.add(selectOne.getValue());
    }
   
    encodeListHeads(context,component);
    encodeListCols(context,component);   
   
View Full Code Here

  public void encodeChildren(FacesContext context, UIComponent component)
      throws IOException {
        
    ResponseWriter responseWriter = context.getResponseWriter();
    UISelectOne selectOne = (UISelectOne) component;
       
    Object object = selectOne.getValue();
    responseWriter.startElement("menupopup",null);
    Iterator iterator = getSelectItems(context,selectOne);
    while(iterator.hasNext()){
      SelectItem selectItem = (SelectItem) iterator.next();
      responseWriter.startElement("menuitem",null);     
View Full Code Here

    /**
     * The aim of this test is to check first part of {@link SelectUtils#getSelectItems}, for {@link UISelectOne}
     */
    public void testGetSelectItem() {
        UISelectOne selectOne = new UISelectOne();
        selectOne.getChildren().add(new UISelectItemStub("value1", "label1", "description1", false, false, false));
        selectOne.getChildren().add(new UISelectItemStub("value2", "label2", "description2", false, true, true));

        UISelectItem item = new UISelectItem();
        item.setValue(new SelectItem("value3", "label3", "description3", true, true, true));
        selectOne.getChildren().add(item);

        // non select item at end
        UIParameter param = new UIParameter();
        param.setName("param");
        param.setValue("paramValue");
        selectOne.getChildren().add(param);

        checkSelectItems(asList(SelectUtils.getSelectItems(facesContext, selectOne)));

        // non select item in middle
        selectOne = new UISelectOne();
        selectOne.getChildren().add(new UISelectItemStub("value1", "label1", "description1", false, false, false));
        selectOne.getChildren().add(param);
        selectOne.getChildren().add(new UISelectItemStub("value2", "label2", "description2", false, true, true));
        checkTwoSelectItems(asList(SelectUtils.getSelectItems(facesContext, selectOne)));

        // non select item as value cause IllegalArgumentException
        item = new UISelectItem();
        item.setValue(new UISelectItem());
        selectOne.getChildren().add(item);
        try {
            SelectUtils.getSelectItems(facesContext, selectOne);
        } catch (Exception e) {
            if (!(e instanceof IllegalArgumentException)) {
                Assert.fail("Non select item as value should cause IllegalArgumentException");
View Full Code Here

  private void addSelectOne(StringBuilder sb, String var, FacesContext facesContext, List<String> accKeyFunctions,
      UICommand command, String onclick) throws IOException {
    List<SelectItem> items;
    LabelWithAccessKey label = new LabelWithAccessKey(command);

    UISelectOne radio = (UISelectOne) command.getFacet(FACET_ITEMS);
    if (radio == null) {
      items = ComponentUtil.getSelectItems(command);
      radio = ComponentUtil.createUIMenuSelectOneFacet(facesContext, command);
      radio.setId(facesContext.getViewRoot().createUniqueId());
    } else {
      items = ComponentUtil.getSelectItems(radio);
    }

    Object value = radio.getValue();

    boolean markFirst = !ComponentUtil.hasSelectedValue(items, value);
    String radioId = radio.getClientId(facesContext);
    String onClickPrefix = "menuSetRadioValue('" + radioId + "', '";
    String onClickPostfix = onclick != null ? "') ; " + onclick : "";
    for (SelectItem item : items) {
      final String labelText = item.getLabel();
      label.reset();
View Full Code Here

    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
    {
        org.apache.myfaces.shared_impl.renderkit.RendererUtils.checkParamValidity(facesContext, uiComponent, UISelectOne.class);

        UISelectOne selectOne = (UISelectOne)uiComponent;

        String layout = getLayout(selectOne);

        boolean pageDirectionLayout = false; // Defaults to LINE_DIRECTION
        if (layout != null)
        {
            if (layout.equals(PAGE_DIRECTION))
            {
                pageDirectionLayout = true;
            }
            else if (layout.equals(LINE_DIRECTION))
            {
                pageDirectionLayout = false;
            }
            else
            {
                log.severe("Wrong layout attribute for component " + selectOne.getClientId(facesContext) + ": " + layout);
            }
        }

        ResponseWriter writer = facesContext.getResponseWriter();
View Full Code Here

        // TODO : Check here for getSubmittedValue. Look at RendererUtils.getValue
        // this is useless object creation
//        Object itemValue = selectItem.getValue();

        UISelectOne selectOne = (UISelectOne)uiComponent;

        if (isSelectItemGroup)
        {
            if (pageDirectionLayout)
                writer.startElement(HTML.TR_ELEM, selectOne);
View Full Code Here

            if (lookupSet == null)
            {
                lookupSet = RendererUtils.getSelectedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
            }
        } else {
            UISelectOne uiSelectOne = (UISelectOne) uiComponent;
            Object lookup = uiSelectOne.getSubmittedValue();
            if (lookup == null)
            {
                lookup = uiSelectOne.getValue();
                String lookupString = RendererUtils.getConvertedStringValue(facesContext, uiComponent, converter, lookup);
                lookupSet = Collections.singleton(lookupString);
            }
            else if(STR_EMPTY.equals(lookup))
            {
View Full Code Here

    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
    {
        RendererUtils.checkParamValidity(facesContext, uiComponent, UISelectOne.class);

        UISelectOne selectOne = (UISelectOne)uiComponent;

        String layout = getLayout(selectOne);

        boolean pageDirectionLayout = false; // Defaults to LINE_DIRECTION
        if (layout != null)
        {
            if (layout.equals(PAGE_DIRECTION))
            {
                pageDirectionLayout = true;
            }
            else if (layout.equals(LINE_DIRECTION))
            {
                pageDirectionLayout = false;
            }
            else
            {
                log.error("Wrong layout attribute for component " + selectOne.getClientId(facesContext) + ": " + layout);
            }
        }

        ResponseWriter writer = facesContext.getResponseWriter();
View Full Code Here

      // TODO : Check here for getSubmittedValue. Look at RendererUtils.getValue
      // this is useless object creation
//      Object itemValue = selectItem.getValue();

      UISelectOne selectOne = (UISelectOne)uiComponent;

        if (isSelectItemGroup) {
          if (pageDirectionLayout)
                writer.startElement(HTML.TR_ELEM, selectOne);

          writer.startElement(HTML.TD_ELEM, selectOne);
          writer.write(selectItem.getLabel());
          writer.endElement(HTML.TD_ELEM);

          if (pageDirectionLayout) {
            writer.endElement(HTML.TR_ELEM);
            writer.startElement(HTML.TR_ELEM, selectOne);
          }
          writer.startElement(HTML.TD_ELEM, selectOne);

          writer.startElement(HTML.TABLE_ELEM, selectOne);
          writer.writeAttribute(HTML.BORDER_ATTR, "0", null);

          SelectItemGroup group = (SelectItemGroup) selectItem;
          SelectItem[] selectItems = group.getSelectItems();

          for (int i=0; i<selectItems.length; i++) {
            renderGroupOrItemRadio(facesContext, selectOne, selectItems[i], currentValue, converter, pageDirectionLayout);
          }

          writer.endElement(HTML.TD_ELEM);
          writer.endElement(HTML.TR_ELEM);
          writer.endElement(HTML.TABLE_ELEM);
          writer.endElement(HTML.TD_ELEM);

          if (pageDirectionLayout)
                writer.endElement(HTML.TR_ELEM);

        } else {

        writer.write("\t\t");
        if (pageDirectionLayout)
            writer.startElement(HTML.TR_ELEM, selectOne);
        writer.startElement(HTML.TD_ELEM, selectOne);
        writer.startElement(HTML.LABEL_ELEM, selectOne);

        String itemStrValue = RendererUtils.getConvertedStringValue(facesContext, selectOne, converter, selectItem.getValue());
        boolean itemDisabled = selectItem.isDisabled();

        boolean itemChecked = itemStrValue.equals(currentValue);

        String labelClass = null;
        boolean componentDisabled = isDisabled(facesContext, selectOne);

        if (componentDisabled || itemDisabled) {
            labelClass = (String) selectOne.getAttributes().get(JSFAttr.DISABLED_CLASS_ATTR);
        } else {
            labelClass = (String) selectOne.getAttributes().get(JSFAttr.ENABLED_CLASS_ATTR);
        }
        if (labelClass != null) {
            writer.writeAttribute("class", labelClass, "labelClass");
        }
View Full Code Here

TOP

Related Classes of javax.faces.component.UISelectOne$ArrayIterator

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.