Project

General

Profile

Revision 3b975922

ID3b975922fd937a25828c466ef5052050e019d547
Parent 81641aab
Child 329e699e, 0e786079

Added by Katja Luther about 1 year ago

ref #7793: add DB preferences to hide specimen and import issues and smaller changes in db preferences

View differences:

eu.etaxonomy.taxeditor.application/fragment.e4xmi
14 14
        </children>
15 15
        <children xsi:type="menu:MenuSeparator" xmi:id="_BmuOUB63EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.menuseparator.3"/>
16 16
        <children xsi:type="menu:HandledMenuItem" xmi:id="_jE5VoB60EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.import" label="%command.label.3" command="_dlo3oB60EeePLJ5to5QrXQ">
17
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_0UicAB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnected"/>
17
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_0UicAB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
18 18
        </children>
19 19
        <children xsi:type="menu:HandledMenuItem" xmi:id="_xT7KsB61EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.export" label="%command.label.4" command="_CYHrgB62EeePLJ5to5QrXQ">
20
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_21J-oB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnected"/>
20
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_21J-oB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
21 21
        </children>
22 22
        <children xsi:type="menu:MenuSeparator" xmi:id="_XE1yMB62EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.menuseparator.1"/>
23 23
        <children xsi:type="menu:HandledMenuItem" xmi:id="_YM8CsB62EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.save" label="%command.label.1" command="_PkWcQB62EeePLJ5to5QrXQ">
eu.etaxonomy.taxeditor.bulkeditor/fragment.e4xmi
51 51
      </children>
52 52
      <children xsi:type="menu:MenuSeparator" xmi:id="_liWNsKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.7"/>
53 53
      <children xsi:type="menu:HandledMenuItem" xmi:id="_ob4moKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.specimen" label="%handledmenuitem.label.8" tooltip="%handledmenuitem.label.8" command="_Kc-ToCAzEeeepOgM49meig">
54
        <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_sEquQMu6EeiGO4eKaXkw0w"/>
54 55
        <parameters xmi:id="_ob4moaLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.occurrence" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.occurrence"/>
55 56
      </children>
56 57
    </elements>
eu.etaxonomy.taxeditor.navigation/fragment.e4xmi
59 59
        <children xsi:type="menu:HandledMenuItem" xmi:id="_o1PAsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.movefactualdata" label="%command.label.moveFactualData" command="_3PRy8JIxEeeJAdt8ZUxyaw"/>
60 60
        <children xsi:type="menu:MenuSeparator" xmi:id="_rBdnsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.2"/>
61 61
        <children xsi:type="menu:Menu" xmi:id="_T8ey0KkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.menu.import" label="Import">
62
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_7ZtcEMuuEeiGO4eKaXkw0w" coreExpressionId="isShowIOMenuEnabled"/>
62 63
          <children xsi:type="menu:HandledMenuItem" xmi:id="_YMugAKkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSpecimens" label="Import Specimens" command="_yBC78KnJEeeTAPHmaMLwQQ"/>
63 64
          <children xsi:type="menu:HandledMenuItem" xmi:id="_2NC0kKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importAbcd" label="%wizard.name.3" command="_AOq4QKnKEeeTAPHmaMLwQQ"/>
64 65
          <children xsi:type="menu:HandledMenuItem" xmi:id="_3rMNkKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExceldistribution" label="%wizard.name.23" command="_Anfn8KnKEeeTAPHmaMLwQQ">
......
71 72
          <children xsi:type="menu:HandledMenuItem" xmi:id="_7w_lUKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importTcs" label="%wizard.name" command="_LCsbgKnKEeeTAPHmaMLwQQ"/>
72 73
        </children>
73 74
        <children xsi:type="menu:Menu" xmi:id="_rbInwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.menu.export" label="Export">
75
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3qJaEMuuEeiGO4eKaXkw0w" coreExpressionId="isShowIOMenuEnabled"/>
74 76
          <children xsi:type="menu:HandledMenuItem" xmi:id="_tPAZIKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_fQX7EKqhEeeXcJGhyhlrKA"/>
75 77
          <children xsi:type="menu:HandledMenuItem" xmi:id="_xwZgsKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportSdd" label="%wizard.name.8" command="_iaZnEKqhEeeXcJGhyhlrKA"/>
76 78
          <children xsi:type="menu:HandledMenuItem" xmi:id="_zDuJwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportDwca" label="%wizard.name.9" command="_juMxQKqhEeeXcJGhyhlrKA"/>
eu.etaxonomy.taxeditor.navigation/plugin.xml
138 138
         </and>
139 139
      </definition>
140 140
       <definition
141
            id="isCdmStoreConnectedAndShowIOMenuEnabled">
142
         <and>
143
            <reference
144
                  definitionId="isShowIOMenuEnabled">
145
            </reference>
146
            <reference
147
                  definitionId="isCdmStoreConnected">
148
            </reference>
149
         </and>
150
      </definition>
151
       <definition
141 152
            id="isClassification">
142 153
         <test
143 154
               property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isClassification">
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
184 184
command.name.OPEN_REFERENCING_OBJECTS_VIEW = Open Referencing Objects View
185 185
extension.name.1 = Store Workbench Model
186 186
page.name.21 = Distribution Editor Configuration
187
page.name.21 = Distribution Data Configuration
187 188
page.name.40 = ABCD Import Configuration
188 189
page.name.41 = ABCD Import Provider
189 190
page.name.42 = Database Preferences
......
193 194
extension-point.name.0 = Preference Page
194 195
extension-point.name.1 = Admin Preference Page
195 196
page.name.45 = Specimen
196
page.name.46 = Publish Flag
197
page.name.46 = Publish Flag
198
page.name.47 = Vocabulary Selection
199
command.name.111 = Open Admin Distributionstatus-Wizard
200
command.name.112 = Open Admin CommonNameArea-Wizard
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
184 184
partdescriptor.label.featureTreeEditor = Merkmalsbaum-Editor
185 185
command.name.OPEN_REFERENCING_OBJECTS_VIEW = ?ffne Referenzierende Objekte
186 186
page.name.21 = Verbreitungs-Editor
187
page.name.100 = Verbreitungs-Daten
187 188
page.name.40 = ABCD Import
188 189
page.name.41 = Biocase Provider
189 190
page.name.42 = Datenbank Pr?ferenzen
......
193 194
extension-point.name.0 = Pr?ferenzen
194 195
extension-point.name.1 = Admin Pr?ferenzen
195 196
page.name.45 = Specimen
196
page.name.46 = Publish Flag
197
page.name.46 = Publish Flag
198
page.name.47 = Vokabular Auswahl
199
command.name.111 = \u00d6ffne Admin Verbreitungsstatus-Wizard
200
command.name.112 = \u00d6ffne Admin Common Name Areal-Wizard
eu.etaxonomy.taxeditor.store/fragment.e4xmi
132 132
    <elements xsi:type="commands:Command" xmi:id="_AJtnsCHXEeiP8eNo0PEm1g" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.createFeatureTree" commandName="Create feature tree"/>
