Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NaTable Validation(How to make NatTabel row non editable based on particular value entered in a column)
NaTable Validation [message #1456687] Thu, 30 October 2014 16:17 Go to next message
Amruta Sardeshmukh is currently offline Amruta SardeshmukhFriend
Messages: 25
Registered: September 2014
Junior Member
Based on particaluar value entered in column ,the NatTabel row needs to made non editable or editable.
How can this validation check implemented in effectively NatTable
Re: NaTable Validation [message #1456829 is a reply to message #1456687] Thu, 30 October 2014 19:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Implement and register a custom IEditableRule
https://www.eclipse.org/nattable/documentation.php?page=editing
Re: NaTable Validation [message #1457483 is a reply to message #1456829] Fri, 31 October 2014 11:20 Go to previous messageGo to next message
Amruta Sardeshmukh is currently offline Amruta SardeshmukhFriend
Messages: 25
Registered: September 2014
Junior Member
Thanks for the inputs it helped me.
Further I need to apply certain cell style on the non editable cell.
Is this only achieved through accumulateConfigLabels or any other way.
Re: NaTable Validation [message #1457553 is a reply to message #1457483] Fri, 31 October 2014 12:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
No, that is the way.
Re: NaTable Validation [message #1460191 is a reply to message #1457553] Mon, 03 November 2014 09:41 Go to previous messageGo to next message
Amruta Sardeshmukh is currently offline Amruta SardeshmukhFriend
Messages: 25
Registered: September 2014
Junior Member
My NatTable has alomost 25+ columns and based on combinations of diffrent values in certain columns I need to enable or disable column editing for particular row . On disabling the column edit I require to apply diffrent style to those cells.

Currently I following this apporach:
In the GridLayer class ,I have implemented all my condition checks in the getConfigLabels method and based on the checks applies "addLabelOnTop"

bodyDataLayer = new DataLayer(bodyDataProvider) {
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition,
int rowPosition) {

configLabel .addLabelOnTop(CoverSheetNatTable.NONEDITABLE_LABEL);

}
}

Is this apporach o.k. or I needs to Override accmulateConfigLabel() method.
Please recommend what is correct approach and if accumulateConfigLabels() has to be implemented then what is the correct location to overide this class.

Re: NaTable Validation [message #1460192 is a reply to message #1460191] Mon, 03 November 2014 09:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
No, don't override any methods of layers. You should implement a label overrider/accumulator and register it to the DataLayer

https://www.eclipse.org/nattable/documentation.php?page=styling
Re: NaTable Validation [message #1514247 is a reply to message #1460192] Wed, 17 December 2014 06:19 Go to previous messageGo to next message
Amruta Sardeshmukh is currently offline Amruta SardeshmukhFriend
Messages: 25
Registered: September 2014
Junior Member
I have added some ComboBox configurations to my NatTabel as follows :

ComboBoxPainter comboBoxPainter = new ComboBoxPainter();
comboBoxCellEditor = new ComboBoxEditor(objType, propName);

if (comboBoxLabelName != null) {

configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
DisplayMode.EDIT, comboBoxLabelName);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER, comboBoxPainter,
DisplayMode.NORMAL, comboBoxLabelName);

}

I also need to add some custom labels to the tabel,and I have implemented it through accmulateConfigLabel:

colLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer){

@Override
public void accumulateConfigLabels(LabelStack configLabels,
int columnPosition, int rowPosition) {

CoverSheetRowData rowObject = (CoverSheetRowData) ((GlazedListsDataProvider) gridLayer.getBodyDataProvider)).getRowObject(rowPosition);


if ((columnPropertyAccessor.getColumnIndex(PartViewUICommon.isNoticeReqIdCol) == columnPosition)) configLabels.addLabel(CoverSheetNatTable.EDITABLE_LABEL);}
else {configLabels .addLabel(CoverSheetNatTable.NONEDITABLE_LABEL);
}
}
}

};

All the columns of NatTabel are registered through:
colLabelAccumulator.registerColumnOverrides(colIndx, colNameLabel);
bodyDataLayer.setConfigLabelAccumulator(colLabelAccumulator);


This overwrites the ComboBox editors on my NatTabel.I need to have both the ComboBox and the custom label.

What is the correct way to apply both on the NatTabel.
Re: NaTable Validation [message #1514333 is a reply to message #1514247] Wed, 17 December 2014 07:56 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
If you want to apply two labels using different label accumulator, you should use the AggregrateConfigLabelAccumulator which is intended to combine several IConfigLabelAccumulator
Re: NaTable Validation [message #1514844 is a reply to message #1514333] Wed, 17 December 2014 16:58 Go to previous messageGo to next message
Amruta Sardeshmukh is currently offline Amruta SardeshmukhFriend
Messages: 25
Registered: September 2014
Junior Member
Could you please point me to some examples for the same.
Re: NaTable Validation [message #1515022 is a reply to message #1514844] Wed, 17 December 2014 20:15 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
No. But you simply need to create an instance of AggregrateConfigLabelAccumulator and add your other IConfigLabelAccumulators to it. Then register the AggregrateConfigLabelAccumulator instance as label accumulator.
Previous Topic:Create a huge columns for nattable, still working paint function.
Next Topic:NatTabel comboBox dynamically changing values
Goto Forum:
  


Current Time: Tue Apr 16 04:40:56 GMT 2024

Powered by FUDForum. Page generated in 0.39427 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top