fds[1] = new StringFieldDef("desc"); //NON-NLS
int colCount = 0;
BaseColumnConfig[] cols = new BaseColumnConfig[fds.length + 1]; //its +1 as we have the separator -> thing.
cols[0] = new ColumnConfig() {
{
setDataIndex("num"); //NON-NLS
setWidth(20);
setSortable(true);
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'>" + value + "</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);
}
}
};
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);
}
}
};
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);
}
}
};
colMap.put(c.header, c);
colCount++;
}
//the split thing
cols[colCount] = new ColumnConfig() {
{
setDataIndex("x");
setHeader("");
//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-1] = new StringFieldDef(c.header);
cols[colCount] = new ColumnConfig() {
{
setHeader(c.header);
setDataIndex(c.header);
//and here we do the appropriate editor
setSortable(true);