@Override
public void setEntity(T entity){
super.setEntity(entity);
- sourceSection.setEntity(entity);
+ removeSourcesControls();
- if (this.entity != null && this.entity.isLectoType()){
+ if (this.entity != null && this.entity.hasDesignationSource()){
if (selection_reference == null){
removeNotDesignatedControls();
selection_reference = formFactory
}
}
}
+ 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);
}
}
+ }
+
+ public void removeSourcesControls(){
+ for (Iterator<ICdmFormElement> iterator = getElements().iterator();iterator.hasNext();) {
+ ICdmFormElement childElement = iterator.next();
+ // recursion
+ if (childElement instanceof SourceSection) {
+ childElement.removeElements();
+
+ getElements().remove(childElement);
+
+ // 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);
+ ((SourceSection)childElement).dispose();
+ sourceSection = null;
+ break;
+ }
+
+ }
+
}
@Override
public void handleEvent(Object eventSource) {