本文整理汇总了Java中com.intellij.uiDesigner.core.GridConstraints.getCell方法的典型用法代码示例。如果您正苦于以下问题:Java GridConstraints.getCell方法的具体用法?Java GridConstraints.getCell怎么用?Java GridConstraints.getCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.uiDesigner.core.GridConstraints
的用法示例。
在下文中一共展示了GridConstraints.getCell方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: splitCell
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
/**
* @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);
}
}
}
示例2: moveCell
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
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);
}
}
示例3: isSpaceBelowEmpty
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private static boolean isSpaceBelowEmpty(final RadComponent component, boolean incrementRow) {
final GridConstraints constraints = component.getConstraints();
int startRow = constraints.getCell(incrementRow) + constraints.getSpan(incrementRow);
int endRow = constraints.getCell(incrementRow) + constraints.getSpan(incrementRow)*2 +
component.getParent().getGridLayoutManager().getGapCellCount();
if (endRow > component.getParent().getGridCellCount(incrementRow)) {
return false;
}
for(int row=startRow; row < endRow; row++) {
for(int col=constraints.getCell(!incrementRow); col < constraints.getCell(!incrementRow) + constraints.getSpan(!incrementRow); col++) {
if (component.getParent().getComponentAtGrid(incrementRow, row, col) != null) {
return false;
}
}
}
return true;
}
示例4: adjustDeletedCellOrigins
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private void adjustDeletedCellOrigins(final RadContainer grid, final int cellIndex, final boolean isRow) {
int gapCellDelta = isGapCell(grid, isRow, cellIndex+1) ? 2 : 1;
for(RadComponent component: grid.getComponents()) {
// ensure that we don't have component origins in the deleted cells
final GridConstraints gc = component.getConstraints();
if (gc.getCell(isRow) == cellIndex) {
final int span = gc.getSpan(isRow);
if (span > gapCellDelta) {
gc.setCell(isRow, cellIndex+gapCellDelta);
gc.setSpan(isRow, span -gapCellDelta);
updateConstraints(component);
}
else {
throw new IllegalArgumentException("Attempt to delete grid row/column which contains origins of 1-span components");
}
}
}
}
示例5: constraintsIntersect
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private boolean constraintsIntersect(final boolean horizontal,
final GridConstraints constraints,
final GridConstraints otherConstraints) {
int start = constraints.getCell(!horizontal);
int end = start + constraints.getSpan(!horizontal) - 1;
int otherStart = otherConstraints.getCell(!horizontal);
int otherEnd = otherStart + otherConstraints.getSpan(!horizontal) - 1;
return start <= otherEnd && otherStart <= end;
}
示例6: adjustConstraintsOnInsert
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
public static void adjustConstraintsOnInsert(final GridConstraints constraints, final boolean isRow, final int beforeIndex,
final int count) {
if (constraints.getCell(isRow) >= beforeIndex) {
addToCell(constraints, isRow, count);
}
else if (isCellInsideComponent(constraints, isRow, beforeIndex)) {
// component belongs to the cell being resized - increment component's span
addToSpan(constraints, isRow, count);
}
}
示例7: canDeleteCell
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
/**
* @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 deleted, otherwise column
* @return whether the specified column can be deleted
*/
public static CellStatus canDeleteCell(@NotNull final RadContainer grid, final int cellIndex, final boolean isRow) {
check(grid, isRow, cellIndex);
// Do not allow to delete the single row/column
if(isRow && grid.getGridRowCount() <= grid.getGridLayoutManager().getMinCellCount()) {
return CellStatus.Required;
}
else if(!isRow && grid.getGridColumnCount() <= grid.getGridLayoutManager().getMinCellCount()) {
return CellStatus.Required;
}
boolean haveComponents = false;
boolean haveOrigins = false;
boolean haveSingleSpan = false;
for (int i = 0; i < grid.getComponentCount(); i++) {
final GridConstraints constraints = grid.getComponent(i).getConstraints();
final int cell = constraints.getCell(isRow);
final int span = constraints.getSpan(isRow);
if (cellIndex >= cell && cellIndex < cell+span) {
haveComponents = true;
if (cellIndex == cell) {
haveOrigins = true;
if (span == 1) {
haveSingleSpan = true;
}
}
}
}
if (haveSingleSpan)
return CellStatus.Required;
if (haveOrigins)
return CellStatus.CanShift;
if (haveComponents)
return CellStatus.Redundant;
return CellStatus.Empty;
}
示例8: deleteCell
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
/**
* @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 deleted, otherwise column
*/
public static void deleteCell(final RadContainer grid, final int cellIndex, final boolean isRow) {
check(grid, isRow, cellIndex);
if (canDeleteCell(grid, cellIndex, isRow) == CellStatus.Required) {
throw new IllegalArgumentException("cell cannot be deleted");
}
final RadAbstractGridLayoutManager oldLayout = grid.getGridLayoutManager();
final LayoutManager newLayout = oldLayout.copyLayout(grid.getLayout(), isRow ? -1 : 0, isRow ? 0 : -1);
GridConstraints[] oldConstraints = copyConstraints(grid);
for (int i=grid.getComponentCount() - 1; i >= 0; i--){
final GridConstraints constraints = grid.getComponent(i).getConstraints();
if (constraints.getCell(isRow) > cellIndex) {
// component starts after the cell being deleted - move it
addToCell(constraints, isRow, -1);
}
else if (isCellInsideComponent(constraints, isRow, cellIndex)) {
// component belongs to the cell being deleted - decrement component's span
addToSpan(constraints, isRow, -1);
}
}
grid.setLayout(newLayout);
fireAllConstraintsChanged(grid, oldConstraints);
}
示例9: deleteEmptyGridCells
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private static void deleteEmptyGridCells(final RadContainer parent, final GridConstraints delConstraints, final boolean isRow) {
final RadAbstractGridLayoutManager layoutManager = parent.getGridLayoutManager();
for (int cell = delConstraints.getCell(isRow) + delConstraints.getSpan(isRow) - 1; cell >= delConstraints.getCell(isRow); cell--) {
if (cell < parent.getGridCellCount(isRow) && GridChangeUtil.canDeleteCell(parent, cell, isRow) == GridChangeUtil.CellStatus.Empty &&
!layoutManager.isGapCell(parent, isRow, cell)) {
layoutManager.deleteGridCells(parent, cell, isRow);
}
}
}
示例10: constraintsIntersect
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private static boolean constraintsIntersect(boolean horizontal,
GridConstraints constraints,
Rectangle rc) {
int start = constraints.getCell(!horizontal);
int end = start + constraints.getSpan(!horizontal) - 1;
int otherStart = horizontal ? rc.x : rc.y;
int otherEnd = otherStart + (horizontal ? rc.width : rc.height) - 1;
return start <= otherEnd && otherStart <= end;
}
示例11: isInsertInsideComponent
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private boolean isInsertInsideComponent(final int size) {
int endColumn = getInsertCell();
if (isInsertAfter()) endColumn++;
int row = getOppositeCell();
for(int r=row; r<row+size; r++) {
for(int col = 0; col<endColumn; col++) {
RadComponent component;
if (isColumnInsert()) {
component = RadAbstractGridLayoutManager.getComponentAtGrid(getContainer(), r, col);
}
else {
component = RadAbstractGridLayoutManager.getComponentAtGrid(getContainer(), col, r);
}
if (component != null) {
GridConstraints constraints = component.getConstraints();
final boolean isRow = !isColumnInsert();
if (constraints.getCell(isRow) + constraints.getSpan(isRow) > endColumn &&
constraints.getSpan(isRow) > 1) {
return true;
}
}
}
}
return false;
}
示例12: processCellResized
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
public void processCellResized(RadContainer container, final boolean isRow, final int cell, final int newSize) {
int cellCount = isRow ? container.getGridRowCount() : container.getGridColumnCount();
if (container.getParent().isXY() && cell == cellCount-1) {
processRootContainerResize(container, isRow, newSize);
}
else {
for(RadComponent component: container.getComponents()) {
GridConstraints c = component.getConstraints();
if (c.getCell(isRow) == cell && c.getSpan(isRow) == 1) {
Dimension preferredSize = new Dimension(c.myPreferredSize);
if (isRow) {
preferredSize.height = newSize;
if (preferredSize.width == -1) {
preferredSize.width = component.getDelegee().getPreferredSize().width;
}
}
else {
preferredSize.width = newSize;
if (preferredSize.height == -1) {
preferredSize.height = component.getDelegee().getPreferredSize().height;
}
}
PreferredSizeProperty.getInstance(container.getProject()).setValueEx(component, preferredSize);
}
}
}
}
示例13: isCellInsideComponent
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private static boolean isCellInsideComponent(final GridConstraints constraints, final boolean isRow, final int cellIndex) {
final int cell = constraints.getCell(isRow);
final int span = constraints.getSpan(isRow);
return cell <= cellIndex && cellIndex <= cell + span - 1;
}