Search in sources :

Example 1 with JarListPageRow

use of org.guvnor.m2repo.model.JarListPageRow in project kie-wb-common by kiegroup.

the class DependencyListWidget method init.

@PostConstruct
public void init() {
    dependencyPagedJarTable = IOC.getBeanManager().lookupBean(ArtifactListPresenter.class).getInstance();
    dependencyPagedJarTable.setup(ColumnType.NAME, ColumnType.GAV, ColumnType.LAST_MODIFIED);
    // Column to view KJAR's pom
    final Column<JarListPageRow, String> openColumn = new Column<JarListPageRow, String>(new ButtonCell(ButtonSize.EXTRA_SMALL)) {

        @Override
        public String getValue(JarListPageRow row) {
            return M2RepoEditorConstants.INSTANCE.Open();
        }
    };
    openColumn.setFieldUpdater(new FieldUpdater<JarListPageRow, String>() {

        @Override
        public void update(int index, JarListPageRow row, String value) {
            dependencyPagedJarTable.onOpenPom(row.getPath());
        }
    });
    // Column to allow selection of dependency
    final Column<JarListPageRow, String> selectColumn = new Column<JarListPageRow, String>(new ButtonCell(ButtonSize.EXTRA_SMALL)) {

        @Override
        public String getValue(JarListPageRow row) {
            return ProjectEditorResources.CONSTANTS.Select();
        }
    };
    selectColumn.setFieldUpdater(new FieldUpdater<JarListPageRow, String>() {

        @Override
        public void update(final int index, final JarListPageRow row, final String value) {
            onPathSelect.execute(row.getPath());
        }
    });
    final ArtifactListView artifactListView = dependencyPagedJarTable.getView();
    artifactListView.addColumn(openColumn, M2RepoEditorConstants.INSTANCE.Open(), false, 100.0, Style.Unit.PX);
    artifactListView.addColumn(selectColumn, ProjectEditorResources.CONSTANTS.Select(), 100.0, Style.Unit.PX);
    artifactListView.setContentHeight("200px");
    artifactListView.asWidget().getElement().getStyle().setMarginLeft(0, Style.Unit.PX);
    artifactListView.asWidget().getElement().getStyle().setMarginRight(0, Style.Unit.PX);
    panel.add(artifactListView);
}
Also used : ArtifactListView(org.guvnor.m2repo.client.widgets.ArtifactListView) Column(com.google.gwt.user.cellview.client.Column) JarListPageRow(org.guvnor.m2repo.model.JarListPageRow) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell) PostConstruct(javax.annotation.PostConstruct)

Aggregations

Column (com.google.gwt.user.cellview.client.Column)1 PostConstruct (javax.annotation.PostConstruct)1 ArtifactListView (org.guvnor.m2repo.client.widgets.ArtifactListView)1 JarListPageRow (org.guvnor.m2repo.model.JarListPageRow)1 ButtonCell (org.gwtbootstrap3.client.ui.gwt.ButtonCell)1