Search in sources :

Example 21 with RadComponent

use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.

the class DragTracker method updateContext.

@Override
protected void updateContext() {
    super.updateContext();
    myContext.setMoveDelta(new Point(moveDeltaWidth(), moveDeltaHeight()));
    myContext.setSizeDelta(new Dimension());
    myContext.setLocation(getLocation());
    if (myContext.getComponents() == null) {
        List<RadComponent> components = calculateContextComponents(RadComponent.getPureSelection(myArea.getSelection()));
        myContext.setComponents(components);
        for (RadComponent component : components) {
            component.processDropOperation(myContext);
        }
    }
}
Also used : RadComponent(com.intellij.designer.model.RadComponent)

Example 22 with RadComponent

use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.

the class DragTracker method updateTargetUnderMouse.

private void updateTargetUnderMouse() {
    if (myContext.getComponents().isEmpty()) {
        return;
    }
    ContainerTargetFilter filter = new ContainerTargetFilter() {

        @Override
        public boolean preFilter(RadComponent component) {
            return !myContext.getComponents().contains(component);
        }

        @Override
        protected void updateContext(RadComponent target) {
            updateContextType(target);
        }
    };
    RadComponent target = myArea.findTarget(myCurrentScreenX, myCurrentScreenY, filter);
    setTarget(target, filter);
    if (target == null) {
        myContext.setType(null);
    } else {
        myTargetOperation.setComponents(myContext.getComponents());
    }
}
Also used : RadComponent(com.intellij.designer.model.RadComponent)

Example 23 with RadComponent

use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.

the class MarqueeTracker method performMarqueeSelect.

private void performMarqueeSelect() {
    final Rectangle selectionRectangle = getSelectionRectangle();
    final List<RadComponent> newSelection = new ArrayList<>();
    RadComponent rootComponent = myArea.getRootComponent();
    if (rootComponent != null) {
        rootComponent.accept(new RadComponentVisitor() {

            @Override
            public void endVisit(RadComponent component) {
                if (selectionRectangle.contains(component.getBounds(myArea.getNativeComponent())) && !component.isBackground()) {
                    newSelection.add(component);
                }
            }
        }, true);
        if (newSelection.isEmpty() && mySelectBackground) {
            rootComponent.accept(new RadComponentVisitor() {

                @Override
                public void endVisit(RadComponent component) {
                    // Only select the bottom-most background
                    if (newSelection.isEmpty() && component.getBounds(myArea.getNativeComponent()).contains(selectionRectangle.x, selectionRectangle.y) && component.isBackground()) {
                        newSelection.add(component);
                    }
                }
            }, true);
        }
    }
    if (mySelectionMode == TOGGLE_MODE) {
        List<RadComponent> selection = new ArrayList<>(myArea.getSelection());
        for (RadComponent component : newSelection) {
            int index = selection.indexOf(component);
            if (index == -1) {
                selection.add(component);
            } else {
                selection.remove(index);
            }
        }
        myArea.setSelection(selection);
    } else if (mySelectionMode == APPEND_MODE) {
        for (RadComponent component : newSelection) {
            myArea.appendSelection(component);
        }
    } else {
        myArea.setSelection(newSelection);
    }
}
Also used : RadComponentVisitor(com.intellij.designer.model.RadComponentVisitor) ArrayList(java.util.ArrayList) RadComponent(com.intellij.designer.model.RadComponent)

Example 24 with RadComponent

use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.

the class ResizeTracker method getOperations.

private List<EditOperation> getOperations() {
    if (myOperations == null) {
        myContext.setComponents(new ArrayList<>(myArea.getSelection()));
        myOperations = new ArrayList<>();
        for (RadComponent component : myContext.getComponents()) {
            EditOperation operation;
            RadComponent parent = component.getParent();
            if (parent == null) {
                operation = myArea.processRootOperation(myContext);
            } else {
                operation = parent.getLayout().processChildOperation(myContext);
            }
            if (operation != null) {
                myOperations.add(operation);
                operation.setComponent(component);
            }
        }
    }
    return myOperations;
}
Also used : RadComponent(com.intellij.designer.model.RadComponent) EditOperation(com.intellij.designer.designSurface.EditOperation)

Example 25 with RadComponent

use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.

the class DecorationLayer method findTargetTool.

@Nullable
public InputTool findTargetTool(int x, int y) {
    List<RadComponent> selection = myArea.getSelection();
    for (RadComponent component : selection) {
        ComponentDecorator decorator = getDecorator(component, selection);
        InputTool tracker = decorator.findTargetTool(this, component, x, y);
        if (tracker != null) {
            return tracker;
        }
    }
    return null;
}
Also used : InputTool(com.intellij.designer.designSurface.tools.InputTool) RadComponent(com.intellij.designer.model.RadComponent) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

RadComponent (com.intellij.designer.model.RadComponent)28 ArrayList (java.util.ArrayList)8 RadComponentVisitor (com.intellij.designer.model.RadComponentVisitor)6 Nullable (org.jetbrains.annotations.Nullable)3 EditOperation (com.intellij.designer.designSurface.EditOperation)2 IComponentCopyProvider (com.intellij.designer.model.IComponentCopyProvider)2 MetaModel (com.intellij.designer.model.MetaModel)2 RadLayout (com.intellij.designer.model.RadLayout)2 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 SimpleTransferable (com.intellij.designer.clipboard.SimpleTransferable)1 ComponentTargetFilter (com.intellij.designer.designSurface.ComponentTargetFilter)1 EditableArea (com.intellij.designer.designSurface.EditableArea)1 FeedbackTreeLayer (com.intellij.designer.designSurface.FeedbackTreeLayer)1 LineMarginBorder (com.intellij.designer.designSurface.feedbacks.LineMarginBorder)1 CreationTool (com.intellij.designer.designSurface.tools.CreationTool)1 InputTool (com.intellij.designer.designSurface.tools.InputTool)1 IComponentDeletionParticipant (com.intellij.designer.model.IComponentDeletionParticipant)1 Property (com.intellij.designer.model.Property)1 WrapInProvider (com.intellij.designer.model.WrapInProvider)1 InplaceContext (com.intellij.designer.propertyTable.InplaceContext)1