private Color getCaptionColor(final int i) { if(mySelectionModel.isSelectedIndex(i)) { return LightColors.BLUE; } if(mySelectedContainer != null) { if(i >= 0 && i < mySelectedContainer.getGridCellCount(myIsRow)) { final GridChangeUtil.CellStatus status = GridChangeUtil.canDeleteCell(mySelectedContainer, i, myIsRow); if(status == GridChangeUtil.CellStatus.Empty || status == GridChangeUtil.CellStatus.Redundant) { return Color.PINK; } } } return LightColors.GREEN; }
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<RadComponent>(); 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(); } }
private Color getCaptionColor(final int i) { if (mySelectionModel.isSelectedIndex(i)) { return LightColors.BLUE; } if (mySelectedContainer != null) { if (i >= 0 && i < mySelectedContainer.getGridCellCount(myIsRow)) { final GridChangeUtil.CellStatus status = GridChangeUtil.canDeleteCell(mySelectedContainer, i, myIsRow); if (status == GridChangeUtil.CellStatus.Empty || status == GridChangeUtil.CellStatus.Redundant) { return Color.PINK; } } } return LightColors.GREEN; }
private static void checkAdjustConstraints(@Nullable final GridConstraints[] constraintsToAdjust, final boolean isRow, final int index, final int count) { if (constraintsToAdjust != null) { for(GridConstraints constraints: constraintsToAdjust) { GridChangeUtil.adjustConstraintsOnInsert(constraints, isRow, index, count); } } }
@Override public boolean isGapCell(RadContainer grid, boolean isRow, int cellIndex) { if (cellIndex < 0 || cellIndex >= getGridCellCount(grid, isRow)) { return false; } if (cellIndex % 2 == 1) { final GridChangeUtil.CellStatus status = GridChangeUtil.canDeleteCell(grid, cellIndex, isRow); if (status == GridChangeUtil.CellStatus.Empty || status == GridChangeUtil.CellStatus.Redundant) { return true; } } return false; }
protected void actionPerformed(CaptionSelection selection) { GridChangeUtil.splitCell(selection.getContainer(), selection.getFocusedIndex(), selection.isRow()); }
/** * @return the number of inserted rows or columns */ public int insertGridCells(final RadContainer grid, final int cellIndex, final boolean isRow, final boolean isBefore, final boolean grow) { GridChangeUtil.insertRowOrColumn(grid, cellIndex, isRow, isBefore); return 1; }
/** * @return the number of deleted rows or columns */ public int deleteGridCells(final RadContainer grid, final int cellIndex, final boolean isRow) { GridChangeUtil.deleteCell(grid, cellIndex, isRow); return 1; }
public void processCellsMoved(final RadContainer container, final boolean isRow, final int[] cells, final int targetCell) { GridChangeUtil.moveCells(container, isRow, cells, targetCell); }