fix #6197 Move excluded and unplaced from Taxon to TaxonNode in
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 15 Nov 2016 09:12:29 +0000 (10:12 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 15 Nov 2016 09:12:29 +0000 (10:12 +0100)
TaxEditor

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java

index 1ecc939342dc3a5d007953ef433d9b14e62521cb..9087bac7ad5ebfb15ade18d4f39000f3e1ffdb81 100644 (file)
@@ -59,9 +59,12 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
 
        private TaxonNodeAgentRelationCollectionSection selectionNodeAgentRelation;
 
-
        private CheckboxElement checkbox_openInEditor;
 
+    private CheckboxElement checkbox_excluded;
+
+    private CheckboxElement checkbox_unplaced;
+
        private boolean openInEditor;
 
        private boolean complete;
@@ -116,6 +119,13 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
             setTreeNode(entity);
             complete = true;
         }
+               if (entity instanceof TaxonNode) {
+                   checkbox_excluded = formFactory.createCheckbox(formElement,
+                           "Taxon is excluded", ((TaxonNode) entity).isExcluded(), style);
+                   checkbox_unplaced = formFactory.createCheckbox(formElement,
+                           "Taxon is unplaced", ((TaxonNode) entity).isUnplaced(), style);
+               }
+
                if (!isCreateNew()){
             selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), style);
             selectionNodeAgentRelation.setEntity((TaxonNode)entity);
@@ -177,7 +187,7 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                                textNewTaxonName.setText(null);
                            }
                                complete = !textNewTaxonName.getText().isEmpty();
-                               
+
 
                } else if (eventSource == selection_reuseExistingName) {
                    boolean enabled = selection_reuseExistingName.getEntity() == null;
@@ -193,7 +203,11 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                        selection_reuseExistingTaxon.setEnabled(enabled);
                        selection_reuseExistingName.setEnabled(enabled);
 
-                       complete = !textNewTaxonName.getText().isEmpty();
+                       complete = CdmUtils.isNotBlank(textNewTaxonName.getText());
+               } else if (eventSource == checkbox_excluded) {
+                   ((TaxonNode) getEntity()).setExcluded(checkbox_excluded.getSelection());
+               } else if (eventSource == checkbox_unplaced) {
+                   ((TaxonNode) getEntity()).setUnplaced(checkbox_unplaced.getSelection());
                } else if (eventSource == checkbox_openInEditor) {
                        setOpenInEditor(checkbox_openInEditor.getSelection());
                } else if (eventSource == selectionNodeAgentRelation){
index 2d612eb92b31a402cea73cc70bf6e7dd9e018fbd..8c956f1111db6679aecb39feee13ea2ab2b34856 100644 (file)
@@ -14,10 +14,8 @@ import java.util.Arrays;
 
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.SWT;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
@@ -27,7 +25,6 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
@@ -53,10 +50,6 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
 
        private TextWithLabelElement text_appendedPhrase;
 
-       private CheckboxElement checkbox_excluded;
-
-       private CheckboxElement checkbox_unplaced;
-
        private CheckboxElement checkbox_published;
 
 //     private SynonymRelationshipDetailSection sectionSynonymRelationship;
@@ -111,15 +104,6 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)) {
                        checkbox_useNameCache = formFactory.createCheckbox(formElement,
                                        "Exclude Authorship", entity.isUseNameCache(), style);
-
-//#3925                
-//                     if (entity instanceof Taxon) {
-//                             checkbox_excluded = formFactory.createCheckbox(formElement,
-//                                             "Taxon is excluded", ((Taxon) entity).isExcluded(), style);
-//                             checkbox_unplaced = formFactory.createCheckbox(formElement,
-//                                             "Taxon is unplaced", ((Taxon) entity).isUnplaced(), style);
-//                     }
-
                        checkbox_doubtful = formFactory.createCheckbox(formElement,
                                        entity.getClass().getSimpleName() + " is doubtful", entity.isDoubtful(), style);
                }
@@ -157,7 +141,7 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                super.updateContent();
                toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
                setIrrelevant(toggleable_cache.getState(),
-                               Arrays.asList(new Object[] { toggleable_cache, checkbox_published, checkbox_unplaced, checkbox_excluded }));
+                               Arrays.asList(new Object[] { toggleable_cache, checkbox_published}));
        }
 
        @Override
@@ -182,11 +166,6 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                        getEntity().setAppendedPhrase(text_appendedPhrase.getText());
                }else if (eventSource == text_secundum_microreference) {
             getEntity().setSecMicroReference(text_secundum_microreference.getText());
-//#3925
-//        }else if (eventSource == checkbox_excluded) {
-//                     ((Taxon) getEntity()).setExcluded(checkbox_excluded.getSelection());
-//             } else if (eventSource == checkbox_unplaced) {
-//                 ((Taxon) getEntity()).setUnplaced(checkbox_unplaced.getSelection());
                } else if (eventSource == checkbox_published) {
                    ((Taxon)getEntity()).setPublish(checkbox_published.getSelection());
                }
@@ -196,7 +175,7 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
         boolean pushedState = toggleable_cache.getState();
 
         getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
-        setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, checkbox_published, checkbox_unplaced, checkbox_excluded}));
+        setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, checkbox_published}));
         updateToggleableCacheField();
     }
 }