Example usage for com.vaadin.ui Button setEnabled

List of usage examples for com.vaadin.ui Button setEnabled

Introduction

In this page you can find the example usage for com.vaadin.ui Button setEnabled.

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java

License:Open Source License

@SuppressWarnings({ "deprecation", "serial" })
private void paintTagView() {
    layout.removeAllComponents();//from   www. ja v a  2s  .  c  o  m

    Set<String> tags = TaggingUtils.getTags(project);
    if (tags != null && tags.size() > 0) {
        Layout tagListLayout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                if (c instanceof Label) {
                    return "float: left; line-height:18px; padding-right: 3px;";
                } else {
                    return "float: left; padding-right: 5px";
                }
            }
        };
        tagListLayout.setSizeFull();
        Label tagLabel = new Label("Tags:");
        tagLabel.setSizeUndefined();
        tagListLayout.addComponent(tagLabel);

        for (String tag : tags) {
            Button tagButton = new Button(tag, new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    String tag = event.getButton().getCaption();
                    util.getNavigator().navigateTagView(tag);
                }
            });
            tagButton.setStyleName(Button.STYLE_LINK);
            tagListLayout.addComponent(tagButton);
        }

        Button editButton = new Button("(edit tags)");
        if (util.getLoggedInUser() != null) {
            editButton.addListener(new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    paintTagEdit();
                }
            });
        } else {
            editButton.setEnabled(false);
            editButton.setDescription("Login to tag this project");
        }
        editButton.setStyleName(Button.STYLE_LINK);
        tagListLayout.addComponent(editButton);

        layout.addComponent(tagListLayout);
    } else {
        if (util.getLoggedInUser() != null) {
            Button addTagButton = new Button("(add tags)", new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    paintTagEdit();
                }
            });
            addTagButton.setStyleName(Button.STYLE_LINK);
            layout.addComponent(addTagButton);
        }
    }

}

From source file:org.groom.review.ui.flows.admin.ReviewsFlowlet.java

License:Apache License

@Override
public void initialize() {
    final List<FieldDescriptor> fieldDescriptors = ReviewFields.getFieldDescriptors(Review.class);

    final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>();

    filterDefinitions.add(//from  w w w. j a  v  a 2s . c o m
            new FilterDescriptor("title", "title", "Title", new TextField(), 200, "like", String.class, ""));

    final GridLayout gridLayout = new GridLayout(1, 2);
    gridLayout.setSizeFull();
    gridLayout.setMargin(false);
    gridLayout.setSpacing(true);
    gridLayout.setRowExpandRatio(1, 1f);
    setViewContent(gridLayout);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setSizeUndefined();
    gridLayout.addComponent(buttonLayout, 0, 0);

    final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class);
    container = new LazyEntityContainer<Review>(entityManager, true, false, false, Review.class, 1000,
            new String[] { "created" }, new boolean[] { true }, "reviewId");

    ContainerUtil.addContainerProperties(container, fieldDescriptors);

    final Table table = new FormattingTable();
    grid = new Grid(table, container);
    grid.setFields(fieldDescriptors);
    grid.setFilters(filterDefinitions);
    grid.setWidth(100, Unit.PERCENTAGE);
    grid.setHeight(UI.getCurrent().getPage().getBrowserWindowHeight() - 285, Unit.PIXELS);

    table.setColumnCollapsed("reviewId", true);

    gridLayout.addComponent(grid, 0, 1);

    /*final Button addButton = getSite().getButton("add");
    buttonLayout.addComponent(addButton);
    addButton.addClickListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
            
    @Override
    public void buttonClick(final ClickEvent event) {
        final Review review = new Review();
        review.setCreated(new Date());
        review.setModified(review.getCreated());
        review.setOwner((Company) getSite().getSiteContext().getObject(Company.class));
        final ReviewFlowlet reviewView = getViewSheet().forward(ReviewFlowlet.class);
        reviewView.edit(review, true);
    }
    });*/

    final Button editButton = getSite().getButton("edit");
    buttonLayout.addComponent(editButton);
    editButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Review entity = container.getEntity(grid.getSelectedItemId());
            final ReviewFlowlet reviewView = getFlow().forward(ReviewFlowlet.class);
            reviewView.edit(entity, false);
        }
    });

    table.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            editButton.setEnabled(table.getValue() != null);
        }
    });

    reviewButton = new Button("Report");
    reviewButton.setImmediate(true);
    buttonLayout.addComponent(reviewButton);
    reviewButton.addListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Review entity = container.getEntity(grid.getSelectedItemId());
            final Company company = getSite().getSiteContext().getObject(Company.class);
            getUI().getPage().open(company.getUrl() + "/../report?reviewId=" + entity.getReviewId(), "_blank");
        }
    });

    /*final Button removeButton = getSite().getButton("remove");
    buttonLayout.addComponent(removeButton);
    removeButton.addClickListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
            
    @Override
    public void buttonClick(final ClickEvent event) {
        container.removeItem(grid.getSelectedItemId());
        container.commit();
    }
    });*/

    final Company company = getSite().getSiteContext().getObject(Company.class);
    container.removeDefaultFilters();
    container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId()));
    grid.refresh();
}

From source file:org.groom.review.ui.flows.LogFlowlet.java

License:Apache License

@Override
public void initialize() {
    entityManager = getSite().getSiteContext().getObject(EntityManager.class);

    final GridLayout gridLayout = new GridLayout(1, 3);
    gridLayout.setSizeFull();//from ww w.  j av a2  s.c  om
    gridLayout.setMargin(false);
    gridLayout.setSpacing(true);
    gridLayout.setRowExpandRatio(2, 1f);
    setViewContent(gridLayout);

    final HorizontalLayout filterLayout = new HorizontalLayout();
    filterLayout.setSpacing(true);
    filterLayout.setSizeUndefined();
    gridLayout.addComponent(filterLayout, 0, 0);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setSizeUndefined();
    gridLayout.addComponent(buttonLayout, 0, 1);

    final Validator validator = new Validator() {
        @Override
        public void validate(Object o) throws InvalidValueException {
            final String value = (String) o;
            if (value.indexOf("..") != -1) {
                throw new InvalidValueException("..");
            }
            for (int i = 0; i < value.length(); i++) {
                final char c = value.charAt(i);
                if (!(Character.isLetter(c) || Character.isDigit(c) || "-./".indexOf(c) != -1)) {
                    throw new InvalidValueException("" + c);
                }
            }
        }
    };

    repositoryField = new ComboBox(getSite().localize("field-repository"));
    repositoryField.setNullSelectionAllowed(false);
    repositoryField.setTextInputAllowed(true);
    repositoryField.setNewItemsAllowed(false);
    repositoryField.setInvalidAllowed(false);
    final List<Repository> repositories = ReviewDao.getRepositories(entityManager,
            (Company) getSite().getSiteContext().getObject(Company.class));

    for (final Repository repository : repositories) {
        repositoryField.addItem(repository);
        repositoryField.setItemCaption(repository, repository.getPath());
        if (repositoryField.getItemIds().size() == 1) {
            repositoryField.setValue(repository);
        }
    }
    filterLayout.addComponent(repositoryField);

    sinceField = new TextField(getSite().localize("field-since"));
    sinceField.setValue("master");
    sinceField.setValidationVisible(true);
    sinceField.addValidator(validator);
    filterLayout.addComponent(sinceField);

    untilField = new TextField(getSite().localize("field-until"));
    untilField.setValidationVisible(true);
    untilField.addValidator(validator);
    filterLayout.addComponent(untilField);

    final BeanQueryFactory<CommitBeanQuery> beanQueryFactory = new BeanQueryFactory<CommitBeanQuery>(
            CommitBeanQuery.class);
    queryConfiguration = new HashMap<String, Object>();
    beanQueryFactory.setQueryConfiguration(queryConfiguration);

    final LazyQueryContainer container = new LazyQueryContainer(beanQueryFactory, "hash", 200, false);

    container.addContainerFilter(new Compare.Equal("branch", sinceField.getValue()));
    container.addContainerProperty("hash", String.class, null, true, false);
    container.addContainerProperty("committerDate", Date.class, null, true, false);
    container.addContainerProperty("committer", String.class, null, true, false);
    container.addContainerProperty("authorDate", Date.class, null, true, false);
    container.addContainerProperty("author", String.class, null, true, false);
    container.addContainerProperty("tags", String.class, null, true, false);
    container.addContainerProperty("subject", String.class, null, true, false);

    final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    final Table table = new Table() {

        @Override
        protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            Object v = property.getValue();
            if (v instanceof Date) {
                Date dateValue = (Date) v;
                return format.format(v);
            }
            return super.formatPropertyValue(rowId, colId, property);
        }

    };

    table.setWidth(100, Unit.PERCENTAGE);
    table.setHeight(UI.getCurrent().getPage().getBrowserWindowHeight() - 350, Unit.PIXELS);
    table.setContainerDataSource(container);
    table.setVisibleColumns(
            new Object[] { "hash", "committerDate", "committer", "authorDate", "author", "tags", "subject" });

    table.setColumnWidth("hash", 50);
    table.setColumnWidth("committerDate", 120);
    table.setColumnWidth("committer", 100);
    table.setColumnWidth("authorDate", 120);
    table.setColumnWidth("author", 100);
    table.setColumnWidth("tags", 100);

    table.setColumnHeaders(new String[] { getSite().localize("field-hash"),
            getSite().localize("field-committer-date"), getSite().localize("field-committer"),
            getSite().localize("field-author-date"), getSite().localize("field-author"),
            getSite().localize("field-tags"), getSite().localize("field-subject") });

    table.setColumnCollapsingAllowed(true);
    table.setColumnCollapsed("authorDate", true);
    table.setColumnCollapsed("author", true);
    table.setSelectable(true);
    table.setMultiSelect(true);
    table.setImmediate(true);

    gridLayout.addComponent(table, 0, 2);

    final Button refreshButton = new Button(getSite().localize("button-refresh"));
    buttonLayout.addComponent(refreshButton);
    refreshButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    refreshButton.addStyleName("default");
    refreshButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            repository = (Repository) repositoryField.getValue();

            if (repository != null && sinceField.isValid() && untilField.isValid()) {
                queryConfiguration.put("repository", repository);
                final StringBuilder range = new StringBuilder(sinceField.getValue());
                if (untilField.getValue().length() > 0) {
                    range.append("..");
                    range.append(untilField);
                }
                container.removeAllContainerFilters();
                container.addContainerFilter(new Compare.Equal("range", range.toString()));
                container.refresh();
            }
        }
    });

    final Button fetchButton = new Button("Fetch");
    buttonLayout.addComponent(fetchButton);
    fetchButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Repository repository = (Repository) repositoryField.getValue();
            Notification.show("Executed fetch. " + Shell.execute("git fetch", repository.getPath()));
            refreshButton.click();
        }
    });

    final Button addReviewButton = getSite().getButton("add-review");
    addReviewButton.setEnabled(false);
    buttonLayout.addComponent(addReviewButton);
    addReviewButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Object[] selection = ((Set) table.getValue()).toArray();
            if (selection != null && selection.length == 2) {
                final String hashOne = (String) selection[0];
                final String hashTwo = (String) selection[1];
                final Commit commitOne = ((NestingBeanItem<Commit>) container.getItem(hashOne)).getBean();
                final Commit commitTwo = ((NestingBeanItem<Commit>) container.getItem(hashTwo)).getBean();

                final Commit sinceCommit;
                final Commit untilCommit;
                if (commitOne.getCommitterDate().getTime() > commitTwo.getCommitterDate().getTime()) {
                    sinceCommit = commitTwo;
                    untilCommit = commitOne;
                } else {
                    sinceCommit = commitOne;
                    untilCommit = commitTwo;
                }
                createReview(sinceCommit.getHash(), untilCommit.getHash());
            } else {
                final ReviewRangeDialog dialog = new ReviewRangeDialog(new ReviewRangeDialog.DialogListener() {
                    @Override
                    public void onOk(String sinceHash, String untilHash) {
                        if (sinceHash.length() > 0 && untilHash.length() > 0) {
                            createReview(sinceHash, untilHash);
                        }
                    }

                    @Override
                    public void onCancel() {
                    }
                }, ((selection != null && selection.length == 1) ? "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
                        : ""), ((selection != null && selection.length == 1) ? (String) selection[0] : ""));
                dialog.setCaption("Please enter final comment.");
                UI.getCurrent().addWindow(dialog);
                dialog.getSinceField().focus();
            }

        }
    });

    table.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            final Set selection = (Set) table.getValue();
            addReviewButton.setEnabled(selection != null && (selection.size() == 1 || selection.size() == 2));
        }
    });

}

From source file:org.hip.vif.admin.admin.ui.UpgradeView.java

License:Open Source License

/** UpgradeView constructor.
 *
 * @param inVersionInstance String the instance's version (i.e. the version of the tables)
 * @param inVersionSoftware String the version according to the installed version
 * @param inThread {@link UpgradeTask} the thread managing the upgrade */
public UpgradeView(final String inVersionInstance, final String inVersionSoftware,
        final UpgradeThread inThread) {
    final IMessages lMessages = Activator.getMessages();

    final VerticalLayout lLayout = initLayout(lMessages, "admin.menu.upgrade"); //$NON-NLS-1$

    final Label lFeedbackMsg = new Label(
            String.format(TMPL_FEEDBACK, lMessages.getMessage("admin.upgrade.feedback.failure")), //$NON-NLS-1$
            ContentMode.HTML);//from   www .  java 2  s  .c om
    lFeedbackMsg.setVisible(false);
    lLayout.addComponent(lFeedbackMsg);
    final Label lFailures = new Label("", ContentMode.HTML); //$NON-NLS-1$
    lLayout.addComponent(lFailures);
    lFailures.setVisible(false);

    final LabelValueTable lTable = new LabelValueTable();
    lTable.addRow(lMessages.getMessage("admin.upgrade.version.instance"), inVersionInstance); //$NON-NLS-1$
    lTable.addRow(lMessages.getMessage("admin.upgrade.version.app"), inVersionSoftware); //$NON-NLS-1$
    lLayout.addComponent(lTable);
    lLayout.addComponent(RiplaViewHelper.createSpacer());

    final Button lUpgrade = new Button(lMessages.getMessage("admin.menu.upgrade")); //$NON-NLS-1$
    lLayout.addComponent(lUpgrade);

    lLayout.addComponent(RiplaViewHelper.createSpacer());
    final ProgressBar lProgress = new ProgressBar(new Float(0.0));
    lProgress.setWidth(200, Unit.PIXELS);
    lProgress.setVisible(false);
    lLayout.addComponent(lProgress);

    lUpgrade.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            lProgress.setVisible(true);
            lProgress.setEnabled(true);
            lUpgrade.setEnabled(false);
            UI.getCurrent().setPollInterval(POLL_RUN);

            final Collection<IVIFUpgrade> lFailed = inThread.upgrade(inVersionInstance, inVersionSoftware,
                    lProgress);

            lProgress.setVisible(false);
            if (lFailed.isEmpty()) {
                lFeedbackMsg.setVisible(false);
                lFailures.setVisible(false);
            } else {
                lFeedbackMsg.setVisible(true);
                lFailures.setPropertyDataSource(
                        new ObjectProperty<String>(renderFailures(lFailed), String.class));
                lFailures.setVisible(true);
            }
            lUpgrade.setEnabled(true);
        }
    });
}

From source file:org.inakirj.imagerulette.MyUI.java

License:Open Source License

/**
 * Adds the image row.//from   w  ww .j  a  v a2s .  c om
 */
private void addImageRow() {
    DiceGallerySetupView gallery = (DiceGallerySetupView) tabContent1.getContent();
    gallery.addRow(null);
    Button addButton = (Button) tabContent1.getRightComponent();
    addButton.setEnabled(!gallery.hasReachLimitImages);
}

From source file:org.inakirj.imagerulette.screens.DiceGallerySetupView.java

License:Open Source License

/**
 * Delete url action./*from www.  ja  v a 2 s  .com*/
 *
 * @param itemToBeRemoved
 *            the item to be removed
 */
private void deleteUrlAction(DiceItem itemToBeRemoved) {
    newDataSource.removeItem(itemToBeRemoved);
    String url = itemToBeRemoved.getUrl().getValue();
    if (ImageUtils.isValidImageURI(url)) {
        CookieManager cm = new CookieManager();
        cm.removeFromProperties(url);
    }
    refreshIDs();
    if (hasReachLimitImages) {
        MyUI ui = (MyUI) UI.getCurrent();
        Button addButton = (Button) ui.tabContent1.getRightComponent();
        addButton.setEnabled(true);
    }
}

