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<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; }
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<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; }
@Override public void addBooleanProperty(DisplayerAttributeDef attributeDef, boolean value) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, Boolean.toString(value), BOOLEAN) .withKey(attributeDef.getFullId())); }
@Override public void addBooleanProperty(DisplayerAttributeDef attributeDef, boolean value) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, Boolean.toString(value), BOOLEAN) .withKey(attributeDef.getFullId())); }
@Override public void addColorProperty(DisplayerAttributeDef attributeDef, String color) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, color, COLOR) .withKey(attributeDef.getFullId())); }
@Override public void addColorProperty(DisplayerAttributeDef attributeDef, String color) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, color, COLOR) .withKey(attributeDef.getFullId())); }
@Override public void addListProperty(DisplayerAttributeDef attributeDef, List<String> optionList, String selectedValue) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, selectedValue, COMBO) .withComboValues(optionList) .withKey(attributeDef.getFullId())); }
@Override public void addTextProperty(String propId, String propName, String value, PropertyFieldValidator... validators) { category.withField(new PropertyEditorFieldInfo(propName, value, TEXT) .withValidators(validators) .withKey(propId)); }
@Override public void addTextProperty(DisplayerAttributeDef attributeDef, String value, PropertyFieldValidator... validators) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, value, TEXT) .withValidators(validators) .withKey(attributeDef.getFullId())); }
@Override public void addTextProperty(DisplayerAttributeDef attributeDef, String value, PropertyFieldValidator... validators) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, value, TEXT) .withValidators(validators) .withKey(attributeDef.getFullId())); }
@Override public void addTextProperty(String propId, String propName, String value, PropertyFieldValidator... validators) { category.withField(new PropertyEditorFieldInfo(propName, value, TEXT) .withValidators(validators) .withKey(propId)); }
@Override public void addListProperty(DisplayerAttributeDef attributeDef, List<String> optionList, String selectedValue) { String propName = attrMapI18n.get(attributeDef); category.withField(new PropertyEditorFieldInfo(propName, selectedValue, COMBO) .withComboValues(optionList) .withKey(attributeDef.getFullId())); }
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); } }
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); } }
private void extractFieldInformationAndValues(Class targetClass, PropertyEditorCategory beanCategory, Object instance) throws ErrorReadingFieldInformationAndValues { for (Field declaredField : targetClass.getDeclaredFields()) { PropertyEditorType type = PropertyEditorType.getFromType(declaredField.getType()); if (isAHandledType(type)) { PropertyEditorFieldInfo field = createPropertyEditorInfo(instance, declaredField, type); if (isACombo(field)) { generateComboValues(declaredField, field); } beanCategory.withField(field); } } }
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 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; }
@Before public void initialize() { List<PropertyEditorCategory> categories = new ArrayList<>(); category1 = new PropertyEditorCategory("c1"); category1.withField(new PropertyEditorFieldInfo("f1", "v1", PropertyEditorType.TEXT).withKey("f1")); categories.add(category1); category2 = new PropertyEditorCategory("c2"); category2.withField(new PropertyEditorFieldInfo("f2", "v2", PropertyEditorType.TEXT).withKey("f2")); categories.add(category2); when(layoutElement.getProperties()).thenReturn(elementProps); when(layoutElement.getPropertyCategories()).thenReturn(categories); presenter = new LayoutElementPropertiesPresenter(view, cssHelper, propertyChangedEvent, propertyClearAllEvent); presenter.edit(layoutElement); }