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
FieldsModifier and TypeFieldDescriptionstatic final intConstant denoting the cell above current one (value is 1).static final intConstant denoting the cell below current one (value is 2).static final intConstant denoting the cell to the left of the current one (value is 4).static final intConstant denoting the cell to the right of the current one (value is 8). -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the background color of the cell.Get the bounds of the cell.intGet 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, ornullif no neighbor exists in the given direction.Returns the style ranges to be applied on the text label ornullif 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)intGet the current index.inthashCode()booleanScroll the cell into viewvoidsetBackground(Color background) Set the background color of the cell.voidSet the font of the cell.voidsetForeground(Color foreground) Set the foreground color of the cell.voidSet the Image for the cell.voidsetStyleRanges(StyleRange[] styleRanges) Set the style ranges to be applied on the text label Note: RequiresStyledCellLabelProviderwith owner draw enabled.voidSet 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:
Imageornull
-
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: RequiresStyledCellLabelProviderwith owner draw enabled.- Parameters:
styleRanges- the styled ranges- Since:
- 3.4
-
getStyleRanges
Returns the style ranges to be applied on the text label ornullif 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, ornullif 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. IfsameLevelistrue, 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
nullif 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
nullif 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
nullif 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
nullfor the default foreground - Since:
- 3.4
-
getBackground
Gets the background color of the cell.- Returns:
- the background of the cell or
nullfor the default background - Since:
- 3.4
-
getFont
Gets the font of the cell.- Returns:
- the font of the cell or
nullfor 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
-