private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
private final MediaDeletionConfigurator configurator;
- private final Button btnDeleteIfUsedInTaxonDescription;
- private final Button btnDeleteIfUsedInSpecimenDescription;
+ private Button btnDelete;
+ private Button btnDeleteIfUsedInTaxonDescription;
+ private Button btnDeleteIfUsedInSpecimenDescription;
private Button btnRemoveFromImageGallery;
+
+ private boolean inBulkEditor;
public DeleteMediaConfiguratorComposite(MediaDeletionConfigurator configurator, Composite parent, int style, boolean inBulkEditor) {
super(parent, style);
+ this.inBulkEditor = inBulkEditor;
this.configurator = configurator;
addDisposeListener(new DisposeListener() {
@Override
toolkit.paintBordersFor(this);
setLayout(new RowLayout(SWT.VERTICAL));
setBackground(getBackground());
-
+
+
if (inBulkEditor){
btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
+ btnDeleteIfUsedInTaxonDescription.setEnabled(true);
+ btnDeleteIfUsedInTaxonDescription.setSelection(configurator.isDeleteIfUsedInTaxonDescription());
+ btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
+ btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
+ btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
+ btnDeleteIfUsedInSpecimenDescription.setSelection(configurator.isDeleteIfUsedInSpecimenDescription());
}
else {
- btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.RADIO);
- btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_delete);
-
+
+ btnDelete = new Button(this, SWT.RADIO);
+ btnDelete.setText(Messages.DeleteConfiguration_media_delete);
+
+// btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
+// btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
+// btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
+// btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
+// btnDelete.addListener(SWT.Selection, (Event e) -> {
+// Button b = (Button) e.widget;
+// btnDeleteIfUsedInSpecimenDescription.setEnabled(b.getSelection());
+// btnDeleteIfUsedInTaxonDescription.setEnabled(b.getSelection());
+// });
btnRemoveFromImageGallery = new Button(this, SWT.RADIO);
btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery);
+ btnDelete.setSelection(!configurator.isOnlyRemoveFromGallery());
+ btnRemoveFromImageGallery.setSelection(configurator.isOnlyRemoveFromGallery());
}
- btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
- btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
-
- if(inBulkEditor){
- btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
- }
- else{
- btnDeleteIfUsedInSpecimenDescription.setEnabled(false);
-
- btnDeleteIfUsedInTaxonDescription.addListener(SWT.Selection, (Event e) -> {
- Button b = (Button) e.widget;
- btnDeleteIfUsedInSpecimenDescription.setEnabled(b.getSelection());
-
- });
- }
- btnDeleteIfUsedInTaxonDescription.setSelection(true);
-
m_bindingContext = initDataBindings();
}
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
- IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
- IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
- bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
-
- if(btnRemoveFromImageGallery!=null){
+ if (inBulkEditor){
+ IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
+ IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
+ IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
+ } else{
+
+ IObservableValue observeSelectionBtnDelete = WidgetProperties.selection().observe(btnDelete);
+ IObservableValue deleteConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnDelete, deleteConfiguratorObserveValue, null, null);
+
IObservableValue observeSelectionBtnRemoveFromImageGallery = WidgetProperties.selection().observe(btnRemoveFromImageGallery);
IObservableValue removeFromImageGalleryConfiguratorObserveValue = PojoProperties.value("onlyRemoveFromGallery").observe(configurator);
bindingContext.bindValue(observeSelectionBtnRemoveFromImageGallery, removeFromImageGalleryConfiguratorObserveValue, null, null);
}
- IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
- IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
- bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
+
return bindingContext;
}