pl.edu.agh.cast.data.ui.utils
Class TableViewerHelper

java.lang.Object
  extended by pl.edu.agh.cast.data.ui.utils.TableViewerHelper

public final class TableViewerHelper
extends Object

Helper class which contains common operations on table viewers.

Author:
AGH CAST Team

Method Summary
static void adjustColumnWidth(org.eclipse.jface.viewers.TableViewer tableViewer)
          Adjust columns width to their content in specified table viewer.
 void expandColumn(org.eclipse.swt.widgets.TableColumn column)
          Expands the specified column.
static TableViewerHelper getInstance()
           
static void initErrorTable(org.eclipse.jface.viewers.TableViewer tableViewer, String[] captions, boolean isSortable, int defaultSorterColumnNo)
          Initialized the error table.
static void initTable(org.eclipse.jface.viewers.TableViewer tableViewer, String[] captions, int[] selectedColumns, boolean isSortable, int defaultSorterColumnNo, BrokenDataInfo errors, boolean isEditable, ValidationPageComposite composite)
          Initialize table viewer: creates columns chosen from selected columns and sets sorter for each column (if isSortable == true).
static void setSelectedRows(org.eclipse.jface.viewers.TableViewer tableViewer, List<DataRow> selectedDataRows)
          Sets selected data rows within a specified table viewer.
 void shrinkColumn(org.eclipse.swt.widgets.TableColumn column)
          Shrinks the specified column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TableViewerHelper getInstance()

initTable

public static void initTable(org.eclipse.jface.viewers.TableViewer tableViewer,
                             String[] captions,
                             int[] selectedColumns,
                             boolean isSortable,
                             int defaultSorterColumnNo,
                             BrokenDataInfo errors,
                             boolean isEditable,
                             ValidationPageComposite composite)
Initialize table viewer: creates columns chosen from selected columns and sets sorter for each column (if isSortable == true).

Parameters:
tableViewer - the table viewer to initialize
captions - all the column captions (even if not selected)
selectedColumns - the columns indexes from captions (or DataRow) which will be created (other columns from captions or DataRow are ignored)
isSortable - the flag that specifies if the table viewer has sorters
defaultSorterColumnNo - the index of column which is to be sorted after creating the table viewer
errors - the errors information used for coloring cells, if null default coloring is set
isEditable - the flag that specifies if the broken cell can by edited by user
composite - the main composite of the page, which has access to WiazardPage object and is responsible for updating all controls

initErrorTable

public static void initErrorTable(org.eclipse.jface.viewers.TableViewer tableViewer,
                                  String[] captions,
                                  boolean isSortable,
                                  int defaultSorterColumnNo)
Initialized the error table.

Parameters:
tableViewer - the error table viewer to initialize
captions - the error table column captions
isSortable - the flag that specifies if the error table viewer has sorters
defaultSorterColumnNo - the index of column which is to be sorted after creating the error table viewer

setSelectedRows

public static void setSelectedRows(org.eclipse.jface.viewers.TableViewer tableViewer,
                                   List<DataRow> selectedDataRows)
Sets selected data rows within a specified table viewer.

Parameters:
tableViewer - the table viewer whose rows are to be set
selectedDataRows - the data rows to set

adjustColumnWidth

public static void adjustColumnWidth(org.eclipse.jface.viewers.TableViewer tableViewer)
Adjust columns width to their content in specified table viewer.

Parameters:
tableViewer - the table viewer whose column width is to be adjusted

expandColumn

public void expandColumn(org.eclipse.swt.widgets.TableColumn column)
Expands the specified column.

Parameters:
column - the column to expand

shrinkColumn

public void shrinkColumn(org.eclipse.swt.widgets.TableColumn column)
Shrinks the specified column.

Parameters:
column - the column to shrink


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.