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

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

Introduction

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

Prototype

public void setFieldUpdater(FieldUpdater<T, C> fieldUpdater) 

Source Link

Document

Set the FieldUpdater used for updating values in the column.

Usage

From source file:org.guvnor.asset.management.client.editors.project.structure.widgets.ProjectModulesViewImpl.java

License:Apache License

private void addEditModuleColumn() {
    final ButtonCell editModuleButton = new ButtonCell(IconType.EDIT, ButtonType.PRIMARY, ButtonSize.SMALL);
    final Column<ProjectModuleRow, String> editModuleColumn = new Column<ProjectModuleRow, String>(
            editModuleButton) {//from   w  w  w  .  j  av  a 2s . c  o m
        @Override
        public String getValue(final ProjectModuleRow moduleRow) {
            return Constants.INSTANCE.EditModule();
        }
    };
    editModuleColumn.setFieldUpdater(new FieldUpdater<ProjectModuleRow, String>() {
        public void update(final int index, final ProjectModuleRow moduleRow, final String value) {
            if (presenter != null && actionsEnabled) {
                presenter.onEditModule(moduleRow);
            }
        }
    });

    modulesTable.addColumn(editModuleColumn, "");
    modulesTable.setColumnWidth(editModuleColumn, 15, Style.Unit.PCT);
}

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//from  ww  w .  j ava 2  s  . c  o 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.  ja va 2  s  .co  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.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();
        }// ww w. j av  a2s  . c  o  m
    };

    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";
        }/*from w w  w.ja  v a2 s.com*/
    };

    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  ww  .  j a va  2  s  .  com*/
        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();
        }/*w  w w  .  jav a  2  s  .  co  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.messageconsole.client.console.MessageConsoleViewImpl.java

License:Apache License

private void addFileNameColumn() {
    final Column<MessageConsoleServiceRow, HyperLinkCell.HyperLink> column = new Column<MessageConsoleServiceRow, HyperLinkCell.HyperLink>(
            new HyperLinkCell()) {
        @Override// w ww. jav a 2 s .c  om
        public HyperLinkCell.HyperLink getValue(MessageConsoleServiceRow row) {
            if (row.getMessagePath() != null) {
                return HyperLinkCell.HyperLink.newLink(row.getMessagePath().getFileName());
            } else {
                return HyperLinkCell.HyperLink.newText("-");
            }
        }
    };
    column.setFieldUpdater(new FieldUpdater<MessageConsoleServiceRow, HyperLinkCell.HyperLink>() {
        @Override
        public void update(final int index, final MessageConsoleServiceRow row,
                final HyperLinkCell.HyperLink value) {
            if (row.getMessagePath() != null) {
                placeManager.goTo(row.getMessagePath());
            }
        }
    });
    dataGrid.addColumn(column, MessageConsoleResources.CONSTANTS.FileName());
    dataGrid.setColumnWidth(column, 180, Style.Unit.PX);
}

From source file:org.gwtbootstrap3.demo.client.application.css.TablesView.java

License:Apache License

private void initTable(final AbstractCellTable<TableTestPojo> grid, final SimplePager pager,
        final Pagination pagination, final ListDataProvider<TableTestPojo> dataProvider) {
    final TextColumn<TableTestPojo> col1 = new TextColumn<TableTestPojo>() {

        @Override//from   w ww  .ja v  a2s.  com
        public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
        }
    };
    grid.addColumn(col1, "Field 1");

    final TextColumn<TableTestPojo> col2 = new TextColumn<TableTestPojo>() {

        @Override
        public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
        }
    };
    grid.addColumn(col2, "Field 2");

    final TextColumn<TableTestPojo> col3 = new TextColumn<TableTestPojo>() {

        @Override
        public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
        }
    };
    grid.addColumn(col3, "Field 3");

    final Column<TableTestPojo, String> col4 = new Column<TableTestPojo, String>(
            new ButtonCell(ButtonType.PRIMARY, IconType.GITHUB)) {
        @Override
        public String getValue(TableTestPojo object) {
            return "Click Me";
        }
    };
    col4.setFieldUpdater(new FieldUpdater<TableTestPojo, String>() {
        @Override
        public void update(int index, TableTestPojo object, String value) {
            Window.alert("Clicked!");
        }
    });
    grid.addColumn(col4, "Buttons");

    grid.addRangeChangeHandler(new RangeChangeEvent.Handler() {

        @Override
        public void onRangeChange(final RangeChangeEvent event) {
            pagination.rebuild(pager);
        }
    });

    pager.setDisplay(grid);
    pagination.clear();
    dataProvider.addDataDisplay(grid);
}

From source file:org.jboss.as.console.client.teiid.runtime.VDBCachingTab.java

License:Open Source License

private DefaultCellTable getMaterializedTable() {
    ProvidesKey keyProvider = new ProvidesKey<MaterializedView>() {
        @Override/*www .j av  a2  s  . co m*/
        public Object getKey(MaterializedView item) {
            return getVdbName() + "." + getVdbVersion() + "." + item.getModelName() + "." + item.getTableName();
        }
    };

    final DefaultCellTable table = new DefaultCellTable<MaterializedView>(10, keyProvider);

    TextColumn<MaterializedView> nameColumn = new TextColumn<MaterializedView>() {
        @Override
        public String getValue(MaterializedView record) {
            return record.getTableName();
        }
    };
    nameColumn.setSortable(true);

    TextColumn<MaterializedView> modelNameColumn = new TextColumn<MaterializedView>() {
        @Override
        public String getValue(MaterializedView record) {
            return String.valueOf(record.getModelName());
        }
    };
    modelNameColumn.setSortable(true);

    TextColumn<MaterializedView> validColumn = new TextColumn<MaterializedView>() {
        @Override
        public String getValue(MaterializedView record) {
            return String.valueOf(record.isValid());
        }
    };
    validColumn.setSortable(true);

    TextColumn<MaterializedView> lastUpdatedTime = new TextColumn<MaterializedView>() {
        @Override
        public String getValue(MaterializedView record) {
            //return dtf.format(dtf.parse(record.getLastUpdatedTime()), TimeZone.createTimeZone(0));
            return record.getLastUpdatedTime();
        }
    };
    lastUpdatedTime.setSortable(true);

    TextColumn<MaterializedView> loadStateColumn = new TextColumn<MaterializedView>() {
        @Override
        public String getValue(MaterializedView record) {
            return record.getLoadState();
        }
    };
    loadStateColumn.setSortable(true);

    TextColumn<MaterializedView> cardinalityColumn = new TextColumn<MaterializedView>() {
        @Override
        public String getValue(MaterializedView record) {
            return String.valueOf(record.getCardinality());
        }
    };
    loadStateColumn.setSortable(true);

    Column<MaterializedView, String> invalidateBtn = new Column<MaterializedView, String>(new ButtonCell()) {
        @Override
        public String getValue(MaterializedView record) {
            return "Reload";
        }
    };
    invalidateBtn.setFieldUpdater(new FieldUpdater<MaterializedView, String>() {
        @Override
        public void update(int index, MaterializedView table, String value) {
            invalidate(table, "Reload");
        }
    });

    table.setSelectionModel(new SingleSelectionModel<MaterializedView>(keyProvider));

    table.setTitle("Mateiralized Tables");
    table.addColumn(nameColumn, "View");
    table.addColumn(modelNameColumn, "Model Name");
    table.addColumn(validColumn, "Valid");
    table.addColumn(lastUpdatedTime, "Last Updated");
    table.addColumn(loadStateColumn, "State");
    table.addColumn(cardinalityColumn, "# Rows");
    table.addColumn(invalidateBtn, INVALIDATE);
    return table;
}