Project

General

Profile

« Previous | Next » 

Revision 1a6c4078

Added by Katja Luther over 6 years ago

enable setPublishFlagForSubtree in edior

View differences:

eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties
46 46
command.name.moveFactualData = Move factual data
47 47
command.label.setSecForSubtree = Set secundum for subtree
48 48
command.name.setSecForSubtree = set secundum for subtree
49
command.label.setPublishForSubtree = Set publish flag for subtree
50
command.name.setPublishForSubtree = Set publish flag for subtree
49 51
wizard.name = TCS
50 52
wizard.name.2 = Excel Normal Explicit Taxa
51 53
wizard.name.3 = ABCD
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties
47 47
command.name.moveFactualData = Verschiebe Faktendaten
48 48
command.label.setSecForSubtree = Setze Secundum f?r Teilbaum
49 49
command.name.setSecForSubtree = Setze Secundum f?r Teilbaum
50
command.label.setPublishForSubtree = Setze Publish Flag f?r Teilbaum
51
command.name.setPublishForSubtree = Setze Publish Flag f?r Teilbaum
50 52
wizard.name = TCS
51 53
wizard.name.2 = Excel Normal Explicit Taxa
52 54
wizard.name.3 = ABCD
eu.etaxonomy.taxeditor.navigation/fragment.e4xmi
27 27
      <handlers xmi:id="_0d3l0JIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CopyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CopyHandlerE4" command="_EJ-u0JIyEeeJAdt8ZUxyaw"/>
28 28
      <handlers xmi:id="_3I_vUJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingChangeAcceptedTaxonToSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingChangeAcceptedTaxonToSynonymHandlerE4" command="_p7Oi8JIxEeeJAdt8ZUxyaw"/>
29 29
      <handlers xmi:id="_6l8-YJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetSecReferenceForSubtreeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetSecReferenceForSubtreeHandlerE4" command="_uFj1YJIxEeeJAdt8ZUxyaw"/>
30
      <handlers xmi:id="_eEul0K5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetPublishFlagForSubtreeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetPublishFlagForSubtreeHandlerE4" command="_Jb45kK5bEeeDTZvTg-vKRg"/>
30 31
      <handlers xmi:id="_-QYowJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewClassificationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewClassificationHandlerE4" command="_Vco-4JIxEeeJAdt8ZUxyaw"/>
31 32
      <handlers xmi:id="_Bc8EUJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4" command="_Nx06MJIvEeeJAdt8ZUxyaw"/>
32 33
      <handlers xmi:id="_GTyegJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveFactualDataHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveFactualDataHandlerE4" command="_3PRy8JIxEeeJAdt8ZUxyaw"/>
......
51 52
        <children xsi:type="menu:MenuSeparator" xmi:id="_ktyqMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.1"/>
52 53
        <children xsi:type="menu:HandledMenuItem" xmi:id="_lALasJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.accTaxonToSynonym" label="%command.label.6" command="_p7Oi8JIxEeeJAdt8ZUxyaw"/>
53 54
        <children xsi:type="menu:HandledMenuItem" xmi:id="_mLjosJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree" label="%command.label.setSecForSubtree" command="_uFj1YJIxEeeJAdt8ZUxyaw"/>
55
        <children xsi:type="menu:HandledMenuItem" xmi:id="_SNIFsK5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree" label="%command.label.setPublishForSubtree" command="_Jb45kK5bEeeDTZvTg-vKRg"/>
54 56
        <children xsi:type="menu:HandledMenuItem" xmi:id="_nh_3MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.moveTaxon" label="%command.label.7" command="_w4RNkJIxEeeJAdt8ZUxyaw"/>
55 57
        <children xsi:type="menu:HandledMenuItem" xmi:id="_o1PAsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.movefactualdata" label="%command.label.moveFactualData" command="_3PRy8JIxEeeJAdt8ZUxyaw"/>
56 58
        <children xsi:type="menu:MenuSeparator" xmi:id="_rBdnsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.2"/>
......
122 124
    <elements xsi:type="commands:Command" xmi:id="_nOOxMJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.cloneClassification" commandName="Clone Classification"/>
123 125
    <elements xsi:type="commands:Command" xmi:id="_p7Oi8JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym" commandName="%command.name.5"/>
