Package org.eclipse.rap.rwt.template
Class Cell<T extends Cell>
java.lang.Object
org.eclipse.rap.rwt.template.Cell<T>
- All Implemented Interfaces:
- Serializable
Defines a region in a template. A cell can display a part of a connected data item. This part is
 selected by the bindingIndex.
 
For horizontal positioning, two of the the properties left, right, and width must be set. For vertical positioning, two properties out of top, bottom, and height are required.
- Since:
- 2.2
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionsetBackground(Color color) Sets the background color for this cell.setBindingIndex(int index) Sets the index that is used to select the part (e.g.setBottom(float percentage, int offset) Sets the position of the lower edge of the cell.setBottom(int offset) Sets the position of the lower edge of the cell.Sets the font for this cell.setForeground(Color color) Sets the foreground color for this cell.setHeight(int height) Sets the height of the cell.setHorizontalAlignment(int alignment) Defines how the content of this cell should be positioned horizontally.setLeft(float percentage, int offset) Sets the position of the left edge of the cell.setLeft(int offset) Sets the position of the left edge of the cell.Sets a name for this cell.setRight(float percentage, int offset) Sets the position of the right edge of the cell.setRight(int offset) Sets the position of the right edge of the cell.setSelectable(boolean selectable) Enables cell selection.setTop(float percentage, int offset) Sets the position of the upper edge of the cell.setTop(int offset) Sets the position of the upper edge of the cell.setVerticalAlignment(int alignment) Defines how the content of this cell should be positioned vertically.setWidth(int width) Sets the width of the cell.protected JsonObjecttoJson()Creates a JSON representation of this cell.
- 
Constructor Details- 
CellConstructs a new cell on the given template. Subclasses must provide a unique name.- Parameters:
- template- the template that this cell will be part of, must not be- null
- type- a unique type string to identify the cell type, must not be- nullor empty
 
 
- 
- 
Method Details- 
setNameSets a name for this cell. This name is used to identify the cell in a selection event. If the cell is selectable, a selection event will have its text attribute set to this name.- Returns:
- the cell itself, to enable method chaining
- See Also:
 
- 
setBindingIndexSets the index that is used to select the part (e.g. text/image) from the connected data item to be displayed by this cell. A value of-1indicates that the cell is not bound.- Parameters:
- index- the index of the part to display
- Returns:
- the cell itself, to enable method chaining
 
- 
setSelectableEnables cell selection. If set totrue, clicking this cell will not select the item but still trigger a selection event on the control. This selection event will have its detail field set toRWT.CELLand it's text field set to the name of this cell. The default isfalse.- Parameters:
- selectable-- trueto enable cell selection
- Returns:
- the cell itself, to enable method chaining
- See Also:
 
- 
setForegroundSets the foreground color for this cell. The connected data item may override this color. If the argument is null, the widget's default foreground color will be used.- Parameters:
- color- the foreground color, or- nullto use the default
- Returns:
- the cell itself, to enable method chaining
 
- 
setBackgroundSets the background color for this cell. The connected data item may override this color. If the argument is null, the widget's default color will be used.- Parameters:
- color- the background color, or- nullto use the default
- Returns:
- the cell itself, to enable method chaining
 
- 
setFontSets the font for this cell. The connected data item may override this font. If the argument is null, the widget's default font will be used.- Parameters:
- font- a font, or- nullto use the default
- Returns:
- the cell itself, to enable method chaining
 
- 
setLeftSets the position of the left edge of the cell.- Parameters:
- offset- the distance from the left edge of the template in px
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both right and width are already set
 
- 
setLeftSets the position of the left edge of the cell.- Parameters:
- percentage- the distance from the left edge of the template as a percentage of the template's width
- offset- a fixed offset in px to add to the percentage
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both right and width are already set
- Since:
- 2.3
 
- 
setRightSets the position of the right edge of the cell.- Parameters:
- offset- the distance from the right edge of the template in px
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both left and width are already set
 
- 
setRightSets the position of the right edge of the cell.- Parameters:
- percentage- the distance from the right edge of the template as a percentage of the template's width
- offset- a fixed offset in px to add to the percentage
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both left and width are already set
- Since:
- 2.3
 
- 
setTopSets the position of the upper edge of the cell.- Parameters:
- offset- the distance from the upper edge of the template in px
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both bottom and height are already set
 
- 
setTopSets the position of the upper edge of the cell.- Parameters:
- percentage- the distance from the right edge of the template as a percentage of the template's height
- offset- a fixed offset in px to add to the percentage
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both bottom and height are already set
- Since:
- 2.3
 
- 
setBottomSets the position of the lower edge of the cell.- Parameters:
- offset- the distance from the lower edge of the template in px
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both top and height are already set
 
- 
setBottomSets the position of the lower edge of the cell.- Parameters:
- percentage- the distance from the right edge of the template as a percentage of the template's height
- offset- a fixed offset in px to add to the percentage
- Returns:
- the cell itself, to enable method chaining
- Throws:
- IllegalStateException- if both top and height are already set
- Since:
- 2.3
 
- 
setWidthSets the width of the cell. A value ofSWT.DEFAULTresets the width.- Parameters:
- width- the width in px, must not be negative
- Returns:
- the cell itself, to enable method chaining
 
- 
setHeightSets the height of the cell. A value ofSWT.DEFAULTresets the height.- Parameters:
- height- the height in px, must not be negative
- Returns:
- the cell itself, to enable method chaining
 
- 
setHorizontalAlignmentDefines how the content of this cell should be positioned horizontally.- Parameters:
- alignment- the horizontal alignment, must be one of: SWT.BEGINNING (or SWT.LEFT), SWT.CENTER, SWT.END (or SWT.RIGHT)
- Returns:
- the cell itself, to enable method chaining
 
- 
setVerticalAlignmentDefines how the content of this cell should be positioned vertically.- Parameters:
- alignment- the horizontal alignment, must be one of: SWT.BEGINNING (or SWT.TOP), SWT.CENTER, SWT.END (or SWT.BOTTOM)
- Returns:
- the cell itself, to enable method chaining
 
- 
toJsonCreates a JSON representation of this cell. Subclasses can override this method, but must call super and add additional attributes like this:protected JsonObject toJson() { JsonObject json = super.toJson(); json.add( "foo", getFoo() ); ... return json; }- Returns:
- a json object that represents this cell
 
 
-