133 133
    <elements xsi:type="commands:Command" xmi:id="_FTpC0MVSEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler" commandName="%command.name.11"/>
134 134
    <elements xsi:type="commands:Command" xmi:id="_Vs75kMVfEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler" commandName="%command.name.110"/>
135
    <elements xsi:type="commands:Command" xmi:id="_tPtdwMiIEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler" commandName="%command.name.111"/>
136
    <elements xsi:type="commands:Command" xmi:id="_tRsg8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler" commandName="%command.name.112"/>
135 137
  </fragments>
136 138
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
137 139
    <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
......
162 164
    <elements xsi:type="commands:Handler" xmi:id="_H98S8K2tEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.SwitchUserHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.SwitchUserHandlerE4" command="_S868QK2dEeeykrJkROy5EA"/>
163 165
    <elements xsi:type="commands:Handler" xmi:id="_zdDe8BWNEeiazYUJirF0Pw" elementId="eu.etaxonomy.taxeditor.handler.update.UpdateHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.update.UpdateHandler" command="_jSJrsBWPEeiazYUJirF0Pw"/>
164 166
    <elements xsi:type="commands:Handler" xmi:id="_4owEkMVREeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" command="_Vs75kMVfEeiKErB3UVzQug"/>
167
    <elements xsi:type="commands:Handler" xmi:id="_VBYX4MiQEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStausWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardAdminHandler" command="_tPtdwMiIEeiKErB3UVzQug"/>
168
    <elements xsi:type="commands:Handler" xmi:id="_jnQb8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" command="_tRsg8MrcEeiKErB3UVzQug"/>
165 169
  </fragments>
166 170
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
167 171
    <elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="Term Editor">
......
183 187
  </fragments>
184 188
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_ITE10KkVEeejedk4mZQIGw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.file" positionInList="before:eu.etaxonomy.taxeditor.application.filemenu.io">
185 189
    <elements xsi:type="menu:Menu" xmi:id="_z6EugKqXEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.menu.export" label="Export">
186
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3eyLYKqXEeeXcJGhyhlrKA" coreExpressionId="isCdmStoreConnected"/>
190
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3eyLYKqXEeeXcJGhyhlrKA" coreExpressionId="isShowIOMenuEnabled"/>
187 191
      <children xsi:type="menu:HandledMenuItem" xmi:id="_b9E38KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_L0xNEKqYEeeXcJGhyhlrKA"/>
188 192
      <children xsi:type="menu:HandledMenuItem" xmi:id="_lXe84KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportSdd" label="%wizard.name.8" command="_ybovsKqZEeeXcJGhyhlrKA"/>
189 193
      <children xsi:type="menu:HandledMenuItem" xmi:id="_nf4z0KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportDwca" label="%wizard.name.9" command="_y69I8KqZEeeXcJGhyhlrKA"/>
......
193 197
      <children xsi:type="menu:HandledMenuItem" xmi:id="_uruvcKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
194 198
    </elements>
195 199
    <elements xsi:type="menu:Menu" xmi:id="_QC5O8KkaEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.store.menu.import" label="Import">
196
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnected"/>
200
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isShowIOMenuEnabled"/>
197 201
      <children xsi:type="menu:HandledMenuItem" xmi:id="_RUOtQKkVEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.workbench.handledmenuitem.importspecimens" label="%wizard.name.14" command="_TwGSwKkVEeejedk4mZQIGw"/>
198 202
      <children xsi:type="menu:HandledMenuItem" xmi:id="_NO718KmQEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importAbcd" label="%wizard.name.3" command="_QbHeEKmQEeeDJPU_cUTI2g"/>
199 203
      <children xsi:type="menu:HandledMenuItem" xmi:id="_-h0G8KmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExceldistribution" label="%wizard.name.23" command="_tpPnUKmfEeeTAPHmaMLwQQ">
eu.etaxonomy.taxeditor.store/plugin.xml
100 100
         class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
101 101
         id="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
102 102
         namespace="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
103
         properties="isShowExperimentalFeatures, isChecklistEditorEnabled"
103
         properties="isShowExperimentalFeatures, isChecklistEditorEnabled, isShowIOMenuEnabled"
104 104
         type="java.lang.Object">
105 105
   </propertyTester>
106 106
   <propertyTester
......
145 145
      </test>
146 146
   </definition>
147 147
   <definition
148
         id="isShowIOMenuEnabled">
149
      <test
150
            property="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester.isShowIOMenuEnabled">
151
      </test>
152
   </definition>
153
   <definition
148 154
         id="isModifiable">
149 155
      <with
150 156
            variable="selection">
......
239 245
            </reference>
240 246
         </and>
241 247
      </definition>
248
       
242 249
      <definition
243 250
            id="isChecklistEditorEnabled">
244 251
         <test
......
574 581
   </page>  -->
575 582
   <page 
576 583
         category="eu.etaxonomy.taxeditor.preferences.general"
584
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.DistributionAdminPreferences"
585
         id="eu.etaxonomy.taxeditor.store.distribution"
586
         name="%page.name.100">
587
   </page>
588
    <page 
589
         category="eu.etaxonomy.taxeditor.store.distribution"
577 590
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.ChecklistEditorGeneralPreference"
578 591
         id="eu.etaxonomy.taxeditor.store.checklist"
579 592
         name="%page.name.21">
......
590 603
         id="eu.etaxonomy.taxeditor.store.abcdImportProvider"
591 604
         name="%page.name.41">
592 605
   </page>
606
   <page
607
         category="eu.etaxonomy.taxeditor.preferences.general"
608
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.VokabularyAdminPreferences"
609
         id="eu.etaxonomy.taxeditor.store.vocabularyAdminPreference"
610
         name="%page.name.47">
611
   </page>
593 612
    <page
594 613
         category="eu.etaxonomy.taxeditor.preferences.general"
595 614
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.SpecimenAdminPreferences"
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportProvider.java
16 16

  
17 17
import eu.etaxonomy.cdm.api.application.ICdmRepository;
18 18
import eu.etaxonomy.cdm.api.service.IPreferenceService;
19
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
20 19
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
21 20
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
22 21
import eu.etaxonomy.taxeditor.l10n.Messages;
......
30 29
 */
