Search in sources :

Example 51 with RadContainer

use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.

the class FlattenAction method flattenSimple.

private static void flattenSimple(final RadContainer container) {
    RadContainer parent = container.getParent();
    RadComponent child = null;
    Object childLayoutConstraints = null;
    if (container.getComponentCount() == 1) {
        child = container.getComponent(0);
        childLayoutConstraints = container.getCustomLayoutConstraints();
        child.getConstraints().restore(container.getConstraints());
        container.removeComponent(child);
    }
    int childIndex = parent.indexOfComponent(container);
    FormEditingUtil.deleteComponents(Collections.singletonList(container), false);
    if (child != null) {
        if (childLayoutConstraints != null) {
            child.setCustomLayoutConstraints(childLayoutConstraints);
        }
        parent.addComponent(child, childIndex);
        child.revalidate();
    }
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Aggregations

RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)51 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)20 RadRootContainer (com.intellij.uiDesigner.radComponents.RadRootContainer)6 ArrayList (java.util.ArrayList)6 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)5 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)3 IComponent (com.intellij.uiDesigner.lw.IComponent)3 ComponentTreeBuilder (com.intellij.uiDesigner.componentTree.ComponentTreeBuilder)2 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)2 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)2 IProperty (com.intellij.uiDesigner.lw.IProperty)2 IncorrectOperationException (com.intellij.util.IncorrectOperationException)2 LayoutManager (java.awt.LayoutManager)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 Ref (com.intellij.openapi.util.Ref)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 SelectionState (com.intellij.uiDesigner.SelectionState)1 ComponentPtr (com.intellij.uiDesigner.componentTree.ComponentPtr)1 ComponentTree (com.intellij.uiDesigner.componentTree.ComponentTree)1