fix details view for authorship cache and referencing objects view
authorKatja Luther <k.luther@bgbm.org>
Thu, 9 Mar 2017 11:14:51 +0000 (12:14 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 9 Mar 2017 11:16:32 +0000 (12:16 +0100)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java

index 7536b882a17b4bb9910175049a4034f3c6948de0..fd1219a69262d94544814a13d0e9bf0414139eeb 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -21,10 +21,15 @@ import eu.etaxonomy.cdm.model.common.ICdmBase;
  * @version 1.0
  */
 public abstract class AbstractDateComparator<T extends ICdmBase> implements Comparator<T>{
-       
-       public int compare(T o1, T o2) {                
+
+       @Override
+    public int compare(T o1, T o2) {
+           if (o1.equals(o2)){
+               return 0;
+           }
+
                return getDate(o1).compareTo(getDate(o2));
        };
-       
+
        protected abstract DateTime getDate(T object);
 }
index d8a07325c67aef0ee3b8a773eca14d5256e9332c..783845df10ad827d29ee6bc422043d5119a80c43 100644 (file)
@@ -54,9 +54,16 @@ public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerReques
                RemoteInvocationResult rir = fromCache(currentRemoteInvocation);
 
                if(rir == null) {
-                   logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl());
-                       rir = super.doExecuteRequest(config, baos);
+
+                   if (!(currentRemoteInvocation.getMethodName() == null) && !(config.getServiceUrl() == null)){
+                      // logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl());
+                   }
+                   rir = super.doExecuteRequest(config, baos);
                        if(rir.getValue() != null && !rir.hasException()) {
+                           if (currentRemoteInvocation == null){
+                               logger.debug("return RemoteInvocationResult without caching" );
+                               return rir;
+                           }
                 if(cachableMethods.contains(currentRemoteInvocation.getMethodName())) {
                     rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
                 } else if(rir.getValue() instanceof UpdateResult){
index 110571ee2b61e02f7486fdeadc14055c2875fd40..f77eb24e50390005747557141ac17d47571925ef 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -28,7 +28,6 @@ import org.eclipse.swt.events.ControlListener;
 import org.eclipse.swt.events.FocusAdapter;
 import org.eclipse.swt.events.FocusEvent;
 import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.MouseAdapter;
@@ -88,7 +87,7 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * The <code>IManagedForm</code> can also used for drawing borders by calling
  * the method <code>createBorderSupport()</code>.
  * </p>
- * 
+ *
  * @author p.ciardelli
  * @author n.hoffmann
  * @created 02.06.2008
@@ -125,7 +124,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Constructor for AbstractGroupedContainer.
         * </p>
-        * 
+        *
         * @param editor
         *            a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor}
         *            object.
@@ -172,7 +171,8 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        protected void createListener() {
                nameCompositeModifyListener = new ModifyListener() {
 
-                       public void modifyText(ModifyEvent e) {
+                       @Override
+            public void modifyText(ModifyEvent e) {
                                // mark the composite dirty
                                setDirty(true);
                                // parse the text
@@ -194,7 +194,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
                        /*
                         * (non-Javadoc)
-                        * 
+                        *
                         * @see
                         * org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt
                         * .events.FocusEvent)
@@ -233,7 +233,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * getEmptyTextPrompt
         * </p>
-        * 
+        *
         * @return a {@link java.lang.String} object.
         */
        protected String getEmptyTextPrompt() {
@@ -241,7 +241,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        }
 
        /**
-        * 
+        *
         */
        private void showNameRelations() {
                TaxonNameBase<?, ?> name = getName();
@@ -311,7 +311,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        }
 
        /**
-        * 
+        *
         */
        public void showAnnotations() {
 
@@ -336,7 +336,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        }
 
        /**
-        * 
+        *
         */
        private void showParsingProblems() {
                String text = getNameViewer().getTextWidget().getText();
@@ -376,7 +376,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * handleSplitText
         * </p>
-        * 
+        *
         * @param text
         *            a {@link java.lang.String} object.
         */
@@ -392,10 +392,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /**
         * Refreshes the display with latest data from the model.
-        * 
+        *
         * Note: Will not parse the text and not calculate errors!
         */
-       public void refresh() {
+       @Override
+    public void refresh() {
                // showNameRelations();
 
                String text = NameHelper.getDisplayNameWithRef(getTaxonBase());
@@ -423,7 +424,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        }
 
        /**
-        * 
+        *
         */
        protected abstract void updateIcon();
 
@@ -437,7 +438,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        protected abstract void updateNonEditableInfo();
 
        /**
-        * 
+        *
         */
        private void enableFreeText() {
                setEnabled(isFreetextEditingAllowed());
@@ -446,7 +447,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        /**
         * Checks whether the freetext should be editable based on specific empty
         * fields.
-        * 
+        *
         * @return
         */
        private boolean isFreetextEditingAllowed() {
@@ -461,19 +462,19 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        }
 
        /**
-        * Checks whether there are more than one, non-orphaned taxon bases   
+        * Checks whether there are more than one, non-orphaned taxon bases
         * attached to the taxon name
-        * 
+        *
         * @return
         */
        private boolean isNameUsedMultipleTimes() {
-               
+
                Set<TaxonBase> taxonBases = getName().getTaxonBases();
                Iterator<TaxonBase> tbItr = taxonBases.iterator();
                int nonOrphanedTaxonBaseCount = taxonBases.size();
-               
+
                while(tbItr.hasNext()) {
-                       TaxonBase tb = tbItr.next(); 
+                       TaxonBase tb = tbItr.next();
                        if(tb.isOrphaned()) {
                                nonOrphanedTaxonBaseCount--;
                        }
@@ -514,7 +515,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * getTaxonBase
         * </p>
-        * 
+        *
         * @return the taxonBase
         */
        public T getTaxonBase() {
@@ -525,11 +526,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * getName
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
         */
        public TaxonNameBase getName() {
-               return (TaxonNameBase) HibernateProxyHelper.deproxy(getTaxonBase()
+               return HibernateProxyHelper.deproxy(getTaxonBase()
                                .getName());
        }
 
@@ -575,7 +576,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Getter for the field <code>group</code>.
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup}
         *         object.
@@ -630,7 +631,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Getter for the field <code>control</code>.
         * </p>
-        * 
+        *
         * @return a {@link org.eclipse.swt.widgets.Composite} object.
         */
        public Composite getControl() {
@@ -688,7 +689,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setIcon
         * </p>
-        * 
+        *
         * @param icon
         *            a {@link org.eclipse.swt.graphics.Image} object.
         */
@@ -700,7 +701,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setIndent
         * </p>
-        * 
+        *
         * @param indent
         *            a int.
         */
@@ -730,7 +731,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * isSelected
         * </p>
-        * 
+        *
         * @return a boolean.
         */
        public boolean isSelected() {
@@ -741,7 +742,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * colorSelected
         * </p>
-        * 
+        *
         * @param mode
         *            a int.
         */
@@ -782,7 +783,8 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                Display display = Display.getCurrent();
                Runnable runnable = new Runnable() {
 
-                       public void run() {
+                       @Override
+            public void run() {
                                getEditor().getManagedForm().setInput(selection);
                        }
                };
@@ -794,7 +796,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setBackground
         * </p>
-        * 
+        *
         * @param color
         *            a {@link org.eclipse.swt.graphics.Color} object.
         */
@@ -810,7 +812,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.swt.widgets.Control#setFont(org.eclipse.swt.graphics.Font)
         */
@@ -818,7 +820,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setFont
         * </p>
-        * 
+        *
         * @param font
         *            a {@link org.eclipse.swt.graphics.Font} object.
         */
@@ -830,7 +832,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Getter for the field <code>nameViewer</code>.
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.NameViewer}
         *         object.
         */
@@ -847,7 +849,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * If <code>textViewer</code> has already been set, it will show a
         * <code>prompt</code> along the lines of
         * "Click here to start entering data" when empty.
-        * 
+        *
         * @param prompt
         *            a {@link java.lang.String} object.
         */
@@ -860,14 +862,16 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
                setFocusListener(new FocusListener() {
 
-                       public void focusGained(FocusEvent e) {
+                       @Override
+            public void focusGained(FocusEvent e) {
                                if (document.get().equals(prompt)) {
                                        textControl.setFont(getViewerFont());
                                        document.set(""); //$NON-NLS-1$
                                }
                        }
 
-                       public void focusLost(FocusEvent e) {
+                       @Override
+            public void focusLost(FocusEvent e) {
                                if (document.getLength() == 0) {
                                        initEmptyText();
                                }
@@ -887,7 +891,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * getViewerFont
         * </p>
-        * 
+        *
         * @return a {@link org.eclipse.swt.graphics.Font} object.
         */
        abstract protected Font getViewerFont();
@@ -909,7 +913,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Setter for the field <code>focusListener</code>.
         * </p>
-        * 
+        *
         * @param focusListener
         *            a {@link org.eclipse.swt.events.FocusListener} object.
         */
@@ -925,7 +929,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setDirty
         * </p>
-        * 
+        *
         * @param isDirty
         *            a boolean.
         */
@@ -940,10 +944,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * isDirty
         * </p>
-        * 
+        *
         * @return a boolean.
         */
-       public boolean isDirty() {
+       @Override
+    public boolean isDirty() {
                return isDirty;
        }
 
@@ -951,7 +956,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setMenu
         * </p>
-        * 
+        *
         * @param menu
         *            a {@link org.eclipse.swt.widgets.Menu} object.
         */
@@ -967,7 +972,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setDraggableControl
         * </p>
-        * 
+        *
         * @param controls
         *            an array of {@link org.eclipse.swt.widgets.Control} objects.
         */
@@ -979,7 +984,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * setIsDraggable
         * </p>
-        * 
+        *
         * @param draggable
         *            a boolean.
         */
@@ -1038,7 +1043,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * nonEditableInfo is a label displayed underneath a GroupedComposite's
         * input field. For instance, NameComposites display things like name
         * relations, sec. references, etc. here.
-        * 
+        *
         * @param info
         *            the text to display in the label
         * @param append
@@ -1094,10 +1099,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Getter for the field <code>data</code>.
         * </p>
-        * 
+        *
         * @return a T object.
         */
-       public T getData() {
+       @Override
+    public T getData() {
                return data;
        }
 
@@ -1105,12 +1111,12 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Setter for the field <code>data</code>.
         * </p>
-        * 
+        *
         * @param data
         *            a T object.
         */
        public void setData(T data) {
-               this.data = (T) HibernateProxyHelper.deproxy(data);
+               this.data = HibernateProxyHelper.deproxy(data);
        }
 
        /**
@@ -1128,7 +1134,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                };
 
                getNameViewer().getTextWidget().addVerifyListener(lineBreakListener);
-               
+
        }
 
        abstract class LabelEllipsisListener extends ControlAdapter {
@@ -1179,7 +1185,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * <p>
         * Setter for the field <code>group</code>.
         * </p>
-        * 
+        *
         * @param group
         *            a
         *            {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup}
@@ -1200,7 +1206,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
         * )
@@ -1213,7 +1219,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#dispose()
         */
        @Override
@@ -1226,7 +1232,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
         */
        @Override
@@ -1238,7 +1244,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
         */
        @Override
@@ -1248,7 +1254,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#setFocus()
         */
        @Override
@@ -1258,28 +1264,28 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#isStale()
         */
        @Override
        public boolean isStale() {
                return false;
        }
-       
+
        public void setDisabled(boolean disabled) {
                this.enabled = !disabled;
                setEnabled(enabled);
        }
-       
+
        public void setEnabled(boolean enabled) {
                this.enabled = enabled;
                Color color = enabled ? control.getForeground() : EditorUtil.getColor(Resources.COLOR_DISABLED_EDITOR);
-                               
+
                getNameViewer().getTextWidget().setEditable(enabled);
                getNameViewer().getTextWidget().setEnabled(enabled);
                getNameViewer().getTextWidget().setForeground(color);
        }
-       
+
        public boolean isEnabled(){
                return enabled;
        }
index ee6ecbc03c8dfab5e81fbae3fa36a4409fcfcf66..5e6ef66baef75a3be39ed3afe23cecc8579d0435 100644 (file)
@@ -11,9 +11,11 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 
 public class TaxonNodeNavigatorComparator extends ViewerComparator{
 
+       Comparator<TaxonNode> comparator;
        
        public TaxonNodeNavigatorComparator(Comparator<TaxonNode> comparator){
-               super(comparator);
+               super();
+               this.comparator = comparator;
        }
 
        
@@ -23,11 +25,8 @@ public class TaxonNodeNavigatorComparator extends ViewerComparator{
                if (e1 instanceof Classification && e2 instanceof Classification){
                        return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache());
                } else{
-                       if (this.getComparator() instanceof TaxonNaturalComparator){
-                               return this.getComparator().compare((TaxonNode)e1, (TaxonNode)e2);
-                       }else{
-                               return this.getComparator().compare(e1,e2);
-                       }
+                       return comparator.compare((TaxonNode)e1, (TaxonNode)e2);
+                       
                }
        }
 }
index 4a7133574d9d9ddbb11cf7feab11458bed5b68ef..aead08f6ce78ffc4c5f76d19d4c1e4c50f11a3b1 100644 (file)
@@ -43,6 +43,7 @@ import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
 import eu.etaxonomy.cdm.model.description.Distribution;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
+import eu.etaxonomy.cdm.model.description.KeyStatement;
 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
 import eu.etaxonomy.cdm.model.description.QuantitativeData;
 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
@@ -88,9 +89,11 @@ public class DescriptionHelper {
         */
        public static String getCache(DescriptionElementBase element,
                        Language language) {
-               
+
                String mainElementLabel= null;
                DescriptionBase<?> descr = element.getInDescription();
+               descr = CdmBase.deproxy(descr, DescriptionBase.class);
+
                if (descr != null){
                        if (descr.isInstanceOf(TaxonDescription.class)){
                                Taxon taxon = CdmBase.deproxy(descr, TaxonDescription.class).getTaxon();
@@ -109,10 +112,12 @@ public class DescriptionHelper {
                                }
                        }
                }
-               
+
+
                String cache = null;
                if (element instanceof TextData) {
-                       cache = ((TextData) element).getText(language);
+                       //cache = ((TextData) element).getText(language);
+                   cache = "Text Data";
                }
                if (element instanceof CommonTaxonName) {
                        cache = ((CommonTaxonName) element).getName();
@@ -217,7 +222,7 @@ public class DescriptionHelper {
                        try{
                                OriginalSourceBase<?> originalSource = (OriginalSourceBase<?>) element;
 //                             ISourceable sourcedObject = originalSource.getSourcedObj();
-                               //due to #5743 the bidirectionality for sourced object had to be removed 
+                               //due to #5743 the bidirectionality for sourced object had to be removed
                                String sourceObjectTitle = "sourced object data not available (#5743)";
 //                             if(sourcedObject instanceof IIdentifiableEntity){
 //                                     sourceObjectTitle = ((IdentifiableEntity) sourcedObject).getTitleCache();
@@ -257,7 +262,10 @@ public class DescriptionHelper {
                }else if (element instanceof Group) {
                        Group group = (Group) element;
                        return group.getName();
-               }else{
+               }else if (element instanceof KeyStatement) {
+            KeyStatement keyStatement = (KeyStatement) element;
+            return getCache(keyStatement);
+        }else{
                        // TODO write return texts for HomotypicalGroup, etc.
                        return element.toString();
                }
@@ -278,8 +286,8 @@ public class DescriptionHelper {
                if (StringUtils.isBlank(taxonStr)){
                        taxonStr = "no or unlabled taxon";
                }
-                       
-                       
+
+
                //unit
                SpecimenOrObservationBase<?> unit = detEvent.getIdentifiedUnit();
                String unitStr;
@@ -291,7 +299,7 @@ public class DescriptionHelper {
                }else{
                        unitStr = "no unit";
                }
-               
+
                String result = CdmUtils.concat(" determined as ", unitStr, taxonStr);
 
                return result;
@@ -325,7 +333,7 @@ public class DescriptionHelper {
                        }
                }
                result = CdmUtils.concat(": ", result, parentStr);
-               
+
                return result;
        }
 
@@ -338,7 +346,7 @@ public class DescriptionHelper {
                if (designation.isInstanceOf(SpecimenTypeDesignation.class)){
                        to = ((SpecimenTypeDesignation)designation).getTypeSpecimen();
                }else if (designation.isInstanceOf(NameTypeDesignation.class)){
-                       to = ((NameTypeDesignation)designation).getTypeName();  
+                       to = ((NameTypeDesignation)designation).getTypeName();
                }else{
                        throw new RuntimeException("Type Designation class not supported: " +  designation.getClass().getName());
                }
@@ -365,7 +373,7 @@ public class DescriptionHelper {
                for (TaxonNameBase<?,?> name : from){
                        CdmUtils.concat(",", fromString, name.getTitleCache());
                }
-               String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString, 
+               String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString,
                                typeLabel, to == null? null : to.getTitleCache()});
                return result;
        }
@@ -416,11 +424,11 @@ public class DescriptionHelper {
                if (StringUtils.isBlank(typeLabel)){
                        typeLabel = "->";
                }
-               String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(), 
+               String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(),
                                typeLabel, to == null? null : to.getTitleCache()});
                return result;
        }
-       
+
 
        private static String getCache(HomotypicalGroup hg) {
                String result = "";
@@ -433,6 +441,14 @@ public class DescriptionHelper {
                return result;
        }
 
+       private static String getCache(KeyStatement ks) {
+        String result = "";
+
+        result = "KeyStatement";
+
+        return result;
+    }
+
        /**
         * <p>getObjectClassname</p>
         *
index 854a7aab85895578d1be7d66a4995eb914a134c3..f100783019f8989d33b6ebd8761fdc09d3ef0a06 100644 (file)
@@ -25,6 +25,7 @@ public class NameDetailsConfigurator {
     private boolean isRankActivated = true;
     private boolean isAtomisedEpithetsActivated = true;
     private boolean isAuthorshipSectionActivated = true;
+    private boolean isAuthorCacheActivated = true;
     private boolean isNomenclaturalReferenceSectionActivated = true;
     private boolean isNomenclaturalStatusSectionActivated = true;
     private boolean isTypeDesignationSectionActivated = true;
@@ -158,6 +159,11 @@ public class NameDetailsConfigurator {
         StringBuffer result = new StringBuffer();
       //the preference value is build like this:
         //<section1>:true;<section2>:false....
+        result.append("simpleViewActivated");
+        result.append(":");
+        result.append(this.isSimpleDetailsViewActivated);
+        result.append(";");
+
         result.append("taxon");
         result.append(":");
         result.append(this.isTaxonSectionActivated);
@@ -210,5 +216,19 @@ public class NameDetailsConfigurator {
       return result.toString();
     }
 
+    /**
+     * @return the isAuthorCacheActivated
+     */
+    public boolean isAuthorCacheActivated() {
+        return isAuthorCacheActivated;
+    }
+
+    /**
+     * @param isAuthorCacheActivated the isAuthorCacheActivated to set
+     */
+    public void setAuthorCacheActivated(boolean isAuthorCacheActivated) {
+        this.isAuthorCacheActivated = isAuthorCacheActivated;
+    }
+
 
 }
index a24eac024c10522d7a90b09758e68f88e836283c..1646d455851312f372d12b6475ca7df6160df0e0 100644 (file)
@@ -1,6 +1,7 @@
 package eu.etaxonomy.taxeditor.preference;
 
 
+import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -8,10 +9,8 @@ import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.jface.preference.PreferencePage;
 
 
 public class NameDetailsViewConfiguration extends PreferencePage implements IWorkbenchPreferencePage {
@@ -19,7 +18,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
     Composite child ;
        @Override
        public void init(IWorkbench workbench) {
-               
+
        }
 
        /*
@@ -31,9 +30,11 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
      */
     @Override
     protected Control createContents(Composite parent) {
-       
+
        Composite composite = new Composite(parent, SWT.NULL);
         composite.setLayout(new GridLayout());
+
+        //boolean isAllowOverride = PreferencesUtil
         isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
         final Button activateCheckButton = new Button(composite, SWT.CHECK);
         activateCheckButton.setText("Show only a simple name details view");
@@ -52,11 +53,11 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
             }
          }
          });
-         
+
         child  = new Composite(composite, SWT.NULL);
         child.setLayout(new GridLayout());
         child.setVisible(isSimpleDetailsViewActivated);
-               
+
         final Button showTaxon = new Button(child, SWT.CHECK);
         boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
         showTaxon.setText("Show taxon of the name");
@@ -68,7 +69,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
               }
          });
-         
+
         final Button showLsid = new Button(child, SWT.CHECK);
         boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
         showLsid.setText("Show Lsid of the name");
@@ -80,7 +81,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
               }
          });
-        
+
         final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
         boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
         showNomenclaturalCode.setText("Show the nomenclatural code");
@@ -92,7 +93,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
               }
          });
-        
+
         final Button showNameCache = new Button(child, SWT.CHECK);
         boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
         showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
@@ -112,10 +113,10 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
              @Override
              public void widgetSelected(SelectionEvent e) {
                  boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
-                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowAppendedPhrase);
+                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
               }
          });
-       
+
         final Button showRank = new Button(child, SWT.CHECK);
         boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
         showRank.setText("Show rank of the name");
@@ -149,7 +150,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
               }
          });
-               
+
         final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
         boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
         showNomenclaturalRef.setText("Show nomenclatural reference section");
@@ -161,7 +162,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
               }
          });
-               
+
         final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
         boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
         showNomenclaturalStatus.setText("Show nomenclatural status section");
@@ -173,7 +174,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
               }
          });
