Exemplo n.º 1
0
  private Widget getCompareWidget(final String packageName, final String snapshotName) {
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(new Label("Compare to:"));

    ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
    moduleService.listSnapshots(
        this.parentConf.getName(),
        new GenericCallback<SnapshotInfo[]>() {
          public void onSuccess(SnapshotInfo[] info) {
            for (int i = 0; i < info.length; i++) {
              if (!snapshotName.equals(info[i].getName())) {
                box.addItem(info[i].getName());
              }
            }
          }
        });
    hPanel.add(box);

    Button button = new Button("Compare");
    button.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (table != null) {
              vert.remove(table);
            }
            table =
                new SnapshotComparisonPagedTable(
                    packageName,
                    snapshotName,
                    box.getItemText(box.getSelectedIndex()),
                    clientFactory);
            vert.add(table);
          }
        });

    hPanel.add(button);

    return hPanel;
  }