// copy layout delegate from another container public void copyLayoutDelegateFrom( LayoutSupportManager sourceLayoutSupport, RADVisualComponent<?>[] newRadComps) { LayoutSupportDelegate sourceDelegate = sourceLayoutSupport.getLayoutDelegate(); int componentCount = sourceDelegate.getComponentCount(); Container cont = getPrimaryContainer(); Container contDel = getPrimaryContainerDelegate(); if (layoutDelegate != null) { removeLayoutDelegate(false); } Component[] primaryComps = new Component[componentCount]; for (int i = 0; i < componentCount; i++) { RADVisualComponent<?> radComp = newRadComps[i]; primaryComps[i] = (Component) radComp.getBeanInstance(); } LayoutSupportDelegate newDelegate = sourceDelegate.cloneLayoutSupport(this, newRadComps); newDelegate.setLayoutToContainer(cont, contDel); newDelegate.addComponentsToContainer(cont, contDel, primaryComps, 0); layoutDelegate = newDelegate; // Ensure correct propagation of copied properties (issue 50011, 72351) try { layoutDelegate.acceptContainerLayoutChange(null); } catch (PropertyVetoException pvex) { // should not happen } }
public static LayoutConstraints<?> storeConstraints(RADVisualComponent<?> radComp) { LayoutSupportManager layoutSupport = radComp.getParentLayoutSupport(); if (layoutSupport != null) { LayoutConstraints<?> constr = layoutSupport.getConstraints(radComp); if (constr != null) { radComp.setLayoutConstraints(layoutSupport.getLayoutDelegate().getClass(), constr); } return constr; } else { return null; } }