Example usage for com.google.gwt.user.cellview.client Column Column

List of usage examples for com.google.gwt.user.cellview.client Column Column

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client Column Column.

Prototype

public Column(Cell<C> cell) 

Source Link

Document

Construct a new Column with a given Cell .

Usage

From source file:org.guvnor.client.screens.clients.ClientsScreenPresenter.java

License:Apache License

public ClientsScreenPresenter() {
    initWidget(uiBinder.createAndBindUi(this));

    TextBox textBox = new TextBox();
    //        textBox.setSearchQuery(true);
    textBox.setPlaceholder("Search...");
    table.getLeftToolbar().add(textBox);

    Column<String, HyperLinkCell.HyperLink> column = new Column<String, HyperLinkCell.HyperLink>(
            new HyperLinkCell()) {
        @Override//www . j  ava2 s  . co  m
        public HyperLinkCell.HyperLink getValue(String object) {
            return HyperLinkCell.HyperLink.newLink("third-party");
        }
    };
    table.addColumn(column, "OAuth Client Name");
    table.addColumn(new Column<String, String>(new TextCell()) {
        @Override
        public String getValue(String object) {
            return "true";
        }
    }, "Enabled");

    column.setFieldUpdater(new FieldUpdater<String, HyperLinkCell.HyperLink>() {
        @Override
        public void update(final int index, final String row, final HyperLinkCell.HyperLink value) {
            placeManager.goTo("oauthClientSettingsScreen");
        }
    });

    ListDataProvider<String> dataProvider = new ListDataProvider<String>();

    dataProvider.addDataDisplay(table);
    ArrayList<String> list = new ArrayList<String>();
    list.add("mock");
    dataProvider.setList(list);
}

From source file:org.guvnor.inbox.client.editor.InboxEditor.java

License:Apache License

public InboxEditor(Caller<InboxService> inboxService, final String inboxName) {
    //this.m2RepoService = repoService;
    inboxPagedTable = new InboxPagedTable(inboxService, inboxName);

    Column<InboxPageRow, String> openColumn = new Column<InboxPageRow, String>(new ButtonCell()) {
        public String getValue(InboxPageRow row) {
            return "Open";
        }//from   w  w w .j  av  a  2  s . c  o  m
    };

    openColumn.setFieldUpdater(new FieldUpdater<InboxPageRow, String>() {
        public void update(int index, InboxPageRow row, String value) {
            /*                Window.open(getFileDownloadURL(row.getPath()),
                "downloading",
                "resizable=no,scrollbars=yes,status=no");*/
        }
    });

    inboxPagedTable.addColumn(openColumn, new TextHeader("Open"));

    initWidget(uiBinder.createAndBindUi(this));
}

From source file:org.guvnor.inbox.client.editor.InboxPagedTable.java

License:Apache License

@Override
protected void addAncillaryColumns(ColumnPicker<InboxPageRow> columnPicker,
        SortableHeaderGroup<InboxPageRow> sortableHeaderGroup) {

    Column<InboxPageRow, ComparableImageResource> formatColumn = new Column<InboxPageRow, ComparableImageResource>(
            new ComparableImageResourceCell()) {

        public ComparableImageResource getValue(InboxPageRow row) {
            //TODO: get icons for different asset format
            //AssetEditorFactory factory = clientFactory.getAssetEditorFactory();                
            //return new ComparableImageResource( row.getFormat(), factory.getAssetEditorIcon( row.getFormat() ) );
            return new ComparableImageResource(row.getFormat(), new Image(ImageResources.INSTANCE.fileIcon()));
        }/*from  w w w  .  j  a va  2s. c o  m*/
    };
    columnPicker.addColumn(formatColumn, new SortableHeader<InboxPageRow, ComparableImageResource>(
            sortableHeaderGroup, "Format", formatColumn), true);

    TextColumn<InboxPageRow> noteColumn = new TextColumn<InboxPageRow>() {
        public String getValue(InboxPageRow row) {
            return row.getNote();
        }
    };
    columnPicker.addColumn(noteColumn,
            new SortableHeader<InboxPageRow, String>(sortableHeaderGroup, "Name", noteColumn), true);

    Column<InboxPageRow, Date> dateColumn = new Column<InboxPageRow, Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) {
        public Date getValue(InboxPageRow row) {
            return row.getTimestamp();
        }
    };
    columnPicker.addColumn(dateColumn,
            new SortableHeader<InboxPageRow, Date>(sortableHeaderGroup, "Created Date", dateColumn), true);

}

