* @return a {@link java.lang.String} object.
*/
protected String getTitle(T cdmObject) {
+ if(cdmObject == null){
+ return "";
+ }
+
if (cdmObject instanceof IIdentifiableEntity) {
return ((IIdentifiableEntity) cdmObject).getTitleCache();
}
+
throw new IllegalArgumentException("Generic method only" +
" supports cdmObject of type IIdentifiableEntity." +
" Please implement specific method in subclass.");
/** {@inheritDoc} */
@Override
protected String getTitle(Reference cdmObject) {
- if(cdmObject.getAuthorTeam() == null){
+ if(cdmObject == null){
+ return "";
+ }else if(cdmObject.getAuthorTeam() == null){
return super.getTitle(cdmObject);
}else{
return ReferenceBaseDefaultCacheStrategy.putAuthorToEndOfString(cdmObject.getTitleCache(), cdmObject.getAuthorTeam().getTitleCache());
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.forms.widgets.Section;
import eu.etaxonomy.taxeditor.store.StoreUtil;
/** {@inheritDoc} */
public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
Assert.isNotNull(propertyChangeListeners, "Property change listeners are not present");
+
for(Object listener : propertyChangeListeners){
((IPropertyChangeListener)listener).propertyChange(event);
}
}
+ public void firePropertyChangeEvent(Object object){
+ firePropertyChangeEvent(object, null);
+ }
+
+ public void firePropertyChangeEvent(Object object, PropertyChangeEvent originatingEvent){
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(object, originatingEvent));
+ }
+
/**
* {@inheritDoc}
return;
}
}
-
+ // call specific handler implementation
handleEvent(eventSource);
-
+ // refire the event
+ firePropertyChangeEvent(this, event);
+ // update possible parents
updateParentSection();
}
}
}
/**
- * <p>handleEvent</p>
+ * Gets called when the source of the event is a child widget of this widget.
*
* @param eventSource a {@link java.lang.Object} object.
*/
} else if (eventSource == text_microReference) {
getEntity().setMicroReference(text_microReference.getText());
}
-
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
} else if (eventSource == checkbox_openInEditor) {
setOpenInEditor(checkbox_openInEditor.getSelection());
}
-
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
-
}
/**
} else if (eventSource == selection_otherNode) {
getEntity().setOtherNode(selection_otherNode.getEntity());
}
-
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
else if(eventSource == checkbox_trinomHybrid){
getEntity().setTrinomHybrid(checkbox_trinomHybrid.getSelection());
}
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.forms.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.forms.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.forms.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.forms.SelectionArbitrator;
import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement;
public void handleEvent(Object eventSource){
if(eventSource == combo_rank){
getEntity().setRank(combo_rank.getSelection());
- clearCheckRankWarnings();
+ clearCheckRankWarnings();
+ updateContent();
}
else if(eventSource == text_appendedPhrase){
getEntity().setAppendedPhrase(text_appendedPhrase.getText());
else if(eventSource == checkbox_anamorphic){
((BotanicalName)getEntity()).setAnamorphic(checkbox_anamorphic.getSelection());
}
-
-
- if(eventSource != toggleable_cache && !toggleable_cache.getLayoutComposite().isDisposed()){
- toggleable_cache.setText(getEntity().getNameCache());
- }
-
-// // we have to notify the parent if this is embedded in the nonviral name section
-// // maybe we can handle this a little bit more elegant
-// if(getParentElement() instanceof AbstractCdmDetailSection)
-// firePropertyChangeEvent(new CdmPropertyChangeEvent(getParentElement(), null));
}
/*
@Override
public void handleEvent(Object eventSource) {
if (eventSource == toggleable_cache) {
- getEntity().setTitleCache(toggleable_cache.getText(),
- toggleable_cache.getState());
+ handleToggleableCacheField();
// we never want the fullTitleCache to be protected since we only
// use it for
// initiating the free text name editor
getEntity().setProtectedFullTitleCache(false);
- boolean irrelevant = toggleable_cache.getState();
- List<Object> except = Arrays
- .asList(new Object[] { toggleable_cache });
- setIrrelevant(irrelevant, except);
} else if (eventSource == section_name || eventSource == section_author) {
if (getParentElement() instanceof AbstractCdmDetailSection)
((AbstractCdmDetailSection) getParentElement()).updateTitle();
section_name.setEntity(getEntity());
getLayoutComposite().layout();
}
-
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
else if(eventSource == combo_sex){
getEntity().setSex(combo_sex.getSelection());
}
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
getEntity().setGatheringEventDescription(
text_gatheringEventDescription.getText());
}
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
if (eventSource != toggleableText_titleCache) {
toggleableText_titleCache.setText(getEntity().getTitleCache());
}
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
getEntity().setCredentialsNonExpired(
checkbox_credentialsNonExpired.getSelection());
}
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
Reference newSelection = ReferenceSelectionDialog.select(getShell(),
getConversationHolder(), entity);
- Reference freshlyLoadedSelection = null;
- if (newSelection != null)
- freshlyLoadedSelection = CdmStore.getService(
- IReferenceService.class).load(newSelection.getUuid());
-
- setSelectionInternal(freshlyLoadedSelection);
+ setSelectionInternal(newSelection);
+
+// Reference freshlyLoadedSelection = null;
+// if (newSelection != null)
+// freshlyLoadedSelection = CdmStore.getService(
+// IReferenceService.class).load(newSelection.getUuid());
+//
+// setSelectionInternal(freshlyLoadedSelection);
}
}
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
Object eventSource = event.getSource();
if (formSection.equals(eventSource)
- || (eventSource instanceof ICdmFormElement && formSection
- .containsFormElement((ICdmFormElement) eventSource))) {
+ || (eventSource instanceof AbstractCdmDetailElement && formSection
+ .containsFormElement((AbstractCdmDetailElement) eventSource))) {
markDirty();
}
}
super(parent, viewPart);
}
- // START HACK TO MAKE THE DERIVED UNIT FACADE WORKING
+ // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
// since we are getting implementations of DerivedUnitBase from the bulk
// editor
- // and not derived unit base objects,
+ // and not derived unit facade objects,
/*
* (non-Javadoc)
super.markViewPartDirty();
}
- // END HACK TO MAKE THE DERIVED UNIT FACADE WORKING
+ // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
/*
* (non-Javadoc)