Esempio n. 1
0
  public void init(final ArtifactListPresenter presenter) {
    this.presenter = presenter;

    // Set the message to display when the table is empty.
    final Label emptyTable = new Label(M2RepoEditorConstants.INSTANCE.NoArtifactAvailable());
    emptyTable.setStyleName("");
    cellTable.setEmptyTableWidget(emptyTable);

    // Create a Pager to control the table.
    pager.setDisplay(cellTable);
    pager.setPageSize(PAGE_SIZE);

    initTableColumns();
  }
Esempio n. 2
0
  private void initTableColumns() {
    final Column<JarListPageRow, String> nameColumn =
        new Column<JarListPageRow, String>(new TextCell()) {
          @Override
          public String getValue(JarListPageRow row) {
            return row.getName();
          }
        };
    cellTable.addColumn(
        nameColumn,
        new ResizableHeader(M2RepoEditorConstants.INSTANCE.Name(), cellTable, nameColumn));

    final Column<JarListPageRow, String> pathColumn =
        new Column<JarListPageRow, String>(new TextCell()) {
          @Override
          public String getValue(JarListPageRow row) {
            return row.getPath();
          }
        };
    cellTable.addColumn(
        pathColumn,
        new ResizableHeader(M2RepoEditorConstants.INSTANCE.Path(), cellTable, pathColumn));

    final Column<JarListPageRow, Date> lastModifiedColumn =
        new Column<JarListPageRow, Date>(
            new DateCell(
                DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) {
          @Override
          public Date getValue(JarListPageRow row) {
            return row.getLastModified();
          }
        };
    cellTable.addColumn(
        lastModifiedColumn,
        new ResizableHeader(
            M2RepoEditorConstants.INSTANCE.LastModified(), cellTable, lastModifiedColumn));

    // Add "View kjar detail" button column
    final Column<JarListPageRow, String> openColumn =
        new Column<JarListPageRow, String>(
            new ButtonCell() {
              {
                setSize(ButtonSize.MINI);
              }
            }) {
          public String getValue(JarListPageRow row) {
            return M2RepoEditorConstants.INSTANCE.Open();
          }
        };
    openColumn.setFieldUpdater(
        new FieldUpdater<JarListPageRow, String>() {
          public void update(int index, JarListPageRow row, String value) {
            m2RepoService
                .call(
                    new RemoteCallback<String>() {
                      @Override
                      public void callback(final String response) {
                        JarDetailPopup popup = new JarDetailPopup(response);
                        popup.show();
                      }
                    })
                .loadPOMStringFromJar(row.getPath());
          }
        });
    cellTable.addColumn(
        openColumn,
        new ResizableHeader(M2RepoEditorConstants.INSTANCE.Open(), cellTable, openColumn));
  }