Class TableHandle
- All Implemented Interfaces:
IReportItemMethodContext,org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel,org.eclipse.birt.report.model.elements.interfaces.IInternalReportItemModel,org.eclipse.birt.report.model.elements.interfaces.IListingElementModel,org.eclipse.birt.report.model.elements.interfaces.IStyledElementModel,org.eclipse.birt.report.model.elements.interfaces.ITableItemModel
public class TableHandle
extends ListingHandle
implements org.eclipse.birt.report.model.elements.interfaces.ITableItemModel
Represents a table element. A table has a localized caption and can repeat
its heading at the top of each page. The table is a list that is structured
into a rows and columns. The columns are defined for the entire table. Rows
are clustered into a set of groups.
To get the layout of a table, it is recommended to use
LayoutTableModel.
- See Also:
-
TableItemLayoutTableModel
-
Field Summary
Fields inherited from class org.eclipse.birt.report.model.api.ReportItemHandleImpl
DATABINDING_TYPE_DATA, DATABINDING_TYPE_NONE, DATABINDING_TYPE_REPORT_ITEM_REFFields inherited from class org.eclipse.birt.report.model.api.ReportElementHandle
elementFields inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
moduleFields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
COMMENTS_PROP, CUSTOM_XML_PROP, DISPLAY_NAME_ID_PROP, DISPLAY_NAME_PROP, EVENT_HANDLER_CLASS_PROP, EXTENDS_PROP, FULL_LABEL, ID_SUFFIX, NAME_PROP, NEW_HANDLER_ON_EACH_EVENT_PROP, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP, VIEW_ACTION_PROPFields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IInternalReportItemModel
ACL_EXPRESSION_PROP, ALLOW_EXPORT_PROP, ALTTEXT_KEY_PROP, ALTTEXT_PROP, BOOKMARK_DISPLAY_NAME_PROP, BOOKMARK_PROP, BOUND_DATA_COLUMNS_PROP, CASCADE_ACL_PROP, CUBE_PROP, DATA_BINDING_REF_PROP, DATA_SET_PROP, HEIGHT_PROP, LANGUAGE_PROP, MULTI_VIEWS_PROP, ON_CREATE_METHOD, ON_PAGE_BREAK_METHOD, ON_PREPARE_METHOD, ON_RENDER_METHOD, ORDER_PROP, PARAM_BINDINGS_PROP, PUSH_DOWN_PROP, TAG_TYPE_PROP, THEME_PROP, TOC_PROP, URL_PROP, VISIBILITY_PROP, WIDTH_PROP, X_PROP, Y_PROP, Z_INDEX_PROPFields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IListingElementModel
DETAIL_SLOT, FILTER_PROP, FOOTER_SLOT, GROUP_SLOT, HEADER_SLOT, ON_FINISH_METHOD, ON_ROW_METHOD, ON_START_METHOD, PAGE_BREAK_INTERVAL_PROP, REPEAT_HEADER_PROP, SORT_BY_GROUPS_PROP, SORT_PROPFields inherited from interface org.eclipse.birt.report.model.api.elements.IReportItemMethodContext
ON_CREATE_CONTEXT, ON_PREPARE_CONTEXT, ON_RENDER_CONTEXTFields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IStyledElementModel
STYLE_PROPFields inherited from interface org.eclipse.birt.report.model.elements.interfaces.ITableItemModel
CAPTION_KEY_PROP, CAPTION_PROP, COLUMN_SLOT, IS_SUMMARY_TABLE_PROP, SUMMARY_PROP -
Constructor Summary
ConstructorsConstructorDescriptionTableHandle(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element) Constructs a handle for the table with the given design and element. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCopyColumn(int columnIndex) Copies a column and cells under it with the given column number.booleancanCopyRow(RowOperationParameters parameters) Checks whether the copy operation can be done with the given parameters.booleancanInsertAndPasteColumn(ColumnBandData data, int columnIndex) Checks whether the insert and paste operation can be done with the given copied column band data, the column index and the operation flag.booleancanInsertAndPasteRow(IDesignElement copiedRow, RowOperationParameters parameters) Checks whether the inserting and paste table row to the given destination row with the given parameters.booleancanInsertRow(RowOperationParameters parameters) Checks whether inserting an empty table row can be done with the given parameters.booleancanPasteColumn(ColumnBandData data, int columnIndex, boolean inForce) Checks whether the paste operation can be done with the given copied column band data, the column index and the operation flag.booleancanPasteRow(IDesignElement copiedRow, RowOperationParameters parameters) Checks whether the paste operation can be done with the given parameters.booleancanShiftColumn(int sourceColumn, int destColumn) Moves the column fromsourceColumntodestColumn.booleancanShiftRow(RowOperationParameters parameters) Checks whether the shift operation can be done with the given the given parameters.copyColumn(int columnIndex) Copies a column and cells under it with the given column number.copyRow(RowOperationParameters parameters) Copies table row with the given parameters.findColumn(int columnIndex) Figures out the column according to the index of the column.Returns the caption text of this table.Returns the resource key of the caption.protected CellHandlegetCell(int row, int column) Gets the cell at the position where the given row and column intersect regardless of slot information.getCell(int slotId, int groupLevel, int row, int column) Gets the cell at the position where the given row and column intersect within the given slot.intReturns the number of columns in the table.Returns the column slot.getFilters(int colIndex) Returns a list containing filters applied to the column at position of colIndex.Returns the layout model of the table.Returns the value of the summary.voidinsertAndPasteColumn(ColumnBandData data, int columnNumber) Inserts and pastes a column with its cells to the given column number.voidinsertAndPasteRow(IDesignElement copiedRow, RowOperationParameters parameters) Inserts and paste table row to the given destination row with the given parameters.voidinsertColumn(int columnNumber, int positionFlag) Inserts a column to the table.voidinsertRow(RowOperationParameters parameters) Inserts table row to the given destination row with the given parameters.booleanReturns if the table is a summary table.voidpasteColumn(ColumnBandData data, int columnNumber, boolean inForce) Pastes a column with its cells to the given column number.voidpasteRow(IDesignElement copiedRow, RowOperationParameters parameters) Pastes table row to destination row with the given parameters.voidsetCaption(String caption) Sets the caption text of this table.voidsetCaptionKey(String captionKey) Sets the resource key of the caption.voidsetIsSummaryTable(boolean isSummaryTable) Sets the flag to control whether the table is a summary table.voidsetSummary(String summary) Sets the value of summary.voidSets the width of the table to fit columns' widths with default dpi value.voidsetWidthToFitColumns(int dpi) Sets the width of the table to fit columns' widths with the given dpi value.voidshiftColumn(int sourceColumn, int destColumn) Moves the column fromsourceColumntodestIndex.voidshiftColumn(int sourceColumn, int destColumn, boolean weakMode) Shift columnvoidshiftRow(RowOperationParameters parameters) Shifts table row to the given destination row with the given parameters.Methods inherited from class org.eclipse.birt.report.model.api.ListingHandle
filtersIterator, getDetail, getFooter, getGroups, getHeader, getPageBreakInterval, isSortByGroups, repeatHeader, setPageBreakInterval, setRepeatHeader, setSortByGroups, sortsIteratorMethods inherited from class org.eclipse.birt.report.model.api.ReportItemHandleImpl
addColumnBinding, addTOC, addTOC, addView, allowExport, canAddView, canCascadeACL, cascadeACL, columnBindingsIterator, dropView, findColumnBinding, getACLExpression, getAltTextExpression, getAltTextKey, getAvailableBindings, getAvailableCubeBindingReferenceList, getAvailableDataBindingReferenceList, getAvailableDataBindingReferenceList, getAvailableDataSetBindingReferenceList, getBookmark, getBookmarkDisplayName, getColumnBindings, getCube, getCurrentView, getDataBindingReference, getDataBindingReferenceName, getDataBindingType, getDataSet, getHeight, getLanguage, getMethods, getNamedCubeBindingReferenceList, getNamedDataBindingReferenceList, getNamedDataSetBindingReferenceList, getOnCreate, getOnPageBreak, getOnPrepare, getOnRender, getOrder, getProperty, getTagType, getTheme, getTOC, getTocExpression, getURL, getViewHost, getViews, getWidth, getX, getY, getZIndex, paramBindingsIterator, pushDown, removedColumnBinding, removedColumnBindings, removedUnusedColumnBindings, setACLExpression, setAllowExport, setAltTextExpression, setAltTextKey, setBookmark, setBookmarkDisplayName, setCascadeACL, setCube, setCurrentView, setDataBindingReference, setDataSet, setHeight, setHeight, setLanguage, setOnCreate, setOnPageBreak, setOnPrepare, setOnRender, setOrder, setPushDown, setTagType, setTheme, setThemeName, setTocExpression, setURL, setWidth, setWidth, setX, setX, setY, setY, setZIndex, visibilityRulesIteratorMethods inherited from class org.eclipse.birt.report.model.api.ReportElementHandle
getComments, getCustomXml, getDisplayName, getDisplayNameKey, getElement, getPropertyMask, isValidLayoutForCompoundElement, isValidReferenceForCompoundElement, propertyMaskIterator, setComments, setCustomXml, setDisplayName, setDisplayNameKey, setPropertyMaskMethods inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
add, add, addElement, addElement, addListener, addUserPropertyDefn, cachePropertyHandles, canContain, canContain, canContain, canContain, canDrop, canEdit, canTransformToTemplate, clearAllProperties, clearContents, clearProperty, clientsIterator, copy, copyPropertyTo, createTemplateElement, derivedIterator, doSort, drop, drop, drop, dropAndClear, dropAndClear, dropAndClear, dropUserPropertyDefn, findContentSlot, getBooleanProperty, getChoices, getColorProperty, getContainer, getContainerPropertyHandle, getContainerSlotHandle, getContent, getContentCount, getContents, getDefn, getDesign, getDesignHandle, getDimensionProperty, getDisplayLabel, getDisplayLabel, getDisplayProperty, getEffectiveModule, getElementFactory, getElementProperty, getEventHandlerClass, getExpressionProperty, getExtends, getExternalizedValue, getExternalizedValue, getExternalizedValue, getFactoryElementHandle, getFactoryPropertyHandle, getFloatProperty, getFontProperty, getFullName, getHostViewHandle, getID, getIndex, getIntProperty, getListProperty, getListProperty, getMethods, getModule, getModuleHandle, getName, getNumberProperty, getPrivateStyle, getPropertyBinding, getPropertyBindingExpression, getPropertyBindings, getPropertyDefn, getPropertyHandle, getPropertyIterator, getQualifiedName, getRoot, getSemanticErrors, getSlot, getStringProperty, getStyle, getUserProperties, getUserPropertyDefnHandle, getXPath, hasLocalProperties, hasSemanticError, initializeSlotHandles, isDirectionRTL, isInTemplateParameter, isTemplateParameterValue, isValid, localize, move, move, moveTo, moveTo, moveTo, moveTo, newHandlerOnEachEvent, paste, paste, paste, paste, removeListener, revertToReportItem, revertToTemplate, semanticCheck, setBooleanProperty, setEncryption, setEventHandlerClass, setExpressionProperty, setExtends, setExtendsElement, setExtendsName, setFloatProperty, setIntProperty, setName, setNewHandlerOnEachEvent, setNumberProperty, setProperties, setProperty, setPropertyBinding, setPropertyBinding, setStringProperty, setStyle, setStyleElement, setStyleName, setValid, shift, showError, slotsIterator
-
Constructor Details
-
TableHandle
public TableHandle(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element) Constructs a handle for the table with the given design and element. The application generally does not create handles directly. Instead, it uses one of the navigation methods available on other element handles.- Parameters:
module- the moduleelement- the model representation of the element
-
-
Method Details
-
getColumns
Returns the column slot. The column slot represents a list of Column elements that describe the table columns.- Returns:
- a handle to the detail slot
- See Also:
-
getColumnCount
public int getColumnCount()Returns the number of columns in the table. The number is defined as 1) the sum of columns described in the "column" slot, or 2) the widest row defined in the detail, header or footer slots if column slot is empty.- Returns:
- the number of columns in the table
-
getCaption
Returns the caption text of this table.- Returns:
- the caption text
-
setCaption
Sets the caption text of this table.- Parameters:
caption- the caption text- Throws:
SemanticException- if the property is locked.
-
getSummary
Returns the value of the summary.- Returns:
- the value of summary
-
setSummary
Sets the value of summary.- Parameters:
summary- the value of summary- Throws:
SemanticException
-
getCaptionKey
Returns the resource key of the caption.- Returns:
- the resource key of the caption
-
setCaptionKey
Sets the resource key of the caption.- Parameters:
captionKey- the resource key of the caption- Throws:
SemanticException- if the caption resource-key property is locked.
-
canCopyColumn
public boolean canCopyColumn(int columnIndex) Copies a column and cells under it with the given column number.- Parameters:
columnIndex- the column position indexing from 1.- Returns:
trueif this column band can be copied. Otherwisefalse.
-
canPasteColumn
Checks whether the paste operation can be done with the given copied column band data, the column index and the operation flag.- Parameters:
data- the column band data to pastecolumnIndex- the column index from 1 to the number of columns in the tableinForce-trueindicates to paste the column regardless of the different layout of cells.falseindicates not.- Returns:
trueindicates the paste operation can be done. Otherwisefalse.
-
canCopyRow
Checks whether the copy operation can be done with the given parameters.- Parameters:
parameters- parameters needed by insert operation.- Returns:
trueif this row band can be copied. Otherwisefalse.
-
canPasteRow
Checks whether the paste operation can be done with the given parameters.- Parameters:
copiedRow- the copied table rowparameters- parameters needed by insert operation.- Returns:
trueindicates the paste operation can be done. Otherwisefalse.
-
canInsertRow
Checks whether inserting an empty table row can be done with the given parameters.- Parameters:
parameters- parameters needed by insert operation.- Returns:
trueindicates the insert operation can be done. Otherwisefalse.
-
canInsertAndPasteRow
Checks whether the inserting and paste table row to the given destination row with the given parameters.- Parameters:
copiedRow- the copied table rowparameters- parameters needed by insert operation.- Returns:
trueindicates the insert and paste operation can be done. Otherwisefalse.
-
canShiftRow
Checks whether the shift operation can be done with the given the given parameters.- Parameters:
parameters- parameters needed by insert operation.- Returns:
trueindicates the shift operation can be done. Otherwisefalse.
-
copyColumn
Copies a column and cells under it with the given column number.- Parameters:
columnIndex- the column number- Returns:
- a new
ColumnBandAdapterinstance - Throws:
SemanticException- if the cell layout of the column is invalid.
-
pasteColumn
public void pasteColumn(ColumnBandData data, int columnNumber, boolean inForce) throws SemanticException Pastes a column with its cells to the given column number.- Parameters:
data- the data of a column band to pastecolumnNumber- the column index from 1 to the number of columns in the tableinForce-trueif pastes the column regardless of the warning. Otherwisefalse.- Throws:
SemanticException
-
copyRow
Copies table row with the given parameters.- Parameters:
parameters- parameters needed by insert operation.- Returns:
- a new
TableRowinstance - Throws:
SemanticException- throw if paste operation is forbiddenIllegalArgumentException- throw if the input parameters are not valid
-
pasteRow
public void pasteRow(IDesignElement copiedRow, RowOperationParameters parameters) throws SemanticException Pastes table row to destination row with the given parameters.- Parameters:
copiedRow- the copied table rowparameters- parameters needed by insert operation.- Throws:
SemanticException- throw if paste operation is forbiddenIllegalArgumentException- throw if the input parameters are not valid
-
insertRow
Inserts table row to the given destination row with the given parameters.- Parameters:
parameters- parameters needed by insert operation.- Throws:
SemanticException- throw if paste operation is forbiddenIllegalArgumentException- throw if the input parameters are not valid
-
insertAndPasteRow
public void insertAndPasteRow(IDesignElement copiedRow, RowOperationParameters parameters) throws SemanticException Inserts and paste table row to the given destination row with the given parameters.- Parameters:
copiedRow- the copied table rowparameters- parameters needed by insert operation.- Throws:
SemanticException- throw if paste operation is forbiddenIllegalArgumentException- throw if the input parameters are not valid
-
shiftRow
Shifts table row to the given destination row with the given parameters.- Parameters:
parameters- parameters needed by insert operation.- Throws:
SemanticException- throw if paste operation is forbiddenIllegalArgumentException- throw if the input parameters are not valid
-
insertAndPasteColumn
Inserts and pastes a column with its cells to the given column number.- Parameters:
data- the data of a column band to pastecolumnNumber- the column index from 0 to the number of columns in the table- Throws:
SemanticException
-
canInsertAndPasteColumn
Checks whether the insert and paste operation can be done with the given copied column band data, the column index and the operation flag. This is different fromcanPasteColumnsince this action creates an extra column for the table.- Parameters:
data- the column band data to pastecolumnIndex- the column index from 0 to the number of columns in the table- Returns:
trueindicates the paste operation can be done. Otherwisefalse.
-
shiftColumn
Moves the column fromsourceColumntodestIndex.- Parameters:
sourceColumn- the source column ranging from 1 to the column numberdestColumn- the target column ranging from 0 to the column number- Throws:
SemanticException- if the chosen column band is forbidden to shift
-
shiftColumn
public void shiftColumn(int sourceColumn, int destColumn, boolean weakMode) throws SemanticException Shift column- Parameters:
sourceColumn- the source column ranging from 1 to the column numberdestColumn- the target column ranging from 0 to the column numberweakMode-- Throws:
SemanticException- if the chosen column band is forbidden to shift
-
canShiftColumn
public boolean canShiftColumn(int sourceColumn, int destColumn) Moves the column fromsourceColumntodestColumn.- Parameters:
sourceColumn- the source column ranging from 1 to the column numberdestColumn- the target column ranging from 0 to the column number- Returns:
trueif the chosen column band is legal to shift. Otherwisefalse.
-
getLayoutModel
Returns the layout model of the table.- Returns:
- the layout model of the table
-
insertColumn
Inserts a column to the table. This includes inserting a table column and corresponding table cells to the table item.The insert action cannot be finished succesfully for cases like this:
<cell colSpan="1/><cell colSpan="1/> <cell colSpan="2/>if the user want to insert a column with cells to the column 2.- Parameters:
columnNumber- The 1-based column number.positionFlag- The column insert sign. 1 insert after position. -1 insert before position- Throws:
SemanticException- if the given position is occupied by any cell with a column span equal or greater than 1.
-
getCell
Gets the cell at the position where the given row and column intersect regardless of slot information. The table is viewed as be constructed by a set of flattened rows.- Parameters:
row- the row position indexing from 1column- the column position indexing from 1- Returns:
- the cell handle at the position if the cell exists, otherwise
null
-
getCell
Gets the cell at the position where the given row and column intersect within the given slot. The first row in the slot is count as 1. And so on.If
groupLevelis less or equal than 0, then retrieve cell from header/detail/footer. If not, return the cell from the given group.- Parameters:
slotId- the slot idgroupLevel- the group level indexing from 1. Or -1 if to get the cell from header/detail/footer.row- the row position indexing from 1column- the column position indexing from 1- Returns:
- the cell handle at the position if the cell exists, otherwise
null
-
findColumn
Figures out the column according to the index of the column.- Parameters:
columnIndex- the 1-based column index- Returns:
- the handle of the column at the specified position, or null if not found.
-
getFilters
Returns a list containing filters applied to the column at position of colIndex.- Parameters:
colIndex- the column index ranging from 0 to columnCount - 1- Returns:
- a list containing matched filter conditions
-
isSummaryTable
public boolean isSummaryTable()Returns if the table is a summary table. A summary table should not allow adding any detail rows.- Returns:
trueif the table is a summary table.Otherwisefalse.
-
setIsSummaryTable
Sets the flag to control whether the table is a summary table. If the flag is checked, there should be no detail rows added for this table allowed.- Parameters:
isSummaryTable- the flag to set- Throws:
SemanticException
-
setWidthToFitColumns
Sets the width of the table to fit columns' widths with default dpi value. The new width value will be the sum of the columns' widths.- Throws:
SemanticException- when width of the table cannot be calculated.
-
setWidthToFitColumns
Sets the width of the table to fit columns' widths with the given dpi value. The new width value will be the sum of the columns' widths.- Parameters:
dpi- the dpi value- Throws:
SemanticException- when width of the table cannot be calculated.
-