PDA

View Full Version : How know to finish to load ?



yh800701
6 Jul 2010, 3:19 AM
///// My Source /////
TreeLoader<ModelData> loader = new BaseTreeLoader<ModelData>( proxy );
loader .addLoadListener( new LoadListener() {
MessageBox box;
public void loaderBeforeLoad( LoadEvent le ) {
box = MessageBox.progress( "", "", "" );
}
public void loaderLoad( LoadEvent le ) {
box.close();
}
} );



Function 'loaderLoad' is that Fires after a load operation completes.
but When load had finished, this function is not invoked.

why ??

How know to finish to load ?

so result. don't close MessageBox.

i am tired...

plz... help me.

and when lealese GXT 2.2 version ???

my company buy lisense of GXT. but don't reached...

sven
6 Jul 2010, 3:24 AM
Function 'loaderLoad' is that Fires after a load operation completes.
but When load had finished, this function is not invoked.

So are you sure everything workd and there was no excpetion? Try to listen to the LoadException event

yh800701
6 Jul 2010, 3:37 AM
Sorry. no Exception.

public void loaderLoadException( LoadEvent le ) {
box.close();
}

add sources.

but this function don't invoke.

don't close MessageBox.

lucky... other loaders are well work.
ex : gridLoader

but treeLoader isn't.

hu............

sven
6 Jul 2010, 3:43 AM
Please post a fully working testcase that implements EntryPoint and demonstrates the problem you have.

sven
6 Jul 2010, 3:58 AM
Your override removes all that functionality.

In your load method you get a callback you are not using. Instad, you implement your own logic.

yh800701
6 Jul 2010, 3:59 AM
public class StoreTreeExample extends LayoutContainer {
TreeStore<BeanModel> treeStore;
TreePanel<BeanModel> treePanel;
TreeGrid<BeanModel> treeGrid;
protected void onRender( Element target, int index ) {
super.onRender( target, index );
setLayout( new FitLayout() );
final PilotServiceAsync service = (PilotServiceAsync) Registry.get( Pilot.SERVICE );
RpcProxy<List<BeanModel>> proxy = new RpcProxy<List<BeanModel>>() {
@Override
protected void load( Object loadConfig, AsyncCallback<List<BeanModel>> callback ) {
service.selectOrgInfo( new AsyncCallback<List<OrgInfo>>() {
public void onFailure( Throwable caught ) {
}
public void onSuccess( List<OrgInfo> result ) {
BeanModelFactory factory = BeanModelLookup.get().getFactory( OrgInfo.class );
for (OrgInfo info : result) {
String parentCode = info.getUp_org_cd();
BeanModel parent = treeStore.findModel( "org_cd", parentCode );
BeanModel item = factory.createModel( info );
if ( parent == null ) {
treeStore.add( item, false );
}
else {
treeStore.add( parent, item, false );
}
}
for (BeanModel model : treeStore.getModels()) {
OrgInfo info = model.getBean();
if ( info.getLast_org_yn().equals( "N" ) ) {
int childCount = treeStore.getChildCount( model );
info.setOrg_nm( info.getOrg_nm() + "[" + childCount + "]" );
BeanModel item = factory.createModel( info );
treeStore.update( item );
}
}
}
} );
}
};
TreeLoader<BeanModel> loader = new BaseTreeLoader<BeanModel>( proxy );
loader.addLoadListener( new LoadListener() {
MessageBox box;
public void loaderBeforeLoad( LoadEvent le ) {
box = MessageBox.progress( "aa", "aa", "aa" );
}
public void loaderLoad( LoadEvent le ) {
box.close();
}
public void loaderLoadException( LoadEvent le ) {
box.close();
}
} );
treeStore = new TreeStore<BeanModel>();
loader.load();
treePanel = new TreePanel<BeanModel>( treeStore );
treePanel.setDisplayProperty( "org_nm" );
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig columnConfg = new ColumnConfig( "org_nm", "org_nm", 200 );
columnConfg.setRenderer( new TreeGridCellRenderer<BeanModel>() );
columns.add( columnConfg );
ColumnModel cm = new ColumnModel( columns );
treeGrid = new TreeGrid<BeanModel>( treeStore, cm );
treeGrid.setStripeRows( true );
add( treeGrid );
}
}

yh800701
6 Jul 2010, 4:04 AM
hm...
thanks for your anwer.

but i don't know.

^^.. I am trying more.
more testing...

thanks.