public class TableNode extends DiagramNode implements InplaceEditable
Links can link either to table rows or to the table as an integral node.
Use the setConnectionStyle(com.mindfusion.diagramming.TableConnectionStyle) method to specify whether links drawn
by the user should be connected to the table rows or to the table itself.
Tables consist of Cell instances distributed across rows and columns.
The number of rows and columns can be set via the setRowCount(int) and
setColumnCount(int) methods. The default width of the table columns is
specified through setColumnWidth(float) and the default height of the rows
through setRowHeight(float). Cells can be made to span several rows and
columns via their Cell.setRowSpan(int) and Cell.setColumnSpan(int) methods.
Rows can be assigned to distinct sections of the table. Each section can be
collapsed or expanded, hiding or showing all rows in the section except the
header one. To define a section, call the Row.setHeader(boolean) method. A
section consists of all rows after a header row and spans to the next header.
Each header row displays a +/- button that allows expanding or collapsing the
section interactively. The button appears either on the left of the first
cell of a header row or in a separate column, as specified through the
setOffsetHeaderRows(boolean) method. Sections can be collapsed or expanded
programmatically using the Row.setExpanded(boolean) method of their header rows.
The structure of a table can be changed dynamically by adding and deleting
rows and columns. This can be done with the addColumn() and addRow()
methods as well with the insertColumn(int), insertRow(int) and
redimTable(int, int) methods. Use the deleteRow(int) and deleteColumn(int)
methods to delete existing rows and columns.
Tables have a caption text, which is set via the setCaption(java.lang.String) method.
The height of the caption and the alignment of the text are specified via the
setCaptionHeight(float) and setCaptionFormat(com.mindfusion.diagramming.TextFormat) methods. To get even
richer text formatting, call setEnableStyledText(boolean) and embed HTML-like
formatting tags in the caption.
In order to set an image as tables background, call the setImage(android.graphics.Bitmap)
method. The alignment of the image in relation to the tables rectangle is
set via the setImageAlign(com.mindfusion.diagramming.ImageAlign) method. The table can be resized to fit
the size of its image by calling the resizeToFitImage() method.
Tow rows and columns of a table can be accessed through the getRows()
and getColumns() methods. The getCell(int, int) method lets you
access individual table cells.
allowIncomingLinks, allowOutgoingLinks, anchorPattern, AV_Cancel, AV_EndModIncoming, AV_EndModOutgoing, AV_StartModIncoming, AV_StartModOutgoing, AV_UpdateIncoming, AV_UpdateOutgoing, AV_UpdIntscIncoming, AV_UpdIntscOutgoing, AV_UpdPosIncoming, AV_UpdPosOutgoing, bounds, enabledHandles, handlesStyle, incomingLinks, masterGroup, obstacle, outgoingLinks, savedBoundsbrush, cycleDetected, cycleProtect, modifyDX, modifyDY, modifyHandle, modifying, pen, ptEnd, ptMdfLast, ptOrg, ptSavedEnd, ptSavedOrg, subordinateGroup| Constructor and Description |
|---|
TableNode()
Initializes a new instance of the TableNode class.
|
TableNode(Diagram parent)
Initializes a new instance of the TableNode class by setting is properties
to the default values set in the specified diagram.
|
TableNode(TableNode prototype)
Initializes a new instance of the TableNode class by copying the attributes
of the specified prototype table.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addColumn()
Appends a new column to this table.
|
DiagramLink |
addRelation(int row,
Relationship rel,
TableNode table,
int relRow)
Creates a new
DiagramLink related to this table. |
int |
addRow()
Adds a row to the table.
|
boolean |
cellFromPoint(android.graphics.PointF point,
android.graphics.Point cellPos)
Returns the row and column indices of the cell located at the
specified point, taking into consideration the cells span.
|
protected ConnectionPoint |
createConnectionPoint(DiagramLink link,
android.graphics.PointF pt,
boolean incoming) |
protected DiagramItemProperties |
createProperties()
DiagramItem.createProperties() override. |
void |
deleteColumn(int col)
Deletes the specified column.
|
void |
deleteRow(int row)
Deletes the specified row from the table.
|
protected void |
drawLocal(android.graphics.Canvas g,
RenderOptions options)
Override in a derived class to provide implementation specific drawing for the node.
|
protected void |
drawShadowLocal(android.graphics.Canvas g,
RenderOptions options)
DiagramItem#drawShadowLocal override. |
java.lang.String |
getCaption()
Gets the caption text of a table.
|
Brush |
getCaptionBrush()
Gets the brush used to draw the table's caption text.
|
TextFormat |
getCaptionFormat()
Gets a
TextFormat object specifying how to format and align the caption text. |
float |
getCaptionHeight()
Gets the height of the caption area of the table.
|
java.lang.String |
getCaptionPlainText()
Gets the plain text extracted from the formatted caption text
by removing the formatting tags.
|
Cell |
getCell(int column,
int row)
Gets the cell at the specified row and column.
|
CellFrameStyle |
getCellFrameStyle()
Gets the style of the cell frame lines.
|
Brush |
getCellTextBrush()
Gets the color used to draw the cells' text in this table.
|
int |
getColumnCount()
Gets the number of columns of this table.
|
ColumnList |
getColumns()
Gets a list of all columns in the table.
|
float |
getColumnWidth()
Gets the initial width of the columns of this table.
|
TableConnectionStyle |
getConnectionStyle()
Gets a value indicating whether links should connect to the
rows of this table or to the table as an integral entity.
|
int |
getCurrentRow()
Gets the index of the current scroll row.
|
android.graphics.RectF |
getEditRect(DiagramItem item,
android.graphics.PointF pointerPosition)
Implements InplaceEditable.getEditRect.
|
Brush |
getEffectiveCaptionBrush()
Creates a
Brush object representing the currently
effective caption brush of the table. |
Brush |
getEffectiveCellTextBrush()
Creates a
Brush object representing the currently
effective text brush of the table cells. |
boolean |
getEnableStyledText()
Gets a value indicating whether the text displayed inside a table
contains formatting tags which should be processed by JDiagram.
|
Font |
getFont()
Gets the font used to draw the text displayed in this table.
|
android.graphics.Bitmap |
getImage()
Gets the image displayed inside this table.
|
ImageAlign |
getImageAlign()
Gets the alignment of the table image relative
to the boundaries of the table.
|
boolean |
getOffsetHeaderRows()
Gets a value indicating whether the table cells are offset to the right
to accommodate for the expand buttons displayed inside header rows.
|
protected android.graphics.RectF |
getRepaintRect(boolean includeConnected)
Gets the repaint region for this item, taking into account
factors such as pen, selection handles and shadow.
|
AnchorPattern |
getRowAnchorPattern()
Gets the default row
AnchorPattern. |
int |
getRowCount()
Gets the number of rows of this table.
|
float |
getRowHeight()
Gets the initial height of the rows of this table.
|
RowList |
getRows()
Gets a list of all rows in the table.
|
boolean |
getScrollable()
Gets a value indicating whether users are allowed to scroll the table.
|
SimpleShape |
getShape()
Gets the shape of this table.
|
java.lang.String |
getTextToEdit()
Implements InplaceEditable.getTextToEdit.
|
com.mindfusion.diagramming.builders.TableNodeBuilder |
init()
Returns a TableNodeBuilder object used to configure this TableNode instance.
|
void |
insertColumn(int col)
Inserts a new column at the specified position.
|
void |
insertRow(int row)
Inserts a row in the table.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Loads the item content from an XML element.
|
protected void |
onChangeTextPadding() |
protected void |
onLoad(Diagram diagram)
|
protected void |
onUpdateBounds()
Invoked when the bounding rectangle of this node has changed.
|
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
void |
redimTable(int cols,
int rows)
Sets the number of rows and columns.
|
void |
renderText(java.lang.String text,
android.graphics.RectF dest,
com.mindfusion.diagramming.DrawTextHint hint) |
void |
resizeToFitImage()
Resizes a table so that it will be as big as the image displayed in the table.
|
void |
resizeToFitText(boolean ignoreCaption)
Resizes the columns and rows so that the cells are large enough to fit their text.
|
protected void |
restoreProperties(DiagramItemProperties props)
|
protected void |
saveProperties(DiagramItemProperties props)
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Saves the item content into an XML element.
|
protected void |
scaleElements(float scale)
DiagramNode.scaleElements override.
|
void |
setCaption(java.lang.String value)
Sets the caption text of a table.
|
void |
setCaptionBrush(Brush value)
Sets the brush used to draw the table's caption text.
|
void |
setCaptionFormat(TextFormat value)
Sets a
TextFormat object specifying how to format and align the caption text. |
void |
setCaptionHeight(float value)
Sets the height of the caption area of the table.
|
void |
setCellFrameStyle(CellFrameStyle value)
Sets the style of the cell frame lines.
|
void |
setCellTextBrush(Brush value)
Sets the color used to draw the text in this table.
|
void |
setColumnCount(int value)
Sets the number of columns of this table.
|
void |
setColumnWidth(float value)
Sets the initial width of the columns of this table.
|
void |
setConnectionStyle(TableConnectionStyle value)
Sets a value indicating whether links should connect to the
rows of this table or to the table as an integral entity.
|
void |
setCurrentRow(int value)
Scrolls the table to the specified row.
|
void |
setEditedText(java.lang.String newText)
Implements InplaceEditable.setEditedText.
|
void |
setEnableStyledText(boolean value)
Sets a value indicating whether the text displayed inside a table
contains formatting tags which should be processed by JDiagram.
|
void |
setFont(Font value)
Sets the font used to draw the text displayed in this table.
|
void |
setImage(android.graphics.Bitmap value)
Sets the image that should be displayed inside this table.
|
void |
setImageAlign(ImageAlign value)
Sets the alignment of the table image relative to the boundaries
of the table.
|
void |
setOffsetHeaderRows(boolean value)
Sets a value indicating whether the table cells should be offset to
the right to accommodate for the expand buttons displayed inside header rows.
|
protected void |
setReflexive(DiagramLink link)
Invoked to let a node set the shape of a reflexive link connected to it.
|
void |
setRowAnchorPattern(AnchorPattern value)
Sets the default row
AnchorPattern. |
void |
setRowCount(int value)
Sets the number of rows of this table.
|
void |
setRowHeight(float value)
Sets the initial height of the rows of this table.
|
void |
setScrollable(boolean value)
Sets a value indicating whether users are allowed to scroll the table.
|
void |
setShape(SimpleShape value)
Sets the shape of this table.
|
static com.mindfusion.diagramming.builders.TableNodeBuilder |
with()
Returns a TableNodeBuilder object used to configure and create new TableNode instances.
|
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable.
|
allowCreate, allowModify, allowModifyImpl, attachTo, attachTo, attachTo, cancelModify, completeCreate, completeModify, constraintsInfringed, containsPoint, containsPoint, createState, detach, draw, drawShadow, getAllIncomingLinks, getAllLinks, getAllOutgoingLinks, getAllowIncomingLinks, getAllowOutgoingLinks, getAnchorPattern, getBounds, getCenter, getConstraints, getEffects, getEnabledHandles, getExpandable, getExpanded, getHandlesStyle, getIncomingLinks, getLocalBounds, getLocalBoundsD, getLocalCenter, getMasterGroup, getObstacle, getOutgoingLinks, getRotatedBounds, getRotationAngle, groupContains, hitTestHandle, move, moveTo, nodesIntersect, onDragOut, onDragOver, onDropOver, onModify, onRemove, onRotationAngleChanged, parentConstraintsInfringed, putExpandable, rectFromPoints, resize, resizeToFitImage, restoreState, saveState, setAllowIncomingLinks, setAllowOutgoingLinks, setAnchorPattern, setBounds, setBounds, setBounds, setBoundsDirect, setConstraints, setEnabledHandles, setExpandable, setExpanded, setExpandedFlag, setHandlesStyle, setObstacle, setRotationAngle, shouldRenderAnchors, startCreate, startModify, updateCreate, updateLinkPositions, updateModifyclone, getBrush, getEffectiveBrush, getEffectiveFont, getEffectivePen, getEffectiveShadowBrush, getEffectiveTextBrush, getHyperLink, getId, getIgnoreLayout, getLayerIndex, getLayoutTraits, getLocked, getMeasureUnit, getParent, getPen, getPrintable, getRuntimeIndex, getSelected, getShadowBrush, getShadowOffsetX, getShadowOffsetY, getStyle, getSubordinateGroup, getTag, getTextBrush, getTextPadding, getToolTip, getValue, getVisible, getWeight, getZIndex, hasSubordinates, onAdd, onChangeFont, onChildModified, onClick, onDoubleClick, onMeasureUnitChanged, onStyleChanged, putSelected, query, repaint, repaint, repaint, setBrush, setDiagramDirty, setHyperLink, setId, setIgnoreLayout, setLayerIndex, setLocked, setPen, setPrintable, setSelected, setShadowBrush, setShadowOffsetX, setShadowOffsetY, setStyle, setTag, setTextBrush, setTextPadding, setToolTip, setVisible, setWeight, setZIndex, shouldRender, zBottom, zLevelDown, zLevelUp, zToppublic TableNode()
public TableNode(Diagram parent)
parent - A Diagram instance whose default table
attributes are copied to this table.public static com.mindfusion.diagramming.builders.TableNodeBuilder with()
TableNodeBuilder instance.public com.mindfusion.diagramming.builders.TableNodeBuilder init()
TableNodeBuilder instance.public Cell getCell(int column, int row)
column - An integer value specifying the column index.row - An integer value specifying the row index.Cell object representing the specified cell.public RowList getRows()
RowList containing the table rows.public ColumnList getColumns()
ColumnList containing the table columns.public int getCurrentRow()
public void setCurrentRow(int value)
value - An integer value specifying the index of the row that
should be scrolled to the top of the table.public boolean getOffsetHeaderRows()
true if table cells are offset to the right,
otherwise false.public void setOffsetHeaderRows(boolean value)
value - true if table cells should be offset
to the right, otherwise false.public boolean getScrollable()
true if users are allowed to scroll the table,
otherwise false.public void setScrollable(boolean value)
value - true if users are allowed to scroll
the table, otherwise false.public java.lang.String getCaptionPlainText()
String containing the caption text
stripped from any formatting tags.public Font getFont()
getFont in class DiagramItemFont object representing the table font.public void setFont(Font value)
setFont in class DiagramItemvalue - A Font object representing the table font.protected void onChangeTextPadding()
onChangeTextPadding in class DiagramItempublic boolean getEnableStyledText()
true if JDiagram should process formatting tags
when rendering text in this table, otherwise false.public void setEnableStyledText(boolean value)
value - true if JDiagram should process formatting tags
when rendering text in this table, otherwise false.public void renderText(java.lang.String text,
android.graphics.RectF dest,
com.mindfusion.diagramming.DrawTextHint hint)
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 java.lang.String getCaption()
String object containing the caption text.public void setCaption(java.lang.String value)
value - A String object containing the caption text.public Brush getCaptionBrush()
Brush object representing the color of the caption text.public void setCaptionBrush(Brush value)
value - A Brush object representing the color of the caption text.public Brush getEffectiveCaptionBrush()
Brush object representing the currently
effective caption brush of the table.
This method returns a system brush corresponding to the table's
CaptionBrush if the table's
CaptionBrush is not null,
or a system brush corresponding to the
TextBrush
property of the table's style.public TextFormat getCaptionFormat()
TextFormat object specifying how to format and align the caption text.TextFormat object specifying the caption format and alignment.public void setCaptionFormat(TextFormat value)
TextFormat object specifying how to format and align the caption text.value - A TextFormat object specifying the caption format and alignment.public float getCaptionHeight()
public void setCaptionHeight(float value)
value - A float value specifying the height of the table caption area.public int getColumnCount()
public void setColumnCount(int value)
value - An integer value specifying the number of columns in this table.public int getRowCount()
public void setRowCount(int value)
value - An integer value specifying the number of rows in this table.public CellFrameStyle getCellFrameStyle()
CellFrameStyle enumeration.public void setCellFrameStyle(CellFrameStyle value)
value - A member of the CellFrameStyle enumeration.public float getColumnWidth()
public void setColumnWidth(float value)
value - A float value specifying the initial width of columns
added to this table.public float getRowHeight()
public void setRowHeight(float value)
value - A float value specifying the initial height of rows
added to this table.public DiagramLink addRelation(int row, Relationship rel, TableNode table, int relRow)
DiagramLink related to this table.row - Index of a row in this table.rel - A member of the Relationship enumeration.table - The related table.relRow - Index of a row in the related table.DiagramLink object representing the new link.public void resizeToFitImage()
public void resizeToFitText(boolean ignoreCaption)
ignoreCaption - false if the caption bar should be resized too
to fit the caption text; otherwise true.public int addRow()
public void insertRow(int row)
row - The position where the new row should be inserted.public void deleteRow(int row)
row - Index of the row that should be deleted.public int addColumn()
public void insertColumn(int col)
col - The position where the new column must be inserted.public void deleteColumn(int col)
col - Index of the column that must be deleted.public void redimTable(int cols,
int rows)
cols - The new number of columns.rows - The new number of rows.protected void onUpdateBounds()
DiagramNodeonUpdateBounds in class DiagramNodepublic Brush getCellTextBrush()
Brush object representing the text color.public void setCellTextBrush(Brush value)
value - A Brush object representing the text color.public Brush getEffectiveCellTextBrush()
Brush object representing the currently
effective text brush of the table cells.
This method returns a system brush corresponding to the table's
CellTextBrush if the table's
CellTextBrush is not null,
or a system brush corresponding to the
CellTextBrush property
of the table's style.protected void drawLocal(android.graphics.Canvas g,
RenderOptions options)
DiagramNodedrawLocal in class DiagramNodeg - The Canvas surface to draw the node on.options - Provides options for the drawing operation.protected void drawShadowLocal(android.graphics.Canvas g,
RenderOptions options)
DiagramItem#drawShadowLocal override.drawShadowLocal in class DiagramNodeg - The Canvas object where the shadow should be rendered.options - Provides options for the drawing operation.protected ConnectionPoint createConnectionPoint(DiagramLink link, android.graphics.PointF pt, boolean incoming)
createConnectionPoint in class DiagramNodeprotected android.graphics.RectF getRepaintRect(boolean includeConnected)
DiagramItemgetRepaintRect in class DiagramNodeincludeConnected - true if related items should be considered too; otherwise, false.protected void scaleElements(float scale)
scaleElements in class DiagramNodescale - The value by which to multiply node elements' sizes.protected void setReflexive(DiagramLink link)
setReflexive in class DiagramNodelink - Reference to the link.public boolean cellFromPoint(android.graphics.PointF point,
android.graphics.Point cellPos)
point - The point to check.cellPos - Receives the row and column indices if a cell is found at the specified position.public java.lang.String getTextToEdit()
getTextToEdit in interface InplaceEditablepublic void setEditedText(java.lang.String newText)
setEditedText in interface InplaceEditablenewText - The new text of the table's caption.public android.graphics.RectF getEditRect(DiagramItem item, android.graphics.PointF pointerPosition)
getEditRect in interface InplaceEditableitem - A reference to this node.mousePosition - A PointF instance specifying the current pointer position.public SimpleShape getShape()
SimpleShape enumeration.public void setShape(SimpleShape value)
value - A member of the SimpleShape enumeration.public AnchorPattern getRowAnchorPattern()
AnchorPattern.AnchorPattern object representing the set of anchor
points used when connecting links to the rows of this table.public void setRowAnchorPattern(AnchorPattern value)
AnchorPattern. A link is aligned to
the points of this pattern if the row the link connects to doesn't
have an AnchorPattern defined for it.value - An AnchorPattern object representing the set of anchor
points used when connecting links to the rows of this table.public TableConnectionStyle getConnectionStyle()
TableConnectionStyle enumeration.public void setConnectionStyle(TableConnectionStyle value)
value - A member of the TableConnectionStyle enumeration.protected DiagramItemProperties createProperties()
DiagramItem.createProperties() override.createProperties in class DiagramNodeprotected void saveProperties(DiagramItemProperties props)
saveProperties in class DiagramNodeprops - A DiagramItemProperties-derived object where
the item's properties should be saved.protected void restoreProperties(DiagramItemProperties props)
restoreProperties in class DiagramNodeprops - A DiagramItemProperties -derived object containing a
snapshot of the item's properties.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class DiagramNodejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class DiagramNodejava.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected void onLoad(Diagram diagram)
onLoad in class DiagramItemprotected void saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
DiagramItemsaveToXml in class DiagramNodexmlElement - An Element the item's data should be stored into.context - An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.protected void loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
throws javax.xml.transform.TransformerException,
XmlException
DiagramItemloadFromXml in class DiagramNodexmlElement - An XmlElement containing the item's data.context - An XmlPersistContext object providing contextual
information about the serialization process and some helper serialization methodsjavax.xml.transform.TransformerExceptionXmlException