本文整理汇总了Java中com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager类的典型用法代码示例。如果您正苦于以下问题:Java RadAbstractGridLayoutManager类的具体用法?Java RadAbstractGridLayoutManager怎么用?Java RadAbstractGridLayoutManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RadAbstractGridLayoutManager类属于com.intellij.uiDesigner.radComponents包,在下文中一共展示了RadAbstractGridLayoutManager类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertRowOrColumn
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的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 inserted, otherwise column
* @param isBefore if true, row/column will be inserted before row/column with given index, otherwise after
*/
public static void insertRowOrColumn(final RadContainer grid, final int cellIndex, final boolean isRow, final boolean isBefore) {
check(grid, isRow, cellIndex);
final RadAbstractGridLayoutManager oldLayout = grid.getGridLayoutManager();
int beforeIndex = cellIndex;
if (!isBefore) {
// beforeIndex can actually be equal to get{Row|Column}Count an case we add row after the last row/column
beforeIndex++;
}
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();
adjustConstraintsOnInsert(constraints, isRow, beforeIndex, 1);
}
grid.setLayout(newLayout);
fireAllConstraintsChanged(grid, oldConstraints);
}
示例2: processDrop
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的package包/类
@Override
public void processDrop(final GuiEditor editor, final RadComponent[] components, final GridConstraints[] constraintsToAdjust,
final ComponentDragObject dragObject) {
RadAbstractGridLayoutManager gridLayout = myContainer.getGridLayoutManager();
if (myContainer.getGridRowCount() == 0) {
gridLayout.insertGridCells(myContainer, 0, true, true, true);
}
if (myContainer.getGridColumnCount() == 0) {
gridLayout.insertGridCells(myContainer, 0, false, true, true);
}
dropIntoGrid(myContainer, components, myRow, myColumn, dragObject);
FormLayout formLayout = (FormLayout) myContainer.getDelegee().getLayout();
if (myXPart == 0) {
formLayout.setColumnSpec(1, new ColumnSpec("d"));
}
else if (myXPart == 2) {
gridLayout.insertGridCells(myContainer, 0, false, true, true);
}
if (myYPart == 0) {
formLayout.setRowSpec(1, new RowSpec("d"));
}
else if (myYPart == 2) {
gridLayout.insertGridCells(myContainer, 0, true, true, true);
}
}
示例3: processDrop
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的package包/类
@Override
public void processDrop(final GuiEditor editor, final RadComponent[] components, final GridConstraints[] constraintsToAdjust,
final ComponentDragObject dragObject) {
RadAbstractGridLayoutManager gridLayout = myContainer.getGridLayoutManager();
if (myContainer.getGridRowCount() == 0) {
gridLayout.insertGridCells(myContainer, 0, true, true, true);
}
if (myContainer.getGridColumnCount() == 0) {
gridLayout.insertGridCells(myContainer, 0, false, true, true);
}
dropIntoGrid(myContainer, components, myRow, myColumn, dragObject);
FormLayout formLayout = (FormLayout) myContainer.getDelegee().getLayout();
if (myXPart == 0) {
formLayout.setColumnSpec(1, ColumnSpec.decode("d"));
}
else if (myXPart == 2) {
gridLayout.insertGridCells(myContainer, 0, false, true, true);
}
if (myYPart == 0) {
formLayout.setRowSpec(1, RowSpec.decode("d"));
}
else if (myYPart == 2) {
gridLayout.insertGridCells(myContainer, 0, true, true, true);
}
}
示例4: deleteCell
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的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);
}
示例5: deleteEmptyGridCells
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的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);
}
}
}
示例6: processDrop
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的package包/类
@Override public void processDrop(final GuiEditor editor,
final RadComponent[] components,
final GridConstraints[] constraintsToAdjust,
final ComponentDragObject dragObject) {
RadAbstractGridLayoutManager gridLayout = myContainer.getGridLayoutManager();
if (myContainer.getGridRowCount() == 0 && myContainer.getGridColumnCount() == 0) {
gridLayout.insertGridCells(myContainer, 0, false, true, true);
gridLayout.insertGridCells(myContainer, 0, true, true, true);
}
super.processDrop(editor, components, constraintsToAdjust, dragObject);
Palette palette = Palette.getInstance(editor.getProject());
ComponentItem hSpacerItem = palette.getItem(HSpacer.class.getName());
ComponentItem vSpacerItem = palette.getItem(VSpacer.class.getName());
InsertComponentProcessor icp = new InsertComponentProcessor(editor);
if (myXPart == 0) {
insertSpacer(icp, hSpacerItem, GridInsertMode.ColumnAfter);
}
if (myXPart == 2) {
insertSpacer(icp, hSpacerItem, GridInsertMode.ColumnBefore);
}
if (myYPart == 0) {
insertSpacer(icp, vSpacerItem, GridInsertMode.RowAfter);
}
if (myYPart == 2) {
insertSpacer(icp, vSpacerItem, GridInsertMode.RowBefore);
}
}
示例7: normalize
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的package包/类
public GridInsertLocation normalize() {
final RadAbstractGridLayoutManager gridManager = myContainer.getGridLayoutManager();
if (myMode == GridInsertMode.RowBefore && myRow > 0) {
myMode = GridInsertMode.RowAfter;
myRow--;
}
else if (myMode == GridInsertMode.ColumnBefore && myColumn > 0) {
myMode = GridInsertMode.ColumnAfter;
myColumn--;
}
if (myMode == GridInsertMode.RowAfter && gridManager.isGapCell(myContainer, true, myRow)) {
myRow--;
}
else if (myMode == GridInsertMode.RowBefore && gridManager.isGapCell(myContainer, true, myRow)) {
myRow++;
}
else if (myMode == GridInsertMode.ColumnAfter && gridManager.isGapCell(myContainer, false, myColumn)) {
myColumn--;
}
else if (myMode == GridInsertMode.ColumnBefore && gridManager.isGapCell(myContainer, false, myColumn)) {
myColumn++;
}
return this;
}
示例8: isInsertInsideComponent
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的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;
}
示例9: deleteEmptyGridCells
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的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: GridSpanInsertProcessor
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的package包/类
public GridSpanInsertProcessor(RadContainer container,
int insertRow,
int insertColumn,
GridInsertMode mode,
ComponentDragObject dragObject) {
myContainer = container;
myLayoutManager = container.getGridLayoutManager();
myRow = insertRow;
myColumn = insertColumn;
int[] vGridLines = myLayoutManager.getVerticalGridLines(container);
int[] hGridLines = myLayoutManager.getHorizontalGridLines(container);
RadComponent component = RadAbstractGridLayoutManager.getComponentAtGrid(container, insertRow, insertColumn);
if (component != null) {
int lastColIndex = insertColumn + dragObject.getColSpan(0);
if (lastColIndex > vGridLines.length - 1) {
lastColIndex = insertColumn + 1;
}
int lastRowIndex = insertRow + dragObject.getRowSpan(0);
if (lastRowIndex > hGridLines.length - 1) {
lastRowIndex = insertRow + 1;
}
Rectangle bounds = component.getBounds();
bounds.translate(-vGridLines[insertColumn], -hGridLines[insertRow]);
int spaceToRight = vGridLines[lastColIndex] - vGridLines[insertColumn] - (bounds.x + bounds.width);
int spaceBelow = hGridLines[lastRowIndex] - hGridLines[insertRow] - (bounds.y + bounds.height);
if (mode == GridInsertMode.RowBefore && bounds.y > GridInsertLocation.INSERT_RECT_MIN_SIZE) {
myMode = GridInsertMode.RowBefore;
myInsertCellComponent = component;
}
else if (mode == GridInsertMode.RowAfter && spaceBelow > GridInsertLocation.INSERT_RECT_MIN_SIZE) {
myMode = GridInsertMode.RowAfter;
}
else if (mode == GridInsertMode.ColumnBefore && bounds.x > GridInsertLocation.INSERT_RECT_MIN_SIZE) {
myMode = GridInsertMode.ColumnBefore;
myInsertCellComponent = component;
}
else if (mode == GridInsertMode.ColumnAfter && spaceToRight > GridInsertLocation.INSERT_RECT_MIN_SIZE) {
myMode = GridInsertMode.ColumnAfter;
}
}
}
示例11: getInsertFeedbackPosition
import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; //导入依赖的package包/类
public static Rectangle getInsertFeedbackPosition(final GridInsertMode mode, final RadContainer container, final Rectangle cellRect,
final Rectangle feedbackRect) {
final RadAbstractGridLayoutManager manager = container.getGridLayoutManager();
int[] vGridLines = manager.getVerticalGridLines(container);
int[] hGridLines = manager.getHorizontalGridLines(container);
Rectangle rc = feedbackRect;
int w=4;
switch (mode) {
case ColumnBefore:
rc = new Rectangle(vGridLines [cellRect.x] - w, feedbackRect.y - INSERT_ARROW_SIZE,
2 * w, feedbackRect.height + 2 * INSERT_ARROW_SIZE);
if (cellRect.x > 0 && manager.isGapCell(container, false, cellRect.x-1)) {
rc.translate(-(vGridLines [cellRect.x] - vGridLines [cellRect.x-1]) / 2, 0);
}
break;
case ColumnAfter:
rc = new Rectangle(vGridLines [cellRect.x + cellRect.width+1] - w, feedbackRect.y - INSERT_ARROW_SIZE,
2 * w, feedbackRect.height + 2 * INSERT_ARROW_SIZE);
if (cellRect.x < manager.getGridColumnCount(container)-1 && manager.isGapCell(container, false, cellRect.x+1)) {
rc.translate((vGridLines [cellRect.x+2] - vGridLines [cellRect.x+1]) / 2, 0);
}
break;
case RowBefore:
rc = new Rectangle(feedbackRect.x - INSERT_ARROW_SIZE, hGridLines [cellRect.y] - w,
feedbackRect.width + 2 * INSERT_ARROW_SIZE, 2 * w);
if (cellRect.y > 0 && manager.isGapCell(container, true, cellRect.y-1)) {
rc.translate(0, -(hGridLines [cellRect.y] - hGridLines [cellRect.y-1]) / 2);
}
break;
case RowAfter:
rc = new Rectangle(feedbackRect.x - INSERT_ARROW_SIZE, hGridLines [cellRect.y+cellRect.height+1] - w,
feedbackRect.width + 2 * INSERT_ARROW_SIZE, 2 * w);
if (cellRect.y < manager.getGridRowCount(container)-1 && manager.isGapCell(container, true, cellRect.y+1)) {
rc.translate(0, (hGridLines [cellRect.y+2] - hGridLines [cellRect.y+1]) / 2);
}
break;
}
return rc;
}