import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
* @date 01.11.2016
*
*/
-public class DatabasePreferencesPage extends WizardPage implements IWizardPage{
-
-
+public class DatabasePreferencesPage extends AbstractPreferenceWizard implements IWizardPage{
CdmPreference preferedNomenclaturalCode;
NameDetailsConfigurator config ;
- TabFolder tabFolder;
- // private int maxNumOfColumns;
- IPreferenceStore preferenceStore;
- Composite composite;
+ CdmPreference isRedListPreference;
+ CdmPreference determinationOnlyForFieldUnitsPreference;
+ CdmPreference showCollectingAreaInGeneralSectionPreference;
+ CdmPreference showTaxonAssociationsPreference;
+ CdmPreference setPublishFlagAsDefault;
+
boolean isSimpleDetailsViewActivated;
+
Composite child ;
+ NameDetailsViewComposite nameDetailsConfig;
+ protected NameDetailsViewComposite getNameDetailsConfig() {
+ return nameDetailsConfig;
+ }
- private Combo nomenclaturalCodeCombo;
+ String selectedPreferenceKey = null;
- private Label nomenclaturalCodeLabel;
+ ListComponent biocaseProviderList;
+ Abcd206ImportConfigurator abcdImportConfigurator;
String[][] labelAndValues;
super(pageName);
this.preferedNomenclaturalCode = PreferencesUtil.setPreferredNomenclaturalCode(null, false);
this.config = PreferencesUtil.setPreferredNameDetailsConfiguration( false);
- setPreferenceStore(PreferencesUtil.getPreferenceStore());
-
- }
-
- protected void setPreferenceStore(IPreferenceStore store){
- this.preferenceStore = store;
- }
-
-// @Override
-// protected void createFieldEditors() {
-// setMessage("Choose the preferences for the whole cdm store.");
-// tabFolder = new TabFolder(getFieldEditorParent(), SWT.NONE);
-//
-// createNomenclaturalCodeTab();
-// createNameDetailsConfiguration();
-//
-//
-// }
-
-
-
-//
-// /***
-// * Adjust the layout of the field editors so that they are properly aligned.
-// */
-// @Override
-// protected void adjustGridLayout() {
-// if (tabFolder != null){
-// TabItem[] items = tabFolder.getItems();
-// for (int j = 0; j < items.length; j++){
-// GridLayout layout = ((GridLayout) ((Composite) items[j].getControl()).getLayout());
-// layout.numColumns = this.maxNumOfColumns;
-// layout.marginHeight = 5;
-// layout.marginWidth = 5;
-// }
-// }
-// // need to call super.adjustGridLayout() since fieldEditor.adjustForNumColumns() is protected
-// super.adjustGridLayout();
-//
-// // reset the main container to a single column
-// ((GridLayout) super.getFieldEditorParent().getLayout()).numColumns = 1;
-// }
-
-// /***
-// * Returns a parent composite for a field editor.
-// * <p>
-// * This value must not be cached since a new parent may be created each time this method called. Thus this method
-// * must be called each time a field editor is constructed.
-// * </p>
-// * @return a parent
-// */
-// @Override
-// protected Composite getEditorParent(){
-// if (tabFolder == null || tabFolder.getItemCount() == 0){
-// return super.getWizard();
-// }
-// return (Composite) tabFolder.getItem(tabFolder.getItemCount() - 1).getControl();
-// }
-
- /***
- * Adds a tab to the page.
- * @param text the tab label
- */
- public Composite addTab(String text) {
- if (tabFolder == null){
- // initialize tab folder
- if (composite == null) {
- composite = new Composite(getShell(), SWT.NONE);
- }
- tabFolder = new TabFolder(composite, SWT.NONE);
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ if (config == null){
+ config = new NameDetailsConfigurator(false);
}
- TabItem item = new TabItem(tabFolder, SWT.NONE);
- item.setText(text);
-
- Composite currentTab = new Composite(tabFolder, SWT.NULL);
- GridLayout layout = new GridLayout();
- currentTab.setLayout(layout);
- currentTab.setFont(composite.getFont());
- currentTab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- item.setControl(currentTab);
- return currentTab;
}
- /**
- * @param tabFolder
- */
- private void createNameDetailsConfiguration(Composite parent) {
- if (composite == null){
- composite = parent;
- }
- composite = addTab("Name Details View Configuration");
-// TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE);
-// Composite c2 = new Composite(tabFolder, SWT.BORDER);
-// c2.setLayout(new GridLayout(1, true));
-// tbtmNameDetailsConfiguration.setControl(c2);
- // composite.setLayout(new GridLayout(1, true));
- config = new NameDetailsConfigurator(true);
-
- // Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
-
- isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
- final Button activateCheckButton = new Button(composite, SWT.CHECK);
- activateCheckButton.setText("Show only a simple name details view");
- activateCheckButton.setSelection(isSimpleDetailsViewActivated);
- activateCheckButton.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- isSimpleDetailsViewActivated = activateCheckButton.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
- if(isSimpleDetailsViewActivated){
- child.setVisible(true);
- child.setEnabled(true);
- }else{
- child.setVisible(false);
- child.setEnabled(false);
- }
- }
- });
-
- child = new Composite(composite, SWT.NULL);
- child.setLayout(new GridLayout());
- child.setVisible(isSimpleDetailsViewActivated);
-
- final Button showTaxon = new Button(child, SWT.CHECK);
- boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
- showTaxon.setText("Show taxon of the name");
- showTaxon.setSelection(isShowTaxon);
- showTaxon.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowTaxon = showTaxon.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
- }
- });
-
- final Button showLsid = new Button(child, SWT.CHECK);
- boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
- showLsid.setText("Show Lsid of the name");
- showLsid.setSelection(isShowLSID);
- showLsid.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowLSID = showLsid.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
- }
- });
-
- final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
- boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
- showNomenclaturalCode.setText("Show the nomenclatural code");
- showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
- showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
- }
- });
-
- final Button showNameCache = new Button(child, SWT.CHECK);
- boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
- showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
- showNameCache.setSelection(isShowNomenclaturalCode);
- showNameCache.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNameCache = showNameCache.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
- }
- });
- final Button showAppendedPhrase = new Button(child, SWT.CHECK);
- boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
- showAppendedPhrase.setText("Show appended phrase");
- showAppendedPhrase.setSelection(isShowAppendedPhrase);
- showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
- }
- });
-
- final Button showRank = new Button(child, SWT.CHECK);
- boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
- showRank.setText("Show rank of the name");
- showRank.setSelection(isShowRank);
- showRank.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowRank = showRank.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
- }
- });
- final Button showEpithets = new Button(child, SWT.CHECK);
- boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
- showEpithets.setText("Show atomised epithets");
- showEpithets.setSelection(isShowEpithets);
- showEpithets.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowEpithets = showEpithets.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
- }
- });
- final Button showAuthorship = new Button(child, SWT.CHECK);
- boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
- showAuthorship.setText("Show authorship section");
- showAuthorship.setSelection(isShowAuthorship);
- showAuthorship.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowAuthorship = showAuthorship.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
- }
- });
-
- final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
- boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
- showNomenclaturalRef.setText("Show nomenclatural reference section");
- showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
- showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
- }
- });
-
- final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
- boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
- showNomenclaturalStatus.setText("Show nomenclatural status section");
- showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
- showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
- }
- });
-
- final Button showProtologue = new Button(child, SWT.CHECK);
- boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
- showProtologue.setText("Show protologue section");
- showProtologue.setSelection(isShowProtologue);
- showProtologue.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowProtologue = showProtologue.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
- }
- });
-
- final Button showTypeDesignation = new Button(child, SWT.CHECK);
- boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
- showTypeDesignation.setText("Show name type designation section");
- showTypeDesignation.setSelection(isShowTypeDesignation);
- showTypeDesignation.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowTypeDesignation = showTypeDesignation.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
- }
- });
-
-
- final Button showNameRelationship = new Button(child, SWT.CHECK);
- boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
- showNameRelationship.setText("Show name relationship section");
- showNameRelationship.setSelection(isShowNameRelationship);
- showNameRelationship.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNameRelationship = showNameRelationship.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
- }
- });
-
- if(isSimpleDetailsViewActivated){
- child.setEnabled(true);
- }else{
- child.setEnabled(false);
- }
-
-
-
- // Label emptyLabel = new Label(getFieldEditorParent(), 0);
-
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, "show simple (configurable) details", getFieldEditorParent()));
-// addField(new SpacerFieldEditor(getFieldEditorParent()));
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON,
-// "show taxon section",
-// getFieldEditorParent()));
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE,
-// "show name cache",
-// getFieldEditorParent()));
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID,
-// "show LSID of the name",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
-// "show nomenclatural code of the name",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
-// "show appended phrase",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK,
-// "show rank of the name",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
-// "show atomised epithets of the name",
-// getFieldEditorParent()));
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
-// "show authorship section",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
-// "show nomenclatural reference section",
-// getFieldEditorParent()));
-//
-//
-// addField( new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
-// "show nomenclatural status section",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
-// "show protologue section",
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS,
-// "allow to use local preference",
-// getFieldEditorParent()));
-
-
- }
-
-
protected IPreferenceStore doGetPreferenceStore() {
return PreferencesUtil.getPreferenceStore();
}
return labelAndValues;
}
-// @Override
-// public boolean performOk() {
-// if (doGetPreferenceStore()== null){
-// setPreferenceStore(PreferencesUtil.getPreferenceStore());
-// }
-//
-//
-// String value =doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
-// boolean allowOverride = doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
-// CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
-// pref.setAllowOverride(allowOverride);
-// ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
-// if (controller == null){
-// return false;
-// }
-// IPreferenceService service = controller.getPreferenceService();
-// service.set(pref);
-// createNameDetailsViewConfig();
-// value =config.toString();
-// allowOverride = doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS);
-// pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
-// pref.setAllowOverride(allowOverride);
-// service.set(pref);
-//
-// return true;
-// }
-/**
- *
- */
- void createNameDetailsViewConfig() {
- config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
- config.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
- config.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
- config.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
- config.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
- config.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
- config.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
- config.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
- config.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
- config.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
- config.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
- config.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
- config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
- config.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
- config.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
- }
+
+
public void createNomenclaturalCodeTab(Composite parent){
- composite = addTab("Nomenclatural Code");
- nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY);
- List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
+
+ Combo nomenclaturalCodeCombo;
+ Label nomenclaturalCodeLabel;
+
+ composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
+ nomenclaturalCodeCombo = new Combo(composite, SWT.DROP_DOWN);
+
+ List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
.getSupportedCodes();
- for (NomenclaturalCode code: supportedCodes) {
+ for (NomenclaturalCode code: supportedCodes) {
nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
.getDescription(code));
}
+ nomenclaturalCodeCombo.select(0);
getLabelAndValues();
+ //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
String name = nomenclaturalCodeCombo.getText();
- String selectedPreferenceKey = null;
+
for (String[] labelAndValue: labelAndValues){
if (labelAndValue[0].equals(name)){
selectedPreferenceKey = labelAndValue[1];
final Button useLocalPreference = new Button(composite, SWT.CHECK);
boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
- useLocalPreference.setText("allow to use local preference");
+ useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
useLocalPreference.setSelection(isUseLocalPreference);
useLocalPreference.addSelectionListener(new SelectionAdapter(){
@Override
});
- // Label emptyLabel = new Label(getFieldEditorParent(), 0);
- // addField(new ComboFieldEditor(
-// IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY,
-// "Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.", getLabelAndValues(),
-// getFieldEditorParent()));
-//
-//
-// addField(new BooleanFieldEditor(
-// IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY,
-// "allow to use local preference",
-// getFieldEditorParent()));
-// adjustGridLayout();
-}
+ }
+ public void createSetPublishFlagTab(Composite parent){
+ composite = addTab(Messages.DatabasePreferencesPage_SetPublishFlag);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+ //radio buttons for set publish as default, set not publish as default and inherit from parent
+
+ }
+
+
+ public void createBiocaseProviderTab(Composite parent){
+ composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+ biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
+
+ }
+
+ public ListComponent getBiocaseProviderList() {
+ return biocaseProviderList;
+ }
+
+ public void createNameDetailsViewConfigurationTab(Composite parent, NameDetailsConfigurator config){
+ composite = parent;
+ composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+
+ composite.setLayout(gridLayout);
+ nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
+
+
+ }
+
+
+ public void createSpecimenOrObservationTab(Composite parent){
+ composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
+
+ final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
+ CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
+ if (isShowCollectingAreaInGeneralSection == null){
+ isShowCollectingAreaInGeneralSection = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(false));
+ }
+ showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
+
+ showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
+ showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION, isShowCollectingAreaInGeneralSection);
+ }
+ });
+
+ final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
+// boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
+ CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
+ if (isDeterminationOnlyForFieldUnits == null){
+ isDeterminationOnlyForFieldUnits = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(false));
+ }
+ determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
+
+ determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
+ determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS, isDeterminationOnlyForFieldUnits);
+ }
+ });
+
+ final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
+ CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
+ if (isShowTaxonAssociation == null){
+ isShowTaxonAssociation = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(false));
+ }
+ showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
+
+ showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
+ showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowTaxonAssociation = showTaxonAssociationButton.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
+ }
+ });
+
+ final Button showLifeFormButton = new Button(composite, SWT.CHECK);
+ CdmPreference isShowLifeForm = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
+ if (isShowLifeForm == null){
+ isShowLifeForm = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(false));
+ }
+
+ showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
+ showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
+ showLifeFormButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowLifeForm = showLifeFormButton.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_LIFE_FORM, isShowLifeForm);
+ }
+ });
+// Composite useLocalComp = new Composite(composite, SWT.NONE);
+ final Button useLocalPreference = new Button(composite, SWT.CHECK);
+ boolean isUseLocalPreference = isShowTaxonAssociation.isAllowOverride();
+ useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
+ GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
+ gridData.verticalIndent = 10;
+ useLocalPreference.setLayoutData(gridData);
+
+ useLocalPreference.setSelection(isUseLocalPreference);
+ useLocalPreference.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isUseLocalPreference = useLocalPreference.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, isUseLocalPreference);
+ }
+ });
+
+
+
+ }
+
/**
* {@inheritDoc}
*/
*/
@Override
public void createControl(Composite parent) {
- createNameDetailsConfiguration(parent);
+ createNameDetailsViewConfigurationTab(parent, config);
createNomenclaturalCodeTab(parent);
+
+ createSpecimenOrObservationTab(parent);
+ createBiocaseProviderTab(parent);
setControl(parent);
}
* @return
*/
public NameDetailsConfigurator getConfig() {
-
return config;
}
+/**
+ *
+ */
+public Abcd206ImportConfigurator getAbcdImportConfig() {
+ return abcdImportConfigurator;
+
+}
+
+/**
+ * @return
+ */
+public void createAbcdImportConfig() {
+ this.abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
+ this.abcdImportConfigurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
+ this.abcdImportConfigurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
+ //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
+ this.abcdImportConfigurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
+ this.abcdImportConfigurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
+ // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
+ this.abcdImportConfigurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
+ this.abcdImportConfigurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
+ this.abcdImportConfigurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
+ this.abcdImportConfigurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
+ this.abcdImportConfigurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
+ this.abcdImportConfigurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
+ this.abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
+ this.abcdImportConfigurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
+ this.abcdImportConfigurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
+
+}
+