// upload stuff // This is what happens when the file finish uploading public void onSubmitComplete(FormSubmitCompleteEvent event) { /* * event.getResults is a String with a special format before the dot is * the result of the uploadWidget, where 0 == ok and 1 == error. After * the dot is the id of the file or the explanation of the error */ Integer result = null; // Window.alert((String) event.getResults()); try { // Window.alert((String) event.getResults().subSequence(0, 1)); result = new Integer((String) event.getResults().subSequence(0, 1)); } catch (Exception e) { // Window.alert("exepcion parseando resultado del servidor"); } // Window.alert((String) event.getResults().substring(2)); String tempFileId = (String) event.getResults().substring(2); if (result.equals(new Integer(ClientProperties.OK))) { // OK rpc.executeImport( usernameImportOwner, tempFileId, new AsyncCallback() { public void onFailure(Throwable caught) { Window.alert("Error invocando la ejeción del archivo de importacion"); System.out.println("cromo la invocacion de ejecucion del archivo de importacion"); } public void onSuccess(Object result) { asynRefreshTableData(); } }); usernameImportOwner = null; } else { // TODO a better message Window.alert("Error accediendo a base de datos"); System.out.println("cromo el Submit del archivo"); } }
/** Makes the call for the info needed to apply the refreshTableData */ private void asynRefreshTableData() { if (LoginManager.isUserLogged()) { rpc.getResultTableData( LoginManager.getUserName(), new AsyncCallback() { public void onFailure(Throwable caught) { // TODO a better message Window.alert("Error accediendo a base de datos"); System.out.println("cromo el rpc.getResultTableData"); } @SuppressWarnings("unchecked") public void onSuccess(Object result) { // TODO Auto-generated method stub refreshTableData((List<ImportInfo>) result); } }); } else { Window.alert("Debe iniciar sesion en el sistema."); } }