Advertisement
Guest User

java2

a guest
Aug 28th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.16 KB | None | 0 0
  1. /*
  2.              * grid
  3.              */
  4.            
  5.     DataProxy<PagingLoadConfig, PagingLoadResult<List<RegionUsersData>>> dataProxy = new DataProxy<PagingLoadConfig, PagingLoadResult<List<RegionUsersData>>>() {
  6.  
  7.                 @Override
  8.                 public void load(PagingLoadConfig loadConfig, Callback<PagingLoadResult<List<RegionUsersData>>, Throwable> callback) {
  9.  
  10.                         GCS.getService().getRegionUsers(1, 1,
  11.                                 new AsyncCallback<List<RegionUsersData>>() {
  12.  
  13.                                     @Override
  14.                                     public void onSuccess(List<RegionUsersData> result) {
  15.                                         regionStore.replaceAll(result);
  16.                                         regionUsersGrid.getView().refresh(true);
  17.                                         GCS.unMask();
  18.                                     }
  19.  
  20.                                     @Override
  21.                                     public void onFailure(Throwable caught) {
  22.  
  23.                                         String error = caught.getMessage();
  24.                                         // TODO Auto-generated method stub
  25.                                         MessageBox box = new MessageBox(getLabel(GcsUserMsgsConstants.ERROR, false));
  26.                                         box.setMessage(getLabel(error, false));
  27.                                         box.show();
  28.                                         GCS.unMask();
  29.                                     }
  30.                                 });
  31.                    
  32.                 }
  33.             };
  34.            
  35.             regionUsersLoader = new PagingLoader<PagingLoadConfig, PagingLoadResult<List<RegionUsersData>>>(dataProxy);
  36.             regionUsersLoader.load();
  37.             regionStore.setEnableFilters(true);
  38.  
  39.             ColumnConfig<RegionUsersData, String> colId = new ColumnConfig<RegionUsersData, String>(props.getTxtUserId(), 80, getLabel(AdminUIConstants.getId(), false));
  40.             ColumnConfig<RegionUsersData, String> colName = new ColumnConfig<RegionUsersData, String>(props.txtName(), 100, getLabel(AdminUIConstants.getName(), false));
  41.             ColumnConfig<RegionUsersData, String> colSurname = new ColumnConfig<RegionUsersData, String>(props.txtSurname(), 120, getLabel(AdminUIConstants.getSurname(), false));
  42.             ColumnConfig<RegionUsersData, String> colEmail = new ColumnConfig<RegionUsersData, String>(props.txtEmailId(), 130, getLabel(AdminUIConstants.geteMail(), false));
  43.             ColumnConfig<RegionUsersData, String> colCompany = new ColumnConfig<RegionUsersData, String>(props.company(), 190, getLabel(AdminUIConstants.getCompany(), false));
  44.             ColumnConfig<RegionUsersData, String> colStatus = new ColumnConfig<RegionUsersData, String>(props.status(), 280, getLabel(AdminUIConstants.getStatus(), false));
  45.  
  46.             List<ColumnConfig<RegionUsersData, ?>> listColumnConfig = new ArrayList<ColumnConfig<RegionUsersData, ?>>();
  47.            
  48.            
  49.             listColumnConfig.add(colId);
  50.             listColumnConfig.add(colName);
  51.             listColumnConfig.add(colSurname);
  52.             listColumnConfig.add(colEmail);
  53.             listColumnConfig.add(colCompany);
  54.             listColumnConfig.add(colStatus);
  55.            
  56.             ColumnModel<RegionUsersData> cm = new ColumnModel<RegionUsersData>(listColumnConfig);
  57.             regionStore = new ListStore<RegionUsersData>(props.key());
  58.            
  59.             regionUsersGrid = new Grid<RegionUsersData>(regionStore, cm);
  60.             regionUsersGrid.setLoader(regionUsersLoader);//nuovo
  61.             regionUsersGrid.setBorders(true);
  62.             regionUsersGrid.getView().setStripeRows(true);
  63.             regionUsersGrid.getView().setColumnLines(true);
  64.             regionUsersGrid.getView().setAutoFill(false);
  65.             regionUsersGrid.getView().setForceFit(true);
  66.            
  67.             VerticalPanel gridContainer = new VerticalPanel();
  68.             gridContainer.add(regionUsersGrid);
  69.             tabCarloPanel.add(gridContainer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement