use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class PageTreeMenuAction method addGroup.
private void addGroup(String code, Map<String, List<SelectItem>> mapping, List<List<SelectItem>> group) {
List<SelectItem> singleGroup = mapping.get(code);
if (null != singleGroup) {
BeanComparator comparator = new BeanComparator("value");
Collections.sort(singleGroup, comparator);
group.add(singleGroup);
}
}
use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class PageTreeMenuAction method getWidgetFlavoursMapping.
protected Map<String, List<SelectItem>> getWidgetFlavoursMapping(List<String> pluginCodes) {
Map<String, List<SelectItem>> mapping = new HashMap<String, List<SelectItem>>();
List<WidgetType> types = this.getWidgetTypeManager().getWidgetTypes();
for (int i = 0; i < types.size(); i++) {
WidgetType type = types.get(i);
String pluginCode = type.getPluginCode();
if (null != pluginCode && pluginCode.trim().length() > 0) {
// is a plugin's widgets
if (!pluginCodes.contains(pluginCode)) {
pluginCodes.add(pluginCode);
}
this.addFlavourWidgetType(pluginCode, type, mapping);
} else if (type.isUserType()) {
// is a user widgets
this.addFlavourWidgetType(USER_WIDGETS_CODE, type, mapping);
} else if (this.getStockWidgetCodes().contains(type.getCode())) {
this.addFlavourWidgetType(STOCK_WIDGETS_CODE, type, mapping);
} else {
this.addFlavourWidgetType(CUSTOM_WIDGETS_CODE, type, mapping);
}
}
Collections.sort(pluginCodes);
return mapping;
}
use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class PageTreeMenuAction method addFlavourWidgetType.
protected void addFlavourWidgetType(String mapCode, WidgetType type, Map<String, List<SelectItem>> mapping) {
List<SelectItem> widgetTypes = mapping.get(mapCode);
if (null == widgetTypes) {
widgetTypes = new ArrayList<SelectItem>();
mapping.put(mapCode, widgetTypes);
}
String title = super.getTitle(type.getCode(), type.getTitles());
SelectItem item = new SelectItem(type.getCode(), title, mapCode);
widgetTypes.add(item);
}
use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class AbstractPortalAction method getWidgetFlavoursMapping.
protected Map<String, List<SelectItem>> getWidgetFlavoursMapping(List<String> pluginCodes) {
Map<String, List<SelectItem>> mapping = new HashMap<String, List<SelectItem>>();
List<WidgetType> types = this.getWidgetTypeManager().getWidgetTypes();
for (int i = 0; i < types.size(); i++) {
WidgetType type = types.get(i);
String pluginCode = type.getPluginCode();
if (null != pluginCode && pluginCode.trim().length() > 0) {
// is a plugin's widgets
if (!pluginCodes.contains(pluginCode)) {
pluginCodes.add(pluginCode);
}
this.addFlavourWidgetType(pluginCode, type, mapping);
} else if (type.isUserType()) {
// is a user widgets
this.addFlavourWidgetType(USER_WIDGETS_CODE, type, mapping);
} else // is a core widgets
{
if (this.getStockWidgetCodes().contains(type.getCode())) {
this.addFlavourWidgetType(STOCK_WIDGETS_CODE, type, mapping);
} else {
this.addFlavourWidgetType(CUSTOM_WIDGETS_CODE, type, mapping);
}
}
}
Collections.sort(pluginCodes);
return mapping;
}
use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class EnumeratorMapAttribute method extractStaticItems.
private SelectItem[] extractStaticItems() {
List<SelectItem> items = new ArrayList<SelectItem>();
if (!StringUtils.isEmpty(this.getStaticItems())) {
String[] entries = this.getStaticItems().split(this.getCustomSeparator());
for (String entry : entries) {
if (!StringUtils.isEmpty(entry) && entry.contains(DEFAULT_KEY_VALUE_SEPARATOR)) {
String[] keyValue = entry.split(DEFAULT_KEY_VALUE_SEPARATOR);
if (keyValue.length == 2) {
items.add(new SelectItem(keyValue[0].trim(), keyValue[1].trim()));
}
}
}
}
BeanComparator c = new BeanComparator("value");
Collections.sort(items, c);
SelectItem[] array = new SelectItem[items.size()];
for (int i = 0; i < items.size(); i++) {
array[i] = items.get(i);
}
return array;
}
Aggregations