本文整理匯總了Java中com.vaadin.ui.Grid.setColumns方法的典型用法代碼示例。如果您正苦於以下問題:Java Grid.setColumns方法的具體用法?Java Grid.setColumns怎麽用?Java Grid.setColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Grid
的用法示例。
在下文中一共展示了Grid.setColumns方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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);
}
示例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.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);
}
示例5: setPropertyColumns
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
public void setPropertyColumns(Iterable<P> columns) {
ObjectUtils.argumentNotNull(columns, "Property columns must be not null");
final Object[] columnsArray = ConversionUtils.iterableAsList(columns).toArray();
switch (getRenderingMode()) {
case GRID: {
final Grid grid = getGrid();
// set columns
grid.setColumns(columnsArray);
// setup columns
for (P column : columns) {
Column c = grid.getColumn(column);
// setup column
setupGridPropertyColumn(column, c);
// setup renderer and converter
setupRendererAndConverter(column, c);
}
}
break;
case TABLE: {
final Table table = getTable();
try {
duringSetup = true;
// Setup columns and check Component generated columns
for (P property : columns) {
// column settings
setupTablePropertyColumn(property, table);
// generated columns
Class<?> type = getPropertyColumnType(property);
if (type != null && Component.class.isAssignableFrom(type)) {
if (table.getColumnGenerator(property) == null) {
table.addGeneratedColumn(property, new VirtualPropertyGenerator());
}
}
}
} finally {
duringSetup = false;
}
// set columns
table.setVisibleColumns(columnsArray);
}
break;
default:
break;
}
}
示例6: CheckBoxDemo
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
public CheckBoxDemo() {
Random random = new Random(4837291937l);
BeanItemContainer<SimplePojo> container = new BeanItemContainer<SimplePojo>(SimplePojo.class);
SimplePojo bean1 = new SimplePojo(0, "Me", true, new Date(), BigDecimal.valueOf(random.nextDouble()*100), Double.valueOf(random.nextInt(5)), Integer.valueOf(random.nextInt(5)));
SimplePojo bean2 = new SimplePojo(1, "You", false, new Date(), BigDecimal.valueOf(random.nextDouble()*100), Double.valueOf(random.nextInt(5)), Integer.valueOf(random.nextInt(5)));
SimplePojo bean3 = new SimplePojo(2, "He", true, new Date(), BigDecimal.valueOf(random.nextDouble()*100), Double.valueOf(random.nextInt(5)), Integer.valueOf(random.nextInt(5)));
container.addBean(bean1);
container.addBean(bean2);
container.addBean(bean3);
byte[] image = Base64.decodeBase64(castle);
bean1.setImage(image);
bean2.setImage(image);
bean3.setImage(image);
Grid grid = new Grid(container);
grid.setColumns("description","yes","truth","date","number","image");
grid.setSizeFull();
grid.setEditorEnabled(true);
grid.setEditorBuffered(false);
Grid.Column yes = grid.getColumn("yes");
yes.setRenderer(new CheckboxRenderer());
yes.setEditable(true);
grid.getColumn("image").setEditable(false);
grid.getColumn("image").setRenderer(new BlobImageRenderer(30,30,"image/png"));
Grid.Column truth = grid.getColumn("truth");
truth.setRenderer(new HtmlRenderer(), new StringToBooleanConverter() {
@Override
protected String getTrueString() {
return FontAwesome.CHECK_CIRCLE_O.getHtml();
}
@Override
protected String getFalseString() {
return FontAwesome.CIRCLE_O.getHtml();
}
});
truth.setEditable(false);
setStyleName("demoContentLayout");
setSizeFull();
addComponent(grid);
setComponentAlignment(grid
, Alignment.MIDDLE_CENTER);
setMargin(true);
}