Revision 37cff480
Added by Katja Luther almost 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java | ||
---|---|---|
6 | 6 |
import org.eclipse.swt.custom.CLabel; |
7 | 7 |
import org.eclipse.swt.events.SelectionAdapter; |
8 | 8 |
import org.eclipse.swt.events.SelectionEvent; |
9 |
import org.eclipse.swt.events.SelectionListener; |
|
9 | 10 |
import org.eclipse.swt.layout.GridData; |
10 | 11 |
import org.eclipse.swt.layout.GridLayout; |
11 | 12 |
import org.eclipse.swt.widgets.Button; |
... | ... | |
19 | 20 |
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage; |
20 | 21 |
|
21 | 22 |
|
22 |
public class NameDetailsViewConfiguration extends CdmPreferencePage{// implements SelectionListener{
|
|
23 |
public class NameDetailsViewConfiguration extends CdmPreferencePage implements SelectionListener{ |
|
23 | 24 |
|
24 | 25 |
boolean isUseLocalSettings; |
25 | 26 |
protected NameDetailsConfigurator nameDetailsConfig; |
... | ... | |
108 | 109 |
separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
109 | 110 |
showTaxon = new Button(dbSettings, SWT.CHECK); |
110 | 111 |
showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon); |
112 |
showTaxon.addSelectionListener(this); |
|
111 | 113 |
isShowTaxon = nameDetailsConfig.isTaxonSectionActivated(); |
112 | 114 |
|
113 | 115 |
showTaxon.addSelectionListener(new SelectionAdapter(){ |
... | ... | |
132 | 134 |
GridLayoutFactory.fillDefaults().applyTo(taxonComp); |
133 | 135 |
secEnabled = new Button(taxonComp, SWT.CHECK); |
134 | 136 |
secEnabled.setText(Messages.NameDetailsViewComposite_SecEnabled); |
135 |
|
|
137 |
secEnabled.addSelectionListener(this); |
|
136 | 138 |
isSecEnabled = nameDetailsConfig.isSecEnabled(); |
137 | 139 |
|
138 | 140 |
secEnabled.addSelectionListener(new SelectionAdapter(){ |
... | ... | |
145 | 147 |
}); |
146 | 148 |
showSecDetail = new Button(taxonComp, SWT.CHECK); |
147 | 149 |
showSecDetail.setText(Messages.NameDetailsViewComposite_Show_SecDetail); |
148 |
|
|
150 |
showSecDetail.addSelectionListener(this); |
|
149 | 151 |
isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated(); |
150 | 152 |
|
151 | 153 |
showSecDetail.addSelectionListener(new SelectionAdapter(){ |
... | ... | |
160 | 162 |
showLsid = new Button(dbSettings, SWT.CHECK); |
161 | 163 |
showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID); |
162 | 164 |
isShowLSID = nameDetailsConfig.isLSIDActivated(); |
163 |
|
|
165 |
showLsid.addSelectionListener(this); |
|
164 | 166 |
showLsid.addSelectionListener(new SelectionAdapter(){ |
165 | 167 |
@Override |
166 | 168 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
173 | 175 |
showNomenclaturalCode = new Button(dbSettings, SWT.CHECK); |
174 | 176 |
showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode); |
175 | 177 |
isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived(); |
176 |
|
|
178 |
showNomenclaturalCode.addSelectionListener(this); |
|
177 | 179 |
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){ |
178 | 180 |
@Override |
179 | 181 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
186 | 188 |
showNameCache = new Button(dbSettings, SWT.CHECK); |
187 | 189 |
showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache); |
188 | 190 |
isShowNameCache = nameDetailsConfig.isNameCacheActivated(); |
189 |
|
|
191 |
showNameCache.addSelectionListener(this); |
|
190 | 192 |
showNameCache.addSelectionListener(new SelectionAdapter(){ |
191 | 193 |
@Override |
192 | 194 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
198 | 200 |
showAppendedPhrase = new Button(dbSettings, SWT.CHECK); |
199 | 201 |
isShowAppendedPhrase= nameDetailsConfig.isAppendedPhraseActivated(); |
200 | 202 |
showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase); |
201 |
|
|
203 |
showAppendedPhrase.addSelectionListener(this); |
|
202 | 204 |
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){ |
203 | 205 |
@Override |
204 | 206 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
211 | 213 |
showRank = new Button(dbSettings, SWT.CHECK); |
212 | 214 |
isShowRank = nameDetailsConfig.isRankActivated(); |
213 | 215 |
showRank.setText(Messages.NameDetailsViewComposite_Show_Rank); |
214 |
|
|
216 |
showRank.addSelectionListener(this); |
|
215 | 217 |
showRank.addSelectionListener(new SelectionAdapter(){ |
216 | 218 |
@Override |
217 | 219 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
223 | 225 |
showEpithets = new Button(dbSettings, SWT.CHECK); |
224 | 226 |
isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated(); |
225 | 227 |
showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets); |
226 |
|
|
228 |
showEpithets.addSelectionListener(this); |
|
227 | 229 |
showEpithets.addSelectionListener(new SelectionAdapter(){ |
228 | 230 |
@Override |
229 | 231 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
236 | 238 |
showAuthorCache = new Button(dbSettings, SWT.CHECK); |
237 | 239 |
isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated(); |
238 | 240 |
showAuthorCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache); |
239 |
|
|
241 |
showAuthorCache.addSelectionListener(this); |
|
240 | 242 |
showAuthorCache.addSelectionListener(new SelectionAdapter(){ |
241 | 243 |
@Override |
242 | 244 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
249 | 251 |
showAuthorship = new Button(dbSettings, SWT.CHECK); |
250 | 252 |
isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated(); |
251 | 253 |
showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author); |
252 |
|
|
254 |
showAuthorship.addSelectionListener(this); |
|
253 | 255 |
showAuthorship.addSelectionListener(new SelectionAdapter(){ |
254 | 256 |
@Override |
255 | 257 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
262 | 264 |
showNomenclaturalRef = new Button(dbSettings, SWT.CHECK); |
263 | 265 |
isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated(); |
264 | 266 |
showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference); |
265 |
|
|
267 |
showNomenclaturalRef.addSelectionListener(this); |
|
266 | 268 |
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){ |
267 | 269 |
@Override |
268 | 270 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
275 | 277 |
showNomenclaturalStatus = new Button(dbSettings, SWT.CHECK); |
276 | 278 |
isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated(); |
277 | 279 |
showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus); |
278 |
|
|
280 |
showNomenclaturalStatus.addSelectionListener(this); |
|
279 | 281 |
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){ |
280 | 282 |
@Override |
281 | 283 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
302 | 304 |
showNomenclaturalStatusRuleConsidered = new Button(nomenlaturalStatusComp, SWT.CHECK); |
303 | 305 |
isShowNomenclaturalStatusRuleConsidered = nameDetailsConfig.isNomenclaturalStatusRuleConsideredActivated(); |
304 | 306 |
showNomenclaturalStatusRuleConsidered.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsidered); |
305 |
|
|
307 |
showNomenclaturalStatusRuleConsidered.addSelectionListener(this); |
|
306 | 308 |
showNomenclaturalStatusRuleConsidered.addSelectionListener(new SelectionAdapter(){ |
307 | 309 |
@Override |
308 | 310 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
316 | 318 |
showNomenclaturalStatusRuleConsideredCodeEdition = new Button(nomenlaturalStatusComp, SWT.CHECK); |
317 | 319 |
isShowNomenclaturalStatusRuleConsideredCodeEdition = nameDetailsConfig.isNomenclaturalStatusRuleConsideredCodeEditionActivated(); |
318 | 320 |
showNomenclaturalStatusRuleConsideredCodeEdition.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsideredCodeEdition); |
319 |
|
|
321 |
showNomenclaturalStatusRuleConsideredCodeEdition.addSelectionListener(this); |
|
320 | 322 |
showNomenclaturalStatusRuleConsideredCodeEdition.addSelectionListener(new SelectionAdapter(){ |
321 | 323 |
@Override |
322 | 324 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
329 | 331 |
showProtologue = new Button(dbSettings, SWT.CHECK); |
330 | 332 |
isShowProtologue = nameDetailsConfig.isProtologueActivated(); |
331 | 333 |
showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue); |
332 |
|
|
334 |
showProtologue.addSelectionListener(this); |
|
333 | 335 |
showProtologue.addSelectionListener(new SelectionAdapter(){ |
334 | 336 |
@Override |
335 | 337 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
342 | 344 |
showTypeDesignation = new Button(dbSettings, SWT.CHECK); |
343 | 345 |
isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated(); |
344 | 346 |
showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation); |
345 |
|
|
347 |
showTypeDesignation.addSelectionListener(this); |
|
346 | 348 |
showTypeDesignation.addSelectionListener(new SelectionAdapter(){ |
347 | 349 |
@Override |
348 | 350 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
356 | 358 |
showNameRelationship = new Button(dbSettings, SWT.CHECK); |
357 | 359 |
isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated(); |
358 | 360 |
showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships); |
359 |
|
|
361 |
showNameRelationship.addSelectionListener(this); |
|
360 | 362 |
showNameRelationship.addSelectionListener(new SelectionAdapter(){ |
361 | 363 |
@Override |
362 | 364 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
380 | 382 |
showNameRelationshipRuleConsidered = new Button(nameRelationComp, SWT.CHECK); |
381 | 383 |
isShowNameRelationshipRuleConsidered = nameDetailsConfig.isNameRelationsRuleConsideredActivated(); |
382 | 384 |
showNameRelationshipRuleConsidered.setText(Messages.NameDetailsViewComposite_Show_Namerelationships_RuleConsidered); |
383 |
|
|
385 |
showNameRelationshipRuleConsidered.addSelectionListener(this); |
|
384 | 386 |
showNameRelationshipRuleConsidered.addSelectionListener(new SelectionAdapter(){ |
385 | 387 |
@Override |
386 | 388 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
395 | 397 |
showNameRelationshipRuleConsideredCodeEdition = new Button(nameRelationComp, SWT.CHECK); |
396 | 398 |
isShowNameRelationshipRuleConsideredCodeEdition = nameDetailsConfig.isNameRelationsRuleConsideredCodeEditionActivated(); |
397 | 399 |
showNameRelationshipRuleConsideredCodeEdition.setText(Messages.NameDetailsViewComposite_Show_Namerelationships_RuleConsideredCodeEdition); |
398 |
|
|
400 |
showNameRelationshipRuleConsideredCodeEdition.addSelectionListener(this); |
|
399 | 401 |
showNameRelationshipRuleConsideredCodeEdition.addSelectionListener(new SelectionAdapter(){ |
400 | 402 |
@Override |
401 | 403 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
408 | 410 |
showHybrid = new Button(dbSettings, SWT.CHECK); |
409 | 411 |
isShowHybrid = nameDetailsConfig.isHybridActivated(); |
410 | 412 |
showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid); |
411 |
|
|
413 |
showHybrid.addSelectionListener(this); |
|
412 | 414 |
showHybrid.addSelectionListener(new SelectionAdapter(){ |
413 | 415 |
@Override |
414 | 416 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
420 | 422 |
showNameApprobiation = new Button(dbSettings, SWT.CHECK); |
421 | 423 |
isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated(); |
422 | 424 |
showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation); |
425 |
showNameApprobiation.addSelectionListener(this); |
|
423 | 426 |
showNameApprobiation.addSelectionListener(new SelectionAdapter(){ |
424 | 427 |
@Override |
425 | 428 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
474 | 477 |
|
475 | 478 |
} |
476 | 479 |
isOverride = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true) != null? PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true): false; |
477 |
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(true); |
|
480 |
if (isOverride){ |
|
481 |
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(true); |
|
482 |
}else{ |
|
483 |
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false); |
|
484 |
} |
|
478 | 485 |
} |
479 | 486 |
} |
480 | 487 |
|
... | ... | |
525 | 532 |
|
526 | 533 |
@Override |
527 | 534 |
protected void performDefaults() { |
528 |
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false); |
|
535 |
if (isAdminPreference){ |
|
536 |
nameDetailsConfig = new NameDetailsConfigurator(); |
|
537 |
}else{ |
|
538 |
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false); |
|
539 |
} |
|
529 | 540 |
|
530 | 541 |
isShowAppendedPhrase = nameDetailsConfig.isAppendedPhraseActivated(); |
531 | 542 |
isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated(); |
... | ... | |
551 | 562 |
isShowHybrid = nameDetailsConfig.isHybridActivated(); |
552 | 563 |
// isSimpleDetailsViewActivated = null; |
553 | 564 |
isAllowOverride = true; |
565 |
isOverride = false; |
|
554 | 566 |
this.setButtonSelections(); |
555 | 567 |
// PreferencesUtil.recursiveSetEnabled(dbSettings, isSimpleDetailsViewActivated!= null? isSimpleDetailsViewActivated:false); |
556 | 568 |
// activateCheckButton.select(0); |
... | ... | |
558 | 570 |
super.performDefaults(); |
559 | 571 |
} |
560 | 572 |
|
573 |
@Override |
|
574 |
public void widgetSelected(SelectionEvent e) { |
|
575 |
if (e.getSource() != getApplyButton() || e.getSource() != getDefaultsButton()){ |
|
576 |
isOverride = true; |
|
577 |
} |
|
578 |
|
|
579 |
} |
|
580 |
|
|
581 |
@Override |
|
582 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
583 |
// TODO Auto-generated method stub |
|
584 |
|
|
585 |
} |
|
586 |
|
|
561 | 587 |
|
562 | 588 |
|
563 | 589 |
} |
Also available in: Unified diff
ref #8648: default handling in name details preference