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

The following examples show how to use com.vaadin.ui.Table#setColumnHeader() . 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: ArtifactDetailsLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void setTableColumnDetails(final Table table) {

        table.setColumnHeader(PROVIDED_FILE_NAME, i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_FILENAME));
        table.setColumnHeader(SIZE, i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_FILESIZE_BYTES));
        if (fullWindowMode) {
            table.setColumnHeader(SHA1HASH, i18n.getMessage("upload.sha1"));
            table.setColumnHeader(MD5HASH, i18n.getMessage("upload.md5"));
        }
        table.setColumnHeader(CREATE_MODIFIED_DATE_UPLOAD, i18n.getMessage("upload.last.modified.date"));
        if (!readOnly) {
            table.setColumnHeader(ACTION, i18n.getMessage(UIMessageIdProvider.MESSAGE_UPLOAD_ACTION));
        }

        table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5F);
        table.setColumnExpandRatio(SIZE, 2F);
        if (fullWindowMode) {
            table.setColumnExpandRatio(SHA1HASH, 2.8F);
            table.setColumnExpandRatio(MD5HASH, 2.4F);
        }
        table.setColumnExpandRatio(CREATE_MODIFIED_DATE_UPLOAD, 3F);
        if (!readOnly) {
            table.setColumnExpandRatio(ACTION, 2.5F);
        }

        table.setVisibleColumns(getVisbleColumns().toArray());
    }
 
Example 2
Source File: Application.java    From boot-examples with Apache License 2.0 6 votes vote down vote up
@Override
protected void init(VaadinRequest vaadinRequest) {
    getPage().setTitle("Root UI");

    Table table = new Table("Customer Table");

    table.addContainerProperty("firstName", String.class, null);
    table.addContainerProperty("lastName", String.class, null);
    table.addContainerProperty("id", Long.class, null);

    for (Customer c : this.customerRepository.findAll())
        table.addItem(new Object[]{c.getFirstName(), c.getLastName(), c.getId()}, c.getId());

    table.setSizeFull();
    table.setColumnHeader("firstName", "First Name");
    table.setColumnHeader("lastName", "First Name");
    setContent(table);
}