public class ChecklistEditorGeneralAdminPreference extends ChecklistEditorGeneralPreference implements IE4AdminPreferencePage {
Composite parent;
- CdmPreference areaVocPref = null;
- CdmPreference statusPref = null;
+
@Override
protected Control createContents(Composite parent) {
setValid(false);
}
- @Override
- protected void performDefaults() {
- isEditorActivated = (Boolean)PreferencePredicate.DistributionEditorActivated.getDefaultValue();
- activateCheckButton.setSelection(isEditorActivated);
-
- displayArea = ((TermDisplayEnum)PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()).getKey();
- TermDisplayEnum areaDisplay;
- try{
- if (displayArea != null){
- areaDisplay = TermDisplayEnum.byKey(displayArea);
- }else{
- areaDisplay = TermDisplayEnum.Title;
- }
- }catch(IllegalArgumentException e){
- areaDisplay = TermDisplayEnum.Title;
- }
- int index = 0;
- for (String itemLabel : areaDisplaySelectionCombo.getItems()){
- if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){
- areaDisplaySelectionCombo.select(index);
- break;
- }
- index++;
- }
-
- displayStatus = ((TermDisplayEnum)PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
- TermDisplayEnum statusDisplay;
- try{
- if (displayStatus != null){
- statusDisplay = TermDisplayEnum.byKey(displayStatus);
- }else{
- statusDisplay = TermDisplayEnum.Title;
- }
- }catch(IllegalArgumentException e){
- statusDisplay = TermDisplayEnum.Title;
- }
- index = 0;
- for (String itemLabel : statusDisplaySelectionCombo.getItems()){
- if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){
- statusDisplaySelectionCombo.select(index);
- break;
- }
- index++;
- }
-
-
-
- orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
- index = 0;
- if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
- TermOrder areaOrder;
- try{
- if (orderAreas != null){
- areaOrder = TermOrder.valueOf(orderAreas);
- }else{
- areaOrder = TermOrder.IdInVoc;
- }
- }catch(IllegalArgumentException e){
- areaOrder = TermOrder.IdInVoc;
- }
- for (String itemLabel : areaOrderSelectionCombo.getItems()){
- if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())){
- areaOrderSelectionCombo.select(index);
- break;
- }
- index++;
- }
- }
-
-
- isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
- activateRankButton.setSelection(isShowRank);
- ownDescriptionForDistributionEditor = Boolean.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
-
- allowOverrideActivated = true;
- allowOverrideActivatedButton.setSelection(allowOverrideActivated);
- allowOverrideAreaDisplay = true;
- allowOverrideAreaDisplayButton.setSelection(allowOverrideAreaDisplay);
- allowOverrideStatusDisplay = true;
- allowOverrideStatusDisplayButton.setSelection(allowOverrideStatusDisplay);
- allowOverrideOrderAreas = true;
- allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas);
- allowOverrideRank = true;
- allowOverrideRankButton.setSelection(allowOverrideRank);
- allowOverrideOwnDescriptionForDistributionEditor = true;
- createContents(parent);
-
- this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
- this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
- super.performDefaults();
- }
}
}
- @Override
- protected void performDefaults() {
- nameDetailsConfig = new NameDetailsConfigurator(false);
- isShowAppendedPhrase = nameDetailsConfig.isAppendedPhraseActivated();
- isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
- isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
- isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
- isShowLSID = nameDetailsConfig.isLSIDActivated();
- isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
- isShowNameCache = nameDetailsConfig.isNameCacheActivated();
- isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
- isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
- isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
- isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
- isShowProtologue = nameDetailsConfig.isProtologueActivated();
- isShowRank = nameDetailsConfig.isRankActivated();
- isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
- isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
- isSecEnabled = nameDetailsConfig.isSecEnabled();
- isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
- isShowHybrid = nameDetailsConfig.isHybridActivated();
- this.setButtonSelections();
- super.performDefaults();
- }
+
}
publishBehaviour = PublishEnum.valueOf(pref.getValue());
}
- @Override
- protected void performDefaults() {
- publishBehaviour = (PublishEnum)PreferencePredicate.DefaultBehaviourForPublishFlag.getDefaultValue();
- allowOverride = true;
- int index = 0;
- for (String itemLabel : publishFlagBehaviour.getItems()){
- if (itemLabel.equalsIgnoreCase(publishBehaviour.getLabel())){
- publishFlagBehaviour.select(index);
- break;
- }
- index++;
- }
- super.performDefaults();
- }
return true;
}
- @Override
- protected void performDefaults() {
- isShowSpecimenRelatedIssues = (Boolean)PreferencePredicate.ShowSpecimen.getDefaultValue();
- showSpecimenButton.setSelection(isShowSpecimenRelatedIssues);
-
- allowOverrideShowSpecimenRelatedIssues = true;
- allowOverrideIsShowSpecimenRelatedIssuesButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
-
- isShowCollectingAreaInGeneralSection = (Boolean)PreferencePredicate.ShowCollectingAreasInGeneralSection.getDefaultValue();
- showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
-
- allowOverrideShowCollectingAreaInGeneralSection = true;
- allowOverrideShowCollectingAreaButton.setSelection(allowOverrideShowCollectingAreaInGeneralSection);
-
- isDeterminationOnlyForFieldUnits = (Boolean) PreferencePredicate.DeterminationOnlyForFieldUnits.getDefaultValue();
- determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
-
- allowOverrideDeterminationOnlyForFieldUnits = true;
- allowOverridesDeterminationOnlyForFieldUnitsButton.setSelection(allowOverrideDeterminationOnlyForFieldUnits);
-
- isShowTaxonAssociation = (Boolean) PreferencePredicate.ShowTaxonAssociations.getDefaultValue();
- showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
-
- allowOverrideShowTaxonAssociation = true;
- allowOverrideIsShowTaxonAssociationButton.setSelection(allowOverrideShowTaxonAssociation);
-
- isShowLifeForm = (Boolean) PreferencePredicate.ShowLifeForm.getDefaultValue();
- showLifeFormButton.setSelection(isShowLifeForm);
-
- allowOverrideShowLifeForm = true;
- allowOverrideShowLifeFormButton.setSelection(allowOverrideShowLifeForm);
-
- super.performDefaults();
- }
-
}
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.TermDisplayEnum;
+import eu.etaxonomy.cdm.model.metadata.TermOrder;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
protected Button activateRankButton;
protected Button allowOverrideRankButton;
+ protected CdmPreference areaVocPref = null;
+ protected CdmPreference statusPref = null;
+
@Override
protected Control createContents(Composite parent) {
getValues();
PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), overrideOwnDescriptionForDistributionEditor);
-
+ if (statusPref != null){
+ PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), statusPref.getValue());
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionStatus.getKey()), true);
+ }
+ if (areaVocPref != null){
+ PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), areaVocPref.getValue());
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()), true);
+ }
}
if (pref.getValue() != null){
orderAreas = pref.getValue().toString();
}else{
- orderAreas = PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString();
+ orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
}
}
}else{
}
+ @Override
+ protected void performDefaults() {
+ isEditorActivated = (Boolean)PreferencePredicate.DistributionEditorActivated.getDefaultValue();
+ activateCheckButton.setSelection(isEditorActivated);
+
+ displayArea = ((TermDisplayEnum)PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()).getKey();
+ TermDisplayEnum areaDisplay;
+ try{
+ if (displayArea != null){
+ areaDisplay = TermDisplayEnum.byKey(displayArea);
+ }else{
+ areaDisplay = TermDisplayEnum.Title;
+ }
+ }catch(IllegalArgumentException e){
+ areaDisplay = TermDisplayEnum.Title;
+ }
+ int index = 0;
+ for (String itemLabel : areaDisplaySelectionCombo.getItems()){
+ if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){
+ areaDisplaySelectionCombo.select(index);
+ break;
+ }
+ index++;
+ }
+
+ displayStatus = ((TermDisplayEnum)PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
+ TermDisplayEnum statusDisplay;
+ try{
+ if (displayStatus != null){
+ statusDisplay = TermDisplayEnum.byKey(displayStatus);
+ }else{
+ statusDisplay = TermDisplayEnum.Title;
+ }
+ }catch(IllegalArgumentException e){
+ statusDisplay = TermDisplayEnum.Title;
+ }
+ index = 0;
+ for (String itemLabel : statusDisplaySelectionCombo.getItems()){
+ if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){
+ statusDisplaySelectionCombo.select(index);
+ break;
+ }
+ index++;
+ }
+
+
+
+ orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
+ index = 0;
+ if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
+ TermOrder areaOrder;
+ try{
+ if (orderAreas != null){
+ areaOrder = TermOrder.valueOf(orderAreas);
+ }else{
+ areaOrder = TermOrder.IdInVoc;
+ }
+ }catch(IllegalArgumentException e){
+ areaOrder = TermOrder.IdInVoc;
+ }
+ for (String itemLabel : areaOrderSelectionCombo.getItems()){
+ if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())){
+ areaOrderSelectionCombo.select(index);
+ break;
+ }
+ index++;
+ }
+ }
+
+
+ isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
+ activateRankButton.setSelection(isShowRank);
+
+ ownDescriptionForDistributionEditor = Boolean.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
+
+ allowOverrideActivated = true;
+ allowOverrideActivatedButton.setSelection(allowOverrideActivated);
+ overrideActivated = true;
+ allowOverrideAreaDisplay = true;
+ overrideAreaDisplay = true;
+ allowOverrideAreaDisplayButton.setSelection(allowOverrideAreaDisplay);
+ allowOverrideStatusDisplay = true;
+ overrideStatusDisplay = true;
+ allowOverrideStatusDisplayButton.setSelection(allowOverrideStatusDisplay);
+ allowOverrideOrderAreas = true;
+ overrideOrderAreas = true;
+ allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas);
+ allowOverrideRank = true;
+ overrideRank = true;
+ allowOverrideRankButton.setSelection(allowOverrideRank);
+ allowOverrideOwnDescriptionForDistributionEditor = true;
+ overrideOwnDescriptionForDistributionEditor = true;
+
+ this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
+ this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
+ super.performDefaults();
+ }
+
}
}
}
+ @Override
+ protected void performDefaults() {
+
+ super.performDefaults();
+ }
+
}
+ @Override
+ protected void performDefaults() {
+ openUrl.presentsDefaultValue();
+ maxHeight.presentsDefaultValue();
+ maxWidth.presentsDefaultValue();
+ mapService.presentsDefaultValue();
+ super.performDefaults();
+ }
+
}
}
+ @Override
+ protected void performDefaults() {
+ advanced.presentsDefaultValue();
+ preview.presentsDefaultValue();
+ super.performDefaults();
+ }
+
boolean isRestoreTaxonNavigator;\r
boolean isSelectionChanged = false;\r
boolean isStrictlyAlphabeticallyOrdered;\r
+ Button activateRestoreNavigatorButton;\r
\r
@Override\r
protected Control createContents(Composite parent) {\r
Composite secondComposite = new Composite(parent, SWT.NULL);\r
secondComposite.setLayout(new GridLayout());\r
\r
- final Button activateRestoreNavigatorButton = new Button(secondComposite, SWT.CHECK | SWT.LEFT);\r
+ activateRestoreNavigatorButton = new Button(secondComposite, SWT.CHECK | SWT.LEFT);\r
activateRestoreNavigatorButton.setText(Messages.OrderPreferences_Restore);\r
activateRestoreNavigatorButton.setSelection(isRestoreTaxonNavigator);\r
activateRestoreNavigatorButton.addSelectionListener(new SelectionAdapter(){\r
\r
}\r
\r
+ @Override\r
+ protected void performDefaults() {\r
+ activateRestoreNavigatorButton.setSelection(false);\r
+ isRestoreTaxonNavigator = false;\r
+ orderActivated = NavigatorOrderEnum.RankAndNameOrder;\r
+ int index = 0;\r
+ for (String itemLabel : orderSelectionCombo.getItems()){\r
+ if (itemLabel.equalsIgnoreCase(orderActivated.getLabel())){\r
+ orderSelectionCombo.select(index);\r
+ break;\r
+ }\r
+ index++;\r
+ }\r
+ super.performDefaults();\r
+ }\r
+\r
\r
}\r
getPreferenceStore().setDefault(createPreferenceString(SORT_NODES), NavigatorOrderEnum.RankAndNameOrder.getKey());
getPreferenceStore().setDefault(createPreferenceString(SORT_TAXA_BY_RANK_AND_NAME), true);
+
+ getPreferenceStore().setDefault(createPreferenceString(SHOW_ADVANCED_MEDIA_SECTION), false);
+
+ getPreferenceStore().setDefault(createPreferenceString(SHOW_MEDIA_PREVIEW), false);
//override db preferences
getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey())), false);
getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(PreferencePredicate.ShowSpecimen.getKey())), true);
protected Combo publishFlagBehaviour;
protected CdmPreference pref = null;
+ Button allowOverrideButton;
protected boolean allowOverride;
}
});
- Button allowOverrideButton = createAllowOverrideButton(composite);
+ allowOverrideButton = createAllowOverrideButton(composite);
allowOverrideButton.setText(Messages.GeneralPreference_override);
allowOverrideButton.setSelection(allowOverride);
allowOverrideButton.addSelectionListener(new SelectionAdapter(){
}
}
+ @Override
+ protected void performDefaults() {
+ publishBehaviour = (PublishEnum)PreferencePredicate.DefaultBehaviourForPublishFlag.getDefaultValue();
+ allowOverride = true;
+ int index = 0;
+ for (String itemLabel : publishFlagBehaviour.getItems()){
+ if (itemLabel.equalsIgnoreCase(publishBehaviour.getLabel())){
+ publishFlagBehaviour.select(index);
+ break;
+ }
+ index++;
+ }
+
+ super.performDefaults();
+ }
+
}
}
+
+ @Override
+ protected void performDefaults() {
+ isShowSpecimenRelatedIssues = (Boolean)PreferencePredicate.ShowSpecimen.getDefaultValue();
+ showSpecimenButton.setSelection(isShowSpecimenRelatedIssues);
+
+ allowOverrideShowSpecimenRelatedIssues = true;
+ allowOverrideIsShowSpecimenRelatedIssuesButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
+
+ isShowCollectingAreaInGeneralSection = (Boolean)PreferencePredicate.ShowCollectingAreasInGeneralSection.getDefaultValue();
+ showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
+
+ allowOverrideShowCollectingAreaInGeneralSection = true;
+ allowOverrideShowCollectingAreaButton.setSelection(allowOverrideShowCollectingAreaInGeneralSection);
+
+ isDeterminationOnlyForFieldUnits = (Boolean) PreferencePredicate.DeterminationOnlyForFieldUnits.getDefaultValue();
+ determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
+
+ allowOverrideDeterminationOnlyForFieldUnits = true;
+ allowOverridesDeterminationOnlyForFieldUnitsButton.setSelection(allowOverrideDeterminationOnlyForFieldUnits);
+
+ isShowTaxonAssociation = (Boolean) PreferencePredicate.ShowTaxonAssociations.getDefaultValue();
+ showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
+
+ allowOverrideShowTaxonAssociation = true;
+ allowOverrideIsShowTaxonAssociationButton.setSelection(allowOverrideShowTaxonAssociation);
+
+ isShowLifeForm = (Boolean) PreferencePredicate.ShowLifeForm.getDefaultValue();
+ showLifeFormButton.setSelection(isShowLifeForm);
+
+ allowOverrideShowLifeForm = true;
+ allowOverrideShowLifeFormButton.setSelection(allowOverrideShowLifeForm);
+
+ super.performDefaults();
+ }
+
+
}
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
protected AbstractAdminTermSelectionWizardPage(String pageName, TermType type, CdmPreference pref) {
super(pageName, type);
this.pref = pref;
+ if (localPref){
+ this.override = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(pref.getPredicate()));
+ }else{
+ this.override = pref != null? this.pref.isAllowOverride(): true;
+ }
- this.override = pref != null? this.pref.isAllowOverride(): true;
}
CdmPreference pref;
final Button activateCheckButton = new Button(parent, SWT.CHECK);
if (localPref){
activateCheckButton.setText("Override");
+ activateCheckButton.setSelection(override);
}else{
activateCheckButton.setText("Allow Override");
+ activateCheckButton.setSelection(pref.isAllowOverride());
}
- activateCheckButton.setSelection(pref.isAllowOverride());
+
+
activateCheckButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
pref.setAllowOverride(activateCheckButton.getSelection());
+ override = activateCheckButton.getSelection();
}
});
// TODO check if configuration exists
// CdmStore.getCurrentSessionManager().bindNullSession();
this.type = type;
+
}
@Override
if (StringUtils.isBlank(vocString) && pref != null){
vocString = pref.getValue();
}
+ this.override = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(pref.getPredicate()));
}else if (pref != null){
vocString = pref.getValue();
}
setTitle(Messages.AvailableDistributionStatusPage_PAGE_TITLE);
setDescription(Messages.AvailableDistributionStatusPage_PAGE_DESCRIPTION);
//if (!localPref){
- createAllowOverrideButton(parent);
+ override = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()));
+ createAllowOverrideButton(parent);
//}
super.createControl(parent);
if (StringUtils.isBlank(checkedValues) && pref != null){
checkedValues = pref.getValue();
}
+
}else {
checkedValues = pref.getValue();
}
String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), saveCheckedElements);
- PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()), true);
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()), aPage.override);
PreferencesUtil.firePreferencesChanged(this.getClass());
return true;
}
predicate = pref.getPredicate();
}
-// if (!localPref){
+ if (!localPref){
CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.getByKey(predicate), saveCheckedElements);
savePref.setAllowOverride(pref.isAllowOverride());
PreferencesUtil.setPreferenceToDB(savePref);
PreferencesUtil.updateDBPreferences();
-
+ }else{
+ PreferencesUtil.setStringValue(predicate, saveCheckedElements);
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate), this.aPage.override);
+ }
return true;
}