public abstract class Cell<T extends Cell>
extends java.lang.Object
implements java.io.Serializable
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.
Constructor and Description |
---|
Cell(Template template,
java.lang.String type)
Constructs a new cell on the given template.
|
Modifier and Type | Method and Description |
---|---|
T |
setBackground(Color color)
Sets the background color for this cell.
|
T |
setBindingIndex(int index)
Sets the index that is used to select the part (e.g.
|
T |
setBottom(float percentage,
int offset)
Sets the position of the lower edge of the cell.
|
T |
setBottom(int offset)
Sets the position of the lower edge of the cell.
|
T |
setFont(Font font)
Sets the font for this cell.
|
T |
setForeground(Color color)
Sets the foreground color for this cell.
|
T |
setHeight(int height)
Sets the height of the cell.
|
T |
setHorizontalAlignment(int alignment)
Defines how the content of this cell should be positioned horizontally.
|
T |
setLeft(float percentage,
int offset)
Sets the position of the left edge of the cell.
|
T |
setLeft(int offset)
Sets the position of the left edge of the cell.
|
T |
setName(java.lang.String name)
Sets a name for this cell.
|
T |
setRight(float percentage,
int offset)
Sets the position of the right edge of the cell.
|
T |
setRight(int offset)
Sets the position of the right edge of the cell.
|
T |
setSelectable(boolean selectable)
Enables cell selection.
|
T |
setTop(float percentage,
int offset)
Sets the position of the upper edge of the cell.
|
T |
setTop(int offset)
Sets the position of the upper edge of the cell.
|
T |
setVerticalAlignment(int alignment)
Defines how the content of this cell should be positioned vertically.
|
T |
setWidth(int width)
Sets the width of the cell.
|
protected JsonObject |
toJson()
Creates a JSON representation of this cell.
|
public Cell(Template template, java.lang.String type)
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 null
or
emptypublic T setName(java.lang.String name)
setSelectable(boolean)
,
Event.text
public T setBindingIndex(int index)
-1
indicates that the cell is not bound.index
- the index of the part to displaypublic T setSelectable(boolean selectable)
true
, 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 to RWT.CELL
and it's text field set to the name
of this cell. The default is false
.selectable
- true
to enable cell selectionsetName(String)
,
RWT.CELL
public T setForeground(Color color)
color
- the foreground color, or null
to use the defaultpublic T setBackground(Color color)
color
- the background color, or null
to use the defaultpublic T setFont(Font font)
font
- a font, or null
to use the defaultpublic T setLeft(int offset)
offset
- the distance from the left edge of the template in pxjava.lang.IllegalStateException
- if both right and width are already setpublic T setLeft(float percentage, int offset)
percentage
- the distance from the left edge of the template as a percentage of the
template's widthoffset
- a fixed offset in px to add to the percentagejava.lang.IllegalStateException
- if both right and width are already setpublic T setRight(int offset)
offset
- the distance from the right edge of the template in pxjava.lang.IllegalStateException
- if both left and width are already setpublic T setRight(float percentage, int offset)
percentage
- the distance from the right edge of the template as a percentage of the
template's widthoffset
- a fixed offset in px to add to the percentagejava.lang.IllegalStateException
- if both left and width are already setpublic T setTop(int offset)
offset
- the distance from the upper edge of the template in pxjava.lang.IllegalStateException
- if both bottom and height are already setpublic T setTop(float percentage, int offset)
percentage
- the distance from the right edge of the template as a percentage of the
template's heightoffset
- a fixed offset in px to add to the percentagejava.lang.IllegalStateException
- if both bottom and height are already setpublic T setBottom(int offset)
offset
- the distance from the lower edge of the template in pxjava.lang.IllegalStateException
- if both top and height are already setpublic T setBottom(float percentage, int offset)
percentage
- the distance from the right edge of the template as a percentage of the
template's heightoffset
- a fixed offset in px to add to the percentagejava.lang.IllegalStateException
- if both top and height are already setpublic T setWidth(int width)
SWT.DEFAULT
resets the width.width
- the width in px, must not be negativepublic T setHeight(int height)
SWT.DEFAULT
resets the height.height
- the height in px, must not be negativepublic T setHorizontalAlignment(int alignment)
alignment
- the horizontal alignment, must be one of: SWT.BEGINNING (or SWT.LEFT),
SWT.CENTER, SWT.END (or SWT.RIGHT)public T setVerticalAlignment(int alignment)
alignment
- the horizontal alignment, must be one of: SWT.BEGINNING (or SWT.TOP),
SWT.CENTER, SWT.END (or SWT.BOTTOM)protected JsonObject toJson()
protected JsonObject toJson() { JsonObject json = super.toJson(); json.add( "foo", getFoo() ); ... return json; }
Copyright (c) EclipseSource and others 2002, 2017.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0