Project

General

Profile

« Previous | Next » 

Revision 1bfcc747

Added by Katja Luther almost 8 years ago

add first implementation for simple details view

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractIdentifiableEntityDetailElement.java
9 9
import eu.etaxonomy.cdm.model.common.CdmBase;
10 10
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
11 11
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
12
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
13
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
12 14
import eu.etaxonomy.taxeditor.store.CdmStore;
13 15
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
14 16
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
......
26 28
     */
27 29
    private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
28 30
    protected ToggleableTextElement toggleable_cache;
31
    protected boolean isAdvancedView ;
29 32

  
30 33
    public AbstractIdentifiableEntityDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
31 34
        super(formFactory, formElement);
32 35
        updateToggleableCacheState();
36
        initIsAdvancedDetailsView();
33 37

  
34 38
    }
35 39

  
36 40
    public void updateToggleableCacheField() {
37
        if (!getEntity().isProtectedTitleCache()) {
38
            toggleable_cache.setText(getEntity().generateTitle());
41
        if (toggleable_cache != null){
42
            if (!getEntity().isProtectedTitleCache()) {
43
                toggleable_cache.setText(getEntity().generateTitle());
44
            }
39 45
        }
40 46
    }
41 47

  
......
60 66
            toggleable_cache.setEnabled(getEntity() != null && CdmStore.currentAuthentiationHasPermission((CdmBase) getEntity(), UPDATE));
61 67
        }
62 68
    }
69
    protected void initIsAdvancedDetailsView(){
70
        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
71
            isAdvancedView = false;
72
        } else{
73
            isAdvancedView = true;
74
        }
75

  
76

  
77

  
78
    }
63 79

  
64 80
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java
61 61
	@Override
62 62
	protected void createControls(ICdmFormElement formElement,
63 63
			NonViralName entity, int style) {
64
		toggleable_cache = formFactory.createToggleableTextField(this,
64
	    if (isAdvancedView){
65
	        toggleable_cache = formFactory.createToggleableTextField(this,
65 66
				"Authorship Cache", entity.getAuthorshipCache(),
66 67
				entity.isProtectedAuthorshipCache(), style);
68
		    //TODO RL
69
            if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
70
                toggleable_cache.setVisible(false);
71
            }
72
	    }
67 73

  
68
		//TODO RL
69
		if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
70
			toggleable_cache.setVisible(false);
71
		}
72 74
		selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
73 75
				getConversationHolder(),
74 76
				formElement, "Author",
......
100 102
		}
101 103

  
102 104
		super.updateContent();
103
		toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache());
105
		if (toggleable_cache != null){
106
    		toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache());
107

  
104 108

  
105
		if (this.isIrrelevant()) {
106
			setIrrelevant(isIrrelevant());
107
		} else {
108
			setIrrelevant(toggleable_cache.getState(),
109
					Arrays.asList(new Object[] { toggleable_cache }));
109
    		if (this.isIrrelevant()) {
110
    			setIrrelevant(isIrrelevant());
111
    		} else {
112
    			setIrrelevant(toggleable_cache.getState(),
113
    					Arrays.asList(new Object[] { toggleable_cache }));
114
    		}
110 115
		}
111 116
	}
112 117

  
......
148 153

  
149 154
	@Override
150 155
	public void updateToggleableCacheField() {
151
		if(! getEntity().isProtectedAuthorshipCache()){
152
			toggleable_cache.setText(getEntity().getAuthorshipCache());
153
		}
156
	    if (toggleable_cache != null){
157
    		if(! getEntity().isProtectedAuthorshipCache()){
158
    			toggleable_cache.setText(getEntity().getAuthorshipCache());
159
    		}
160
	    }
154 161
	}
155 162
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java
31 31

  
32 32
	private TaxonBase taxonBase;
33 33

  
34

  
34 35
	public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
35 36
			ISelectionProvider selectionProvider, int style) {
36 37
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
38

  
37 39
	}
38 40

  
39 41
	/** {@inheritDoc} */
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
79 79
	@Override
80 80
	protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) {
81 81

  
82
		toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
83

  
82
	    if (isAdvancedView){
83
	        toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
84
	    }
84 85
		combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
85 86

  
86 87
		createGenusOrUninomialControls(this, nonViralName, style);
87 88
		createInfragenerericEpithetControls(this, nonViralName, style);
88 89
		createSpecificEpithetControls(this, nonViralName, style);
89 90
		createInfraSpecificEpithetControls(this, nonViralName, style);
90

  
91
		createSpecificNameParts(this, nonViralName, style);
92

  
93
		text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
94

  
91
		if (isAdvancedView){
92
		    createSpecificNameParts(this, nonViralName, style);
93
			text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
94
		}
95 95
	}
