本文整理汇总了Java中com.intellij.uiDesigner.FormEditingUtil.adjustForGap方法的典型用法代码示例。如果您正苦于以下问题:Java FormEditingUtil.adjustForGap方法的具体用法?Java FormEditingUtil.adjustForGap怎么用?Java FormEditingUtil.adjustForGap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.uiDesigner.FormEditingUtil
的用法示例。
在下文中一共展示了FormEditingUtil.adjustForGap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdjacentLocation
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
@Override @Nullable
public ComponentDropLocation getAdjacentLocation(Direction direction) {
if (isRowInsert()) {
if (direction == Direction.RIGHT) {
if (getColumn() < myContainer.getGridColumnCount()-1) {
return new GridInsertLocation(myContainer, getRow(), FormEditingUtil.adjustForGap(myContainer, getColumn()+1, false, 1), getMode());
}
return new GridInsertLocation(myContainer, getRow(), getColumn(), GridInsertMode.ColumnAfter);
}
if (direction == Direction.LEFT) {
if (getColumn() > 0) {
return new GridInsertLocation(myContainer, getRow(), FormEditingUtil.adjustForGap(myContainer, getColumn()-1, false, -1), getMode());
}
return new GridInsertLocation(myContainer, getRow(), getColumn(), GridInsertMode.ColumnBefore);
}
if (direction == Direction.DOWN || direction == Direction.UP) {
int adjRow = (myMode == GridInsertMode.RowAfter) ? getRow() : getRow()-1;
if (direction == Direction.DOWN && adjRow+1 < myContainer.getGridRowCount()) {
return new GridDropLocation(myContainer, FormEditingUtil.adjustForGap(myContainer, adjRow+1, true, 1), getColumn());
}
if (direction == Direction.UP && adjRow >= 0) {
return new GridDropLocation(myContainer, FormEditingUtil.adjustForGap(myContainer, adjRow, true, -1), getColumn());
}
return getLocationAtParent(direction);
}
}
else {
if (direction == Direction.DOWN) {
if (getRow() < myContainer.getGridRowCount()-1) {
return new GridInsertLocation(myContainer, FormEditingUtil.adjustForGap(myContainer, getRow()+1, true, 1), getColumn(), getMode());
}
return new GridInsertLocation(myContainer, getRow(), getColumn(), GridInsertMode.RowAfter);
}
if (direction == Direction.UP) {
if (getRow() > 0) {
return new GridInsertLocation(myContainer, FormEditingUtil.adjustForGap(myContainer, getRow()-1, true, -1), getColumn(), getMode());
}
return new GridInsertLocation(myContainer, getRow(), getColumn(), GridInsertMode.RowBefore);
}
if (direction == Direction.LEFT || direction == Direction.RIGHT) {
int adjCol = (myMode == GridInsertMode.ColumnAfter) ? getColumn() : getColumn()-1;
if (direction == Direction.RIGHT && adjCol+1 < myContainer.getGridColumnCount()) {
return new GridDropLocation(myContainer, getRow(), FormEditingUtil.adjustForGap(myContainer, adjCol+1, false, 1));
}
if (direction == Direction.LEFT && adjCol >= 0) {
return new GridDropLocation(myContainer, getRow(), FormEditingUtil.adjustForGap(myContainer, adjCol, false, -1));
}
return getLocationAtParent(direction);
}
}
return null;
}
示例2: run
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
public void run() {
RadContainer parent = myComponent.getParent();
ArrayList<RadComponent> buttonsToGroup = new ArrayList<RadComponent>();
for(RadComponent component: parent.getComponents()) {
if (FormInspectionUtil.isComponentClass(myComponent.getModule(), component, JRadioButton.class)) {
if (component.getConstraints().getCell(!myVerticalGroup) == myComponent.getConstraints().getCell(!myVerticalGroup))
buttonsToGroup.add(component);
}
}
Collections.sort(buttonsToGroup, new Comparator<RadComponent>() {
public int compare(final RadComponent o1, final RadComponent o2) {
if (myVerticalGroup) {
return o1.getConstraints().getRow() - o2.getConstraints().getRow();
}
return o1.getConstraints().getColumn() - o2.getConstraints().getColumn();
}
});
// ensure that selected radio buttons are in adjacent cells, and exclude from grouping
// buttons separated by empty cells or other controls
int index=buttonsToGroup.indexOf(myComponent);
LOG.assertTrue(index >= 0);
int expectCell = myComponent.getConstraints().getCell(myVerticalGroup);
for(int i=index-1; i >= 0; i--) {
expectCell = FormEditingUtil.adjustForGap(parent, expectCell-1, myVerticalGroup, -1);
if (buttonsToGroup.get(i).getConstraints().getCell(myVerticalGroup) != expectCell) {
removeRange(buttonsToGroup, 0, i);
break;
}
}
expectCell = myComponent.getConstraints().getCell(myVerticalGroup);
for(int i=index+1; i<buttonsToGroup.size(); i++) {
expectCell = FormEditingUtil.adjustForGap(parent, expectCell+1, myVerticalGroup, 1);
if (buttonsToGroup.get(i).getConstraints().getCell(myVerticalGroup) != expectCell) {
removeRange(buttonsToGroup, i, buttonsToGroup.size()-1);
break;
}
}
LOG.assertTrue(buttonsToGroup.size() > 1);
GroupButtonsAction.groupButtons(myEditor, buttonsToGroup);
}
示例3: getNewRow
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
private static int getNewRow(final RadComponent c, final int rowDelta) {
return FormEditingUtil.adjustForGap(c.getParent(), c.getConstraints().getRow() + rowDelta, true, rowDelta);
}
示例4: getNewColumn
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
private static int getNewColumn(final RadComponent c, final int colDelta) {
return FormEditingUtil.adjustForGap(c.getParent(), c.getConstraints().getColumn() + colDelta, false, colDelta);
}