示例#1
0
  protected void processHQMF(
      RichTextArea textArea,
      SplitLayoutPanel splitLayoutPanel,
      VerticalPanel summaryVerticalPanel) {

    String text = textArea.getText();
    final ScrollPanel xmlPanel = getPanelForXML(text);
    if (xmlPanel != null) {
      splitLayoutPanel.remove(textArea);
      splitLayoutPanel.add(xmlPanel);
    }

    for (final Map.Entry<String, TextArea> entry : bookmarkMap.entrySet()) {
      String key = entry.getKey();
      Label label = new Label(key);
      label.setStyleName("bookMarkLabel");
      label.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              TextArea textArea = entry.getValue();
              xmlPanel.setVerticalScrollPosition(textArea.getElement().getOffsetTop());
            }
          });
      summaryVerticalPanel.add(label);
    }
  }
示例#2
0
  /**
   * Draws the panels and their children that compose the basic WMT GUI.
   *
   * @param data the DataManager object for the WMT session
   */
  public Perspective(DataManager data) {

    super(Unit.PX);
    this.data = data;
    this.data.setPerspective(this);
    this.addStyleName("wmt-DockLayoutPanel");
    if (data.isDevelopmentMode()) {
      this.addStyleDependentName("devmode");
    }

    // Determine initial view sizes based on browser window dimensions.
    browserWindowWidth = Window.getClientWidth();
    Integer viewEastInitialWidth =
        (int) Math.round(Constants.VIEW_EAST_FRACTION * browserWindowWidth);
    Integer headerHeight = 50; // TODO diagnose from largest header elt

    // The Perspective has two children, a header in the north panel
    // and a SplitLayoutPanel below.
    viewNorth = new ViewNorth();
    this.addNorth(viewNorth, headerHeight);
    SplitLayoutPanel splitter = new SplitLayoutPanel(Constants.SPLITTER_SIZE);
    splitter.addStyleName("wmt-SplitLayoutPanel");
    this.add(splitter);

    // The SplitLayoutPanel defines panels which translate to the West
    // and East views of WMT.
    viewEast = new ViewEast();
    splitter.addEast(viewEast, viewEastInitialWidth);
    viewWest = new ViewWest();
    splitter.add(viewWest); // must be last
  }
  /** 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 setupAuthorizationTableVisibility(boolean visible) {
   rootPanel.clear();
   if (visible) {
     rootPanel.addSouth(authorizationTable, 150);
   }
   rootPanel.add(macPoolTable);
 }
  public ServerGroupMgmtView() {
    super();

    layout = new SplitLayoutPanel(4);

    contentCanvas = new LayoutPanel();
    lhsNavigation = new LHSServerGroupNavigation();

    layout.addWest(lhsNavigation.asWidget(), 180);
    layout.add(contentCanvas);
  }
  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 Widget asWidget() {

    SimplePanel panel = new SimplePanel();

    definitionView = new DefinitionHistoryListView();
    instanceView = new HistoryInstanceListView();

    final SplitLayoutPanel splitPanel = new SplitLayoutPanel();

    splitPanel.addWest(definitionView.asWidget(), 250);

    splitPanel.add(instanceView.asWidget());

    panel.add(splitPanel);

    return panel;
  }
  public com.google.gwt.user.client.ui.Widget createAndBindUi(
      final PolyakovGWT.client.view.MailboxViewImpl owner) {

    PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenBundle
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay =
            (PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenBundle)
                GWT.create(PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenBundle.class);
    PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenCss_style style =
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style();
    PolyakovGWT.client.view.widgets.CurrentPathWidget currentPathWidget =
        (PolyakovGWT.client.view.widgets.CurrentPathWidget)
            GWT.create(PolyakovGWT.client.view.widgets.CurrentPathWidget.class);
    PolyakovGWT.client.view.widgets.toolbar.ButtonsHolderWidget buttonsWidget = owner.buttonsWidget;
    com.google.gwt.user.client.ui.VerticalPanel f_VerticalPanel2 =
        (com.google.gwt.user.client.ui.VerticalPanel)
            GWT.create(com.google.gwt.user.client.ui.VerticalPanel.class);
    PolyakovGWT.client.view.widgets.FolderTreeWidget folderTree = owner.folderTree;
    com.google.gwt.user.client.ui.SimpleLayoutPanel containerPanel =
        (com.google.gwt.user.client.ui.SimpleLayoutPanel)
            GWT.create(com.google.gwt.user.client.ui.SimpleLayoutPanel.class);
    com.google.gwt.user.client.ui.SplitLayoutPanel f_SplitLayoutPanel3 =
        (com.google.gwt.user.client.ui.SplitLayoutPanel)
            GWT.create(com.google.gwt.user.client.ui.SplitLayoutPanel.class);
    com.google.gwt.user.client.ui.DockLayoutPanel f_DockLayoutPanel1 =
        new com.google.gwt.user.client.ui.DockLayoutPanel(com.google.gwt.dom.client.Style.Unit.PX);

    f_VerticalPanel2.add(currentPathWidget);
    f_VerticalPanel2.add(buttonsWidget);
    f_DockLayoutPanel1.addNorth(f_VerticalPanel2, 85);
    f_SplitLayoutPanel3.addWest(folderTree, 135);
    containerPanel.addStyleName("" + style.container() + "");
    f_SplitLayoutPanel3.add(containerPanel);
    f_SplitLayoutPanel3.addStyleName("" + style.data_container() + "");
    f_DockLayoutPanel1.add(f_SplitLayoutPanel3);

    owner.containerPanel = containerPanel;
    owner.currentPathWidget = currentPathWidget;
    clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected();

    return f_DockLayoutPanel1;
  }
示例#9
0
  public GeoStory() {
    panel = new SplitLayoutPanel();
    types = new GeoEventTypes();
    model = new GeoStoryModel(types);
    space = new Space(LatLng.newInstance(45.50, -73.60), 4, types, model);
    time = new TimeLine(model, types);
    list = new ListBox(true);
    list.setVisibleItemCount(20);
    for (GeoStoryItem i : model.getItems()) {
      list.addItem(i.toString());
    }
    {
      controls = new VerticalPanel();
      {
        email = new TextBox();
        email.setText("*****@*****.**");
        controls.add(email);
        email.addChangeHandler(
            new ChangeHandler() {
              @Override
              public void onChange(ChangeEvent event) {}
            });
      }
      {
        Button getFromServer = new Button("Get from server");
        getFromServer.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                types.getEventFromServer.shareEvent(getEmail());
              }
            });
        controls.add(getFromServer);
      }
      {
        Button dump = new Button("Json dump");
        dump.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                StringBuilder sb = new StringBuilder();
                for (GeoStoryItem item : model.getItems()) {
                  sb.append(item.toJSON() + "\n");
                }
                DialogBox db = new DialogBox(true);
                TextArea ta = new TextArea();
                ta.setEnabled(true);
                ta.setText(sb.toString());
                db.add(ta);
                db.center();
                db.show();
              }
            });
        controls.add(dump);
      }
      {
        Button jsonload = new Button("Json load");
        jsonload.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Question<String> q = new ContentQuestion("Entrer la cha”ne JSON");
                final QPanel textContent = new QPanel(new Questionnaire(q));
                textContent.center();
                textContent.show();
                q.answerChannel()
                    .registerHandler(
                        new WHandler<String>() {
                          @Override
                          public void onEvent(WEvent<String> elt) {
                            String[] lines = elt.getElement().split("\n");
                            for (String item : lines) {
                              JSONValue json = JSONParser.parse(item);
                              JSONObject object = json.isObject();
                              GeoStoryItem gsi = GeoStoryItem.fromJSON(object);
                              types.itemAdded.shareEvent(gsi);
                              types.centerEvent.shareEvent(null);
                            }
                          }
                        });
              }
            });
        controls.add(jsonload);
      }
      {
        Button popRandom = new Button("Populate at random");
        controls.add(popRandom);
        popRandom.addClickHandler(
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                model.populateRandomly(10);
                types.centerEvent.shareEvent(null);
              }
            });
      }
      {
        Button popFromText = new Button("Populate from text");
        controls.add(popFromText);
        popFromText.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Question<String> q = new ContentQuestion("Description des evenements");
                final QPanel textContent = new QPanel(new Questionnaire(q));
                textContent.center();
                textContent.show();
                q.answerChannel()
                    .registerHandler(
                        new WHandler<String>() {
                          @Override
                          public void onEvent(WEvent<String> elt) {
                            List<Triple<String, Interval, String>> res =
                                GeoStoryParser.parse(elt.getElement());
                            int delay = 0;
                            final Geocoder geo = new Geocoder();
                            for (final Triple<String, Interval, String> indiv : res) {
                              geodecode(geo, indiv, delay = delay + 100);
                            }
                            textContent.hide();
                          }
                        });
              }
            });
      }
      {
        Button cia = new Button("Draw borders");
        controls.add(cia);
        cia.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                for (final Polyline poly : CIA.segments(CIA.northamerica)) {
                  space.space.addOverlay(poly);
                }
                for (final Polyline poly : CIA.segments(CIA.europe)) {
                  space.space.addOverlay(poly);
                }
              }
            });
      }
      {
        Button family = new Button("Genealogy info");
        controls.add(family);
        family.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Geocoder geo = new Geocoder();
                for (final Triple<String, Interval, String> indiv : Genea.people()) {
                  geodecode(geo, indiv, 100);
                }
              }
            });
      }
      {
        Button addOne = new Button("Add one");
        addOne.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                ContentQuestion desc = new ContentQuestion("Description?");
                WhenQuestion when = new WhenQuestion("Quand?");
                ContentQuestion plac = new ContentQuestion("Nom du lieu?");
                WhereQuestion wher = new WhereQuestion("Sur la carte?", plac.answerChannel());
                Questionnaire q = new Questionnaire(desc, when, plac, wher);
                QPanel tested = new QPanel(q);
                // tested.setSize("50%", "50%");
                q.answerChannel()
                    .registerHandler(
                        new WHandler<Map<String, String>>() {
                          @Override
                          public void onEvent(WEvent<Map<String, String>> elt) {
                            Map<String, String> map = elt.getElement();
                            // Window.alert("Questionnaire are  "+ elt.getElement().toString());
                            String[] coord = map.get("Sur la carte?").split("\\|");
                            // Window.alert("Questionnaire are  "+ elt.getElement().toString()+"
                            // "+Arrays.toString(coord));
                            LatLng ll =
                                LatLng.newInstance(
                                    Double.parseDouble(coord[0]),
                                    Double.parseDouble(coord[1])); // ;
                            String[] dates = map.get("Quand?").split("->");
                            Interval interval =
                                new Interval(
                                    WhenQuestion.dtf.parse(dates[0]),
                                    WhenQuestion.dtf.parse(dates[1]));
                            GeoStoryItem geo =
                                new GeoStoryItem(
                                    interval, map.get("Nom du lieu?"), ll, map.get("Description?"));
                            Window.alert(
                                "GeoStory "
                                    + geo
                                    + " "
                                    + Arrays.toString(dates)
                                    + " "
                                    + map.get("Quand?"));
                            types.itemAdded.shareEvent(geo);
                            types.centerEvent.shareEvent(null);
                          }
                        });
                tested.center();
                tested.show();
              }
            });
        controls.add(addOne);
      }
      {
        Button reset = new Button("Reset");
        reset.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                model.reset();
                types.centerEvent.shareEvent(null);
              }
            });
        controls.add(reset);
      }
      {
        final TextBox search = new TextBox();
        search.setTitle("Search");
        final Button go = new Button("go");
        go.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Set<GeoStoryItem> itemsSet = model.getItems();
                // filtering
                if (search.getText() != null && !search.getText().isEmpty()) {
                  for (GeoStoryItem geoStoryItem : itemsSet) {
                    if (geoStoryItem.getDescription().contains(search.getText())) {
                      geoStoryItem.setVisible(true);
                    } else {
                      geoStoryItem.setVisible(false);
                    }
                  }
                }
                types.centerEvent.shareEvent(null);
              }
            });
        controls.add(go);
        controls.add(search);
      }
      {
        final Button removeFilter = new Button("remove filter");
        removeFilter.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Set<GeoStoryItem> itemsSet = model.getItems();
                // filtering
                for (GeoStoryItem geoStoryItem : itemsSet) {
                  geoStoryItem.setVisible(true);
                }
                types.centerEvent.shareEvent(null);
              }
            });
        controls.add(removeFilter);
      }
      panel.addSouth(time, 150);
      panel.addWest(controls, 150);
      panel.add(space);
      Window.addResizeHandler(this);
    }
    this.initWidget(panel);
    // Short term timer to check and resize the badly initialized map.
    Timer t =
        new Timer() {
          public void run() {
            space.checkResizeAndCenter();
            time.init();
          }
        };
    t.schedule(1);
  }
    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);
    }
示例#11
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);
  }