Example usage for com.vaadin.ui Button setHtmlContentAllowed

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

Introduction

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

Prototype

@Deprecated
public void setHtmlContentAllowed(boolean htmlContentAllowed) 

Source Link

Document

Set whether the caption text is rendered as HTML or not.

Usage

From source file:info.magnolia.security.app.dialog.field.WorkspaceAccessFieldFactory.java

License:Open Source License

protected Component createRuleRow(final AbstractOrderedLayout parentContainer,
        final AbstractJcrNodeAdapter ruleItem, final Label emptyLabel) {

    final HorizontalLayout ruleLayout = new HorizontalLayout();
    ruleLayout.setSpacing(true);//from   w  w  w.j  a va2 s.com
    ruleLayout.setWidth("100%");

    NativeSelect accessRights = new NativeSelect();
    accessRights.setNullSelectionAllowed(false);
    accessRights.setImmediate(true);
    accessRights.setInvalidAllowed(false);
    accessRights.setNewItemsAllowed(false);
    accessRights.addItem(Permission.ALL);
    accessRights.setItemCaption(Permission.ALL, i18n.translate("security.workspace.field.readWrite"));
    accessRights.addItem(Permission.READ);
    accessRights.setItemCaption(Permission.READ, i18n.translate("security.workspace.field.readOnly"));
    accessRights.addItem(Permission.NONE);
    accessRights.setItemCaption(Permission.NONE, i18n.translate("security.workspace.field.denyAccess"));
    accessRights.setPropertyDataSource(ruleItem.getItemProperty(AccessControlList.PERMISSIONS_PROPERTY_NAME));
    ruleLayout.addComponent(accessRights);

    NativeSelect accessType = new NativeSelect();
    accessType.setNullSelectionAllowed(false);
    accessType.setImmediate(true);
    accessType.setInvalidAllowed(false);
    accessType.setNewItemsAllowed(false);
    accessType.setWidth("150px");
    accessType.addItem(AccessControlList.ACCESS_TYPE_NODE);
    accessType.setItemCaption(AccessControlList.ACCESS_TYPE_NODE,
            i18n.translate("security.workspace.field.selected"));
    accessType.addItem(AccessControlList.ACCESS_TYPE_CHILDREN);
    accessType.setItemCaption(AccessControlList.ACCESS_TYPE_CHILDREN,
            i18n.translate("security.workspace.field.subnodes"));
    accessType.addItem(AccessControlList.ACCESS_TYPE_NODE_AND_CHILDREN);
    accessType.setItemCaption(AccessControlList.ACCESS_TYPE_NODE_AND_CHILDREN,
            i18n.translate("security.workspace.field.selectedSubnodes"));
    Property accessTypeProperty = ruleItem.getItemProperty(ACCESS_TYPE_PROPERTY_NAME);
    accessType.setPropertyDataSource(accessTypeProperty);
    ruleLayout.addComponent(accessType);

    final TextField path = new TextField();
    path.setWidth("100%");
    path.setPropertyDataSource(ruleItem.getItemProperty(AccessControlList.PATH_PROPERTY_NAME));
    ruleLayout.addComponent(path);
    ruleLayout.setExpandRatio(path, 1.0f);

    Button chooseButton = new Button(i18n.translate("security.workspace.field.choose"));
    chooseButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            openChooseDialog(path);
        }
    });
    ruleLayout.addComponent(chooseButton);

    Button deleteButton = new Button();
    deleteButton.setHtmlContentAllowed(true);
    deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>");
    deleteButton.addStyleName("inline");
    deleteButton.setDescription(i18n.translate("security.workspace.field.delete"));
    deleteButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            parentContainer.removeComponent(ruleLayout);
            ruleItem.getParent().removeChild(ruleItem);
            if (parentContainer.getComponentCount() == 1) {
                parentContainer.addComponent(emptyLabel, 0);
            }
        }
    });
    ruleLayout.addComponent(deleteButton);

    return ruleLayout;
}

From source file:info.magnolia.ui.form.field.MultiField.java

License:Open Source License

