*/
@Override
public void handleEvent(Object eventSource) {
+// if (eventSource==comboPreservationMedium) {
+// addPreservationMethod().setMedium(comboPreservationMedium.getSelection());
+// }
+// else if (eventSource==datePreservation) {
+// addPreservationMethod().setTimeperiod(datePreservation.getTimePeriod());
+// }
+// else if(eventSource==selectionCollection){
+// getEntity().setCollection(selectionCollection.getSelection());
+// }
+// else if(eventSource==textAccessionNumber){
+// getEntity().setAccessionNumber(textAccessionNumber.getText());
+// }
+// else if(eventSource==textBarcode){
+// getEntity().setBarcode(textBarcode.getText());
+// }
+ }
+
+ private PreservationMethod addPreservationMethod(){
+ PreservationMethod preservationMethod = null;
try {
- if (eventSource==comboPreservationMedium) {
- PreservationMethod preservationMethod = getEntity().getPreservationMethod();
- if(preservationMethod==null){
- preservationMethod = PreservationMethod.NewInstance();
- getEntity().setPreservationMethod(preservationMethod);
- }
- preservationMethod.setMedium(comboPreservationMedium.getSelection());
+ preservationMethod = getEntity().getPreservationMethod();
+ if(getEntity().getPreservationMethod()==null){
+ preservationMethod = PreservationMethod.NewInstance();
+ getEntity().setPreservationMethod(preservationMethod);
}
- else if (eventSource==datePreservation) {
- PreservationMethod preservationMethod = getEntity().getPreservationMethod();
- if(preservationMethod==null){
- preservationMethod = PreservationMethod.NewInstance();
- getEntity().setPreservationMethod(preservationMethod);
- }
- preservationMethod.setTimeperiod(datePreservation.getTimePeriod());
- }
- }catch (MethodNotSupportedByDerivedUnitTypeException e) {
- AbstractUtility.errorDialog("Parameter not available", this, "Could not set preservation parameter!", e);
- }
- if(eventSource==selectionCollection){
- getEntity().setCollection(selectionCollection.getSelection());
- }
- else if(eventSource==textAccessionNumber){
- getEntity().setAccessionNumber(textAccessionNumber.getText());
- }
- else if(eventSource==textBarcode){
- getEntity().setBarcode(textBarcode.getText());
+ } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
-
+ return preservationMethod;
}
}