Project

General

Profile

« Previous | Next » 

Revision 59e7cc59

Added by Katja Luther over 6 years ago

smaller changes for simple name details configuration

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java
187 187
        composite.setLayout(gridLayout);
188 188
        nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
189 189

  
190
        final Button useLocalPreference = new Button(composite, SWT.CHECK);
191
        boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
192
        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
193
        useLocalPreference.setSelection(isUseLocalPreference);
194
        useLocalPreference.addSelectionListener(new SelectionAdapter(){
195
             @Override
196
             public void widgetSelected(SelectionEvent e) {
197
                 boolean isUseLocalPreference = useLocalPreference.getSelection();
198
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
199
              }
200
         });
190

  
201 191
    }
202 192

  
203 193

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/NameDetailsViewComposite.java
17 17
import org.eclipse.swt.widgets.Button;
18 18
import org.eclipse.swt.widgets.Composite;
19 19

  
20
import eu.etaxonomy.taxeditor.l10n.Messages;
21
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
20 22
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
21 23
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
22 24

  
......
64 66
       this.setData(data);
65 67
//       CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
66 68
//       NameDetailsConfigurator config = PreferencesUtil.setPreferredNameDetailsConfiguration(local)
69

  
70
       final Button allowLocalPreference = new Button(this, SWT.CHECK);
71
       boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
72
       allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
73
       allowLocalPreference.setSelection(isUseLocalPreference);
74
       allowLocalPreference.addSelectionListener(new SelectionAdapter(){
75
            @Override
76
            public void widgetSelected(SelectionEvent e) {
77
                boolean isUseLocalPreference = allowLocalPreference.getSelection();
78
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
79
             }
80
        });
81

  
82

  
67 83
       isSimpleDetailsViewActivated= config.isSimpleDetailsViewActivated();
68 84
       final Button activateCheckButton = new Button(this, SWT.CHECK);
69 85
       activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java
20 20
	boolean isSimpleDetailsViewActivated;
21 21
	boolean isUseLocalSettings;
22 22
    Composite child ;
23
    Composite localSettings ;
23 24
	@Override
24 25
	public void init(IWorkbench workbench) {
25 26

  
......
61 62
             }
62 63
             });
63 64

  
65
            child  = new Composite(composite, SWT.NONE);
66
            child.setLayout(new GridLayout());
67
            child.setVisible(isUseLocalSettings);
68

  
64 69
            isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
65
            final Button activateCheckButton = new Button(composite, SWT.CHECK);
70

  
71

  
72

  
73
            final Button activateCheckButton = new Button(child, SWT.CHECK);
66 74
            activateCheckButton.setText("Show only a simple name details view");
67 75
            activateCheckButton.setSelection(isSimpleDetailsViewActivated);
68 76
            activateCheckButton.addSelectionListener(new SelectionAdapter(){
......
70 78
            public void widgetSelected(SelectionEvent e) {
71 79
            	isSimpleDetailsViewActivated = activateCheckButton.getSelection();
72 80
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
73
                if(isSimpleDetailsViewActivated){
74
                	child.setVisible(true);
75
                    child.setEnabled(true);
81
                if(isSimpleDetailsViewActivated && isUseLocalSettings){
82
                    localSettings.setVisible(true);
83
                    localSettings.setEnabled(true);
76 84
                }else{
77
                	child.setVisible(false);
78
                    child.setEnabled(false);
85
                    localSettings.setVisible(false);
86
                    localSettings.setEnabled(false);
79 87
                }
80 88
             }
81 89
             });
90
            localSettings  = new Composite(child, SWT.NONE);
91
            localSettings.setLayout(new GridLayout());
92
            localSettings.setVisible(isSimpleDetailsViewActivated);
82 93

  
83
            child  = new Composite(composite, SWT.H_SCROLL);
84
            child.setLayout(new GridLayout());
85
            child.setVisible(isSimpleDetailsViewActivated);
86 94

  
87
            final Button showTaxon = new Button(child, SWT.CHECK);
95
            final Button showTaxon = new Button(localSettings, SWT.CHECK);
88 96
            boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
89 97
            showTaxon.setText("Show taxon of the name");
90 98
            showTaxon.setSelection(isShowTaxon);
......
96 104
                  }
97 105
             });
98 106

  
99
            final Button showLsid = new Button(child, SWT.CHECK);
107
            final Button showLsid = new Button(localSettings, SWT.CHECK);
100 108
            boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
101 109
            showLsid.setText("Show Lsid of the name");
102 110
            showLsid.setSelection(isShowLSID);
......
108 116
                  }
109 117
             });
110 118

  
111
            final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
119
            final Button showNomenclaturalCode = new Button(localSettings, SWT.CHECK);
112 120
            boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
