fds[1] = new StringFieldDef( "desc" ); //NON-NLS
int colCount = 0;
BaseColumnConfig[] cols = new BaseColumnConfig[fds.length]; //its +1 as we have the separator -> thing.
cols[0] = new ColumnConfig() {
{
setDataIndex( "num" ); //NON-NLS
setWidth( 60 );
setSortable( false );
setHeader( "Row Number" );
setRenderer( new Renderer() {
public String render(Object value,
CellMetadata cellMetadata,
Record record,
int rowIndex,
int colNum,
Store store) {
return "<span class='x-grid3-cell-inner x-grid3-td-numberer'>" + (rowIndex + 1) + "</span>"; //NON-NLS
}
} );
}
};
colCount++;
cols[1] = new ColumnConfig() {
{
setDataIndex( "desc" ); //NON-NLS
setSortable( true );
setHeader( constants.Description() );
if ( dt.descriptionWidth != -1 ) {
setWidth( dt.descriptionWidth );
}
}
};
colCount++;
//now to metadata
for ( int i = 0; i < dt.getMetadataCols().size(); i++ ) {
final MetadataCol attr = dt.getMetadataCols().get( i );
fds[colCount] = new StringFieldDef( attr.attr );
cols[colCount] = new ColumnConfig() {
{
setHeader( attr.attr );
setDataIndex( attr.attr );
setSortable( true );
if ( attr.width != -1 ) {
setWidth( attr.width );
}
if ( attr.hideColumn ) {
setHidden( true );
}
}
};
colMap.put( attr.attr, attr );
colCount++;
}
//now to attributes
for ( int i = 0; i < dt.attributeCols.size(); i++ ) {
final AttributeCol attr = dt.attributeCols.get( i );
fds[colCount] = new StringFieldDef( attr.attr );
cols[colCount] = new ColumnConfig() {
{
setHeader( attr.attr );
setDataIndex( attr.attr );
setSortable( true );
if ( attr.width != -1 ) {
setWidth( attr.width );
}
if ( attr.hideColumn ) {
setHidden( true );
}
}
};
colMap.put( attr.attr,
attr );
colCount++;
}
//do all the condition cols
for ( int i = 0; i < dt.conditionCols.size(); i++ ) {
//here we could also deal with numeric type?
final ConditionCol c = dt.conditionCols.get( i );
fds[colCount] = new StringFieldDef( c.header );
cols[colCount] = new ColumnConfig() {
{
setHeader( c.header );
setDataIndex( c.header );
setSortable( true );
if ( c.width != -1 ) {
setWidth( c.width );
}
if ( c.hideColumn ) {
setHidden( true );
}
}
};
colMap.put( c.header,
c );
colCount++;
}
//the split thing
//The separator column causes confusion, see GUVNOR-498. Remove this column for now until
//we find a better way to represent a column for the purpose of separator.
/* cols[colCount] = new ColumnConfig() {
{
setDataIndex( "x" );
setHeader( "x" );
//setFixed(true);
setSortable( false );
setResizable( false );
//setWidth(60);
setRenderer( new Renderer() {
public String render(Object value,
CellMetadata cellMetadata,
Record record,
int rowIndex,
int colNum,
Store store) {
return "<image src='images/production.gif'/>"; //NON-NLS
}
} );
setWidth( 20 );
}
};
colCount++;*/
for ( int i = 0; i < dt.actionCols.size(); i++ ) {
//here we could also deal with numeric type?
final ActionCol c = dt.actionCols.get( i );
fds[colCount] = new StringFieldDef( c.header );
cols[colCount] = new ColumnConfig() {
{
setHeader( c.header );
setDataIndex( c.header );
//and here we do the appropriate editor
setSortable( true );