@Test public void testGetCompatibleModelFields() { List<String> compatibleModelFields = formEditorHelper.getCompatibleModelFields(nameField); Assertions.assertThat(compatibleModelFields) .hasSize(2) .contains(lastNameField.getId(), nameField.getId()); compatibleModelFields = formEditorHelper.getCompatibleModelFields(ageField); Assertions.assertThat(compatibleModelFields).containsOnly(ageField.getId()); compatibleModelFields = formEditorHelper.getCompatibleModelFields(weightField); Assertions.assertThat(compatibleModelFields) .hasSize(1) .containsOnly(weightField.getId()); IntegerSliderDefinition slider = new IntegerSliderDefinition(); slider.setId("slider"); slider.setName("slider"); slider.setLabel("slider"); slider.setBinding("slider"); compatibleModelFields = formEditorHelper.getCompatibleModelFields(slider); Assertions.assertThat(compatibleModelFields) .hasSize(1) .containsOnly(ageField.getId()); }
public List<String> getCompatibleModelFields(FieldDefinition field) { return availableFields.values() .stream() .filter(availableField -> availableField.getFieldTypeInfo().equals(field.getFieldTypeInfo())) .map(FieldDefinition::getBinding) .collect(Collectors.toList()); }
FormEditorHelper { public List<String> getCompatibleModelFields(FieldDefinition field) { return availableFields.values() .stream() .filter(availableField -> availableField.getFieldTypeInfo().equals(field.getFieldTypeInfo())) .map(FieldDefinition::getBinding) .collect(Collectors.toList()); } }
FormEditorHelper { public List<String> getCompatibleModelFields(FieldDefinition field) { return availableFields.values() .stream() .filter(availableField -> availableField.getFieldTypeInfo().equals(field.getFieldTypeInfo())) .map(FieldDefinition::getBinding) .collect(Collectors.toList()); } @Inject  FormEditorHelper(FieldManager fieldManager,
                            ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                            SyncBeanManager beanManager); }
FormEditorHelper { public List<String> getCompatibleModelFields(FieldDefinition field) { return availableFields.values() .stream() .filter(availableField -> availableField.getFieldTypeInfo().equals(field.getFieldTypeInfo())) .map(FieldDefinition::getBinding) .collect(Collectors.toList()); } @Inject  FormEditorHelper(FieldManager fieldManager,
                            ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                            SyncBeanManager beanManager); FormModelerContent getContent(); void initHelper(FormModelerContent content); FormDefinition getFormDefinition(); FormModel getFormModel(); void addAvailableFields(); void addAvailableField(FieldDefinition field); void removeAvailableField(FieldDefinition field); FieldDefinition getFormField(String fieldId); void removeField(String fieldId,
                            boolean addToAvailables); boolean modelContainsField(FieldDefinition fieldDefinition); List<String> getCompatibleModelFields(FieldDefinition field); List<String> getCompatibleFieldTypes(FieldDefinition field); FieldDefinition switchToField(FieldDefinition originalField,
                                         String newBinding); FieldDefinition switchToFieldType(FieldDefinition field,
                                             String fieldCode); void saveFormField(FieldDefinition originalField,
                              FieldDefinition fieldCopy); String generateUnboundFieldName(FieldDefinition field); Collection<EditorFieldLayoutComponent> getBaseFieldsDraggables(); Map<String, FieldDefinition> getAvailableFields(); FormEditorRenderingContext getRenderingContext(); @PreDestroy void destroy(); }
FormEditorHelper { public List<String> getCompatibleModelFields(FieldDefinition field) { return availableFields.values() .stream() .filter(availableField -> availableField.getFieldTypeInfo().equals(field.getFieldTypeInfo())) .map(FieldDefinition::getBinding) .collect(Collectors.toList()); } @Inject  FormEditorHelper(FieldManager fieldManager,
                            ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                            SyncBeanManager beanManager); FormModelerContent getContent(); void initHelper(FormModelerContent content); FormDefinition getFormDefinition(); FormModel getFormModel(); void addAvailableFields(); void addAvailableField(FieldDefinition field); void removeAvailableField(FieldDefinition field); FieldDefinition getFormField(String fieldId); void removeField(String fieldId,
                            boolean addToAvailables); boolean modelContainsField(FieldDefinition fieldDefinition); List<String> getCompatibleModelFields(FieldDefinition field); List<String> getCompatibleFieldTypes(FieldDefinition field); FieldDefinition switchToField(FieldDefinition originalField,
                                         String newBinding); FieldDefinition switchToFieldType(FieldDefinition field,
                                             String fieldCode); void saveFormField(FieldDefinition originalField,
                              FieldDefinition fieldCopy); String generateUnboundFieldName(FieldDefinition field); Collection<EditorFieldLayoutComponent> getBaseFieldsDraggables(); Map<String, FieldDefinition> getAvailableFields(); FormEditorRenderingContext getRenderingContext(); @PreDestroy void destroy(); static final String UNBOUND_FIELD_NAME_PREFFIX; }