Search in sources :

Example 76 with RadComponent

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

the class MoveComponentAction method actionPerformed.

protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
    if (myColumnDelta != 0) {
        // sort the selection so that move in indexed layout will handle components in correct order
        Collections.sort(selection, (o1, o2) -> {
            int index1 = o1.getParent().indexOfComponent(o1);
            int index2 = o2.getParent().indexOfComponent(o2);
            return (index2 - index1) * myColumnDelta;
        });
    }
    for (RadComponent c : selection) {
        c.getParent().getLayoutManager().moveComponent(c, myRowDelta, myColumnDelta, myRowSpanDelta, myColSpanDelta);
    }
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

Example 77 with RadComponent

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

the class ResetValueAction method doResetValue.

public static void doResetValue(final List<RadComponent> selection, final Property property, final GuiEditor editor) {
    try {
        if (!editor.ensureEditable())
            return;
        final PropertyInspector propertyInspector = DesignerToolWindowManager.getInstance(editor).getPropertyInspector();
        if (propertyInspector.isEditing()) {
            propertyInspector.stopEditing();
        }
        //noinspection unchecked
        for (RadComponent component : selection) {
            //noinspection unchecked
            if (property.isModified(component)) {
                //noinspection unchecked
                property.resetValue(component);
                component.getDelegee().invalidate();
            }
        }
        editor.refreshAndSave(false);
        propertyInspector.repaint();
    } catch (Exception e1) {
        LOG.error(e1);
    }
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

Example 78 with RadComponent

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

the class StartInplaceEditingAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor);
    final RadComponent component = selection.get(0);
    final Property defaultInplaceProperty = component.getDefaultInplaceProperty();
    myEditor.getInplaceEditingLayer().startInplaceEditing(component, defaultInplaceProperty, component.getDefaultInplaceEditorBounds(), new InplaceContext(true));
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) Property(com.intellij.uiDesigner.propertyInspector.Property) InplaceContext(com.intellij.uiDesigner.propertyInspector.InplaceContext)

Example 79 with RadComponent

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

the class StartInplaceEditingAction method update.

public void update(final AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor);
    // Inplace editing can be started only if single component is selected
    if (selection.size() != 1) {
        presentation.setEnabled(false);
        return;
    }
    // Selected component should have "inplace" property
    final RadComponent component = selection.get(0);
    presentation.setEnabled(component.getDefaultInplaceProperty() != null);
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 80 with RadComponent

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

the class SurroundPopupAction method actionPerformed.

protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
    final ListPopup groupPopup = JBPopupFactory.getInstance().createActionGroupPopup(UIDesignerBundle.message("surround.with.popup.title"), myActionGroup, e.getDataContext(), JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true);
    final JComponent component = (JComponent) e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
    if (component instanceof ComponentTree) {
        groupPopup.show(JBPopupFactory.getInstance().guessBestPopupLocation(component));
    } else {
        RadComponent selComponent = selection.get(0);
        FormEditingUtil.showPopupUnderComponent(groupPopup, selComponent);
    }
}
Also used : ListPopup(com.intellij.openapi.ui.popup.ListPopup) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) ComponentTree(com.intellij.uiDesigner.componentTree.ComponentTree)

Aggregations

RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)86 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)22 RadRootContainer (com.intellij.uiDesigner.radComponents.RadRootContainer)18 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)15 ArrayList (java.util.ArrayList)12 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)8 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)8 IComponent (com.intellij.uiDesigner.lw.IComponent)7 IProperty (com.intellij.uiDesigner.lw.IProperty)6 ComponentItem (com.intellij.uiDesigner.palette.ComponentItem)5 RadButtonGroup (com.intellij.uiDesigner.radComponents.RadButtonGroup)5 ListPopup (com.intellij.openapi.ui.popup.ListPopup)4 ComponentTree (com.intellij.uiDesigner.componentTree.ComponentTree)4 IntrospectedProperty (com.intellij.uiDesigner.propertyInspector.IntrospectedProperty)4 IntroComponentProperty (com.intellij.uiDesigner.propertyInspector.properties.IntroComponentProperty)4 QuickFix (com.intellij.uiDesigner.quickFixes.QuickFix)4 Nullable (org.jetbrains.annotations.Nullable)4 RelativePoint (com.intellij.ui.awt.RelativePoint)3 Palette (com.intellij.uiDesigner.palette.Palette)3 IncorrectOperationException (com.intellij.util.IncorrectOperationException)3