Java 类com.intellij.uiDesigner.designSurface.GridInsertMode 实例源码

项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testGrowComponent() {
  myContainer.setLayout(new GridLayoutManager(2, 2));

  //  *|.       *** .
  //
  //  ***   ->  *****
  insertComponent(0, 0, 1, 1);
  RadComponent c = insertComponent(1, 0, 1, 2);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(3, myManager.getGridColumnCount(myContainer));
  assertEquals(3, c.getConstraints().getColSpan());
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertGrowMultiple() {
  setGridSize(4, 4);

  // * . . .
  // . . . .
  // . . . .
  // . . . *

  insertComponent(0, 0, 1, 1);
  insertComponent(3, 3, 1, 1);

  // * . . .
  // . . . .
  // * . . .
  // * . . *
  RadComponent c1 = createComponent(0, 0, 2, 1);
  RadComponent c2 = createComponent(0, 1, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(6, myManager.getGridRowCount(myContainer));
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertGrowMultiple1x1() {
  setGridSize(2, 2);

  // * .
  //
  // . *

  insertComponent(0, 0, 1, 1);
  insertComponent(1, 1, 1, 1);

  // * *
  // *
  // * .
  RadComponent c1 = createComponent(0, 0, 2, 1);
  RadComponent c2 = createComponent(0, 1, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(3, myManager.getGridRowCount(myContainer));
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertGrowSingle1x1() {
  setGridSize(2, 2);

  // * .
  //
  // . *

  insertComponent(0, 0, 1, 1);
  insertComponent(1, 1, 1, 1);

  setComponentDimensions(myDropComponent, 0, 0, 2, 2);
  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(3, myManager.getGridRowCount(myContainer));
  final RadComponent addedComponent = myContainer.getComponents()[2];
  assertEquals(1, addedComponent.getConstraints().getRowSpan());
  assertEquals(1, addedComponent.getConstraints().getColSpan());

}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertGrowSingle() {
  setGridSize(4, 4);

  // * . . .
  // . . . .
  // . . . .
  // . . . *

  insertComponent(0, 0, 1, 1);
  insertComponent(3, 3, 1, 1);

  setComponentDimensions(myDropComponent, 0, 0, 2, 2);
  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(6, myManager.getGridRowCount(myContainer));
  final RadComponent addedComponent = myContainer.getComponents()[2];
  assertEquals(2, addedComponent.getConstraints().getRowSpan());
  assertEquals(2, addedComponent.getConstraints().getColSpan());

}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testGrowComponent() {
  myContainer.setLayout(new GridLayoutManager(2, 2));

  //  *|.       *** .
  //
  //  ***   ->  *****
  insertComponent(0, 0, 1, 1);
  RadComponent c = insertComponent(1, 0, 1, 2);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(3, myManager.getGridColumnCount(myContainer));
  assertEquals(3, c.getConstraints().getColSpan());
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertGrowMultiple() {
  setGridSize(4, 4);

  // * . . .
  // . . . .
  // . . . .
  // . . . *

  insertComponent(0, 0, 1, 1);
  insertComponent(3, 3, 1, 1);

  // * . . .
  // . . . .
  // * . . .
  // * . . *
  RadComponent c1 = createComponent(0, 0, 2, 1);
  RadComponent c2 = createComponent(0, 1, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(6, myManager.getGridRowCount(myContainer));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertGrowMultiple1x1() {
  setGridSize(2, 2);

  // * .
  //
  // . *

  insertComponent(0, 0, 1, 1);
  insertComponent(1, 1, 1, 1);

  // * *
  // *
  // * .
  RadComponent c1 = createComponent(0, 0, 2, 1);
  RadComponent c2 = createComponent(0, 1, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(3, myManager.getGridRowCount(myContainer));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertGrowSingle1x1() {
  setGridSize(2, 2);

  // * .
  //
  // . *

  insertComponent(0, 0, 1, 1);
  insertComponent(1, 1, 1, 1);

  setComponentDimensions(myDropComponent, 0, 0, 2, 2);
  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(3, myManager.getGridRowCount(myContainer));
  final RadComponent addedComponent = myContainer.getComponents()[2];
  assertEquals(1, addedComponent.getConstraints().getRowSpan());
  assertEquals(1, addedComponent.getConstraints().getColSpan());

}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertGrowSingle() {
  setGridSize(4, 4);

  // * . . .
  // . . . .
  // . . . .
  // . . . *

  insertComponent(0, 0, 1, 1);
  insertComponent(3, 3, 1, 1);

  setComponentDimensions(myDropComponent, 0, 0, 2, 2);
  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(6, myManager.getGridRowCount(myContainer));
  final RadComponent addedComponent = myContainer.getComponents()[2];
  assertEquals(2, addedComponent.getConstraints().getRowSpan());
  assertEquals(2, addedComponent.getConstraints().getColSpan());

}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testGrowComponent() {
  myContainer.setLayout(new GridLayoutManager(2, 2));

  //  *|.       *** .
  //
  //  ***   ->  *****
  insertComponent(0, 0, 1, 1);
  RadComponent c = insertComponent(1, 0, 1, 2);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(3, myManager.getGridColumnCount(myContainer));
  assertEquals(3, c.getConstraints().getColSpan());
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertGrowMultiple() {
  setGridSize(4, 4);

  // * . . .
  // . . . .
  // . . . .
  // . . . *

  insertComponent(0, 0, 1, 1);
  insertComponent(3, 3, 1, 1);

  // * . . .
  // . . . .
  // * . . .
  // * . . *
  RadComponent c1 = createComponent(0, 0, 2, 1);
  RadComponent c2 = createComponent(0, 1, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(6, myManager.getGridRowCount(myContainer));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertGrowMultiple1x1() {
  setGridSize(2, 2);

  // * .
  //
  // . *

  insertComponent(0, 0, 1, 1);
  insertComponent(1, 1, 1, 1);

  // * *
  // *
  // * .
  RadComponent c1 = createComponent(0, 0, 2, 1);
  RadComponent c2 = createComponent(0, 1, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(3, myManager.getGridRowCount(myContainer));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertGrowSingle1x1() {
  setGridSize(2, 2);

  // * .
  //
  // . *

  insertComponent(0, 0, 1, 1);
  insertComponent(1, 1, 1, 1);

  setComponentDimensions(myDropComponent, 0, 0, 2, 2);
  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(3, myManager.getGridRowCount(myContainer));
  final RadComponent addedComponent = myContainer.getComponents()[2];
  assertEquals(1, addedComponent.getConstraints().getRowSpan());
  assertEquals(1, addedComponent.getConstraints().getColSpan());

}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertGrowSingle() {
  setGridSize(4, 4);

  // * . . .
  // . . . .
  // . . . .
  // . . . *

  insertComponent(0, 0, 1, 1);
  insertComponent(3, 3, 1, 1);

  setComponentDimensions(myDropComponent, 0, 0, 2, 2);
  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(6, myManager.getGridRowCount(myContainer));
  final RadComponent addedComponent = myContainer.getComponents()[2];
  assertEquals(2, addedComponent.getConstraints().getRowSpan());
  assertEquals(2, addedComponent.getConstraints().getColSpan());

}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertColumnAfter() {
  assertEquals(1, myManager.getGridColumnCount(myContainer));

  insertComponent(0, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(2, myManager.getGridColumnCount(myContainer));
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertRowBefore() {
  setGridSize(2, 1);
  insertComponent(0, 0, 1, 1);
  final RadComponent c = insertComponent(1, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowBefore);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(2, c.getConstraints().getRow());
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertInMiddleOfComponentColumn() {
  myContainer.setLayout(new GridLayoutManager(1, 2));
  insertComponent(0, 0, 1, 2);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertFalse(location.canDrop(dcl));
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertInMiddleOfComponentRow() {
  setGridSize(2, 1);
  insertComponent(0, 0, 2, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertFalse(location.canDrop(dcl));
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertInsideBigComponent() {
  setGridSize(2, 2);
  insertComponent(0, 0, 1, 1);
  insertComponent(1, 0, 1, 2);

  setComponentDimensions(myDropComponent, 0, 0, 2, 1);
  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  assertFalse(location.canDrop(DraggedComponentList.withComponents(myDropComponent)));
}
项目:intellij-ce-playground    文件:GridInsertLocationTest.java   
public void testInsertDifferentRows() {
  setGridSize(2, 1);
  insertComponent(0, 0, 1, 1);
  insertComponent(1, 0, 1, 1);

  RadComponent c1 = createComponent(0, 0, 1, 1);
  RadComponent c2 = createComponent(1, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(4, myManager.getGridRowCount(myContainer));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertColumnAfter() {
  assertEquals(1, myManager.getGridColumnCount(myContainer));

  insertComponent(0, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(2, myManager.getGridColumnCount(myContainer));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertRowBefore() {
  setGridSize(2, 1);
  insertComponent(0, 0, 1, 1);
  final RadComponent c = insertComponent(1, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowBefore);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(2, c.getConstraints().getRow());
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertInMiddleOfComponentColumn() {
  myContainer.setLayout(new GridLayoutManager(1, 2));
  insertComponent(0, 0, 1, 2);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertFalse(location.canDrop(dcl));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertInMiddleOfComponentRow() {
  setGridSize(2, 1);
  insertComponent(0, 0, 2, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertFalse(location.canDrop(dcl));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertInsideBigComponent() {
  setGridSize(2, 2);
  insertComponent(0, 0, 1, 1);
  insertComponent(1, 0, 1, 2);

  setComponentDimensions(myDropComponent, 0, 0, 2, 1);
  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  assertFalse(location.canDrop(DraggedComponentList.withComponents(myDropComponent)));
}
项目:tools-idea    文件:GridInsertLocationTest.java   
public void testInsertDifferentRows() {
  setGridSize(2, 1);
  insertComponent(0, 0, 1, 1);
  insertComponent(1, 0, 1, 1);

  RadComponent c1 = createComponent(0, 0, 1, 1);
  RadComponent c2 = createComponent(1, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(4, myManager.getGridRowCount(myContainer));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertColumnAfter() {
  assertEquals(1, myManager.getGridColumnCount(myContainer));

  insertComponent(0, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(2, myManager.getGridColumnCount(myContainer));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertRowBefore() {
  setGridSize(2, 1);
  insertComponent(0, 0, 1, 1);
  final RadComponent c = insertComponent(1, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowBefore);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertTrue(location.canDrop(dcl));
  doDrop(location);
  assertEquals(2, c.getConstraints().getRow());
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertInMiddleOfComponentColumn() {
  myContainer.setLayout(new GridLayoutManager(1, 2));
  insertComponent(0, 0, 1, 2);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertFalse(location.canDrop(dcl));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertInMiddleOfComponentRow() {
  setGridSize(2, 1);
  insertComponent(0, 0, 2, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(myDropComponent);
  assertFalse(location.canDrop(dcl));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertInsideBigComponent() {
  setGridSize(2, 2);
  insertComponent(0, 0, 1, 1);
  insertComponent(1, 0, 1, 2);

  setComponentDimensions(myDropComponent, 0, 0, 2, 1);
  GridInsertLocation location = new GridInsertLocation(myContainer, 0, 0, GridInsertMode.ColumnAfter);
  assertFalse(location.canDrop(DraggedComponentList.withComponents(myDropComponent)));
}
项目:consulo-ui-designer    文件:GridInsertLocationTest.java   
public void testInsertDifferentRows() {
  setGridSize(2, 1);
  insertComponent(0, 0, 1, 1);
  insertComponent(1, 0, 1, 1);

  RadComponent c1 = createComponent(0, 0, 1, 1);
  RadComponent c2 = createComponent(1, 0, 1, 1);

  GridInsertLocation location = new GridInsertLocation(myContainer, 1, 0, GridInsertMode.RowAfter);
  DraggedComponentList dcl = DraggedComponentList.withComponents(c1, c2);
  assertTrue(location.canDrop(dcl));
  location.processDrop(null, new RadComponent[] {c1, c2}, null, dcl);
  assertEquals(4, myManager.getGridRowCount(myContainer));
}