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);
}
}
}
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());
}
}
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);
}
}
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;
}
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;
}
Aggregations