From source file:org.guvnor.inbox.client.editor.InboxViewImpl.java

License:Apache License

public InboxViewImpl(final Caller<InboxService> inboxService, final String inboxName,
        final InboxPresenter presenter) {
    Column<InboxPageRow, String> openColumn = new Column<InboxPageRow, String>(new ButtonCell()) {
        public String getValue(final InboxPageRow row) {
            return InboxConstants.INSTANCE.open();
        }//from w  w  w.  j ava 2  s .  com
    };

    openColumn.setFieldUpdater(new FieldUpdater<InboxPageRow, String>() {
        public void update(final int index, final InboxPageRow row, final String value) {
            presenter.open(row);
        }
    });

    table.addColumn(openColumn, InboxConstants.INSTANCE.open());

    Column<InboxPageRow, ComparableImageResource> formatColumn = new Column<InboxPageRow, ComparableImageResource>(
            new ComparableImageResourceCell()) {

        public ComparableImageResource getValue(InboxPageRow row) {
            return new ComparableImageResource(row.getFormat(), new Image(ImageResources.INSTANCE.fileIcon()));
        }
    };
    table.addColumn(formatColumn, InboxConstants.INSTANCE.format());

    TextColumn<InboxPageRow> noteColumn = new TextColumn<InboxPageRow>() {
        public String getValue(InboxPageRow row) {
            return row.getNote();
        }
    };
    table.addColumn(noteColumn, InboxConstants.INSTANCE.name());

    Column<InboxPageRow, Date> dateColumn = new Column<InboxPageRow, Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) {
        public Date getValue(InboxPageRow row) {
            return row.getTimestamp();
        }
    };
    table.addColumn(dateColumn, InboxConstants.INSTANCE.createdDate());

    table.setDataProvider(new AsyncDataProvider<InboxPageRow>() {
        protected void onRangeChanged(HasData<InboxPageRow> display) {
            InboxPageRequest request = new InboxPageRequest(inboxName, table.dataGrid.getPageStart(),
                    PAGE_SIZE);

            inboxService.call(new RemoteCallback<PageResponse<InboxPageRow>>() {
                @Override
                public void callback(final PageResponse<InboxPageRow> response) {
                    updateRowCount(response.getTotalRowSize(), response.isTotalRowSizeExact());
                    updateRowData(response.getStartRowIndex(), response.getPageRowList());
                }
            }).loadInbox(request);

        }
    });

    final Button refreshButton = new Button();
    refreshButton.setIcon(IconType.REFRESH);
    refreshButton.setTitle(InboxConstants.INSTANCE.refresh());
    refreshButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            table.refresh();
        }
    });
    table.getToolbar().add(refreshButton);

    initWidget(uiBinder.createAndBindUi(this));
}

From source file:org.guvnor.m2repo.client.editor.JarListEditor.java

License:Apache License

public JarListEditor(Caller<M2RepoService> repoService, final String searchFilter) {
    this.m2RepoService = repoService;
    pagedJarTable = new PagedJarTable(repoService, searchFilter);

    Column<JarListPageRow, String> downloadColumn = new Column<JarListPageRow, String>(new ButtonCell()) {
        public String getValue(JarListPageRow row) {
            return "Download";
        }/* w w w .ja  v  a2s .co m*/
    };

    downloadColumn.setFieldUpdater(new FieldUpdater<JarListPageRow, String>() {
        public void update(int index, JarListPageRow row, String value) {
            Window.open(getFileDownloadURL(row.getPath()), "downloading",
                    "resizable=no,scrollbars=yes,status=no");
        }
    });

    pagedJarTable.addColumn(downloadColumn, new TextHeader("Download"));

    initWidget(uiBinder.createAndBindUi(this));
}

From source file:org.guvnor.m2repo.client.editor.MavenRepositoryPagedJarTable.java

License:Apache License

void addViewPOMButton() {
    final Column<JarListPageRow, String> openColumn = new Column<JarListPageRow, String>(
            new ButtonCell(ButtonSize.EXTRA_SMALL)) {
        @Override//from   w  w  w. j  av a 2  s . c om
        public String getValue(JarListPageRow row) {
            return M2RepoEditorConstants.INSTANCE.Open();
        }
    };
    openColumn.setFieldUpdater(
            (int index, JarListPageRow row, String value) -> presenter.onOpenPom(row.getPath()));
    presenter.getView().addColumn(openColumn, M2RepoEditorConstants.INSTANCE.Open(), 100.0, Style.Unit.PX);
}