/**
 * Create a single element.<br>/*w  w  w  .  j  av a2 s.  c o m*/
 * This single element is composed of:<br>
 * - a configured field <br>
 * - a remove Button<br>
 */
private Component createEntryComponent(Object propertyId, Property<?> property) {

    final HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeight(-1, Unit.PIXELS);

    final Field<?> field = createLocalField(fieldDefinition, property, true); // creates property datasource if given property is null
    layout.addComponent(field);

    // bind the field's property to the item
    if (property == null) {
        property = field.getPropertyDataSource();
        ((PropertysetItem) getPropertyDataSource().getValue()).addItemProperty(propertyId, property);
    }
    final Property<?> propertyReference = property;
    // set layout to full width
    layout.setWidth(100, Unit.PERCENTAGE);

    // distribute space in favour of field over delete button
    layout.setExpandRatio(field, 1);
    if (definition.isReadOnly()) {
        return layout;
    }

    // move up Button
    Button moveUpButton = new Button();
    moveUpButton.setHtmlContentAllowed(true);
    moveUpButton.setCaption("<span class=\"" + "icon-arrow2_n" + "\"></span>");
    moveUpButton.addStyleName("inline");
    moveUpButton.setDescription(buttonCaptionMoveUp);
    moveUpButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            onMove(layout, propertyReference, true);
        }
    });

    // move down Button
    Button moveDownButton = new Button();
    moveDownButton.setHtmlContentAllowed(true);
    moveDownButton.setCaption("<span class=\"" + "icon-arrow2_s" + "\"></span>");
    moveDownButton.addStyleName("inline");
    moveDownButton.setDescription(buttonCaptionMoveDown);
    moveDownButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            onMove(layout, propertyReference, false);
        }
    });

    // Delete Button
    Button deleteButton = new Button();
    deleteButton.setHtmlContentAllowed(true);
    deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>");
    deleteButton.addStyleName("inline");
    deleteButton.setDescription(buttonCaptionRemove);
    deleteButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            onDelete(layout, propertyReference);
        }
    });

    layout.addComponents(moveUpButton, moveDownButton, deleteButton);

    // make sure button stays aligned with the field and not with the optional field label when used
    layout.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT);
    layout.setComponentAlignment(moveUpButton, Alignment.BOTTOM_RIGHT);
    layout.setComponentAlignment(moveDownButton, Alignment.BOTTOM_RIGHT);

    return layout;
}

From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadField.java

License:Open Source License

/**
 * Create Delete button.//ww w. j  a  va  2  s  . co m
 */
protected Button createDeleteButton() {
    Button deleteButton = new Button();
    deleteButton.setHtmlContentAllowed(true);
    deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>");
    deleteButton.addStyleName("inline");
    deleteButton.setDescription(i18n.translate(deleteCaption));

    deleteButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            resetDataSource();
            updateDisplay();
        }
    });
    return deleteButton;
}

From source file:lv.polarisit.demosidemenu.ValoThemeUI.java

License:Apache License

