예제 #1
0
  public void onRoutineSessionAdded(String sessionName, int index) {

    int orderIndex;
    String requestID;

    if (index == -1) {
      orderIndex = routineSessionData.getDataCount();
    } else {
      orderIndex = index;
    }

    RoutineSession routineSession = new RoutineSession();
    routineSession.setUserRoutineID(currentRoutineID);
    routineSession.setRoutineSessionName(sessionName);
    routineSession.setOrderIndex(orderIndex);

    if (index == -1) {
      requestID = routineSessionData.dataAddTemporary(routineSession);
    } else {
      requestID = routineSessionData.dataAddTemporary(routineSession, index);
    }

    routineService
        .getService()
        .addRoutineSession(
            User.instance().getToken(),
            requestID,
            routineSession,
            new CallbackScreener(callbackAddRoutineSession()));
  }
예제 #2
0
  public void onRoutineSessionSelected(int index) {

    routineService
        .getService()
        .getSessionExercises(
            User.instance().getToken(),
            ((RoutineSession) routineSessionData.getDataObject(index)).getRoutineSessionID(),
            new CallbackScreener(callbackGetSessionExercises()));
  }
예제 #3
0
 public void onRoutineSessionDeleted(int index) {
   routineService
       .getService()
       .deleteRoutineSession(
           User.instance().getToken(),
           routineSessionData.dataRemoveTemporary(index),
           ((RoutineSession) routineSessionData.getDataObject(index)).getRoutineSessionID(),
           new CallbackScreener(callbackDeleteRoutineSession()));
 }
예제 #4
0
  public void onSessionExerciseDeleted(SessionExercise sessionExercise) {

    String requestID = sessionExerciseData.dataRemoveTemporary(sessionExercise.getOrderIndex());

    routineService
        .getService()
        .deleteSessionExercise(
            User.instance().getToken(),
            requestID,
            sessionExercise.getSessionExerciseID(),
            new CallbackScreener(callbackDeleteSessionExercise()));
  }
예제 #5
0
  public void onSessionExerciseAdded(SessionExercise sessionExercise) {

    String requestID = sessionExerciseData.dataAddTemporary(sessionExercise);

    routineService
        .getService()
        .addSessionExercise(
            User.instance().getToken(),
            requestID,
            sessionExercise,
            new CallbackScreener(callbackAddSessionExercise()));
  }
예제 #6
0
  public void onSessionExerciseChanged(SessionExercise sessionExercise) {

    String requestID =
        sessionExerciseData.dataReplaceTemporary(sessionExercise, sessionExercise.getOrderIndex());

    routineService
        .getService()
        .changeSessionExercise(
            User.instance().getToken(),
            requestID,
            sessionExercise,
            new CallbackScreener(callbackChangeSessionExercise()));
  }
예제 #7
0
  public void onKeyPress(Widget sender, char keyCode, int modifiers) {
    if (sender == txtNewRoutine && keyCode == KEY_ENTER && txtNewRoutine.getText().length() > 0) {

      UserRoutine userRoutine = new UserRoutine();
      userRoutine.setRoutineName(txtNewRoutine.getText());

      String requestID = userRoutineData.dataAddTemporary(userRoutine);
      routineService
          .getService()
          .addUserRoutine(
              User.instance().getToken(),
              requestID,
              userRoutine,
              new CallbackScreener(callbackAddUserRoutine()));
      txtNewRoutine.setText("");
    }
  }
예제 #8
0
  public void onModuleLoad() {

    /*
     * Layout Stuff
     */

    routineSessionEditor.setVisible(false);
    RootPanel.get("fr-widgetLstRoutineSelector").add(lstRoutineSelector);
    RootPanel.get("fr-widgetTxtNewRoutine").add(txtNewRoutine);
    RootPanel.get("fr-widgetRoutineEditor").add(routineSessionEditor);
    /*
     * Register Listeners
     */

    lstRoutineSelector.addChangeListener(this);
    txtNewRoutine.addKeyboardListener(this);
    routineSessionEditor.addRoutineEditorListener(this);
    routineSessionEditor.getSessionExerciseEditor().addRoutineSessionEditorListener(this);

    routineSessionData.addDataListener(routineSessionEditor);

    sessionExerciseData.addDataListener(routineSessionEditor.getSessionExerciseEditor());

    /*
     * RPC's
     */

    exerciseService.getService().getUOMS(new CallbackScreener(callbackGetExerciseUOMS()));

    exerciseService
        .getService()
        .getUserExercises(
            User.instance().getToken(), new CallbackScreener(callbackGetUserExercises()));

    routineService
        .getService()
        .getUserRoutines(
            User.instance().getToken(), new CallbackScreener(callbackGetUserRoutines()));
  }
예제 #9
0
  public void onChange(Widget sender) {
    if (sender == lstRoutineSelector) {
      if (lstRoutineSelector.getSelectedIndex() > 0) {
        long routineID =
            ((UserRoutine) userRoutineData.getDataObject(lstRoutineSelector.getSelectedIndex() - 1))
                .getUserRoutineID();

        if (routineID != currentRoutineID) {
          currentRoutineID = routineID;
          routineService
              .getService()
              .getRoutineSessions(
                  User.instance().getToken(),
                  routineID,
                  new CallbackScreener(callbackGetRoutineSessions()));
          if (!routineSessionEditor.isVisible()) {
            routineSessionEditor.setVisible(true);
          }
        }
      }
    }
  }