String selectItemVal = getOptionAsString(context, component, component.getConverter(), selectItem.getValue()); if (selectItem.isDisabled()) { if (LangUtils.contains(submittedValues, selectItemVal) && !LangUtils.contains(oldValues, selectItemVal)) {
protected void encodeSelectItems(FacesContext context, SelectOneButton button, List<SelectItem> selectItems) throws IOException { int selectItemsSize = selectItems.size(); Converter converter = button.getConverter(); String name = button.getClientId(context); Object value = button.getSubmittedValue(); if (value == null) { value = button.getValue(); } Class type = value == null ? String.class : value.getClass(); for (int i = 0; i < selectItems.size(); i++) { SelectItem selectItem = selectItems.get(i); boolean disabled = selectItem.isDisabled() || button.isDisabled(); String id = name + UINamingContainer.getSeparatorChar(context) + i; boolean selected; if (value == null && selectItem.getValue() == null) { selected = true; } else { Object coercedItemValue = coerceToModelType(context, selectItem.getValue(), type); selected = (coercedItemValue != null) && coercedItemValue.equals(value); } encodeOption(context, button, selectItem, id, name, converter, selected, disabled, i, selectItemsSize); } }
protected void encodePageLayout(FacesContext context, SelectOneRadio radio, List<SelectItem> selectItems) throws IOException { ResponseWriter writer = context.getResponseWriter(); Converter converter = radio.getConverter(); String name = radio.getClientId(context); String currentValue = ComponentUtils.getValueToRender(context, radio); for (int i = 0; i < selectItems.size(); i++) { SelectItem selectItem = selectItems.get(i); boolean disabled = selectItem.isDisabled() || radio.isDisabled(); String id = name + UINamingContainer.getSeparatorChar(context) + i; boolean selected = isSelected(context, radio, selectItem, currentValue); writer.startElement("tr", null); writer.startElement("td", null); encodeOption(context, radio, selectItem, id, name, converter, selected, disabled); writer.endElement("td"); writer.endElement("tr"); } }
protected void encodeLineLayout(FacesContext context, SelectOneRadio radio, List<SelectItem> selectItems) throws IOException { ResponseWriter writer = context.getResponseWriter(); Converter converter = radio.getConverter(); String name = radio.getClientId(context); String currentValue = ComponentUtils.getValueToRender(context, radio); writer.startElement("tr", null); for (int i = 0; i < selectItems.size(); i++) { SelectItem selectItem = selectItems.get(i); boolean disabled = selectItem.isDisabled() || radio.isDisabled(); String id = name + UINamingContainer.getSeparatorChar(context) + i; boolean selected = isSelected(context, radio, selectItem, currentValue); writer.startElement("td", null); encodeOption(context, radio, selectItem, id, name, converter, selected, disabled); writer.endElement("td"); } writer.endElement("tr"); }
boolean disabled = selectItem.isDisabled() || radio.isDisabled(); String id = name + UINamingContainer.getSeparatorChar(context) + idx; boolean selected = isSelected(context, radio, selectItem, currentValue);
protected void encodeOption(FacesContext context, UIInput component, Object values, Object submittedValues, Converter converter, SelectItem option, int idx) throws IOException { ResponseWriter writer = context.getResponseWriter(); SelectManyCheckbox checkbox = (SelectManyCheckbox) component; String itemValueAsString = getOptionAsString(context, component, converter, option.getValue()); String name = checkbox.getClientId(context); String id = name + UINamingContainer.getSeparatorChar(context) + idx; boolean disabled = option.isDisabled() || checkbox.isDisabled(); Object valuesArray; Object itemValue; if (submittedValues != null) { valuesArray = submittedValues; itemValue = itemValueAsString; } else { valuesArray = values; itemValue = option.getValue(); } boolean selected = isSelected(context, component, itemValue, valuesArray, converter); if (option.isNoSelectionOption() && values != null && !selected) { return; } writer.startElement("div", null); writer.writeAttribute("class", HTML.CHECKBOX_CLASS, null); encodeOptionInput(context, checkbox, id, name, selected, disabled, itemValueAsString); encodeOptionOutput(context, checkbox, selected, disabled); writer.endElement("div"); encodeOptionLabel(context, checkbox, id, option, disabled); }
boolean disabled = selectItem.isDisabled() || radio.isDisabled(); String id = name + UINamingContainer.getSeparatorChar(context) + idx; boolean selected = isSelected(context, radio, selectItem, currentValue);
boolean disabled = option.isDisabled() || menu.isDisabled();
boolean disabled = option.isDisabled() || listbox.isDisabled();
boolean disabled = option.isDisabled(); boolean isEscape = option.isEscape();
boolean disabled = option.isDisabled() || listbox.isDisabled(); String itemClass = disabled ? SelectOneListbox.ITEM_CLASS + " ui-state-disabled" : SelectOneListbox.ITEM_CLASS;
String name = menu.getClientId(context); String id = name + UINamingContainer.getSeparatorChar(context) + idx; boolean disabled = option.isDisabled() || menu.isDisabled(); boolean escaped = option.isEscape(); String itemLabel = option.getLabel();
ResponseWriter writer = context.getResponseWriter(); String itemValueAsString = getOptionAsString(context, menu, converter, option.getValue()); boolean disabled = option.isDisabled() || menu.isDisabled(); String itemClass = disabled ? SelectManyMenu.ITEM_CLASS + " ui-state-disabled" : SelectManyMenu.ITEM_CLASS;
String name = button.getClientId(context); String id = name + UINamingContainer.getSeparatorChar(context) + idx; boolean disabled = option.isDisabled() || button.isDisabled(); String tabindex = button.getTabindex();
@Override public boolean isItemDisabled() { return getSelectItem().isDisabled(); } }
@Override public boolean isItemDisabled() { return getSelectItem().isDisabled(); } }
@Override public boolean isItemDisabled() { return getSelectItem().isDisabled(); } }
private Set<String> getDisabledSelectItemValues(FacesContext context, UIComponent component) { Set<String> disabledSelectItemValues = new HashSet<>(2); RenderKitUtils.getSelectItems(context, component).forEachRemaining(selectItem -> { if (selectItem.isDisabled()) { disabledSelectItemValues.add(getFormattedValue(context, component, selectItem.getValue())); } }); return disabledSelectItemValues; }
public String toScript() { return "{ \"id\" : " + ScriptUtils.toScript(clientId) + " , \"label\" : " + ScriptUtils.toScript(label) + ", \"value\" : " + ScriptUtils.toScript(convertedValue) + ", \"disabled\" : " + ScriptUtils.toScript(selectItem.isDisabled()) + "}"; }
private static SelectItem cloneSelectItem(SelectItem o) { SelectItem copy = new SelectItem(); String description = o.getDescription(); if (description != null) copy.setDescription(new String(description)); copy.setDisabled(o.isDisabled()); copy.setEscape(o.isEscape()); String label = o.getLabel(); if (label != null) copy.setLabel(new String(label)); copy.setNoSelectionOption(o.isNoSelectionOption()); copy.setValue(o.getValue()); return copy; } }