// Resize the inner DIV in each table cell
protected void resizeColumn( DynamicColumn<BaseColumn> resizeColumn,
int resizeColumnWidth ) {
DivElement div;
TableCellElement tce;
int colOffsetIndex;
// This is also set in the ColumnResizeEvent handler, however it makes
// resizing columns in the header more simple too
resizeColumn.setWidth( resizeColumnWidth );
resizeColumn.getModelColumn().setWidth( resizeColumnWidth );
int resizeColumnIndex = widget.visibleCols.indexOf( resizeColumn );
// Row 0 (General\Fact Type)
// General row, all visible cells included
int iRow0ColColumn = 0;
for ( int iCol = 0; iCol < widget.visibleCols.size(); iCol++ ) {
DynamicColumn<BaseColumn> col = widget.visibleCols.get( iCol );
BaseColumn modelCol = col.getModelColumn();
// Merging
int colSpan = 1;
int width = col.getWidth();
if ( modelCol instanceof BRLVariableColumn ) {
BRLVariableColumn brlColumn = (BRLVariableColumn) col.getModelColumn();
BRLColumn<?, ?> brlColumnParent = model.getBRLColumn( brlColumn );
while ( iCol + colSpan < widget.visibleCols.size() ) {
DynamicColumn<BaseColumn> mergeCol = widget.visibleCols.get( iCol + colSpan );
BaseColumn mergeModelCol = mergeCol.getModelColumn();
if ( !( mergeModelCol instanceof BRLVariableColumn ) ) {
break;
}
BRLVariableColumn mergeBRLColumn = (BRLVariableColumn) mergeModelCol;
BRLColumn<?, ?> mergeBRLColumnParent = model.getBRLColumn( mergeBRLColumn );
if ( mergeBRLColumnParent != brlColumnParent ) {
break;
}
width = width + mergeCol.getWidth();
colSpan++;
}
iCol = iCol + colSpan - 1;
}
// Resize cell
tce = widget.rowHeaders[ 0 ].getChild( iRow0ColColumn ).<TableCellElement>cast();
div = tce.getFirstChild().<DivElement>cast();
div.getStyle().setWidth( width,
Unit.PX );
iRow0ColColumn++;
}
// Row 4 (Sorters)
tce = widget.rowHeaders[ 4 ].getChild( resizeColumnIndex ).<TableCellElement>cast();
div = tce.getFirstChild().<DivElement>cast();
div.getStyle().setWidth( resizeColumnWidth,
Unit.PX );
// Row 3 (Fact Fields)
if ( multiRowColumnOffset != -1 ) {
colOffsetIndex = resizeColumnIndex - multiRowColumnOffset;
if ( colOffsetIndex >= 0 && !( resizeColumn.getModelColumn() instanceof AnalysisCol52 ) ) {
DynamicColumn<BaseColumn> col = widget.visibleCols.get( resizeColumnIndex );
tce = widget.rowHeaders[ 3 ].getChild( colOffsetIndex ).<TableCellElement>cast();
div = tce.getFirstChild().<DivElement>cast();
div.getStyle().setWidth( col.getWidth(),
Unit.PX );
}
}
// Row 2 (Fact Types) - Condition Columns
int iRow2ColColumn = 0;
for ( int iCol = 0; iCol < widget.visibleConditionCols.size(); iCol++ ) {
DynamicColumn<BaseColumn> col = widget.visibleConditionCols.get( iCol );
ConditionCol52 cc = (ConditionCol52) col.getModelColumn();
Pattern52 ccPattern = model.getPattern( cc );
// Merging
int colSpan = 1;
int width = col.getWidth();
while ( iCol + colSpan < widget.visibleConditionCols.size() ) {
DynamicColumn<BaseColumn> mergeCol = widget.visibleConditionCols.get( iCol + colSpan );
ConditionCol52 mergeCondCol = (ConditionCol52) mergeCol.getModelColumn();
Pattern52 mergeCondColPattern = model.getPattern( mergeCondCol );
if ( mergeCondColPattern != ccPattern ) {
break;
}
width = width + mergeCol.getWidth();
colSpan++;
}
// Resize cell
iCol = iCol + colSpan - 1;
tce = widget.rowHeaders[ 2 ].getChild( iRow2ColColumn ).<TableCellElement>cast();
div = tce.getFirstChild().<DivElement>cast();
div.getStyle().setWidth( width,
Unit.PX );
iRow2ColColumn++;
}
// Row 2 (Fact Types) - Action Columns
if ( multiRowColumnActionsOffset != -1 ) {
colOffsetIndex = resizeColumnIndex - multiRowColumnActionsOffset;
if ( colOffsetIndex >= 0 && !( resizeColumn.getModelColumn() instanceof AnalysisCol52 ) ) {
colOffsetIndex = colOffsetIndex + iRow2ColColumn;
DynamicColumn<BaseColumn> col = widget.visibleCols.get( resizeColumnIndex );
tce = widget.rowHeaders[ 2 ].getChild( colOffsetIndex ).<TableCellElement>cast();
div = tce.getFirstChild().<DivElement>cast();
div.getStyle().setWidth( col.getWidth(),
Unit.PX );
}
}