本文整理了Java中com.google.gwt.user.cellview.client.DataGrid
类的一些代码示例,展示了DataGrid
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataGrid
类的具体详情如下:
包路径:com.google.gwt.user.cellview.client.DataGrid
类名称:DataGrid
[英]A tabular view with a fixed header and footer section and a scrollable data section in the middle. This widget supports paging and columns.
The Column class defines the com.google.gwt.cell.client.Cell used to render a column. Implement Column#getValue(Object) to retrieve the field value from the row object that will be rendered in the com.google.gwt.cell.client.Cell.
A Header can be placed at the top (header) or bottom (footer) of the DataGrid. You can specify a header as text using #addColumn(Column,String), or you can create a custom Header that can change with the value of the cells, such as a column total. The Header will be rendered every time the row data changes or the table is redrawn. If you pass the same header instance (==) into adjacent columns, the header will span the columns.
Trivial example com.google.gwt.examples.cellview.CellTableExample FieldUpdater example com.google.gwt.examples.cellview.CellTableFieldUpdaterExample Key provider example com.google.gwt.examples.view.KeyProviderExample
[中]一个表格视图,中间有一个固定的页眉和页脚部分和一个可滚动的数据部分。此小部件支持分页和列。
####纵队
Column类定义了com。谷歌。gwt。单间牢房客户用于渲染列的单元格。实现列#getValue(Object)以从将在com中呈现的行对象检索字段值。谷歌。gwt。单间牢房客户单间牢房
####页眉和页脚
页眉可以放置在数据网格的顶部(页眉)或底部(页脚)。您可以使用#addColumn(Column,String)将标题指定为文本,也可以创建可随单元格值(如列总数)更改的自定义标题。每次行数据更改或重新绘制表时,都会呈现标题。如果将相同的标题实例(=)传递到相邻列中,则标题将跨越这些列。
####例子
简单的例子com。谷歌。gwt。例子。cellview。CellTableExample FieldUpdater示例com。谷歌。gwt。例子。cellview。CellTableFieldUpdaterExample密钥提供程序示例com。谷歌。gwt。例子。看法KeyProviderExample
代码示例来源:origin: kaaproject/kaa
@Override
protected float constructActions(DataGrid<T> table, float prefWidth) {
float result = 0;
if (downloadSchemaColumn == null || table.getColumnIndex(downloadSchemaColumn) == -1) {
Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader(
SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordSchema()));
downloadSchemaColumn = constructDownloadSchemaColumn();
table.addColumn(downloadSchemaColumn, downloadRecordSchemaHeader);
table.setColumnWidth(downloadSchemaColumn, 60, Unit.PX);
result += 60;
}
return result;
}
代码示例来源:origin: kaaproject/kaa
/**
* The constructor.
*/
public AbstractDataProvider(AbstractGrid<T, K> dataGrid, HasErrorMessage hasErrorMessage,
boolean addDisplay) {
this.dataGrid = dataGrid;
callback = new LoadCallback(hasErrorMessage);
dataGrid.getDataGrid().addColumnSortHandler(this);
dataGrid.addColumnFilterEventHandler(this);
if (addDisplay) {
addDataDisplay(dataGrid.getDataGrid());
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Constructs a table with the given page size, the specified
* {@link Resources}, and the given key provider.
*
* @param pageSize the page size
* @param resources the resources to use for this widget
* @param keyProvider an instance of ProvidesKey<T>, or null if the record
* object should act as its own key
*/
public DataGrid(int pageSize, Resources resources, ProvidesKey<T> keyProvider) {
this(pageSize, resources, keyProvider, createDefaultLoadingIndicator(resources));
}
代码示例来源:origin: kaaproject/kaa
SafeHtmlUtils.fromSafeConstant(Utils.constants.action()));
table.addColumn(actionColumn, actionHeader);
actionColumn.setFieldUpdater(
new FieldUpdater<ApplicationEventMapDto, ApplicationEventAction>() {
table.setColumnWidth(actionColumn, 80, Unit.PX);
prefWidth += 80;
} else {
代码示例来源:origin: net.sf.javaprinciples.client/client-presentation
DataGrid widget = new DataGrid<JSONObject>();
widget.setWidth("100%");
widget.setAutoHeaderRefreshDisabled(true);
widget.setHeight("300");
widget.addColumn(column, classAttributeMetadata.getLabel());
widget.setColumnWidth(column, 40, Style.Unit.PX);
widget.setRowCount(list.size());
widget.setRowData(list);
代码示例来源:origin: org.jresearch.logui/org.jresearch.logui.gwt.core
private DataGrid<LogUiAppender> createDatagrid() {
final DataGrid<LogUiAppender> dataGrid = new DataGrid<>(30);
dataGrid.addColumn(colName, "Name");
dataGrid.setColumnWidth(colName, 90, Unit.PCT);
dataGrid.addColumn(colClassName, "Type");
dataGrid.setColumnWidth(colClassName, 30, Unit.PCT);
代码示例来源:origin: bedatadriven/activityinfo
public void refresh(ValidatedRowTable table) {
while (dataGrid.getColumnCount() > 0) {
dataGrid.removeColumn(0);
}
for(int i = 0; i< table.getColumns().size(); i++) {
final FieldImporterColumn column = table.getColumns().get(i);
String columnHeader = column.getAccessor().getHeading();
dataGrid.addColumn(new ValidationRowGridColumn(column.getAccessor(), i),
new TextHeader(columnHeader));
dataGrid.setColumnWidth(i, GwtUtil.columnWidthInEm(columnHeader), Style.Unit.EM);
}
dataGrid.setRowData(table.getRows());
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
@Inject
public ExtensionManagerViewImpl(
ToolbarPresenter toolbarPresenter, ActionManager actionManager, Resources resources) {
dataGrid = new DataGrid<>(100, resources);
rootElement = ourUiBinder.createAndBindUi(this);
DefaultActionGroup actionGroup =
new DefaultActionGroup("extensionManager", false, actionManager);
actionManager.registerAction("extensionManagerGroup", actionGroup);
toolbarPresenter.bindMainGroup(actionGroup);
UIObject.ensureDebugId(descriptionArea, "window-preferences-extensions-descriptionArea");
Column<ExtensionDescription, String> titleColumn =
new Column<ExtensionDescription, String>(new TextCell()) {
@Override
public String getValue(ExtensionDescription object) {
return object.getTitle();
}
};
titleColumn.setCellStyleNames(style.titleColumn());
dataGrid.addColumn(titleColumn);
SingleSelectionModel<ExtensionDescription> selectionModel =
new SingleSelectionModel<ExtensionDescription>();
dataGrid.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {}
});
}
代码示例来源:origin: bedatadriven/activityinfo
public ValidationMappingGrid() {
this.dataGrid = new DataGrid<>(100, DataGridResources.INSTANCE);
dataGrid.addColumn(new ValidationClassGridColumn(), new TextHeader(I18N.CONSTANTS.message()));
initWidget(dataGrid);
}
代码示例来源:origin: org.geomajas/geomajas-puregwt-example-base
public SampleListView(List<ShowcaseSampleDefinition> data, final SampleOverviewPage overviewPage) {
initWidget(UIBINDER.createAndBindUi(this));
ProvidesKey<ShowcaseSampleDefinition> sampleKeyProvider = new ProvidesKey<ShowcaseSampleDefinition>() {
public Object getKey(ShowcaseSampleDefinition item) {
return item.getTitle();
}
};
// We fill the grid through a list of SamplePanelFactory objects:
dataProvider = new ListDataProvider<ShowcaseSampleDefinition>(sampleKeyProvider);
dataProvider.addDataDisplay(grid);
// Selection: show sample on click
final SingleSelectionModel<ShowcaseSampleDefinition> selectionModel;
selectionModel = new SingleSelectionModel<ShowcaseSampleDefinition>(sampleKeyProvider);
grid.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
ExampleBase.showSample(selectionModel.getSelectedObject());
}
});
// Add a sort handler:
sortHandler = new ListHandler<ShowcaseSampleDefinition>(dataProvider.getList());
grid.addColumnSortHandler(sortHandler);
// Initialize the grid columns:
initColumns();
// Apply the entire data-set:
setData(data);
}
代码示例来源:origin: marianbuenosayres/jBPM6-Developer-Guide
private void initTableColumns() {
Column<String, String> messageTextColumn = new Column<String, String>(new TextCell()) {
@Override
public String getValue(String string) {
return string;
}
};
messageTextColumn.setSortable(true);
sortHandler.setComparator(messageTextColumn, new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.compareTo(o2);
}
});
messageListGrid.addColumn(messageTextColumn);
}
代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client
@Inject
public TestRunnerReportingViewImpl() {
dataGrid = new DataGrid<Failure>();
dataGrid.setWidth("100%");
dataGrid.setAutoHeaderRefreshDisabled(true);
dataGrid.setEmptyTableWidget(new Label("---"));
setUpColumns();
initWidget(uiBinder.createAndBindUi(this));
}
代码示例来源:origin: bedatadriven/activityinfo
public ValidationGrid() {
this.dataGrid = new DataGrid<>(100, DataGridResources.INSTANCE);
initWidget(dataGrid);
this.dataGrid.setWidth("100%");
this.dataGrid.setHeight("100%");
}
代码示例来源:origin: org.geomajas/geomajas-puregwt-example-base
@UiFactory
protected DataGrid<ShowcaseSampleDefinition> createGrid() {
return new DataGrid<ShowcaseSampleDefinition>(1000, RESOURCE);
}
代码示例来源:origin: org.jresearch.logui/org.jresearch.logui.gwt.core
public void refresh() {
appenders.setRowData(0, ImmutableList.<LogUiAppender> of());
appenders.setVisibleRangeAndClearData(new Range(0, appenders.getPageSize()), true);
}
代码示例来源:origin: kaaproject/kaa
detailsView.getSdkAefMapsGrid().getDataGrid().setRowData(aefMapDtoList);
} else {
detailsView.getSdkAefMapsGrid().getDataGrid()
.setRowData(new ArrayList<ApplicationEventFamilyMapDto>());
代码示例来源:origin: oVirt/ovirt-engine
super.setColumnWidth(column, width);
column.setCellStyleNames(columnVisible ? GRID_VISIBLE : GRID_HIDDEN);
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Constructs a table with the given page size.
*
* @param pageSize the page size
*/
public DataGrid(final int pageSize) {
this(pageSize, getDefaultResources());
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
/** {@inheritDoc} */
@Override
public void setExtensions(List<ExtensionDescription> extensions) {
dataGrid.setRowData(extensions);
dataGrid.redraw();
}
代码示例来源:origin: marianbuenosayres/jBPM6-Developer-Guide
@Override
public void init(final MessageListPresenter presenter ) {
this.presenter = presenter;
listContainer.add( messageListGrid );
// Set the message to display when the table is empty.
messageListGrid.setEmptyTableWidget( new Label( constants.NoMessages() ) );
sortHandler = new ListHandler<String>(presenter.getDataProvider().getList());
messageListGrid.addColumnSortHandler(sortHandler);
initTableColumns();
presenter.addDataDisplay(messageListGrid);
}
内容来源于网络,如有侵权,请联系作者删除!