2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.databaseAdmin
.preferencePage
;
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
;
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
;
32 public class DistributionAdminPreferences
extends CdmPreferencePage
implements IE4AdminPreferencePage
{
34 boolean allowOverride
;
35 CdmPreference pref
= null;
38 protected Control
createContents(Composite parent
) {
39 Composite composite
= new Composite(parent
, SWT
.NULL
);
40 composite
.setLayout(new GridLayout());
43 pref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.AvailableDistributionAreaVocabularies
);
45 allowOverride
= pref
.isAllowOverride();
50 final CLabel label
= new CLabel(composite
, SWT
.NULL
);
51 label
.setText(Messages
.ChecklistEditorGeneralPreference_open_wizard
);
53 final CommandHandlerButton button_openWizard
= new CommandHandlerButton(composite
, SWT
.PUSH
,
54 "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
56 button_openWizard
.setText(Messages
.ChecklistEditorGeneralPreference_open_distribution_selection
);
57 final Button allowOverrideCheckButton
= new Button(composite
, SWT
.CHECK
);
58 allowOverrideCheckButton
.setText(Messages
.ChecklistEditorGeneralPreference_allowOverride
);
59 allowOverrideCheckButton
.setSelection(allowOverride
);
60 allowOverrideCheckButton
.addSelectionListener(new SelectionAdapter(){
62 public void widgetSelected(SelectionEvent e
) {
63 allowOverride
= allowOverrideCheckButton
.getSelection();
69 pref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.AvailableDistributionStatus
);
72 allowOverride
= pref
.isAllowOverride();
75 final CLabel labelStatus
= new CLabel(composite
, SWT
.NULL
);
76 labelStatus
.setText("Select the status which should be available for distribution data.");
78 final CommandHandlerButton button_openStatusWizard
= new CommandHandlerButton(composite
, SWT
.PUSH
,
79 "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler");
81 button_openStatusWizard
.setText(Messages
.Distribution_status_selection
);
82 final Button allowOverrideStatusCheckButton
= new Button(composite
, SWT
.CHECK
);
83 allowOverrideStatusCheckButton
.setText(Messages
.ChecklistEditorGeneralPreference_allowOverride
);
84 allowOverrideStatusCheckButton
.setSelection(allowOverride
);
85 allowOverrideStatusCheckButton
.addSelectionListener(new SelectionAdapter(){
87 public void widgetSelected(SelectionEvent e
) {
88 allowOverride
= allowOverrideStatusCheckButton
.getSelection();