Project

General

Profile

« Previous | Next » 

Revision 76b874f8

Added by Katja Luther over 7 years ago

fix #6050: add the possibility to configure which fields should be displayed in name details view

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
156 156

  
157 157
    public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia";
158 158
    public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName";
159
    public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon";
159 160
    public static final String SHOW_NAME_DETAILS_SECTION_LSID = "eu.etaxonomy.taxeditor.name.showNameLsid";
160 161
    public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalCode";
161 162
    public static final String SHOW_NAME_DETAILS_SECTION_RANK = "eu.etaxonomy.taxeditor.name.showNameRank";
163
    public static final String SHOW_NAME_DETAILS_SECTION_NAMECACHE = "eu.etaxonomy.taxeditor.name.showNameNameCache";
162 164
    public static final String SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS = "eu.etaxonomy.taxeditor.name.showNameAtomisedEpithets";
163 165
    public static final String SHOW_NAME_DETAILS_SECTION_AUTHORSHIP = "eu.etaxonomy.taxeditor.name.showNameAuthorship";
164 166
    public static final String SHOW_NAME_DETAILS_SECTION_HYBRID = "eu.etaxonomy.taxeditor.name.showNameHybrid";
......
167 169
    public static final String SHOW_NAME_DETAILS_SECTION_PROTOLOGUE = "eu.etaxonomy.taxeditor.name.showNameProtologue";
168 170
    public static final String SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION = "eu.etaxonomy.taxeditor.name.showNameTypeDesignation";
169 171
    public static final String SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP = "eu.etaxonomy.taxeditor.name.showNameNameRelationship";
170

  
172
	public static final String SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE = "eu.etaxonomy.taxeditor.name.showNameAppendedPhrase";
173
	public static final String SHOW_NAME_DETAILS_SECTION_CACHE = "eu.etaxonomy.taxeditor.name.showNameCache";
174
	
171 175
    public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor";
172 176

  
173 177
    // TODO RL
......
182 186
     */
183 187
    public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories";
184 188

  
189
	
190

  
191

  
192

  
193

  
185 194

  
186 195

  
187 196
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
451 451
		getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_HEIGHT, "1000");
452 452
		getPreferenceStore().setDefault(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, false);
453 453
		getPreferenceStore().setDefault(CHECKLIST_ID_IN_VOCABULARY, true);
454
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, true);
455
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, true);
456
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_HYBRID, true);
457
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_LSID, true);
458
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, true);
459
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAMECACHE, true);
460
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, true);
461
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, true);
462
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, true);
463
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, true);
464
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_RANK, true);
465
		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, true);
454 466
	}
455 467

  
456 468
	/**
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
70 70
		addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
71 71
		        "Open search results in separate windows",
72 72
		        getFieldEditorParent()));
73
		addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
74
                "Show only a simple name details view",
75
                getFieldEditorParent()));
73
//		addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
74
//                "Show only a simple name details view",
75
//                getFieldEditorParent()));
76 76

  
77 77
		Composite composite = new Composite(getFieldEditorParent(), SWT.NULL);
78 78
        composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
79 79
        composite.setLayout(new RowLayout(1));
80 80

  
81
        final Label label = new Label(composite, SWT.NONE);
82
        label.setText("Choose the prefered match mode for searches.");
83

  
84
        final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
85

  
86
        MatchMode[] matchModes = MatchMode.values();
87
        int currentSelectionIndex = 0;
88
        for(int i = 0; i < matchModes.length; i++){
89
            MatchMode mode = matchModes[i];
90
            combo_MatchMode.add(mode.name(),i);
91
            //TODO:the correct preselection is needed here!!
92
            if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
93
                currentSelectionIndex = i;
94
            }
95
        }
96

  
97
        combo_MatchMode.select(currentSelectionIndex);
98

  
99
        combo_MatchMode.addSelectionListener(new SelectionAdapter() {
100
            /* (non-Javadoc)
101
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
102
             */
103
            @Override
104
            public void widgetSelected(SelectionEvent e) {
105
                int selectionIndex = combo_MatchMode.getSelectionIndex();
106
                PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
107
            }
108
        });
