本文整理汇总了Java中com.intellij.uiDesigner.core.GridConstraints.getColumn方法的典型用法代码示例。如果您正苦于以下问题:Java GridConstraints.getColumn方法的具体用法?Java GridConstraints.getColumn怎么用?Java GridConstraints.getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.uiDesigner.core.GridConstraints
的用法示例。
在下文中一共展示了GridConstraints.getColumn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constraintsToGridBag
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
public static void constraintsToGridBag(final GridConstraints constraints, final GridBagConstraints result) {
result.gridx = constraints.getColumn();
result.gridy = constraints.getRow();
result.gridwidth = constraints.getColSpan();
result.gridheight = constraints.getRowSpan();
switch(constraints.getFill()) {
case GridConstraints.FILL_HORIZONTAL: result.fill = GridBagConstraints.HORIZONTAL; break;
case GridConstraints.FILL_VERTICAL: result.fill = GridBagConstraints.VERTICAL; break;
case GridConstraints.FILL_BOTH: result.fill = GridBagConstraints.BOTH; break;
default: result.fill = GridBagConstraints.NONE; break;
}
switch(constraints.getAnchor()) {
case GridConstraints.ANCHOR_NORTHWEST: result.anchor = GridBagConstraints.NORTHWEST; break;
case GridConstraints.ANCHOR_NORTH: result.anchor = GridBagConstraints.NORTH; break;
case GridConstraints.ANCHOR_NORTHEAST: result.anchor = GridBagConstraints.NORTHEAST; break;
case GridConstraints.ANCHOR_EAST: result.anchor = GridBagConstraints.EAST; break;
case GridConstraints.ANCHOR_SOUTHEAST: result.anchor = GridBagConstraints.SOUTHEAST; break;
case GridConstraints.ANCHOR_SOUTH: result.anchor = GridBagConstraints.SOUTH; break;
case GridConstraints.ANCHOR_SOUTHWEST: result.anchor = GridBagConstraints.SOUTHWEST; break;
case GridConstraints.ANCHOR_WEST: result.anchor = GridBagConstraints.WEST; break;
}
}
示例2: areCellsAdjacent
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private static boolean areCellsAdjacent(final IContainer parent, final GridConstraints c1, final GridConstraints c2) {
if (parent instanceof RadContainer) {
final RadContainer container = (RadContainer)parent;
if (!container.getLayoutManager().isGrid()) return false;
if (c1.getRow() == c2.getRow()) {
return FormEditingUtil.prevCol(container, c1.getColumn()) == c2.getColumn() ||
FormEditingUtil.nextCol(container, c1.getColumn()) == c2.getColumn();
}
if (c1.getColumn() == c2.getColumn()) {
return FormEditingUtil.prevRow(container, c1.getRow()) == c2.getRow() ||
FormEditingUtil.nextRow(container, c1.getRow()) == c2.getRow();
}
}
return (c1.getRow() == c2.getRow() && Math.abs(c1.getColumn() - c2.getColumn()) == 1) ||
(c1.getColumn() == c2.getColumn() && Math.abs(c1.getRow() - c2.getRow()) == 1);
}
示例3: getComponentAtGrid
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
@Nullable
public static RadComponent getComponentAtGrid(RadContainer container, final int row, final int column) {
// If the target cell is not empty does not allow drop.
for(int i=0; i<container.getComponentCount(); i++){
final RadComponent component = container.getComponent(i);
if (component.isDragging()) {
continue;
}
final GridConstraints constraints=component.getConstraints();
if(
constraints.getRow() <= row && row < constraints.getRow()+constraints.getRowSpan() &&
constraints.getColumn() <= column && column < constraints.getColumn()+constraints.getColSpan()
){
return component;
}
}
return null;
}
示例4: update
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private void update(final RadContainer container) {
if (container.getWidth() * container.getHeight() >= 4096*4096) return;
int count = container.getComponentCount();
int[] rows = new int[count];
int[] rowSpans = new int[count];
int[] cols = new int[count];
int[] colSpans = new int[count];
for(int i=0; i<count; i++) {
GridConstraints c = container.getComponent(i).getConstraints();
rows [i] = c.getRow();
rowSpans [i] = c.getRowSpan();
cols [i] = c.getColumn();
colSpans [i] = c.getColSpan();
}
int[] horzGridLines = container.getGridLayoutManager().getHorizontalGridLines(container);
int[] vertGridLines = container.getGridLayoutManager().getVerticalGridLines(container);
if (!arraysEqual(horzGridLines, myHorzGridLines) ||
!arraysEqual(vertGridLines, myVertGridLines) ||
!arraysEqual(rows, myRows) ||
!arraysEqual(rowSpans, myRowSpans) ||
!arraysEqual(cols, myCols) ||
!arraysEqual(colSpans, myColSpans)) {
myHorzGridLines = horzGridLines;
myVertGridLines = vertGridLines;
myRows = rows;
myRowSpans = rowSpans;
myCols = cols;
myColSpans = colSpans;
repaint(container);
}
}
示例5: getLocationAtParent
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private ComponentDropLocation getLocationAtParent(final Direction direction) {
final RadContainer parent = myContainer.getParent();
if (parent.getLayoutManager().isGrid()) {
final GridConstraints c = myContainer.getConstraints();
switch(direction) {
case LEFT: return new GridInsertLocation(parent, c.getRow(), c.getColumn(), GridInsertMode.ColumnBefore);
case RIGHT: return new GridInsertLocation(parent, c.getRow(), c.getColumn()+c.getColSpan()-1, GridInsertMode.ColumnAfter);
case UP: return new GridInsertLocation(parent, c.getRow(), c.getColumn(), GridInsertMode.RowBefore);
case DOWN: return new GridInsertLocation(parent, c.getRow()+c.getRowSpan()-1, c.getColumn(), GridInsertMode.RowAfter);
}
}
return null;
}
示例6: checkComponentProperties
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
protected void checkComponentProperties(Module module, IComponent component, FormErrorCollector collector) {
if (FormInspectionUtil.isComponentClass(module, component, JRadioButton.class)) {
final IRootContainer root = FormEditingUtil.getRoot(component);
if (root == null) return;
if (root.getButtonGroupName(component) == null) {
EditorQuickFixProvider quickFixProvider = null;
IContainer parent = component.getParentContainer();
for(int i=0; i<parent.getComponentCount(); i++) {
IComponent child = parent.getComponent(i);
if (child != component &&
FormInspectionUtil.isComponentClass(module, child, JRadioButton.class)) {
final GridConstraints c1 = component.getConstraints();
final GridConstraints c2 = child.getConstraints();
if (areCellsAdjacent(parent, c1, c2)) {
final String groupName = root.getButtonGroupName(child);
if (groupName == null) {
quickFixProvider = new EditorQuickFixProvider() {
public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
return new CreateGroupQuickFix(editor, component, c1.getColumn() == c2.getColumn());
}
};
break;
}
else {
quickFixProvider = new EditorQuickFixProvider() {
public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
return new AddToGroupQuickFix(editor, component, groupName);
}
};
}
}
}
}
collector.addError(getID(), component, null, UIDesignerBundle.message("inspection.no.button.group.error"), quickFixProvider);
}
}
}
示例7: gridToCellConstraints
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private static CellConstraints gridToCellConstraints(final RadComponent component) {
GridConstraints gc = component.getConstraints();
CellConstraints.Alignment hAlign = ((gc.getHSizePolicy() & GridConstraints.SIZEPOLICY_WANT_GROW) != 0)
? CellConstraints.FILL
: CellConstraints.DEFAULT;
CellConstraints.Alignment vAlign = ((gc.getVSizePolicy() & GridConstraints.SIZEPOLICY_WANT_GROW) != 0)
? CellConstraints.FILL
: CellConstraints.DEFAULT;
if (component.getCustomLayoutConstraints() instanceof CellConstraints) {
CellConstraints cc = (CellConstraints) component.getCustomLayoutConstraints();
hAlign = cc.hAlign;
vAlign = cc.vAlign;
}
return new CellConstraints(gc.getColumn()+1, gc.getRow()+1, gc.getColSpan(), gc.getRowSpan(), hAlign, vAlign);
}
示例8: convert
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
private Result convert(final JComponent component, final GridConstraints constraints) {
final Result result = new Result(component);
int endRow = constraints.getRow() + constraints.getRowSpan()-1;
myLastRow = Math.max(myLastRow, endRow);
int endCol = constraints.getColumn() + constraints.getColSpan()-1;
myLastCol = Math.max(myLastCol, endCol);
int indent = Util.DEFAULT_INDENT * constraints.getIndent();
constraintsToGridBag(constraints, result.constraints);
result.constraints.weightx = getWeight(constraints, true);
result.constraints.weighty = getWeight(constraints, false);
result.constraints.insets = new Insets(myInsets.top, myInsets.left + indent, myInsets.bottom, myInsets.right);
Dimension minSize = constraints.myMinimumSize;
if (component != null && minSize.width <= 0 && minSize.height <= 0) {
minSize = component.getMinimumSize();
}
if ((constraints.getHSizePolicy() & GridConstraints.SIZEPOLICY_CAN_SHRINK) == 0) {
minSize.width = constraints.myPreferredSize.width > 0 || component == null
? constraints.myPreferredSize.width
: component.getPreferredSize().width;
}
if ((constraints.getVSizePolicy() & GridConstraints.SIZEPOLICY_CAN_SHRINK) == 0) {
minSize.height = constraints.myPreferredSize.height > 0 || component == null
? constraints.myPreferredSize.height
: component.getPreferredSize().height;
}
if (minSize.width != -1 || minSize.height != -1) {
result.minimumSize = minSize;
}
if (constraints.myPreferredSize.width > 0 && constraints.myPreferredSize.height > 0) {
result.preferredSize = constraints.myPreferredSize;
}
if (constraints.myMaximumSize.width > 0 && constraints.myMaximumSize.height > 0) {
result.maximumSize = constraints.myMaximumSize;
}
return result;
}
示例9: getGridSpanGridRect
import com.intellij.uiDesigner.core.GridConstraints; //导入方法依赖的package包/类
@Nullable
static Rectangle getGridSpanGridRect(final RadContainer grid,
final GridConstraints originalConstraints,
final Point point,
final int resizeMask) {
int rowAtMouse = (resizeMask & (Painter.NORTH_MASK | Painter.SOUTH_MASK)) != 0
? grid.getGridRowAt(point.y)
: -1;
int colAtMouse = (resizeMask & (Painter.WEST_MASK | Painter.EAST_MASK)) != 0
? grid.getGridColumnAt(point.x)
: -1;
if (rowAtMouse != -1 || colAtMouse != -1) {
final int origStartCol = originalConstraints.getColumn();
final int origEndCol = originalConstraints.getColumn() + originalConstraints.getColSpan() - 1;
int startCol = origStartCol;
int endCol = origEndCol;
if (colAtMouse >= 0) {
if ((resizeMask & Painter.WEST_MASK) != 0 && colAtMouse <= endCol) {
// resize to left
startCol = colAtMouse;
}
else if ((resizeMask & Painter.EAST_MASK) != 0 && colAtMouse >= startCol) {
endCol = colAtMouse;
}
}
final int origStartRow = originalConstraints.getRow();
final int origEndRow = originalConstraints.getRow() + originalConstraints.getRowSpan() - 1;
int startRow = origStartRow;
int endRow = origEndRow;
if (rowAtMouse >= 0) {
if ((resizeMask & Painter.NORTH_MASK) != 0 && rowAtMouse <= endRow) {
startRow = rowAtMouse;
}
else if ((resizeMask & Painter.SOUTH_MASK) != 0 && rowAtMouse >= startRow) {
endRow = rowAtMouse;
}
}
return new Rectangle(startCol, startRow, endCol-startCol+1, endRow-startRow+1);
}
return null;
}