import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
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;
.getDescription(code));
}
- nomenclaturalCodeCombo.select(0);
+ 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() {
//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);
composite = parent;
composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
+ 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);
+ composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
- boolean isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
+ 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(isShowCollectingAreaInGeneralSection);
+
+ showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
});
final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
- boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
+// 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(isDeterminationOnlyForFieldUnits);
+
+ determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
});
final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
- boolean isShowTaxonAssociation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
+ 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(isShowTaxonAssociation);
+
+ showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
}
});
-
+
final Button showLifeFormButton = new Button(composite, SWT.CHECK);
- boolean isShowLifeForm = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
+ 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(isShowLifeForm);
+ showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
showLifeFormButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
}
});
+// 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);
+ }
+ });
+
}