public class JWordDocument.TableElement
extends javax.swing.text.AbstractDocument.BranchElement
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CELL_MARGIN |
static java.lang.String |
ELEMENT_NAME_TABLE |
Constructor and Description |
---|
TableElement(javax.swing.text.Element parent,
javax.swing.text.AttributeSet attr)
constructor
|
TableElement(int[] rowOffsets,
int[] rowLengths,
javax.swing.text.Element parent,
javax.swing.text.AttributeSet attr,
javax.swing.text.AttributeSet paraAttr,
javax.swing.text.AttributeSet charAttr,
int rowCount,
int colCount,
int[] widths,
int[] heights,
boolean nested)
Constructs a new table element in the document.
|
Modifier and Type | Method and Description |
---|---|
int |
getAbsoluteColumnWidth(int baseWidth,
int columnIndex)
Calculate and return the absolute width of the given column
|
int |
getAbsoluteWidth(int baseWidth)
calculate and return the absolute width of the table in case the
table width is given in percent values this will try to find the
actual width by calculating the percent of the parent area.
|
java.lang.Object |
getAttribute(java.lang.Object attrName) |
java.awt.Color |
getBackColor()
returns table default back color
|
Borders |
getBorders()
returns border attributes
|
JWordDocument.CellElement |
getCell(int rowIndex,
int colIndex)
return a cell of the table at the given row/col position
|
int |
getCellSpacing()
returns cell spacing value (in twips)
|
TableColumn |
getColumn(int i)
returns attributes of ith table column
|
java.util.ArrayList<TableColumn> |
getColumns()
returns column list of this table
|
JWordDocument.CellElement |
getFirstCell()
return first cell of table
|
int |
getHAlign()
returns tables horizontal alignment
|
Dimension |
getHeight()
Gets the table height (sum of row heights).
|
JWordDocument.CellElement |
getLastCell()
return first cell of table
|
int |
getLeftIndent()
returns tables left indent (in twips)
|
java.awt.Insets |
getMargins()
Gets the cell's margins.
|
java.lang.String |
getName()
Gets the element name.
|
int |
getParentWidth(int baseWidth)
returns the width of the usable area where this table is located
|
int |
getRowIndex(JWordDocument.RowElement row)
return index of row in table (0 based) returns -1 if row is not in
this table
|
javax.swing.text.Style |
getTableStyle()
returns table style or null
|
Dimension |
getWidth()
Gets the table width (sum of column widths).
|
boolean |
isLeaf()
Checks whether the element is a leaf.
|
boolean |
isNested()
return whether the table is nested whithin another
|
void |
setAlignment(int align)
Sets table alignment.
|
void |
setBackColor(java.awt.Color backColor)
set default back color
|
void |
setBorders(Borders ba)
Sets cell borders attributes.
|
void |
setLeftIndent(int leftIndent)
sets tables left indent (in twips)
|
void |
setMargins(java.awt.Insets margins)
Sets the cell's margins.
|
void |
setMargins(int top,
int left,
int bottom,
int right)
Sets the cell's margins.
|
void |
setNested(boolean nested) |
children, getAllowsChildren, getElement, getElementCount, getElementIndex, getEndOffset, getStartOffset, positionToElement, replace, toString
addAttribute, addAttributes, containsAttribute, containsAttributes, copyAttributes, dump, getAttributeCount, getAttributeNames, getAttributes, getChildAt, getChildCount, getDocument, getIndex, getParent, getParentElement, getResolveParent, isDefined, isEqual, removeAttribute, removeAttributes, removeAttributes, setResolveParent
public static final java.lang.String ELEMENT_NAME_TABLE
public static final int DEFAULT_CELL_MARGIN
public TableElement(int[] rowOffsets, int[] rowLengths, javax.swing.text.Element parent, javax.swing.text.AttributeSet attr, javax.swing.text.AttributeSet paraAttr, javax.swing.text.AttributeSet charAttr, int rowCount, int colCount, int[] widths, int[] heights, boolean nested)
rowOffsets
- The start offsets for each table row.rowLengths
- Lengths (char length) for each row.parent
- The parent element.attr
- The attributes for the table.rowCount
- The number of rows.colCount
- The number of columns.widths
- The list of column's widths.heights
- The list of rows' heights.public TableElement(javax.swing.text.Element parent, javax.swing.text.AttributeSet attr)
parent
- attr
- public java.lang.Object getAttribute(java.lang.Object attrName)
getAttribute
in interface javax.swing.text.AttributeSet
getAttribute
in class javax.swing.text.AbstractDocument.AbstractElement
public java.util.ArrayList<TableColumn> getColumns()
public TableColumn getColumn(int i)
i
- public java.lang.String getName()
getName
in interface javax.swing.text.Element
getName
in class javax.swing.text.AbstractDocument.BranchElement
public javax.swing.text.Style getTableStyle()
public Dimension getWidth()
public int getAbsoluteWidth(int baseWidth)
baseWidth
- public int getParentWidth(int baseWidth)
public int getAbsoluteColumnWidth(int baseWidth, int columnIndex)
baseWidth
- columnIndex
- public Dimension getHeight()
public JWordDocument.CellElement getFirstCell()
public JWordDocument.CellElement getCell(int rowIndex, int colIndex)
public JWordDocument.CellElement getLastCell()
public int getRowIndex(JWordDocument.RowElement row)
row
- public Borders getBorders()
public boolean isLeaf()
isLeaf
in interface javax.swing.text.Element
isLeaf
in interface javax.swing.tree.TreeNode
isLeaf
in class javax.swing.text.AbstractDocument.BranchElement
public void setBorders(Borders ba)
ba
- The border attributes.public void setBackColor(java.awt.Color backColor)
backColor
- public java.awt.Color getBackColor()
public void setAlignment(int align)
align
- The new margins.public int getHAlign()
public int getLeftIndent()
public void setLeftIndent(int leftIndent)
leftIndent
- public int getCellSpacing()
public boolean isNested()
public void setNested(boolean nested)
nested
- public java.awt.Insets getMargins()
public void setMargins(java.awt.Insets margins)
margins
- -
the page's margins.public void setMargins(int top, int left, int bottom, int right)
top
- -
the top margin.left
- -
the left margin.bottom
- -
the bottom margin.right
- -
the right margin.