當前位置: 首頁>>代碼示例>>Java>>正文


Java Grid.removeAllColumns方法代碼示例

本文整理匯總了Java中com.vaadin.ui.Grid.removeAllColumns方法的典型用法代碼示例。如果您正苦於以下問題:Java Grid.removeAllColumns方法的具體用法?Java Grid.removeAllColumns怎麽用?Java Grid.removeAllColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.Grid的用法示例。


在下文中一共展示了Grid.removeAllColumns方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: formatHeaders

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<HeaderGridRow> formatHeaders(String title, Map<String, List<String>> headers) {
	Grid<HeaderGridRow> grid = new Grid<>(HeaderGridRow.class);

	grid.removeAllColumns();

	Column<HeaderGridRow, String> headerColumn = grid.addColumn(HeaderGridRow::getHeader)
			.setCaption("Header")
			.setExpandRatio(1);
	Column<HeaderGridRow, String> valuesColumn = grid.addColumn(HeaderGridRow::getValues)
			.setCaption("Values")
			.setDescriptionGenerator(HeaderGridRow::getValues)
			.setExpandRatio(1);

	grid.setItems(headers.entrySet().stream().map(HeaderGridRow::new));
	grid.sort(headerColumn);

	HeaderRow titleRow = grid.prependHeaderRow();
	titleRow.join(headerColumn, valuesColumn).setHtml(title);

	return grid;
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:22,代碼來源:TracePage.java

示例2: getRestGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Component getRestGrid(Collection<MetricsRest> metrics, Series httpSerie) {

		List<MetricsRest> metricsItems = metrics.stream()
													.filter(m -> m.valid() && m.getStatus().series() == httpSerie)
													.collect(Collectors.toList());

		if(metricsItems.isEmpty()) {
			return new Label("No requests");
		} else {
			Grid<MetricsRest> gridCache = new Grid<>(MetricsRest.class);
			gridCache.removeAllColumns();
			gridCache.addColumn(MetricsRest::getName).setCaption("Path").setExpandRatio(1);
			gridCache.addColumn(m -> m.getStatus() + " " + m.getStatus().getReasonPhrase()).setCaption("HTTP Status");
			gridCache.addColumn(MetricsRest::getValue).setCaption("Hits");
			gridCache.addColumn(MetricsRest::getLastResponseTime).setCaption("Last Response Time (ms)");

			gridCache.setItems(metricsItems);
			if(metricsItems.size() < 10) {
				gridCache.setHeightByRows(metricsItems.size());
			}
			gridCache.setWidth(100, Unit.PERCENTAGE);

			return gridCache;
		}
	}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:26,代碼來源:MetricsPage.java

示例3: getCacheGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<MetricsCacheGridRow> getCacheGrid(Collection<MetricsCache> metricsCaches) {
	List<MetricsCacheGridRow> metricsCacheItems = metricsCaches.stream()
													.map(MetricsCacheGridRow::new)
													.collect(Collectors.toList());

	Grid<MetricsCacheGridRow> gridCache = new Grid<>(MetricsCacheGridRow.class);
	gridCache.removeAllColumns();
	gridCache.addColumn(MetricsCacheGridRow::getName).setCaption("Name").setExpandRatio(1);
	gridCache.addColumn(MetricsCacheGridRow::getSize).setCaption("Size");
	gridCache.addColumn(MetricsCacheGridRow::getHit).setCaption("Hit");
	gridCache.addColumn(MetricsCacheGridRow::getMiss).setCaption("Miss");

	gridCache.setItems(metricsCacheItems);
	gridCache.setHeightByRows(metricsCacheItems.size());
	return gridCache;
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:17,代碼來源:MetricsPage.java

示例4: getTracesGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<TraceGridRow> getTracesGrid(List<Trace> traces) {

		List<TraceGridRow> tracesInfos = traces.stream()
											.map(TraceGridRow::new)
											.collect(Collectors.toList());

		Grid<TraceGridRow> grid = new Grid<>(TraceGridRow.class);
		grid.removeAllColumns();

		grid.addColumn(TraceGridRow::getTimestamp).setCaption("Date");
		grid.addColumn(t -> t.getMethod() + " " + t.getPath()).setCaption("HTTP Request").setExpandRatio(1);
		grid.addColumn(t -> {
			if(t.getResponseHttp().isPresent()) {
				return t.getResponseHttp().get() + " " + t.getResponseHttp().get().getReasonPhrase();
			}
			return "";
		}).setCaption("HTTP Response");
		grid.addColumn(t -> t.getTimeTaken().isPresent() ? t.getTimeTaken().get().toMillis() : -1).setCaption("Time taken (ms)");

		this.requestDetailsPopup(grid);

		grid.setItems(tracesInfos);
		grid.setSizeFull();
		return grid;
	}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:26,代碼來源:TracePage.java

示例5: getDatasourceGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<MetricsDatasource> getDatasourceGrid(Collection<MetricsDatasource> metrics) {

		Grid<MetricsDatasource> grid = new Grid<>(MetricsDatasource.class);
		grid.removeAllColumns();
		grid.addColumn(MetricsDatasource::getName).setCaption("Datasource name").setExpandRatio(1);
		grid.addColumn(MetricsDatasource::getActiveConnections).setCaption("Active connections");
		grid.addColumn(MetricsDatasource::getConnectionPoolUsage).setCaption("Connection pool usage");

		grid.setItems(metrics);
		grid.setHeightByRows(metrics.size());

		return grid;
	}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:14,代碼來源:MetricsPage.java

示例6: getAllMetricsGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<MetricsGridRow> getAllMetricsGrid(Map<String, Number> metrics) {
	allMetricsRows = metrics.entrySet().stream()
							.map(MetricsGridRow::new)
							.collect(Collectors.toList());

	Grid<MetricsGridRow> grid = new Grid<>(MetricsGridRow.class);
	grid.removeAllColumns();
	Column<MetricsGridRow, String> nameColumn = grid.addColumn(MetricsGridRow::getName)
															.setCaption("Name")
															.setExpandRatio(1);
	grid.addColumn(MetricsGridRow::getValue).setCaption("Value");

	grid.setItems(allMetricsRows);
	grid.sort(nameColumn);
	grid.setSizeFull();
	grid.setRowHeight(40);

	TextField filterInput = new TextField();
	filterInput.setPlaceholder("filter by metric...");
	filterInput.addValueChangeListener(e -> updateMetrics(e.getValue()));
	filterInput.setValueChangeMode(ValueChangeMode.LAZY);
	filterInput.setSizeFull();

	// Header row
	HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
	filterRow.getCell(nameColumn).setComponent(filterInput);

	return grid;
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:30,代碼來源:MetricsPage.java


注:本文中的com.vaadin.ui.Grid.removeAllColumns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。