|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectivehtml.oms.OMSObject | +--objectivehtml.htmlwidget.HtmlElement | +--objectivehtml.htmlwidget.HtmlWidget | +--objectivehtml.htmlwidget.HtmlContainerWidget | +--objectivehtml.htmlwidget.HtmlTable
This class represents a html table. i.e.
<table> <tr><td></td></tr> <tr><td></td></tr> </table>
This object allows users to place text and other widgets into a tabular format. The table is always rectangular.
A table is made up of HtmlTableRow objects and HtmlTableCell objects. Each HtmlTableRow object represents one row of the table and each HtmlTableCell object represents one cell of the table. HtmlTableCell objects have the ability the span either vertically or horizontally over other table cells.
Table rows and table columns can be shown/hidden using the methods setRowVisible(int,boolean) and setColumnVisible(int,boolean).
The current implementation of HtmlTable only supports the simple table model. The complex table model which was introduced in HTML 4.0 is not supported. The main reasons for this is because most developers use the simple model and everything that can be done with the complex version can be emulated with the simple version.
Fields inherited from class objectivehtml.htmlwidget.HtmlContainerWidget |
m_alChildrenWidgets, m_bAutoEscape, m_sText |
Fields inherited from class objectivehtml.htmlwidget.HtmlWidget |
m_bDestroyed, m_bVisible, m_objHtmlForm, m_objParentWidget |
Fields inherited from class objectivehtml.htmlwidget.HtmlElement |
m_hmAttributes, m_sEndTag, m_sQuoteType, m_sStartTag |
Constructor Summary | |
HtmlTable(HtmlContainerWidget objParent)
Constructs an instance of HtmlTable with 1 row and 1 column. |
|
HtmlTable(HtmlContainerWidget objParent,
int nRows,
int nColumns)
Constructs an instance of HtmlTable with nRows rows and nColumns columns. |
Method Summary | |
HtmlTableRow |
appendTableRow(boolean bCloneLastRow)
Adds a new row to this table. |
java.lang.String |
getAlign()
Returns the alignment style of this object. |
java.lang.String |
getBgColor()
Returns the background color of this object. |
java.lang.String |
getBorder()
Returns the border of this object. |
java.lang.String |
getCaptionText()
Returns the caption text for this table object. |
java.lang.String |
getCellPadding()
Returns the cell padding of this object. |
java.lang.String |
getCellSpacing()
Returns the cell spacing of this object. |
int |
getColumns()
Returns the number of table columns. |
HtmlTableCaption |
getHtmlTableCaption()
Returns a reference to the html table caption object. |
int |
getRows()
Returns the number of table rows. |
HtmlTableCell |
getTableCell(int nRow,
int nColumn)
Returns the HtmlTableCell object for the specified table cell. |
HtmlTableRow |
getTableRow(int nRow)
Returns the HtmlTableRow object for the specified table row. |
java.lang.String |
getWidth()
Returns the width of this object. |
boolean |
isColumnVisible(int nColumn)
Returns if a table column is visible or hidden. |
boolean |
isRowVisible(int nRow)
Returns if a table row is visible or hidden. |
protected void |
isValidChildWidget(HtmlWidget objHtmlWidget)
Overrides the default version, so that only HtmlTableRow objects can be added to this object. |
void |
setAlign(java.lang.String sAlign)
Sets the alignment style of this object. |
void |
setBgColor(java.lang.String sBgColor)
Sets the background color of this object. |
void |
setBorder(java.lang.String sBorder)
Sets the border of this table. |
void |
setCaptionText(java.lang.String sCaptionText)
Sets the text for the caption of the table. |
void |
setCellPadding(java.lang.String sCellPadding)
Sets the cell padding of this table. |
void |
setCellSpacing(java.lang.String sCellSpacing)
Sets the cell spacing of this table. |
void |
setColumns(int nTableColumns)
Sets the number of table columns. |
void |
setColumnVisible(int nColumn,
boolean bVisible)
Sets a column to be either hidden or visible. |
void |
setRows(int nTableRows)
Sets the number of table rows. |
void |
setRowVisible(int nRow,
boolean bVisible)
Sets a table row to be either hidden or visible. |
void |
setVisible(boolean bVisible)
Sets the visibility of this object. |
void |
setWidth(java.lang.String sWidth)
Sets the width of this object. |
void |
swapHtmlWidgets(int nFirstRow,
int nSecondRow)
Swaps the position of the 2 table rows. |
protected void |
updateVisibility()
Updates the visible flag of all the widgets in the table. |
Methods inherited from class objectivehtml.htmlwidget.HtmlContainerWidget |
addHtmlWidget, appendChild, destroy, generateUpdateOrder, getChildrenCount, getChildrenWidgets, getChildWidget, getText, indexOfChildWidget, insertChild, insertHtmlWidget, isAutoEscape, isChildWidget, printHtml, printHtml, removeHtmlWidget, setAttribute, setAutoEscape, setBooleanAttribute, setText |
Methods inherited from class objectivehtml.htmlwidget.HtmlWidget |
changeParent, changeParent, getClassAttribute, getHtmlForm, getID, getOnClick, getOnDblClick, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getParent, getStyle, isDestroyed, isVisible, setClassAttribute, setID, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStyle |
Methods inherited from class objectivehtml.htmlwidget.HtmlElement |
genEndTag, genStartTag, genStartTag, getAttribute, getAttributes, getBooleanAttribute, getQuoteType, printHtml, printHtml, printHtml, printHtml, printHtml, printHtml, setAttribute, setBooleanAttribute, setQuoteType, toString, toString |
Methods inherited from class objectivehtml.oms.OMSObject |
compareClasses, connect, disconnect, emit, isAlive, setAlive, signal, slot, slot |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public HtmlTable(HtmlContainerWidget objParent) throws InvalidParentWidgetException, InvalidChildWidgetException
objParent
- the parent object of this tableInvalidParentWidgetException
- if the specified parent widget is not validInvalidChildWidgetException
- if the parent widget does not accept this widget as a childpublic HtmlTable(HtmlContainerWidget objParent, int nRows, int nColumns) throws InvalidParentWidgetException, InvalidChildWidgetException
objParent
- the parent object of this tablenRows
- the number of rows the table starts withnColumns
- the number of columns the table starts withInvalidParentWidgetException
- if the specified parent widget is not validInvalidChildWidgetException
- if the parent widget does not accept this widget as a childMethod Detail |
public HtmlTableCaption getHtmlTableCaption()
setCaptionText(String)
public void setCaptionText(java.lang.String sCaptionText)
sCaptionText
- the caption textgetCaptionText()
,
getHtmlTableCaption()
public java.lang.String getCaptionText()
setCaptionText(String)
,
getHtmlTableCaption()
public void setVisible(boolean bVisible)
setVisible
in class HtmlContainerWidget
bVisible
- true if visible, false if invisiblepublic java.lang.String getAlign()
setAlign(String)
public void setAlign(java.lang.String sAlign)
Sets the alignment style of this object. Suitable values are "left", "center" and "right".
The html attribute it sets is "align".
If null is specified the attribute is cleared.
sAlign
- the alignment style for this widget,
if null is specified then this attribute
will be clearedgetAlign()
public java.lang.String getBgColor()
setBgColor(String)
public void setBgColor(java.lang.String sBgColor)
Sets the background color of this object. There 16 preset values "black", "silver", "gray", "white", "maroon", "red", "purple", "fushcia", "green", "lime", "olive", "yellow", "navy", "blue", "teal" and "navy". For all other colors you can specify the color in the format SRGB, i.e. #RRGGBB.
The html attribute it sets is "bgcolor".
If null is specified the attribute is cleared.
sBgColor
- the background color for this widget,
if null is specified then this attribute
will be clearedgetBgColor()
public java.lang.String getWidth()
setWidth(String)
public void setWidth(java.lang.String sWidth)
Sets the width of this object. There are 2 formats that can be used. The first is to give a precise pixel value, e.g. "400", meaning the object will attempt to be 400 pixels wide. The second is to give a percentage, this means the object will attempt to occupy that percentage of the available space to it. e.g. "80%", meaning the object will attempt to occupy 80 percent of the width space that is available to it.
The html attribute it sets is "width".
If null is specified the attribute is cleared.
sWidth
- the width size for this widget,
if null is specified then this attribute
will be clearedgetWidth()
public java.lang.String getBorder()
setBorder(String)
public void setBorder(java.lang.String sBorder)
Sets the border of this table. The border size is specified in pixels.
The html attribute it sets is "border".
If null is specified the attribute is cleared.
sBorder
- the border size for this widget,
if null is specified then this attribute
will be clearedgetBorder()
public java.lang.String getCellPadding()
setCellPadding(String)
public void setCellPadding(java.lang.String sCellPadding)
Sets the cell padding of this table. The cell padding size is specified in pixels. Cell padding is the space between the outermost widgets inside a table cell and the border of the table cell.
The html attribute it sets is "cellpadding".
If null is specified the attribute is cleared.
sCellPadding
- the cell padding size for this widget,
if null is specified then this attribute
will be clearedgetCellPadding()
public java.lang.String getCellSpacing()
setCellSpacing(String)
public void setCellSpacing(java.lang.String sCellSpacing)
Sets the cell spacing of this table. The cell spacing size is specified in pixels. Cell spacing is the space between the table cells.
The html attribute it sets is "cellspacing".
If null is specified the attribute is cleared.
sCellSpacing
- the cell spacing size for this widget,
if null is specified then this attribute
will be clearedgetCellSpacing()
public HtmlTableRow appendTableRow(boolean bCloneLastRow)
Adds a new row to this table. If bCloneLastRow is specified to be true then the new row will have all the properties of the last row, otherwise the new row will have no default properties.
bCloneLastRow
- indicates whether the new row will clone the properties of the last rowpublic void setRows(int nTableRows)
Sets the number of table rows.
If nTableRows is greater than the current number of rows then new table rows and table cells are created and appended to the end.
If nTableRows is less than the current number of rows then the table rows and table cells (starting from the end) are deleted. All widgets contained in the table cells will also be destroyed.
nTableRows
- the new number of table rowsgetRows()
,
setColumns(int)
public int getRows()
setRows(int)
public void setColumns(int nTableColumns)
Sets the number of table columns.
If nTableColumns is greater than the current number of columns then new table cells are created and appended to the end.
If nTableColumns is less than the current number of columns then the table cells (starting from the end) are deleted. All widgets contained in the table cells will also be destroyed.
nTableColumns
- the new number of table columnsgetColumns()
,
setRows(int)
public int getColumns()
setColumns(int)
public HtmlTableRow getTableRow(int nRow)
nRow
- the row indexpublic HtmlTableCell getTableCell(int nRow, int nColumn)
the
- row indexthe
- column indexpublic void setRowVisible(int nRow, boolean bVisible)
nRow
- the row indexbVisible
- true if the row is to visible, false otherwiseisRowVisible(int)
,
setColumnVisible(int, boolean)
,
updateVisibility()
public boolean isRowVisible(int nRow)
setRowVisible(int, boolean)
public void setColumnVisible(int nColumn, boolean bVisible)
nColumn
- the column indexbVisible
- true if the column is to visible, false otherwiseisColumnVisible(int)
,
setRowVisible(int, boolean)
,
updateVisibility()
public boolean isColumnVisible(int nColumn)
setColumnVisible(int, boolean)
public void swapHtmlWidgets(int nFirstRow, int nSecondRow)
Swaps the position of the 2 table rows. Moves the table row at position nFirstRow to nSecondRow, and moves the table row at position nSecondRow to nFirstRow.
Overrides the default implementation. When rows are swapped the visibility is applied to the rows accordingly.
swapHtmlWidgets
in class HtmlContainerWidget
nFirstRow
- the first rownSecondRow
- the second rowupdateVisibility()
protected void updateVisibility()
protected void isValidChildWidget(HtmlWidget objHtmlWidget) throws InvalidChildWidgetException
isValidChildWidget
in class HtmlContainerWidget
objHtmlWidget
- the widget to testInvalidChildWidgetException
- if the widget is not a HtmlTableRow object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |