本文整理汇总了Java中com.vaadin.ui.Table.addValueChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Table.addValueChangeListener方法的具体用法?Java Table.addValueChangeListener怎么用?Java Table.addValueChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Table
的用法示例。
在下文中一共展示了Table.addValueChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectionMode
import com.vaadin.ui.Table; //导入方法依赖的package包/类
@Override
public void setSelectionMode(SelectionMode selectionMode) {
ObjectUtils.argumentNotNull(selectionMode, "SelectionMode must be not null");
if (this.selectionMode != selectionMode) {
this.selectionMode = selectionMode;
switch (getRenderingMode()) {
case GRID: {
final Grid grid = getGrid();
grid.removeSelectionListener(this);
switch (selectionMode) {
case MULTI:
grid.setSelectionMode(Grid.SelectionMode.MULTI);
grid.addSelectionListener(this);
break;
case SINGLE:
grid.setSelectionMode(Grid.SelectionMode.SINGLE);
grid.addSelectionListener(this);
break;
case NONE:
default:
grid.setSelectionMode(Grid.SelectionMode.NONE);
break;
}
}
break;
case TABLE: {
final Table table = getTable();
table.removeValueChangeListener(tableSelectionChangeListener);
table.setValue(null);
if (selectionMode != null && selectionMode != SelectionMode.NONE) {
table.setSelectable(true);
table.setMultiSelect(selectionMode == SelectionMode.MULTI);
table.addValueChangeListener(tableSelectionChangeListener);
} else {
table.setSelectable(false);
}
}
break;
default:
break;
}
}
}
示例2: buildTable
import com.vaadin.ui.Table; //导入方法依赖的package包/类
private Table buildTable() {
final Table table = new Table() {
@Override
protected String formatPropertyValue(final Object rowId,
final Object colId, final Property<?> property) {
String result = super.formatPropertyValue(rowId, colId,
property);
if (colId.equals("time")) {
result = DATEFORMAT.format(((Date) property.getValue()));
} else if (colId.equals("price")) {
if (property != null && property.getValue() != null) {
return "$" + DECIMALFORMAT.format(property.getValue());
} else {
return "";
}
}
return result;
}
};
table.setSizeFull();
table.addStyleName(ValoTheme.TABLE_BORDERLESS);
table.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
table.addStyleName(ValoTheme.TABLE_COMPACT);
table.setSelectable(true);
table.setColumnCollapsingAllowed(true);
table.setColumnCollapsible("time", false);
table.setColumnCollapsible("price", false);
table.setColumnReorderingAllowed(true);
table.setContainerDataSource(new TempTransactionsContainer(DashboardUI
.getDataProvider().getRecentTransactions(200)));
table.setSortContainerPropertyId("time");
table.setSortAscending(false);
table.setColumnAlignment("seats", Align.RIGHT);
table.setColumnAlignment("price", Align.RIGHT);
table.setVisibleColumns("time", "country", "city", "theater", "room",
"title", "seats", "price");
table.setColumnHeaders("Time", "Country", "City", "Theater", "Room",
"Title", "Seats", "Price");
table.setFooterVisible(true);
table.setColumnFooter("time", "Total");
table.setColumnFooter(
"price",
"$"
+ DECIMALFORMAT.format(DashboardUI.getDataProvider()
.getTotalSum()));
// Allow dragging items to the reports menu
table.setDragMode(TableDragMode.MULTIROW);
table.setMultiSelect(true);
table.addActionHandler(new TransactionsActionHandler());
table.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(final ValueChangeEvent event) {
if (table.getValue() instanceof Set) {
Set<Object> val = (Set<Object>) table.getValue();
createReport.setEnabled(val.size() > 0);
}
}
});
table.setImmediate(true);
return table;
}