31 30
public class AbcdImportProvider extends CdmPreferencePage implements IE4AdminPreferencePage{
32 31

  
33
    private Abcd206ImportConfigurator configurator;
34

  
35 32
    ListComponent biocaseProviderList;
36 33

  
37 34
    /**
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralPreference.java
9 9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10 10

  
11 11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13 12
import org.eclipse.swt.events.SelectionAdapter;
14 13
import org.eclipse.swt.events.SelectionEvent;
15 14
import org.eclipse.swt.layout.GridLayout;
......
26 25
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
27 26
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
28 27
import eu.etaxonomy.taxeditor.store.CdmStore;
29
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
30 28

  
31 29
/**
32 30
 * @author a.oppermann
......
91 89

  
92 90

  
93 91

  
94
        final CLabel label = new CLabel(child, SWT.NULL);
95
        label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
92
//
96 93

  
97 94

  
98

  
99
        final CommandHandlerButton button_openWizard = new CommandHandlerButton(child, SWT.PUSH,
100
                "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
101

  
102
        button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
95
//
96
//        final CommandHandlerButton button_openWizard = new CommandHandlerButton(child, SWT.PUSH,
97
//                "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
98
//
99
//        button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
103 100

  
104 101
//        Table table = new Table
105 102

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

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.events.SelectionAdapter;
14
import org.eclipse.swt.events.SelectionEvent;
15
import org.eclipse.swt.layout.GridLayout;
16
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Control;
19

  
20
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
21
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
22
import eu.etaxonomy.taxeditor.l10n.Messages;
23
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
25
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
26

  
27
/**
28
 * @author k.luther
29
 * @since 08.10.2018
30
 *
31
 */
32
public class DistributionAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
33

  
34
    boolean allowOverride;
35

  
36
    @Override
37
    protected Control createContents(Composite parent) {
38
        Composite composite = new Composite(parent, SWT.NULL);
39
        composite.setLayout(new GridLayout());
40

  
41

  
42
        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
43
        if (pref != null){
44
            allowOverride = pref.isAllowOverride();
45
        }
46

  
47

  
48

  
49
        final CLabel label = new CLabel(composite, SWT.NULL);
50
        label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
51

  
52
        final CommandHandlerButton button_openWizard = new CommandHandlerButton(composite, SWT.PUSH,
53
                "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
54

  
55
        button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
56
        final Button allowOverrideCheckButton = new Button(composite, SWT.CHECK);
57
        allowOverrideCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
58
        allowOverrideCheckButton.setSelection(allowOverride);
59
        allowOverrideCheckButton.addSelectionListener(new SelectionAdapter(){
60
            @Override
61
            public void widgetSelected(SelectionEvent e) {
62
                allowOverride = allowOverrideCheckButton.getSelection();
63

  
64
            }
65
        });
66

  
67

  
68
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
69

  
70
        if (pref != null){
71
            allowOverride = pref.isAllowOverride();
72
        }
73

  
74
        final CLabel labelStatus = new CLabel(composite, SWT.NULL);
75
        labelStatus.setText("Select the status which should be available for distribution data.");
76

  
77
        final CommandHandlerButton button_openStatusWizard = new CommandHandlerButton(composite, SWT.PUSH,
78
                "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler");
79

  
80
        button_openStatusWizard.setText(Messages.Distribution_status_selection);
81
        final Button allowOverrideStatusCheckButton = new Button(composite, SWT.CHECK);
82
        allowOverrideStatusCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
83
        allowOverrideStatusCheckButton.setSelection(allowOverride);
84
        allowOverrideStatusCheckButton.addSelectionListener(new SelectionAdapter(){
85
            @Override
86
            public void widgetSelected(SelectionEvent e) {
87
                allowOverride = allowOverrideStatusCheckButton.getSelection();
88

  
89
            }
90
        });
91

  
92
        return composite;
93
    }
94

  
95

  
96
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/GeneralAdminPreferencePage.java
9 9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10 10

  
11 11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.events.SelectionAdapter;
13
import org.eclipse.swt.events.SelectionEvent;
12 14
import org.eclipse.swt.layout.GridLayout;
15
import org.eclipse.swt.widgets.Button;
13 16
import org.eclipse.swt.widgets.Composite;
14 17
import org.eclipse.swt.widgets.Control;
15 18

  
19
import eu.etaxonomy.cdm.api.application.ICdmRepository;
20
import eu.etaxonomy.cdm.api.service.IPreferenceService;
21
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
22
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
23
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
24
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
25
import eu.etaxonomy.taxeditor.l10n.Messages;
26
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
16 27
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
28
import eu.etaxonomy.taxeditor.store.CdmStore;
17 29

  
18 30
/**
19 31
 * @author k.luther
......
22 34
 */
23 35
public class GeneralAdminPreferencePage extends CdmPreferencePage implements IE4AdminPreferencePage {
24 36

  
37

  
38
    boolean isShowIOMenu = true;
25 39
    /**
26 40
     * {@inheritDoc}
27 41
     */
......
31 45

  
32 46
        GridLayout gridLayout = new GridLayout();
33 47
        composite.setLayout(gridLayout);
48
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
49
        if (controller != null){
50
            IPreferenceService service = controller.getPreferenceService();
51
            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowImportExportMenu);
52
            CdmPreference isShowSpecimenPref = service.find(key);
53
            if (isShowSpecimenPref != null){
54
                this.isShowIOMenu = Boolean.valueOf(isShowSpecimenPref.getValue());
55
            }
56
        }
57
        final Button showIOMenuButton = new Button(composite, SWT.CHECK);
58

  
59
        showIOMenuButton.setText(Messages.DatabasePreferncesPage_Show_IOMenu);
60

  
61
        showIOMenuButton.setSelection(isShowIOMenu);
62
        showIOMenuButton.addSelectionListener(new SelectionAdapter(){
63
             @Override
64
             public void widgetSelected(SelectionEvent e) {
65
                 isShowIOMenu = showIOMenuButton.getSelection();
66

  
67
              }
68
         });
34 69
        return composite;
35 70
    }
36 71

  
......
40 75
        getControl().setVisible(false);
41 76
    }
42 77

  
78
    @Override
79
    public boolean performOk() {
80
       ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
81
       if (controller != null){
82
           IPreferenceService service = controller.getPreferenceService();
83

  
84
           CdmPreference pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowImportExportMenu, Boolean.toString(this.isShowIOMenu));
85
           pref.setAllowOverride(false);
86
           service.set(pref);
87
           PreferencesUtil.updateDBPreferences();
88

  
89

  
90
       }
91
       return true;
92
   }
93

  
43 94
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewConfiguration.java
62 62
        isSimpleDetailsViewActivated = nameDetailsConfig.isSimpleDetailsViewActivated();
63 63
        activateCheckButton.setSelection(isSimpleDetailsViewActivated);