-               
+
         final Button showProtologue = new Button(child, SWT.CHECK);
         boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
         showProtologue.setText("Show protologue section");
@@ -185,7 +186,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
               }
          });
-        
+
         final Button showTypeDesignation = new Button(child, SWT.CHECK);
         boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
         showTypeDesignation.setText("Show name type designation section");
@@ -197,8 +198,8 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
               }
          });
-               
-               
+
+
         final Button showNameRelationship = new Button(child, SWT.CHECK);
         boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
         showNameRelationship.setText("Show name relationship section");
@@ -207,10 +208,10 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
              @Override
              public void widgetSelected(SelectionEvent e) {
                  boolean isShowNameRelationship = showNameRelationship.getSelection();
-                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowNameRelationship);
+                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
               }
          });
-                               
+
         if(isSimpleDetailsViewActivated){
             child.setEnabled(true);
         }else{
@@ -219,7 +220,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
 
         return composite;
 
-   
+
 
        }
 
index a87139b7eec815166395aa739f6d503da0133502..01563ffdd2f8d0ddf309bd12a2a96a8818a8c332 100644 (file)
@@ -478,6 +478,7 @@ public class PreferencesUtil implements IPreferenceKeys {
                getPreferenceStore().setDefault(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, false);
                getPreferenceStore().setDefault(CHECKLIST_ID_IN_VOCABULARY, true);
                getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, true);
                getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, true);
                getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_HYBRID, true);
                getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_LSID, true);
index 98fc8f938df9c050cbbc874df0b4262b0f45f322..73dde5b92d3fcee3db9334735bc0d68bc4f41b80 100644 (file)
@@ -71,9 +71,8 @@ public class AuthorshipDetailElement extends
                toggleable_cache = formFactory.createToggleableTextField(this,
                                "Authorship Cache", entity.getAuthorshipCache(),
                                entity.isProtectedAuthorshipCache(), style);
-               toggleable_cache.setVisible(false);
-
-           }
+               addElement(toggleable_cache);
+          }
            NomenclaturalCode code = entity.getNomenclaturalCode();
 
            if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP)){
index 250b4b608e601f33ec334f4e719cd0e32c0ce17c..ece23c212635628a1f76745bcf6341a0ca6e8784 100644 (file)
@@ -23,8 +23,6 @@ import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.NameSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
@@ -64,7 +62,7 @@ public class NonViralNameDetailSection extends AbstractCdmDetailSection<NonViral
        protected Control createToolbar() {
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
 
-               if(nameChoosable && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+               if(nameChoosable ){
                    //choose name
                    Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
                        @Override