use of com.google.gwt.cell.client.TextCell in project che by eclipse.
the class ResetToCommitViewImpl method createCommitsTable.
/** Creates table what contains list of available commits. */
private void createCommitsTable() {
commits = new CellTable<Revision>(15, tableRes);
Column<Revision, String> dateColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(new Date((long) revision.getCommitTime()));
}
@Override
public void render(Cell.Context context, Revision revision, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-reset-cellTable-" + context.getIndex() + "\">");
super.render(context, revision, sb);
}
};
Column<Revision, String> commiterColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
if (revision.getCommitter() == null) {
return "";
}
return revision.getCommitter().getName();
}
};
Column<Revision, String> commentColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage();
}
};
commits.addColumn(dateColumn, locale.commitGridDate());
commits.setColumnWidth(dateColumn, "20%");
commits.addColumn(commiterColumn, locale.commitGridCommiter());
commits.setColumnWidth(commiterColumn, "20%");
commits.addColumn(commentColumn, locale.commitGridComment());
commits.setColumnWidth(commentColumn, "60%");
final SingleSelectionModel<Revision> selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Revision selectedObject = selectionModel.getSelectedObject();
delegate.onRevisionSelected(selectedObject);
}
});
commits.setSelectionModel(selectionModel);
}
use of com.google.gwt.cell.client.TextCell in project perun by CESNET.
the class JsonUtils method addColumn.
/**
* Returns a column with a header and with automatic cell selection
*
* @param <R> the row type
* @param getter the value getter for the cell
* @param fieldUpdater Field updater - on click action
*/
public static <R> Column<R, String> addColumn(final GetValue<R, String> getter, final FieldUpdater<R, String> fieldUpdater) {
Cell<String> cell;
if (fieldUpdater == null) {
cell = new TextCell();
} else {
cell = new CustomClickableTextCell();
}
Column<R, String> column = new Column<R, String>(cell) {
@Override
public String getValue(R object) {
return getter.getValue(object);
}
@Override
public String getCellStyleNames(Cell.Context context, R object) {
if (fieldUpdater != null) {
return super.getCellStyleNames(context, object) + " pointer";
} else {
return super.getCellStyleNames(context, object);
}
}
};
if (fieldUpdater != null) {
column.setFieldUpdater(fieldUpdater);
}
return column;
}
use of com.google.gwt.cell.client.TextCell in project mvp4g2-examples by mvp4g.
the class ListView method createView.
public void createView() {
panel = new ScrollPanel();
FlowPanel resultPanel = new FlowPanel();
resultPanel.addStyleName(style.resultPanel());
panel.add(resultPanel);
Label headline = new Label(ApplicationConstants.CONSTANTS.resultHeadline());
headline.addStyleName(style.headline());
resultPanel.add(headline);
resultTable = new CellTable<Person>();
resultPanel.add(resultTable);
resultTable.setEmptyTableWidget(new HTML(ApplicationConstants.CONSTANTS.resultText()));
Column<Person, String> nameColumn = addColumn(new ClickableTextCell(), ApplicationConstants.CONSTANTS.columnName(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getName() + ", " + person.getFirstName();
}
}, new FieldUpdater<Person, String>() {
@Override
public void update(int index, Person object, String value) {
getPresenter().doUpdate(object);
}
});
Column<Person, String> streetColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnStreet(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getAddress().getStreet();
}
}, null);
Column<Person, String> plzColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnPlz(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getAddress().getZip();
}
}, null);
plzColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
Column<Person, String> cityColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnCity(), new GetValue<String>() {
@Override
public String getValue(Person person) {
return person.getAddress().getCity();
}
}, null);
// Tabellen und Spalten-Breite setzen
resultTable.setWidth("100%");
resultTable.setColumnWidth(nameColumn, "40%");
resultTable.setColumnWidth(streetColumn, "25%");
resultTable.setColumnWidth(plzColumn, "10%");
resultTable.setColumnWidth(cityColumn, "25%");
resetTable();
}
Aggregations