64 64
        activateCheckButton.addSelectionListener(new SelectionAdapter(){
65
        @Override
66
        public void widgetSelected(SelectionEvent e) {
67
            isSimpleDetailsViewActivated = activateCheckButton.getSelection();
68
           //
69
            if(isSimpleDetailsViewActivated){
70
                dbSettings.setVisible(true);
71
                dbSettings.setEnabled(true);
72
            }else{
73
                dbSettings.setVisible(false);
74
                dbSettings.setEnabled(false);
75
            }
76
         }
65
            @Override
66
            public void widgetSelected(SelectionEvent e) {
67
                isSimpleDetailsViewActivated = activateCheckButton.getSelection();
68
               //
69
                if(isSimpleDetailsViewActivated){
70
                    dbSettings.setVisible(true);
71
                    dbSettings.setEnabled(true);
72
                }else{
73
                    dbSettings.setVisible(false);
74
                    dbSettings.setEnabled(false);
75
                }
76
             }
77 77
         });
78 78

  
79 79

  
......
90 90

  
91 91
        final Button allowLocalPreference = new Button(dbSettings, SWT.CHECK);
92 92
//      boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
93
      allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
94
      isAllowOverride = nameDetailsConfig.isAllowOverride();
95
      allowLocalPreference.setSelection(isAllowOverride);
96
      allowLocalPreference.addSelectionListener(new SelectionAdapter(){
93
        allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
94
        isAllowOverride = nameDetailsConfig.isAllowOverride();
95
        allowLocalPreference.setSelection(isAllowOverride);
96
        allowLocalPreference.addSelectionListener(new SelectionAdapter(){
97 97
           @Override
98 98
           public void widgetSelected(SelectionEvent e) {
99 99
               isAllowOverride = allowLocalPreference.getSelection();
100 100

  
101 101
            }
102
       });
102
        });
103 103
        Label separator= new Label(dbSettings, SWT.HORIZONTAL | SWT.SEPARATOR);
104 104
        separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
105 105
        final Button showTaxon = new Button(dbSettings, SWT.CHECK);
......
288 288
             @Override
289 289
             public void widgetSelected(SelectionEvent e) {
290 290
                 isShowNameApprobiation = showNameApprobiation.getSelection();
291
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
291
                //PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
292 292
              }
293 293
         });
294 294

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java
16 16
import org.eclipse.swt.widgets.Button;
17 17
import org.eclipse.swt.widgets.Composite;
18 18
import org.eclipse.swt.widgets.Control;
19
import org.eclipse.swt.widgets.Label;
19 20

  
20 21
import eu.etaxonomy.cdm.api.application.ICdmRepository;
21 22
import eu.etaxonomy.cdm.api.service.IPreferenceService;
......
24 25
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
25 26
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
26 27
import eu.etaxonomy.taxeditor.l10n.Messages;
28
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
27 29
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
28 30
import eu.etaxonomy.taxeditor.store.CdmStore;
29 31

  
......
33 35
 *
34 36
 */
35 37
public class SpecimenAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
38
    public SpecimenAdminPreferences() {
39
    }
36 40

  
37 41

  
38

  
42
    boolean isShowSpecimenRelatedIssues;
39 43
    boolean isShowCollectingAreaInGeneralSection;
40 44
    boolean isDeterminationOnlyForFieldUnits;
41 45
    boolean isShowTaxonAssociation;
42 46
    boolean isShowLifeForm;
43 47
    boolean isUseLocalPreference;
44

  
48
    Composite composite;
45 49

  
46 50
    @Override
47 51
    protected Control createContents(Composite parent) {
48
        Composite composite = new Composite(parent, SWT.NULL);
52

  
49 53
        getValues();
54

  
55

  
56
        final Button showSpecimenButton = new Button(parent, SWT.CHECK);
57

  
58
        showSpecimenButton.setText(Messages.DatabasePreferncesPage_Show_Specimen);
59

  
60
        showSpecimenButton.setSelection(isShowSpecimenRelatedIssues);
61
        showSpecimenButton.addSelectionListener(new SelectionAdapter(){
62
             @Override
63
             public void widgetSelected(SelectionEvent e) {
64
                 isShowSpecimenRelatedIssues = showSpecimenButton.getSelection();
65
                 if(isShowSpecimenRelatedIssues){
66
                     composite.setVisible(true);
67
                     composite.setEnabled(true);
68
                 }else{
69
                     composite.setVisible(false);
70
                     composite.setEnabled(false);
71
                 }
72
              }
73
         });
74
        composite = new Composite(parent, SWT.NULL);
50 75
        GridLayout gridLayout = new GridLayout();
51 76
        composite.setLayout(gridLayout);
77
        composite.setEnabled(isShowSpecimenRelatedIssues);
78
        Label separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
79
        separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
80

  
52 81
        final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
53 82

  
54 83
        showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
......
71 100
             @Override
72 101
             public void widgetSelected(SelectionEvent e) {
73 102
                 isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
74
                               }
103
             }
75 104
         });
76 105

  
77 106
        final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
......
134 163
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
135 164
        if (controller != null){
136 165
            IPreferenceService service = controller.getPreferenceService();
137
            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
166
            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowSpecimen);
167
            CdmPreference isShowSpecimenPref = service.find(key);
168
            if (isShowSpecimenPref != null){
169
                this.isShowSpecimenRelatedIssues = Boolean.valueOf(isShowSpecimenPref.getValue());
170
            }
171

  
172

  
173
            key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
138 174
            CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
