Search in sources :

Example 41 with RadComponent

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

the class MainProcessor method removeDragger.

private void removeDragger() {
    final RadComponent oldDraggerHost = FormEditingUtil.getDraggerHost(myEditor);
    if (oldDraggerHost != null) {
        oldDraggerHost.setDragger(false);
        myEditor.repaintLayeredPane();
    }
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

Example 42 with RadComponent

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

the class PassiveDecorationLayer method paint.

public void paint(final Graphics g) {
    // Passive decoration
    final RadRootContainer root = myEditor.getRootContainer();
    for (int i = root.getComponentCount() - 1; i >= 0; i--) {
        final RadComponent component = root.getComponent(i);
        paintPassiveDecoration(component, g);
    }
    // Paint active decorators
    paintChildren(g);
}
Also used : RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

Example 43 with RadComponent

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

the class PassiveDecorationLayer method paintPassiveDecoration.

/**
   * Paints all necessary decoration for the specified <code>component</code>
   */
protected final void paintPassiveDecoration(final RadComponent component, final Graphics g) {
    // Paint component bounds and grid markers
    Painter.paintComponentDecoration(myEditor, component, g);
    final Set<RadButtonGroup> paintedGroups = new HashSet<>();
    final RadRootContainer rootContainer = myEditor.getRootContainer();
    final ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
    final Collection<RadButtonGroup> selectedGroups = componentTree != null ? componentTree.getSelectedElements(RadButtonGroup.class) : Collections.<RadButtonGroup>emptyList();
    // Paint selection and dragger
    FormEditingUtil.iterate(component, new FormEditingUtil.ComponentVisitor<RadComponent>() {

        public boolean visit(final RadComponent component) {
            final Point point = SwingUtilities.convertPoint(component.getDelegee(), 0, 0, rootContainer.getDelegee());
            RadButtonGroup group = (RadButtonGroup) FormEditingUtil.findGroupForComponent(rootContainer, component);
            if (group != null && !paintedGroups.contains(group) && (component.isSelected() || selectedGroups.contains(group))) {
                paintedGroups.add(group);
                Painter.paintButtonGroupLines(rootContainer, group, g);
            }
            g.translate(point.x, point.y);
            try {
                if (myEditor.isShowComponentTags() && FormEditingUtil.isComponentSwitchedInView(component)) {
                    Painter.paintComponentTag(component, g);
                }
                Painter.paintSelectionDecoration(component, g, myEditor.getGlassLayer().isFocusOwner());
                // Over selection we have to paint dragger
                if (component.hasDragger()) {
                    final Icon icon = getDragIcon();
                    icon.paintIcon(PassiveDecorationLayer.this, g, -icon.getIconWidth(), -icon.getIconHeight());
                }
            } finally {
                g.translate(-point.x, -point.y);
            }
            return true;
        }
    });
}
Also used : RadButtonGroup(com.intellij.uiDesigner.radComponents.RadButtonGroup) RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) FormEditingUtil(com.intellij.uiDesigner.FormEditingUtil) ComponentTree(com.intellij.uiDesigner.componentTree.ComponentTree) HashSet(com.intellij.util.containers.HashSet)

Example 44 with RadComponent

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

the class PasteProcessor method doPaste.

private void doPaste(final ComponentDropLocation location) {
    if (location.canDrop(myPastedComponentList) && myEditor.ensureEditable()) {
        final RadComponent[] componentsToPaste = myComponentsToPaste.toArray(new RadComponent[myComponentsToPaste.size()]);
        CommandProcessor.getInstance().executeCommand(myEditor.getProject(), () -> {
            location.processDrop(myEditor, componentsToPaste, null, myPastedComponentList);
            for (RadComponent c : componentsToPaste) {
                FormEditingUtil.iterate(c, new FormEditingUtil.ComponentVisitor() {

                    public boolean visit(final IComponent component) {
                        if (component.getBinding() != null) {
                            InsertComponentProcessor.createBindingField(myEditor, (RadComponent) component);
                        }
                        return true;
                    }
                });
            }
            FormEditingUtil.selectComponents(myEditor, myComponentsToPaste);
            myEditor.refreshAndSave(true);
        }, UIDesignerBundle.message("command.paste"), null);
        endPaste();
    }
}
Also used : IComponent(com.intellij.uiDesigner.lw.IComponent) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) FormEditingUtil(com.intellij.uiDesigner.FormEditingUtil)

Example 45 with RadComponent

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

the class QuickFixManagerImpl method getErrorBounds.

protected Rectangle getErrorBounds() {
    final ArrayList<RadComponent> list = FormEditingUtil.getSelectedComponents(getEditor());
    if (list.size() != 1) {
        return null;
    }
    RadComponent c = list.get(0);
    return SwingUtilities.convertRectangle(c.getDelegee().getParent(), c.getBounds(), getEditor().getGlassLayer());
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

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