コード例 #1
0
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  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
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
 public void onRoutineSessionDeleted(int index) {
   routineService
       .getService()
       .deleteRoutineSession(
           User.instance().getToken(),
           routineSessionData.dataRemoveTemporary(index),
           ((RoutineSession) routineSessionData.getDataObject(index)).getRoutineSessionID(),
           new CallbackScreener(callbackDeleteRoutineSession()));
 }
コード例 #3
0
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  public void onRoutineSessionSelected(int index) {

    routineService
        .getService()
        .getSessionExercises(
            User.instance().getToken(),
            ((RoutineSession) routineSessionData.getDataObject(index)).getRoutineSessionID(),
            new CallbackScreener(callbackGetSessionExercises()));
  }
コード例 #4
0
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  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
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  public void onSessionExerciseAdded(SessionExercise sessionExercise) {

    String requestID = sessionExerciseData.dataAddTemporary(sessionExercise);

    routineService
        .getService()
        .addSessionExercise(
            User.instance().getToken(),
            requestID,
            sessionExercise,
            new CallbackScreener(callbackAddSessionExercise()));
  }
コード例 #6
0
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  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
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  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()));
  }
コード例 #8
0
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  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("");
    }
  }
コード例 #9
0
ファイル: Routine.java プロジェクト: bgourlie/routine-tracker
  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);
          }
        }
      }
    }
  }