当前位置: 首页>>代码示例>>Java>>正文


Java Table.setColumnAlignment方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:28,代码来源:UserDetailPanel.java

示例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());
		}
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:55,代码来源:DefaultItemListing.java

示例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;
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:72,代码来源:TransactionsView.java

示例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("&nbsp;", 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);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:51,代码来源:AlfrescoProcessDefinitionDetailPanel.java


注:本文中的com.vaadin.ui.Table.setColumnAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。