-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.LoginManager;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
/**
- * <p>
- * Abstract AbstractCdmDetailElement class.
- * </p>
*
* @author n.hoffmann
* @created Feb 26, 2010
private EnumSet<CRUD> requiredCrud = null;
- /**
- * <p>
- * Constructor for AbstractCdmDetailElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param <T>
- * a T object.
- */
public AbstractCdmDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
public void setEntity(T entity) {
this.entity = entity;
// the id is always 0 if the entity was not yet saved, so it is new in this case
- if(StoreUtil.getCdmEntity(getEntity()).getId() == 0) {
+ if(getEntity() == null || StoreUtil.getCdmEntity(getEntity()).getId() == 0) {
// new entity, not yet saved
requiredCrud = EnumSet.of(CRUD.CREATE);
} else {
updateContent();
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity()
- */
- /**
- * <p>
- * Getter for the field <code>entity</code>.
- * </p>
- *
- * @return a T object.
- */
@Override
public T getEntity() {
return entity;
protected void updateContent() {
removeElements();
createControls(this, entity, SWT.WRAP);
- getLayoutComposite().layout();
+ reflowParentScrolledForm(true);
updateControlStates();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.ISelectableComposite#setSelected(boolean)
- */
- /** {@inheritDoc} */
- @Override
+ @Override
public void setSelected(boolean selected) {
Composite section = getLayoutComposite().getParent();
section.setBackground(selected ? SELECTED : getPersistentBackground());
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
- */
@Override
public boolean isEnabled() {
return enabled;
if (getParentElement() instanceof AbstractCdmDetailSection) {
((AbstractCdmDetailSection) getParentElement()).updateTitle();
}
+ reflowParentScrolledForm(true);
}
/**
*/
public abstract void handleEvent(Object eventSource);
- /**
- * <p>
- * handleException
- * </p>
- *
- * @param event
- * a
- * {@link eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent}
- * object.
- */
public void handleException(CdmPropertyChangeEvent event) {
// override this in subclasses if you want to deal with the error
- AbstractUtility.error(event.getSource().getClass(), event.getException());
+ MessagingUtils.error(event.getSource().getClass(), event.getException());
}
- /**
- * <p>
- * isIrrelevant
- * </p>
- *
- * @return a boolean.
- */
public boolean isIrrelevant() {
return irrelevant;
}
- /**
- * <p>
- * getConversationHolder
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
@Override
public ConversationHolder getConversationHolder() {
if (getParentElement() instanceof IConversationEnabled) {