示例#1
0
  public void testTableColumnsNumAndHeader() {
    final Grid control = getWidget();

    final GridColumn[] columns = control.getColumns();
    assertEquals(2, columns.length);
    assertEquals("First Name", columns[0].getText()); // $NON-NLS-1$
    assertEquals("Last Name", columns[1].getText()); // $NON-NLS-1$
    assertTrue(control.getHeaderVisible());
  }
示例#2
0
 @Override
 protected int getColumnStyle(final int columnIndex) {
   checkColumnRange(columnIndex);
   final Grid control = getUIControl();
   if (control == null) {
     return SWT.DEFAULT;
   }
   final GridColumn[] columns = control.getColumns();
   return columns[columnIndex].getStyle();
 }
示例#3
0
 private void clearSortIndicator() {
   final Grid control = getUIControl();
   if (control == null) {
     return;
   }
   final GridColumn[] columns = control.getColumns();
   for (final GridColumn column : columns) {
     column.setSort(SWT.NONE);
   }
 }
示例#4
0
 @Override
 protected final void applyColumnsMovable() {
   final Grid control = getUIControl();
   if (control == null) {
     return;
   }
   for (final GridColumn column : control.getColumns()) {
     column.setMoveable(hasMoveableColumns());
   }
 }
示例#5
0
 @Override
 protected final void unbindUIControl() {
   super.unbindUIControl();
   final Grid control = getUIControl();
   if (control != null) {
     for (final GridColumn column : control.getColumns()) {
       column.removeSelectionListener(sortListener);
     }
     control.removeSelectionListener(selectionTypeEnforcer);
   }
 }
示例#6
0
 @Override
 protected final void bindUIControl() {
   super.bindUIControl();
   final Grid control = getUIControl();
   if (control != null) {
     for (final GridColumn column : control.getColumns()) {
       column.addSelectionListener(sortListener);
       column.setCellRenderer(cellRenderer);
     }
     control.addSelectionListener(selectionTypeEnforcer);
     control.setEmptyCellRenderer(emptyCellRenderer);
   }
 }
示例#7
0
 @Override
 protected final void applyColumns() {
   final Grid control = getUIControl();
   if (control == null) {
     return;
   }
   final int expectedCols = getExpectedColumnCount();
   if (getColumnCount() != expectedCols) {
     for (final GridColumn column : control.getColumns()) {
       column.dispose();
     }
     for (int i = 0; i < expectedCols; i++) {
       new GridColumn(control, SWT.NONE);
     }
     applyColumnWidths();
   }
   final GridColumn[] columns = control.getColumns();
   for (int columnIndex = 0; columnIndex < columns.length; columnIndex++) {
     final ViewerColumn viewerColumn =
         new GridViewerColumn(getTableViewer(), columns[columnIndex]);
     applyEditingSupport(viewerColumn, columnIndex);
   }
 }
示例#8
0
 @Override
 protected final void applyTableColumnHeaders() {
   final Grid control = getUIControl();
   final boolean headersVisible = columnHeaders != null;
   control.setHeaderVisible(headersVisible);
   if (headersVisible) {
     final GridColumn[] columns = control.getColumns();
     for (int i = 0; i < columns.length; i++) {
       String columnHeader = ""; // $NON-NLS-1$
       if (i < columnHeaders.length && columnHeaders[i] != null) {
         columnHeader = columnHeaders[i];
       }
       columns[i].setText(columnHeader);
       // not necessary for GridColumns because they implement this function already!
       // final String tooltip = isShowColumnTooltip(columns[i], columnHeader) ? columnHeader : "";
       // //$NON-NLS-1$
       // columns[i].setHeaderTooltip(tooltip);
     }
   }
 }