CssLayout buildMenu() {
    // Add items/*from w ww . j  a  v a2s. c om*/
    menuItems.put("MessageView", "First Message");
    menuItems.put("MessageView1", "Second Message");
    /*
    menuItems.put("labels", "Labels");
    menuItems.put("buttons-and-links", "Buttons & Links");
    menuItems.put("textfields", "Text Fields");
    menuItems.put("datefields", "Date Fields");
    menuItems.put("comboboxes", "Combo Boxes");
    menuItems.put("selects", "Selects");
    menuItems.put("checkboxes", "Check Boxes & Option Groups");
    menuItems.put("sliders", "Sliders & Progress Bars");
    menuItems.put("colorpickers", "Color Pickers");
    menuItems.put("menubars", "Menu Bars");
    menuItems.put("trees", "Trees");
    menuItems.put("tables", "Tables");
    menuItems.put("dragging", "Drag and Drop");
    menuItems.put("panels", "Panels");
    menuItems.put("splitpanels", "Split Panels");
    menuItems.put("tabs", "Tabs");
    menuItems.put("accordions", "Accordions");
    menuItems.put("popupviews", "Popup Views");
    // menuItems.put("calendar", "Calendar");
    menuItems.put("forms", "Forms");
    */
    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);
    menu.addComponent(createThemeSelect());

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    /*
    final StringGenerator sg = new StringGenerator();
    final MenuItem settingsItem = settings.addItem(sg.nextString(true)
        + " " + sg.nextString(true) + sg.nextString(false),
        new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"),
        null);
            
    settingsItem.addItem("Edit Profile", null);
    settingsItem.addItem("Preferences", null);
    settingsItem.addSeparator();
    settingsItem.addItem("Sign Out", null);
                */
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    Label label = null;
    int count = -1;
    for (final Entry<String, String> item : menuItems.entrySet()) {
        if (item.getKey().equals("labels")) {
            label = new Label("Components", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("panels")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Containers", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("forms")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Other", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        final Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        if (count == 2) {
            b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>");
        }
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        //            b.setIcon(testIcon.get());
        menuItemsLayout.addComponent(b);
        count++;
    }
    if (label != null)
        label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");

    return menu;
}

From source file:me.uni.emuseo.view.menu.MenuView.java

License:Open Source License

private CssLayout buildMenu() {
    // Add items//from w  w  w  . ja  v  a 2 s .c o  m
    if (authManager.isAuthorizedTo(Permissions.MENU_USERS_VIEW)) {
        menuItems.put(Permissions.MENU_USERS_VIEW, "Uytkownicy");
    }
    if (authManager.isAuthorizedTo(Permissions.MENU_EXHIBIT_VIEW)) {
        menuItems.put(Permissions.MENU_EXHIBIT_VIEW, "Katalog eksponatw");
    }
    if (authManager.isAuthorizedTo(Permissions.MENU_CATEGORIES_VIEW)) {
        menuItems.put(Permissions.MENU_CATEGORIES_VIEW, "Kategorie");
    }
    if (authManager.isAuthorizedTo(Permissions.MENU_RESOURCES_VIEW)) {
        menuItems.put(Permissions.MENU_RESOURCES_VIEW, "Zasoby");
    }

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);
    final Button showMenu = new Button("Menu", new ClickListener() {
        private static final long serialVersionUID = -719702284721453362L;

        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);
    final Label title = new Label("<h3>e<strong>Museo</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);
    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");

    settingsItem = settings.addItem("Jan Kowalski", defaultIcon, null);
    if (authManager.isAuthorizedTo(Permissions.MENU_MY_ACCOUNT_VIEW)) {
        settingsItem.addItem("Moje konto", new MenuBar.Command() {
            private static final long serialVersionUID = 7015035735144235104L;

            @Override
            public void menuSelected(MenuItem selectedItem) {
                navigator.navigateTo(Permissions.MENU_MY_ACCOUNT_VIEW);
            }

        });
    }
    if (authManager.isAuthorizedTo(Permissions.MENU_SETTINGS_VIEW)) {
        settingsItem.addItem("Ustawienia", new MenuBar.Command() {
            private static final long serialVersionUID = 7015035735144235105L;

            @Override
            public void menuSelected(MenuItem selectedItem) {
                navigator.navigateTo(Permissions.MENU_SETTINGS_VIEW);
            }

        });
    }
    settingsItem.addSeparator();
    settingsItem.addItem("Wyloguj", new MenuBar.Command() {
        private static final long serialVersionUID = 1333473616079310225L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            final AuthManager authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class);
            authManager.logout();
        }
    });
    menu.addComponent(settings);
    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    for (final Entry<String, String> item : menuItems.entrySet()) {
        FontIcon icon = null;
        if (item.getKey().equals(Permissions.MENU_USERS_VIEW)) {
            icon = FontAwesome.USERS;
        } else if (item.getKey().endsWith(Permissions.MENU_EXHIBIT_VIEW)) {
            icon = FontAwesome.UNIVERSITY;
        } else if (item.getKey().endsWith(Permissions.MENU_CATEGORIES_VIEW)) {
            icon = FontAwesome.ARCHIVE;
        } else if (item.getKey().endsWith(Permissions.MENU_RESOURCES_VIEW)) {
            icon = FontAwesome.IMAGE;
        }
        final Button b = new Button(item.getValue(), new ClickListener() {
            private static final long serialVersionUID = -7089398070311521853L;

            @Override
            public void buttonClick(final ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        if (icon != null) {
            b.setIcon(icon);
        }
        menuItemsLayout.addComponent(b);
    }
    return menu;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java

License:Apache License

private Component getMenu() {
    GridLayout gl = new GridLayout(3, 3);
    gl.addComponent(new Image("", LOGO), 0, 0);
    Label version = new Label(TRANSLATOR.translate("general.version") + ": " + getVersion());
    gl.addComponent(version, 2, 2);//from   w ww  . ja v a2  s  . c  om
    if (getUser() != null) {
        getUser().update();
        //Logout button
        Button logout = new Button(TRANSLATOR.translate("general.logout"));
        logout.addClickListener((Button.ClickEvent event) -> {
            try {
                user.update();
                user.write2DB();
                user = null;
                main = null;
                setLocale(Locale.ENGLISH);
                updateScreen();
                // Close the session
                closeSession();
            } catch (VMException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        });
        gl.addComponent(logout, 1, 0);
        //Notification Button
        if (getUser().getNotificationList().isEmpty() && DataBaseManager.isDemo()) {
            //For demo add a notification for users
            try {
                Lookup.getDefault().lookup(INotificationManager.class).addNotification(
                        "Welcome to ValidationManager!", NotificationTypes.GENERAL, getUser().getEntity(),
                        new VMUserServer(1).getEntity());
            } catch (Exception ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }
        Button notification = new Button();
        if (getUser().getPendingNotifications().size() > 0) {
            notification.setCaption("" + getUser().getPendingNotifications().size()); //any number, count, etc
        }
        notification.setHtmlContentAllowed(true);
        notification.setIcon(VaadinIcons.BELL);
        notification.addClickListener((Button.ClickEvent event) -> {
            //TODO: Show notifications screen
        });
        gl.addComponent(notification, 2, 0);
    }
    gl.setSizeFull();
    return gl;
}

From source file:org.bubblecloud.ilves.site.view.valo.DefaultValoView.java

License:Apache License

private void addMenuLink(final NavigationVersion navigationVersion, final String pageName) {
    final Site site = Site.getCurrent();
    final ViewVersion pageVersion = site.getCurrentViewVersion(pageName);
    if (pageVersion == null) {
        throw new SiteException("Unknown page: " + pageName);
    }/*from w  ww .  j  a va 2 s.  co m*/
    if (pageVersion.getViewerRoles().length > 0) {
        boolean roleMatch = false;
        for (final String role : pageVersion.getViewerRoles()) {
            if (site.getSecurityProvider().getRoles().contains(role)) {
                roleMatch = true;
                break;
            }
        }
        if (!roleMatch) {
            return;
        }
    }

    final String localizedPageName = pageVersion.isDynamic() ? pageName
            : site.localize("page-link-" + pageName);
    final Resource iconResource = pageVersion.isDynamic()
            ? navigationVersion.hasChildPages(pageName) ? site.getIcon("page-icon-folder")
                    : site.getIcon("page-icon-page")
            : site.getIcon("page-icon-" + pageName);

    Button b = new Button(localizedPageName, new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo(pageName);
        }
    });

    b.setHtmlContentAllowed(true);
    b.setPrimaryStyleName("valo-menu-item");
    b.setIcon(iconResource);
    menuItemsLayout.addComponent(b);

}

From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java

License:Open Source License

private Button createActionsButton() {
    final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.PENDING_ACTION_BUTTON,
            getNoActionsButtonLabel(), "", "", false, FontAwesome.BELL, SPUIButtonStyleSmall.class);
    button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
    button.addStyleName(SPUIStyleDefinitions.DEL_ACTION_BUTTON);

    button.addClickListener(event -> actionButtonClicked());
    button.setHtmlContentAllowed(true);
    return button;
}

From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java

License:Open Source License

private Button createBulkUploadStatusButton() {
    final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.BULK_UPLOAD_STATUS_BUTTON, "",
            "", "", false, null, SPUIButtonStyleSmall.class);
    button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
    button.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
    button.setWidth("100px");
    button.setHtmlContentAllowed(true);
    button.addClickListener(event -> onClickBulkUploadNotificationButton());
    button.setVisible(false);/*from  www  .ja va 2s.c om*/
    return button;
}

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

License:Apache License

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

    gridLayout = new GridLayout(1, 2);
    gridLayout.setSpacing(true);/* w  w w.j a v  a 2  s. com*/
    gridLayout.setSizeFull();
    gridLayout.setColumnExpandRatio(0, 1f);
    gridLayout.setRowExpandRatio(1, 1f);
    setViewContent(gridLayout);

    selectionChangeListener = new AceEditor.SelectionChangeListener() {
        @Override
        public void selectionChanged(AceEditor.SelectionChangeEvent e) {

        }
    };

    //gridLayout.addComponent(editor, 0, 0);

    if (getFlow().getFlowlet(ReviewFlowlet.class) != null) {
        final HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.setSpacing(true);
        gridLayout.addComponent(buttonLayout, 0, 0);

        final Button previousButton = new Button(getSite().localize("button-previous-diff"));
        previousButton.setClickShortcut(ShortcutAction.KeyCode.ARROW_LEFT);
        previousButton.setHtmlContentAllowed(true);
        buttonLayout.addComponent(previousButton);
        previousButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                final ReviewFlowlet view = getFlow().getFlowlet(ReviewFlowlet.class);
                view.previous(path);
            }
        });

        final Button nextButton = new Button(getSite().localize("button-next-diff"));
        nextButton.setClickShortcut(ShortcutAction.KeyCode.ARROW_RIGHT);
        nextButton.setHtmlContentAllowed(true);
        buttonLayout.addComponent(nextButton);
        nextButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                final ReviewFlowlet view = getFlow().getFlowlet(ReviewFlowlet.class);
                view.next(path);
            }
        });

        final Button scrollToPreviousChangeButton = new Button(
                getSite().localize("button-scroll-to-previous-change"));
        scrollToPreviousChangeButton.setClickShortcut(ShortcutAction.KeyCode.ARROW_UP);
        scrollToPreviousChangeButton.setHtmlContentAllowed(true);
        buttonLayout.addComponent(scrollToPreviousChangeButton);
        scrollToPreviousChangeButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                int cursorLine = getScrolledTowRow();

                for (int i = cursorLine; i >= 0; i--) {
                    cursorLine = i;
                    if (blames.get(i).getType() == LineChangeType.NONE) {
                        break;
                    }
                }
                for (int i = cursorLine; i >= 0; i--) {
                    cursorLine = i;
                    if (i == 0 | blames.get(i).getType() != LineChangeType.NONE) {
                        break;
                    }
                }
                for (int i = cursorLine; i >= 0; i--) {
                    if (i == 0) {
                        final ReviewFlowlet view = getFlow().getFlowlet(ReviewFlowlet.class);
                        //view.previous(path);
                        scrollToRow(0);
                        break;
                    }
                    if (blames.get(i).getType() == LineChangeType.NONE) {
                        scrollToRow(i + 1);
                        break;
                    }
                }
            }
        });

        final Button scrollToNextChangeButton = new Button(getSite().localize("button-scroll-to-next-change"));
        scrollToNextChangeButton.setClickShortcut(ShortcutAction.KeyCode.ARROW_DOWN);
        scrollToNextChangeButton.setHtmlContentAllowed(true);
        buttonLayout.addComponent(scrollToNextChangeButton);
        scrollToNextChangeButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                int cursorLine = getScrolledTowRow();

                for (int i = cursorLine; i < blames.size(); i++) {
                    cursorLine = i;
                    if (blames.get(i).getType() == LineChangeType.NONE) {
                        break;
                    }
                }
                for (int i = cursorLine; i < blames.size(); i++) {
                    if (i == blames.size() - 1) {
                        final ReviewFlowlet view = getFlow().getFlowlet(ReviewFlowlet.class);
                        //view.next(path);
                        scrollToRow(i);
                        break;
                    }
                    if (blames.get(i).getType() != LineChangeType.NONE) {
                        scrollToRow(i);
                        break;
                    }
                }
            }
        });

        final Button scrollToCursorButton = new Button("Scroll to Cursor");
        scrollToCursorButton.setHtmlContentAllowed(true);
        buttonLayout.addComponent(scrollToCursorButton);
        scrollToCursorButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                if (editor.getSelection() == null || editor.getCursorPosition() < 0) {
                    return;
                }
                int cursor = editor.getCursorPosition();
                if (fileDiff.getReviewStatus() != null) {
                    final int cursorLine = findLine(editor.getValue(), cursor);
                    scrollToRow(cursorLine);
                }
            }
        });

        groomButton = getSite().getButton("groom");
        groomButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
        groomButton.setHtmlContentAllowed(true);
        buttonLayout.addComponent(groomButton);
        groomButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                if (editor.getSelection() == null || editor.getCursorPosition() < 0) {
                    return;
                }
                int cursor = editor.getCursorPosition();
                if (fileDiff.getReviewStatus() != null) {
                    final int cursorLine = findLine(editor.getValue(), cursor);
                    final BlameLine blame = blames.get(cursorLine);

                    final CommentDialog commentDialog = new CommentDialog(new CommentDialog.DialogListener() {
                        @Override
                        public void onOk(final String message, final int severity) {
                            final ReviewStatus reviewStatus = fileDiff.getReviewStatus();
                            final Review review = reviewStatus.getReview();
                            final Date date = new Date();
                            if (message.trim().length() > 0) {
                                final Comment comment = new Comment(review, reviewStatus.getReviewer(),
                                        blame.getHash(), fileDiff.getPath(), blame.getFinalLine(), cursorLine,
                                        severity, message, blame.getAuthorName(), blame.getCommitterName(),
                                        date, date);
                                ReviewDao.saveComment(entityManager, comment);
                                addComment(comment);
                                final Company company = getSite().getSiteContext().getObject(Company.class);
                                final Thread emailThread = new Thread(new Runnable() {
                                    @Override
                                    public void run() {
                                        String severity;
                                        switch (comment.getSeverity()) {
                                        case 1:
                                            severity = "Kudo";
                                            break;
                                        case -1:
                                            severity = "Warning";
                                            break;
                                        case -2:
                                            severity = "Red Flag";
                                            break;
                                        default:
                                            severity = Integer.toString(comment.getSeverity());
                                            if (!severity.startsWith("-")) {
                                                severity = "+" + severity;
                                            }
                                        }
                                        EmailUtil.send(blame.getAuthorEmail(),
                                                reviewStatus.getReviewer().getEmailAddress(),
                                                severity + " from review '" + review.getTitle() + "'",
                                                "Reviewer: " + reviewStatus.getReviewer().getFirstName() + " "
                                                        + reviewStatus.getReviewer().getLastName() + "\n"
                                                        + "Commit: " + blame.getHash() + "\n" + "File: "
                                                        + fileDiff.getPath() + "\n" + "Original Line: "
                                                        + blame.getOriginalLine() + "\n" + "Diff line: "
                                                        + cursorLine + "\n" + blame.getType() + ":"
                                                        + blame.getLine() + "\n" + "Message: " + message);
                                    }
                                });
                                emailThread.start();
                            }
                        }

                        public void onCancel() {
                            //To change body of implemented methods use File | Settings | File Templates.
                        }
                    });
                    int cursorPosition = editor.getCursorPosition();
                    commentDialog.setCaption("Please enter groom text for " + blame.getAuthorName()
                            + " at line: " + (cursorLine + 1));
                    UI.getCurrent().addWindow(commentDialog);
                    commentDialog.getTextArea().focus();

                }
            }
        });

    }
}