Project

General

Profile

Revision 828e0012

ID828e0012bde5f63f0f083e2fbddf00723bd0b14e
Parent 3a553a43
Child ec4a9eb1

Added by Katja Luther 5 months ago

ref #9373: adapt detail elements to enable/disable possibility of toggleable text fields

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java
48 48
	private final Composite container;
49 49
	private final CacheRelevance relevance;
50 50

  
51
	private boolean isEnabled = true;
51 52
	//TODO for RL
52 53
	public void setVisible(boolean b) {
53 54
		text_cache.setVisible(b);
......
121 122
	        btnToggleProtectTitleCache.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
122 123
	        btnToggleProtectTitleCache.setToolTipText(Messages.ToggleableText_ToolTip_closed);
123 124
	    }
124
	   setEnabled(state);
125
	    setCacheEnabled(state);
125 126
		this.state = state;
126 127
	}
127 128

  
128
	@Override
129
    public void setEnabled(boolean enabled) {
130
		text_cache.setEnabled(enabled);
129

  
130
    public void setCacheEnabled(boolean enabled) {
131
        text_cache.setEnabled(enabled);
131 132
       	btnToggleProtectTitleCache.setGrayed(enabled);
132 133
		btnToggleProtectTitleCache.setSelection(enabled);
133 134
		Color color = enabled ? null : AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED);
......
135 136
		text_cache.setForeground(color);
136 137
	}
137 138

  
139
    @Override
140
    public void setEnabled(boolean isEnabled){
141
        this.isEnabled = isEnabled;
142
        text_cache.setEnabled(isEnabled);
143
        btnToggleProtectTitleCache.setEnabled(isEnabled);
144
    }
145

  
138 146
	@Override
139 147
	public boolean isEnabled() {
140
	    return text_cache.isEnabled();
148
	    return isEnabled;
141 149
	}
142 150

  
151
	public boolean isCacheEnabled() {
152
        return btnToggleProtectTitleCache.getSelection();
153
    }
154

  
143 155
    public CacheRelevance getRelevance() {
144 156
        return this.relevance;
145 157
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
75 75
				formElement, "Title Cache", entity.getTitleCache(),
76 76
				entity.isProtectedTitleCache(), style);
77 77
        //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
78
		if(showOnlyDerivedUnitData){
79
		    toggleableText_titleCache.setEnabled(false);
80
		}
81
		else{
78
		if(!showOnlyDerivedUnitData){
82 79
		    combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
83 80
		    combo_specorobstype.setSelection(entity.getType());
84 81
		    combo_specorobstype.setEnabled(showSpecimenType);
......
127 124
		if (eventSource == toggleableText_titleCache) {
128 125
			getEntity().setTitleCache(toggleableText_titleCache.getText(),
129 126
					toggleableText_titleCache.getState());
127

  
130 128
		} else if (eventSource == selection_country) {
131 129
			getEntity().setCountry(selection_country.getSelection());
132 130
		} else if (eventSource == languageText_locality) {
......
155 153
            getEntity().innerDerivedUnit().setPublish(checkIsPublish.getSelection());
156 154
        }
157 155

  
158
		if (eventSource != toggleableText_titleCache) {
159
			toggleableText_titleCache.setText(getEntity().getTitleCache());
160
		}
156
		toggleableText_titleCache.setText(getEntity().getTitleCache());
157

  
161 158
	}
162 159

  
163 160
    public void setShowOnlyDerivedUnitData(boolean showOnlyDerivedUnitData) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitFacadeGeneralDetailElement.java
87 87
    public void handleEvent(Object eventSource) {
88 88
        if (eventSource == toggleableText_titleCache) {
89 89
            getEntity().setTitleCache(toggleableText_titleCache.getText(), toggleableText_titleCache.getState());
90

  
90 91
        } else if (eventSource == selection_country) {
91 92
            getEntity().setCountry(selection_country.getSelection());
92 93
        } else if (eventSource == languageText_locality) {
......
108 109
            getEntity().innerFieldUnit().setPublish(checkIsPublish.getSelection());
109 110
        }
110 111

  
111
        if (eventSource != toggleableText_titleCache) {
112
            toggleableText_titleCache.setText(getEntity().getTitleCache());
113
        }
112
        toggleableText_titleCache.setText(getEntity().getTitleCache());
113

  
114 114
    }
115 115
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
36 36
import eu.etaxonomy.taxeditor.ui.element.VerbatimTimePeriodElement;
37 37
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
38 38
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
39
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
39 40
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
40 41

  
41 42
/**
......
72 73
	private EntitySelectionElement<Reference> selection_inReference;
73 74
	private EntitySelectionElement<Institution> selection_institution;
74 75
	private EnumComboElement<ReferenceType> combo_referenceType;
75

  
76
	private ExternalLinksSection externalLinks;
76 77
	private EntitySelectionElement<Reference> selection_inSeries;
77 78

  
78 79
    private void registerCacheElements() {
......
168 169
		}
169 170

  
170 171
		createUri(this, entity, SWT.NULL);
172

  
173
//		externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
174
//        externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
175
//        externalLinks.setEntity(entity);
176
//        externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
177
//        externalLinks.setEmptySectionString("No links yet.");
178

  
171 179
		if(referenceType != null && (!referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) && !referenceType.equals(ReferenceType.PersonalCommunication))) {
172 180
            text_doi = formFactory.createDoiWithLabelElement(formElement, "DOI", entity.getDoi(), style);
173 181
        }
......
428 436
			getEntity().setSeriesPart(text_series.getText());
429 437
		} else if (eventSource == text_title ) {
430 438
			getEntity().setTitle(text_title.getText());
431
			if (!toggleable_cache.isEnabled()){
439
			if (!toggleable_cache.isCacheEnabled()){
432 440
			    toggleable_cache.setText(getEntity().generateTitle());
433 441
			}
434 442
		} else if (eventSource == text_abbrevTitle ) {
435 443
		    getEntity().setAbbrevTitle(text_abbrevTitle.getText());
436
		    if (!toggleableAbbrevCache.isEnabled()){
444
		    if (!toggleableAbbrevCache.isCacheEnabled()){
437 445
		        toggleableAbbrevCache.setText(getEntity().generateAbbrevTitle());
438 446
		    }
439 447
		} else if (eventSource == text_uri) {
......
444 452
			getEntity().setVolume(text_volume.getText());
445 453
		}else if (eventSource == text_doi) {
446 454
            getEntity().setDoi(text_doi.parseText());
447
        }else if (eventSource == text_accessed.getController()) {
455
        }else if (text_accessed != null && eventSource == text_accessed.getController()) {
448 456
            getEntity().setAccessed(text_accessed.getController().getDateTime());
449 457
        }
450 458

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
122 122
	@Override
123 123
	protected void updateContent() {
124 124
		super.updateContent();
125
		toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
125
		toggleable_cache.setCacheEnabled(getEntity().isProtectedTitleCache());
126 126
		updateCacheRelevance();
127 127
	}
128 128

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)