Exemplo n.º 1
0
  private LayoutConstraints<?>[] removeLayoutDelegate(boolean extractConstraints) {
    int componentCount = layoutDelegate.getComponentCount();
    LayoutConstraints<?>[] constraints = null;

    if (componentCount > 0) {
      RADVisualComponent<?>[] radComps = radContainer.getSubComponents();
      if (radComps.length
          == componentCount) { // robustness: might be called after failed layout initialization
        if (extractConstraints) {
          constraints = new LayoutConstraints<?>[componentCount];
        }

        for (int i = 0; i < componentCount; i++) {
          LayoutConstraints<?> constr = layoutDelegate.getConstraints(i);
          if (extractConstraints) {
            constraints[i] = constr;
          }
          if (constr != null) {
            radComps[i].setLayoutConstraints(layoutDelegate.getClass(), constr);
          }
        }
      }
    }
    layoutDelegate.removeAll();
    layoutDelegate.clearContainer(getPrimaryContainer(), getPrimaryContainerDelegate());
    layoutDelegate = null;
    return constraints;
  }
Exemplo n.º 2
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
    }
  }
Exemplo n.º 3
0
 public LayoutConstraints<?> getConstraints(RADVisualComponent<?> radComp) {
   if (layoutDelegate != null) {
     int index = radComp.getComponentIndex(); // radContainer.getIndexOf(radComp);
     return index >= 0 && index < layoutDelegate.getComponentCount()
         ? layoutDelegate.getConstraints(index)
         : null;
   } else {
     return null;
   }
 }
Exemplo n.º 4
0
 // components adding/removing
 public void injectComponents(
     RADVisualComponent<?>[] components, LayoutConstraints<?>[] aConstraints, int index) {
   if (index <= -1) {
     index = layoutDelegate.getComponentCount();
   }
   layoutDelegate.addComponents(components, aConstraints, index);
   for (RADVisualComponent<?> component : components) {
     component.resetConstraintsProperties();
   }
 }
Exemplo n.º 5
0
  public void addComponents(
      RADVisualComponent<?>[] components, LayoutConstraints<?>[] aConstraints, int index) {
    if (index <= -1) {
      index = layoutDelegate.getComponentCount();
    }
    injectComponents(components, aConstraints, index);

    Component[] comps = new Component[components.length];
    for (int i = 0; i < components.length; i++) {
      comps[i] = components[i].getBeanInstance();
    }
    layoutDelegate.addComponentsToContainer(
        getPrimaryContainer(), getPrimaryContainerDelegate(), comps, index);
  }
Exemplo n.º 6
0
 public int getComponentCount() {
   return layoutDelegate.getComponentCount();
 }