public static PropertyEditorCategory convertMapToCategory(Map<String, List<String>> map) { if (map != null && !map.keySet().isEmpty()) { String categoryName = map.keySet().iterator().next(); PropertyEditorCategory category = new PropertyEditorCategory(categoryName); List<String> fields = map.get(categoryName); for (String field : fields) { category.withField(new PropertyEditorFieldInfo(field, PropertyEditorType.TEXT)); } return category; } return null; } }
@Override public List<PropertyEditorFieldInfo> getFields() { return new ArrayList<PropertyEditorFieldInfo>(super.getFields()) { @Override public boolean remove(Object o) { if (o instanceof PropertyEditorFieldInfo) { final PropertyEditorFieldInfo info = (PropertyEditorFieldInfo) o; configContext.removeComponentProperty(info.getLabel()); } return super.remove(o); } }; } };
private PropertyEditorCategory generatedPropertyEditor() { PropertyEditorCategory category = new PropertyEditorCategory(CommonConstants.INSTANCE.TargetDivConfiguration()); final Map<String, String> parameters = configContext.getComponentProperties(); String selectedID = parameters.get(ID_PARAMETER); category.withField(new PropertyEditorFieldInfo(CommonConstants.INSTANCE.TargetDivPlaceHolder(), selectedID == null ? "" : selectedID, PropertyEditorType.TEXT) .withKey(configContext.hashCode() + ID_PARAMETER)); propertyEditor.addExpandedCategory(category.getName()); return category; }
private void createPropertiesEditorCategory() { category = new PropertyEditorCategory("Properties"); category.setIdEvent(id); for (Map.Entry<String, PropertyFormType> property : preference.getPropertiesTypes().entrySet()) { final String propertyName = property.getKey(); final PropertyEditorType propertyType = getPropertyEditorType(property.getValue()); final Object propertyValue = preference.get(propertyName); final PropertyEditorFieldInfo fieldInfo = createFieldInfo(propertyName, propertyType, propertyValue); category.withField(fieldInfo); } }
@Override public List<PropertyEditorCategory> getPropertyCategories(LayoutComponent layoutComponent) { Map<String, String> propertyMap = layoutComponent.getProperties(); List<PropertyEditorCategory> result = new ArrayList<>(); PropertyEditorCategory category = layoutCssHelper.createCategory(LayoutEditorCssHelper.CSS_CATEGORY_TEXT); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.TEXT_ALIGN)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.TEXT_DECORATION)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.COLOR)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.FONT_SIZE)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.FONT_WEIGHT)); result.add(category); return result; }
@Test public void sortFieldsByPriority() { PropertyEditorFieldInfo highPriority = new PropertyEditorFieldInfo("highPriority", PropertyEditorType.BOOLEAN).withPriority(1); PropertyEditorFieldInfo lowPriority = new PropertyEditorFieldInfo("lowPriority", PropertyEditorType.BOOLEAN).withPriority(10); PropertyEditorCategory category = new PropertyEditorCategory("cat1", 2) .withField(lowPriority) .withField(highPriority); PropertyEditorEvent event = new PropertyEditorEvent("event", category); assertEquals(highPriority, event.getSortedProperties().get(0).getFields().get(0)); assertEquals(lowPriority, event.getSortedProperties().get(0).getFields().get(1)); } }
public PropertyEditorCategory createCategory(String categoryCode) { String name = propertyCategoryMapI18n.get(categoryCode); return new PropertyEditorCategory(name); }
String selectedScreenId = parameters.get(PLACE_NAME_PARAMETER); category.withField(new PropertyEditorFieldInfo(CommonConstants.INSTANCE.PlaceName(), selectedScreenId == null ? "" : selectedScreenId, PropertyEditorType.COMBO) category.withField(new PropertyEditorFieldInfo(key, parameters.get(key), PropertyEditorType.TEXT) propertyEditor.setLastOpenAccordionGroupTitle(category.getName()); return category;
public PropertyEditorEvent(String idEvent, PropertyEditorCategory property) { checkNotNull("idEvent", idEvent); checkNotNull("property", property); property.setIdEvent(idEvent); this.properties.add(property); }
static PanelCollapse createPanelCollapse(final PropertyEditorWidget propertyEditorWidget, final PropertyEditorCategory category) { final PanelCollapse collapse = GWT.create(PanelCollapse.class); collapse.addShowHandler(showEvent -> propertyEditorWidget.addExpandedCategory(category.getName())); collapse.addHiddenHandler(hiddenEvent -> { hiddenEvent.stopPropagation(); propertyEditorWidget.collapseCategory(category.getName()); }); if (propertyEditorWidget.getExpandedCategories().contains(category.getName())) { collapse.setIn(true); } return collapse; }
@Override public List<PropertyEditorCategory> getPropertyCategories(LayoutComponent layoutComponent) { Map<String, String> propertyMap = layoutComponent.getProperties(); List<PropertyEditorCategory> result = new ArrayList<>(); PropertyEditorCategory category = layoutCssHelper.createCategory(LayoutEditorCssHelper.CSS_CATEGORY_TEXT); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.TEXT_ALIGN)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.TEXT_DECORATION)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.COLOR)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.FONT_SIZE)); category.withField(layoutCssHelper.createField(propertyMap, CssProperty.FONT_WEIGHT)); result.add(category); return result; }
@Test public void sortFieldsByPriority() { PropertyEditorFieldInfo highPriority = new PropertyEditorFieldInfo("highPriority", PropertyEditorType.BOOLEAN).withPriority(1); PropertyEditorFieldInfo lowPriority = new PropertyEditorFieldInfo("lowPriority", PropertyEditorType.BOOLEAN).withPriority(10); PropertyEditorCategory category = new PropertyEditorCategory("cat1", 2) .withField(lowPriority) .withField(highPriority); PropertyEditorEvent event = new PropertyEditorEvent("event", category); assertEquals(highPriority, event.getSortedProperties().get(0).getFields().get(0)); assertEquals(lowPriority, event.getSortedProperties().get(0).getFields().get(1)); } }
public PropertyEditorCategory createCategory(String categoryCode) { String name = propertyCategoryMapI18n.get(categoryCode); return new PropertyEditorCategory(name); }
private void createPropertiesEditorCategory() { category = new PropertyEditorCategory("Properties"); category.setIdEvent(id); for (Map.Entry<String, PropertyFormType> property : preference.getPropertiesTypes().entrySet()) { final String propertyName = property.getKey(); final PropertyEditorType propertyType = getPropertyEditorType(property.getValue()); final Object propertyValue = preference.get(propertyName); final PropertyEditorFieldInfo fieldInfo = createFieldInfo(propertyName, propertyType, propertyValue); category.withField(fieldInfo); } }
String selectedScreenId = parameters.get(PLACE_NAME_PARAMETER); category.withField(new PropertyEditorFieldInfo(CommonConstants.INSTANCE.PlaceName(), selectedScreenId == null ? "" : selectedScreenId, PropertyEditorType.COMBO) category.withField(new PropertyEditorFieldInfo(key, parameters.get(key), PropertyEditorType.TEXT) propertyEditor.setLastOpenAccordionGroupTitle(category.getName()); return category;
public PropertyEditorEvent(String idEvent, PropertyEditorCategory property) { checkNotNull("idEvent", idEvent); checkNotNull("property", property); property.setIdEvent(idEvent); this.properties.add(property); }
static PanelHeader createPanelHeader(final PropertyEditorCategory category, final PanelGroup propertyMenu, PanelCollapse panelCollapse) { final Heading heading = new Heading(HeadingSize.H4); final Anchor anchor = GWT.create(Anchor.class); anchor.setText(category.getName()); anchor.setDataToggle(Toggle.COLLAPSE); anchor.setDataParent(propertyMenu.getId()); anchor.setDataTargetWidget(panelCollapse); anchor.addStyleName("collapsed"); heading.add(anchor); final PanelHeader header = GWT.create(PanelHeader.class); header.add(heading); return header; }
public static PropertyEditorCategory convertMapToCategory(Map<String, List<String>> map) { if (map != null && !map.keySet().isEmpty()) { String categoryName = map.keySet().iterator().next(); PropertyEditorCategory category = new PropertyEditorCategory(categoryName); List<String> fields = map.get(categoryName); for (String field : fields) { category.withField(new PropertyEditorFieldInfo(field, PropertyEditorType.TEXT)); } return category; } return null; } }
public List<PropertyEditorCategory> getContainerPropertyCategories(Container container) { List<PropertyEditorCategory> result = new ArrayList<>(); PropertyEditorCategory category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL); category.withField(createField(container, CssProperty.WIDTH)); category.withField(createField(container, CssProperty.HEIGHT)); category.withField(createField(container, CssProperty.BACKGROUND_COLOR)); result.add(category); category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_MARGIN); category.withField(createField(container, CssProperty.MARGIN_TOP)); category.withField(createField(container, CssProperty.MARGIN_BOTTOM)); category.withField(createField(container, CssProperty.MARGIN_LEFT)); category.withField(createField(container, CssProperty.MARGIN_RIGHT)); result.add(category); category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PADDING); category.withField(createField(container, CssProperty.PADDING_TOP)); category.withField(createField(container, CssProperty.PADDING_BOTTOM)); category.withField(createField(container, CssProperty.PADDING_LEFT)); category.withField(createField(container, CssProperty.PADDING_RIGHT)); result.add(category); return result; }
@Override public void addCategory(DisplayerAttributeDef attributeDef) { String catName = attrMapI18n.get(attributeDef); category = new PropertyEditorCategory(catName); categories.add(category); }