com.vaadin.ui.Table.ColumnGenerator Java Examples

The following examples show how to use com.vaadin.ui.Table.ColumnGenerator. 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 static void addGeneratedColumn(final Table table) {
    table.addGeneratedColumn(CREATE_MODIFIED_DATE_UPLOAD, new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public String generateCell(final Table source, final Object itemId, final Object columnId) {
            final Long createdDate = (Long) table.getContainerDataSource().getItem(itemId)
                    .getItemProperty(CREATED_DATE).getValue();
            final Long modifiedDATE = (Long) table.getContainerDataSource().getItem(itemId)
                    .getItemProperty(LAST_MODIFIED_DATE).getValue();
            if (modifiedDATE != null) {
                return SPDateTimeUtil.getFormattedDate(modifiedDATE);
            }
            return SPDateTimeUtil.getFormattedDate(createdDate);
        }
    });
}
 
Example #2
Source File: GitPushWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeTable(Status status) {
	//
	// Setup the table
	//
	this.tableChanges.setContainerDataSource(this.container);
	this.tableChanges.setPageLength(this.container.size());
	this.tableChanges.setImmediate(true);
	//
	// Generate column
	//
	this.tableChanges.addGeneratedColumn("Entry", new ColumnGenerator() {
		private static final long serialVersionUID = 1L;

		@Override
		public Object generateCell(Table source, Object itemId, Object columnId) {
			Item item = self.container.getItem(itemId);
			assert(item != null);
			if (item instanceof StatusItem) {
				return self.generateGitEntryComponent(((StatusItem) item).getGitEntry());
			}
			assert(item instanceof StatusItem);
			return null;
		}
	});
}
 
Example #3
Source File: ArtifactDetailsLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void addGeneratedColumnButton(final Table table) {
    table.addGeneratedColumn(ACTION, new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public HorizontalLayout generateCell(final Table source, final Object itemId, final Object columnId) {
            HorizontalLayout actioncellLayout = new HorizontalLayout();
            actioncellLayout.addComponent(getArtifactDeleteButton(table, itemId));
            actioncellLayout.addComponent(getArtifactDownloadButton(table, itemId));
            actioncellLayout.setImmediate(true);
            return actioncellLayout;
        }
    });  
}
 
Example #4
Source File: Column.java    From jdal with Apache License 2.0 4 votes vote down vote up
public ColumnGenerator getColumnGenerator() {
	return columnGenerator;
}
 
Example #5
Source File: Column.java    From jdal with Apache License 2.0 4 votes vote down vote up
public void setColumnGenerator(ColumnGenerator columnGenerator) {
	this.columnGenerator = columnGenerator;
}