Java Code Examples for com.vaadin.ui.Table

The following examples show how to use com.vaadin.ui.Table. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: hawkbit   Source File: HawkbitCommonUtil.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Apply style for status label in target table.
 *
 * @param targetTable
 *            target table
 * @param pinBtn
 *            pin button used for status display and pin on mouse over
 * @param itemId
 *            id of the tabel row
 */
public static void applyStatusLblStyle(final Table targetTable, final Button pinBtn, final Object itemId) {
    final Item item = targetTable.getItem(itemId);
    if (item != null) {
        final TargetUpdateStatus updateStatus = (TargetUpdateStatus) item
                .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
        pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue");
        if (updateStatus == TargetUpdateStatus.ERROR) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
        } else if (updateStatus == TargetUpdateStatus.UNKNOWN) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
        } else if (updateStatus == TargetUpdateStatus.IN_SYNC) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
        } else if (updateStatus == TargetUpdateStatus.PENDING) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
        } else if (updateStatus == TargetUpdateStatus.REGISTERED) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
        }
    }
}
 
Example 2
Source Project: hawkbit   Source File: ArtifactDetailsLayout.java    License: 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 3
Source Project: hawkbit   Source File: ArtifactDetailsLayout.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private Button getArtifactDownloadButton(final Table table, final Object itemId) {
    final String fileName = (String) table.getContainerDataSource().getItem(itemId)
            .getItemProperty(PROVIDED_FILE_NAME).getValue();
    final Button downloadIcon = SPUIComponentProvider.getButton(
            fileName + "-" + UIComponentIdProvider.ARTIFACT_FILE_DOWNLOAD_ICON, "",
            i18n.getMessage(UIMessageIdProvider.TOOLTIP_ARTIFACT_DOWNLOAD), ValoTheme.BUTTON_TINY + " " + "blueicon", 
            true, FontAwesome.DOWNLOAD, SPUIButtonStyleNoBorder.class);
    downloadIcon.setData(itemId);
    FileDownloader fileDownloader = new FileDownloader(createStreamResource((Long) itemId));
    fileDownloader.extend(downloadIcon);
    fileDownloader.setErrorHandler(new ErrorHandler() {

        /**
         * Error handler for file downloader
         */
        private static final long serialVersionUID = 4030230501114422570L;

        @Override
        public void error(com.vaadin.server.ErrorEvent event) {
            uINotification.displayValidationError(i18n.getMessage(UIMessageIdProvider.ARTIFACT_DOWNLOAD_FAILURE_MSG));
        }
    });
    return downloadIcon;
}
 
Example 4
Source Project: hawkbit   Source File: ArtifactDetailsLayout.java    License: 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 5
Source Project: XACML   Source File: UserManagement.java    License: MIT License 6 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("100%");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(false);
	
	// top-level component properties
	setWidth("100.0%");
	setHeight("-1px");
	
	// horizontalLayoutToolbar
	horizontalLayoutToolbar = buildHorizontalLayoutToolbar();
	mainLayout.addComponent(horizontalLayoutToolbar);
	
	// tableUsers
	tableUsers = new Table();
	tableUsers.setImmediate(false);
	tableUsers.setWidth("100.0%");
	tableUsers.setHeight("-1px");
	mainLayout.addComponent(tableUsers);
	
	return mainLayout;
}
 
Example 6
Source Project: hawkbit   Source File: TargetTagFilterButtons.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected DropHandler getFilterButtonDropHandler() {

    return new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return managementViewClientCriterion;
        }

        @Override
        public void drop(final DragAndDropEvent event) {
            if (validate(event) && isNoTagAssigned(event)) {
                final TableTransferable tbl = (TableTransferable) event.getTransferable();
                final Table source = tbl.getSourceComponent();
                if (source.getId().equals(UIComponentIdProvider.TARGET_TABLE_ID)) {
                    UI.getCurrent().access(() -> processTargetDrop(event));
                }
            }
        }
    };
}
 
