private final Composite container;
private final CacheRelevance relevance;
+ private boolean isEnabled = true;
//TODO for RL
public void setVisible(boolean b) {
text_cache.setVisible(b);
btnToggleProtectTitleCache.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
btnToggleProtectTitleCache.setToolTipText(Messages.ToggleableText_ToolTip_closed);
}
- setEnabled(state);
+ setCacheEnabled(state);
this.state = state;
}
- @Override
- public void setEnabled(boolean enabled) {
- text_cache.setEnabled(enabled);
+
+ public void setCacheEnabled(boolean enabled) {
+ text_cache.setEnabled(enabled);
btnToggleProtectTitleCache.setGrayed(enabled);
btnToggleProtectTitleCache.setSelection(enabled);
Color color = enabled ? null : AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED);
text_cache.setForeground(color);
}
+ @Override
+ public void setEnabled(boolean isEnabled){
+ this.isEnabled = isEnabled;
+ text_cache.setEnabled(isEnabled);
+ btnToggleProtectTitleCache.setEnabled(isEnabled);
+ }
+
@Override
public boolean isEnabled() {
- return text_cache.isEnabled();
+ return isEnabled;
}
+ public boolean isCacheEnabled() {
+ return btnToggleProtectTitleCache.getSelection();
+ }
+
public CacheRelevance getRelevance() {
return this.relevance;
}
formElement, "Title Cache", entity.getTitleCache(),
entity.isProtectedTitleCache(), style);
//TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
- if(showOnlyDerivedUnitData){
- toggleableText_titleCache.setEnabled(false);
- }
- else{
+ if(!showOnlyDerivedUnitData){
combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
combo_specorobstype.setSelection(entity.getType());
combo_specorobstype.setEnabled(showSpecimenType);
if (eventSource == toggleableText_titleCache) {
getEntity().setTitleCache(toggleableText_titleCache.getText(),
toggleableText_titleCache.getState());
+
} else if (eventSource == selection_country) {
getEntity().setCountry(selection_country.getSelection());
} else if (eventSource == languageText_locality) {
getEntity().innerDerivedUnit().setPublish(checkIsPublish.getSelection());
}
- if (eventSource != toggleableText_titleCache) {
- toggleableText_titleCache.setText(getEntity().getTitleCache());
- }
+ toggleableText_titleCache.setText(getEntity().getTitleCache());
+
}
public void setShowOnlyDerivedUnitData(boolean showOnlyDerivedUnitData) {
public void handleEvent(Object eventSource) {
if (eventSource == toggleableText_titleCache) {
getEntity().setTitleCache(toggleableText_titleCache.getText(), toggleableText_titleCache.getState());
+
} else if (eventSource == selection_country) {
getEntity().setCountry(selection_country.getSelection());
} else if (eventSource == languageText_locality) {
getEntity().innerFieldUnit().setPublish(checkIsPublish.getSelection());
}
- if (eventSource != toggleableText_titleCache) {
- toggleableText_titleCache.setText(getEntity().getTitleCache());
- }
+ toggleableText_titleCache.setText(getEntity().getTitleCache());
+
}
}
\ No newline at end of file
import eu.etaxonomy.taxeditor.ui.element.VerbatimTimePeriodElement;
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
private EntitySelectionElement<Reference> selection_inReference;
private EntitySelectionElement<Institution> selection_institution;
private EnumComboElement<ReferenceType> combo_referenceType;
-
+ private ExternalLinksSection externalLinks;
private EntitySelectionElement<Reference> selection_inSeries;
private void registerCacheElements() {
}
createUri(this, entity, SWT.NULL);
+
+// externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
+// externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
+// externalLinks.setEntity(entity);
+// externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
+// externalLinks.setEmptySectionString("No links yet.");
+
if(referenceType != null && (!referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) && !referenceType.equals(ReferenceType.PersonalCommunication))) {
text_doi = formFactory.createDoiWithLabelElement(formElement, "DOI", entity.getDoi(), style);
}
getEntity().setSeriesPart(text_series.getText());
} else if (eventSource == text_title ) {
getEntity().setTitle(text_title.getText());
- if (!toggleable_cache.isEnabled()){
+ if (!toggleable_cache.isCacheEnabled()){
toggleable_cache.setText(getEntity().generateTitle());
}
} else if (eventSource == text_abbrevTitle ) {
getEntity().setAbbrevTitle(text_abbrevTitle.getText());
- if (!toggleableAbbrevCache.isEnabled()){
+ if (!toggleableAbbrevCache.isCacheEnabled()){
toggleableAbbrevCache.setText(getEntity().generateAbbrevTitle());
}
} else if (eventSource == text_uri) {
getEntity().setVolume(text_volume.getText());
}else if (eventSource == text_doi) {
getEntity().setDoi(text_doi.parseText());
- }else if (eventSource == text_accessed.getController()) {
+ }else if (text_accessed != null && eventSource == text_accessed.getController()) {
getEntity().setAccessed(text_accessed.getController().getDateTime());
}
@Override
protected void updateContent() {
super.updateContent();
- toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
+ toggleable_cache.setCacheEnabled(getEntity().isProtectedTitleCache());
updateCacheRelevance();
}