Search in sources :

Example 66 with RadComponent

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

the class ComponentEditor method collectFilteredComponents.

protected RadComponent[] collectFilteredComponents(final RadComponent component) {
    final ArrayList<RadComponent> result = new ArrayList<>();
    result.add(null);
    RadContainer container = component.getParent();
    while (container.getParent() != null) {
        container = container.getParent();
    }
    FormEditingUtil.iterate(container, new FormEditingUtil.ComponentVisitor() {

        public boolean visit(final IComponent component) {
            RadComponent radComponent = (RadComponent) component;
            final JComponent delegee = radComponent.getDelegee();
            if (!myPropertyType.isInstance(delegee)) {
                return true;
            }
            if (myFilter == null || myFilter.value(radComponent)) {
                result.add(radComponent);
            }
            return true;
        }
    });
    return result.toArray(new RadComponent[result.size()]);
}
Also used : IComponent(com.intellij.uiDesigner.lw.IComponent) ArrayList(java.util.ArrayList) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) FormEditingUtil(com.intellij.uiDesigner.FormEditingUtil) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Example 67 with RadComponent

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

the class IntroComponentProperty method updateLabelForBinding.

void updateLabelForBinding(final RadComponent component) {
    String value = getValue(component);
    String text = FormInspectionUtil.getText(component.getModule(), component);
    if (text != null && value != null) {
        RadRootContainer root = (RadRootContainer) FormEditingUtil.getRoot(component);
        if (root != null) {
            RadComponent valueComponent = (RadComponent) FormEditingUtil.findComponent(root, value);
            if (valueComponent != null) {
                if (valueComponent instanceof RadScrollPane && ((RadScrollPane) valueComponent).getComponentCount() == 1) {
                    valueComponent = ((RadScrollPane) valueComponent).getComponent(0);
                }
                BindingProperty.checkCreateBindingFromText(valueComponent, text);
            }
        }
    }
}
Also used : RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) RadScrollPane(com.intellij.uiDesigner.radComponents.RadScrollPane)

Example 68 with RadComponent

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

the class ComponentRenderer method getComponent.

public JComponent getComponent(final RadRootContainer rootContainer, String value, boolean selected, boolean hasFocus) {
    clear();
    setBackground(selected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground());
    if (value != null && value.length() > 0) {
        RadComponent target = (RadComponent) FormEditingUtil.findComponent(rootContainer, value);
        if (target != null) {
            renderComponent(target, selected);
        } else {
            append(UIDesignerBundle.message("component.not.found"), SimpleTextAttributes.ERROR_ATTRIBUTES);
        }
    }
    return this;
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

Example 69 with RadComponent

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

the class ActiveDecorationLayer method layoutListenerNavigateButtons.

private void layoutListenerNavigateButtons() {
    for (Map.Entry<RadComponent, ListenerNavigateButton> e : myNavigateButtons.entrySet()) {
        RadComponent c = e.getKey();
        ListenerNavigateButton btn = e.getValue();
        if (btn.isVisible()) {
            Rectangle rc = SwingUtilities.convertRectangle(c.getDelegee().getParent(), c.getBounds(), this);
            btn.setLocation(rc.x, rc.y + rc.height);
        }
    }
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) Map(java.util.Map) HashMap(java.util.HashMap)

Example 70 with RadComponent

use of com.intellij.uiDesigner.radComponents.RadComponent 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)

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