@Test public void testShow() { RelationType relationTypeValue = RelationType.ONE_TO_MANY; List<CascadeType> cascadeTypeValue = Arrays.asList(CascadeType.DETACH, CascadeType.MERGE); FetchMode fetchModeValue = FetchMode.EAGER; Boolean optionalValue = Boolean.TRUE; String mappedByValue = "mappedByValue"; Boolean orphanRemovalValue = Boolean.FALSE; when(fieldInfo.getCurrentValue(RelationshipAnnotationValueHandler.RELATION_TYPE)).thenReturn(relationTypeValue); when(fieldInfo.getCurrentValue(RelationshipAnnotationValueHandler.CASCADE)).thenReturn(cascadeTypeValue); when(fieldInfo.getCurrentValue(RelationshipAnnotationValueHandler.FETCH)).thenReturn(fetchModeValue); when(fieldInfo.getCurrentValue(RelationshipAnnotationValueHandler.OPTIONAL)).thenReturn(optionalValue); when(fieldInfo.getCurrentValue(RelationshipAnnotationValueHandler.MAPPED_BY)).thenReturn(mappedByValue); when(fieldInfo.getCurrentValue(RelationshipAnnotationValueHandler.ORPHAN_REMOVAL)).thenReturn(orphanRemovalValue); when(fieldInfo.isDisabled()).thenReturn(false); dialog.setProperty(fieldInfo); dialog.show(); verify(view).setRelationType(relationTypeValue.name()); verifyRelationDependentFields(relationTypeValue); verifyCascadeTypesWhereSet(cascadeTypeValue); verify(view).setFetchMode(fetchModeValue.name()); verify(view).setOptional(optionalValue); verify(view).setMappedBy(mappedByValue); verify(view).setOrphanRemoval(orphanRemovalValue); verify(view).setEnabled(!fieldInfo.isDisabled()); verify(view).show(); }
@Override @SuppressWarnings("unchecked") public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue(RELATION_TYPE); if (relationTypeValue != null) { view.setRelationType(relationTypeValue.name()); } else { view.setRelationType(UIUtil.NOT_SELECTED); } enableRelationDependentFields(relationTypeValue); cascadeAllWasClicked = false; setCascadeTypes((List<CascadeType>) fieldInfo.getCurrentValue(CASCADE)); enableCascadeTypes(true, true); FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue(FETCH); if (fetchModeValue != null) { view.setFetchMode(fetchModeValue.name()); } else { view.setFetchMode(UIUtil.NOT_SELECTED); } Boolean optionalValue = (Boolean) fieldInfo.getCurrentValue(OPTIONAL); if (optionalValue != null) { view.setOptional(optionalValue); } String mappedBy = (String) fieldInfo.getCurrentValue(MAPPED_BY); view.setMappedBy(mappedBy); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue(ORPHAN_REMOVAL); if (orphanRemovalValue != null) { view.setOrphanRemoval(orphanRemovalValue); } view.setEnabled(!fieldInfo.isDisabled()); view.show(); }
RelationshipEditionDialog implements PropertyEditionPopup { @Override @SuppressWarnings("unchecked") public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue(RELATION_TYPE); if (relationTypeValue != null) { view.setRelationType(relationTypeValue.name()); } else { view.setRelationType(UIUtil.NOT_SELECTED); } enableRelationDependentFields(relationTypeValue); cascadeAllWasClicked = false; setCascadeTypes((List<CascadeType>) fieldInfo.getCurrentValue(CASCADE)); enableCascadeTypes(true, true); FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue(FETCH); if (fetchModeValue != null) { view.setFetchMode(fetchModeValue.name()); } else { view.setFetchMode(UIUtil.NOT_SELECTED); } Boolean optionalValue = (Boolean) fieldInfo.getCurrentValue(OPTIONAL); if (optionalValue != null) { view.setOptional(optionalValue); } String mappedBy = (String) fieldInfo.getCurrentValue(MAPPED_BY); view.setMappedBy(mappedBy); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue(ORPHAN_REMOVAL); if (orphanRemovalValue != null) { view.setOrphanRemoval(orphanRemovalValue); } view.setEnabled(!fieldInfo.isDisabled()); view.show(); } }
RelationshipEditionDialog implements PropertyEditionPopup { @Override @SuppressWarnings("unchecked") public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue(RELATION_TYPE); if (relationTypeValue != null) { view.setRelationType(relationTypeValue.name()); } else { view.setRelationType(UIUtil.NOT_SELECTED); } enableRelationDependentFields(relationTypeValue); cascadeAllWasClicked = false; setCascadeTypes((List<CascadeType>) fieldInfo.getCurrentValue(CASCADE)); enableCascadeTypes(true, true); FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue(FETCH); if (fetchModeValue != null) { view.setFetchMode(fetchModeValue.name()); } else { view.setFetchMode(UIUtil.NOT_SELECTED); } Boolean optionalValue = (Boolean) fieldInfo.getCurrentValue(OPTIONAL); if (optionalValue != null) { view.setOptional(optionalValue); } String mappedBy = (String) fieldInfo.getCurrentValue(MAPPED_BY); view.setMappedBy(mappedBy); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue(ORPHAN_REMOVAL); if (orphanRemovalValue != null) { view.setOrphanRemoval(orphanRemovalValue); } view.setEnabled(!fieldInfo.isDisabled()); view.show(); } @Inject  RelationshipEditionDialog(View view); }
RelationshipEditionDialog implements PropertyEditionPopup { @Override @SuppressWarnings("unchecked") public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue(RELATION_TYPE); if (relationTypeValue != null) { view.setRelationType(relationTypeValue.name()); } else { view.setRelationType(UIUtil.NOT_SELECTED); } enableRelationDependentFields(relationTypeValue); cascadeAllWasClicked = false; setCascadeTypes((List<CascadeType>) fieldInfo.getCurrentValue(CASCADE)); enableCascadeTypes(true, true); FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue(FETCH); if (fetchModeValue != null) { view.setFetchMode(fetchModeValue.name()); } else { view.setFetchMode(UIUtil.NOT_SELECTED); } Boolean optionalValue = (Boolean) fieldInfo.getCurrentValue(OPTIONAL); if (optionalValue != null) { view.setOptional(optionalValue); } String mappedBy = (String) fieldInfo.getCurrentValue(MAPPED_BY); view.setMappedBy(mappedBy); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue(ORPHAN_REMOVAL); if (orphanRemovalValue != null) { view.setOrphanRemoval(orphanRemovalValue); } view.setEnabled(!fieldInfo.isDisabled()); view.show(); } @Inject  RelationshipEditionDialog(View view); @Override Widget asWidget(); @Override @SuppressWarnings("unchecked") void show(); @Override void setOkCommand(Command okCommand); @Override void setProperty(PropertyEditorFieldInfo property); @Override String getStringValue(); @Override void setStringValue(String value); }
RelationshipEditionDialog implements PropertyEditionPopup { @Override @SuppressWarnings("unchecked") public void show() { DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property; RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue(RELATION_TYPE); if (relationTypeValue != null) { view.setRelationType(relationTypeValue.name()); } else { view.setRelationType(UIUtil.NOT_SELECTED); } enableRelationDependentFields(relationTypeValue); cascadeAllWasClicked = false; setCascadeTypes((List<CascadeType>) fieldInfo.getCurrentValue(CASCADE)); enableCascadeTypes(true, true); FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue(FETCH); if (fetchModeValue != null) { view.setFetchMode(fetchModeValue.name()); } else { view.setFetchMode(UIUtil.NOT_SELECTED); } Boolean optionalValue = (Boolean) fieldInfo.getCurrentValue(OPTIONAL); if (optionalValue != null) { view.setOptional(optionalValue); } String mappedBy = (String) fieldInfo.getCurrentValue(MAPPED_BY); view.setMappedBy(mappedBy); Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue(ORPHAN_REMOVAL); if (orphanRemovalValue != null) { view.setOrphanRemoval(orphanRemovalValue); } view.setEnabled(!fieldInfo.isDisabled()); view.show(); } @Inject  RelationshipEditionDialog(View view); @Override Widget asWidget(); @Override @SuppressWarnings("unchecked") void show(); @Override void setOkCommand(Command okCommand); @Override void setProperty(PropertyEditorFieldInfo property); @Override String getStringValue(); @Override void setStringValue(String value);  }