96 96

  
97 97
	/**
......
115 115
		}
116 116

  
117 117
		super.updateContent();
118

  
119
		if(isIrrelevant()){
120
			setIrrelevant(isIrrelevant());
121
		}else{
122
			setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
118
		if (isAdvancedView){
119
    		if(isIrrelevant()){
120
    			setIrrelevant(isIrrelevant());
121
    		}else{
122
    			setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
123
    		}
123 124
		}
124 125
	}
125 126

  
......
246 247

  
247 248
	@Override
248 249
	public void updateToggleableCacheField() {
249
		if(! getEntity().isProtectedNameCache()){
250
			toggleable_cache.setText(getEntity().getNameCache());
251
		}
250
	    if (toggleable_cache != null){
251
    		if(! getEntity().isProtectedNameCache()){
252
    			toggleable_cache.setText(getEntity().getNameCache());
253
    		}
254
	    }
252 255
	}
253
	
256

  
254 257
	@Override
255 258
	protected void handleToggleableCacheField() {
256 259
        boolean pushedState = toggleable_cache.getState();
......
258 261
        getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
259 262
        setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, text_appendedPhrase, checkbox_anamorphic }));
260 263
        updateToggleableCacheField();
261
    }	
264
    }
265

  
266

  
262 267

  
263 268

  
264 269
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailSection.java
87 87
	@Override
88 88
	protected AbstractCdmDetailElement<NonViralName> createCdmDetailElement(AbstractCdmDetailSection<NonViralName> parentElement, int style) {
89 89
	    return formFactory.createNameDetailElement(parentElement, style);
90

  
90 91
	}
91 92
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
32 32
 * @version 1.0
33 33
 */
34 34
public class NonViralNameDetailElement extends
35
	AbstractIdentifiableEntityDetailElement<NonViralName> {
35
	AbstractIdentifiableEntityDetailElement<NonViralName>  {
36 36

  
37 37
	private NameDetailSection section_name;
38 38
	private AuthorshipDetailSection section_author;
......
40 40
	private HybridDetailSection section_hybrid;
41 41
	private LsidWithExceptionLabelElement textLsid;
42 42

  
43

  
43 44
	public NonViralNameDetailElement(CdmFormFactory formFactory,
44 45
			ICdmFormElement formElement) {
45 46
		super(formFactory, formElement);
47
		initIsAdvancedDetailsView();
48

  
46 49
	}
47 50

  
48 51
	/** {@inheritDoc} */
49 52
	@Override
50 53
    protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) {
51
	    toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
52 54

  
53
	    combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
54
	    combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
55 55

  
56
	    //TODO RL
57
	    if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
58
	        toggleable_cache.setVisible(false);
59
	        combo_nomenclaturalCode.setVisible(false);
60
	    }
61
	    textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
56
        if (isAdvancedView){
57
            toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
58

  
59
            combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
60
            combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
61
            textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
62
            //TODO RL
63
            if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
64
                toggleable_cache.setVisible(false);
65
                combo_nomenclaturalCode.setVisible(false);
66
            }
67
        }
68

  
69

  
62 70
	    section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
63 71
	    section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
64 72
	    addControl(section_name);
......
69 77
	    addElement(section_author);
70 78

  
71 79
	    //TODO RL
72
	    if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
73
	        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
74
	        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
75
	        addControl(section_hybrid);
76
	        addElement(section_hybrid);
80
	    if (isAdvancedView){
81
    	    if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
82
    	        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
83
    	        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
84
    	        addControl(section_hybrid);
85
    	        addElement(section_hybrid);
86
    	    }
77 87
	    }
78 88

  
79 89

  
......
162 172
        setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, textLsid }));
163 173
        updateToggleableCacheField();
164 174
    }
175

  
176

  
177

  
178

  
179
//    @Override
180
//    public void toggleAdvancedMediaView(){
181
//        mediaDetailElement.toggleAdvancedMediaView();
182
//    }
165 183
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailSection.java
26 26
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
27 27
import eu.etaxonomy.taxeditor.model.ImageResources;
28 28
import eu.etaxonomy.taxeditor.model.MessagingUtils;
29
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
30
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
29 31
import eu.etaxonomy.taxeditor.store.CdmStore;
30 32
import eu.etaxonomy.taxeditor.ui.dialog.selection.NameSelectionDialog;
31 33
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
66 68
	protected Control createToolbar() {
67 69
	        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
68 70

  
69
	        if(nameChoosable){
71
	        if(nameChoosable && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
70 72
	            //choose name
71 73
	            Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
72 74
	                @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
363 363

  
364 364
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
365 365
                ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
366
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
367
            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
368
            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
369
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
366 370

  
367
        TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
368
        		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
369
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
370

  
371
            addPart(taxonBaseDetailSection);
372
        }
371 373
        NonViralNameDetailSection nonViralNameSection = formFactory
372 374
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
373 375
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
374 376
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
377
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
378
            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
379
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
380
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
375 381

  
376
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
377
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
378
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
379

  
380
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
381
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
382
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
382
            NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
383
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
384
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
383 385

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

  
......
398 403
        }
399 404

  
400 405
        addPart(parsingMessagesSection);
401
        addPart(taxonBaseDetailSection);
406

  
402 407
        addPart(nonViralNameSection);
403
        addPart(nomenclaturalStatusSection);
404
        addPart(referenceDetailSection);
408

  
405 409
    }
406 410

  
407 411
    private void createNameSections(RootElement parent) {

Also available in: Unified diff