Пример #1
0
    public UI() {
      DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);

      LayoutPanel northPanel = new LayoutPanel();

      this.topLabel = new Label();
      topLabel.setStyleName("cc-problemName", true);
      northPanel.add(topLabel);
      northPanel.setWidgetTopHeight(topLabel, 0.0, Unit.PX, 22.0, Unit.PX);
      northPanel.setWidgetLeftRight(topLabel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);

      this.pageNavPanel = new PageNavPanel();
      northPanel.add(pageNavPanel);
      northPanel.setWidgetTopHeight(pageNavPanel, 0.0, Unit.PX, PageNavPanel.HEIGHT_PX, Unit.PX);
      northPanel.setWidgetRightWidth(pageNavPanel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);

      dockLayoutPanel.addNorth(northPanel, PageNavPanel.HEIGHT_PX);

      LayoutPanel southPanel = new LayoutPanel();

      this.statusMessageView = new StatusMessageView();
      southPanel.add(statusMessageView);
      southPanel.setWidgetTopBottom(statusMessageView, 0.0, Unit.PX, 0.0, Unit.PX);
      southPanel.setWidgetLeftRight(statusMessageView, 0.0, Unit.PX, 0.0, Unit.PX);

      dockLayoutPanel.addSouth(southPanel, StatusMessageView.HEIGHT_PX);

      this.userProgressView = new UserProgressView();
      userProgressView.setViewSubmissionsCallback(
          new ICallback<Problem>() {
            @Override
            public void call(Problem value) {
              // Set the Problem. (The UserSelection should already be in the session.)
              getSession().add(value);

              // Switch to UserProblemSubmissionsPage
              getSession().get(PageStack.class).push(PageId.USER_PROBLEM_SUBMISSIONS);
            }
          });
      dockLayoutPanel.add(userProgressView);

      initWidget(dockLayoutPanel);
    }
    public UI() {
      SplitLayoutPanel panel = new SplitLayoutPanel();

      // North panel has username/problem name, page nav panel,
      // and slider to select the user's submissions.
      LayoutPanel northPanel = new LayoutPanel();

      this.usernameAndProblemLabel = new Label("");
      usernameAndProblemLabel.setStyleName("cc-problemName", true);
      northPanel.add(usernameAndProblemLabel);
      northPanel.setWidgetLeftRight(
          usernameAndProblemLabel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);
      northPanel.setWidgetTopHeight(usernameAndProblemLabel, 0.0, Unit.PX, 22.0, Unit.PX);

      this.pageNavPanel = new PageNavPanel();
      northPanel.add(pageNavPanel);
      northPanel.setWidgetRightWidth(pageNavPanel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);
      northPanel.setWidgetTopHeight(pageNavPanel, 0.0, Unit.PX, PageNavPanel.HEIGHT_PX, Unit.PX);

      this.sliderView = new ProblemSubmissionHistorySliderView();
      northPanel.add(sliderView);
      northPanel.setWidgetTopHeight(
          sliderView,
          PageNavPanel.HEIGHT_PX,
          Unit.PX,
          ProblemSubmissionHistorySliderView.HEIGHT_PX,
          Unit.PX);
      northPanel.setWidgetLeftRight(sliderView, 0.0, Unit.PX, 0.0, Unit.PX);

      panel.addNorth(northPanel, PageNavPanel.HEIGHT_PX + 8.0 + SLIDER_HEIGHT_PX);

      // South panel has status message view, test outcome summary view,
      // and test result view.  TODO: indicate whether or not the sumission compiled.
      LayoutPanel southPanel = new LayoutPanel();

      this.statusMessageView = new StatusMessageView();
      southPanel.add(statusMessageView);
      southPanel.setWidgetLeftRight(
          statusMessageView, 0.0, Unit.PX, TestOutcomeSummaryView.WIDTH_PX, Unit.PX);
      southPanel.setWidgetTopHeight(
          statusMessageView, 0.0, Unit.PX, StatusMessageView.HEIGHT_PX, Unit.PX);

      this.testOutcomeSummaryView = new TestOutcomeSummaryView();
      southPanel.add(testOutcomeSummaryView);
      southPanel.setWidgetRightWidth(
          testOutcomeSummaryView, 0.0, Unit.PX, TestOutcomeSummaryView.WIDTH_PX, Unit.PX);
      southPanel.setWidgetTopHeight(
          testOutcomeSummaryView, 0.0, Unit.PX, TestOutcomeSummaryView.HEIGHT_PX, Unit.PX);

      this.testResultListView = new TestResultListView();
      southPanel.add(testResultListView);
      southPanel.setWidgetLeftRight(testResultListView, 0.0, Unit.PX, 0.0, Unit.PX);
      southPanel.setWidgetTopBottom(
          testResultListView, TestOutcomeSummaryView.HEIGHT_PX, Unit.PX, 0.0, Unit.PX);

      panel.addSouth(southPanel, 200.0);

      // Center panel has a ReadOnlyProblemTextView
      this.problemTextView = new ReadOnlyProblemTextView();
      panel.add(problemTextView);

      initWidget(panel);
    }