Class Column<T,V,R extends IColumn<T,V,R>>

java.lang.Object
com.amalgamasimulation.desktop.ui.columndescriptors.Column<T,V,R>
All Implemented Interfaces:
IColumn<T,V,R>
Direct Known Subclasses:
EditableColumn

public abstract class Column<T,V,R extends IColumn<T,V,R>> extends Object implements IColumn<T,V,R>
Class that implements a set of functions for displaying data
Author:
Ionov Ivan
  • Field Details

    • columnViewer

      protected org.eclipse.jface.viewers.ColumnViewer columnViewer
    • parent

      protected org.eclipse.swt.widgets.Composite parent
    • viewerColumn

      protected org.eclipse.jface.viewers.ViewerColumn viewerColumn
    • name

      protected String name
    • width

      protected int width
    • toolTipText

      protected String toolTipText
    • labelForNullValue

      protected String labelForNullValue
    • valueExtractor

      protected Function<T,V> valueExtractor
    • iconExtractor

      protected BiFunction<T,V,org.eclipse.swt.graphics.Image> iconExtractor
    • backgroundColorExtractor

      protected BiFunction<T,V,Accumulator<Color>> backgroundColorExtractor
    • fontColorExtractor

      protected BiFunction<T,V,Color> fontColorExtractor
    • pseudoHistogramColorExtractor

      protected BiFunction<T,V,Color> pseudoHistogramColorExtractor
    • fontExtractor

      protected BiFunction<T,V,org.eclipse.swt.graphics.Font> fontExtractor
    • formatValue

      protected BiFunction<T,V,String> formatValue
    • comparator

      protected Comparator<T> comparator
    • contextMenuHanlers

      protected List<Column.ContextMenuHandler<T,V>> contextMenuHanlers
    • doubleClickHandler

      protected BiConsumer<T,org.eclipse.swt.widgets.Event> doubleClickHandler
    • visibility

      protected BooleanSupplier visibility
  • Constructor Details

    • Column

      protected Column(Class<R> cl, org.eclipse.jface.viewers.ColumnViewer columnViewer, org.eclipse.swt.widgets.Composite parent, Function<T,V> valueExtractor)
  • Method Details

    • getValueExtractor

      public Function<T,V> getValueExtractor()
      Description copied from interface: IColumn
      Returns a function that extracts a value from a row value for a column
      Specified by:
      getValueExtractor in interface IColumn<T,V,R extends IColumn<T,V,R>>
    • getColumnViewer

      public org.eclipse.jface.viewers.ColumnViewer getColumnViewer()
      Description copied from interface: IColumn
      Returns a ColumnViewer
      Specified by:
      getColumnViewer in interface IColumn<T,V,R extends IColumn<T,V,R>>
    • getParent

      public org.eclipse.swt.widgets.Composite getParent()
      Description copied from interface: IColumn
      Returns a parent Composite
      Specified by:
      getParent in interface IColumn<T,V,R extends IColumn<T,V,R>>
    • setViewerColumn

      public void setViewerColumn(org.eclipse.jface.viewers.ViewerColumn viewerColumn)
      Description copied from interface: IColumn
      Set the new ViewerColumn to the column
      Specified by:
      setViewerColumn in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      viewerColumn - new ViewerColumn
    • getName

      public String getName()
      Description copied from interface: IColumn
      Returns the column name
      Specified by:
      getName in interface IColumn<T,V,R extends IColumn<T,V,R>>
    • getWidth

      public int getWidth()
      Description copied from interface: IColumn
      Returns the column width
      Specified by:
      getWidth in interface IColumn<T,V,R extends IColumn<T,V,R>>
    • getThis

      protected R getThis()
    • addContextMenuHandler

      public R addContextMenuHandler(Column.ContextMenuHandler<T,V> handler)
      Description copied from interface: IColumn
      Adds a new ContextMenuHandler to the list handlers
      Specified by:
      addContextMenuHandler in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      handler - Provides an API for creating a pop-up menu item for a column
      Returns:
      this column
    • removeContextMenuHandler

      public R removeContextMenuHandler(Column.ContextMenuHandler<T,V> handler)
      Description copied from interface: IColumn
      Removes a previously added ContextMenuHandler from the list handlers
      Specified by:
      removeContextMenuHandler in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      handler - Provides an API for creating a pop-up menu item for a column
      Returns:
      this column
    • getContextMenuHandlers

      public List<Column.ContextMenuHandler<T,V>> getContextMenuHandlers()
      Description copied from interface: IColumn
      Returns a list context menu handlers
      Specified by:
      getContextMenuHandlers in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      list of ContextMenuHandler
    • setDoubleClickHandler

      public R setDoubleClickHandler(BiConsumer<T,org.eclipse.swt.widgets.Event> doubleClickHandler)
      Description copied from interface: IColumn
      Set the double click handler
      Specified by:
      setDoubleClickHandler in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      doubleClickHandler - Provides API for handling double click on a column
      Returns:
      this column
    • removeDoubleClickHandler

      public R removeDoubleClickHandler()
      Description copied from interface: IColumn
      Remove the doubleClickHandler
      Specified by:
      removeDoubleClickHandler in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      this column
    • getDoubleClickHandler

      public BiConsumer<T,org.eclipse.swt.widgets.Event> getDoubleClickHandler()
      Description copied from interface: IColumn
      Return the doubleClickHandler
      Specified by:
      getDoubleClickHandler in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      doubleClickHandler
    • visible

      public R visible(BooleanSupplier visibility)
      Description copied from interface: IColumn
      Set the visibility function
      Specified by:
      visible in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      visibility - Provides an API to control column visibility
    • isVisible

      public boolean isVisible()
      Description copied from interface: IColumn
      Return boolean value.
      Specified by:
      isVisible in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      boolean
    • getToolTipText

      public String getToolTipText()
      Description copied from interface: IColumn
      Returns the tool tip for this column.
      Specified by:
      getToolTipText in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      string tool tip for this column
    • getBackgroundColor

      public BiFunction<T,V,Accumulator<Color>> getBackgroundColor()
      Description copied from interface: IColumn
      Returns a function to get the color for the background
      Specified by:
      getBackgroundColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      function to get the color for the background
    • backgroundColor

      public R backgroundColor(Color color)
      Description copied from interface: IColumn
      Set color for the background
      Specified by:
      backgroundColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      color - for the background
      Returns:
      this column
    • backgroundColor

      public R backgroundColor(Function<T,Color> colorExtractor)
      Description copied from interface: IColumn
      Set function to get the color for the background
      Specified by:
      backgroundColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExtractor - function to get the color for the background
      Returns:
      this column
    • backgroundColor

      public R backgroundColor(BiFunction<T,V,Accumulator<Color>> colorExtractor)
      Description copied from interface: IColumn
      Set function to get the color for the background
      Specified by:
      backgroundColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExtractor - function to get the color for the background
      Returns:
      this column
    • getFontColor

      public BiFunction<T,V,Color> getFontColor()
      Description copied from interface: IColumn
      Returns a function to get the color for the font
      Specified by:
      getFontColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      color for the font
    • fontColor

      public R fontColor(Color color)
      Description copied from interface: IColumn
      Set color for the font
      Specified by:
      fontColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      color - for the font
      Returns:
      this column
    • fontColor

      public R fontColor(Function<T,Color> colorExractor)
      Description copied from interface: IColumn
      Set function to get the color for the font
      Specified by:
      fontColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExractor - function to get the color for the font
      Returns:
      this column
    • fontColor

      public R fontColor(BiFunction<T,V,Color> colorExractor)
      Description copied from interface: IColumn
      Set function to get the color for the font
      Specified by:
      fontColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExractor - function to get the color for the font
      Returns:
      this column
    • getFont

      public BiFunction<T,V,org.eclipse.swt.graphics.Font> getFont()
      Description copied from interface: IColumn
      Returns a function to get the font for the column
      Specified by:
      getFont in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      function to get the font for the column
    • font

      public R font(org.eclipse.swt.graphics.Font font)
      Description copied from interface: IColumn
      Set font for the column
      Specified by:
      font in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      font - for the column
      Returns:
      this column
    • font

      public R font(Function<T,org.eclipse.swt.graphics.Font> font)
      Description copied from interface: IColumn
      Set function to get the font for the column
      Specified by:
      font in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      font - function to get the font for the column
      Returns:
      this column
    • font

      public R font(BiFunction<T,V,org.eclipse.swt.graphics.Font> font)
      Description copied from interface: IColumn
      Set function to get the font for the column
      Specified by:
      font in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      font - function to get the font for the column
      Returns:
      this column
    • getPseudoHistogramColor

      public BiFunction<T,V,Color> getPseudoHistogramColor()
      Description copied from interface: IColumn
      Returns a function to get the color for the pseudoHistogram
      Specified by:
      getPseudoHistogramColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      function to get the color for the pseudoHistogram
    • pseudoHistogramColor

      public R pseudoHistogramColor(Color colorExtractor)
      Description copied from interface: IColumn
      Set color for the pseudoHistogram
      Specified by:
      pseudoHistogramColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExtractor - for the pseudoHistogram
      Returns:
      this column
    • pseudoHistogramColor

      public R pseudoHistogramColor(Function<T,Color> colorExtractor)
      Description copied from interface: IColumn
      Set function to get the color for the pseudoHistogram
      Specified by:
      pseudoHistogramColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExtractor - function to get the color for the pseudoHistogram
      Returns:
      this column
    • pseudoHistogramColor

      public R pseudoHistogramColor(BiFunction<T,V,Color> colorExtractor)
      Description copied from interface: IColumn
      Set function to get the color for the pseudoHistogram
      Specified by:
      pseudoHistogramColor in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      colorExtractor - function to get the color for the pseudoHistogram
      Returns:
      this column
    • comparator

      public R comparator(Comparator<T> comparator)
      Description copied from interface: IColumn
      Add a comparator that is used to sort values in this column
      Specified by:
      comparator in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      this column
    • getComparator

      public Comparator<T> getComparator()
      Description copied from interface: IColumn
      Return comparator in this column
      Specified by:
      getComparator in interface IColumn<T,V,R extends IColumn<T,V,R>>
    • getFormat

      public BiFunction<T,V,String> getFormat()
      Description copied from interface: IColumn
      Returns a function to get the "label" for the cell
      Specified by:
      getFormat in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      function to get the "label" for the cell
    • format

      public R format(String format)
      Description copied from interface: IColumn
      Set "label" for the cell
      Specified by:
      format in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      this column
    • format

      public R format(Function<V,String> format)
      Description copied from interface: IColumn
      Set function to get the "label" for the cell
      Specified by:
      format in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      format - function to get the font for the cell
      Returns:
      this column
    • format

      public R format(BiFunction<T,V,String> format)
      Description copied from interface: IColumn
      Set function to get the "label" for the cell
      Specified by:
      format in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      format - function to get the font for the cell
      Returns:
      this column
    • nullValueText

      public R nullValueText(String labelForNullValue)
      Description copied from interface: IColumn
      Set nullValueText will be used as a cell label if it equal null
      Specified by:
      nullValueText in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      labelForNullValue - String will be used as a cell label if it equal null
      Returns:
      this column
    • getNullValueText

      public String getNullValueText()
      Description copied from interface: IColumn
      String will be used as a cell label if it equal null
      Specified by:
      getNullValueText in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      nullValueText String will be used as a cell label if it equal null
    • getIcon

      public BiFunction<T,V,org.eclipse.swt.graphics.Image> getIcon()
      Description copied from interface: IColumn
      Returns a function to get the icon for the cell
      Specified by:
      getIcon in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      function to get the icon for the cell
    • icon

      public R icon(org.eclipse.swt.graphics.Image icon)
      Description copied from interface: IColumn
      Set icon for the cell
      Specified by:
      icon in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Returns:
      this column
    • icon

      public R icon(Function<T,org.eclipse.swt.graphics.Image> iconExtractor)
      Description copied from interface: IColumn
      Set function to get the icon for the cell
      Specified by:
      icon in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      iconExtractor - function to get the icon for the cell
      Returns:
      this column
    • icon

      public R icon(BiFunction<T,V,org.eclipse.swt.graphics.Image> iconExtractor)
      Description copied from interface: IColumn
      Set function to get the icon for the cell
      Specified by:
      icon in interface IColumn<T,V,R extends IColumn<T,V,R>>
      Parameters:
      iconExtractor - function to get the icon for the cell
      Returns:
      this column
    • initLabelProvider

      protected void initLabelProvider()