139 175
            if (isShowCollectingAreaInGeneralSectionPref != null){
140 176
                this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
......
185 221
            pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
186 222
            pref.setAllowOverride(isUseLocalPreference);
187 223
            service.set(pref);
224
            PreferencesUtil.updateDBPreferences();
188 225

  
189 226

  
190 227
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/VokabularyAdminPreferences.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.events.SelectionAdapter;
14
import org.eclipse.swt.events.SelectionEvent;
15
import org.eclipse.swt.layout.GridLayout;
16
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Control;
19

  
20
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
21
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
22
import eu.etaxonomy.taxeditor.l10n.Messages;
23
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
25
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
26

  
27
/**
28
 * @author k.luther
29
 * @since 05.10.2018
30
 *
31
 */
32
public class VokabularyAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
33

  
34
    boolean allowOverride;
35

  
36

  
37

  
38
    @Override
39
    protected Control createContents(Composite parent) {
40

  
41
        Composite composite = new Composite(parent, SWT.NULL);
42
        composite.setLayout(new GridLayout());
43

  
44
        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
45

  
46
        if (pref != null){
47
            allowOverride = pref.isAllowOverride();
48
        }
49

  
50
        final CLabel commonNameAreaLabel = new CLabel(composite, SWT.NULL);
51
        commonNameAreaLabel.setText("Select the area vocabularies which should be available for common names.");
52

  
53
        final CommandHandlerButton button_opencommonNameAreaWizard = new CommandHandlerButton(composite, SWT.PUSH,
54
                "eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler");
55

  
56
        button_opencommonNameAreaWizard.setText(Messages.GeneralPreference_open_common_name_area_selection);
57
        final Button allowOverrideCommonNameAreaCheckButton = new Button(composite, SWT.CHECK);
58
        allowOverrideCommonNameAreaCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
59
        allowOverrideCommonNameAreaCheckButton.setSelection(allowOverride);
60
        allowOverrideCommonNameAreaCheckButton.addSelectionListener(new SelectionAdapter(){
61
            @Override
62
            public void widgetSelected(SelectionEvent e) {
63
                allowOverride = allowOverrideCommonNameAreaCheckButton.getSelection();
64

  
65
            }
66
        });
67

  
68
        return composite;
69
    }
70

  
71

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

  
11
import javax.inject.Named;
12

  
13
import org.eclipse.e4.core.di.annotations.Execute;
14
import org.eclipse.e4.ui.services.IServiceConstants;
15
import org.eclipse.jface.wizard.WizardDialog;
16
import org.eclipse.swt.widgets.Shell;
17

  
18
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21
import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
22

  
23
/**
24
 * @author k.luther
25
 * @since 08.10.2018
26
 *
27
 */
28
public class OpenCommonNameAreaWizardAdminHandler {
29
    String commandID = "eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler";
30

  
31
    @Execute
32
    public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
33
        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
34
        if (pref == null){
35
            pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.CommonNameAreaVocabularies, null);
36
        }
37
        AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(false, pref, "Common Names");
38

  
39
        WizardDialog dialog = new WizardDialog(shell,
40
                wizard);
41

  
42
        dialog.open();
43
    }
44
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionEditorWizardHandlerAdminE4.java
15 15
import org.eclipse.jface.wizard.WizardDialog;
16 16
import org.eclipse.swt.widgets.Shell;
17 17

  
18
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
18 21
import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
19 22

  
20 23
/**
......
29 32

  
30 33
        @Execute
31 34
        public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
32

  
33
            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(false);
35
            CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
36
            if (pref == null){
37
                pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
38
            }
39
            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(false, pref, "Distribution");
34 40

  
35 41
            WizardDialog dialog = new WizardDialog(shell,
36 42
                    wizard);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionEditorWizardHandlerE4.java
30 30
        @Execute
31 31
        public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
32 32

  
33
            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true);
33
            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true, null, "Distribution");
34 34

  
35 35
            WizardDialog dialog = new WizardDialog(shell,
36 36
                    wizard);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionStatusWizardAdminHandler.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.handler.e4;
10

  
11
import javax.inject.Named;
12

  
13
import org.eclipse.e4.core.di.annotations.Execute;
14
import org.eclipse.e4.ui.services.IServiceConstants;
15
import org.eclipse.jface.wizard.WizardDialog;
16
import org.eclipse.swt.widgets.Shell;
17

  
18
import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionStatusWizard;
19

  
20
/**
21
 * @author k.luther
22
 * @since 05.10.2018
23
 *
24
 */
25
public class OpenDistributionStatusWizardAdminHandler {
26
    String commandID = "eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardAdminHandler";
27

  
28
    @Execute
29
    public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
30

  
31
        AvailableDistributionStatusWizard wizard = new AvailableDistributionStatusWizard();
32

  
33
        WizardDialog dialog = new WizardDialog(shell,
34
                wizard);
35

  
36
        dialog.open();
37
    }
38
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
431 431

  
432 432
    public static String DateDetail_parseText_tooltip;
433 433

  
434

  
435
    public static String GeneralPreference_open_common_name_area_selection;
436

  
437

  
438
    public static String DatabasePreferncesPage_Show_Specimen;
439

  
440

  
441
    public static String SpecimenConfiguration_description;
442

  
443

  
444
    public static String DatabasePreferncesPage_Show_IOMenu;
445

  
446

  
447
    public static String Distribution_status_selection;
448

  
434 449
    static {
435 450
        // initialize resource bundle
436 451
        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
331 331

  
332 332
DateDetail_parseText_tooltip=This field is for quick data entry. The content is parsed and the atomised fields will be filled, the content of this field will not be saved.
333 333

  
334
GeneralPreference_open_common_name_area_selection=Selection of vocabularies for common name distributions
335

  
336
DatabasePreferncesPage_Show_Specimen=Show specimen related views and menu entries
337
SpecimenConfiguration_description=Select whether you want to edit specimen related data and how they should be displayed.
338
DatabasePreferncesPage_Show_IOMenu=Show Import/Export menu entries
339
Distribution_status_selection=Status Selection
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
330 330

  
331 331
DateDetail_parseText_tooltip=Dieses Feld ist f?r die schnelle Dateneingabe. Der Inhalt des Feldes wird geparsed und in die atomisierten Felder geschrieben. Der Inhalt des Feldes selber wird nicht gespeichert.
332 332

  
333
GeneralPreference_open_common_name_area_selection=Auswahl der Vokabulare f?r die Verbreitung der Common Names
334

  
335
DatabasePreferncesPage_Show_Specimen=Zeige Specimenbezogene Views und Men?eintrg?ge
336
SpecimenConfiguration_description=W?hlen Sie aus, ob sie specimenbezogene Daten editieren wollen und wie diese angezeigt werden sollen.
337
DatabasePreferncesPage_Show_IOMenu=Zeige Import/Export Men? Eintr?ge an
338
Distribution_status_selection=Status Auswahl
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminGeneralPreferences.java
34 34
                IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES,
35 35
                "Show experimental features", getFieldEditorParent()));
36 36

  
37

  
37 38
    }
38 39

  
39 40
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java
38 38
    boolean isShowSymbol;
39 39
    boolean isShowIdInVocabulary;
40 40
    Composite child ;
41
    boolean isAllowOverride;
41 42

  
42 43
    @Override
43 44
    protected Control createContents(Composite parent) {
......
46 47
        composite.setLayout(new GridLayout());
47 48

  
48 49
        CdmPreference distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated);
49
        boolean isAllowOverride = false;
50
        isAllowOverride = false;
50 51
            if (distributionEditorPref != null){
51 52
                isAllowOverride = distributionEditorPref.isAllowOverride();
52 53
            }
......
142 143

  
143 144
    @Override
144 145
    public boolean performOk() {
145
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated);
146
        PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
147
        PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
148
        PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol);
149
        PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary);
146
        if (isAllowOverride){
147
            PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated);
148
            PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
149
            PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
150
            PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol);
151
            PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary);
152
        }
150 153
        return true;
151 154
    }
152 155

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
136 136
    public static final String SHOW_LIFE_FORM = "eu.etaxonomy.taxeditor.specimen.showLifeForm";
137 137
    public static final String SHOW_LIFE_FORM_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showLifeForm.override";
138 138
    public static final String SHOW_LIFE_FORM_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showLifeForm.allowOverride";
139

  
140
    public static final String ALLOW_OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.allowOverride";
141
    public static final String OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.override";
139
    public static final String SHOW_SPECIMEN = "eu.etaxonomy.taxeditor.specimen.showSpecimen";
140
    public static final String SHOW_SPECIMEN_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showSpecimen.allowOverride";
141
    public static final String SHOW_SPECIMEN_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showSpecimen.override";
142 142

  
143 143
    //Distribution Editor preferences
144 144
    public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
......
152 152
    public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActiveOverride";
153 153
    public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActiveAllowOverride";
154 154

  
155
    public static final String DISTRIBUTION_STATUS_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.status";
156

  
157
    public static final String COMMON_NAME_AREA_VOCABULARIES = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies";
158
    public static final String COMMON_NAME_AREA_VOCABULARIES_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies.allowOverride";
159
    public static final String COMMON_NAME_AREA_VOCABULARIES_OVERRIDE = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies.override";
155 160
//Name details view
156 161
    public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName";
157 162
    public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon";
......
236 241
    public static final String PUBLISH = "PUBLISH";
237 242

  
238 243
    public static final String FILTER_COMMON_NAME_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.filterCommonNameReferences";
244
    public static final String SHOW_IO_MENU = "eu.etaxonomy.taxeditor.menu.showIO";
239 245

  
240 246

  
241 247

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencePropertyTester.java
23 23

  
24 24
    private static final String SHOW_CHECKLIST_EDITOR = "isChecklistEditorEnabled";
25 25

  
26
    private static final String SHOW_IO_MENU = "isShowIOMenuEnabled";
27

  
26 28
	@Override
27 29
	public boolean test(Object receiver, String property, Object[] args,
28 30
			Object expectedValue) {
......
32 34
	    if(SHOW_CHECKLIST_EDITOR.equals(property)){
33 35
	        return isChecklistEditorEnabled();
34 36
	    }
37
	    if(SHOW_IO_MENU.equals(property)){
38
            return isShowIOMenuEnabled();
39
        }
35 40
		return false;
36 41
	}
37 42

  
......
45 50
	private boolean isChecklistEditorEnabled() {
46 51
        return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
47 52
    }
53
	private boolean isShowIOMenuEnabled() {
54
        return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_IO_MENU);
55
    }
48 56

  
49 57
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
45 45
import eu.etaxonomy.cdm.common.CdmUtils;
46 46
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
47 47
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
48
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
48 49
import eu.etaxonomy.cdm.model.common.ICdmBase;
49 50
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
50 51
import eu.etaxonomy.cdm.model.common.ISimpleTerm;
51 52
import eu.etaxonomy.cdm.model.common.Language;
52 53
import eu.etaxonomy.cdm.model.common.MarkerType;
53 54
import eu.etaxonomy.cdm.model.common.TermBase;
55
import eu.etaxonomy.cdm.model.common.TermType;
54 56
import eu.etaxonomy.cdm.model.description.FeatureTree;
55 57
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
56 58
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
......
65 67
import eu.etaxonomy.taxeditor.model.MessagingUtils;
66 68
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
67 69
import eu.etaxonomy.taxeditor.store.CdmStore;
70
import eu.etaxonomy.taxeditor.store.TermStore;
68 71
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
69 72
import eu.etaxonomy.taxeditor.ui.dialog.DefaultLanguageDialog;
70 73

  
......
211 214
    }
212 215

  
213 216
	public static boolean isShowTaxonAssociations(){
214
        if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
217
        if (getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS_OVERRIDE) && getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS_ALLOW_OVERRIDE)) {
215 218
            return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS);
216 219
        } else{
217 220
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
......
221 224
    }
222 225

  
223 226
	public static boolean isShowLifeForm(){
224
        if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
227
        if (getPreferenceStore().getBoolean(SHOW_LIFE_FORM_OVERRIDE) && getPreferenceStore().getBoolean(SHOW_LIFE_FORM_ALLOW_OVERRIDE)) {
225 228
            return getPreferenceStore().getBoolean(SHOW_LIFE_FORM);
226 229
        } else{
227 230
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
......
231 234
    }
232 235

  
233 236
	public static boolean isDeterminationOnlyForFieldUnits(){
234
        if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
237
        if (getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS_OVERRIDE) && getPreferenceStore().getBoolean(DETERMINATIONS_ONLY_FOR_FIELDUNITS_ALLOW_OVERRIDE)) {
235 238
            return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS);
236 239
        } else{
237 240
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
......
241 244
    }