Example 7
Source Project: hawkbit   Source File: TargetTableHeader.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void filterByDroppedDist(final DragAndDropEvent event) {
    if (doValidations(event)) {
        final TableTransferable tableTransferable = (TableTransferable) event.getTransferable();
        final Table source = tableTransferable.getSourceComponent();
        if (!UIComponentIdProvider.DIST_TABLE_ID.equals(source.getId())) {
            return;
        }
        final Set<Long> distributionIdSet = getDropppedDistributionDetails(tableTransferable);
        if (CollectionUtils.isEmpty(distributionIdSet)) {
            return;
        }
        final Long distributionSetId = distributionIdSet.iterator().next();
        final Optional<DistributionSet> distributionSet = distributionSetManagement.get(distributionSetId);
        if (!distributionSet.isPresent()) {
            notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
            return;
        }
        final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distributionSet.get());
        getManagementUIState().getTargetTableFilters().setDistributionSet(distributionSetIdName);
        addFilterTextField(distributionSetIdName);
    }
}
 
Example 8
Source Project: hawkbit   Source File: TargetTableHeader.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Validation for drag event.
 *
 * @param dragEvent
 * @return
 */
private Boolean doValidations(final DragAndDropEvent dragEvent) {
    final Component compsource = dragEvent.getTransferable().getSourceComponent();
    Boolean isValid = Boolean.TRUE;
    if (compsource instanceof Table && !isComplexFilterViewDisplayed) {
        final TableTransferable transferable = (TableTransferable) dragEvent.getTransferable();
        final Table source = transferable.getSourceComponent();

        if (!source.getId().equals(UIComponentIdProvider.DIST_TABLE_ID)) {
            notification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
            isValid = Boolean.FALSE;
        } else {
            if (getDropppedDistributionDetails(transferable).size() > 1) {
                notification.displayValidationError(i18n.getMessage("message.onlyone.distribution.dropallowed"));
                isValid = Boolean.FALSE;
            }
        }
    } else {
        notification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
        isValid = Boolean.FALSE;
    }
    return isValid;
}
 
Example 9
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 10
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 11
Source Project: hawkbit   Source File: CommonDialogWindow.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * adds a listener to a component. Depending on the type of component a
 * valueChange-, textChange- or itemSetChangeListener will be added.
 */
public void addComponentListeners() {
    // avoid duplicate registration
    removeListeners();

    for (final AbstractField<?> field : allComponents) {
        if (field instanceof TextChangeNotifier) {
            ((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
        }

        if (field instanceof Table) {
            ((Table) field).addItemSetChangeListener(new ChangeListener(field));
        }
        field.addValueChangeListener(new ChangeListener(field));
    }
}
 
Example 12
Source Project: hawkbit   Source File: AbstractTable.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets the selected item id or in multiselect mode the selected ids.
 * 
 * @param table
 *            the table to retrieve the selected ID(s)
 * @return the ID(s) which are selected in the table
 */
@SuppressWarnings("unchecked")
public static <T> Set<T> getTableValue(final Table table) {
    final Object value = table.getValue();
    Set<T> idsReturn;
    if (value == null) {
        idsReturn = Collections.emptySet();
    } else if (value instanceof Collection) {
        final Collection<T> ids = (Collection<T>) value;
        idsReturn = ids.stream().filter(Objects::nonNull).collect(Collectors.toSet());
    } else {
        final T id = (T) value;
        idsReturn = Collections.singleton(id);
    }
    return idsReturn;
}
 
Example 13
Source Project: usergrid   Source File: ModuleLayout.java    License: Apache License 2.0 6 votes vote down vote up
public void loadData( Table userTable ){
    ModuleDao moduleDao = InjectorFactory.getInstance( ModuleDao.class );
    List<Module> modules = moduleDao.getAll();
    for( final Module module : modules ) {
        Label groupLabel = new Label( module.getGroupId( ) );
        Label artifactLabel = new Label( module.getArtifactId( ) );
        Label versionLabel = new Label( module.getVersion( ) );

        Button detailsField = new Button( "show details" );
        detailsField.addStyleName( "link" );
        detailsField.addClickListener( new Button.ClickListener( ) {
            @Override
            public void buttonClick( Button.ClickEvent event ) {
                onItemClick( module.getId() );
            }
        } );
        userTable.addItem( new Object[]{ groupLabel, artifactLabel, versionLabel, detailsField }, module.getId( ) );
    }
}
 
Example 14
Source Project: hawkbit   Source File: AbstractTable.java    License: Eclipse Public License 1.0 6 votes vote down vote up
protected boolean isDropValid(final DragAndDropEvent dragEvent) {
    final Transferable transferable = dragEvent.getTransferable();
    final Component compsource = transferable.getSourceComponent();

    final List<String> missingPermissions = hasMissingPermissionsForDrop();
    if (!missingPermissions.isEmpty()) {
        notification.displayValidationError(i18n.getMessage("message.permission.insufficient", missingPermissions));
        return false;
    }

    if (compsource instanceof Table) {
        return validateTable((Table) compsource)
                && validateDropList(getDraggedTargetList((TableTransferable) transferable, (Table) compsource));
    }

    if (compsource instanceof DragAndDropWrapper) {
        return validateDragAndDropWrapper((DragAndDropWrapper) compsource)
                && validateDropList(getDraggedTargetList(dragEvent));
    }
    notification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
    return false;
}
 
Example 15
@Override
public void attach() {
    // テーブル基本設定
    setCaption(ViewProperties.getCaption("table.selectService"));
    setWidth("440px");
    setPageLength(4);
    setSortDisabled(true);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);
    addStyleName("win-service-add-service");

    // カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Service", Label.class, new Label());
    addContainerProperty("Description", String.class, null);
    setColumnExpandRatio("Description", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 16
@Override
public void attach() {
    // テーブル基本設定
    setWidth("100%");
    addStyleName("win-mycloud-add-temp");
    setCaption(ViewProperties.getCaption("table.selectTemplate"));
    setPageLength(4);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);

    // カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Name", Label.class, new Label());
    setColumnExpandRatio("Name", 100);

    // テーブルのカラムに対してStyleNameを設定
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 17
@Override
public void attach() {
    // テーブル基本設定
    setCaption(ViewProperties.getCaption("table.selectCloud"));
    setWidth("470px");
    setPageLength(4);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);
    addStyleName("win-server-add-cloud");

    // カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Cloud", Label.class, new Label());
    setColumnExpandRatio("Cloud", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 18
@Override
public void attach() {
    // テーブル基本設定
    setCaption(ViewProperties.getCaption("table.selectImage"));
    setWidth("470px");
    if (enableService) {
        setPageLength(3);
    } else {
        setPageLength(6);
    }
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);
    addStyleName("win-server-add-os");

    // カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Image", Label.class, new Label());
    setColumnExpandRatio("Image", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 19
@Override
public void attach() {
    // テーブル基本設定
    setCaption(ViewProperties.getCaption("table.availableService"));
    setWidth("100%");
    setHeight("100px");
    setPageLength(3);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(false);
    setMultiSelect(false);
    setImmediate(true);
    addStyleName("win-server-add-service");

    //カラム設定
    addContainerProperty("Service", Label.class, new Label());
    addContainerProperty("Description", String.class, null);
    setColumnExpandRatio("Service", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 20
@Override
public void attach() {
    // テーブル基本設定
    addStyleName("service-desc-detail-param");
    setCaption(ViewProperties.getCaption("label.serviceDetailParams"));
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT);
    setSortDisabled(true);
    setMultiSelect(false);
    setImmediate(false);

    // カラム設定
    addContainerProperty("Kind", String.class, null);
    addContainerProperty("Name", String.class, null);
    addContainerProperty("Value", String.class, null);
    setColumnExpandRatio("Value", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 21
@Override
public void attach() {
    // テーブル基本設定
    setCaption(ViewProperties.getCaption("table.selectCloud"));
    setWidth("260px");
    setPageLength(6);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);
    addStyleName("win-server-add-cloud");

    //カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Cloud", Label.class, new Label());
    setColumnExpandRatio("Cloud", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 22
Source Project: chipster   Source File: JobLogTable.java    License: MIT License 6 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Button link = new Button("Output");
	link.setStyleName(BaseTheme.BUTTON_LINK);
	link.setDescription("Show job output");

	link.addClickListener(new Button.ClickListener() {

		public void buttonClick(ClickEvent event) {

			select(itemId);
			view.showOutput(itemId);
		}
	});

	return link;
}
 
Example 23
@Override
public void attach() {
    // テーブル基本設定
    setCaption(ViewProperties.getCaption("table.selectCloud"));
    setWidth("340px");
    setPageLength(3);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);
    addStyleName("loadbalancer-add-table");

    // カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Cloud", Label.class, new Label());
    setColumnExpandRatio("Cloud", 100);
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 24
Source Project: usergrid   Source File: RunnersLayout.java    License: Apache License 2.0 6 votes vote down vote up
private void addGroup( RunnerGroup group, Table runnersTable ) {

        Module module = moduleDao.get( group.getModuleId() );

        if (module == null) {
            return;
        }

        String caption = String.format( "%s / %s / %s: commit[%s], user[%s]",
                module.getGroupId(),
                module.getArtifactId(),
                module.getVersion(),
                StringUtils.abbreviate( group.getCommitId(), 10 ),
                group.getUser()
        );

        accordion.addTab( runnersTable, caption );
    }
 
Example 25
Source Project: chipster   Source File: JobLogTable.java    License: MIT License 6 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {
	
	Property<?> prop = source.getItem(itemId).getItemProperty(columnId);
	if (prop != null && prop.getType() != null && prop.getType().equals(Integer.class)) {

		Integer wallClockTime = (Integer) prop.getValue();

		if (wallClockTime != null) {
			return new Label(StringUtils.formatMinutes(wallClockTime));
		} else {
			return new Label();
		}
	}
	return null;
}
 
Example 26
@Override
public void attach() {
    //テーブル基本設定
    setWidth("100%");

    setPageLength(4);
    setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setNullSelectionAllowed(false);
    setImmediate(true);
    addStyleName("win-mycloud-edit-table");

    //カラム設定
    addContainerProperty("No", Integer.class, null);
    addContainerProperty("Name", Label.class, new Label());
    addContainerProperty("Description", String.class, null);
    setColumnExpandRatio("Name", 40);
    setColumnExpandRatio("Description", 60);

    //テーブルのカラムに対してStyleNameを設定
    setCellStyleGenerator(new StandardCellStyleGenerator());
}
 
Example 27
Source Project: XACML   Source File: GitPushWindow.java    License: 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 28
Source Project: boot-examples   Source File: Application.java    License: 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);
}
 
Example 29
Source Project: XACML   Source File: AttributeContainer.java    License: MIT License 6 votes vote down vote up
@Override
public Class<?> getType(Object propertyId) {
       if (propertyId.equals(PROPERTY_ID)) {
           return String.class;
       }
       if (propertyId.equals(PROPERTY_CATEGORY)) {
           return Category.class;
       }
       if (propertyId.equals(PROPERTY_DATATYPE)) {
           return Datatype.class;
       }
       if (propertyId.equals(PROPERTY_VALUES)) {
           return Table.class;
       }
	return null;
}
 
Example 30
@Override
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
    final DistributionSet distributionSet;
    final Item item = ((Table) source).getItem(itemId);
    if (propertyId != null) {
        if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
            distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
            return getDSDetails(distributionSet);
        } else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
            distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
            return getDSDetails(distributionSet);
        }
    }
    return null;
}