Java Code Examples for com.vaadin.ui.Table#setMultiSelect()

The following examples show how to use com.vaadin.ui.Table#setMultiSelect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DistributionSetTypeSoftwareModuleSelectLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildSelectedTable() {
    selectedTable = new Table();
    selectedTable.setId(SPUIDefinitions.TWIN_TABLE_SELECTED_ID);
    selectedTable.setSelectable(true);
    selectedTable.setMultiSelect(true);
    selectedTable.setSortEnabled(false);
    selectedTable.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
    selectedTable.addStyleName(ValoTheme.TABLE_NO_STRIPES);
    selectedTable.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
    selectedTable.addStyleName(ValoTheme.TABLE_SMALL);
    selectedTable.addStyleName("dist_type_twin-table");
    selectedTable.setSizeFull();
    createSelectedTableContainer();
    selectedTable.setContainerDataSource(selectedTableContainer);
    addTooltTipToSelectedTable();
    selectedTable.setImmediate(true);
    selectedTable.setVisibleColumns(DIST_TYPE_NAME, DIST_TYPE_MANDATORY);
    selectedTable.setColumnHeaders(i18n.getMessage("header.dist.twintable.selected"), STAR);
    selectedTable.setColumnExpandRatio(DIST_TYPE_NAME, 0.75F);
    selectedTable.setColumnExpandRatio(DIST_TYPE_MANDATORY, 0.25F);
    selectedTable.setRequired(true);
}
 
Example 2
Source File: DistributionSetTypeSoftwareModuleSelectLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildSourceTable() {
    sourceTable = new Table();
    sourceTable.setId(SPUIDefinitions.TWIN_TABLE_SOURCE_ID);
    sourceTable.setSelectable(true);
    sourceTable.setMultiSelect(true);
    sourceTable.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
    sourceTable.addStyleName(ValoTheme.TABLE_NO_STRIPES);
    sourceTable.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
    sourceTable.addStyleName(ValoTheme.TABLE_SMALL);
    sourceTable.setImmediate(true);
    sourceTable.setSizeFull();
    sourceTable.addStyleName("dist_type_twin-table");
    sourceTable.setSortEnabled(false);
    sourceTableContainer = new IndexedContainer();
    sourceTableContainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
    sourceTableContainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
    sourceTable.setContainerDataSource(sourceTableContainer);

    sourceTable.setVisibleColumns(DIST_TYPE_NAME);
    sourceTable.setColumnHeaders(i18n.getMessage("header.dist.twintable.available"));
    sourceTable.setColumnExpandRatio(DIST_TYPE_NAME, 1.0F);
    createSourceTableData();
    addTooltip();
    sourceTable.select(sourceTable.firstItemId());
}
 
Example 3
Source File: ObjectTypeSelectionPopup.java    From sensorhub with Mozilla Public License 2.0 4 votes vote down vote up
public ObjectTypeSelectionPopup(String title, final Map<String, Class<?>> typeList, final ObjectTypeSelectionCallback callback)
{
    super(title);
    VerticalLayout layout = new VerticalLayout();
    
    // generate table with type list
    final Table table = new Table();
    table.setSizeFull();
    table.setSelectable(true);
    table.setColumnReorderingAllowed(true);        
    table.addContainerProperty(UIConstants.PROP_NAME, String.class, null);
    table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
    table.setPageLength(10);
    table.setMultiSelect(false);
    
    final Map<Object, Class<?>> idTypeMap = new HashMap<Object, Class<?>>();
    for (Entry<String, Class<?>> item: typeList.entrySet())
    {
        Object id = table.addItem(new Object[] {item.getKey()}, null);
        idTypeMap.put(id, item.getValue());
    }
    layout.addComponent(table);
    
    // add OK button
    Button okButton = new Button("OK");
    okButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event)
        {
            Object selectedItemId = table.getValue();
            
            if (selectedItemId != null)
            {
                Class<?> clazz = idTypeMap.get(selectedItemId);
                if (clazz != null)
                    callback.typeSelected(clazz);
            }
            
            close();
        }
    });
    layout.addComponent(okButton);
    layout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER);
    
    setContent(layout);
    center();
}