List of usage examples for com.google.gwt.user.cellview.client Column Column
public Column(Cell<C> cell)
From source file:com.appspot.socialinquirer.client.view.HomeViewImpl.java
License:Apache License
/** * Inits the table columns./*from w w w . j a va 2 s . co m*/ * * @param table the table */ private void initTableColumns(CellTable<Message> table) { // Checkbox column. This table will uses a checkbox column for // selection. // Alternatively, you can call cellTable.setSelectionEnabled(true) to // enable // mouse selection. // Column<Message, Boolean> checkColumn = new Column<Message, Boolean>( // new CheckboxCell(true, false)) { // @Override // public Boolean getValue(Message object) { // // Get the value from the selection model. // return selectionModel.isSelected(object); // } // }; // table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); // Name. Column<Message, String> nameColumn = new Column<Message, String>(new TextCell()) { @Override public String getValue(Message object) { return object.getName(); } }; table.addColumn(nameColumn, constants.templatesTableColumnName()); // Headline. Column<Message, String> tagsColumn = new Column<Message, String>(new TextCell()) { @Override public String getValue(Message object) { StringBuilder builder = new StringBuilder(); builder.append(object.getRecipient().getDisplayName()); return builder.toString(); } }; table.addColumn(tagsColumn, constants.templatesTableColumnTags()); // Description Column<Message, SafeHtml> descColumn = new Column<Message, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Message object) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant(object.getDescription()); return builder.toSafeHtml(); } }; table.addColumn(descColumn, constants.templatesTableColumnSummary()); }
From source file:com.appspot.socialinquirer.client.view.NetworkViewImpl.java
License:Apache License
/** * Inits the table columns./*w w w .j a v a 2 s . c om*/ * * @param table the table * @param selectionModel the selection model */ private void initTableColumns(CellTable<User> table, final SelectionModel<User> selectionModel) { // Checkbox column. This table will uses a checkbox column for selection. // Alternatively, you can call cellTable.setSelectionEnabled(true) to enable // mouse selection. Column<User, Boolean> checkColumn = new Column<User, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(User object) { // Get the value from the selection model. return selectionModel.isSelected(object); } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); // Name. Column<User, String> nameColumn = new Column<User, String>(new ClickableTextCell()) { @Override public String getValue(User object) { return object.getFullName(); } }; table.addColumn(nameColumn, constants.connectionsTableColumnName()); // Headline. Column<User, String> headlineColumn = new Column<User, String>(new ClickableTextCell()) { @Override public String getValue(User object) { return String.valueOf(object.getReputation()); } }; table.addColumn(headlineColumn, constants.connectionsTableColumnReputation()); // Summary. Column<User, String> projectsColumn = new Column<User, String>(new ClickableTextCell()) { @Override public String getValue(User object) { return String.valueOf(object.getAcceptRate()); } }; table.addColumn(projectsColumn, constants.connectionsTableColumnAcceptRate()); }
From source file:com.appspot.socialinquirer.client.view.PagesViewImpl.java
License:Apache License
/** * Inits the table columns./*from w w w .j av a 2 s. co m*/ * * @param table the table * @param selectionModel the selection model */ private void initTableColumns(CellTable<Page> table, final SelectionModel<Page> selectionModel) { // Checkbox column. This table will uses a checkbox column for // selection. // Alternatively, you can call cellTable.setSelectionEnabled(true) to // enable // mouse selection. Column<Page, Boolean> checkColumn = new Column<Page, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(Page object) { // Get the value from the selection model. return selectionModel.isSelected(object); } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); // Name. Column<Page, String> nameColumn = new Column<Page, String>(new TextCell()) { @Override public String getValue(Page object) { return object.getName(); } }; table.addColumn(nameColumn, constants.templatesTableColumnName()); // Headline. Column<Page, String> tagsColumn = new Column<Page, String>(new TextCell()) { @Override public String getValue(Page object) { StringBuilder builder = new StringBuilder(); for (String tag : object.getTags()) { builder.append(tag).append(" "); } return builder.toString(); } }; table.addColumn(tagsColumn, constants.templatesTableColumnTags()); // Description Column<Page, SafeHtml> descColumn = new Column<Page, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Page object) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant(object.getDescription()); return builder.toSafeHtml(); } }; table.addColumn(descColumn, constants.templatesTableColumnSummary()); }
From source file:com.appspot.socialinquirer.client.view.QuestionsViewImpl.java
License:Apache License
/** * Inits the table columns./* ww w . j a va 2s .c o m*/ * * @param table the table * @param selectionModel the selection model */ private void initTableColumns(CellTable<Question> table, final SelectionModel<Question> selectionModel) { // Checkbox column. This table will uses a checkbox column for selection. // Alternatively, you can call cellTable.setSelectionEnabled(true) to enable // mouse selection. Column<Question, Boolean> checkColumn = new Column<Question, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(Question object) { // Get the value from the selection model. return selectionModel.isSelected(object); } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); // Title. Column<Question, SafeHtml> titleColumn = new Column<Question, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Question object) { return SafeHtmlUtils.fromSafeConstant(object.getTitle()); } }; table.addColumn(titleColumn, constants.templatesTableColumnName()); // Description. Column<Question, SafeHtml> textColumn = new Column<Question, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Question object) { return SafeHtmlUtils.fromSafeConstant(object.getContent()); } }; table.addColumn(textColumn, constants.templatesTableColumnSummary()); // Status. Column<Question, SafeHtml> statusColumn = new Column<Question, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Question object) { return SafeHtmlUtils.fromSafeConstant(object.getTags().toString()); } }; table.addColumn(statusColumn, constants.templatesTableColumnTags()); Column<Question, SafeHtml> authorColumn = new Column<Question, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Question object) { return SafeHtmlUtils.fromSafeConstant(object.getAuthor()); } }; table.addColumn(authorColumn, constants.templatesTableColumnAuthor()); // Due Date. Column<Question, Date> dueDateColumn = new Column<Question, Date>(new DateCell()) { @Override public Date getValue(Question object) { return object.getPublishedDate(); } }; table.addColumn(dueDateColumn, constants.templatesTableColumnPostedDate()); }
From source file:com.appspot.socialinquirer.client.view.QuestionViewImpl.java
License:Apache License
/** * Inits the table columns.//from w w w . ja va 2 s. co m * * @param table the table * @param selectionModel the selection model */ private void initTableColumns(CellTable<Answer> table, final SelectionModel<Answer> selectionModel) { // Checkbox column. This table will uses a checkbox column for selection. // Alternatively, you can call cellTable.setSelectionEnabled(true) to enable // mouse selection. // Column<Answer, Boolean> checkColumn = new Column<Answer, Boolean>( // new CheckboxCell(true, false)) { // @Override // public Boolean getValue(Answer object) { // // Get the value from the selection model. // return selectionModel.isSelected(object); // } // }; // table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); // Description. Column<Answer, SafeHtml> textColumn = new Column<Answer, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Answer object) { return SafeHtmlUtils.fromSafeConstant(object.getContent()); } }; table.addColumn(textColumn, constants.templatesTableColumnSummary()); // Status. Column<Answer, SafeHtml> authorColumn = new Column<Answer, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Answer object) { return SafeHtmlUtils.fromSafeConstant(object.getAuthor()); } }; table.addColumn(authorColumn, constants.templatesTableColumnAuthor()); // Due Date. Column<Answer, Date> dueDateColumn = new Column<Answer, Date>(new DateCell()) { @Override public Date getValue(Answer object) { return object.getPublishedDate(); } }; table.addColumn(dueDateColumn, constants.templatesTableColumnPostedDate()); }
From source file:com.appspot.socialinquirer.client.view.QuizViewImpl.java
License:Apache License
/** * Inits the table columns.// w w w .jav a 2 s .c om * * @param table the table * @param selectionModel the selection model */ private void initTableColumns(CellTable<Answer> table, final SelectionModel<Answer> selectionModel) { // Checkbox column. This table will uses a checkbox column for selection. // Alternatively, you can call cellTable.setSelectionEnabled(true) to enable // mouse selection. Column<Answer, Boolean> checkColumn = new Column<Answer, Boolean>(new CheckboxCell(true, false)) { @Override public Boolean getValue(Answer object) { // Get the value from the selection model. return selectionModel.isSelected(object); } }; table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); // Description. Column<Answer, SafeHtml> textColumn = new Column<Answer, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Answer object) { return SafeHtmlUtils.fromSafeConstant(object.getContent()); } }; table.addColumn(textColumn, constants.templatesTableColumnSummary()); // Status. Column<Answer, SafeHtml> authorColumn = new Column<Answer, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Answer object) { return SafeHtmlUtils.fromSafeConstant(object.getAuthor()); } }; table.addColumn(authorColumn, constants.templatesTableColumnAuthor()); // Due Date. Column<Answer, Date> dueDateColumn = new Column<Answer, Date>(new DateCell()) { @Override public Date getValue(Answer object) { return object.getPublishedDate(); } }; table.addColumn(dueDateColumn, constants.templatesTableColumnPostedDate()); }
From source file:com.chinarewards.gwt.license.client.user.view.UserSearchWidget.java
private void initTableColumns(final SelectionModel<UserVo> selectionModel) { Column<UserVo, Boolean> checkColumn = new Column<UserVo, Boolean>(new CheckboxCell()) { @Override/* w ww . java 2s . co m*/ public Boolean getValue(UserVo o) { return selectionModel.isSelected(o); } }; users = new HashMap<String, UserVo>(); checkColumn.setFieldUpdater(new FieldUpdater<UserVo, Boolean>() { @Override public void update(int index, UserVo o, Boolean value) { if (value) { users.put(o.getId(), o); } else { users.remove(o.getId()); } selectionModel.setSelected(o, value); } }); resultTable.addColumn(checkColumn, ""); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getName(); } }, "???"); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getEnterpriseName(); } }, "????"); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getMobile(); } }, ""); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getEmail(); } }, ""); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getCreatedAt() != null ? dateFormat.format(o.getCreatedAt()) : ""; } }, "?"); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getStatus(); } }, "?"); resultTable.addColumn(new TextColumn<UserVo>() { @Override public String getValue(UserVo o) { return o.getBalance() + ""; } }, ""); resultTable.addColumn("?", new HyperLinkCell(), new GetValue<UserVo, String>() { @Override public String getValue(UserVo userVo) { return ""; } }, new FieldUpdater<UserVo, String>() { @Override public void update(int index, UserVo o, String value) { users.put(o.getId(), o); } }); }
From source file:com.chinarewards.gwt.license.client.widget.ListCellTable.java
private <C> Column<T, C> addColumn(final String text, final Cell<C> cell, final GetValue<T, C> getter, final FieldUpdater<T, C> fieldUpdater, final Comparator<T> ascComparator, final Comparator<T> descComparator, final Sorting<T> ref, final String sortingText) { // Create the column final Column<T, C> column = new Column<T, C>(cell) { @Override/*from www .jav a2s .c om*/ public C getValue(T object) { return getter.getValue(object); } }; /** * ??HeaderHeader */ if (ref != null) { final SortableHeader header = new SortableHeader(text); allHeaders.add(header); // Hook up sorting header.setUpdater(new ValueUpdater<String>() { @Override public void update(String value) { header.setSorted(true); header.toggleReverseSort(); for (SortableHeader otherHeader : allHeaders) { if (otherHeader != header) { otherHeader.setSorted(false); otherHeader.setReverseSort(true); } } // table.refreshHeaders(); // TODO remove this when // confirmed working. ListCellTable.this.redrawHeaders(); if (StringUtil.isEmpty(sortingText)) { ref.sortingCurrentPage(header.getReverseSort() ? descComparator : ascComparator); } else { ref.sortingAll(sortingText, header.getReverseSort() ? "desc" : "asc"); } } }); this.addColumn(column, header); } else { TextHeader header = new TextHeader(text); int fal = 0; for (TextHeader otherHeader : allTextHeaders) { if (otherHeader.getValue() == header.getValue()) { header = otherHeader; fal = 1; } } if (fal != 1) allTextHeaders.add(header); this.addColumn(column, header); } if (fieldUpdater != null) { column.setFieldUpdater(fieldUpdater); } return column; }
From source file:com.chinarewards.gwt.license.client.widget.ListImageTable.java
private <C> Column<T, C> addColumn(final String text, final Cell<C> cell, final GetValue<T, C> getter, final FieldUpdater<T, C> fieldUpdater, final Comparator<T> ascComparator, final Comparator<T> descComparator, final Sorting<T> ref, final String sortingText) { // Create the column final Column<T, C> column = new Column<T, C>(cell) { @Override/*w w w. ja va 2s . c o m*/ public C getValue(T object) { return getter.getValue(object); } }; /** * ??HeaderHeader */ if (ref != null) { final SortableHeader header = new SortableHeader(text); allHeaders.add(header); // Hook up sorting header.setUpdater(new ValueUpdater<String>() { @Override public void update(String value) { header.setSorted(true); header.toggleReverseSort(); for (SortableHeader otherHeader : allHeaders) { if (otherHeader != header) { otherHeader.setSorted(false); otherHeader.setReverseSort(true); } } // table.refreshHeaders(); // TODO remove this when // confirmed working. ListImageTable.this.redrawHeaders(); if (StringUtil.isEmpty(sortingText)) { ref.sortingCurrentPage(header.getReverseSort() ? descComparator : ascComparator); } else { ref.sortingAll(sortingText, header.getReverseSort() ? "desc" : "asc"); } } }); this.addColumn(column, header); } else { final TextHeader header = new TextHeader(text); this.addColumn(column, header); } if (fieldUpdater != null) { column.setFieldUpdater(fieldUpdater); } return column; }
From source file:com.codenvy.ide.client.propertiespanel.common.namespace.NameSpaceEditorViewImpl.java
License:Open Source License
private CellTable<NameSpace> createTable(@Nonnull CellTableResources resource) { CellTable<NameSpace> table = new CellTable<>(0, resource); Column<NameSpace, String> nameSpace = new Column<NameSpace, String>(new TextCell()) { @Override// www . jav a2 s . co m public String getValue(NameSpace object) { return object.toString(); } }; table.setLoadingIndicator(null); table.addColumn(nameSpace); table.setColumnWidth(nameSpace, 570, Style.Unit.PX); final SingleSelectionModel<NameSpace> selectionModel = new SingleSelectionModel<>(); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { delegate.onSelectedNameSpace(selectionModel.getSelectedObject()); } }); table.setSelectionModel(selectionModel); return table; }