Esempio n. 1
0
  /** Popup the view source dialog, showing the given content. */
  public static void showSource(final String content, String name) {
    Constants constants = GWT.create(Constants.class);
    int windowWidth = Window.getClientWidth() / 2;
    int windowHeight = Window.getClientHeight() / 2;
    final FormStylePopup pop =
        new FormStylePopup(images.viewSource(), constants.ViewingSourceFor0(name), windowWidth);

    String[] rows = content.split("\n");

    FlexTable table = new FlexTable();
    for (int i = 0; i < rows.length; i++) {

      table.setHTML(i, 0, "<span style='color:grey;'>" + (i + 1) + ".</span>");
      table.setHTML(i, 1, "<span style='color:green;' >|</span>");
      table.setHTML(i, 2, addSyntaxHilights(rows[i]));
    }

    ScrollPanel scrollPanel = new ScrollPanel(table);

    scrollPanel.setHeight(windowHeight + "px");
    scrollPanel.setWidth(windowWidth + "px");

    pop.addRow(scrollPanel);

    LoadingPopup.close();

    pop.show();
  }
Esempio n. 2
0
  public VersionBrowser(
      ClientFactory clientFactory, EventBus eventBus, String uuid, boolean isPackage) {
    this.clientFactory = clientFactory;
    this.eventBus = eventBus;
    this.uuid = uuid;
    this.isPackage = isPackage;

    HorizontalPanel wrapper = new HorizontalPanel();

    ClickHandler clickHandler =
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            clickLoadHistory();
          }
        };
    layout = new FlexTable();
    ClickableLabel vh = new ClickableLabel(constants.VersionHistory1(), clickHandler);
    layout.setWidget(0, 0, vh);
    layout.getCellFormatter().setStyleName(0, 0, "metadata-Widget"); // NON-NLS
    FlexCellFormatter formatter = layout.getFlexCellFormatter();
    formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);

    refresh = new ImageButton(images.refresh());

    refresh.addClickHandler(clickHandler);

    layout.setWidget(0, 1, refresh);
    formatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);

    wrapper.setStyleName("version-browser-Border");

    wrapper.add(layout);

    layout.setWidth("100%");
    wrapper.setWidth("100%");

    initWidget(wrapper);
  }