Elexis API documentation
Version 2.1.6 as of December 11 2011

de.ralfebert.rcputils.tables
Class ColumnBuilder

java.lang.Object
  extended by de.ralfebert.rcputils.tables.ColumnBuilder

public class ColumnBuilder
extends java.lang.Object

ColumnBuilder is responsible to build a column for TableViewerBuilder Methods are chainable so you can construct table columns in a single line. After customizing the column by calling methods, call build() once to create the actual column.

Author:
Ralf Ebert

Method Summary
 ColumnBuilder alignCenter()
          Sets alignment of column cell texts to be centered.
 ColumnBuilder alignRight()
          Sets alignment of column cell texts to be right-aligned.
 ColumnBuilder bindToProperty(java.lang.String propertyName)
          Binds this column to the given property.
 ColumnBuilder bindToValue(IValue valueHandler)
          Binds the column to an arbitrary value.
 TableViewerColumn build()
          Builds the column and returns the TableViewerColumn
 ColumnBuilder format(ICellFormatter cellFormatter)
          A cell formatter allows to format the cell besides the textual value, for example to customize colors or set images.
 ColumnBuilder format(IValueFormatter valueFormatter)
          Sets a formatter for this column that is responsible to convert the value into a String.
 ColumnBuilder makeEditable()
          Makes this column editable.
 ColumnBuilder makeEditable(CellEditor cellEditor)
          Makes the column cells editable using a custom cell editor.
 ColumnBuilder makeEditable(CellEditor cellEditor, IValueFormatter valueFormatter)
          Makes the column cells editable using a custom cell editor.
 ColumnBuilder makeEditable(IValueFormatter valueFormatter)
          Makes this column editable.
 ColumnBuilder setCustomLabelProvider(CellLabelProvider customLabelProvider)
          If your column is not text based (for example a column with images that are owner-drawn), you can use a custom CellLabelProvider instead of a value and a value formatter.
 ColumnBuilder setPercentWidth(int width)
          Sets column width in percent
 ColumnBuilder setPixelWidth(int width)
          Sets column width in pixel
 ColumnBuilder sortBy(IValue sortBy)
          Sets a custom value to sort by.
 ColumnBuilder useAsDefaultSortColumn()
          Sets this column as default sort column
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

bindToProperty

public ColumnBuilder bindToProperty(java.lang.String propertyName)
Binds this column to the given property.


bindToValue

public ColumnBuilder bindToValue(IValue valueHandler)
Binds the column to an arbitrary value.


format

public ColumnBuilder format(IValueFormatter valueFormatter)
Sets a formatter for this column that is responsible to convert the value into a String. The 'parse' method of the CellFormatter is not required for this. See Formatter for commonly-used formatters.


format

public ColumnBuilder format(ICellFormatter cellFormatter)
A cell formatter allows to format the cell besides the textual value, for example to customize colors or set images.


setCustomLabelProvider

public ColumnBuilder setCustomLabelProvider(CellLabelProvider customLabelProvider)
If your column is not text based (for example a column with images that are owner-drawn), you can use a custom CellLabelProvider instead of a value and a value formatter.


setPercentWidth

public ColumnBuilder setPercentWidth(int width)
Sets column width in percent


setPixelWidth

public ColumnBuilder setPixelWidth(int width)
Sets column width in pixel


alignCenter

public ColumnBuilder alignCenter()
Sets alignment of column cell texts to be centered.


alignRight

public ColumnBuilder alignRight()
Sets alignment of column cell texts to be right-aligned.


makeEditable

public ColumnBuilder makeEditable()
Makes this column editable. Using this method you get a text editor without any formatting applied, to the value type needs to be String.


makeEditable

public ColumnBuilder makeEditable(IValueFormatter valueFormatter)
Makes this column editable. Using this method you get a text editor. The given valueFormatter will be responsible for formatting the value to a String and parsing it back to a new value.


makeEditable

public ColumnBuilder makeEditable(CellEditor cellEditor)
Makes the column cells editable using a custom cell editor. No formatting is applied, the editor will see the value as it is.


makeEditable

public ColumnBuilder makeEditable(CellEditor cellEditor,
                                  IValueFormatter valueFormatter)
Makes the column cells editable using a custom cell editor. The given valueFormatter will be responsible for formatting the value for the editor and converting it back to a new value.


sortBy

public ColumnBuilder sortBy(IValue sortBy)
Sets a custom value to sort by. Implement yourself our use PropertyValue to sort by a custom property value.


useAsDefaultSortColumn

public ColumnBuilder useAsDefaultSortColumn()
Sets this column as default sort column


build

public TableViewerColumn build()
Builds the column and returns the TableViewerColumn


Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis