@Override public String getContributionId(WidgetDefinition contrib) { return contrib.getName(); }
public LayoutDefinitionImpl(String name, Map<String, Map<String, Serializable>> properties, Map<String, String> templates, List<LayoutRowDefinition> rows, List<WidgetDefinition> widgetDefinitions) { super(); this.name = name; this.properties = properties; this.templates = templates; if (rows == null) { this.rows = new LayoutRowDefinition[0]; } else { this.rows = rows.toArray(new LayoutRowDefinition[0]); } this.widgets = new HashMap<String, WidgetDefinition>(); if (widgetDefinitions != null) { for (WidgetDefinition widgetDef : widgetDefinitions) { this.widgets.put(widgetDef.getName(), widgetDef); } } }
public LayoutDefinitionImpl(String name, String template, WidgetDefinition widgetDefinition) { super(); this.name = name; this.properties = null; this.templates = new HashMap<String, String>(); if (template != null) { this.templates.put(BuiltinModes.ANY, template); } this.widgets = new HashMap<String, WidgetDefinition>(); if (widgetDefinition != null) { this.widgets.put(widgetDefinition.getName(), widgetDefinition); this.rows = new LayoutRowDefinition[] { new LayoutRowDefinitionImpl(null, widgetDefinition.getName()) }; } else { this.rows = new LayoutRowDefinition[0]; } }
public void unregisterWidget(String category, WidgetDefinition widgetDef) { WidgetDefinitionRegistry reg = widgetsByCat.get(category); if (reg != null) { reg.removeContribution(widgetDef); log.info(String.format("Unregistered widget '%s' for category '%s' ", widgetDef.getName(), category)); } }
public void registerWidget(String category, WidgetDefinition widgetDef) { WidgetDefinitionRegistry reg = widgetsByCat.get(category); if (reg == null) { reg = new WidgetDefinitionRegistry(category); widgetsByCat.put(category, reg); } reg.addContribution(widgetDef); log.info(String.format("Registered widget '%s' for category '%s' ", widgetDef.getName(), category)); }
builder.append(widgetDef.getName()).append(";"); builder.append(widgetDef.getType()).append(";"); builder.append(widgetDef.getTypeCategory()).append(";");
@Override public WidgetDefinition getWidgetDefinition(WidgetDefinition widgetDef, LayoutConversionContext ctx) { String wType = widgetDef.getType(); String wName = widgetDef.getName(); if (getAcceptedWidgetNames().contains(wName) && isAccepted(wType)) { WidgetDefinition clone = getClonedWidget(widgetDef); // change select options on new widget WidgetSelectOption[] selectOptions = VocabularyHelper.getChainSelectVocabularySelectOptions( getParentDirectoryName(), getChildDirectoryName(), ctx.getLanguage()).toArray( new WidgetSelectOption[] {}); clone.setSelectOptions(selectOptions); return clone; } return widgetDef; } }
@Override public void write(WidgetDefinition entity, JsonGenerator jg) throws IOException { jg.writeStartObject(); jg.writeStringField("name", entity.getName()); jg.writeStringField("type", entity.getType()); String typeCategory = entity.getTypeCategory();