PDA

View Full Version : Getting the involved model in a EditorEvent



jeroni
3 Mar 2013, 3:46 AM
I'm trying to get the involved model when a Complete event fires and a EditorEvent is passed in a grid from a CellEditor.




TaxCombo taxCombo = new TaxCombo() {
@Override
public String getFormat(Tax tax) {
return tax.getName();
}
};
taxCombo.setAllowBlank(false);
taxCombo.hideAddButton();
CellEditor taxComboCellEditor = new CellEditor(taxCombo);
taxComboCellEditor.addListener(Events.Complete, new Listener<EditorEvent>() {
@Override
public void handleEvent(EditorEvent be) {
/***************************************
HERE IS WHERE I NEED THE INVOLVED MODEL
**********************************************/

}
});
column = new ColumnConfig(getTaxIdentifier(), M.i.tax(), 70);
column.setEditor(taxComboCellEditor);
column.setRenderer(new GridCellRenderer<CHILD>() {
public Object render(CHILD model, String property,
ColumnData config, int rowIndex, int colIndex,
ListStore<CHILD> store, Grid<CHILD> grid) {
InvoiceTypeRow row = (InvoiceTypeRow) model;
String taxName = "";
if(null != row.getTax()) {
taxName = row.getTax().getName();
}
return taxName;
}
});



Thanks in advance

jeroni
4 Mar 2013, 12:03 AM
Ok, I had to set a listener to the grid on ValidateEdit and compare the property with the desired ID of the column.