242 245

  
243 246
	public static boolean isCollectingAreaInGeneralSection(){
244
        if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
247
        if (getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_OVERRIDE) && getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_ALLOW_OVERRIDE)) {
245 248
            return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
246 249
        } else{
247 250
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
......
597 600
		getPreferenceStore().setDefault(SORT_TAXA_BY_RANK_AND_NAME, true);
598 601
		//override db preferences
599 602
		getPreferenceStore().setDefault(ABCD_IMPORT_OVERRIDE, false);
600
		getPreferenceStore().setDefault(OVERRIDE_SPECIMEN_PREF, false);
603
		getPreferenceStore().setDefault(SHOW_SPECIMEN_OVERRIDE, false);
601 604
		getPreferenceStore().setDefault(OVERRIDE_NAME_DETAILS, false);
602 605
		getPreferenceStore().setDefault(DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE, false);
603 606
		getPreferenceStore().setDefault(FILTER_COMMON_NAME_REFERENCES, false);
......
1605 1608

  
1606 1609
    updateAbcdImportConfigurationPreference();
1607 1610

  
1611
    preference = getPreferenceFromDB(PreferencePredicate.ShowImportExportMenu);
1612
    if (preference != null){
1613
        if(!prefStore.getBoolean(SHOW_IO_MENU) ||  !preference.isAllowOverride()){
1614
            prefStore.setValue(SHOW_IO_MENU, preference.getValue());
1615
        }
1616
    }
1608 1617
    //Specimen Details
1618
    preference = getPreferenceFromDB(PreferencePredicate.ShowSpecimen);
1619
    if (preference != null){
1620
        if(!prefStore.getBoolean(SHOW_SPECIMEN) ||  !preference.isAllowOverride()){
1621
            prefStore.setValue(SHOW_SPECIMEN, preference.getValue());
1622
        }
1623
    }
1624

  
1609 1625
    preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
1610 1626
    if (preference != null){
1611 1627
        if(!prefStore.getBoolean(SHOW_TAXON_ASSOCIATIONS_OVERRIDE) ||  !preference.isAllowOverride()){
......
1655 1671
        }
1656 1672
    }
1657 1673

  
1674
    preference = getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
1675
    if (preference != null){
1676
        if (!prefStore.getBoolean(DISTRIBUTION_STATUS_OVERRIDE) || !preference.isAllowOverride()){
1677
            //get terms for the uuids... and add them to the termManager as preferred terms
1678
            ITermService termService = CdmStore.getService(ITermService.class);
1679
            String[] uuidArray = preference.getValue().split(";");
1680
            List<UUID> uuidList = new ArrayList();
1681
            for (String uuidString:uuidArray){
1682
                uuidList.add(UUID.fromString(uuidString));
1683
            }
1684

  
1685
            List<DefinedTermBase> definedTermBases = termService.load(uuidList, null);
1686
            CdmStore.getTermManager().setPreferredTerms(definedTermBases, TermStore.getTerms(TermType.PresenceAbsenceTerm, null));
1687
        }
1688
    }
1689

  
1690
    preference = getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
1691
    if (preference != null){
1692
        if (!prefStore.getBoolean(COMMON_NAME_AREA_VOCABULARIES_OVERRIDE) ||  !preference.isAllowOverride()){
1693
            prefStore.setValue(COMMON_NAME_AREA_VOCABULARIES, preference.getValue());
1694
        }
1695
    }
1696

  
1658 1697
}
1659 1698

  
1660 1699

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
72 72

  
73 73
    @Override
74 74
    protected void createFieldEditors() {
75
        if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF)) {
75
        if (getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SPECIMEN_ALLOW_OVERRIDE)) {
76 76
            addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
77 77
                    "Taxon determination only on FieldUnit level",
78 78
                    getFieldEditorParent()));
......
90 90
            label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
91 91

  
92 92
            addField(new BooleanFieldEditor(
93
                    IPreferenceKeys.OVERRIDE_SPECIMEN_PREF,
93
                    IPreferenceKeys.SHOW_SPECIMEN_OVERRIDE,
94 94
                    "Use local specimen preferences",
95 95
                    getFieldEditorParent()));
96 96

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

  
11
import java.util.ArrayList;
12
import java.util.Arrays;
13
import java.util.HashSet;
14
import java.util.List;
15
import java.util.Set;
16
import java.util.UUID;
17

  
18
import org.apache.commons.lang.StringUtils;
19
import org.eclipse.jface.viewers.ColumnViewer;
20
import org.eclipse.jface.wizard.WizardPage;
21
import org.eclipse.swt.widgets.Composite;
22

  
23
import eu.etaxonomy.cdm.api.service.ITermService;
24
import eu.etaxonomy.cdm.api.service.IVocabularyService;
25
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
26
import eu.etaxonomy.cdm.model.common.TermBase;
27
import eu.etaxonomy.cdm.model.common.TermType;
28
import eu.etaxonomy.cdm.model.common.TermVocabulary;
29
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
30
import eu.etaxonomy.taxeditor.store.CdmStore;
31

  
32
/**
33
 * @author k.luther
34
 * @since 04.06.2018
35
 *
36
 */