81
//        final Label label = new Label(composite, SWT.NONE);
82
//        label.setText("Choose the prefered match mode for searches.");
83
//
84
//        final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
85
//
86
//        MatchMode[] matchModes = MatchMode.values();
87
//        int currentSelectionIndex = 0;
88
//        for(int i = 0; i < matchModes.length; i++){
89
//            MatchMode mode = matchModes[i];
90
//            combo_MatchMode.add(mode.name(),i);
91
//            //TODO:the correct preselection is needed here!!
92
//            if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
93
//                currentSelectionIndex = i;
94
//            }
95
//        }
96
//
97
//        combo_MatchMode.select(currentSelectionIndex);
98
//
99
//        combo_MatchMode.addSelectionListener(new SelectionAdapter() {
100
//            /* (non-Javadoc)
101
//             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
102
//             */
103
//            @Override
104
//            public void widgetSelected(SelectionEvent e) {
105
//                int selectionIndex = combo_MatchMode.getSelectionIndex();
106
//                PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
107
//            }
108
//        });
109 109

  
110 110

  
111 111

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
79 79
	protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) {
80 80

  
81 81
	    if (isAdvancedView){
82
	        toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
82
	    	toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
83
	    }else{
84
	    	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE)){
85
	    		toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
86
        	}
83 87
	    }
84 88
		combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
85

  
86
		createGenusOrUninomialControls(this, nonViralName, style);
87
		createInfragenerericEpithetControls(this, nonViralName, style);
88
		createSpecificEpithetControls(this, nonViralName, style);
89
		createInfraSpecificEpithetControls(this, nonViralName, style);
90
		createSpecificNameParts(this, nonViralName, style);
89
		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS)){
90
			createGenusOrUninomialControls(this, nonViralName, style);
91
			createInfragenerericEpithetControls(this, nonViralName, style);
92
			createSpecificEpithetControls(this, nonViralName, style);
93
			createInfraSpecificEpithetControls(this, nonViralName, style);
94
			createSpecificNameParts(this, nonViralName, style);
95
		}
91 96
		if (isAdvancedView){
92 97
		    //createSpecificNameParts(this, nonViralName, style);
93 98
			text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
99
		}else{
100
			if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE)){
101
				text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
102
        	}
94 103
		}
95 104
	}
96 105

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
64 64
                toggleable_cache.setVisible(false);
65 65
                combo_nomenclaturalCode.setVisible(false);
66 66
            }
67
        }else{
68
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE)){
69
        		toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
70
                if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
71
                    toggleable_cache.setVisible(false);
72
                }
73
        	}
74
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE)){
75
        		combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
76
        		combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
77
        		 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
78
        			  combo_nomenclaturalCode.setVisible(false);
79
                 } 
80
        	}
81
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID)){
82
        		textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
83
        		
84
        	}
85
                       
86
        	
67 87
        }
68 88

  
69 89

  
......
84 104
    	        addControl(section_hybrid);
85 105
    	        addElement(section_hybrid);
86 106
    	    }
87
	    }
107
    	 }else{
108
    		 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
109
    			 if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID)){
110
	     	        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
111
	     	        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
112
	     	        addControl(section_hybrid);
113
	     	        addElement(section_hybrid);
114
    			 }
115
     	    }
116
    	 }
88 117

  
89 118

  
90 119
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
365 365
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
366 366
                ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
367 367
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
368
            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
369
            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
370
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
371

  
372
            addPart(taxonBaseDetailSection);
368
        	TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
369
	        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
370
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
371
	        addPart(taxonBaseDetailSection);
372
        }else{
373
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
374
	            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
375
	            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
376
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
377
	
378
	            addPart(taxonBaseDetailSection);
379
        	}
373 380
        }
374 381
        NonViralNameDetailSection nonViralNameSection = formFactory
375 382
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
376 383
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
377 384
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
378
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
385
        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE)){
379 386
            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
380 387
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
381 388
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
382

  
389
            addPart(referenceDetailSection);
390
        }
391
        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS)){
383 392
            NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
384 393
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
385 394
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
386 395

  
387 396
            addPart(nomenclaturalStatusSection);
388
            addPart(referenceDetailSection);
397
            
389 398
        }
390 399
        //TODO RL
391
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
392
	        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
393
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
394

  
395
	        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
396
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
397

  
398
	        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
399
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
400

  
401
			addPart(protologSection);
402
			addPart(typeDesignationSection);
403
			addPart(nameRelationshipSection);
400
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  ){
401
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE)){
402
        		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
403
        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
404
        		addPart(protologSection);
405
        	}
406
        	
407
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION)){
408
        		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
409
        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
410
        		addPart(typeDesignationSection);
411
        	}
412
        	
413
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP)){
414
        		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
415
        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
416
        		addPart(nameRelationshipSection);
417
        	}
404 418
        }
405 419

  
406 420
        addPart(parsingMessagesSection);

Also available in: Unified diff