From source file:org.guvnor.m2repo.client.editor.MavenRepositoryPagedJarTable.java

License:Apache License

void addDownloadJARButton() {
    final Column<JarListPageRow, String> downloadColumn = new Column<JarListPageRow, String>(
            new ButtonCell(ButtonSize.EXTRA_SMALL)) {
        public String getValue(JarListPageRow row) {
            return M2RepoEditorConstants.INSTANCE.Download();
        }/*from  w ww.  j  a  va 2  s.c  o m*/
    };

    downloadColumn.setFieldUpdater(
            (int index, JarListPageRow row, String value) -> Window.open(getFileDownloadURL(row.getPath()),
                    M2RepoEditorConstants.INSTANCE.Downloading(), "resizable=no,scrollbars=yes,status=no"));

    presenter.getView().addColumn(downloadColumn, M2RepoEditorConstants.INSTANCE.Download(), 100.0,
            Style.Unit.PX);
}

From source file:org.guvnor.m2repo.client.widgets.ArtifactListViewImpl.java

License:Apache License

@Override
public void setup(final ColumnType... _columns) {
    final Set<ColumnType> columns = new HashSet<ColumnType>(Arrays.asList(_columns));
    dataGrid.setEmptyTableCaption(M2RepoEditorConstants.INSTANCE.NoArtifactAvailable());

    if (columns.contains(ColumnType.NAME)) {
        final Column<JarListPageRow, String> nameColumn = new Column<JarListPageRow, String>(new TextCell()) {
            @Override/*from  w  w w  .j ava 2s  . c  o  m*/
            public String getValue(JarListPageRow row) {
                return row.getName();
            }
        };
        nameColumn.setSortable(true);
        nameColumn.setDataStoreName(JarListPageRequest.COLUMN_NAME);
        addColumn(nameColumn, M2RepoEditorConstants.INSTANCE.Name());
    }

    if (columns.contains(ColumnType.GAV)) {
        final Column<JarListPageRow, String> gavColumn = new Column<JarListPageRow, String>(new TextCell()) {
            @Override
            public String getValue(JarListPageRow row) {
                return row.getGav().toString();
            }
        };
        gavColumn.setSortable(true);
        gavColumn.setDataStoreName(JarListPageRequest.COLUMN_GAV);
        addColumn(gavColumn, M2RepoEditorConstants.INSTANCE.GAV());
    }

    if (columns.contains(ColumnType.LAST_MODIFIED)) {
        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();
            }
        };
        lastModifiedColumn.setSortable(true);
        lastModifiedColumn.setDataStoreName(JarListPageRequest.COLUMN_LAST_MODIFIED);
        addColumn(lastModifiedColumn, M2RepoEditorConstants.INSTANCE.LastModified(), false);
    }

    dataGrid.addColumnSortHandler(new ColumnSortEvent.AsyncHandler(dataGrid));
}

From source file:org.guvnor.messageconsole.client.console.MessageConsoleViewImpl.java

License:Apache License

private void addLineColumn() {
    final Column<MessageConsoleServiceRow, ?> lineColumn = new Column<MessageConsoleServiceRow, String>(
            new TextCell()) {
        @Override/* ww w  .j  a va  2  s . co m*/
        public String getValue(MessageConsoleServiceRow row) {
            return row != null ? Integer.toString(row.getMessageLine()) : null;
        }
    };
    dataGrid.addColumn(lineColumn, MessageConsoleResources.CONSTANTS.Line());
    dataGrid.setColumnWidth(lineColumn, 75, Style.Unit.PX);
}

From source file:org.guvnor.messageconsole.client.console.MessageConsoleViewImpl.java

License:Apache License

private void addColumnColumn() {
    Column<MessageConsoleServiceRow, ?> column = new Column<MessageConsoleServiceRow, String>(new TextCell()) {
        @Override//from ww w . j a  va  2 s.  c  om
        public String getValue(MessageConsoleServiceRow row) {
            return Integer.toString(row.getMessageColumn());
        }
    };
    dataGrid.addColumn(column, MessageConsoleResources.CONSTANTS.Column());
    dataGrid.setColumnWidth(column, 75, Style.Unit.PX);
}