Revision 198c9340
Added by Katja Luther almost 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.taxeditor.preference; |
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.events.SelectionListener; |
... | ... | |
19 | 18 |
import org.eclipse.swt.widgets.Combo; |
20 | 19 |
import org.eclipse.swt.widgets.Composite; |
21 | 20 |
import org.eclipse.swt.widgets.Control; |
22 |
import org.eclipse.swt.widgets.Event; |
|
23 | 21 |
import org.eclipse.swt.widgets.Label; |
24 |
import org.eclipse.swt.widgets.Listener; |
|
25 | 22 |
|
26 | 23 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
27 | 24 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
... | ... | |
30 | 27 |
import eu.etaxonomy.cdm.model.metadata.TermOrder; |
31 | 28 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
32 | 29 |
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage; |
33 |
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton; |
|
34 | 30 |
|
35 | 31 |
/** |
36 | 32 |
* @author a.oppermann |
... | ... | |
68 | 64 |
protected Button allowOverrideStatusDisplayInComboButton; |
69 | 65 |
protected Combo areaDisplaySelectionCombo; |
70 | 66 |
protected Button allowOverrideAreaDisplayButton; |
71 |
protected String commandHandlerString; |
|
72 |
protected String commandHandlerStringStatus; |
|
67 |
|
|
73 | 68 |
|
74 | 69 |
protected CdmPreference distributionEditorPref; |
75 |
protected CdmPreference prefStatus; |
|
76 |
protected CdmPreference prefAreaVoc; |
|
77 |
protected CdmPreference prefAreaDisplay; |
|
70 |
|
|
78 | 71 |
protected CdmPreference prefStatusDisplay; |
72 |
protected CdmPreference prefAreaDisplay; |
|
73 |
|
|
79 | 74 |
protected CdmPreference prefStatusDisplayInCombo; |
80 | 75 |
protected CdmPreference prefAreaSort; |
81 | 76 |
protected CdmPreference prefRank; |
... | ... | |
92 | 87 |
final String SHOW_RANK = "Show Rank"; |
93 | 88 |
final String NO_RANK = "No Rank"; |
94 | 89 |
|
95 |
protected CdmPreference areaVocPref = null; |
|
96 |
protected CdmPreference statusPref = null; |
|
97 |
private CommandHandlerButton button_openSelectAreaVocabularies; |
|
98 | 90 |
|
99 |
private CommandHandlerButton button_openStatusWizard; |
|
91 |
|
|
100 | 92 |
|
101 | 93 |
@Override |
102 | 94 |
protected Control createContents(Composite parent) { |
... | ... | |
200 | 192 |
} |
201 | 193 |
}); |
202 | 194 |
} |
203 |
|
|
204 |
GridData gridData = new GridData(); |
|
205 |
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); |
|
206 |
|
|
207 | 195 |
areaOrderSelectionCombo = createCombo(child, TermOrder.values(), PreferencePredicate.AreasSortedInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_area_order, isAdminPreference); |
208 | 196 |
|
209 | 197 |
index = 0; |
... | ... | |
379 | 367 |
} |
380 | 368 |
|
381 | 369 |
|
382 |
final CLabel labelStatus = new CLabel(child, SWT.NULL); |
|
383 |
labelStatus.setText(Messages.DistributionAdminPreferences_SELECT_STATUS); |
|
384 |
labelStatus.setLayoutData(textGrid); |
|
385 |
|
|
386 |
button_openStatusWizard = new CommandHandlerButton(child, SWT.PUSH, commandHandlerStringStatus); |
|
387 |
|
|
388 |
button_openStatusWizard.setText(Messages.Distribution_status_selection); |
|
389 |
button_openStatusWizard.addListener(SWT.Selection, new Listener() { |
|
390 |
@Override |
|
391 |
public void handleEvent(Event e) { |
|
392 |
switch (e.type) { |
|
393 |
case SWT.Selection: |
|
394 |
setApply(true); |
|
395 |
break; |
|
396 |
} |
|
397 |
} |
|
398 |
}); |
|
399 | 370 |
|
400 |
final CLabel label = new CLabel(child, SWT.NULL); |
|
401 |
label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard); |
|
402 |
label.setLayoutData(textGrid); |
|
403 |
|
|
404 |
button_openSelectAreaVocabularies = new CommandHandlerButton(child, SWT.PUSH, commandHandlerString); |
|
405 |
button_openSelectAreaVocabularies |
|
406 |
.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection); |
|
407 | 371 |
|
408 | 372 |
if (!isAdminPreference) { |
409 | 373 |
|
... | ... | |
412 | 376 |
activateComp.setEnabled(false); |
413 | 377 |
} |
414 | 378 |
|
415 |
if (prefAreaVoc != null && !prefAreaVoc.isAllowOverride()) { |
|
416 |
button_openSelectAreaVocabularies.setButtonEnabled(false); |
|
417 |
} |
|
418 |
if (prefStatus != null && !prefStatus.isAllowOverride()) { |
|
419 |
button_openStatusWizard.setButtonEnabled(false); |
|
420 |
} |
|
379 |
|
|
421 | 380 |
if (prefRank != null && !prefRank.isAllowOverride()) { |
422 | 381 |
activateRankCombo.setEnabled(false); |
423 | 382 |
} |
... | ... | |
678 | 637 |
distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ? PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null); |
679 | 638 |
} |
680 | 639 |
|
681 |
prefAreaVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies); |
|
682 |
if (prefAreaVoc == null){ |
|
683 |
prefAreaVoc = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue() != null ? PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue().toString(): null); |
|
684 |
} |
|
685 |
|
|
686 | 640 |
|
687 |
prefStatus = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus); |
|
688 |
if (prefStatus == null){ |
|
689 |
prefStatus = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, PreferencePredicate.AvailableDistributionStatus.getDefaultValue() != null ? PreferencePredicate.AvailableDistributionStatus.getDefaultValue().toString(): null); |
|
690 |
} |
|
691 | 641 |
|
692 | 642 |
|
693 | 643 |
prefAreaDisplay = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfAreasInDistributionEditor); |
... | ... | |
830 | 780 |
//prefOwnDescription = CdmPreference.NewTaxEditorInstance(PreferencePredicate.OwnDescriptionForDistributionEditor, PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue() != null ? PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString(): null); |
831 | 781 |
} |
832 | 782 |
|
833 |
commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"; |
|
834 |
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardHandler"; |
|
783 |
|
|
835 | 784 |
} |
836 | 785 |
|
837 | 786 |
@Override |
... | ... | |
956 | 905 |
|
957 | 906 |
overrideOwnDescriptionForDistributionEditor = true; |
958 | 907 |
|
959 |
this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null); |
|
960 |
this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, |
|
961 |
null); |
|
908 |
|
|
962 | 909 |
if (!isAdminPreference) { |
963 | 910 |
PreferencesUtil.recursiveSetEnabled(child, isEditorActivated); |
964 | 911 |
|
965 |
if (!prefAreaVoc.isAllowOverride()) { |
|
966 |
button_openSelectAreaVocabularies.setButtonEnabled(false); |
|
967 |
} |
|
968 |
if (!prefStatus.isAllowOverride()) { |
|
969 |
button_openStatusWizard.setButtonEnabled(false); |
|
970 |
} |
|
912 |
|
|
971 | 913 |
if (!prefRank.isAllowOverride()) { |
972 | 914 |
activateRankCombo.setEnabled(false); |
973 | 915 |
|
Also available in: Unified diff
ref #8256: add table of all status preferences in preference page