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


Java Grid.setContainerDataSource方法代碼示例

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


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

示例1: createMetadataGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
protected Grid createMetadataGrid() {
    final Grid metadataGrid = new Grid();
    metadataGrid.addStyleName(SPUIStyleDefinitions.METADATA_GRID);
    metadataGrid.setImmediate(true);
    metadataGrid.setHeight("100%");
    metadataGrid.setWidth("100%");
    metadataGrid.setId(UIComponentIdProvider.METDATA_TABLE_ID);
    metadataGrid.setSelectionMode(SelectionMode.SINGLE);
    metadataGrid.setColumnReorderingAllowed(true);
    metadataGrid.setContainerDataSource(getMetadataContainer());
    metadataGrid.getColumn(KEY).setHeaderCaption(i18n.getMessage("header.key"));
    metadataGrid.getColumn(VALUE).setHeaderCaption(i18n.getMessage("header.value"));
    metadataGrid.getColumn(VALUE).setHidden(true);
    metadataGrid.addSelectionListener(this::onRowClick);
    metadataGrid.getColumn(DELETE_BUTTON).setHeaderCaption("");
    metadataGrid.getColumn(DELETE_BUTTON).setRenderer(new HtmlButtonRenderer(this::onDelete));
    metadataGrid.getColumn(DELETE_BUTTON).setWidth(50);
    metadataGrid.getColumn(KEY).setExpandRatio(1);
    return metadataGrid;
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:21,代碼來源:AbstractMetadataPopupLayout.java

示例2: ReleasesView

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
public ReleasesView() {
    setSizeFull();
    setMargin(false);
    ButtonBar buttonBar = new ButtonBar();
    addButton = buttonBar.addButton("Add", FontAwesome.PLUS, e -> add());
    editButton = buttonBar.addButton("Edit", FontAwesome.EDIT, e -> edit());
    exportButton = buttonBar.addButton("Export", FontAwesome.DOWNLOAD, e -> export());
    archiveButton = buttonBar.addButton("Archive", FontAwesome.ARCHIVE, e -> archive());
    // TODO add support for the archive button
    archiveButton.setVisible(false);
    finalizeButton = buttonBar.addButton("Finalize", FontAwesome.CUBE, e -> finalize());
    addComponent(buttonBar);
    enableDisableButtonsForSelectionSize(0);
    grid = new Grid();
    grid.setSizeFull();
    grid.setSelectionMode(SelectionMode.MULTI);
    grid.addItemClickListener(e->rowClicked(e));
    grid.addSelectionListener((e) -> rowSelected(e));
    container = new BeanItemContainer<>(ReleasePackage.class);
    grid.setContainerDataSource(container);
    grid.setColumns("name", "versionLabel", "releaseDate", "released");
    grid.sort("releaseDate", SortDirection.DESCENDING);
    addComponent(grid);
    setExpandRatio(grid, 1);
    progressBar = new ProgressBar(0.0f);
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:27,代碼來源:ReleasesView.java

示例3: init

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
/**
 * Init
 */
private void init() {
	// Init the grid with Caption, alternatively can initialize the same
	// with passing the datasource
	grid = new Grid("My Basic Grid");
	grid.setContainerDataSource(getDatasource());
	// new Customer(15432, "Test", new Date(), "myCity")

	grid.setImmediate(true);
	initSelectionMode();
	initGridProperties();
	// Init the columns
	initGridColumns();
	initLabel();
	initSelectionListeners();
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:19,代碼來源:BasicGridView.java

示例4: buildGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
protected void buildGrid() {
    grid = new Grid();
    grid.setSelectionMode(SelectionMode.NONE);
    grid.setSizeFull();
    grid.setEditorEnabled(!readOnly);
    container = new BeanItemContainer<Record>(Record.class);
    grid.setContainerDataSource(container);
    grid.setColumnOrder("entityName", "attributeName", "excelMapping");
    HeaderRow filterRow = grid.appendHeaderRow();
    addColumn("entityName", filterRow);
    addColumn("attributeName", filterRow);
    TextField tfExcelMapping = new TextField();
    tfExcelMapping.addBlurListener(e->saveExcelMappingSettings());
    tfExcelMapping.setWidth(100, Unit.PERCENTAGE);
    tfExcelMapping.setImmediate(true);
    grid.getColumn("excelMapping").setEditorField(tfExcelMapping).setExpandRatio(1);
    addShowPopulatedFilter("excelMapping", filterRow);
    grid.setEditorBuffered(false);
    addComponent(grid);
    setExpandRatio(grid, 1);
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:22,代碼來源:EditExcelReaderPanel.java

示例5: wrapGridContainer

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private GeneratedPropertyListContainer<E> wrapGridContainer(final Class<E> entityClass, final Grid grid)
{
	final Indexed gridContainer = grid.getContainerDataSource();
	if (gridContainer instanceof GeneratedPropertyListContainer)
	{
		return (GeneratedPropertyListContainer<E>) gridContainer;
	}

	final GeneratedPropertyListContainer<E> gplc = new GeneratedPropertyListContainer<>(entityClass);
	gplc.setCollection((Collection<E>) gridContainer.getItemIds());
	final Collection<?> containerPropertyIds = gridContainer.getContainerPropertyIds();
	if (!containerPropertyIds.isEmpty())
	{
		gplc.setContainerPropertyIds(containerPropertyIds.toArray(new String[containerPropertyIds.size()]));
	}
	grid.setContainerDataSource(gplc);

	return gplc;
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:21,代碼來源:GridHeadingV2PropertySet.java

示例6: createSelectedGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private void createSelectedGrid()
{
	selectedGrid = new Grid();
	selectedGrid.setContainerDataSource(createSelectedContainer());

	selectedGrid.setWidth(DEFAULT_COLUMN_WIDTH, Unit.PIXELS);
	selectedGrid.setHeight(DEFAULT_COLUMN_HEIGHT, Unit.PIXELS);

	selectedGrid.addItemClickListener(new ItemClickListener()
	{
		private static final long serialVersionUID = 1L;

		@Override
		public void itemClick(ItemClickEvent event)
		{
			if (event.isDoubleClick())
			{
				removeButton.click();
			}
		}
	});

	createSelectedHeadings().applyToGrid(selectedGrid);

	// initialised = true;
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:27,代碼來源:TwinColumnSelect.java

示例7: init

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest vaadinRequest) {

	BeanItemContainer<Workout> container = new BeanItemContainer<>(
			Workout.class, new WorkoutDataReader().run());

	Grid grid = new Grid();
	grid.setContainerDataSource(container);
	grid.getColumn("sport").setRenderer(new ImageRenderer());
	grid.setSizeFull();

    setContent(grid);
}
 
開發者ID:amahdy,項目名稱:java-pwa,代碼行數:14,代碼來源:MyUI.java

示例8: createGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid createGrid(SparklineRenderer sparkline) {
 		BeanItemContainer<MyPojo> container = new BeanItemContainer<MyPojo>(MyPojo.class);
 		for (int i = 0; i < 1000; ++i) {
 			container.addBean(new MyPojo(i));
 		}

 		Grid grid = new Grid();
 		grid.setSizeFull();
 		RowIndexRenderer rowIndex = new RowIndexRenderer();
 		GeneratedPropertyContainer gpc = rowIndex.addGeneratedProperty("index", container);
 		grid.setContainerDataSource(gpc);
 		grid.getColumn("index").setRenderer(rowIndex);
 		grid.getColumn("numbers").setRenderer(sparkline);
 		grid.getColumn("stars").setRenderer(new RatingStarsRenderer(5));
 		grid.getColumn("stars").setEditable(false);
 		HtmlButtonRenderer htmlButtonRenderer = new HtmlButtonRenderer(new HtmlButtonRendererClickListener() {
	@Override
	public void click(HtmlButtonRendererClickEvent event) {
		Notification.show("Java button was clicked");
	}
});
 		htmlButtonRenderer.setHtmlContentAllowed(true);
 		grid.getColumn("foo").setRenderer(htmlButtonRenderer);
 		grid.getColumn("foo").setEditable(false);
 		grid.setColumns("index", "id", "foo", "bar", "stars", "numbers");
 		return grid;
 	}
 
開發者ID:vaadin,項目名稱:grid-renderers-collection-addon,代碼行數:28,代碼來源:DemoUI.java

示例9: initGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
/**
 * Initializes the grid
 */
protected void initGrid() {
	// Init the grid with Caption, alternatively can initialize the same
	// with passing the datasource
	grid = new Grid();
	grid.setContainerDataSource(getDatasource());
	grid.setSizeFull();
	grid.setImmediate(true);
	setDefaultGridProperties();
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:13,代碼來源:AbstractGridView.java

示例10: buildGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
protected void buildGrid() {
    grid = new Grid();
    grid.setEditorEnabled(true);
    
    grid.setSizeFull();
    grid.setSelectionMode(SelectionMode.SINGLE);
    grid.setColumns("projectName","newDeployName","newDeployVersion",
            "newDeployType","existingDeployName","existingDeployVersion",
            "existingDeployType","upgrade");        
    container = new BeanItemContainer<>(DeploymentLine.class);
    buildContainer();
    grid.setContainerDataSource(container);
    grid.sort("projectName", SortDirection.DESCENDING);        
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:15,代碼來源:ValidateFlowDeploymentPanel.java

示例11: buildGrid

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
protected void buildGrid() {
    grid = new Grid();
    grid.setSelectionMode(SelectionMode.NONE);
    grid.setSizeFull();
    grid.setEditorEnabled(!readOnly);
    container = new BeanItemContainer<Record>(Record.class);
    grid.setContainerDataSource(container);
    grid.setColumns("entityName", "attributeName", "xpath");
    HeaderRow filterRow = grid.appendHeaderRow();

    addColumn("entityName", filterRow);

    addColumn("attributeName", filterRow);

    ComboBox combo = new ComboBox();
    combo.addValueChangeListener(e->saveXPathSettings());
    combo.setWidth(100, Unit.PERCENTAGE);
    combo.setImmediate(true);
    combo.setNewItemsAllowed(true);
    combo.setInvalidAllowed(true);
    combo.setTextInputAllowed(true);
    combo.setScrollToSelectedItem(true);
    combo.setFilteringMode(FilteringMode.CONTAINS);
    grid.getColumn("xpath").setEditorField(combo).setExpandRatio(1);
    addShowPopulatedFilter("xpath", filterRow);
    grid.setEditorBuffered(false);
    addComponent(grid);
    setExpandRatio(grid, 1);
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:30,代碼來源:EditXmlFormatPanel.java

示例12: wrapGridContainer

import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private GeneratedPropertyContainer wrapGridContainer(final Grid grid)
{
	Indexed gridContainer = grid.getContainerDataSource();
	if (!(gridContainer instanceof GeneratedPropertyContainer))
	{
		final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(gridContainer);
		grid.setContainerDataSource(gpc);
		gridContainer = gpc;
	}

	return (GeneratedPropertyContainer) gridContainer;
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:13,代碼來源:GridHeadingPropertySet.java


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