Exemplo n.º 1
0
  /** Initialize this example. */
  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    // Create a Split Panel
    SplitLayoutPanel splitPanel = new SplitLayoutPanel(5);
    splitPanel.ensureDebugId("cwSplitLayoutPanel");
    splitPanel.setPixelSize(500, 400);
    splitPanel.getElement().getStyle().setProperty("border", "3px solid #e7e7e7");

    // Add text all around.
    splitPanel.addNorth(new Label(constants.cwSplitLayoutPanelNorth1()), 50);
    splitPanel.addSouth(new Label(constants.cwSplitLayoutPanelSouth1()), 50);
    splitPanel.addEast(new Label(constants.cwSplitLayoutPanelEast()), 100);
    splitPanel.addWest(new Label(constants.cwSplitLayoutPanelWest()), 100);
    splitPanel.addNorth(new Label(constants.cwSplitLayoutPanelNorth2()), 50);
    splitPanel.addSouth(new Label(constants.cwSplitLayoutPanelSouth2()), 50);

    // Add scrollable text to the center.
    String centerText = constants.cwSplitLayoutPanelCenter();
    for (int i = 0; i < 3; i++) {
      centerText += " " + centerText;
    }
    Label centerLabel = new Label(centerText);
    ScrollPanel centerScrollable = new ScrollPanel(centerLabel);
    splitPanel.add(centerScrollable);

    // Return the content
    return splitPanel;
  }
  private void buildUI() {
    FlowPanel topPanel = new FlowPanel();
    SimplePanel toolbarWrapper = new SimplePanel();
    toolbarWrapper.setWidget(new BrowserToolbar());
    toolbarWrapper.setStyleName("files-toolbar"); // $NON-NLS-1$
    topPanel.add(toolbarWrapper);
    topPanel.add(new SolutionTreeWrapper(solutionTree));

    solutionNavigatorPanel.setStyleName("puc-vertical-split-panel");
    solutionNavigatorPanel.setWidth("100%");
    solutionNavigatorPanel.addNorth(topPanel, 500);
    solutionNavigatorPanel.add(filesListPanel);

    navigatorAndContentSplit.setStyleName("puc-horizontal-split-panel");
    navigatorAndContentSplit.addWest(solutionNavigatorPanel, 300);
    navigatorAndContentSplit.add(contentTabPanel);
    navigatorAndContentSplit.getElement().setAttribute("id", "solutionNavigatorAndContentPanel");

    Window.addResizeHandler(
        new ResizeHandler() {
          @Override
          public void onResize(ResizeEvent event) {
            adjustContentPanelSize();
          }
        });

    solutionNavigatorPanel.getElement().getParentElement().addClassName("puc-navigator-panel");
    solutionNavigatorPanel.getElement().getParentElement().removeAttribute("style");

    setStyleName("panelWithTitledToolbar"); // $NON-NLS-1$
    setHeight("100%"); // $NON-NLS-1$
    setWidth("100%"); // $NON-NLS-1$

    add(navigatorAndContentSplit);

    sinkEvents(Event.MOUSEEVENTS);

    navigatorAndContentSplit.getWidget(1).setWidth("100%");
    navigatorAndContentSplit.getElement().getStyle().setHeight(1, Unit.PX);
    contentTabPanel.getElement().getStyle().setHeight(1, Unit.PX);
  }
    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);
    }
Exemplo n.º 4
0
  public void onModuleLoad() {

    TabLayoutPanel tabLayoutPanel = new TabLayoutPanel(2.5, Unit.EM);
    final SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel();
    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.setSpacing(10);
    hPanel.add(new HTML("HQMF Viewer."));
    Button processHQMFButton = new Button("Process HQMF.");
    processHQMFButton.addStyleName("sendButton");
    hPanel.add(processHQMFButton);
    hPanel.add(new HTML("\t(For some reason, works only in IE right now.)"));

    final VerticalPanel summaryVerticalPanel = new VerticalPanel();
    summaryVerticalPanel.setSpacing(3);
    processHQMFButton.setStyleName("summaryVPanel");
    summaryVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    summaryVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    splitLayoutPanel.addNorth(hPanel, 50);
    splitLayoutPanel.addWest(summaryVerticalPanel, 0);

    final RichTextArea textArea = new RichTextArea();
    textArea.setTitle("Paste your HQMF XML here.");
    textArea.setText("Paste your HQMF XML here.");
    textArea.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (textArea.getText().length() < 30
                && textArea.getText().equals("Paste your HQMF XML here.")) {
              textArea.setText("");
            }
          }
        });
    textArea.addStyleName("boxsizingBorder");
    textArea.setWidth("100%");
    textArea.setHeight("100%");

    processHQMFButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            processHQMF(textArea, splitLayoutPanel, summaryVerticalPanel);
            splitLayoutPanel.remove(hPanel);
            splitLayoutPanel.setWidgetSize(summaryVerticalPanel, 200);
            splitLayoutPanel.setWidgetToggleDisplayAllowed(summaryVerticalPanel, true);
          }
        });
    splitLayoutPanel.add(textArea);

    MySplitLayoutPanel mySplitPanel = new MySplitLayoutPanel();
    final VerticalPanel testVerticalPanel = new VerticalPanel();
    testVerticalPanel.setSpacing(3);

    testVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    testVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    // final RichTextArea testtextArea = getSmartTextArea();
    // final AceEditor testtextArea = getAceEditor();
    AceEditor aceTxtArea = new AceEditor();
    aceTxtArea.setWidth("100%");
    aceTxtArea.setHeight("100%");

    mySplitPanel.addEast(testVerticalPanel, 0);
    mySplitPanel.add(aceTxtArea);
    //		mySplitPanel.add(testtextArea);

    aceTxtArea.startEditor();

    setAceEditorProperties(aceTxtArea);

    mySplitPanel.setWidgetToggleDisplayAllowed(testVerticalPanel, true);

    tabLayoutPanel.add(mySplitPanel, "test CQL Editor.");
    tabLayoutPanel.add(splitLayoutPanel, "HQMF Viewer");

    RootLayoutPanel.get().add(tabLayoutPanel);
  }