public void addAll(Collection itemsToAdd) { Iterator iter = itemsToAdd.iterator(); while (iter.hasNext()) { ChoiceItem choice = (ChoiceItem) iter.next(); String label = ZawgyiLabelUtilities.getDisplayableLabel(choice.getSpec(), localization); choice.setLabel(label); add(choice); } }
private FieldSpec[] asArray(Comparator sorter) { Collections.sort(allChoices, sorter); mergeSimilarDropdowns(); FieldSpec[] specs = new FieldSpec[allChoices.size()]; for (int i = 0; i < allChoices.size(); ++i) { ChoiceItem choice = (ChoiceItem) allChoices.get(i); specs[i] = choice.getSpec(); } return specs; }
public void onlyKeep(MiniFieldSpec[] allowedSpecs) { HashSet allowedSpecSet = new HashSet(); allowedSpecSet.addAll(Arrays.asList(allowedSpecs)); Vector newChoices = new Vector(); for (int i = 0; i < allChoices.size(); ++i) { ChoiceItem choice = (ChoiceItem) allChoices.get(i); MiniFieldSpec spec = new MiniFieldSpec(choice.getSpec()); spec.setLabel(fontHelper.getStorable(spec.getLabel())); spec.setTopLevelLabel(fontHelper.getStorable(spec.getTopLevelLabel())); if (isSpecInAllowed(spec, allowedSpecSet)) newChoices.add(choice); } allChoices = newChoices; }