use of com.google.gwt.cell.client.TextCell in project kie-wb-common by kiegroup.
the class DataObjectBrowserViewImpl method addPropertyLabelColumn.
private void addPropertyLabelColumn() {
Column<ObjectProperty, String> column = new Column<ObjectProperty, String>(new TextCell()) {
@Override
public String getValue(ObjectProperty objectProperty) {
if (objectProperty.getName() != null) {
return AnnotationValueHandler.getStringValue(objectProperty, MainDomainAnnotations.LABEL_ANNOTATION, MainDomainAnnotations.VALUE_PARAM);
} else {
return "";
}
}
};
column.setSortable(true);
propertiesTable.addColumn(column, Constants.INSTANCE.objectBrowser_columnLabel());
propertiesTable.setColumnWidth(column, 25, Style.Unit.PCT);
columnIds.put(column, ColumnId.LABEL_COLUMN);
}
use of com.google.gwt.cell.client.TextCell in project kie-wb-common by kiegroup.
the class DataObjectBrowserViewImpl method addPropertyNameColumn.
private void addPropertyNameColumn() {
Column<ObjectProperty, String> column = new Column<ObjectProperty, String>(new TextCell()) {
@Override
public String getValue(ObjectProperty objectProperty) {
if (objectProperty.getName() != null) {
return objectProperty.getName();
} else {
return "";
}
}
};
column.setSortable(true);
propertiesTable.addColumn(column, Constants.INSTANCE.objectBrowser_columnName());
propertiesTable.setColumnWidth(column, 25, Style.Unit.PCT);
columnIds.put(column, ColumnId.NAME_COLUMN);
}
use of com.google.gwt.cell.client.TextCell in project gwt-test-utils by gwt-test-utils.
the class CellListTest method beforeCellListTest.
@Before
public void beforeCellListTest() {
sb.delete(0, sb.length());
setBrowserErrorHandler(new BrowserErrorHandler() {
public void onError(String errorMessage) {
sb.append(errorMessage);
}
});
// Create a cell to render each value.
TextCell textCell = new TextCell();
// Create the CellList that uses the cell.
cellList = new CellList<String>(textCell);
// Set the total row count. This isn't strictly necessary, but it affects
// paging calculations, so its good habit to keep the row count up to
// date.
cellList.setRowCount(DAYS.size(), true);
// Push the data into the widget.
cellList.setRowData(0, DAYS);
cellList.setVisibleRange(0, 5);
// Add it to the root panel.
RootPanel.get().add(cellList);
// Preconditions
assertThat(cellList.getRowCount()).isEqualTo(DAYS.size());
assertThat(cellList.getVisibleItemCount()).isEqualTo(5);
assertThat(cellList.getVisibleItem(cellList.getVisibleItemCount() - 1)).isEqualTo("Thursday");
}
use of com.google.gwt.cell.client.TextCell in project che by eclipse.
the class RemoteViewImpl method initRepositoriesTable.
/**
* Initialize the columns of the grid.
*
* @param ideResources
*/
private void initRepositoriesTable(org.eclipse.che.ide.Resources ideResources) {
repositories = new CellTable<>(15, ideResources);
Column<Remote, String> nameColumn = new Column<Remote, String>(new TextCell()) {
@Override
public String getValue(Remote remote) {
return remote.getName();
}
@Override
public void render(Cell.Context context, Remote remote, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-remotes-remotes-cellTable-" + context.getIndex() + "\">");
super.render(context, remote, sb);
}
};
Column<Remote, String> urlColumn = new Column<Remote, String>(new TextCell()) {
@Override
public String getValue(Remote remote) {
return remote.getUrl();
}
};
repositories.addColumn(nameColumn, locale.remoteGridNameField());
repositories.setColumnWidth(nameColumn, "20%");
repositories.addColumn(urlColumn, locale.remoteGridLocationField());
repositories.setColumnWidth(urlColumn, "80%");
final SingleSelectionModel<Remote> selectionModel = new SingleSelectionModel<Remote>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
selectedObject = selectionModel.getSelectedObject();
delegate.onRemoteSelected(selectedObject);
}
});
repositories.setSelectionModel(selectionModel);
}
use of com.google.gwt.cell.client.TextCell in project che by eclipse.
the class RevisionListViewImpl method createRevisionsTable.
private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getId().substring(0, 8) + "...";
}
};
Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
}
};
Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getCommitter().getName();
}
};
Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage().substring(0, 50);
}
};
revisions = new CellTable<>(15, coreRes);
revisions.setWidth("100%");
revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
description.setText(selectionModel.getSelectedObject().getMessage());
delegate.onRevisionSelected(selectionModel.getSelectedObject());
}
});
revisions.setSelectionModel(selectionModel);
revisions.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
delegate.onRevisionDoubleClicked();
}
}, DoubleClickEvent.getType());
this.revisionsPanel.add(revisions);
}
Aggregations