Search in sources :

Example 26 with RadRootContainer

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

the class ComponentPtrDescriptor method update.

public boolean update() {
    myPtr.validate();
    if (!myPtr.isValid()) {
        myPtr = null;
        return true;
    }
    final String oldBinding = myBinding;
    final String oldTitle = myTitle;
    final RadComponent component = myPtr.getComponent();
    if (component.getModule().isDisposed()) {
        return false;
    }
    if (component instanceof RadRootContainer) {
        myBinding = ((RadRootContainer) component).getClassToBind();
    } else {
        myBinding = component.getBinding();
    }
    myTitle = component.getComponentTitle();
    return !Comparing.equal(oldBinding, myBinding) || !Comparing.equal(oldTitle, myTitle);
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer)

Example 27 with RadRootContainer

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

the class GridCaptionPanel method getSelectedGridContainer.

@Nullable
private RadContainer getSelectedGridContainer() {
    final ArrayList<RadComponent> selection = FormEditingUtil.getSelectedComponents(myEditor);
    if (selection.size() == 1 && selection.get(0) instanceof RadContainer) {
        RadContainer container = (RadContainer) selection.get(0);
        if (container.getLayoutManager().isGrid() && (container.getParent() instanceof RadRootContainer || container.getComponentCount() > 0)) {
            return container;
        }
    }
    RadContainer container = FormEditingUtil.getSelectionParent(selection);
    if (container == null && myEditor.getRootContainer().getComponentCount() > 0) {
        final RadComponent topComponent = myEditor.getRootContainer().getComponent(0);
        if (topComponent instanceof RadContainer) {
            container = (RadContainer) topComponent;
        }
    }
    if (container != null && !container.getLayoutManager().isGrid()) {
        return null;
    }
    return container;
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer) Nullable(org.jetbrains.annotations.Nullable)

Example 28 with RadRootContainer

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

the class GroupButtonsAction method groupButtons.

public static void groupButtons(final GuiEditor editor, final List<RadComponent> selectedComponents) {
    if (!editor.ensureEditable())
        return;
    String groupName = Messages.showInputDialog(editor.getProject(), UIDesignerBundle.message("group.buttons.name.prompt"), UIDesignerBundle.message("group.buttons.title"), Messages.getQuestionIcon(), editor.getRootContainer().suggestGroupName(), new IdentifierValidator(editor.getProject()));
    if (groupName == null)
        return;
    RadRootContainer rootContainer = editor.getRootContainer();
    RadButtonGroup group = rootContainer.createGroup(groupName);
    for (RadComponent component : selectedComponents) {
        rootContainer.setGroupForComponent(component, group);
    }
    editor.refreshAndSave(true);
}
Also used : RadButtonGroup(com.intellij.uiDesigner.radComponents.RadButtonGroup) RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) IdentifierValidator(com.intellij.uiDesigner.propertyInspector.properties.IdentifierValidator)

Example 29 with RadRootContainer

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

the class UngroupButtonsAction method isSameGroup.

public static boolean isSameGroup(final GuiEditor editor, final ArrayList<RadComponent> selectedComponents) {
    final RadRootContainer rootContainer = editor.getRootContainer();
    IButtonGroup group = FormEditingUtil.findGroupForComponent(rootContainer, selectedComponents.get(0));
    if (group == null) {
        return false;
    }
    for (int i = 1; i < selectedComponents.size(); i++) {
        if (FormEditingUtil.findGroupForComponent(rootContainer, selectedComponents.get(i)) != group) {
            return false;
        }
    }
    return true;
}
Also used : IButtonGroup(com.intellij.uiDesigner.lw.IButtonGroup) RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer)

Aggregations

RadRootContainer (com.intellij.uiDesigner.radComponents.RadRootContainer)29 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)17 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)6 RadButtonGroup (com.intellij.uiDesigner.radComponents.RadButtonGroup)4 Locale (java.util.Locale)4 IncorrectOperationException (com.intellij.util.IncorrectOperationException)3 HashSet (com.intellij.util.containers.HashSet)3 ArrayList (java.util.ArrayList)3 Nullable (org.jetbrains.annotations.Nullable)3 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)2 IButtonGroup (com.intellij.uiDesigner.lw.IButtonGroup)2 LwInspectionSuppression (com.intellij.uiDesigner.lw.LwInspectionSuppression)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1 Project (com.intellij.openapi.project.Project)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)1 ComponentPtr (com.intellij.uiDesigner.componentTree.ComponentPtr)1 ComponentTree (com.intellij.uiDesigner.componentTree.ComponentTree)1