* Adds listeners to the {@link BroadcastSupport}.
*/
private void addBroadcastListeners() {
addBroadcastListener(new ObjectInfoTreeComplete() {
public void invoke() throws Exception {
ContainerInfo container = getContainer();
// ensure that all widgets have LayoutData, at least virtual
if (isActiveOnContainer(container)) {
for (WidgetInfo widget : container.getChildrenWidgets()) {
ensureLayoutData(widget);
}
}
}
});
addBroadcastListener(new ObjectInfoChildAddBefore() {
public void invoke(ObjectInfo parent, ObjectInfo child, ObjectInfo[] nextChild)
throws Exception {
// add new LayoutData - remove existing one
if (parent instanceof WidgetInfo
&& child instanceof LayoutDataInfo
&& isActiveOnContainer(parent.getParent())) {
WidgetInfo widget = (WidgetInfo) parent;
LayoutDataInfo existingLayoutData = getLayoutData(widget);
if (existingLayoutData != null) {
widget.removeChild(existingLayoutData);
}
}
}
});
addBroadcastListener(new ObjectInfoChildAddAfter() {
public void invoke(ObjectInfo parent, ObjectInfo child) throws Exception {
ContainerInfo container = getContainer();
// add this layout
if (child == m_this) {
// implicit layouts are bound to its parent
if (getCreationSupport() instanceof IImplicitCreationSupport) {
targetBroadcastListener(parent);
}
// create virtual LayoutData's
for (WidgetInfo widget : container.getChildrenWidgets()) {
ensureLayoutData(widget);
}
}
}
});