From source file:org.jpos.qi.eeuser.UsersView.java

License:Open Source License

private Button createChangePasswordButton() {
    Button b = new Button(getApp().getMessage("changePassword"));
    b.setIcon(VaadinIcons.LOCK);//from   w w w .  j av  a 2 s.  c om
    b.setStyleName(ValoTheme.BUTTON_LINK);
    b.addStyleName(ValoTheme.BUTTON_SMALL);
    b.setEnabled(false);
    b.addClickListener((Button.ClickListener) event -> {
        passwordPanel.setVisible(!passwordPanel.isVisible());
        passwordBinder.setReadOnly(!binderIsReadOnly);
        changePassBtn.setCaption(passwordPanel.isVisible() ? getApp().getMessage("cancel")
                : getApp().getMessage("changePassword"));
    });
    return b;
}

From source file:org.jpos.qi.eeuser.UsersView.java

License:Open Source License

private Button createResetPasswordButton() {
    Button b = new Button(getApp().getMessage("resetPassword"));
    b.setStyleName(ValoTheme.BUTTON_LINK);
    b.addStyleName(ValoTheme.BUTTON_SMALL);
    b.setEnabled(false);
    b.setIcon(VaadinIcons.REFRESH);/*from  ww w. j  av  a  2 s . co  m*/
    b.addClickListener((Button.ClickListener) event -> resetPasswordClick());
    return b;
}

From source file:org.jpos.qi.Sidebar.java

License:Open Source License

@SuppressWarnings("unchecked")
private void loadSideBarOptions(String id) {
    if (id != null && id.equals(currentSidebarId))
        return;/*from   ww  w.  j av  a 2  s.  co m*/

    options = new LinkedHashMap<>();
    if (menuItems != null)
        removeComponent(menuItems);

    currentSidebarId = id;
    menuItems = new CssLayout();
    menuItems.setPrimaryStyleName("valo-menuitems");

    Element cfg = app.getXmlConfiguration();
    for (Element sb : cfg.getChildren("sidebar")) {
        String eid = sb.getAttributeValue("id");
        if (id == eid || (eid != null && eid.equals(id))) {
            for (Element e : sb.getChildren()) {
                if ("section".equals(e.getName())) {
                    Label l = new Label(e.getAttributeValue("name"));
                    l.setStyleName(ValoTheme.MENU_SUBTITLE);
                    l.setSizeUndefined();
                    menuItems.addComponent(l);
                } else if ("option".equals(e.getName())) {
                    if (((QINavigator) QI.getQI().getNavigator())
                            .hasAccessToRoute(e.getAttributeValue("action"))) {
                        Button b = new Button(e.getAttributeValue("name"));
                        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
                        String iconName = e.getAttributeValue("icon");
                        if (iconName != null) {
                            try {
                                b.setIcon(FontAwesome.valueOf(iconName));
                            } catch (IllegalArgumentException ex) {
                                b.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
                                b.setEnabled(false);
                            }
                        }
                        String action = e.getAttributeValue("action");
                        options.put(action, b);
                        if (action != null)
                            b.addClickListener((Button.ClickListener) event -> app.getNavigator()
                                    .navigateTo("/" + action));
                        menuItems.addComponent(b);
                    }
                }
            }
            addComponent(menuItems);
        }
    }
}

