|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mindfusion.diagramming.DiagramItem com.mindfusion.diagramming.DiagramNode com.mindfusion.diagramming.TableNode
public class TableNode
Tables are diagram nodes that can contain multiple cells and can be related to other nodes through their rows.
Links can link either to table rows or to the table as an integral node.
Use the setConnectionStyle(int)
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 +/- mouseButton that allows expanding or collapsing the
section interactively. The mouseButton 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(java.awt.Image)
method. The alignment of the image in relation to the tables rectangle is
set via the setImageAlign(int)
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.
Field Summary |
---|
Fields inherited from class com.mindfusion.diagramming.DiagramNode |
---|
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, savedBounds |
Fields inherited from class com.mindfusion.diagramming.DiagramItem |
---|
brush, cycleDetected, cycleProtect, font, hyperLink, ignoreLayout, locked, modifyDX, modifyDY, modifyHandle, modifying, pen, printable, ptEnd, ptMdfLast, ptOrg, ptSavedEnd, ptSavedOrg, selected, shadowColor, shadowOffsetX, shadowOffsetY, subordinateGroup, tag, toolTip, visible, zIndex |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
int |
addColumn()
Appends a new column to this table. |
DiagramLink |
addRelation(int row,
int rel,
TableNode table,
int relRow)
Creates a new DiagramLink related to this table. |
int |
addRow()
Adds a row to the table. |
boolean |
cellFromPoint(java.awt.geom.Point2D point,
java.awt.Point cellPos)
Returns the row and column indices of the cell located at the specified point, taking into consideration the cells span. |
protected com.mindfusion.diagramming.ConnectionPoint |
createConnectionPoint(DiagramLink link,
java.awt.geom.Point2D 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 |
draw(java.awt.Graphics2D g,
RenderOptions options)
|
protected void |
drawShadow(java.awt.Graphics2D g,
RenderOptions options)
|
java.lang.String |
getCaption()
Gets the caption text of a table. |
java.awt.Color |
getCaptionColor()
Gets the color of the 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. |
int |
getCellFrameStyle()
Gets the style of the cell frame lines. |
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. |
int |
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. |
java.awt.geom.Rectangle2D |
getEditRect(java.awt.geom.Point2D mousePosition)
|
boolean |
getEnableStyledText()
Gets a value indicating whether the text displayed inside a table contains formatting tags which should be processed by JDiagram. |
java.awt.Font |
getFont()
Gets the font used to draw the text displayed in this table. |
java.awt.Image |
getImage()
Gets the image displayed inside this table. |
int |
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. |
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. |
int |
getStyle()
Gets the shape of this table. |
java.awt.Color |
getTextColor()
Gets the color used to draw the cells' text in this table. |
java.lang.String |
getTextToEdit()
|
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 |
onUpdateBounds()
Invoked when the bounding rectangle of the 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,
java.awt.geom.Rectangle2D 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)
DiagramItem.restoreProperties(com.mindfusion.diagramming.DiagramItemProperties) override. |
protected void |
saveProperties(DiagramItemProperties props)
DiagramItem.saveProperties(com.mindfusion.diagramming.DiagramItemProperties) override. |
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Saves the item content into an XML element. |
void |
setCaption(java.lang.String value)
Sets the caption text of a table. |
void |
setCaptionColor(java.awt.Color value)
Sets the color of the 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(int value)
Sets the style of the cell frame lines. |
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(int 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)
|
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(java.awt.Font value)
Sets the font used to draw the text displayed in this table. |
void |
setImage(java.awt.Image value)
Sets the image that should be displayed inside this table. |
void |
setImageAlign(int 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 |
setStyle(int value)
Sets the shape of this table. |
void |
setTextColor(java.awt.Color value)
Sets the color used to draw the text in this table. |
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable. |
Methods inherited from class com.mindfusion.diagramming.DiagramItem |
---|
clone, getBrush, getHyperLink, getIgnoreLayout, getLayoutTraits, getLocked, getMeasureUnit, getParent, getPen, getPrintable, getSelected, getShadowColor, getShadowOffsetX, getShadowOffsetY, getSubordinateGroup, getTag, getToolTip, getVisible, getWeight, getZIndex, hasSubordinates, onAdd, onChangeFont, onChildModified, onClick, onDoubleClick, onModify, putSelected, repaint, repaint, repaint, setBrush, setDiagramDirty, setHyperLink, setIgnoreLayout, setLocked, setPen, setPrintable, setSelected, setShadowColor, setShadowOffsetX, setShadowOffsetY, setTag, setToolTip, setVisible, setWeight, setZIndex, shouldRender, zBottom, zLevelDown, zLevelUp, zTop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableNode()
public TableNode(Diagram parent)
parent
- A Diagram
instance whose default table
attributes are copied to this table.public TableNode(TableNode prototype)
prototype
- A TableNode
instance whose attributes are
copied to this table.Method Detail |
---|
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 java.awt.Font getFont()
getFont
in class DiagramItem
Font
object representing the table font.public void setFont(java.awt.Font value)
setFont
in class DiagramItem
value
- A Font
object representing the table font.public 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, java.awt.geom.Rectangle2D dest, com.mindfusion.diagramming.DrawTextHint hint)
public java.awt.Image getImage()
java.awt.Image
object.public void setImage(java.awt.Image value)
value
- A java.awt.Image
object.public int getImageAlign()
ImageAlign
constants.public void setImageAlign(int value)
value
- One of the ImageAlign
constants.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 java.awt.Color getCaptionColor()
Color
object representing the color of the caption text.public void setCaptionColor(java.awt.Color value)
value
- A Color
object representing the color of the caption text.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 int getCellFrameStyle()
CellFrameStyle
constants.public void setCellFrameStyle(int value)
value
- One of the CellFrameStyle
constants.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, int rel, TableNode table, int relRow)
DiagramLink
related to this table.
row
- Index of a row in this table.rel
- One of the Relationship
constants.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()
DiagramNode
onUpdateBounds
in class DiagramNode
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.protected void draw(java.awt.Graphics2D g, RenderOptions options)
draw
in class DiagramItem
protected void drawShadow(java.awt.Graphics2D g, RenderOptions options)
drawShadow
in class DiagramItem
protected com.mindfusion.diagramming.ConnectionPoint createConnectionPoint(DiagramLink link, java.awt.geom.Point2D pt, boolean incoming)
createConnectionPoint
in class DiagramNode
protected void setReflexive(DiagramLink link)
setReflexive
in class DiagramNode
link
- Reference to the link.public boolean cellFromPoint(java.awt.geom.Point2D point, java.awt.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 InplaceEditable
public void setEditedText(java.lang.String newText)
setEditedText
in interface InplaceEditable
public java.awt.geom.Rectangle2D getEditRect(java.awt.geom.Point2D mousePosition)
getEditRect
in interface InplaceEditable
public int getStyle()
TableStyle
constants.public void setStyle(int value)
value
- One of the TableStyle
constants.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 int getConnectionStyle()
TableConnectionStyle
constants.public void setConnectionStyle(int value)
value
- One of the TableConnectionStyle
constants.protected DiagramItemProperties createProperties()
DiagramItem.createProperties()
override.
createProperties
in class DiagramNode
protected void saveProperties(DiagramItemProperties props)
DiagramItem.saveProperties(com.mindfusion.diagramming.DiagramItemProperties)
override.
saveProperties
in class DiagramNode
props
- A DiagramItemProperties-derived object where
the item's properties should be saved.protected void restoreProperties(DiagramItemProperties props)
DiagramItem.restoreProperties(com.mindfusion.diagramming.DiagramItemProperties)
override.
restoreProperties
in class DiagramNode
props
- 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.Externalizable
writeExternal
in class DiagramNode
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class DiagramNode
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
DiagramItem
saveToXml
in class DiagramNode
xmlElement
- 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
DiagramItem
loadFromXml
in class DiagramNode
xmlElement
- An XmlElement containing the item's data.context
- An XmlPersistContext
object providing contextual
information about the serialization process and some helper serialization methods
javax.xml.transform.TransformerException
XmlException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |