Package javax.faces.component.html

Examples of javax.faces.component.html.HtmlSelectOneMenu


    }
   
    @Override
    protected void createInputComponents(UIComponent parent, InputInfo ii, FacesContext context, List<UIComponent> compList)
    {
        HtmlSelectOneMenu input;
        if (compList.size()==0)
        {   try {
                input = inputComponentClass.newInstance();
            } catch (InstantiationException e1) {
                throw new InternalException(e1);
            } catch (IllegalAccessException e2) {
                throw new InternalException(e2);
            }
            // copy Attributes
            copyAttributes(parent, ii, input);
            // disabled
            boolean disabled = ii.isDisabled();
            input.setDisabled(disabled);
            // Options
            Options options = ii.getOptions();
            boolean hasEmpty =(!ii.isRequired() && !(disabled && ii.getColumn().isRequired()) && !options.contains(""));
            String nullText = (hasEmpty) ? getNullText(ii) : "";
            initOptions(input, ii.getTextResolver(), options, hasEmpty, nullText);
            // add
            compList.add(input);
        }
        else
        {   // check type
            UIComponent comp = compList.get(0);
            if (!(comp instanceof HtmlSelectOneMenu))
                throw new UnexpectedReturnValueException(comp.getClass().getName(), "compList.get");
            // cast
            input = (HtmlSelectOneMenu)comp;
            // disabled
            boolean disabled = ii.isDisabled();
            input.setDisabled(disabled);
            // Options (sync)
            Options options = ii.getOptions();
            boolean hasEmpty =(!ii.isRequired() && !(disabled && ii.getColumn().isRequired()) && !options.contains(""));
            String nullText = (hasEmpty) ? getNullText(ii) : "";
            syncOptions(input, ii.getTextResolver(), options, hasEmpty, nullText);
        }

        // style
        addRemoveDisabledStyle(input, input.isDisabled());
        addRemoveInvalidStyle(input, ii.hasError());
       
        // Set Value
        setInputValue(input, ii);
    }
