Example #1
0
  /** As per Bug 295305 */
  public void testAutoCreateColumnsWithNoLayout() {
    final ITableRidget ridget = createRidget();
    final Table control = new Table(getShell(), SWT.FULL_SELECTION | SWT.SINGLE);
    ridget.setUIControl(control);

    getShell().setLayout(null);
    control.setSize(300, 100);
    final String[] columns3 = {
      Person.PROPERTY_FIRSTNAME, Person.PROPERTY_LASTNAME, Person.PROPERTY_BIRTHDAY
    };
    ridget.bindToModel(manager, "persons", Person.class, columns3, null); // $NON-NLS-1$

    assertEquals(null, control.getParent().getLayout());
    assertEquals(null, control.getLayout());

    TestUtils.assertColumnWidths(control, 3);
  }
Example #2
0
  /** As per Bug 295305 */
  public void testAutoCreateColumnsWithTableColumnLayout() {
    final ITableRidget ridget = createRidget();
    for (final Control control : getShell().getChildren()) {
      control.dispose();
    }
    final Table control = new Table(getShell(), SWT.FULL_SELECTION | SWT.SINGLE);
    ridget.setUIControl(control);
    getShell().setLayout(new TableColumnLayout());

    final String[] columns3 = {
      Person.PROPERTY_FIRSTNAME, Person.PROPERTY_LASTNAME, Person.PROPERTY_BIRTHDAY
    };
    ridget.bindToModel(manager, "persons", Person.class, columns3, null); // $NON-NLS-1$

    assertTrue(control.getParent().getLayout() instanceof TableColumnLayout);
    assertEquals(null, control.getLayout());

    TestUtils.assertColumnWidths(control, 3);
  }
Example #3
0
  /** As per Bug 295305 */
  public void testAutoCreateColumnsWithTableLayout() {
    final ITableRidget ridget = createRidget();
    final Table control = new Table(getShell(), SWT.FULL_SELECTION | SWT.SINGLE);
    control.setLayout(new TableLayout());
    ridget.setUIControl(control);

    final String[] columns3 = {
      Person.PROPERTY_FIRSTNAME, Person.PROPERTY_LASTNAME, Person.PROPERTY_BIRTHDAY
    };
    ridget.bindToModel(manager, "persons", Person.class, columns3, null); // $NON-NLS-1$

    final Class<?> shellLayout = getShell().getLayout().getClass();
    assertSame(shellLayout, control.getParent().getLayout().getClass());
    assertTrue(control.getLayout() instanceof TableLayout);

    //		int totalWidthOfColumns = 0;
    //		for (int i = 0; i < 3; i++) {
    //			totalWidthOfColumns += control.getColumn(i).getWidth();
    //		}
    TestUtils.assertColumnWidths(control, 3);
  }