124 126
    <elements xsi:type="commands:Command" xmi:id="_uFj1YJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree" commandName="%command.name.setSecForSubtree"/>
127
    <elements xsi:type="commands:Command" xmi:id="_Jb45kK5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigator.command.update.setPublishForSubtree" commandName="%command.name.setPublishForSubtree"/>
125 128
    <elements xsi:type="commands:Command" xmi:id="_w4RNkJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon" commandName="%command.name.2"/>
126 129
    <elements xsi:type="commands:Command" xmi:id="_3PRy8JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.moveFactualData" commandName="%command.name.moveFactualData"/>
127 130
    <elements xsi:type="commands:Command" xmi:id="__n644JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.delete" commandName="%command.name.11"/>
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java
176 176
    public static String TreeNodeDropAdapter_TARGET_NODE;
177 177
    public static String TreeNodeDropAdapter_UNSAVED_PARENT;
178 178
    public static String TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE;
179
    public static String SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP;
179 180

  
180 181

  
181 182
    static {
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties
152 152
TreeNodeDropAdapter_TARGET_NODE=Target node
153 153
TreeNodeDropAdapter_UNSAVED_PARENT=Unsaved Parent Taxon
154 154
TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first.
155
SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Change publish flag for all children
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties
153 153
TreeNodeDropAdapter_UNSAVED_PARENT=Ungespeichertes Eltern-Taxon
154 154
TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=Es gibt ?nderungen in dem Eltern-Taxon. Bitte speichern Sie erst.
155 155

  
156
SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Publish Flag f?r alle Kinder ?ndern
157

  
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetPublishFlagForSubtreeHandlerE4.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.core.commands.operations.AbstractOperation;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.Status;
17
import org.eclipse.e4.core.di.annotations.CanExecute;
18
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
19
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
20
import org.eclipse.e4.ui.services.IServiceConstants;
21
import org.eclipse.jface.viewers.IStructuredSelection;
22
import org.eclipse.jface.viewers.TreeSelection;
23
import org.eclipse.jface.window.Window;
24
import org.eclipse.jface.wizard.WizardDialog;
25
import org.eclipse.swt.widgets.Shell;
26

  
27
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
28
import eu.etaxonomy.cdm.model.taxon.Classification;
29
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
30
import eu.etaxonomy.taxeditor.model.AbstractUtility;
31
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
32
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetPublishForSubtreeOperation;
33
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
34
import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetPublishForSubtreeWizard;
35

  
36
/**
37
 * @author k.luther
38
 * @date 11.10.2017
39
 *
40
 */
41
public class SetPublishFlagForSubtreeHandlerE4 extends RemotingCdmHandlerE4 {
42

  
43
    /**
44
     * @param label
45
     */
46
    public SetPublishFlagForSubtreeHandlerE4(String label) {
47
        super(label);
48
    }
49

  
50

  
51
    private ITaxonTreeNode taxonNode;
52
    private PublishForSubtreeConfigurator configurator;
53

  
54

  
55
    @Override
56
    public IStatus allowOperations(IStructuredSelection selection, Shell shell, MPart activePart,
57
            MHandledMenuItem menuItem) {
58
     // check that only a single taxon tree node has been selected
59
        if(selection.size() > 1) {  }
60

  
61
        // check for no taxon tree node selected
62
        if(selection.size() == 0) {
63
            return new Status(IStatus.ERROR,
64
                    "unknown", //$NON-NLS-1$
65
                    TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
66
        }
67

  
68
        // check that selected object is a taxon node
69
        Object obj = selection.iterator().next();
70
        if(obj instanceof ITaxonTreeNode) {
71
            if (obj instanceof Classification){
72
                taxonNode = ((Classification)obj).getRootNode();
73
            }else{
74
                taxonNode = (ITaxonTreeNode)obj;
75
            }
76
        } else{
77
            return new Status(IStatus.ERROR,
78
                    "unknown", //$NON-NLS-1$
79
                    TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
80
        }
81

  
82

  
83
        // check if corresponding name editor is closed
84
        //FIXME E4 migrate
85
        //           boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) taxonNode);
86
        //           if(editorClosed != true) {
87
        //               return new Status(IStatus.ERROR,
88
        //                       "unknown", //$NON-NLS-1$
89
        //                       TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
90
        //           }
91

  
92
        configurator = new PublishForSubtreeConfigurator(taxonNode.getUuid());
93
        SetPublishForSubtreeWizard wizard = new SetPublishForSubtreeWizard(configurator);
94

  
95
        WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
96

  
97
        if (dialog.open() == Window.OK) {
98
            return Status.OK_STATUS;
99
        }else{
100
            return Status.CANCEL_STATUS;
101
        }
102
    }
103

  
104
    @CanExecute
105
    private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
106
        boolean canExecute = false;
107
        canExecute = selection.getFirstElement() instanceof ITaxonTreeNode;
108
        menuItem.setVisible(canExecute);
109
        return canExecute;
110
    }
111

  
112

  
113
    @Override
114
    public AbstractOperation prepareOperation(IStructuredSelection selection, Shell shell, MPart activePart,
115
            MHandledMenuItem menuItem) {
116
        SetPublishForSubtreeOperation operation =
117
                new SetPublishForSubtreeOperation(getTrigger(),
118
                        false,
119
                        taxonNode.getUuid(),
120
                        configurator);
121

  
122
        return operation;
123
    }
124

  
125

  
126
    @Override
127
    public void onComplete() {
128

  
129
    }
130

  
131

  
132
    @Override
133
    protected Object getTrigger() {
134
        return this;
135
    }
136

  
137
}
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetPublishForSubtreeOperation.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.navigation.navigator.operation;
11

  
12
import java.util.UUID;
13

  
14
import org.apache.log4j.Logger;
15
import org.eclipse.core.runtime.IAdaptable;
16
import org.eclipse.core.runtime.IProgressMonitor;
17

  
18
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
19
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
20
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
21
import eu.etaxonomy.cdm.api.service.UpdateResult;
22
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
23
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
24
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
25
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
26

  
27
/**
28
 * @author k.luther
29
 * @date 11.10.2017
30
 *
31
 */
32
public class SetPublishForSubtreeOperation extends RemotingCdmUpdateOperation {
33

  
34
    private final static String LABEL = Messages.SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP;
35
    private static final Logger logger = Logger
36
            .getLogger(SetPublishForSubtreeOperation.class);
37
    UUID parentUuid;
38
    PublishForSubtreeConfigurator config;
39

  
40
    /**
41
     * @param label
42
     * @param action
43
     * @param source
44
     * @param async
45
     */
46
    public SetPublishForSubtreeOperation(Object source,
47
            boolean async,
48
            UUID taxonNodeUuid,
49
            PublishForSubtreeConfigurator config) {
50
        super(LABEL, Action.Update, source, async);
51
        parentUuid = taxonNodeUuid;
52
        this.config = config;
53
    }
54

  
55

  
56
    /* (non-Javadoc)
57
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
58
     */
59
    @Override
60
    protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
61
        ITaxonNodeService taxonService = CdmApplicationState.getService(ITaxonNodeService.class);
62
//      taxonService.setSecundumForSubtree(config.getSubtreeUuid(), config.getNewSecundum(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isOverwriteExistingAccepted(), config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail(), null);
63
        eu.etaxonomy.cdm.common.monitor.IProgressMonitor cdmMonitor =  CdmProgressMonitorAdapter.CreateMonitor(monitor);
64
        updateResult = taxonService.setPublishForSubtree(config.getSubtreeUuid(), config.isPublish(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isIncludeSharedTaxa(), cdmMonitor);
65
        return updateResult;
66
    }
67

  
68
}
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java
18 18
import org.eclipse.core.runtime.Status;
19 19
import org.eclipse.core.runtime.jobs.Job;
20 20
import org.eclipse.swt.widgets.Display;
21
import org.eclipse.ui.progress.IProgressConstants;
22 21

  
23 22
import eu.etaxonomy.cdm.api.application.CdmApplicationException;
24 23
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
......
27 26
import eu.etaxonomy.cdm.api.service.UpdateResult;
28 27
import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
29 28
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
29
import eu.etaxonomy.taxeditor.model.AbstractUtility;
30 30
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
31 31
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
32 32
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
......
43 43
            .getLogger(SetSecundumForSubtreeOperation.class);
44 44
    UUID parentUuid;
45 45
    SecundumForSubtreeConfigurator config;
46
    UpdateResult updateResult = new UpdateResult();
46

  
47 47

  
48 48
    /**
49 49
     * @param label
......
65 65
     */
66 66
    @Override
67 67
    protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
68
        Job job = createJob(monitor);
69
        // configure the job
70
        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
71
        job.setUser(true);
72
        // schedule job
73
        job.schedule();
68
        runMoniteredOperation();
69

  
70
//        Job job = createJob(monitor);
71
//        // configure the job
72
//        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
73
//        job.setUser(true);
74
//        // schedule job
75
//        job.schedule();
74 76

  
75 77
        return updateResult;
76 78

  
......
121 123
    }
122 124

  
123 125

  
126
    public void runMoniteredOperation() {
127
        ITaxonNodeService nodeService;
128
        try {
129
            nodeService = CdmApplicationState.getService(ITaxonNodeService.class);
130

  
131
            final UUID uuid = nodeService.monitSetSecundum(config);
132
            Display.getDefault().asyncExec(new Runnable() {
133
            @Override
134
            public void run() {
135
                AbstractUtility.executeMoniteredOperation("Set Secundum Reference for Subtree: ",
136
                        uuid,
137
                        1000,
138
                        false,
139
                        SetSecundumForSubtreeOperation.this,
140
                        null);
141
            }
142
        });
143
        } catch (CdmApplicationException e) {
144
            // TODO Auto-generated catch block
145
            e.printStackTrace();
146
        }
147

  
148
    }
124 149

  
125 150

  
126 151

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
287 287
    public static String NameDetailsViewConfiguration_useLocalSettings;
288 288

  
289 289

  
290
    public static String SetPublishConfiguration_Publish;
291
    public static String SetPublishConfiguration_Publish_tooltip;
292
    public static String SetPublishConfiguration_Description_Configurator;
293

  
294

  
295
    public static String SetPublishConfiguration_IncludeAcceptedTaxa;
296
    public static String SetPublishConfiguration_IncludeSharedtaxa;
297
    public static String SetPublishConfiguration_IncludeSynonyms;
298

  
299

  
290 300

  
291 301

  
292 302

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
228 228
NameDetailsViewComposite_Show_Protologue=Protologue section
229 229

  
230 230
NameDetailsViewConfiguration_activateSimpleDetailsView=Show only a simple name details view with the following elements:
231
NameDetailsViewConfiguration_useLocalSettings=Use local settings for display of name details
231
NameDetailsViewConfiguration_useLocalSettings=Use local settings for display of name details
232

  
233
SetPublishConfiguration_Publish=Set Publish Flag
234
SetPublishConfiguration_Publish_tooltip=With set publish flag, the taxa are published in data portal and print publications
235
SetPublishConfiguration_Description_Configurator=Configure where the publish flag should be set
236
SetPublishConfiguration_IncludeAcceptedTaxa=Accepted taxa
237
SetPublishConfiguration_IncludeSharedtaxa=Shared taxa
238
SetPublishConfiguration_IncludeSynonyms=Synonyms
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
228 228
NameDetailsViewComposite_Show_Protologue=Protologue
229 229

  
230 230
NameDetailsViewConfiguration_activateSimpleDetailsView=Zeige nur einen vereinfachten Details view mit folgenden ELementen:
231
NameDetailsViewConfiguration_useLocalSettings=Verwende die lokalen Eigenschaften f?r die Darstellung der Details
231
NameDetailsViewConfiguration_useLocalSettings=Verwende die lokalen Eigenschaften f?r die Darstellung der Details
232

  
233
SetPublishConfiguration_Publish=Setze das Publish Flag
234
SetPublishConfiguration_Publish_tooltip=Wenn das Publish Flag gesetzt ist, werden die Taxa ver?ffentlicht, sowohl im Datenportal als auch bei Print Publikationen
235

  
236
SetPublishConfiguration_Description_Configurator=Konfigurieren Sie, wie das Setzen des Publish Flags durchgef?hrt werden soll.
237
SetPublishConfiguration_IncludeAcceptedTaxa=Akzeptierte Taxa
238
SetPublishConfiguration_IncludeSharedtaxa=Mehrfach verwendete Taxa mit einbeziehen
239
SetPublishConfiguration_IncludeSynonyms=Synonyme
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/PublishSubTreeConfiguratorWizardPage.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.dialog.configurator;
11

  
12
import org.eclipse.core.databinding.DataBindingContext;
13
import org.eclipse.core.databinding.beans.PojoProperties;
14
import org.eclipse.core.databinding.observable.value.IObservableValue;
15
import org.eclipse.jface.databinding.swt.WidgetProperties;
16
import org.eclipse.jface.wizard.WizardPage;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.layout.GridData;
19
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Button;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Display;
23
import org.eclipse.swt.widgets.Event;
24
import org.eclipse.swt.widgets.Listener;
25

  
26
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
27
import eu.etaxonomy.taxeditor.l10n.Messages;
28
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
29

  
30
/**
31
 * @author k.luther
32
 * @date 10.10.2017
33
 *
34
 */
35
public class PublishSubTreeConfiguratorWizardPage extends WizardPage implements Listener {
36

  
37
    private DataBindingContext m_bindingContext;
38

  
39
    private final static CdmFormFactory toolkit = new CdmFormFactory(Display.getCurrent());
40
    private final PublishForSubtreeConfigurator configurator;
41

  
42
    private Button btnIncludeAcceptedTaxa;
43
    private Button btnIncludeSynonyms;
44
    private Button btnIncludeSharedTaxa;
45

  
46
    private Button btnPublish;
47

  
48

  
49
    /**
50
     * @param string
51
     */
52
    public PublishSubTreeConfiguratorWizardPage(PublishForSubtreeConfigurator configurator) {
53
        super("Set Publish Flag Configuration");
54
        this.configurator = configurator;
55
        this.setDescription(Messages.SetPublishConfiguration_Description_Configurator);
56

  
57
    }
58

  
59

  
60

  
61
    /* (non-Javadoc)
62
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
63
     */
64
    @Override
65
    public void createControl(Composite parent) {
66

  
67
        final Composite composite = new Composite(parent, SWT.NULL);
68

  
69
        GridLayout gridLayout = new GridLayout();
70
        gridLayout.numColumns = 1;
71

  
72
        composite.setLayout(gridLayout);
73
        final Composite control = new Composite(composite, SWT.NULL);
74
        GridLayout gridLayoutControl = new GridLayout();
75

  
76
        control.setLayout(gridLayoutControl);
77
        control.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
78
      //  Composite control = toolkit.createComposite(composite);
79
        btnIncludeAcceptedTaxa = new Button(control, SWT.CHECK);
80
        btnIncludeAcceptedTaxa.setText(Messages.SetPublishConfiguration_IncludeAcceptedTaxa);
81
        btnIncludeAcceptedTaxa.setSelection(configurator.isIncludeAcceptedTaxa());
82
        btnIncludeAcceptedTaxa.addListener(SWT.Selection, new Listener() {
83
            @Override
84
         public void handleEvent(Event e) {
85
                Button b = (Button) e.widget;
86
                GridData data = (GridData)  btnIncludeAcceptedTaxa.getLayoutData();
87
                data.exclude = b.getSelection();
88

  
89
                btnIncludeSharedTaxa.setVisible(data.exclude);
90
                if (!btnIncludeSynonyms.getSelection() && !data.exclude){
91
                   setPageComplete(false);
92
                }else{
93
                   setPageComplete(true);
94
                }
95
            }
96
        });
97

  
98

  
99
        btnIncludeSharedTaxa = new Button(control, SWT.CHECK);
100
        GridData gd_btnIncludeSharedTaxa = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
101
        gd_btnIncludeSharedTaxa.horizontalIndent = 10;
102
        btnIncludeSharedTaxa.setLayoutData(gd_btnIncludeSharedTaxa);
103
        btnIncludeSharedTaxa.setText(Messages.SetPublishConfiguration_IncludeSharedtaxa);
104
        btnIncludeSharedTaxa.setSelection(configurator.isIncludeSharedTaxa());
105

  
106
        btnIncludeSynonyms = new Button(control, SWT.CHECK);
107
        btnIncludeSynonyms.setText(Messages.SetPublishConfiguration_IncludeSynonyms);
108
        btnIncludeSynonyms.setSelection(configurator.isIncludeSynonyms());
109
        btnIncludeSynonyms.addListener(SWT.Selection, new Listener() {
110
            @Override
111
         public void handleEvent(Event e) {
112
                Button b = (Button) e.widget;
113
                GridData data = (GridData)  btnIncludeSynonyms.getLayoutData();
114
                data.exclude = b.getSelection();
115

  
116
                if (!btnIncludeAcceptedTaxa.getSelection() && !data.exclude){
117
                   setPageComplete(false);
118
                }else{
119
                   setPageComplete(true);
120
                }
121

  
122
            }
123
        });
124

  
125
        btnPublish = new Button(control, SWT.CHECK);
126
        btnPublish.setText(Messages.SetPublishConfiguration_Publish);
127
        btnPublish.setToolTipText(Messages.SetPublishConfiguration_Publish_tooltip);
128
        btnPublish.setSelection(configurator.isPublish());
129

  
130
        m_bindingContext = initDataBindings();
131
        setControl(composite);
132
    }
133

  
134
    /* (non-Javadoc)
135
     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
136
     */
137
    @Override
138
    public void handleEvent(Event event) {
139
        // TODO Auto-generated method stub
140

  
141
    }
142

  
143
    protected DataBindingContext initDataBindings() {
144
        DataBindingContext bindingContext = new DataBindingContext();
145

  
146
        IObservableValue observeSelectionBtnIncludeAcceptedTaxa = WidgetProperties.selection().observe(btnIncludeAcceptedTaxa);
147
        IObservableValue includeAcceptedTaxaConfiguratorObserveValue = PojoProperties.value("includeAcceptedTaxa").observe(configurator);
148
        bindingContext.bindValue(observeSelectionBtnIncludeAcceptedTaxa, includeAcceptedTaxaConfiguratorObserveValue, null, null);
149

  
150
        IObservableValue observeSelectionBtnIncludeSynonyms = WidgetProperties.selection().observe(btnIncludeSynonyms);
151
        IObservableValue includeSynonymsConfiguratorObserveValue = PojoProperties.value("includeSynonyms").observe(configurator);
152
        bindingContext.bindValue(observeSelectionBtnIncludeSynonyms, includeSynonymsConfiguratorObserveValue, null, null);
153

  
154

  
155
        IObservableValue observeSelectionBtnIncludeSharedTaxal = WidgetProperties.selection().observe(btnIncludeSharedTaxa);
156
        IObservableValue includeSharedTaxaConfiguratorObserveValue = PojoProperties.value("includeSharedTaxa").observe(configurator);
157
        bindingContext.bindValue(observeSelectionBtnIncludeSharedTaxal, includeSharedTaxaConfiguratorObserveValue, null, null);
158

  
159
        IObservableValue observeSelectionBtnPublish = WidgetProperties.selection().observe(btnPublish);
160
        IObservableValue publishConfiguratorObserveValue = PojoProperties.value("publish").observe(configurator);
161
        bindingContext.bindValue(observeSelectionBtnPublish, publishConfiguratorObserveValue, null, null);
162
        return bindingContext;
163

  
164
    }
165
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetPublishForSubtreeWizard.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.dialog.configurator;
11

  
12
import org.eclipse.jface.wizard.Wizard;
13

  
14
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
15

  
16
/**
17
 * @author k.luther
18
 * @date 11.10.2017
19
 *
20
 */
21
public class SetPublishForSubtreeWizard extends Wizard {
22

  
23
    private final PublishForSubtreeConfigurator configurator;
24
    private PublishSubTreeConfiguratorWizardPage page;
25

  
26

  
27
    /**
28
     * @param parentShell
29
     * @param dialogTitle
30
     * @param dialogTitleImage
31
     * @param dialogMessage
32
     * @param dialogImageType
33
     * @param dialogButtonLabels
34
     * @param defaultIndex
35
     * @param config
36
     */
37
    public SetPublishForSubtreeWizard(PublishForSubtreeConfigurator config) {
38
        super();
39
        this.configurator = config;
40
        setNeedsProgressMonitor(true);
41

  
42
    }
43

  
44

  
45

  
46
    /**
47
     * {@inheritDoc}
48
     */
49
    @Override
50
    public boolean performFinish() {
51
       if (!(configurator.isIncludeAcceptedTaxa() || configurator.isIncludeSynonyms())){
52
           return false;
53
       }else{
54
           return true;
55
       }
56
    }
57

  
58
    /* (non-Javadoc)
59
     * @see org.eclipse.jface.wizard.Wizard#addPages()
60
     */
61
    /** {@inheritDoc} */
62
    @Override
63
    public void addPages() {
64
        page = new PublishSubTreeConfiguratorWizardPage(configurator);
65
        addPage(page);
66
    }
67

  
68

  
69

  
70
}

Also available in: Unified diff