View Full Code Here


    }

    private UIInput createSelectOneMenu(TextResolver textResolver)
    {
        SelectInputControl control = (SelectInputControl)InputControlManager.getControl(SelectInputControl.NAME);
        HtmlSelectOneMenu input = control.createMenuComponent(this);
        // css style
        String userStyle = StringUtils.toString(getAttributes().get("styleClass"));
        String cssStyle  = TagEncodingHelper.getTagStyleClass("eSelect", null, null, userStyle);
        input.setStyleClass(cssStyle);
        // other attributes
        copyAttributes(input);
        // Options
        Options options = getOptionList();
        boolean addEmpty = isAllowNull() && !options.contains("");
        control.initOptions(input, textResolver, options, addEmpty, getNullText());
        // disabled
        boolean disabled = isDisabled();
        input.setDisabled(disabled);
        control.addRemoveDisabledStyle(input, disabled);
        // input.setLabel(getLabelString());
        // input.setRequired(col.isRequired() && !col.isAutoGenerated());
        // input.setId(this.getId() + INPUT_SUFFIX);
        setInputValue(input);
View Full Code Here

    // </h:selectOneRadio>
    private static UIInput createInputForEnumProperty(PropertyDefinitionSimple propertyDefinitionSimple) {
        UISelectOne selectOne;
        if (propertyDefinitionSimple.getEnumeratedValues().size() >= LISTBOX_THRESHOLD_ENUM_SIZE) {
            // Use a drop down menu for larger enums...
            HtmlSelectOneMenu menu = FacesComponentUtility.createComponent(HtmlSelectOneMenu.class, null);

            // TODO: Use CSS to set the width of the menu.
            selectOne = menu;
        } else {
            // ...and a radio for smaller ones.
View Full Code Here

{
  if (!(component instanceof HtmlSelectOneMenu))
  {
    throw new IllegalArgumentException("Component " + component.getClass().getName() + " is no HtmlSelectOneMenu");
  }
  HtmlSelectOneMenu comp = (HtmlSelectOneMenu)component;

  super.setProperties(component);

  if (_onchange != null)
  {
    comp.setValueExpression("onchange", _onchange);
  }
  if (_lang != null)
  {
    comp.setValueExpression("lang", _lang);
  }
  if (_onselect != null)
  {
    comp.setValueExpression("onselect", _onselect);
  }
  if (_styleClass != null)
  {
    comp.setValueExpression("styleClass", _styleClass);
  }
  if (_tabindex != null)
  {
    comp.setValueExpression("tabindex", _tabindex);
  }
  if (_style != null)
  {
    comp.setValueExpression("style", _style);
  }
  if (_dir != null)
  {
    comp.setValueExpression("dir", _dir);
  }
  if (_onmouseover != null)
  {
    comp.setValueExpression("onmouseover", _onmouseover);
  }
  if (_onclick != null)
  {
    comp.setValueExpression("onclick", _onclick);
  }
  if (_accesskey != null)
  {
    comp.setValueExpression("accesskey", _accesskey);
  }
  if (_requiredMessage != null)
  {
    comp.setValueExpression("requiredMessage", _requiredMessage);
  }
  if (_disabled != null)
  {
    comp.setValueExpression("disabled", _disabled);
  }
  if (_onmouseout != null)
  {
    comp.setValueExpression("onmouseout", _onmouseout);
  }
  if (_immediate != null)
  {
    comp.setValueExpression("immediate", _immediate);
  }
  if (_enabledClass != null)
  {
    comp.setValueExpression("enabledClass", _enabledClass);
  }
  if (_validator != null)
  {
    comp.addValidator(new MethodExpressionValidator(_validator));
  }
  if (_onmouseup != null)
  {
    comp.setValueExpression("onmouseup", _onmouseup);
  }
  if (_onfocus != null)
  {
    comp.setValueExpression("onfocus", _onfocus);
  }
  if (_converter != null)
  {
    if (!_converter.isLiteralText())
    {
      comp.setValueExpression("converter", _converter);
    }
    else
    {
      String s = _converter.getExpressionString();
      if (s != null)
      {
        Converter converter = getFacesContext().getApplication().
          createConverter(s);
        comp.setConverter(converter);
      }
    }
  }
  if (_ondblclick != null)
  {
    comp.setValueExpression("ondblclick", _ondblclick);
  }
  if (_valueChangeListener != null)
  {
    comp.addValueChangeListener(new MethodExpressionValueChangeListener(_valueChangeListener));
  }
  if (_label != null)
  {
    comp.setValueExpression("label", _label);
  }
  if (_onkeyup != null)
  {
    comp.setValueExpression("onkeyup", _onkeyup);
  }
  if (_converterMessage != null)
  {
    comp.setValueExpression("converterMessage", _converterMessage);
  }
  if (_required != null)
  {
    comp.setValueExpression("required", _required);
  }
  if (_readonly != null)
  {
    comp.setValueExpression("readonly", _readonly);
  }
  if (_disabledClass != null)
  {
    comp.setValueExpression("disabledClass", _disabledClass);
  }
  if (_title != null)
  {
    comp.setValueExpression("title", _title);
  }
  if (_onmousedown != null)
  {
    comp.setValueExpression("onmousedown", _onmousedown);
  }
  if (_onkeypress != null)
  {
    comp.setValueExpression("onkeypress", _onkeypress);
  }
  if (_onblur != null)
  {
    comp.setValueExpression("onblur", _onblur);
  }
  if (_onmousemove != null)
  {
    comp.setValueExpression("onmousemove", _onmousemove);
  }
  if (_onkeydown != null)
  {
    comp.setValueExpression("onkeydown", _onkeydown);
  }
  if (_validatorMessage != null)
  {
    comp.setValueExpression("validatorMessage", _validatorMessage);
  }
  if (_value != null)
  {
    comp.setValueExpression("value", _value);
  }
}
View Full Code Here

    }

    private UIInput createSelectOneMenu(TextResolver textResolver)
    {
        SelectInputControl control = (SelectInputControl)InputControlManager.getControl(SelectInputControl.NAME);
        HtmlSelectOneMenu input = control.createMenuComponent(this);
        // css style
        String userStyle = StringUtils.toString(getAttributes().get("styleClass"));
        String cssStyle  = TagEncodingHelper.getTagStyleClass("eSelect", null, null, userStyle);
        input.setStyleClass(cssStyle);
        // other attributes
        copyAttributes(input);
        // Options
        Options options = getOptionList();
        boolean addEmpty = isAllowNull() && !options.contains("");
        control.initOptions(input, textResolver, options, addEmpty, getNullText());
        // disabled
        boolean disabled = isDisabled();
        input.setDisabled(disabled);
        control.addRemoveDisabledStyle(input, disabled);
        // input.setLabel(getLabelString());
        // input.setRequired(col.isRequired() && !col.isAutoGenerated());
        // input.setId(this.getId() + INPUT_SUFFIX);
        input.setValue(getValue());
        return input;
    }
View Full Code Here

{
  if (!(component instanceof HtmlSelectOneMenu))
  {
    throw new IllegalArgumentException("Component " + component.getClass().getName() + " is no HtmlSelectOneMenu");
  }
  HtmlSelectOneMenu comp = (HtmlSelectOneMenu)component;

  super.setProperties(component);

  if (_onmousemove != null)
  {
    comp.setValueExpression("onmousemove", _onmousemove);
  }
  if (_dir != null)
  {
    comp.setValueExpression("dir", _dir);
  }
  if (_onblur != null)
  {
    comp.setValueExpression("onblur", _onblur);
  }
  if (_valueChangeListener != null)
  {
    comp.addValueChangeListener(new MethodExpressionValueChangeListener(_valueChangeListener));
  }
  if (_onmouseover != null)
  {
    comp.setValueExpression("onmouseover", _onmouseover);
  }
  if (_required != null)
  {
    comp.setValueExpression("required", _required);
  }
  if (_onmousedown != null)
  {
    comp.setValueExpression("onmousedown", _onmousedown);
  }
  if (_requiredMessage != null)
  {
    comp.setValueExpression("requiredMessage", _requiredMessage);
  }
  if (_accesskey != null)
  {
    comp.setValueExpression("accesskey", _accesskey);
  }
  if (_onchange != null)
  {
    comp.setValueExpression("onchange", _onchange);
  }
  if (_readonly != null)
  {
    comp.setValueExpression("readonly", _readonly);
  }
  if (_ondblclick != null)
  {
    comp.setValueExpression("ondblclick", _ondblclick);
  }
  if (_onselect != null)
  {
    comp.setValueExpression("onselect", _onselect);
  }
  if (_converter != null)
  {
    if (!_converter.isLiteralText())
    {
      comp.setValueExpression("converter", _converter);
    }
    else
    {
      String s = _converter.getExpressionString();
      if (s != null)
      {
        Converter converter = getFacesContext().getApplication().
          createConverter(s);
        comp.setConverter(converter);
      }
    }
  }
  if (_immediate != null)
  {
    comp.setValueExpression("immediate", _immediate);
  }
  if (_onfocus != null)
  {
    comp.setValueExpression("onfocus", _onfocus);
  }
  if (_label != null)
  {
    comp.setValueExpression("label", _label);
  }
  if (_converterMessage != null)
  {
    comp.setValueExpression("converterMessage", _converterMessage);
  }
  if (_onkeypress != null)
  {
    comp.setValueExpression("onkeypress", _onkeypress);
  }
  if (_validator != null)
  {
    comp.addValidator(new MethodExpressionValidator(_validator));
  }
  if (_disabledClass != null)
  {
    comp.setValueExpression("disabledClass", _disabledClass);
  }
  if (_onclick != null)
  {
    comp.setValueExpression("onclick", _onclick);
  }
  if (_value != null)
  {
    comp.setValueExpression("value", _value);
  }
  if (_title != null)
  {
    comp.setValueExpression("title", _title);
  }
  if (_styleClass != null)
  {
    comp.setValueExpression("styleClass", _styleClass);
  }
  if (_onmouseup != null)
  {
    comp.setValueExpression("onmouseup", _onmouseup);
  }
  if (_onkeyup != null)
  {
    comp.setValueExpression("onkeyup", _onkeyup);
  }
  if (_disabled != null)
  {
    comp.setValueExpression("disabled", _disabled);
  }
  if (_onkeydown != null)
  {
    comp.setValueExpression("onkeydown", _onkeydown);
  }
  if (_onmouseout != null)
  {
    comp.setValueExpression("onmouseout", _onmouseout);
  }
  if (_lang != null)
  {
    comp.setValueExpression("lang", _lang);
  }
  if (_style != null)
  {
    comp.setValueExpression("style", _style);
  }
  if (_tabindex != null)
  {
    comp.setValueExpression("tabindex", _tabindex);
  }
  if (_enabledClass != null)
  {
    comp.setValueExpression("enabledClass", _enabledClass);
  }
  if (_validatorMessage != null)
  {
    comp.setValueExpression("validatorMessage", _validatorMessage);
  }
}
View Full Code Here

{
  if (!(component instanceof HtmlSelectOneMenu))
  {
    throw new IllegalArgumentException("Component " + component.getClass().getName() + " is no HtmlSelectOneMenu");
  }
  HtmlSelectOneMenu comp = (HtmlSelectOneMenu)component;

  super.setProperties(component);

  if (_onblur != null)
  {
    comp.setValueExpression("onblur", _onblur);
  }
  if (_immediate != null)
  {
    comp.setValueExpression("immediate", _immediate);
  }
  if (_disabledClass != null)
  {
    comp.setValueExpression("disabledClass", _disabledClass);
  }
  if (_styleClass != null)
  {
    comp.setValueExpression("styleClass", _styleClass);
  }
  if (_value != null)
  {
    comp.setValueExpression("value", _value);
  }
  if (_onkeypress != null)
  {
    comp.setValueExpression("onkeypress", _onkeypress);
  }
  if (_readonly != null)
  {
    comp.setValueExpression("readonly", _readonly);
  }
  if (_onmouseover != null)
  {
    comp.setValueExpression("onmouseover", _onmouseover);
  }
  if (_lang != null)
  {
    comp.setValueExpression("lang", _lang);
  }
  if (_validatorMessage != null)
  {
    comp.setValueExpression("validatorMessage", _validatorMessage);
  }
  if (_converterMessage != null)
  {
    comp.setValueExpression("converterMessage", _converterMessage);
  }
  if (_converter != null)
  {
    if (!_converter.isLiteralText())
    {
      comp.setValueExpression("converter", _converter);
    }
    else
    {
      String s = _converter.getExpressionString();
      if (s != null)
      {
        Converter converter = getFacesContext().getApplication().
          createConverter(s);
        comp.setConverter(converter);
      }
    }
  }
  if (_onmousemove != null)
  {
    comp.setValueExpression("onmousemove", _onmousemove);
  }
  if (_dir != null)
  {
    comp.setValueExpression("dir", _dir);
  }
  if (_required != null)
  {
    comp.setValueExpression("required", _required);
  }
  if (_label != null)
  {
    comp.setValueExpression("label", _label);
  }
  if (_style != null)
  {
    comp.setValueExpression("style", _style);
  }
  if (_title != null)
  {
    comp.setValueExpression("title", _title);
  }
  if (_onclick != null)
  {
    comp.setValueExpression("onclick", _onclick);
  }
  if (_enabledClass != null)
  {
    comp.setValueExpression("enabledClass", _enabledClass);
  }
  if (_onmouseup != null)
  {
    comp.setValueExpression("onmouseup", _onmouseup);
  }
  if (_onselect != null)
  {
    comp.setValueExpression("onselect", _onselect);
  }
  if (_ondblclick != null)
  {
    comp.setValueExpression("ondblclick", _ondblclick);
  }
  if (_validator != null)
  {
    comp.addValidator(new MethodExpressionValidator(_validator));
  }
  if (_onmousedown != null)
  {
    comp.setValueExpression("onmousedown", _onmousedown);
  }
  if (_requiredMessage != null)
  {
    comp.setValueExpression("requiredMessage", _requiredMessage);
  }
  if (_accesskey != null)
  {
    comp.setValueExpression("accesskey", _accesskey);
  }
  if (_onkeydown != null)
  {
    comp.setValueExpression("onkeydown", _onkeydown);
  }
  if (_onkeyup != null)
  {
    comp.setValueExpression("onkeyup", _onkeyup);
  }
  if (_onfocus != null)
  {
    comp.setValueExpression("onfocus", _onfocus);
  }
  if (_valueChangeListener != null)
  {
    comp.addValueChangeListener(new MethodExpressionValueChangeListener(_valueChangeListener));
  }
  if (_onmouseout != null)
  {
    comp.setValueExpression("onmouseout", _onmouseout);
  }
  if (_onchange != null)
  {
    comp.setValueExpression("onchange", _onchange);
  }
  if (_disabled != null)
  {
    comp.setValueExpression("disabled", _disabled);
  }
  if (_tabindex != null)
  {
    comp.setValueExpression("tabindex", _tabindex);
  }
}
View Full Code Here

    public void setUp() throws Exception
    {
        super.setUp();

        selectOneMenu = new HtmlSelectOneMenu();
        selectManyMenu = new HtmlSelectManyMenu();

        writer = new MockResponseWriter(new StringWriter(), null, null);
        facesContext.setResponseWriter(writer);
View Full Code Here


    @Override
    protected UIComponent createComponentToTest()
    {
        UIComponent component = new HtmlSelectOneMenu();
        UISelectItem item = new UISelectItem();
        item.setItemValue("value1");
        component.getChildren().add(item);
        return component;
    }
View Full Code Here


    @Override
    protected UIComponent createComponentToTest()
    {
        UIComponent component = new HtmlSelectOneMenu();
        UISelectItem item = new UISelectItem();
        item.setItemValue("value1");
        component.getChildren().add(item);
        return component;
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.html.HtmlSelectOneMenu

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.