private void fillLayout(LayoutConstraints<?>[] oldConstraints) { RADVisualComponent<?>[] radComps = radContainer.getSubComponents(); int componentCount = radComps.length; Component[] primaryComps = new Component[componentCount]; LayoutConstraints<?>[] newConstraints = new LayoutConstraints<?>[componentCount]; for (int i = 0; i < componentCount; i++) { primaryComps[i] = radComps[i].getBeanInstance(); newConstraints[i] = radComps[i].getLayoutConstraints(layoutDelegate.getClass()); } layoutDelegate.convertConstraints(oldConstraints, newConstraints, primaryComps); if (componentCount > 0) { layoutDelegate.acceptNewComponents(radComps, newConstraints, 0); layoutDelegate.addComponents(radComps, newConstraints, 0); for (int i = 0; i < componentCount; i++) { radComps[i].resetConstraintsProperties(); } } // setup primary container Container cont = getPrimaryContainer(); Container contDel = getPrimaryContainerDelegate(); layoutDelegate.setLayoutToContainer(cont, contDel); if (componentCount > 0) { layoutDelegate.addComponentsToContainer(cont, contDel, primaryComps, 0); } }
// 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 } }
@Override public void updatePrimaryContainer() { Container cont = getPrimaryContainer(); Container contDel = getPrimaryContainerDelegate(); layoutDelegate.clearContainer(cont, contDel); layoutDelegate.setLayoutToContainer(cont, contDel); RADVisualComponent<?>[] components = radContainer.getSubComponents(); if (components.length > 0) { Component[] comps = new Component[components.length]; for (int i = 0; i < components.length; i++) { comps[i] = (Component) components[i].getBeanInstance(); } layoutDelegate.addComponentsToContainer(cont, contDel, comps, 0); } }
// managing live components public void setLayoutToContainer(Container container, Container containerDelegate) { layoutDelegate.setLayoutToContainer(container, containerDelegate); }