Class ViewerRow

java.lang.Object
org.eclipse.jface.viewers.ViewerRow
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
TableViewerRow, TreeViewerRow

public abstract class ViewerRow extends Object implements Cloneable
ViewerRow is the abstract superclass of the part that represents items in a Table or Tree. Implementors of ColumnViewer have to provide a concrete implementation for the underlying widget
Since:
3.3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant denoting the row above the current one (value is 1).
    static final int
    Constant denoting the row below the current one (value is 2).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Object
     
    boolean
     
    abstract Color
    getBackground(int columnIndex)
    Get the background at the columnIndex,
    abstract Rectangle
    Return the bounds for the whole item.
    abstract Rectangle
    getBounds(int columnIndex)
    Get the bounds of the entry at the columnIndex,
    getCell(int column)
    Get a ViewerCell for the column at index.
    getCell(Point point)
    Get the ViewerCell at point.
    abstract int
    Return the number of columns for the receiver.
    int
    Get the columnIndex of the point.
    abstract Control
    Get the Control for the receiver.
    protected int
    getCreationIndex(int visualIndex)
    Translate the current column index (as shown in the UI) to the original one.
    abstract Object
     
    abstract Font
    getFont(int columnIndex)
    Get the font at the columnIndex.
    abstract Color
    getForeground(int columnIndex)
    Get the foreground at the columnIndex.
    abstract Image
    getImage(int columnIndex)
    Return the image at the columnIndex.
    getImageBounds(int index)
    Returns the location and bounds of the area where the image is drawn.
    abstract Widget
    Return the item for the receiver.
    abstract ViewerRow
    getNeighbor(int direction, boolean sameLevel)
    Returns a neighboring row, or null if no neighbor exists in the given direction.
    getStyleRanges(int columnIndex)
    Returns the style ranges to be applied on the text label at the column index or null if no style ranges have been set.
    abstract String
    getText(int columnIndex)
    Get the text at the columnIndex.
    getTextBounds(int index)
    The location and bounds of the area where the text is drawn depends on various things (image displayed, control with SWT.CHECK)
    abstract TreePath
    The tree path used to identify an element by the unique path
    protected int
    getVisualIndex(int creationIndex)
    Translate the original column index to the actual one.
    int
     
    protected boolean
    isColumnVisible(int columnIndex)
    Returns true if the column with the given index is visible
    protected boolean
    scrollCellIntoView(int columnIndex)
    Scrolls the cell at this index into view
    abstract void
    setBackground(int columnIndex, Color color)
    Set the background at the columnIndex.
    abstract void
    setFont(int columnIndex, Font font)
    Set the Font at the columnIndex.
    abstract void
    setForeground(int columnIndex, Color color)
    Set the foreground at the columnIndex.
    abstract void
    setImage(int columnIndex, Image image)
    Set the image at the columnIndex
    void
    setStyleRanges(int columnIndex, StyleRange[] styleRanges)
    Set the style ranges to be applied on the text label at the column index Note: Requires StyledCellLabelProvider with owner draw enabled.
    abstract void
    setText(int columnIndex, String text)
    Set the text at the columnIndex

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ViewerRow

      public ViewerRow()
  • Method Details

    • getBounds

      public abstract Rectangle getBounds(int columnIndex)
      Get the bounds of the entry at the columnIndex,
      Parameters:
      columnIndex - column index of interest
      Returns:
      Rectangle
    • getBounds

      public abstract Rectangle getBounds()
      Return the bounds for the whole item.
      Returns:
      Rectangle
    • getItem

      public abstract Widget getItem()
      Return the item for the receiver.
      Returns:
      Widget
    • getColumnCount

      public abstract int getColumnCount()
      Return the number of columns for the receiver.
      Returns:
      the number of columns
    • getImage

      public abstract Image getImage(int columnIndex)
      Return the image at the columnIndex.
      Parameters:
      columnIndex - column index of interest
      Returns:
      Image or null
    • setImage

      public abstract void setImage(int columnIndex, Image image)
      Set the image at the columnIndex
      Parameters:
      columnIndex - column index to set image for
      image - image to set
    • getText

      public abstract String getText(int columnIndex)
      Get the text at the columnIndex.
      Parameters:
      columnIndex - column index of interest
      Returns:
      String
    • setText

      public abstract void setText(int columnIndex, String text)
      Set the text at the columnIndex
      Parameters:
      columnIndex - column index to set text for
      text - text to set
    • getBackground

      public abstract Color getBackground(int columnIndex)
      Get the background at the columnIndex,
      Parameters:
      columnIndex - column index of interest
      Returns:
      Color or null
    • setBackground

      public abstract void setBackground(int columnIndex, Color color)
      Set the background at the columnIndex.
      Parameters:
      columnIndex - column index to set color for
      color - color to set
    • getForeground

      public abstract Color getForeground(int columnIndex)
      Get the foreground at the columnIndex.
      Parameters:
      columnIndex - column index of interest
      Returns:
      Color or null
    • setForeground

      public abstract void setForeground(int columnIndex, Color color)
      Set the foreground at the columnIndex.
      Parameters:
      columnIndex - column index to set color for
      color - color to set
    • getFont

      public abstract Font getFont(int columnIndex)
      Get the font at the columnIndex.
      Parameters:
      columnIndex - column index of interest
      Returns:
      Font or null
    • setFont

      public abstract void setFont(int columnIndex, Font font)
      Set the Font at the columnIndex.
      Parameters:
      columnIndex - column index to set font for
      font - font to set
    • getCell

      public ViewerCell getCell(Point point)
      Get the ViewerCell at point.
      Parameters:
      point - position to get cell for
      Returns:
      ViewerCell or null if the point is not in the bounds of a cell
    • getColumnIndex

      public int getColumnIndex(Point point)
      Get the columnIndex of the point.
      Parameters:
      point - position to get column index for
      Returns:
      int or -1 if it cannot be found.
    • getCell

      public ViewerCell getCell(int column)
      Get a ViewerCell for the column at index.
      Parameters:
      column - column index of interest
      Returns:
      ViewerCell or null if the index is negative.
    • getControl

      public abstract Control getControl()
      Get the Control for the receiver.
      Returns:
      Control
    • getNeighbor

      public abstract ViewerRow getNeighbor(int direction, boolean sameLevel)
      Returns a neighboring row, or null if no neighbor exists in the given direction. If sameLevel is true, only sibling rows (under the same parent) will be considered.
      Parameters:
      direction - the direction BELOW or ABOVE
      sameLevel - if true, search only within sibling rows
      Returns:
      the row above/below, or null if not found
    • getTreePath

      public abstract TreePath getTreePath()
      The tree path used to identify an element by the unique path
      Returns:
      the path
    • clone

      public abstract Object clone()
      Overrides:
      clone in class Object
    • getElement

      public abstract Object getElement()
      Returns:
      the model element
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getVisualIndex

      protected int getVisualIndex(int creationIndex)
      Translate the original column index to the actual one.

      Because of backwards API compatibility the default implementation returns the original index. Implementators of ColumnViewer should overwrite this method if their widget supports reordered columns

      Parameters:
      creationIndex - the original index
      Returns:
      the current index (as shown in the UI)
      Since:
      3.4
    • getCreationIndex

      protected int getCreationIndex(int visualIndex)
      Translate the current column index (as shown in the UI) to the original one.

      Because of backwards API compatibility the default implementation returns the original index. Implementators of ColumnViewer should overwrite this method if their widget supports reordered columns

      Parameters:
      visualIndex - the current index (as shown in the UI)
      Returns:
      the original index
      Since:
      3.4
    • getTextBounds

      public Rectangle getTextBounds(int index)
      The location and bounds of the area where the text is drawn depends on various things (image displayed, control with SWT.CHECK)
      Parameters:
      index - the column index
      Returns:
      the bounds of the of the text area. May return null if the underlying widget implementation doesn't provide this information
      Since:
      3.4
    • getImageBounds

      public Rectangle getImageBounds(int index)
      Returns the location and bounds of the area where the image is drawn.
      Parameters:
      index - the column index
      Returns:
      the bounds of the of the image area. May return null if the underlying widget implementation doesn't provide this information
      Since:
      3.4
    • setStyleRanges

      public void setStyleRanges(int columnIndex, StyleRange[] styleRanges)
      Set the style ranges to be applied on the text label at the column index Note: Requires StyledCellLabelProvider with owner draw enabled.
      Parameters:
      columnIndex - the index of the column
      styleRanges - the styled ranges
      Since:
      3.4
    • getStyleRanges

      public StyleRange[] getStyleRanges(int columnIndex)
      Returns the style ranges to be applied on the text label at the column index or null if no style ranges have been set.
      Parameters:
      columnIndex - the index of the column
      Returns:
      styleRanges the styled ranges
      Since:
      3.4
    • scrollCellIntoView

      protected boolean scrollCellIntoView(int columnIndex)
      Scrolls the cell at this index into view

      Because of backwards API compatibility the default implementation is a no-op. Implementators of ColumnViewer should overwrite this method if their widget supports reordered columns

      Parameters:
      columnIndex - the column index
      Returns:
      return true when the cell is scrolled into view
      Since:
      3.5
    • isColumnVisible

      protected boolean isColumnVisible(int columnIndex)
      Returns true if the column with the given index is visible
      Parameters:
      columnIndex - the column index
      Returns:
      true if the column is visible
      Since:
      3.5