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