* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-
package eu.etaxonomy.taxeditor.ui.section.name;
import java.util.Iterator;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
/**
- * <p>Abstract AbstractTypeDesignationElement class.</p>
- *
* @author n.hoffmann
* @created May 17, 2010
- * @version 1.0
*/
-public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBase> extends AbstractSourcedEntityBaseElement<T> {
+public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBase>
+ extends AbstractSourcedEntityBaseElement<T> {
+
+ @SuppressWarnings("unused")
+ private static final Logger logger = LogManager.getLogger(AbstractTypeDesignationElement.class);
- private static final Logger logger = LogManager.getLogger(AbstractTypeDesignationElement.class);
- protected CheckboxElement checkbox_notDesignated;
+ protected CheckboxElement checkbox_notDesignated;
// protected EntitySelectionElement<Reference> selection_reference;
// protected TextWithLabelElement text_referenceDetail;
protected OriginalSourceElement singleSourceElement;
protected ICdmFormElement formElement;
protected int style;
- /**
- * <p>Constructor for AbstractTypeDesignationElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param entity a T object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- * @param <T> a T object.
- */
+
public AbstractTypeDesignationElement(CdmFormFactory formFactory,
AbstractFormSection section, T entity,
SelectionListener removeListener, int style) {
super(formFactory, section, entity, removeListener, style);
}
- /** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
checkbox_notDesignated = formFactory.createCheckbox(formElement, "Not Designated", false, style);
if (entity.hasDesignationSource()){
singleSourceElement.setEntity(entity.getDesignationSource(true));
}
-
+
sourceSection = formFactory.createSourceSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(SourceSection.class, IdentifiableSource.class.getCanonicalName()));
sourceSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sourceSection.setEntity(entity);
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
-
}
/**
*/
protected void updateContent() {
// if (this.getParentElement() instanceof NameDetailSection
-
}
-
public void removeReferenceControls(){
for (Iterator<ICdmFormElement> iterator = getElements().iterator();iterator.hasNext();) {
ICdmFormElement childElement = iterator.next();
// formFactory.removePropertyChangeListener(childElement);
// singleSourceElement = null;
// }
- if (childElement instanceof OriginalSourceElement && ((OriginalSourceElement)childElement).equals(singleSourceElement)) {
-
- childElement.removeElements();
-
- // unregister selection arbitrator
- if(childElement instanceof ISelectableElement){
- SelectionArbitrator selectionArbitrator = ((ISelectableElement) childElement).getSelectionArbitrator();
- if(selectionArbitrator != null){
- formFactory.destroySelectionArbitrator(selectionArbitrator);
- }
- }
-
- // unregister from property changes
- formFactory.removePropertyChangeListener(childElement);
- singleSourceElement = null;
- }
- }
+ if (childElement instanceof OriginalSourceElement && ((OriginalSourceElement)childElement).equals(singleSourceElement)) {
+
+ childElement.removeElements();
+ // unregister selection arbitrator
+ if(childElement instanceof ISelectableElement){
+ SelectionArbitrator selectionArbitrator = ((ISelectableElement) childElement).getSelectionArbitrator();
+ if(selectionArbitrator != null){
+ formFactory.destroySelectionArbitrator(selectionArbitrator);
+ }
+ }
+
+ // unregister from property changes
+ formFactory.removePropertyChangeListener(childElement);
+ singleSourceElement = null;
+ }
+ }
}
public void removeNotDesignatedControls(){
checkbox_notDesignated = null;
break;
}
-
}
-
}
public void removeSourcesControls(){
sourceSection = null;
break;
}
-
}
-
}
+
@Override
public void handleEvent(Object eventSource) {
// if (eventSource == selection_reference) {