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(int offset)
Sets the bottom offset of the cell, i.e.
|
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, i.e.
|
T |
setHorizontalAlignment(int alignment)
Defines how the content of this cell should be positioned horizontally.
|
T |
setLeft(int offset)
Sets the left offset of the cell, i.e.
|
T |
setName(java.lang.String name)
Sets a name for this cell.
|
T |
setRight(int offset)
Sets the right offset of the cell, i.e.
|
T |
setSelectable(boolean selectable)
Enables cell selection.
|
T |
setTop(int offset)
Sets the top offset of the cell, i.e.
|
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, i.e.
|
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 left offset in pxjava.lang.IllegalStateException
- if both right and width are already setpublic T setRight(int offset)
offset
- the right offset in pxjava.lang.IllegalStateException
- if both left and width are already setpublic T setTop(int offset)
offset
- the top offset in pxjava.lang.IllegalStateException
- if both bottom and height are already setpublic T setBottom(int offset)
offset
- the bottom offset in pxjava.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 width.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, 2013.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0