public class Cell extends java.lang.Object implements java.lang.Cloneable, java.io.Externalizable, InplaceEditable
Cells are the building blocks of tables. They get their height and width
indirectly, from the width of table columns and the height of table rows as
set via the Column.setWidth(float)
and Row.setHeight(float)
methods. Cells
can be made to span several rows and columns by calling their setRowSpan(int)
and setColumnSpan(int)
methods.
A cell can display a text label, as set via the setText(java.lang.String)
method. The
text alignment is set by calling setTextFormat(com.mindfusion.diagramming.TextFormat)
. Color of the text in
the cells is set via the setTextColor(com.mindfusion.drawing.Color)
method.
The appearance of a cell can be customized further via the setBrush(com.mindfusion.drawing.Brush)
,
setImage(android.graphics.Bitmap)
and setImageAlign(com.mindfusion.diagramming.ImageAlign)
methods.
Constructor and Description |
---|
Cell()
Used internally to implement serialization functionality.
|
Cell(TableNode table)
Initializes a new Cell instance and assigns the
specified table as its parent.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a copy of the cell.
|
Brush |
getBrush()
Gets the
Brush used to fill the cell's interior. |
int |
getColumnSpan()
Gets the number of columns spanned by this cell.
|
android.graphics.RectF |
getEditRect(DiagramItem item,
android.graphics.PointF pointerPosition)
Implements InplaceEditable.getEditRect.
|
Font |
getFont() |
java.lang.String |
getHyperLink()
Gets the hyperlink associated with the cell.
|
android.graphics.Bitmap |
getImage()
Gets the image that is displayed inside the cell.
|
ImageAlign |
getImageAlign()
Gets a value indicating how the image displayed inside the cell
is aligned relatively to the cell bounds.
|
java.lang.String |
getPlainText()
Gets the plain text extracted from the formatted text
by removing the formatting tags.
|
int |
getRowSpan()
Gets the number of rows spanned by this cell.
|
TableNode |
getTable() |
java.lang.String |
getText()
Gets the text that is displayed inside the cell.
|
Color |
getTextColor()
Gets the color used to draw the text of this cell.
|
TextFormat |
getTextFormat()
Gets a
TextFormat object specifying how to format and align the text of this cell. |
Thickness |
getTextPadding()
Gets the spacing between the cell boundaries and its text.
|
Dimension |
getTextSize()
Gets the size of the text displayed in this cell.
|
java.lang.String |
getTextToEdit()
Implements InplaceEditable.getTextToEdit.
|
java.lang.String |
getToolTip()
Gets the tooltip text that is displayed when
the pointer rests for a while over the cell.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context) |
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
void |
renderText(java.lang.String text,
android.graphics.RectF dest,
com.mindfusion.diagramming.DrawTextHint hint)
Styled text rendering callback.
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context) |
void |
setBrush(Brush value)
Sets the
Brush used to fill the cell's interior. |
void |
setColumnSpan(int value)
Sets the number of columns spanned by this cell.
|
void |
setEditedText(java.lang.String newText)
Implements InplaceEditable.setEditedText.
|
void |
setFont(Font font) |
void |
setHyperLink(java.lang.String value)
Sets the hyperlink associated with the cell.
|
void |
setImage(android.graphics.Bitmap value)
Sets the image that should be displayed inside the cell.
|
void |
setImageAlign(ImageAlign value)
Sets a value indicating how the image displayed inside the cell
should be aligned relatively to the cell bounds.
|
void |
setRowSpan(int value)
Sets the number of rows spanned by this cell.
|
void |
setText(java.lang.String value)
Sets the text that should be displayed inside the cell.
|
void |
setTextColor(Color value)
Sets the color used to draw the text of this cell.
|
void |
setTextFormat(TextFormat value)
Sets a
TextFormat object specifying how to format and align the text of this cell. |
void |
setTextPadding(Thickness value)
Sets the spacing between the cell boundaries and its text.
|
void |
setToolTip(java.lang.String value)
Sets the tooltip text that should be displayed when
the pointer rests for a while over the cell.
|
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable.
|
public Cell(TableNode table)
table
- The TableNode
that contains this cell.public Cell()
public java.lang.Object clone()
clone
in class java.lang.Object
Cell
instance.public java.lang.String getText()
String
containing the cell's text.public void setText(java.lang.String value)
value
- A String
containing the cell's text.public java.lang.String getHyperLink()
String
containing the cell's hyperlink.public void setHyperLink(java.lang.String value)
value
- A String
containing the cell's hyperlink.public TextFormat getTextFormat()
TextFormat
object specifying how to format and align the text of this cell.TextFormat
object specifying the text format and alignment.public void setTextFormat(TextFormat value)
TextFormat
object specifying how to format and align the text of this cell.value
- A TextFormat
object specifying the text format and alignment.public Color getTextColor()
Color
object representing the text color.public void setTextColor(Color value)
value
- A Color
object representing the text color.public Dimension getTextSize()
public void renderText(java.lang.String text, android.graphics.RectF dest, com.mindfusion.diagramming.DrawTextHint hint)
public java.lang.String getPlainText()
String
containing the cell's text stripped from
formatting tags.public java.lang.String getToolTip()
String
containing the cell's tooltip.public void setToolTip(java.lang.String value)
value
- A String
containing the cell's tooltip.public android.graphics.Bitmap getImage()
java.awt.Image
object.public void setImage(android.graphics.Bitmap value)
value
- A java.awt.Image
object.public ImageAlign getImageAlign()
ImageAlign
enumeration.public void setImageAlign(ImageAlign value)
value
- A member of the ImageAlign
enumeration.public Brush getBrush()
Brush
used to fill the cell's interior.Brush
object.public void setBrush(Brush value)
Brush
used to fill the cell's interior.value
- A Brush
object.public java.lang.String getTextToEdit()
getTextToEdit
in interface InplaceEditable
public void setEditedText(java.lang.String newText)
setEditedText
in interface InplaceEditable
newText
- The new text of this cell.public android.graphics.RectF getEditRect(DiagramItem item, android.graphics.PointF pointerPosition)
getEditRect
in interface InplaceEditable
item
- The TableNode
whose cell's text will be edited.mousePosition
- A PointF instance specifying the current pointer position.public int getColumnSpan()
public void setColumnSpan(int value)
value
- An integer value specifying the number of spanned columns.public int getRowSpan()
public void setRowSpan(int value)
value
- An integer value specifying the number of spanned rows.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
protected void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public TableNode getTable()
public void setFont(Font font)
public Font getFont()
public Thickness getTextPadding()
Thickness
instance specifying the size of the padding space left around the text.