@Test public void loadDataObjectFieldTest() { MainDataObjectFieldEditor fieldEditor = createFieldEditor(); DataObject dataObject = context.getDataObject(); ObjectProperty field = dataObject.getProperty("field1"); context.setObjectProperty(field); fieldEditor.onContextChange(context); verify(view, times(1)).setName(field.getName()); verify(view, times(1)).setLabel(AnnotationValueHandler.getStringValue(field, Label.class.getName(), "value")); verify(view, times(1)).setDescription(AnnotationValueHandler.getStringValue(field, Description.class.getName(), "value")); verify(view, times(1)).initTypeList(anyList(), eq(field.getClassName()), eq(false)); assertFalse(fieldEditor.isReadonly()); }
@Override protected void loadDataObjectField(DataObject dataObject, ObjectProperty objectField) { clear(); setReadonly(true); if (dataObject != null && objectField != null) { this.dataObject = dataObject; this.objectField = objectField; initTypeList(); view.setName(getObjectField().getName()); Annotation annotation = objectField.getAnnotation(MainDomainAnnotations.LABEL_ANNOTATION); if (annotation != null) { view.setLabel(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } annotation = objectField.getAnnotation(MainDomainAnnotations.DESCRIPTION_ANNOTATION); if (annotation != null) { view.setDescription(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } setReadonly(getContext() == null || getContext().isReadonly()); } else { initTypeList(); } }
MainDataObjectFieldEditor extends FieldEditor implements MainDataObjectFieldEditorView.Presenter { @Override protected void loadDataObjectField(DataObject dataObject, ObjectProperty objectField) { clear(); setReadonly(true); if (dataObject != null && objectField != null) { this.dataObject = dataObject; this.objectField = objectField; initTypeList(); view.setName(getObjectField().getName()); Annotation annotation = objectField.getAnnotation(MainDomainAnnotations.LABEL_ANNOTATION); if (annotation != null) { view.setLabel(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } annotation = objectField.getAnnotation(MainDomainAnnotations.DESCRIPTION_ANNOTATION); if (annotation != null) { view.setDescription(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } setReadonly(getContext() == null || getContext().isReadonly()); } else { initTypeList(); } } }
MainDataObjectFieldEditor extends FieldEditor implements MainDataObjectFieldEditorView.Presenter { @Override protected void loadDataObjectField(DataObject dataObject, ObjectProperty objectField) { clear(); setReadonly(true); if (dataObject != null && objectField != null) { this.dataObject = dataObject; this.objectField = objectField; initTypeList(); view.setName(getObjectField().getName()); Annotation annotation = objectField.getAnnotation(MainDomainAnnotations.LABEL_ANNOTATION); if (annotation != null) { view.setLabel(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } annotation = objectField.getAnnotation(MainDomainAnnotations.DESCRIPTION_ANNOTATION); if (annotation != null) { view.setDescription(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } setReadonly(getContext() == null || getContext().isReadonly()); } else { initTypeList(); } } @Inject  MainDataObjectFieldEditor(MainDataObjectFieldEditorView view,
                                     DomainHandlerRegistry handlerRegistry,
                                     Event<DataModelerEvent> dataModelerEvent,
                                     DataModelCommandBuilder commandBuilder,
                                     ValidatorService validatorService,
                                     Caller<DataModelerService> modelerService,
                                     ShowAssetUsagesDisplayer showAssetUsagesDisplayer); }
MainDataObjectFieldEditor extends FieldEditor implements MainDataObjectFieldEditorView.Presenter { @Override protected void loadDataObjectField(DataObject dataObject, ObjectProperty objectField) { clear(); setReadonly(true); if (dataObject != null && objectField != null) { this.dataObject = dataObject; this.objectField = objectField; initTypeList(); view.setName(getObjectField().getName()); Annotation annotation = objectField.getAnnotation(MainDomainAnnotations.LABEL_ANNOTATION); if (annotation != null) { view.setLabel(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } annotation = objectField.getAnnotation(MainDomainAnnotations.DESCRIPTION_ANNOTATION); if (annotation != null) { view.setDescription(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } setReadonly(getContext() == null || getContext().isReadonly()); } else { initTypeList(); } } @Inject  MainDataObjectFieldEditor(MainDataObjectFieldEditorView view,
                                     DomainHandlerRegistry handlerRegistry,
                                     Event<DataModelerEvent> dataModelerEvent,
                                     DataModelCommandBuilder commandBuilder,
                                     ValidatorService validatorService,
                                     Caller<DataModelerService> modelerService,
                                     ShowAssetUsagesDisplayer showAssetUsagesDisplayer); void onContextChange(DataModelerContext context); @Override String getName(); @Override String getDomainName(); void setReadonly(boolean readonly); @Override Widget asWidget(); @Override void onNameChange(); @Override void onLabelChange(); @Override void onDescriptionChange(); @Override void onTypeChange(); @Override void onTypeMultipleChange(); void refreshTypeList(boolean keepSelection); void clear(); }
MainDataObjectFieldEditor extends FieldEditor implements MainDataObjectFieldEditorView.Presenter { @Override protected void loadDataObjectField(DataObject dataObject, ObjectProperty objectField) { clear(); setReadonly(true); if (dataObject != null && objectField != null) { this.dataObject = dataObject; this.objectField = objectField; initTypeList(); view.setName(getObjectField().getName()); Annotation annotation = objectField.getAnnotation(MainDomainAnnotations.LABEL_ANNOTATION); if (annotation != null) { view.setLabel(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } annotation = objectField.getAnnotation(MainDomainAnnotations.DESCRIPTION_ANNOTATION); if (annotation != null) { view.setDescription(AnnotationValueHandler.getStringValue(annotation, MainDomainAnnotations.VALUE_PARAM)); } setReadonly(getContext() == null || getContext().isReadonly()); } else { initTypeList(); } } @Inject  MainDataObjectFieldEditor(MainDataObjectFieldEditorView view,
                                     DomainHandlerRegistry handlerRegistry,
                                     Event<DataModelerEvent> dataModelerEvent,
                                     DataModelCommandBuilder commandBuilder,
                                     ValidatorService validatorService,
                                     Caller<DataModelerService> modelerService,
                                     ShowAssetUsagesDisplayer showAssetUsagesDisplayer); void onContextChange(DataModelerContext context); @Override String getName(); @Override String getDomainName(); void setReadonly(boolean readonly); @Override Widget asWidget(); @Override void onNameChange(); @Override void onLabelChange(); @Override void onDescriptionChange(); @Override void onTypeChange(); @Override void onTypeMultipleChange(); void refreshTypeList(boolean keepSelection); void clear();  }