giovanni.puliti
5 Jan 2010, 6:21 AM
hi guys
I'm developing a little GXT demo where i've to show some data fetched from a EJB layer (wrapped with a Business Delegate that run behind a GWT-RPC mechanism).
The application is based on a MVC schema; the main parts are:
- TimeTablePanel, is a panel (i.e. is the GUI where the grid is placed).
- OperationController a controller (intercepting event from the GUI and runnning RPC invocation for the reload of data)
- TutorView, a View that run backside the GUI's Panel.
The organization of the application is very similar to the mail app from GXT example.
This is the flow of the application:
1. first round the grid in TimeTablePanel show "all" the data fetched from the EJB layer via an RPC GXT call. That is ok, i can see all the rows in the grid.
2. the user, using two combo on the TimetablePanel define some parameter to fecth just some data to show in the grid
3. changing the value on the combos fire an event (ie an event named loadLeaves)
4. the controller OperationController intercept this event, and do some data reloading via RPC; the new list of data is placed on a new store
5. the controller embedd the new store in the event and forwrd this event to the view TutorView
6. the TutorView take the store from the event, and bind the store to the grid in the panel TimeTablePanel
i'v no excpetions, no error, no strange message, but at the end of that flow nothing appear in the grid. At step 1 the grid was populated, at 6 was blank
Look: the step 2 is not a refinement of data loaded from 1, it's another loading from EJB, so i cannot use the grid filters. Actually a the first step the grid could be blank, the business rule is the user insert data via the two combos.
i place some line of code to exaplain better:
//////////////////////////////////////////////////////////
STEP 1: in the TimeTablePanel:
//////////////////////////////////////////////////////////
final RemoteProviderAsync remoteProvider = (RemoteProviderAsync) Registry.get("remoteProvider");
RpcProxy proxy = new RpcProxy(){
@Override
public void load(Object loadConfig, AsyncCallback callback) {
remoteProvider.getPresenzeOre(callback);
}
};
BeanModelReader reader = new BeanModelReader();
ListLoader loader = new BaseListLoader(proxy, reader);
store = new ListStore (loader);
loader.addLoadListener(new LoadListener(){
@Override
public void loaderLoadException(LoadEvent le) {
System.out.println("loading error "+le.exception);
}
public void loaderLoad(LoadEvent le) {
System.out.println("Store Loaded: " + store.getCount());
}
});
loader.load();
...
...
grid = new EditorGrid<ModelData>(store, cm);
grid.setBorders(true);
grid.setStripeRows(true);
grid.getView().refresh(true);
//////////////////////////////////////////////////////////
STEP 2-3: in the TimeTablePanel: fire the event at the combo change value
//////////////////////////////////////////////////////////
typesCombo.addSelectionChangedListener(new SelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent se) {
SimpleComboValue value = (SimpleComboValue)se.getSelection().get(0);
String courseType = value.getValue().toString();
Registry.register("timetable.courseType", courseType);
populateDetailCombo(detailCombo, courseType);
AppEvent evt = new AppEvent(AppEvents.loadLeaves);
Dispatcher.forwardEvent(evt);
}
});
//////////////////////////////////////////////////////////
STEP 4-5: in the controller intercepting the event and reload some data
//////////////////////////////////////////////////////////
public void handleEvent(AppEvent event) {
EventType type = event.getType();
if (type == AppEvents.loadLeaves) {
// this method make the RPC call
ListStore store = loadOrePresenze();
AppEvent ae = new AppEvent(AppEvents.viewTimeTable);
event.setData("store", store);
forwardToView(tutorView, event);
}
else if (type == AppEvents.Error) {
onError(event);
}
}
/////////////////////////////////////////////////////////////////////////
STEP 6: in the view getting the store from the event ad bind the new store to the grid
/////////////////////////////////////////////////////////////////////////
protected void handleEvent(AppEvent event) {
...
...
if (event.getType() == AppEvents.loadLeaves) {
System.out.println("gestione dell'evento loadLeaves");
ListStore store = event.getData("store");
if (store != null){
this.timeTablePanel.getStore().removeAll();
this.timeTablePanel.setStore(store);
this.timeTablePanel.getGrid().getView().refresh(true);
this.timeTablePanel.layout();
}
else{
System.out.println("store was null");
}
return;
}
}
The removeAll at step 6 run ok, but anythig else appear inside the grid......
Any idea?
giovanni
I'm developing a little GXT demo where i've to show some data fetched from a EJB layer (wrapped with a Business Delegate that run behind a GWT-RPC mechanism).
The application is based on a MVC schema; the main parts are:
- TimeTablePanel, is a panel (i.e. is the GUI where the grid is placed).
- OperationController a controller (intercepting event from the GUI and runnning RPC invocation for the reload of data)
- TutorView, a View that run backside the GUI's Panel.
The organization of the application is very similar to the mail app from GXT example.
This is the flow of the application:
1. first round the grid in TimeTablePanel show "all" the data fetched from the EJB layer via an RPC GXT call. That is ok, i can see all the rows in the grid.
2. the user, using two combo on the TimetablePanel define some parameter to fecth just some data to show in the grid
3. changing the value on the combos fire an event (ie an event named loadLeaves)
4. the controller OperationController intercept this event, and do some data reloading via RPC; the new list of data is placed on a new store
5. the controller embedd the new store in the event and forwrd this event to the view TutorView
6. the TutorView take the store from the event, and bind the store to the grid in the panel TimeTablePanel
i'v no excpetions, no error, no strange message, but at the end of that flow nothing appear in the grid. At step 1 the grid was populated, at 6 was blank
Look: the step 2 is not a refinement of data loaded from 1, it's another loading from EJB, so i cannot use the grid filters. Actually a the first step the grid could be blank, the business rule is the user insert data via the two combos.
i place some line of code to exaplain better:
//////////////////////////////////////////////////////////
STEP 1: in the TimeTablePanel:
//////////////////////////////////////////////////////////
final RemoteProviderAsync remoteProvider = (RemoteProviderAsync) Registry.get("remoteProvider");
RpcProxy proxy = new RpcProxy(){
@Override
public void load(Object loadConfig, AsyncCallback callback) {
remoteProvider.getPresenzeOre(callback);
}
};
BeanModelReader reader = new BeanModelReader();
ListLoader loader = new BaseListLoader(proxy, reader);
store = new ListStore (loader);
loader.addLoadListener(new LoadListener(){
@Override
public void loaderLoadException(LoadEvent le) {
System.out.println("loading error "+le.exception);
}
public void loaderLoad(LoadEvent le) {
System.out.println("Store Loaded: " + store.getCount());
}
});
loader.load();
...
...
grid = new EditorGrid<ModelData>(store, cm);
grid.setBorders(true);
grid.setStripeRows(true);
grid.getView().refresh(true);
//////////////////////////////////////////////////////////
STEP 2-3: in the TimeTablePanel: fire the event at the combo change value
//////////////////////////////////////////////////////////
typesCombo.addSelectionChangedListener(new SelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent se) {
SimpleComboValue value = (SimpleComboValue)se.getSelection().get(0);
String courseType = value.getValue().toString();
Registry.register("timetable.courseType", courseType);
populateDetailCombo(detailCombo, courseType);
AppEvent evt = new AppEvent(AppEvents.loadLeaves);
Dispatcher.forwardEvent(evt);
}
});
//////////////////////////////////////////////////////////
STEP 4-5: in the controller intercepting the event and reload some data
//////////////////////////////////////////////////////////
public void handleEvent(AppEvent event) {
EventType type = event.getType();
if (type == AppEvents.loadLeaves) {
// this method make the RPC call
ListStore store = loadOrePresenze();
AppEvent ae = new AppEvent(AppEvents.viewTimeTable);
event.setData("store", store);
forwardToView(tutorView, event);
}
else if (type == AppEvents.Error) {
onError(event);
}
}
/////////////////////////////////////////////////////////////////////////
STEP 6: in the view getting the store from the event ad bind the new store to the grid
/////////////////////////////////////////////////////////////////////////
protected void handleEvent(AppEvent event) {
...
...
if (event.getType() == AppEvents.loadLeaves) {
System.out.println("gestione dell'evento loadLeaves");
ListStore store = event.getData("store");
if (store != null){
this.timeTablePanel.getStore().removeAll();
this.timeTablePanel.setStore(store);
this.timeTablePanel.getGrid().getView().refresh(true);
this.timeTablePanel.layout();
}
else{
System.out.println("store was null");
}
return;
}
}
The removeAll at step 6 run ok, but anythig else appear inside the grid......
Any idea?
giovanni