本文整理匯總了Java中com.vaadin.ui.Grid.setWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Grid.setWidth方法的具體用法?Java Grid.setWidth怎麽用?Java Grid.setWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Grid
的用法示例。
在下文中一共展示了Grid.setWidth方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: init
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
Grid grid = new Grid();
initializeGrid(grid);
grid.setWidth("700px");
grid.setHeight("500px");
applyDemoHacks(grid);
layout.addComponent(grid);
}
示例3: printConvocationResponses
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private void printConvocationResponses(List<Attendance> attendances) {
List<MemberInfo> attends = attendances.stream()
.filter(Attendance::isAttend)
.map(MemberInfo::from)
.collect(Collectors.toList());
Grid<MemberInfo> attendsGrid = new Grid<>("參加者一覧 (" + attends.size() + ")");
attendsGrid.setItems(attends);
attendsGrid.addColumn(MemberInfo::getName).setCaption("名前");
attendsGrid.addColumn(MemberInfo::getComment).setCaption("コメント");
attendsGrid.setWidth(100, Unit.PERCENTAGE);
attendsGrid.setHeightByRows(attends.size());
addComponent(attendsGrid);
List<MemberInfo> cancels = attendances.stream()
.filter(a -> !a.isAttend())
.map(MemberInfo::from)
.collect(Collectors.toList());
Grid<MemberInfo> cancelsGrid = new Grid<>("キャンセル一覧 (" + cancels.size() + ")");
cancelsGrid.setItems(cancels);
cancelsGrid.addColumn(MemberInfo::getName).setCaption("名前");
cancelsGrid.addColumn(MemberInfo::getComment).setCaption("コメント");
cancelsGrid.setWidth(100, Unit.PERCENTAGE);
cancelsGrid.setHeightByRows(cancels.size());
addComponent(cancelsGrid);
}
示例4: printAllMembers
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private void printAllMembers() {
List<Membership> memberships;
try {
memberships = membershipService.getAll();
} catch (RuntimeException e) {
ErrorView.show("會員一覧の取得に失敗しました。", e);
return;
}
Grid<MemberInfo> membershipGrid = new Grid<>();
membershipGrid.setItems(memberships.stream().map(MemberInfo::from).collect(Collectors.toList()));
membershipGrid.addColumn(MemberInfo::getName).setCaption("名前");
membershipGrid.addColumn(MemberInfo::getJavaTerm).setCaption("Java研修");
membershipGrid.addColumn(MemberInfo::getJava8Term).setCaption("Java8研修");
membershipGrid.addColumn(MemberInfo::getGoTerm).setCaption("Go研修");
membershipGrid.setWidth(100, Unit.PERCENTAGE);
membershipGrid.setHeightByRows(memberships.size());
addComponent(membershipGrid);
}
示例5: createGrid
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid createGrid() {
Grid<Dessert> grid = new Grid<>();
grid.setItems(desserts);
grid.setSelectionMode(Grid.SelectionMode.MULTI);
grid.setWidth(100, Unit.PERCENTAGE);
grid.addColumn(Dessert::getName).setCaption("Dessert (100g serving");
grid.addColumn(Dessert::getCalories).setCaption("Calories");
grid.addColumn(Dessert::getFat).setCaption("Fat (g)");
grid.addColumn(Dessert::getCarbs).setCaption("Carbs (g)");
grid.addColumn(Dessert::getProtein).setCaption("Protein (g)");
grid.addColumn(Dessert::getSodium).setCaption("Sodium (mg)");
grid.addColumn(Dessert::getCalcium).setCaption("Calcium (%)");
grid.addColumn(Dessert::getIron).setCaption("Iron (%)");
grid.setHeight(Metrics.Table.COLUMN_HEADER_HEIGHT + desserts.size() * Metrics.Table.ROW_HEIGHT, Unit.PIXELS);
return grid;
}
示例6: 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;
}
}
示例7: presentTableData
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@Override
public void presentTableData(RootResult rootrResult) {
ResultToListConverter resultToListConverter = new ResultToListConverter();
List<Result> resultList = resultToListConverter.apply(rootrResult);
Collections.sort(resultList, new Inverter<>(new ResultComparator()));
Grid<Result> grid = new Grid<>(TABLE_TITLE);
grid.addColumn(result -> result.getName()).setCaption(TABLE_COLUMN_METHOD_NAME).setId(TABLE_COLUMN_METHOD_NAME);
grid.addColumn(result -> result.getValue() + NONE).setCaption(TABLE_COLUMN_VALUE_NAME)
.setId(TABLE_COLUMN_VALUE_NAME);
grid.setColumnOrder(TABLE_COLUMN_METHOD_NAME, TABLE_COLUMN_VALUE_NAME);
grid.setStyleGenerator(result -> {
if (result.getValue() > MAX_ALLOWED_VALUES)
return ERROR_STYLE;
return NONE;
});
grid.setItems(resultList);
grid.setSizeFull();
grid.setWidth(70, Unit.REM);
mainPanel.addComponent(grid);
mainPanel.setComponentAlignment(grid, Alignment.MIDDLE_CENTER);
}
示例8: 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;
}
示例9: addDataGrid
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private void addDataGrid() {
Grid<app.Event> grid = dataGrid.get();
grid.setWidth("100%");
HorizontalLayout bottomLayout = new HorizontalLayout();
bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
bottomLayout.addComponent(grid);
bottomLayout.setWidth("100%");
addComponent(bottomLayout);
}
示例10: initGrid
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
/**
* Init internal Grid.
* @param grid Grid
*/
protected void initGrid(Grid<T> grid) {
this.grid = grid;
grid.setWidth(100, Unit.PERCENTAGE);
// reset selection model
grid.setSelectionMode(com.vaadin.ui.Grid.SelectionMode.NONE);
// row style generator
grid.setStyleGenerator(i -> generateRowStyle(i));
Editor<T> editor = grid.getEditor();
if (editor != null) {
editor.addSaveListener(e -> {
if (isBuffered()) {
requireDataSource().update(e.getBean());
if (isCommitOnSave()) {
requireDataSource().commit();
}
} else {
requireDataSource().getConfiguration().getCommitHandler().ifPresent(ch -> {
ch.commit(Collections.emptySet(), Collections.singleton(e.getBean()), Collections.emptySet());
});
}
});
}
super.setWidth(100, Unit.PERCENTAGE);
addStyleName("h-itemlisting", false);
setCompositionRoot(grid);
}
示例11: createGridForGantt
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<Step> createGridForGantt() {
dataProvider = new ListDataProvider<>(new ArrayList<>(gantt.getSteps()));
Grid<Step> grid = new Grid<>(dataProvider);
grid.setWidth(400, Unit.PIXELS);
grid.setHeight(100, Unit.PERCENTAGE);
Column<Step, ?> c = grid.addColumn(Step::getCaption);
c.setSortable(false);
c.setResizable(false);
gantt.setVerticalScrollDelegateTarget(grid);
return grid;
}