@Override public void activate(final Session session, final SubscriptionRegistrar subscriptionRegistrar) { // Add a ProblemSubmissionHistory object to the session. ProblemSubmissionHistory history = new ProblemSubmissionHistory(); session.add(history); // FIXME: for now, subscribe the page directly to the ProblemSubmissionHistory // Eventually, only the various views should be subscribed history.subscribe( ProblemSubmissionHistory.Event.SET_SUBMISSION_RECEIPT_LIST, this, subscriptionRegistrar); history.subscribe(ProblemSubmissionHistory.Event.SET_SELECTED, this, subscriptionRegistrar); // FIXME: also subscribe to session add object events session.subscribe(Session.Event.ADDED_OBJECT, this, subscriptionRegistrar); // Show username, problem name and description Problem problem = session.get(Problem.class); UserSelection userSelection = session.get(UserSelection.class); usernameAndProblemLabel.setText( userSelection.getUser().getUsername() + ", " + problem.toNiceString()); // Activate views pageNavPanel.setBackHandler(new PageBackHandler(session)); pageNavPanel.setLogoutHandler(new LogoutHandler(session)); sliderView.activate(session, subscriptionRegistrar); problemTextView.activate(session, subscriptionRegistrar); statusMessageView.activate(session, subscriptionRegistrar); testOutcomeSummaryView.activate(session, subscriptionRegistrar); testResultListView.activate(session, subscriptionRegistrar); // Get all SubmissionReceipts for this user on this problem RPC.getCoursesAndProblemsService.getAllSubmissionReceiptsForUser( problem, userSelection.getUser(), new AsyncCallback<SubmissionReceipt[]>() { @Override public void onSuccess(SubmissionReceipt[] result) { onLoadSubmissionReceipts(result); } @Override public void onFailure(Throwable caught) { session.add(StatusMessage.error("Could not get submission receipts", caught)); } }); }
@Override public void activate(final Session session, final SubscriptionRegistrar subscriptionRegistrar) { UserSelection selectedUser = session.get(UserSelection.class); CourseSelection courseSelection = session.get(CourseSelection.class); // activate views statusMessageView.activate(session, subscriptionRegistrar); userProgressView.activate(session, subscriptionRegistrar); // Display top label (username and course) StringBuilder buf = new StringBuilder(); buf.append("Progress for "); buf.append(selectedUser.getUser().getUsername()); buf.append(" in "); buf.append(courseSelection.getCourse().getName()); topLabel.setText(buf.toString()); // Add back/logout handlers pageNavPanel.setLogoutHandler(new LogoutHandler(session)); pageNavPanel.setBackHandler(new PageBackHandler(session)); }