@Override public WidgetSelectOption clone() { WidgetSelectOptionImpl clone = new WidgetSelectOptionImpl(value, var, itemLabel, itemValue, itemDisabled, itemRendered); if (labels != null) { clone.setItemLabels(new HashMap<String, String>(labels)); } return clone; }
public WidgetSelectOption getWidgetSelectOption() { WidgetSelectOptionImpl res = new WidgetSelectOptionImpl(value, var, itemLabel, itemValue, itemDisabled, itemRendered); res.setItemLabels(itemLabels); return res; }
public static List<WidgetSelectOption> convertToSelectOptions(DocumentModelList entries, String schema, String directoryName, String lang) { List<WidgetSelectOption> res = new ArrayList<WidgetSelectOption>(); for (DocumentModel entry : entries) { String itemValue = entry.getId(); String itemLabel = itemValue; try { itemLabel = (String) entry.getProperty(schema, LABEL_PROPERTY_NAME); if (lang != null) { itemLabel = TranslationHelper.getTranslation(itemLabel, lang); } } catch (PropertyException e) { if (lang != null) { // try out l10n vocabulary structure itemLabel = (String) entry.getProperty(schema, LABEL_PROPERTY_NAME + "_" + lang); } } WidgetSelectOption selectOption = new WidgetSelectOptionImpl(itemLabel, itemValue); res.add(selectOption); } return res; }
itemLabel = TranslationHelper.getTranslation(itemLabel, lang); WidgetSelectOption selectOption = new WidgetSelectOptionImpl(itemLabel, itemValue); result.add(selectOption); WidgetSelectOption subSelectOption = new WidgetSelectOptionImpl(subItemCompleteLabel, subItemValue); result.add(subSelectOption);