LayoutEditorCssHelper { public List<CssValue> readCssValues(Map<String,String> propertyMap) { if (propertyMap == null || propertyMap.isEmpty()) { return new ArrayList<>(); } return propertyMap.entrySet().stream() .filter(entry -> CssProperty.get(entry.getKey()) != null) .map(entry -> new CssValue(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); } LayoutEditorCssHelper(); String formatCssAllowedValue(CssProperty cssProperty); String getHelpText(CssProperty cssProperty); List<PropertyFieldValidator> getValidators(CssProperty property); PropertyEditorType resolveFieldType(CssProperty cssProperty); PropertyEditorCategory createCategory(String categoryCode); PropertyEditorFieldInfo createField(LayoutElementWithProperties element, CssProperty property); PropertyEditorFieldInfo createField(Map<String,String> propertyMap, CssProperty property); PropertyEditorFieldInfo createPropertyField(CssProperty property, String value); String formatCssAllowedValue(CssProperty property, CssAllowedValue value); CssAllowedValue parseCssAllowedValue(String property, String value); CssAllowedValue parseCssAllowedValue(CssProperty property, String value); List<CssValue> readCssValues(Map<String,String> propertyMap); List<PropertyEditorCategory> getContainerPropertyCategories(Container container); List<PropertyEditorCategory> getRowPropertyCategories(Row row); List<PropertyEditorCategory> getComponentPropertyCategories(LayoutComponent layoutComponent); List<PropertyEditorCategory> allCategories(Map<String,String> propertyMap); static final String CSS_CATEGORY_PANEL; static final String CSS_CATEGORY_TEXT; static final String CSS_CATEGORY_MARGIN; static final String CSS_CATEGORY_PADDING; }
@Test public void testReadFromMap() { Map<String,String> properties = new HashMap<>(); properties.put(CssProperty.MARGIN_TOP.getName(), "100px"); properties.put("prop1", "v1"); List<CssValue> cssValueList = cssHelper.readCssValues(properties); assertEquals(cssValueList.size(), 1); assertEquals(cssValueList.get(0).getProperty(), "margin-top"); assertEquals(cssValueList.get(0).getValue(), "100px"); }