public static UIComponent resolveListMember(View view, UIBasicListMember torendero) { UIComponent parent = view.getComponent(torendero.parentFullID); UIBoundList boundlist = parent instanceof UISelect? ((UISelect) parent).optionnames : (UIBoundList)parent; String[] valuelist = boundlist.getValue(); // Reference off the end of an array is not an error - it may be being dynamically expanded String value = torendero.choiceindex < valuelist.length ? valuelist[torendero.choiceindex] : ""; String submittingname = boundlist.submittingname; UIBoundString togo = new UIBoundString(); togo.setValue(value); if (torendero.willinput) { togo.submittingname = submittingname; togo.willinput = true; } return togo; }
/** Creates a selection control without a value binding, either * non-submitting, or suitable for use in a GET form */ public static UISelect make(UIContainer tofill, String ID, String[] values, String[] labels, String value, boolean willinput) { UISelect togo = new UISelect(); togo.optionlist = new UIOutputMany(); togo.ID = ID; togo.optionlist.setValue(values); togo.optionnames = new UIBoundList(); togo.optionnames.setValue(labels); togo.selection = new UIBoundString(); if (value != null) { ((UIBoundString) togo.selection).setValue(value); } togo.selection.willinput = willinput; tofill.addComponent(togo); RSFUtil.updateChildIDs(togo); return togo; }
public static StringSet computeSelectionSet(UIBound selection) { StringSet togo = new StringSet(); if (selection instanceof UIBoundList) { togo.addAll(((UIBoundList) selection).getValue()); } else if (selection instanceof UIBoundString) { togo.add(((UIBoundString) selection).getValue()); } return togo; }
if (ishtmlselect) { pos.print(">\n"); String[] values = select.optionlist.getValue(); String[] names = select.optionnames == null ? values : select.optionnames.getValue(); String[] groups = select.groupnames == null? null : select.groupnames.getValue(); String lastgroup = ""; for (int i = 0; i < values.length; ++i) { UISelectChoice torender = (UISelectChoice) torendero; UISelect parent = (UISelect) view.getComponent(torender.parentFullID); String value = parent.optionlist.getValue()[torender.choiceindex];