use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class PackAction method actionPerformed.
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
RadContainer container = getContainerToPack(selection);
if (container != null) {
container.getDelegee().setSize(container.getMinimumSize());
container.getDelegee().revalidate();
}
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class DuplicateComponentsAction method actionPerformed.
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
FormEditingUtil.remapToActionTargets(selection);
RadContainer parent = FormEditingUtil.getSelectionParent(selection);
assert parent != null;
List<RadComponent> duplicates = new ArrayList<>();
Map<RadComponent, RadComponent> duplicateMap = new HashMap<>();
TIntHashSet insertedRows = new TIntHashSet();
boolean incrementRow = true;
if (selection.size() > 1 && canDuplicate(selection, false) && FormEditingUtil.getSelectionBounds(selection).width == 1) {
incrementRow = false;
}
for (RadComponent c : selection) {
final int row = c.getConstraints().getCell(incrementRow);
int rowSpan = c.getConstraints().getSpan(incrementRow);
int insertIndex = parent.indexOfComponent(c);
if (parent.getLayoutManager().isGrid()) {
if (!insertedRows.contains(row) && !isSpaceBelowEmpty(c, incrementRow)) {
insertedRows.add(row);
parent.getGridLayoutManager().copyGridCells(parent, parent, incrementRow, row, rowSpan, row + rowSpan);
}
}
List<RadComponent> copyList = CutCopyPasteSupport.copyComponents(editor, Collections.singletonList(c));
if (copyList != null) {
RadComponent copy = copyList.get(0);
if (parent.getLayoutManager().isGrid()) {
copy.getConstraints().setCell(incrementRow, row + rowSpan + parent.getGridLayoutManager().getGapCellCount());
copy.getConstraints().setSpan(incrementRow, rowSpan);
}
parent.addComponent(copy, insertIndex + 1);
fillDuplicateMap(duplicateMap, c, copy);
duplicates.add(copy);
}
}
adjustDuplicates(duplicateMap);
FormEditingUtil.selectComponents(editor, duplicates);
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class DuplicateComponentsAction method fillDuplicateMap.
private static void fillDuplicateMap(Map<RadComponent, RadComponent> duplicates, final RadComponent c, final RadComponent copy) {
duplicates.put(c, copy);
if (c instanceof RadContainer) {
LOG.assertTrue(copy instanceof RadContainer);
final RadContainer container = (RadContainer) c;
final RadContainer containerCopy = (RadContainer) copy;
for (int i = 0; i < container.getComponentCount(); i++) {
fillDuplicateMap(duplicates, container.getComponent(i), containerCopy.getComponent(i));
}
}
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class FlattenAction method flattenGrid.
private static void flattenGrid(final RadContainer container) {
RadContainer parent = container.getParent();
GridConstraints containerConstraints = (GridConstraints) container.getConstraints().clone();
// ensure there will be enough rows and columns to fit the container contents
for (int i = containerConstraints.getRowSpan(); i < container.getGridRowCount(); i++) {
GridChangeUtil.splitRow(parent, containerConstraints.getRow());
}
for (int i = containerConstraints.getColSpan(); i < container.getGridColumnCount(); i++) {
GridChangeUtil.splitColumn(parent, containerConstraints.getColumn());
}
ArrayList<RadComponent> contents = new ArrayList<>();
for (int i = container.getComponentCount() - 1; i >= 0; i--) {
contents.add(0, container.getComponent(i));
container.removeComponent(container.getComponent(i));
}
if (contents.size() == 1) {
contents.get(0).setCustomLayoutConstraints(container.getCustomLayoutConstraints());
}
FormEditingUtil.deleteComponents(Collections.singletonList(container), false);
for (RadComponent child : contents) {
final GridConstraints childConstraints = child.getConstraints();
childConstraints.setRow(childConstraints.getRow() + containerConstraints.getRow());
childConstraints.setColumn(childConstraints.getColumn() + containerConstraints.getColumn());
parent.addComponent(child);
child.revalidate();
}
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class InsertAfterAction method actionPerformed.
protected void actionPerformed(final CaptionSelection selection) {
final RadContainer container = selection.getContainer();
container.getGridLayoutManager().insertGridCells(container, selection.getFocusedIndex(), selection.isRow(), false, false);
}
Aggregations