NatTable : Table level validations [message #1278693] |
Thu, 27 March 2014 14:16  |
Eclipse User |
|
|
|
I need to implement some table level validations for a NatTable grid. I am able to validate individual cells using "org.eclipse.nebula.widgets.nattable.data.validate.DataValidator" and I could do it only for text boxes using TextCellEditor (I could also highlight the cells by setting errorDecorationText for the text boxes which have validation errors).
Similarly, I need to validate certain combo boxes (drop down boxes) in a NatTable grid but not at a Cell level but at a table level. (like upon a button click, where there exists a button underneath a NatTable grid), Also, I need to highlight the combo box cells which have validation errors. Can somebody post any suggestions ?
Please let me know if you need more information.
Thanks,
Pavan Kalyan.
|
|
|
Re: NatTable : Table level validations [message #1278808 is a reply to message #1278693] |
Thu, 27 March 2014 18:01   |
Eclipse User |
|
|
|
Hi Pavan,
You need to attach a label to the cells that have validation errors, and then register a Style (perhaps with a background color or red/pink) under that same label.
Here's how you register the style:
public static final String CELL_ERROR = "invalid";
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
style,
DisplayMode.NORMAL,
CELL_ERROR);
You might also want to have a label accumulator, which will add the CELL_ERROR label to the cells that have an error.
Here's how you might do that:
natTableBodyDataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {
@Override
public void accumulateConfigLabels(LabelStack configLabels,
int columnPosition, int rowPosition) {
if (errorExistsOnCell (columnPosition, rowPosition)) {
configLabels.addLabelOnTop(CELL_ERROR);
}
}
}
});
Cheers!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04211 seconds