import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
+
import com.gwtext.client.core.EventObject;
+
import com.gwtext.client.util.Format;
import com.gwtext.client.widgets.BoxComponent;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Component;
-import com.gwtext.client.widgets.HTMLPanel;
+
import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.Window;
+
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
import com.gwtext.client.widgets.layout.RowLayout;
import com.pentila.evalcomp.domain.transit.Activity;
import com.pentila.evalcomp.domain.transit.TCompositeDataMap;
import com.pentila.evalcomp.domain.transit.Todo;
+import com.smartgwt.client.core.Function;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
/**
* The Class EvaluationService.
* @param activity
* the activity
*/
- @SuppressWarnings("unchecked")
+
public void configureService(final Todo todo, Activity activity) {
});
evalGrid = new SmartEvalGrid(todo, readOnly, null, null, "candName", false);
-
+
evalGrid.update(todo, 0, ServiceAbstract.pageSize);
west.add(new ExtRessourcesPanel(todo, activity), new RowLayoutData("50%"));
west.add(new PropertyValuePanel(todo, activity), new RowLayoutData("50%"));
- tpanel = new TransitionPanel(todo, activity, this, false);
- south.add(tpanel);
-
+
finalizeLayout();
}
*/
private void terminateEvaluation(final String login, final String processID,
final String activityID, final String transID){
- AsyncCallback callback = new AsyncCallback() {
-
- public void onFailure(Throwable caught) {
- System.out.println("Probleme dans le set des CI"); //$NON-NLS-1$
- Tools.hideLoadingRegion(getId());
- }
+
+ Function callback = new Function(){
- public void onSuccess(Object result) {
- Tools.hideLoadingRegion(getId());
- ToastWindow tw = new ToastWindow(Messages
- .getString("notification"), Messages
- .getString("save_done"));
- tw.show();
+ @Override
+ public void execute() {
if (login != null){
tpanel.performActivity(login, processID, activityID, transID);
}
+
}
+
};
-
- TCompositeDataMap T = evalGrid.getCompetenceInstances();
-
-
- Tools.showLoadingRegion(getId(), Messages.getString("MAJ"), Messages
- .getString("Chargement"));
- ConnexionServer.instanceService.setCompetenceInstances(T, callback);
+
+ this.saveCompetenceInstances(callback);
+
}
/**
* @param transID the trans id
*/
public void confirmEvaluation(final String login, final String processID, final String activityID, final String transID){
-
+
if (evalGrid.hasRecords()){
+
+ final Function callbackFunction = new Function(){
+
+ @Override
+ public void execute() {
+ AsyncCallback callback = new AsyncCallback(){
+
+ public void onFailure(Throwable caught) {
+
+
+ }
+
+ public void onSuccess(Object result) {
+
+ String unSettedCI = (String)result;
+
+ if (login != null && (unSettedCI != null && !unSettedCI.equals(""))){
+
+ if (transID == null){
+
+ SC.confirm(Format.format(Messages.getString("evaluer_setting_missing"), new String[]{unSettedCI}), new BooleanCallback() {
+ public void execute(Boolean value) {
+ if (value != null && value) {
+
+ //terminateEvaluation(login, processID, activityID, transID);
+ if (login != null){
+ tpanel.performActivity(login, processID, activityID, transID);
+ }
+ } else {
+ tpanel.showButtons();
+
+ }
+ }
+ });
+ }else if (transID.equals("TRANSITION_terminer")){
+ tpanel.showButtons();
+ SC.say(Format.format(Messages.getString("evaluer_dossier_setting_missing") , new String[]{unSettedCI}));
+
+ }else{
+ tpanel.performActivity(login, processID, activityID, transID);
+ }
+
+
+ }else{
+ if (login != null){
+ tpanel.performActivity(login, processID, activityID, transID);
+ }
+ }
- AsyncCallback callback = new AsyncCallback(){
-
- public void onFailure(Throwable caught) {
+ }
+ };
+ Long idESI = ((ScenarioInstance)todo.getScenarioInstance()).getEvaluationSubjectInstance().getId();
+ ConnexionServer.instanceService.checkEvaluationInitLevel(idESI, callback);
+
}
+
+ };
+
+ Function callbackF = new Function(){
- public void onSuccess(Object result) {
-
- String unSettedCI = (String)result;
-
- if (login != null && (unSettedCI != null && !unSettedCI.equals(""))){
- final Window confirmWindow = new Window();
- confirmWindow.setTitle(Messages.getString("Confirmation"));
- confirmWindow.setClosable(false);
- confirmWindow.setWidth(500);
-
- confirmWindow.setPlain(true);
-
- VerticalPanel vpMain = new VerticalPanel();
-
- HTMLPanel message = new HTMLPanel(
- Format.format(Messages.getString("evaluer_setting_missing"), new String[]{unSettedCI}));
- message.setPaddings(15);
- vpMain.add(message);
- final Button okButton = new Button(Messages.getString("Oui"));
- okButton.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
-
- confirmWindow.destroy();
- terminateEvaluation(login, processID, activityID, transID);
- }
- });
-
- Button cancelButton = new Button(Messages.getString("Non"));
- cancelButton.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(Button button, EventObject e) {
- tpanel.showButtons();
- confirmWindow.destroy();
- }
- });
-
- confirmWindow.addButton(okButton);
- confirmWindow.addButton(cancelButton);
- confirmWindow.add(vpMain);
- confirmWindow.show();
- }else{
- terminateEvaluation(login, processID, activityID, transID);
- }
-
+ @Override
+ public void execute() {
+ saveCompetenceInstances(callbackFunction);
+
}
-
+
};
- Long idESI = ((ScenarioInstance)todo.getScenarioInstance()).getEvaluationSubjectInstance().getId();
-
- ConnexionServer.instanceService.checkEvaluationInitLevel(idESI, callback);
-
-
+
+ if (evalGrid.hasPendingRecords()){
+ evalGrid.saveValues(callbackF);
+ }else{
+ callbackFunction.execute();
+ }
+
+
+
}
}
}
+ public void saveCompetenceInstances(final Function callbackFunction){
+ AsyncCallback callback = new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ System.out.println("Probleme dans le set des CI");
+ Tools.hideLoadingRegion(getId());
+ }
+
+ public void onSuccess(Object result) {
+ Tools.hideLoadingRegion(getId());
+ ToastWindow tw = new ToastWindow(Messages
+ .getString("notification"), Messages
+ .getString("save_done"));
+ tw.show();
+ callbackFunction.execute();
+ }
+ };
+
+ TCompositeDataMap T = evalGrid.getCompetenceInstances();
+
+
+ Tools.showLoadingRegion(getId(), Messages.getString("MAJ"), Messages
+ .getString("Chargement"));
+ ConnexionServer.instanceService.setCompetenceInstances(T, callback);
+ }
+
+
}