pl.edu.agh.cast.importer.wizard.utils
Class TableViewerHelper

java.lang.Object
  extended by pl.edu.agh.cast.importer.wizard.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.
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, Integer[] selectedColumns, boolean isSortable, boolean isEditable, ITabularData<?> data, ErrorsLog errorsLog, ValidationPageComposite composite)
          Initialize table viewer: creates columns chosen from selected columns and sets sorter for each column (if isSortable == true).
static void initTable(org.eclipse.jface.viewers.TableViewer tableViewer, ITabularData<?> data)
          Delegated method.
static void setEmptyTokensReplacements(org.eclipse.jface.viewers.TableViewer tableViewer, Map<Integer,List<DataRow>> emptyTokenReplacements)
          Sets empty token replacements for a given table viewer.
static void setHeaderRowIdx(org.eclipse.jface.viewers.TableViewer tableViewer, int headerRowIdx)
          Sets selected header row index within a specified table viewer.
static void setSelectedRows(org.eclipse.jface.viewers.TableViewer tableViewer, List<? extends IDataRow<?>> selectedDataRows)
          Sets selected data rows within a specified table viewer.
 
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,
                             ITabularData<?> data)
Delegated method.

See Also:
initTable(TableViewer, Integer[], boolean, boolean, ITabularData, ErrorsLog, ValidationPageComposite)

initTable

public static void initTable(org.eclipse.jface.viewers.TableViewer tableViewer,
                             Integer[] selectedColumns,
                             boolean isSortable,
                             boolean isEditable,
                             ITabularData<?> data,
                             ErrorsLog errorsLog,
                             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
selectedColumns - the column indices 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
isEditable - the flag that specifies if the broken cell can be edited by user
data - the raw tabular data to be displayed as input of the viewer
errorsLog - the errors log
composite - the main composite of the page that is responsible for this table viewer's creation and which has access to WizardPage 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

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

setSelectedRows

public static void setSelectedRows(org.eclipse.jface.viewers.TableViewer tableViewer,
                                   List<? extends IDataRow<?>> 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

setHeaderRowIdx

public static void setHeaderRowIdx(org.eclipse.jface.viewers.TableViewer tableViewer,
                                   int headerRowIdx)
Sets selected header row index within a specified table viewer.

Parameters:
tableViewer - the table viewer whose row index is to be set
headerRowIdx - the header row index

setEmptyTokensReplacements

public static void setEmptyTokensReplacements(org.eclipse.jface.viewers.TableViewer tableViewer,
                                              Map<Integer,List<DataRow>> emptyTokenReplacements)
Sets empty token replacements for a given table viewer.

Parameters:
tableViewer - the table viewer whose empty token replacements are to be set
emptyTokenReplacements - the empty token replacements


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