public PropertyEditorCategory createCategory(String categoryCode) { String name = propertyCategoryMapI18n.get(categoryCode); return new PropertyEditorCategory(name); }
public PropertyEditorCategory createCategory(String categoryCode) { String name = propertyCategoryMapI18n.get(categoryCode); return new PropertyEditorCategory(name); }
@Override public void addCategory(DisplayerAttributeDef attributeDef) { String catName = attrMapI18n.get(attributeDef); category = new PropertyEditorCategory(catName); categories.add(category); }
@Override public void addCategory(DisplayerAttributeDef attributeDef) { String catName = attrMapI18n.get(attributeDef); category = new PropertyEditorCategory(catName); categories.add(category); }
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 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; } }
private PropertyEditorCategory extractBeanInfoAndValues(String fqcn, Object instance) { Class targetClass; try { targetClass = Class.forName(fqcn); } catch (Exception e) { throw new NullBeanException("No bean found for FQCN: " + fqcn); } PropertyEditorCategory beanCategory = new PropertyEditorCategory(targetClass.getSimpleName()); extractFieldInformationAndValues(targetClass, beanCategory, instance); return beanCategory; }
private PropertyEditorCategory extractBeanInfoAndValues(String fqcn, Object instance) { Class targetClass; try { targetClass = Class.forName(fqcn); } catch (Exception e) { throw new NullBeanException("No bean found for FQCN: " + fqcn); } PropertyEditorCategory beanCategory = new PropertyEditorCategory(targetClass.getSimpleName()); extractFieldInformationAndValues(targetClass, beanCategory, instance); return beanCategory; }
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); } }
fieldInfo1.getValidators().add(new DoubleValidator()); final PropertyEditorCategory attributes = new PropertyEditorCategory(ATTRIBUTES).withField(fieldInfo1);
@Test public void createCategoryWithNoFields() { PropertyEditorWidget propertyEditorWidget = GWT.create(PropertyEditorWidget.class); PanelGroup propertyMenu = GWT.create(PanelGroup.class); PropertyEditorCategory category = new PropertyEditorCategory("1"); PropertyEditorHelper.createCategory(propertyEditorWidget, propertyMenu, category, ""); verify(propertyMenu, never()).add(any(Widget.class)); } }
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; }
@Test public void sortCategoryByPriority() { List<PropertyEditorCategory> categories = new ArrayList<PropertyEditorCategory>(); PropertyEditorCategory category1 = new PropertyEditorCategory("cat1", 2); categories.add(category1); PropertyEditorCategory category2 = new PropertyEditorCategory("catHighPriority", 1); categories.add(category2); PropertyEditorEvent event = new PropertyEditorEvent("event", categories); assertEquals(category2, event.getSortedProperties().get(0)); assertEquals(category1, event.getSortedProperties().get(1)); }
@Test public void sortCategoryByPriority() { List<PropertyEditorCategory> categories = new ArrayList<PropertyEditorCategory>(); PropertyEditorCategory category1 = new PropertyEditorCategory("cat1", 2); categories.add(category1); PropertyEditorCategory category2 = new PropertyEditorCategory("catHighPriority", 1); categories.add(category2); PropertyEditorEvent event = new PropertyEditorEvent("event", categories); assertEquals(category2, event.getSortedProperties().get(0)); assertEquals(category1, event.getSortedProperties().get(1)); }
@Test public void validateEventTest() { ArrayList<PropertyEditorCategory> properties = new ArrayList<PropertyEditorCategory>(); properties.add(new PropertyEditorCategory("Category")); PropertyEditorEvent event = new PropertyEditorEvent("id", properties); assertTrue(PropertyEditorHelper.validade(event)); }
@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); }
@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)); } }
@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)); } }