PDA

View Full Version : [FNR] RowEditor AssertionError



eggp
6 Jan 2012, 4:18 AM
Hello...

i little speak english, so just paste stackTrace and code

error:


12:32:40.046 [ERROR] [hu.eggproject.pizzapiazza.admin.Start] Uncaught exception escaped


java.lang.AssertionError: Method must be called after the component is rendered
at com.extjs.gxt.ui.client.widget.Component.assertAfterRender(Component.java:1503)
at com.extjs.gxt.ui.client.widget.Component.el(Component.java:405)
at com.extjs.gxt.ui.client.widget.grid.RowEditor.positionButtons(RowEditor.java:837)
at com.extjs.gxt.ui.client.widget.grid.RowEditor$1.handleEvent(RowEditor.java:252)
at com.extjs.gxt.ui.client.widget.grid.RowEditor$1.handleEvent(RowEditor.java:1)
at com.extjs.gxt.ui.client.event.BaseObservable.callListener(BaseObservable.java:178)
at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:86)
at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:456)
at com.extjs.gxt.ui.client.widget.grid.GridView.syncScroll(GridView.java:1937)
at com.extjs.gxt.ui.client.widget.grid.GridView.handleComponentEvent(GridView.java:1208)
at com.extjs.gxt.ui.client.widget.grid.Grid.onComponentEvent(Grid.java:514)
at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:884)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)




code:


package hu.eggproject.pizzapiazza.admin.client.controllers.UtcaController.View;


import hu.eggproject.client.controllers.BaseRequestCallback;