113 121
            showNomenclaturalCode.setText("Show the nomenclatural code");
114 122
            showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
......
120 128
                  }
121 129
             });
122 130

  
123
            final Button showNameCache = new Button(child, SWT.CHECK);
131
            final Button showNameCache = new Button(localSettings, SWT.CHECK);
124 132
            boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
125 133
            showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
126 134
            showNameCache.setSelection(isShowNomenclaturalCode);
......
131 139
                     PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
132 140
                  }
133 141
             });
134
            final Button showAppendedPhrase = new Button(child, SWT.CHECK);
142
            final Button showAppendedPhrase = new Button(localSettings, SWT.CHECK);
135 143
            boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
136 144
            showAppendedPhrase.setText("Show appended phrase");
137 145
            showAppendedPhrase.setSelection(isShowAppendedPhrase);
......
143 151
                  }
144 152
             });
145 153

  
146
            final Button showRank = new Button(child, SWT.CHECK);
154
            final Button showRank = new Button(localSettings, SWT.CHECK);
147 155
            boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
148 156
            showRank.setText("Show rank of the name");
149 157
            showRank.setSelection(isShowRank);
......
154 162
                     PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
155 163
                  }
156 164
             });
157
            final Button showEpithets = new Button(child, SWT.CHECK);
165
            final Button showEpithets = new Button(localSettings, SWT.CHECK);
158 166
            boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
159 167
            showEpithets.setText("Show atomised epithets");
160 168
            showEpithets.setSelection(isShowEpithets);
......
165 173
                     PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
166 174
                  }
167 175
             });
168
            final Button showAuthorship = new Button(child, SWT.CHECK);
176
            final Button showAuthorship = new Button(localSettings, SWT.CHECK);
169 177
            boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
170 178
            showAuthorship.setText("Show authorship section");
171 179
            showAuthorship.setSelection(isShowAuthorship);
......
177 185
                  }
178 186
             });
179 187

  
180
            final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
188
            final Button showNomenclaturalRef = new Button(localSettings, SWT.CHECK);
181 189
            boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
182 190
            showNomenclaturalRef.setText("Show nomenclatural reference section");
183 191
            showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
......
189 197
                  }
190 198
             });
191 199

  
192
            final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
200
            final Button showNomenclaturalStatus = new Button(localSettings, SWT.CHECK);
193 201
            boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
194 202
            showNomenclaturalStatus.setText("Show nomenclatural status section");
195 203
            showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
......
201 209
                  }
202 210
             });
203 211

  
204
            final Button showProtologue = new Button(child, SWT.CHECK);
212
            final Button showProtologue = new Button(localSettings, SWT.CHECK);
205 213
            boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
206 214
            showProtologue.setText("Show protologue section");
207 215
            showProtologue.setSelection(isShowProtologue);
......
213 221
                  }
214 222
             });
215 223

  
216
            final Button showTypeDesignation = new Button(child, SWT.CHECK);
224
            final Button showTypeDesignation = new Button(localSettings, SWT.CHECK);
217 225
            boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
218 226
            showTypeDesignation.setText("Show name type designation section");
219 227
            showTypeDesignation.setSelection(isShowTypeDesignation);
......
226 234
             });
227 235

  
228 236

  
229
            final Button showNameRelationship = new Button(child, SWT.CHECK);
237
            final Button showNameRelationship = new Button(localSettings, SWT.CHECK);
230 238
            boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
231 239
            showNameRelationship.setText("Show name relationship section");
232 240
            showNameRelationship.setSelection(isShowNameRelationship);
......
238 246
                  }
239 247
             });
240 248

  
241
            final Button showHybrid = new Button(child, SWT.CHECK);
249
            final Button showHybrid = new Button(localSettings, SWT.CHECK);
242 250
            boolean isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
243 251
            showHybrid.setText("Show hybrid section");
244 252
            showHybrid.setSelection(isShowHybrid);
......
249 257
                     PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
250 258
                  }
251 259
             });
252
            final Button showNameApprobiation = new Button(child, SWT.CHECK);
260
            final Button showNameApprobiation = new Button(localSettings, SWT.CHECK);
253 261
            boolean isShowNameApprobiation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
254 262
            showNameApprobiation.setText("Show name approbiation (for bacterial names)");
255 263
            showNameApprobiation.setSelection(isShowNameApprobiation);
......
263 271

  
264 272

  
265 273
            if(isSimpleDetailsViewActivated){
266
                child.setEnabled(true);
274
                localSettings.setEnabled(true);
267 275
            }else{
268
                child.setEnabled(false);
276
                localSettings.setEnabled(false);
269 277
            }
270 278
        }else{
271 279
            Label label = new Label(composite, SWT.NONE);

Also available in: Unified diff