private PropertyEditorEvent generateEvent(PropertyEditorCategory category) { PropertyEditorEvent event = new PropertyEditorEvent(PROPERTY_EDITOR_KEY, category); return event; }
/** * Get Properties from a event ordered by priority. * * @return Categories and fields ordered by priority, lower values toward the beginning */ public List<PropertyEditorCategory> getSortedProperties() { sortCategoriesAndFieldsByPriority(properties); return properties; } }
private static void sortCategoriesAndFieldsByPriority(List<PropertyEditorCategory> properties) { sortCategoriesByPriority(properties); sortEditorFieldInfoByPriority(properties); }
@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)); }
public static boolean validade(PropertyEditorEvent event) { if (event == null) { throw new NullEventException("Event should not be null,"); } if (event.getSortedProperties().isEmpty()) { throw new NoPropertiesException("Event should not have empty properties."); } return event != null && !event.getSortedProperties().isEmpty(); }
@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)); }
public static void extractEditorFrom(final PropertyEditorWidget propertyEditorWidget, final PanelGroup propertyMenu, final PropertyEditorEvent event, final String propertyNameFilter) { propertyMenu.clear(); for (PropertyEditorCategory category : event.getSortedProperties()) { createCategory(propertyEditorWidget, propertyMenu, category, propertyNameFilter); } }
private PropertyEditorEvent generateEvent(PropertyEditorCategory category) { PropertyEditorEvent event = new PropertyEditorEvent(PROPERTY_EDITOR_KEY, category); return event; }
@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)); } }
private static void sortCategoriesAndFieldsByPriority(List<PropertyEditorCategory> properties) { sortCategoriesByPriority(properties); sortEditorFieldInfoByPriority(properties); }
/** * Get Properties from a event ordered by priority. * * @return Categories and fields ordered by priority, lower values toward the beginning */ public List<PropertyEditorCategory> getSortedProperties() { sortCategoriesAndFieldsByPriority(properties); return properties; } }
private PropertyEditorEvent generateEvent(PropertyEditorCategory category) { PropertyEditorEvent event = new PropertyEditorEvent(PROPERTY_EDITOR_KEY, category); return event; }
@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)); } }
private PropertyEditorEvent generateEvent(PropertyEditorCategory category) { PropertyEditorEvent event = new PropertyEditorEvent(PROPERTY_EDITOR_KEY, category); return event; }
public PropertyEditorEvent generatePropertyEditorEvent() { if (category == null) { createPropertiesEditorCategory(); } PropertyEditorEvent event = new PropertyEditorEvent(id, category); return event; }
@Override public void show() { propertyEditor.handle(new PropertyEditorEvent(PROPERTY_EDITOR_ID, categories)); }
@Override public void show() { propertyEditor.handle(new PropertyEditorEvent(PROPERTY_EDITOR_ID, categories)); }
public PropertyEditorEvent generatePropertyEditorEvent() { if (category == null) { createPropertiesEditorCategory(); } PropertyEditorEvent event = new PropertyEditorEvent(id, category); return event; }
@Override public void show() { propertyEditor.handle(new PropertyEditorEvent(PROPERTY_EDITOR_ID, categories)); }
@Override public void show() { propertyEditor.handle(new PropertyEditorEvent(PROPERTY_EDITOR_ID, categories)); }