@Override public void handleChildrenRemove(MTrimBar parent, Collection<MTrimElement> elements) { Iterator<MTrimElement> iterator = elements.iterator(); while (iterator.hasNext()) { MTrimElement element = iterator.next(); if (element.isToBeRendered() && element.getWidget() != null) { hideChild(parent, element); } } } }
@Override public void handleChildrenAddition(MTrimBar parent, Collection<MTrimElement> elements) { Iterator<MTrimElement> iterator = elements.iterator(); while (iterator.hasNext()) { MTrimElement element = iterator.next(); if (element.isToBeRendered()) { if (element.getWidget() == null) { engineCreateWidget(element); } else { childRendered(parent, element); } } } }
/** * This is a HACK ! Due to compatibility restrictions we have the case where * we <b>must</b> leave 'empty' toolbars in the trim. This code detects this * particular scenario and hides any TB's of this type... * * @param te * The proposed trim element * @return <code>true</code> iff this element represents an empty managed * TB. */ private boolean hideManagedTB(MTrimElement te) { if (!(te instanceof MToolBar) || !(te.getRenderer() instanceof ToolBarManagerRenderer)) return false; if (!(te.getWidget() instanceof Composite)) return false; Composite teComp = (Composite) te.getWidget(); Control[] kids = teComp.getChildren(); if (kids.length != 1 || !(kids[0] instanceof ToolBar)) return false; boolean barVisible = ((ToolBar) kids[0]).getItemCount() > 0; // HACK! The trim dragging code uses the visible attribute as well // this is a local 'lock' to prevent the layout from messing with it if (!te.getTags().contains("LockVisibility")) { //$NON-NLS-1$ te.setVisible(barVisible); } return !barVisible; }
/** * This is a HACK ! Due to compatibility restrictions we have the case where * we <b>must</b> leave 'empty' toolbars in the trim. This code detects this * particular scenario and hides any TB's of this type... * * @param te * The proposed trim element * @return <code>true</code> iff this element represents an empty managed * TB. */ private boolean hideManagedTB(MTrimElement te) { if (!(te instanceof MToolBar) || !(te.getRenderer() instanceof ToolBarManagerRenderer)) return false; if (!(te.getWidget() instanceof Composite)) return false; Composite teComp = (Composite) te.getWidget(); Control[] kids = teComp.getChildren(); if (kids.length != 1 || !(kids[0] instanceof ToolBar)) return false; boolean barVisible = ((ToolBar) kids[0]).getItemCount() > 0; // HACK! The trim dragging code uses the visible attribute as well // this is a local 'lock' to prevent the layout from messing with it if (!te.getTags().contains("LockVisibility")) { //$NON-NLS-1$ te.setVisible(barVisible); } return !barVisible; }