本文整理匯總了Java中com.vaadin.ui.Table.setColumnAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.setColumnAlignment方法的具體用法?Java Table.setColumnAlignment怎麽用?Java Table.setColumnAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Table
的用法示例。
在下文中一共展示了Table.setColumnAlignment方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGroupsTable
import com.vaadin.ui.Table; //導入方法依賴的package包/類
protected void initGroupsTable() {
groupsForUserQuery = new GroupsForUserQuery(identityService, this, user.getId());
if (groupsForUserQuery.size() > 0) {
groupTable = new Table();
groupTable.setSortDisabled(true);
groupTable.setHeight(150, UNITS_PIXELS);
groupTable.setWidth(100, UNITS_PERCENTAGE);
groupLayout.addComponent(groupTable);
groupContainer = new LazyLoadingContainer(groupsForUserQuery, 10);
groupTable.setContainerDataSource(groupContainer);
groupTable.addContainerProperty("id", Button.class, null);
groupTable.setColumnExpandRatio("id", 22);
groupTable.addContainerProperty("name", String.class, null);
groupTable.setColumnExpandRatio("name", 45);
groupTable.addContainerProperty("type", String.class, null);
groupTable.setColumnExpandRatio("type", 22);
groupTable.addContainerProperty("actions", Component.class, null);
groupTable.setColumnExpandRatio("actions", 11);
groupTable.setColumnAlignment("actions", Table.ALIGN_CENTER);
} else {
noGroupsLabel = new Label(i18nManager.getMessage(Messages.USER_NO_GROUPS));
groupLayout.addComponent(noGroupsLabel);
}
}
示例2: setupTablePropertyColumn
import com.vaadin.ui.Table; //導入方法依賴的package包/類
/**
* Setup column configuration for given <code>property</code> using its {@link PropertyColumn} definition.
* @param property Property to which the column is bound
* @param table Table to setup
*/
protected void setupTablePropertyColumn(P property, Table table) {
PropertyColumn<T, P> propertyColumn = getPropertyColumn(property);
if (propertyColumn != null) {
// header
if (propertyColumn.getCaption() != null) {
String header = LocalizationContext.translate(propertyColumn.getCaption(), true);
if (header != null) {
table.setColumnHeader(property, header);
}
}
// alignment
if (propertyColumn.getAlignment() != null) {
switch (propertyColumn.getAlignment()) {
case CENTER:
table.setColumnAlignment(property, Align.CENTER);
break;
case LEFT:
table.setColumnAlignment(property, Align.LEFT);
break;
case RIGHT:
table.setColumnAlignment(property, Align.RIGHT);
break;
default:
break;
}
}
// width
if (propertyColumn.getWidth() > -1) {
table.setColumnWidth(property, propertyColumn.getWidth());
}
// expand
if (propertyColumn.getTableExpandRatio() > -1) {
table.setColumnExpandRatio(property, propertyColumn.getTableExpandRatio());
}
// hiding
if (propertyColumn.isHidable()) {
table.setColumnCollapsible(property, true);
if (propertyColumn.isHidden()) {
table.setColumnCollapsed(property, true);
}
} else {
table.setColumnCollapsible(property, false);
}
// icon
if (propertyColumn.getIcon() != null) {
table.setColumnIcon(property, propertyColumn.getIcon());
}
}
}
示例3: 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;
}
示例4: initProcessInstancesTable
import com.vaadin.ui.Table; //導入方法依賴的package包/類
protected void initProcessInstancesTable() {
ProcessInstanceTableLazyQuery query = new ProcessInstanceTableLazyQuery(processDefinition.getId());
// Header
Label instancesTitle = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCES) + " (" + query.size() + ")");
instancesTitle.addStyleName(ExplorerLayout.STYLE_H3);
instancesTitle.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
instancesTitle.addStyleName(ExplorerLayout.STYLE_NO_LINE);
detailPanelLayout.addComponent(instancesTitle);
if (query.size() > 0) {
Label emptySpace = new Label(" ", Label.CONTENT_XHTML);
detailPanelLayout.addComponent(emptySpace);
Table instancesTable = new Table();
instancesTable.setWidth(400, UNITS_PIXELS);
if (query.size() > 6) {
instancesTable.setPageLength(6);
} else {
instancesTable.setPageLength(query.size());
}
LazyLoadingContainer container = new LazyLoadingContainer(query);
instancesTable.setContainerDataSource(container);
// container props
instancesTable.addContainerProperty(AlfrescoProcessInstanceTableItem.PROPERTY_ID, String.class, null);
instancesTable.addContainerProperty(AlfrescoProcessInstanceTableItem.PROPERTY_BUSINESSKEY, String.class, null);
instancesTable.addContainerProperty(AlfrescoProcessInstanceTableItem.PROPERTY_ACTIONS, Component.class, null);
// column alignment
instancesTable.setColumnAlignment(AlfrescoProcessInstanceTableItem.PROPERTY_ACTIONS, Table.ALIGN_CENTER);
// column header
instancesTable.setColumnHeader(AlfrescoProcessInstanceTableItem.PROPERTY_ID, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID));
instancesTable.setColumnHeader(AlfrescoProcessInstanceTableItem.PROPERTY_BUSINESSKEY, i18nManager.getMessage(Messages.PROCESS_INSTANCE_BUSINESSKEY));
instancesTable.setColumnHeader(AlfrescoProcessInstanceTableItem.PROPERTY_ACTIONS, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ACTIONS));
instancesTable.setEditable(false);
instancesTable.setSelectable(true);
instancesTable.setNullSelectionAllowed(false);
instancesTable.setSortDisabled(true);
detailPanelLayout.addComponent(instancesTable);
} else {
Label noInstances = new Label(i18nManager.getMessage(Messages.PROCESS_NO_INSTANCES));
detailPanelLayout.addComponent(noInstances);
}
}