Package org.eclipse.jface.viewers
Class ViewerCell
java.lang.Object
org.eclipse.jface.viewers.ViewerCell
The ViewerCell is the JFace representation of a cell entry in a ViewerRow.
- Since:
- 3.3
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant denoting the cell above current one (value is 1).static final int
Constant denoting the cell below current one (value is 2).static final int
Constant denoting the cell to the left of the current one (value is 4).static final int
Constant denoting the cell to the right of the current one (value is 8). -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the background color of the cell.Get the bounds of the cell.int
Get the index of the cell.Get the control for this cell.Get the element this row represents.getFont()
Gets the font of the cell.Gets the foreground color of the cell.getImage()
Return the Image for the cell.Returns the location and bounds of the area where the image is drawngetItem()
Return the item for the receiver.getNeighbor
(int directionMask, boolean sameLevel) Returns the specified neighbor of this cell, ornull
if no neighbor exists in the given direction.Returns the style ranges to be applied on the text label ornull
if no style ranges have been set.getText()
Return the text for the cell.The location and bounds of the area where the text is drawn depends on various things (image displayed, control with SWT.CHECK)int
Get the current index.int
hashCode()
boolean
Scroll the cell into viewvoid
setBackground
(Color background) Set the background color of the cell.void
Set the font of the cell.void
setForeground
(Color foreground) Set the foreground color of the cell.void
Set the Image for the cell.void
setStyleRanges
(StyleRange[] styleRanges) Set the style ranges to be applied on the text label Note: RequiresStyledCellLabelProvider
with owner draw enabled.void
Set the text for the cell.
-
Field Details
-
ABOVE
public static final int ABOVEConstant denoting the cell above current one (value is 1).- See Also:
-
BELOW
public static final int BELOWConstant denoting the cell below current one (value is 2).- See Also:
-
LEFT
public static final int LEFTConstant denoting the cell to the left of the current one (value is 4).- See Also:
-
RIGHT
public static final int RIGHTConstant denoting the cell to the right of the current one (value is 8).- See Also:
-
-
Method Details
-
getColumnIndex
public int getColumnIndex()Get the index of the cell.- Returns:
- the index
-
getBounds
Get the bounds of the cell.- Returns:
Rectangle
-
getElement
Get the element this row represents.- Returns:
Object
-
getText
Return the text for the cell.- Returns:
String
-
getImage
Return the Image for the cell.- Returns:
Image
ornull
-
setBackground
Set the background color of the cell.- Parameters:
background
- color to set
-
setForeground
Set the foreground color of the cell.- Parameters:
foreground
- color to set
-
setFont
Set the font of the cell.- Parameters:
font
- font to set
-
setText
Set the text for the cell.- Parameters:
text
- text to set
-
setImage
Set the Image for the cell.- Parameters:
image
- image to set
-
setStyleRanges
Set the style ranges to be applied on the text label Note: RequiresStyledCellLabelProvider
with owner draw enabled.- Parameters:
styleRanges
- the styled ranges- Since:
- 3.4
-
getStyleRanges
Returns the style ranges to be applied on the text label ornull
if no style ranges have been set.- Returns:
- styleRanges the styled ranges
- Since:
- 3.4
-
getItem
Return the item for the receiver.- Returns:
Item
-
getControl
Get the control for this cell.- Returns:
Control
-
getVisualIndex
public int getVisualIndex()Get the current index. This can be different from the original index when columns are reordered- Returns:
- the current index (as shown in the UI)
- Since:
- 3.4
-
getNeighbor
Returns the specified neighbor of this cell, ornull
if no neighbor exists in the given direction. Direction constants can be combined by bitwise OR; for example, this method will return the cell to the upper-left of the current cell by passingABOVE
|LEFT
. IfsameLevel
istrue
, only cells in sibling rows (under the same parent) will be considered.- Parameters:
directionMask
- the direction mask used to identify the requested neighbor cellsameLevel
- iftrue
, only consider cells from sibling rows- Returns:
- the requested neighbor cell, or
null
if not found
-
getViewerRow
- Returns:
- the row
-
getTextBounds
The location and bounds of the area where the text is drawn depends on various things (image displayed, control with SWT.CHECK)- 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
Returns the location and bounds of the area where the image is drawn- 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
-
getForeground
Gets the foreground color of the cell.- Returns:
- the foreground of the cell or
null
for the default foreground - Since:
- 3.4
-
getBackground
Gets the background color of the cell.- Returns:
- the background of the cell or
null
for the default background - Since:
- 3.4
-
getFont
Gets the font of the cell.- Returns:
- the font of the cell or
null
for the default font - Since:
- 3.4
-
hashCode
public int hashCode() -
equals
-
scrollIntoView
public boolean scrollIntoView()Scroll the cell into view- Returns:
- true if the cell was scrolled into view
- Since:
- 3.5
-