Пример #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);
    }
Пример #2
0
    PageSelectorItem(final WizardPageInfo pageInfo, ClickHandler clickHandler) {
      WizardResources res = WizardResources.INSTANCE;
      WizardResources.Styles styles = res.styles();

      LayoutPanel layoutPanel = new LayoutPanel();
      layoutPanel.addStyleName(styles.wizardPageSelectorItem());

      ImageResource pageImageResource = pageInfo.getImage();
      Image image = null;
      if (pageImageResource != null) {
        image = new Image(pageImageResource);
        layoutPanel.add(image);
        layoutPanel.setWidgetLeftWidth(image, 10, Unit.PX, image.getWidth(), Unit.PX);
        layoutPanel.setWidgetTopHeight(
            image, 40 - (image.getHeight() / 2), Unit.PX, image.getHeight(), Unit.PX);
      }

      FlowPanel captionPanel = new FlowPanel();
      Label titleLabel = new Label(pageInfo.getTitle());
      titleLabel.addStyleName(styles.headerLabel());
      captionPanel.add(titleLabel);
      Label subTitleLabel = new Label(pageInfo.getSubTitle());
      subTitleLabel.addStyleName(styles.subcaptionLabel());
      captionPanel.add(subTitleLabel);
      layoutPanel.add(captionPanel);
      layoutPanel.setWidgetLeftWidth(
          captionPanel, 10 + (image == null ? 0 : image.getWidth()) + 12, Unit.PX, 450, Unit.PX);
      layoutPanel.setWidgetTopHeight(captionPanel, 19, Unit.PX, 55, Unit.PX);

      Image arrowImage = new Image(res.wizardDisclosureArrow());
      layoutPanel.add(arrowImage);
      layoutPanel.setWidgetRightWidth(arrowImage, 20, Unit.PX, arrowImage.getWidth(), Unit.PX);
      layoutPanel.setWidgetTopHeight(
          arrowImage, 40 - (arrowImage.getHeight() / 2), Unit.PX, arrowImage.getHeight(), Unit.PX);

      layoutPanel.addDomHandler(clickHandler, ClickEvent.getType());

      initWidget(layoutPanel);
    }
    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);
    }