Package org.eclipse.jface.viewers
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 ofColumnViewerhave to provide a concrete implementation for the underlying widget- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description ViewerRow()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Objectclone()booleanequals(Object obj)abstract ColorgetBackground(int columnIndex)Get the background at the columnIndex,abstract RectanglegetBounds()Return the bounds for the whole item.abstract RectanglegetBounds(int columnIndex)Get the bounds of the entry at the columnIndex,ViewerCellgetCell(int column)Get a ViewerCell for the column at index.ViewerCellgetCell(Point point)Get the ViewerCell at point.abstract intgetColumnCount()Return the number of columns for the receiver.intgetColumnIndex(Point point)Get the columnIndex of the point.abstract ControlgetControl()Get the Control for the receiver.protected intgetCreationIndex(int visualIndex)Translate the current column index (as shown in the UI) to the original one.abstract ObjectgetElement()abstract FontgetFont(int columnIndex)Get the font at the columnIndex.abstract ColorgetForeground(int columnIndex)Get the foreground at the columnIndex.abstract ImagegetImage(int columnIndex)Return the image at the columnIndex.RectanglegetImageBounds(int index)Returns the location and bounds of the area where the image is drawn.abstract WidgetgetItem()Return the item for the receiver.abstract ViewerRowgetNeighbor(int direction, boolean sameLevel)Returns a neighboring row, ornullif no neighbor exists in the given direction.StyleRange[]getStyleRanges(int columnIndex)Returns the style ranges to be applied on the text label at the column index ornullif no style ranges have been set.abstract StringgetText(int columnIndex)Get the text at the columnIndex.RectanglegetTextBounds(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 TreePathgetTreePath()The tree path used to identify an element by the unique pathprotected intgetVisualIndex(int creationIndex)Translate the original column index to the actual one.inthashCode()protected booleanisColumnVisible(int columnIndex)Returnstrueif the column with the given index is visibleprotected booleanscrollCellIntoView(int columnIndex)Scrolls the cell at this index into viewabstract voidsetBackground(int columnIndex, Color color)Set the background at the columnIndex.abstract voidsetFont(int columnIndex, Font font)Set theFontat the columnIndex.abstract voidsetForeground(int columnIndex, Color color)Set the foreground at the columnIndex.abstract voidsetImage(int columnIndex, Image image)Set the image at the columnIndexvoidsetStyleRanges(int columnIndex, StyleRange[] styleRanges)Set the style ranges to be applied on the text label at the column index Note: RequiresStyledCellLabelProviderwith owner draw enabled.abstract voidsetText(int columnIndex, String text)Set the text at the columnIndex
-
-
-
Field Detail
-
ABOVE
public static final int ABOVE
Constant denoting the row above the current one (value is 1).- See Also:
getNeighbor(int, boolean), Constant Field Values
-
BELOW
public static final int BELOW
Constant denoting the row below the current one (value is 2).- See Also:
getNeighbor(int, boolean), Constant Field Values
-
-
Method Detail
-
getBounds
public abstract Rectangle getBounds(int columnIndex)
Get the bounds of the entry at the columnIndex,- Parameters:
columnIndex-- Returns:
Rectangle
-
getBounds
public abstract Rectangle getBounds()
Return the bounds for the whole item.- Returns:
Rectangle
-
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-- Returns:
Imageornull
-
setImage
public abstract void setImage(int columnIndex, Image image)Set the image at the columnIndex- Parameters:
columnIndex-image-
-
getText
public abstract String getText(int columnIndex)
Get the text at the columnIndex.- Parameters:
columnIndex-- Returns:
String
-
setText
public abstract void setText(int columnIndex, String text)Set the text at the columnIndex- Parameters:
columnIndex-text-
-
getBackground
public abstract Color getBackground(int columnIndex)
Get the background at the columnIndex,- Parameters:
columnIndex-- Returns:
Colorornull
-
setBackground
public abstract void setBackground(int columnIndex, Color color)Set the background at the columnIndex.- Parameters:
columnIndex-color-
-
getForeground
public abstract Color getForeground(int columnIndex)
Get the foreground at the columnIndex.- Parameters:
columnIndex-- Returns:
Colorornull
-
setForeground
public abstract void setForeground(int columnIndex, Color color)Set the foreground at the columnIndex.- Parameters:
columnIndex-color-
-
getFont
public abstract Font getFont(int columnIndex)
Get the font at the columnIndex.- Parameters:
columnIndex-- Returns:
Fontornull
-
setFont
public abstract void setFont(int columnIndex, Font font)Set theFontat the columnIndex.- Parameters:
columnIndex-font-
-
getCell
public ViewerCell getCell(Point point)
Get the ViewerCell at point.- Parameters:
point-- Returns:
ViewerCellornullif the point is not in the bounds of a cell
-
getColumnIndex
public int getColumnIndex(Point point)
Get the columnIndex of the point.- Parameters:
point-- 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-- Returns:
ViewerCellornullif the index is negative.
-
getNeighbor
public abstract ViewerRow getNeighbor(int direction, boolean sameLevel)
Returns a neighboring row, ornullif no neighbor exists in the given direction. IfsameLevelistrue, only sibling rows (under the same parent) will be considered.
-
getTreePath
public abstract TreePath getTreePath()
The tree path used to identify an element by the unique path- Returns:
- the path
-
getElement
public abstract Object getElement()
- Returns:
- the model element
-
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
ColumnViewershould 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
ColumnViewershould 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
nullif 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
nullif 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: RequiresStyledCellLabelProviderwith owner draw enabled.- Parameters:
columnIndex- the index of the columnstyleRanges- 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 ornullif 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 viewBecause of backwards API compatibility the default implementation is a no-op. Implementators of
ColumnViewershould overwrite this method if their widget supports reordered columns- Parameters:
columnIndex- the column index- Returns:
- return
truewhen the cell is scrolled into view - Since:
- 3.5
-
isColumnVisible
protected boolean isColumnVisible(int columnIndex)
Returnstrueif the column with the given index is visible- Parameters:
columnIndex- the column index- Returns:
trueif the column is visible- Since:
- 3.5
-
-