public class UtcaEditWindow extends Window {
UtcaModel ujModel = null;
private Grid<UtcaModel> grid;
private ColumnModel columnModel;
private UtcaController uc;
private ListStore<UtcaModel> store;

public UtcaEditWindow(final ListStore<UtcaModel> store) {
this.store = store;
setHeading(store.getAt(0).getDistrict()+". kerület utcáinak szerkesztése");
setOnEsc(false);
setLayout(new FitLayout());
setSize(500,400);
setMaximizable(true);
this.uc = (UtcaController) AppController.getController("Utca");

List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

final CheckBoxSelectionModel<UtcaModel> sm = new CheckBoxSelectionModel<UtcaModel>();
sm.setSelectionMode(SelectionMode.SINGLE);
configs.add(sm.getColumn());

ColumnConfig zipCodeColumn = new ColumnConfig("zip_code", "IRSZ", 60);
NumberField zipCodeNumberField = new NumberField();
zipCodeNumberField.setMaxLength(4);
zipCodeNumberField.setMinLength(4);
zipCodeNumberField.getPropertyEditor().setType(Integer.class);
zipCodeNumberField.setAllowBlank(true);
zipCodeNumberField.setAllowNegative(true);
zipCodeColumn.setEditor(new CellEditor(zipCodeNumberField));
configs.add(zipCodeColumn);

ColumnConfig nevColumn = new ColumnConfig("name","Utca név",200);
TextField<String> nevTextField = new TextField<String>();
nevTextField.setAllowBlank(true);
nevColumn.setEditor(new CellEditor(nevTextField));
configs.add(nevColumn);

ColumnConfig localityColumn = new ColumnConfig("locality","Köztér",80);
localityColumn.setSortable(false);
final ComboBox<UtcaDictModel> localityCombo = new ComboBox<UtcaDictModel>();
localityCombo.setDisplayField("hungarianName");
localityCombo.setAllowBlank(true);
localityCombo.setEditable(false);
localityCombo.setTriggerAction(TriggerAction.ALL);
localityCombo.setStore(this.uc.getUtcaDictStore());
localityColumn.setEditor(new CellEditor(localityCombo)
{
@Override
public Object postProcessValue(Object value) {
if(value != null)
{
return ((ModelData)value).get("hungarianName");
}
return null;
}


@Override
public Object preProcessValue(Object value) {
return localityCombo.getStore().findModel("hungarianName", value);
}
});
configs.add(localityColumn);
// TODO figyelni arra hogyha keruletet valt akkor vegyuk ki ebbol a storebol es tegyuk be a masikba!!!
ColumnConfig districtColumn = new ColumnConfig("district","Kerület",80);
districtColumn.setSortable(false);
final ComboBox<KeruletModel> districtCombo = new ComboBox<KeruletModel>();
districtCombo.setDisplayField("id");
districtCombo.setAllowBlank(true);
districtCombo.setEditable(false);
districtCombo.setTriggerAction(TriggerAction.ALL);
districtCombo.setStore(this.uc.getKeruletek());
districtColumn.setEditor(new CellEditor(districtCombo)
{
@Override
public Object postProcessValue(Object value) {
if(value != null)
{
return ((ModelData)value).get("id");
}
return null;
}


@Override
public Object preProcessValue(Object value) {
return districtCombo.getStore().findModel("id", value);
}
});
configs.add(districtColumn);

ColumnConfig priceColumn = new ColumnConfig("price","Sz.ár",80);
NumberField priceNumberField = new NumberField();
priceNumberField.getPropertyEditor().setType(Integer.class);
priceNumberField.setValue(0);
priceNumberField.setAllowBlank(true);
priceNumberField.setAllowNegative(true);
priceColumn.setEditor(new CellEditor(priceNumberField));
configs.add(priceColumn);

final RowEditor<UtcaModel> rowEditor = new RowEditor<UtcaModel>();
rowEditor.setClicksToEdit(ClicksToEdit.TWO);
/* rowEditor.addListener(Events.BeforeEdit, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
sm.getColumn();
}
});*/
rowEditor.addListener(Events.CancelEdit, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
if(ujModel != null && ((RowEditorEvent)be).getRecord().getModel().equals(ujModel))
{
UtcaEditWindow.this.store.remove(ujModel);
ujModel = null;
}
}
});
rowEditor.addListener(Events.AfterEdit, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
// ha van uj modelben valami akkor azt kell menteni! ha nincs akkor az editaltat!
RowEditorEvent e = (RowEditorEvent) be;
final Record record = e.getRecord();
//UtcaModel model = (UtcaModel)record.getModel();
if(ujModel != null)
{
//mentunk! ez egy uj utca!!!!
// keruletre figyeljunk oda!!!!
try {
UtcaEditWindow.this.uc.saveNewUtca(record, new BaseRequestCallback()
{
@Override
public void onResponse(String response, String msg) {
if(response.equals("UPDATE") && msg.equals("OK"))
{
// UtcaModel model = (UtcaModel) record.getModel();
//record.commit(false);
Info.display("Mentés", "Utca mentése sikeres volt!");
}
else
{
Info.display("Hiba","Hiba történt az utca mentése közben!");
}
}


@Override
public void onError(AjaxRequest request, Throwable ex) {
Info.display("Hiba","Hiba történt az utca mentése közben!");
}});
} catch (AjaxRequestException e1) {
UtcaEditWindow.this.store.remove((UtcaModel) record.getModel());
//e1.printStackTrace();
Info.display("Hiba","Hiba történt az utca mentése közben!");
}
}
else
{
// keruletre figyeljunk oda!!!!
//Map<String, Object> changes = record.getChanges();
try {
UtcaEditWindow.this.uc.saveModifiedUtca(record,new BaseRequestCallback()
{
@Override
public void onResponse(String response, String msg) {
if(response.equals("UPDATE") && msg.equals("OK"))
{
Info.display("Mentés", "Utca mentése sikeres volt!");
}
else
{
Info.display("Hiba","Hiba történt az utca mentése közben!");
}
}


@Override
public void onError(AjaxRequest request,
Throwable ex) {
Info.display("Hiba","Hiba történt az utca mentése közben!");
}
});
} catch (AjaxRequestException e1) {
e1.printStackTrace();
}
}
ujModel = null;
}
});
columnModel = new ColumnModel(configs);
grid = new Grid<UtcaModel>(this.store,columnModel );
grid.setLoadMask(true);
grid.addPlugin(rowEditor);
grid.setSelectionModel(sm);
grid.addPlugin(sm);
this.add(grid);

ToolBar toolBar = new ToolBar();
Button add = new Button("Új utca hozzáadása");
add.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
ujModel = new UtcaModel();
//ujModel.setPrice(0);
rowEditor.stopEditing(false);
UtcaEditWindow.this.store.insert(ujModel, 0);
rowEditor.startEditing(UtcaEditWindow.this.store.indexOf(ujModel), true);
}
});
//Button remove = new Button("A kiválasztott utca törlése");
toolBar.add(add);
//toolBar.add(remove);
this.setTopComponent(toolBar);

show();
}


public void setStore(ListStore<UtcaModel> store)
{
this.store = store;
grid.reconfigure(this.store, columnModel);
}
}




final ListStore<UtcaModel> store => count about 400-700 row...

when i scroll the window, then a page comes after the failure ...:(((

renderering problem ?

thx

By Egg

sven
6 Jan 2012, 5:06 AM
That code looks like GXT 2 and should already be fixed in SVN. Moved to the correct forum

eggp
6 Jan 2012, 5:09 AM
I use gxt 2.2.5 and gwt 2.4

sven
6 Jan 2012, 5:12 AM
I use gxt 2.2.5 and gwt 2.4

Yes and you posted in the GXT 3 forums ;)

eggp
6 Jan 2012, 5:14 AM
thx help! :)