37
public abstract class AbstractAreaSelectionWizard extends WizardPage {
38

  
39
    private ColumnViewer viewer;
40
    private List<TermVocabulary<DefinedTermBase>> vocabularies = new ArrayList<>();
41
    boolean localPref;
42
    List<TermBase> listCheckedTerms;
43
    List<TermBase> listGrayedTerms;
44

  
45
    /**
46
     * @param pageName
47
     */
48
    protected AbstractAreaSelectionWizard(String pageName) {
49
        super(pageName);
50
        // TODO check if configuration exists
51
        CdmStore.getCurrentSessionManager().bindNullSession();
52
    }
53

  
54
    /**
55
     * {@inheritDoc}
56
     */
57
    @Override
58
    public abstract void createControl(Composite parent) ;
59

  
60
    public ColumnViewer getViewer() {
61
        return viewer;
62
    }
63

  
64
    public void setViewer(ColumnViewer viewer) {
65
        this.viewer = viewer;
66
    }
67

  
68
    public List<TermVocabulary<DefinedTermBase>> getVocabularies() {
69
        return vocabularies;
70
    }
71

  
72
    public void addVocabularies(TermVocabulary<DefinedTermBase> vocabulary) {
73
        this.vocabularies.add(vocabulary);
74
    }
75

  
76

  
77
    /**
78
     * @param vocs
79
     */
80
    protected void setVocabularies(List<TermVocabulary<DefinedTermBase>> vocs) {
81
        for (TermVocabulary voc:vocs){
82
            vocabularies.add(voc);
83
        }
84
    }
85

  
86
    public List<TermBase> getListCheckedTerms() {
87
        return listCheckedTerms;
88
    }
89

  
90
    public List<TermBase> getListGrayedTerms() {
91
        return listGrayedTerms;
92
    }
93

  
94
    protected void rememberCheckedValues(String checkedValues, String grayedValues) {
95
        initialiseVocabularies();
96
        getViewer().setInput(getVocabularies());
97

  
98
        if (grayedValues != null && grayedValues != "") {
99
            String[] arrayGrayed = grayedValues.split(";");
100
            List<String> listGrayed = Arrays.asList(arrayGrayed);
101
            if (listGrayedTerms == null){
102
                listGrayedTerms = new ArrayList();
103
            }
104
            getTermsFromStringValues(listGrayed, this.listGrayedTerms);
105
            NamedAreaWrapper wrapper;
106
//            for(TermBase element : listGrayedTerms){
107
//                if(element != null){
108
//                    if (element instanceof DefinedTermBase){
109
//                        wrapper = new NamedAreaWrapper((DefinedTermBase)element, true, null);
110
//                        if (getViewer() instanceof CheckboxTreeViewer) {
111
//                            ((CheckboxTreeViewer)getViewer()).setGrayChecked(wrapper, true);
112
//                        }
113
//                    }else{
114
//                        if (getViewer() instanceof CheckboxTreeViewer) {
115
//                            ((CheckboxTreeViewer)getViewer()).setGrayChecked(element, true);
116
//                        }
117
//                    }
118
//                }
119
//
120
//            }
121
        }
122
        if (checkedValues != null && checkedValues != "") {
123
            String[] listChecked = checkedValues.split(";");
124
            String[] listCheckedComma = checkedValues.split(",");
125
            List<String> checked = new ArrayList<>();
126
            if (listChecked != null ){
127
                checked = Arrays.asList(listChecked);
128
            }
129
            if (listCheckedComma != null && checkedValues.contains(",")){
130
                checked = Arrays.asList(listCheckedComma);
131
            }
132
            if (listCheckedTerms == null){
133
                listCheckedTerms = new ArrayList();
134
            }
135
            getTermsFromStringValues(checked, listCheckedTerms);
136

  
137
//            Object[] elements = ((CheckboxTreeViewer)getViewer()).getExpandedElements();
138
//            for (Object element: elements){
139
//                if (element instanceof NamedAreaWrapper){
140
//                    if (listCheckedTerms.contains(((NamedAreaWrapper)element).getNamedArea())){
141
//                        ((CheckboxTreeViewer)getViewer()).setChecked(element, true);
142
//                    }
143
//                    if (listGrayedTerms.contains(((NamedAreaWrapper)element).getNamedArea())){
144
//                        ((CheckboxTreeViewer)getViewer()).setGrayChecked(element, true);
145
//                    }
146
//                }
147
//            }
148
            NamedAreaWrapper wrapper;
149
//            for(Object element : listCheckedTerms){
150
//                if(element != null){
151
//                    if (element instanceof DefinedTermBase){
152
//                        wrapper = new NamedAreaWrapper((DefinedTermBase)element, true, null);
153
//                        if (getViewer() instanceof CheckboxTreeViewer) {
154
//                            ((CheckboxTreeViewer)getViewer()).setChecked(wrapper, true);
155
//                        }
156
//                    }else{
157
//                        if (getViewer() instanceof CheckboxTreeViewer) {
158
//                            ((CheckboxTreeViewer)getViewer()).setChecked(element, true);
159
//                        }
160
//                    }
161
//                }
162
//            }
163
        }
164
    }
165

  
166
    /**
167
     * @param split
168
     * @param termlist
169
     */
170
    private void getTermsFromStringValues(List<String> listValue, List<TermBase> termlist) {
171

  
172
        for (String s : listValue) {
173
            if (!StringUtils.isBlank(s)){
174
                UUID uuid = UUID.fromString(s);
175
                ITermService termService = CdmStore.getService(ITermService.class);
176
                DefinedTermBase definedTermBase = termService.load(uuid);
177
                if(definedTermBase != null){
178
                    termlist.add(definedTermBase);
179
                }else{
180
                    IVocabularyService vocabularyService = CdmStore.getService(IVocabularyService.class);
181
                    TermVocabulary termVocabulary = vocabularyService.load(uuid);
182
                    termlist.add(termVocabulary);
183
                }
184
            }
185
        }
186
    }
187

  
188

  
189
    protected void initialiseVocabularies() {
190
        if (getVocabularies() != null) {
191
            getVocabularies().clear();
192
        }
193
        List<TermVocabulary<DefinedTermBase>> vocs = new ArrayList<>();
194
        if (localPref){
195
            String vocString = PreferencesUtil.getPreferenceStore().getString(PreferencesUtil.DISTRIBUTION_VOCABULARIES);
196
            String[] arrayVocs = vocString.split(";");
197

  
198
            Set<UUID> uuidVocs = new HashSet();
199
            for (String voc: arrayVocs){
200
                if (!StringUtils.isBlank(voc)){
201
                    uuidVocs.add(UUID.fromString(voc));
202
                }
203
            }
204
            List<TermVocabulary> tempVocs = CdmStore.getService(IVocabularyService.class).find(uuidVocs);
205
            for (TermVocabulary voc: tempVocs){
206
                vocs.add(voc);
207
            }
208

  
209
        }else{
210
            vocs = CdmStore.getService(IVocabularyService.class).findByTermType(
211
                    TermType.NamedArea, null);
212
        }
213
        setVocabularies(vocs);
214
    }
215

  
216

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

  
11
import java.util.ArrayList;
12
import java.util.Arrays;
13
import java.util.HashSet;
14
import java.util.List;
15
import java.util.Set;
16
import java.util.UUID;
17

  
18
import org.apache.commons.lang.StringUtils;
19
import org.eclipse.jface.viewers.ColumnViewer;
20
import org.eclipse.jface.wizard.WizardPage;
21
import org.eclipse.swt.widgets.Composite;
22

  
23
import eu.etaxonomy.cdm.api.service.ITermService;
24
import eu.etaxonomy.cdm.api.service.IVocabularyService;
25
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
26
import eu.etaxonomy.cdm.model.common.TermBase;
27
import eu.etaxonomy.cdm.model.common.TermType;
28
import eu.etaxonomy.cdm.model.common.TermVocabulary;
29
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
30
import eu.etaxonomy.taxeditor.store.CdmStore;
31

  
32
/**
33
 * @author k.luther
34
 * @since 04.06.2018
35
 *
36
 */
37
public abstract class AbstractTermSelectionWizardPage extends WizardPage {
38

  
39
    private ColumnViewer viewer;
40
    private List<TermVocabulary<DefinedTermBase>> vocabularies = new ArrayList<>();
41
    boolean localPref;
42
    List<TermBase> listCheckedTerms = new ArrayList<>();
43
    List<TermBase> listGrayedTerms = new ArrayList<>();
44

  
45
    TermType type;
46

  
47
    /**
48
     * @param pageName
49
     */
50
    protected AbstractTermSelectionWizardPage(String pageName, TermType type) {
51
        super(pageName);
52
        // TODO check if configuration exists
53
        CdmStore.getCurrentSessionManager().bindNullSession();
54
        this.type = type;
55
    }
56

  
57
    /**
58
     * {@inheritDoc}
59
     */
60
    @Override
61
    public abstract void createControl(Composite parent) ;
62

  
63
    public ColumnViewer getViewer() {
64
        return viewer;
65
    }
66

  
67
    public void setViewer(ColumnViewer viewer) {
68
        this.viewer = viewer;
69
    }
70

  
71
    public List<TermVocabulary<DefinedTermBase>> getVocabularies() {
72
        return vocabularies;
73
    }
74

  
75
    public void addVocabularies(TermVocabulary<DefinedTermBase> vocabulary) {
76
        this.vocabularies.add(vocabulary);
77
    }
78

  
79

  
80
    /**
81
     * @param vocs
82
     */
83
    protected void setVocabularies(List<TermVocabulary<DefinedTermBase>> vocs) {
84
        for (TermVocabulary voc:vocs){
85
            vocabularies.add(voc);
86
        }
87
    }
88

  
89
    public List<TermBase> getListCheckedTerms() {
90
        return listCheckedTerms;
91
    }
92

  
93
    public List<TermBase> getListGrayedTerms() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)