use of com.intellij.uiDesigner.radComponents.RadComponent in project intellij-community by JetBrains.
the class GroupSelectionProcessor method markRectangle.
private void markRectangle(final RadComponent component, final Rectangle rectangle, final Component coordinateOriginComponent) {
if (!(component instanceof RadRootContainer) && !component.equals(myComponent)) {
final Rectangle bounds = component.getBounds();
final Point point = SwingUtilities.convertPoint(component.getDelegee().getParent(), bounds.x, bounds.y, coordinateOriginComponent);
bounds.setLocation(point);
if (rectangle.intersects(bounds)) {
component.setSelected(true);
return;
}
}
if (component instanceof RadContainer) {
final RadContainer container = (RadContainer) component;
// [anton] it is very important to iterate through a STORED array because setSelected can
// change order of components so iteration via getComponent(i) is incorrect
final RadComponent[] components = container.getComponents();
for (RadComponent component1 : components) {
markRectangle(component1, rectangle, coordinateOriginComponent);
}
}
}
use of com.intellij.uiDesigner.radComponents.RadComponent in project intellij-community by JetBrains.
the class GroupSelectionProcessor method selectComponentsInRange.
private static void selectComponentsInRange(final RadComponent component, final RadComponent anchor) {
final GridConstraints c1 = component.getConstraints();
final GridConstraints c2 = anchor.getConstraints();
int startRow = Math.min(c1.getRow(), c2.getRow());
int startCol = Math.min(c1.getColumn(), c2.getColumn());
int endRow = Math.max(c1.getRow() + c1.getRowSpan(), c2.getRow() + c2.getRowSpan());
int endCol = Math.max(c1.getColumn() + c1.getColSpan(), c2.getColumn() + c2.getColSpan());
for (int row = startRow; row < endRow; row++) {
for (int col = startCol; col < endCol; col++) {
RadComponent c = anchor.getParent().getComponentAtGrid(row, col);
if (c != null) {
c.setSelected(true);
}
}
}
}
use of com.intellij.uiDesigner.radComponents.RadComponent in project intellij-community by JetBrains.
the class GuiEditor method refreshProperties.
private void refreshProperties() {
final Ref<Boolean> anythingModified = new Ref<>();
FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor() {
public boolean visit(final IComponent component) {
final RadComponent radComponent = (RadComponent) component;
boolean componentModified = false;
for (IProperty prop : component.getModifiedProperties()) {
if (prop instanceof IntroStringProperty) {
IntroStringProperty strProp = (IntroStringProperty) prop;
componentModified = strProp.refreshValue(radComponent) || componentModified;
}
}
if (component instanceof RadContainer) {
componentModified = ((RadContainer) component).updateBorder() || componentModified;
}
if (component.getParentContainer() instanceof RadTabbedPane) {
componentModified = ((RadTabbedPane) component.getParentContainer()).refreshChildTitle(radComponent) || componentModified;
}
if (componentModified) {
anythingModified.set(Boolean.TRUE);
}
return true;
}
});
if (!anythingModified.isNull()) {
refresh();
DesignerToolWindow designerToolWindow = DesignerToolWindowManager.getInstance(this);
ComponentTree tree = designerToolWindow.getComponentTree();
if (tree != null)
tree.repaint();
PropertyInspector inspector = designerToolWindow.getPropertyInspector();
if (inspector != null)
inspector.synchWithTree(true);
}
}
use of com.intellij.uiDesigner.radComponents.RadComponent in project intellij-community by JetBrains.
the class GridChangeUtil method splitCell.
/**
* @param cellIndex column or row index, depending on isRow parameter; must be in the range 0..grid.get{Row|Column}Count()-1
* @param isRow if true, row is splitted, otherwise column
*/
public static void splitCell(final RadContainer grid, final int cellIndex, final boolean isRow) {
check(grid, isRow, cellIndex);
int insertedCells = grid.getGridLayoutManager().insertGridCells(grid, cellIndex, isRow, false, false);
for (int i = grid.getComponentCount() - 1; i >= 0; i--) {
final RadComponent component = grid.getComponent(i);
final GridConstraints constraints = component.getConstraints();
if (constraints.getCell(isRow) + constraints.getSpan(isRow) - 1 == cellIndex) {
// component belongs to the cell being resized - increment component's span
GridConstraints oldConstraints = (GridConstraints) constraints.clone();
constraints.setSpan(isRow, constraints.getSpan(isRow) + insertedCells);
component.fireConstraintsChanged(oldConstraints);
}
}
}
use of com.intellij.uiDesigner.radComponents.RadComponent in project intellij-community by JetBrains.
the class GridChangeUtil method moveCell.
public static void moveCell(final RadContainer container, final boolean isRow, final int sourceCell, int targetCell) {
if (targetCell == sourceCell || targetCell == sourceCell + 1)
return;
// if column moved to left - components inbetween move to right, and vice versa
int delta = (sourceCell > targetCell) ? 1 : -1;
int startCell = Math.min(sourceCell, targetCell);
int endCell = Math.max(sourceCell, targetCell);
if (sourceCell < targetCell)
targetCell--;
for (RadComponent c : container.getComponents()) {
GridConstraints constraints = c.getConstraints();
GridConstraints oldConstraints = (GridConstraints) constraints.clone();
final int aCell = constraints.getCell(isRow);
if (aCell == sourceCell) {
constraints.setCell(isRow, targetCell);
} else if (aCell >= startCell && aCell < endCell) {
constraints.setCell(isRow, aCell + delta);
}
c.fireConstraintsChanged(oldConstraints);
}
}
Aggregations