Java 类com.intellij.uiDesigner.GridChangeUtil 实例源码

项目:consulo-ui-designer    文件:GridCaptionPanel.java   
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;
}
项目:intellij-ce-playground    文件:FlattenAction.java   
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();
  }
}
项目:intellij-ce-playground    文件:GridCaptionPanel.java   
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;
}
项目:intellij-ce-playground    文件:GridInsertLocation.java   
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);
    }
  }
}
项目:intellij-ce-playground    文件:RadFormLayoutManager.java   
@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;
}
项目:tools-idea    文件:FlattenAction.java   
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();
  }
}
项目:tools-idea    文件:GridCaptionPanel.java   
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;
}
项目:tools-idea    文件:GridInsertLocation.java   
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);
    }
  }
}
项目:tools-idea    文件:RadFormLayoutManager.java   
@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;
}
项目:consulo-ui-designer    文件:FlattenAction.java   
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();
  }
}
项目:consulo-ui-designer    文件:GridInsertLocation.java   
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);
    }
  }
}
项目:consulo-ui-designer    文件:RadFormLayoutManager.java   
@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;
}
项目:intellij-ce-playground    文件:SplitAction.java   
protected void actionPerformed(CaptionSelection selection) {
  GridChangeUtil.splitCell(selection.getContainer(), selection.getFocusedIndex(), selection.isRow());
}
项目:intellij-ce-playground    文件:RadAbstractGridLayoutManager.java   
/**
 * @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;
}
项目:intellij-ce-playground    文件:RadAbstractGridLayoutManager.java   
/**
 * @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;
}
项目:intellij-ce-playground    文件:RadAbstractGridLayoutManager.java   
public void processCellsMoved(final RadContainer container, final boolean isRow, final int[] cells, final int targetCell) {
  GridChangeUtil.moveCells(container, isRow, cells, targetCell);
}
项目:tools-idea    文件:SplitAction.java   
protected void actionPerformed(CaptionSelection selection) {
  GridChangeUtil.splitCell(selection.getContainer(), selection.getFocusedIndex(), selection.isRow());
}
项目:tools-idea    文件:RadAbstractGridLayoutManager.java   
/**
 * @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;
}
项目:tools-idea    文件:RadAbstractGridLayoutManager.java   
/**
 * @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;
}
项目:tools-idea    文件:RadAbstractGridLayoutManager.java   
public void processCellsMoved(final RadContainer container, final boolean isRow, final int[] cells, final int targetCell) {
  GridChangeUtil.moveCells(container, isRow, cells, targetCell);
}
项目:consulo-ui-designer    文件:SplitAction.java   
protected void actionPerformed(CaptionSelection selection) {
  GridChangeUtil.splitCell(selection.getContainer(), selection.getFocusedIndex(), selection.isRow());
}
项目:consulo-ui-designer    文件:RadAbstractGridLayoutManager.java   
/**
 * @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;
}
项目:consulo-ui-designer    文件:RadAbstractGridLayoutManager.java   
/**
 * @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;
}
项目:consulo-ui-designer    文件:RadAbstractGridLayoutManager.java   
public void processCellsMoved(final RadContainer container, final boolean isRow, final int[] cells, final int targetCell) {
  GridChangeUtil.moveCells(container, isRow, cells, targetCell);
}