public class Cell extends java.lang.Object implements java.lang.Cloneable, java.io.Externalizable, RenderTextCallback, 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.drawing.TextFormat). Color of the text in
the cells is set via the setTextColor(java.awt.Color) method.
The appearance of a cell can be customized further via the setBrush(com.mindfusion.drawing.Brush),
setImage(java.awt.Image) 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.
|
java.awt.geom.Rectangle2D |
getEditRect(DiagramItem item,
java.awt.geom.Point2D mousePosition)
Implements InplaceEditable.getEditRect.
|
java.awt.Font |
getFont()
Gets the font used to draw the text of this cell.
|
java.lang.String |
getHyperLink()
Gets the hyperlink associated with the cell.
|
java.awt.Image |
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.
|
Thickness |
getImagePadding()
Gets the padding distance between cell's borders and Image.
|
java.lang.String |
getImageUrl()
Gets a URL used to load an image into this cell.
|
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.Object |
getTag()
Gets user-defined data assigned to this cell.
|
java.lang.String |
getText()
Gets the text that is displayed inside the cell.
|
java.awt.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's boundaries and its text.
|
java.awt.geom.Dimension2D |
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 mouse pointer rests for a while over the cell.
|
protected void |
loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Loads the cell from a JSON object.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context) |
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
void |
renderText(java.lang.String text,
java.awt.geom.Rectangle2D dest,
DrawTextHint hint)
Styled text rendering callback.
|
protected void |
saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Saves the cell as a JSON object.
|
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(java.awt.Font font)
Sets the font used to draw the text of this cell.
|
void |
setHyperLink(java.lang.String value)
Sets the hyperlink associated with the cell.
|
void |
setImage(java.awt.Image 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 |
setImagePadding(Thickness value)
Sets the padding distance between cell's borders and Image.
|
void |
setImageUrl(java.lang.String value)
Sets a URL used to load an image into this cell.
|
void |
setRowSpan(int value)
Sets the number of rows spanned by this cell.
|
void |
setTag(java.lang.Object value)
Assigns user-defined data to a cell.
|
void |
setText(java.lang.String value)
Sets the text that should be displayed inside the cell.
|
void |
setTextColor(java.awt.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's boundaries and its text.
|
void |
setToolTip(java.lang.String value)
Sets the tooltip text that should be displayed when
the mouse 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.ObjectCell 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 java.awt.Color getTextColor()
Color object representing the text color.public void setTextColor(java.awt.Color value)
value - A Color object representing the text color.public java.awt.geom.Dimension2D getTextSize()
public void renderText(java.lang.String text,
java.awt.geom.Rectangle2D dest,
DrawTextHint hint)
renderText in interface RenderTextCallbackpublic 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 java.lang.String getImageUrl()
String containing the URL.public void setImageUrl(java.lang.String value)
value - A String containing the URLpublic java.awt.Image getImage()
java.awt.Image object.public void setImage(java.awt.Image 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 InplaceEditablepublic void setEditedText(java.lang.String newText)
setEditedText in interface InplaceEditablenewText - The new text of this cell.public java.awt.geom.Rectangle2D getEditRect(DiagramItem item, java.awt.geom.Point2D mousePosition)
getEditRect in interface InplaceEditableitem - The TableNode whose cell's text will be edited.mousePosition - A Point2D 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.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected 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.TransformerExceptionprotected void saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
obj - A JsonObject instance to contain the serialized data.context - A JsonPersistContext object providing contextual information
about the serialization process and helper serialization methods.protected void loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
obj - A JsonObject containing the Cell data.context - A JsonPersistContext object providing contextual information about
the serialization process and helper serialization methods.public TableNode getTable()
public void setFont(java.awt.Font font)
font - A Font object representing the font
used to draw this cell's text.public java.awt.Font getFont()
Font object representing the font used
to draw this cell's text.public Thickness getTextPadding()
Thickness instance specifying the size of the padding space left around the text.public void setTextPadding(Thickness value)
value - A Thickness instance specifying the size of the padding space left around the text.public Thickness getImagePadding()
public void setImagePadding(Thickness value)
value - A Thickness value specifying padding distance.public java.lang.Object getTag()
Object.public void setTag(java.lang.Object value)
DiagramListener.serializeTag(com.mindfusion.diagramming.SerializeTagEvent) event.value - An Object containing custom data.