From source file:org.jumpmind.metl.ui.views.design.ManageProjectsPanel.java

License:Open Source License

protected Component buildVersionGrid(Project project) {
    context.getConfigurationService().refresh(project);
    List<ProjectVersion> versions = project.getProjectVersions();
    BeanItemContainer<ProjectVersion> versionGridContainer = new BeanItemContainer<>(ProjectVersion.class);
    Grid versionGrid = new Grid();

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setMargin(true);//from  w w w  .  j  a va 2  s .c om
    layout.setSpacing(true);
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button openButton = new Button("Open", (event) -> {
        Collection<Object> selected = versionGrid.getSelectedRows();
        for (Object object : selected) {
            projectNavigator.addProjectVersion(((ProjectVersion) object));
        }
    });
    buttons.addComponent(openButton);
    Button newButton = new Button("New Version", (event) -> newVersion(versionGrid));
    buttons.addComponent(newButton);
    Button editButton = new Button("Edit Version", (event) -> edit(versionGrid));
    buttons.addComponent(editButton);
    Button removeButton = new Button("Remove Version", (event) -> removeVersion(versionGrid));
    buttons.addComponent(removeButton);

    openButton.setEnabled(false);
    newButton.setEnabled(false);
    removeButton.setEnabled(false);
    editButton.setEnabled(false);

    layout.addComponent(buttons);

    versionGrid.setWidth(100, Unit.PERCENTAGE);
    versionGrid.setHeight(3 + (versions.size() * ROW_EM), Unit.EM);
    versionGrid.setEditorEnabled(true);
    versionGrid.setSelectionMode(SelectionMode.MULTI);

    versionGrid.addColumn("versionLabel", String.class).setHeaderCaption("Version").setExpandRatio(2);
    versionGrid.addColumn("description", String.class).setHeaderCaption("Description").setExpandRatio(1);
    versionGrid.addColumn("readOnly", Boolean.class).setHeaderCaption("Read Only").setMaximumWidth(100)
            .setRenderer(new HtmlRenderer(), new StringToBooleanConverter() {
                private static final long serialVersionUID = 1L;

                protected String getTrueString() {
                    return FontAwesome.CHECK.getHtml();
                };

                protected String getFalseString() {
                    return "";
                };
            });
    versionGrid.addColumn("createTime", Date.class).setHeaderCaption("Create Time").setWidth(185)
            .setMaximumWidth(200).setRenderer(new DateRenderer(UiConstants.DATETIME_FORMAT)).setEditable(false);

    versionGrid.setContainerDataSource(versionGridContainer);
    versionGrid.setEditorFieldFactory(new FieldFactory());

    versionGrid.getEditorFieldGroup().addCommitHandler(new FieldGroup.CommitHandler() {

        private static final long serialVersionUID = 1L;

        @Override
        public void preCommit(CommitEvent commitEvent) throws CommitException {
        }

        @Override
        public void postCommit(CommitEvent commitEvent) throws CommitException {
            ProjectVersion item = (ProjectVersion) versionGrid.getEditedItemId();
            IConfigurationService configurationService = context.getConfigurationService();
            configurationService.save(item);
            projectGrid.markAsDirty();
        }
    });

    versionGrid.addSelectionListener((event) -> {
        int numberSelected = versionGrid.getSelectedRows().size();
        boolean currentlyEditing = projectGrid.getEditedItemId() != null;
        boolean selected = numberSelected > 0 && !currentlyEditing;
        openButton.setEnabled(selected);
        newButton.setEnabled(selected);
        removeButton.setEnabled(selected);
        editButton.setEnabled(selected);
    });
    versionGrid.addItemClickListener(new GridClickListener(versionGrid));
    layout.addComponent(versionGrid);
    layout.setExpandRatio(versionGrid, 1);
    layout.addComponent(new Label(" "));
    versionGridContainer.addAll(versions);
    versionGrid.sort("versionLabel", SortDirection.DESCENDING);

    return layout;
}