Example usage for com.vaadin.ui Panel Panel

List of usage examples for com.vaadin.ui Panel Panel

Introduction

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

Prototype

public Panel(String caption) 

Source Link

Document

Creates a new empty panel with caption.

Usage

From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java

License:Apache License

private void initializeLicense() {
    licenseLayout = createVerticalLayout("about.license.caption", "about.license.description",
            FontAwesome.FILE_TEXT);//w  ww.j av  a2 s.c om

    Label text = new Label(licenseText, ContentMode.HTML);
    text.setWidth(100f, PERCENTAGE);

    Panel panel = new Panel(text);
    panel.setWidth(100f, PERCENTAGE);
    panel.setHeight(300f, PIXELS);

    licenseLayout.addComponent(panel);
}

From source file:de.metas.ui.web.vaadin.window.editor.DocumentSectionEditorsContainer.java

License:Open Source License

public DocumentSectionEditorsContainer(final ViewPropertyDescriptor descriptor) {
    super(descriptor);
    addStyleName(STYLE);/*from w  w w. ja va  2 s.  c  om*/

    content = createPanelContent();
    content.setSizeFull();
    content.setPrimaryStyleName(STYLE_PanelContent);
    panel = new Panel(content);
    panel.setPrimaryStyleName(STYLE_Panel);
    setCompositionRoot(panel);

    panel.setCaption(descriptor.getPropertyName().toString());
}

From source file:de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent.java

License:Open Source License

protected void setWrappedComponent(C component, FieldGroup... fieldGroups) {

    this.wrappedComponent = component;
    this.fieldGroups = fieldGroups;

    if (contentPanel != null) {
        contentPanel.setContent(wrappedComponent);
        return;/*  w w w.  j  a  v  a 2s. com*/
    }

    setSpacing(false);
    setMargin(true);
    setSizeUndefined();

    contentPanel = new Panel(component);
    updateInternalWidth();
    updateInternalHeight();
    addComponent(contentPanel);
    setExpandRatio(contentPanel, 1);

    buttonsPanel = new HorizontalLayout();
    buttonsPanel.setMargin(false);
    buttonsPanel.setSpacing(true);
    buttonsPanel.setWidth(100, Unit.PERCENTAGE);

    Button discardButton = getDiscardButton();
    buttonsPanel.addComponent(discardButton);
    buttonsPanel.setComponentAlignment(discardButton, Alignment.BOTTOM_RIGHT);
    buttonsPanel.setExpandRatio(discardButton, 1);

    Button commitButton = getCommitButton();
    buttonsPanel.addComponent(commitButton);
    buttonsPanel.setComponentAlignment(commitButton, Alignment.BOTTOM_RIGHT);
    buttonsPanel.setExpandRatio(commitButton, 0);

    addComponent(buttonsPanel);
    setComponentAlignment(buttonsPanel, Alignment.BOTTOM_RIGHT);

    setShortcutsEnabled(shortcutsEnabled);

    if (fieldGroups != null && fieldGroups.length > 0) {
        // convention: set wrapper to read-only when all wrapped field groups are read-only
        boolean allReadOnly = true;
        for (FieldGroup fieldGroup : fieldGroups) {
            if (!fieldGroup.isReadOnly()) {
                allReadOnly = false;
                break;
            }
        }
        if (allReadOnly) {
            setReadOnly(true);
        }
    } else if (wrappedComponent != null) {
        if (wrappedComponent instanceof AbstractLegacyComponent
                && ((AbstractLegacyComponent) wrappedComponent).isReadOnly()) {
            setReadOnly(true);
        }
    }
}

From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java

private Component getProfiles(Group g) {
    VerticalLayout layoutRootProfiles = new VerticalLayout();
    layoutRootProfiles.setMargin(false);
    layoutRootProfiles.setWidth("100%");
    Panel panelProfiles = new Panel(Language.get(Word.PROFILES));
    Language.setCustom(Word.PROFILES, s -> panelProfiles.setCaption(s));
    panelProfiles.setWidth("100%");
    panelProfiles.setHeight("200px");

    VerticalLayout layoutProfiles = new VerticalLayout();
    mapLayoutProfiles.put(g, layoutProfiles);
    layoutProfiles.setWidth("100%");

    refreshProfiles(g, layoutProfiles);//from   w  w w  .j  ava  2 s  .  c om

    panelProfiles.setContent(layoutProfiles);
    layoutRootProfiles.addComponent(panelProfiles);

    if (GroupUtils.isAdmin(g, UserUtils.getCurrent())) {
        CssLayout addProfileGroup = new CssLayout();
        addProfileGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
        addProfileGroup.setWidth("100%");

        TextField textFieldAddProfile = new TextField();
        Language.setCustom(Word.PROFILE_NAME, s -> textFieldAddProfile.setPlaceholder(s));
        textFieldAddProfile.setMaxLength(255);
        textFieldAddProfile.setWidth("35%");
        addProfileGroup.addComponent(textFieldAddProfile);

        Button buttonAddProfile = new Button();
        buttonAddProfile.setIcon(VaadinIcons.PLUS);
        buttonAddProfile.addStyleName(ValoTheme.BUTTON_PRIMARY);
        buttonAddProfile.setWidth("15%");
        buttonAddProfile.addClickListener(e -> {
            try {
                String name = textFieldAddProfile.getValue();
                textFieldAddProfile.clear();
                Runnable onClose = () -> refreshAll(g);
                UI.getCurrent().addWindow(GroupProfileWindow.create(g, name, true, onClose));
            } catch (UserNotFoundException ex) {
                VaadinUtils.errorNotification(Language.get(Word.USER_NOT_FOUND));
            }
        });
        addProfileGroup.addComponent(buttonAddProfile);

        layoutRootProfiles.addComponent(addProfileGroup);
    }
    return layoutRootProfiles;
}

From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java

private Component getMembers(Group g) {
    VerticalLayout layoutRootMembers = new VerticalLayout();
    layoutRootMembers.setMargin(false);/*from  www.jav  a  2s.c  om*/
    layoutRootMembers.setWidth("100%");
    Panel panelMembers = new Panel(Language.get(Word.MEMBERS));
    Language.setCustom(Word.MEMBERS, s -> panelMembers.setCaption(s));
    panelMembers.setWidth("100%");
    panelMembers.setHeight("200px");

    VerticalLayout layoutMembers = new VerticalLayout();
    mapLayoutMembers.put(g, layoutMembers);
    layoutMembers.setWidth("100%");

    refreshMembers(g, layoutMembers);

    panelMembers.setContent(layoutMembers);
    layoutRootMembers.addComponent(panelMembers);

    if (GroupUtils.isAdmin(g, UserUtils.getCurrent())) {
        CssLayout addUserGroup = new CssLayout();
        addUserGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
        addUserGroup.setWidth("100%");

        TextField textFieldaddUser = new TextField();
        Language.setCustom(Word.USERNAME, s -> textFieldaddUser.setPlaceholder(s));
        textFieldaddUser.setMaxLength(255);
        textFieldaddUser.setWidth("70%");
        addUserGroup.addComponent(textFieldaddUser);

        Button buttonAddUser = new Button();
        buttonAddUser.setIcon(VaadinIcons.PLUS);
        buttonAddUser.addStyleName(ValoTheme.BUTTON_PRIMARY);
        buttonAddUser.setWidth("30%");
        buttonAddUser.addClickListener(e -> {
            try {
                User u = UserUtils.getUser(textFieldaddUser.getValue());
                textFieldaddUser.clear();
                GroupUtils.addUser(g, u);
                refreshAll(g);
            } catch (UserNotFoundException ex) {
                VaadinUtils.errorNotification(Language.get(Word.USER_NOT_FOUND));
            }
        });
        addUserGroup.addComponent(buttonAddUser);

        layoutRootMembers.addComponent(addUserGroup);
    }

    return layoutRootMembers;
}

From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java

public Component getSources(InterestProfile profile) {
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setWidth("100%");
    VerticalLayout sourcesLayout = new VerticalLayout();
    sourcesLayout.setWidth("100%");
    Panel sourcesPanel = new Panel(sourcesLayout);

    List<CheckBox> checkBoxes = new ArrayList<>();
    HashMap<String, GridLayout> sourceLayouts = new HashMap<>();
    profile.getSources().entrySet().stream()
            .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> {
                Source source = e.getKey();
                boolean enabled = e.getValue();
                GridLayout sourceLayout = new GridLayout(5, 1);
                sourceLayout.setSizeFull();

                CheckBox sourceSelected = new CheckBox();
                sourceSelected.setValue(enabled);
                sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue()));
                checkBoxes.add(sourceSelected);

                Image sourceLogo = new Image();
                sourceLogo.addStyleName("logosmall");
                sourceLogo.setSource(new ExternalResource(source.getLogo()));
                sourceLogo.addClickListener(c -> {
                    sourceSelected.setValue(!sourceSelected.getValue());
                    profile.getSources().replace(source, sourceSelected.getValue());
                });//w ww .  j av  a  2 s  . co  m
                VerticalLayout layoutLogo = new VerticalLayout(sourceLogo);
                layoutLogo.setWidth("150px");
                layoutLogo.setHeight("50px");
                layoutLogo.setMargin(false);
                layoutLogo.setSpacing(false);
                layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT);

                Label labelHeadLine = new Label(
                        source.getCategory().getIcon().getHtml() + "  " + source.getName(), ContentMode.HTML);
                labelHeadLine.addStyleName(ValoTheme.LABEL_H3);

                Label labelDescription = new Label(source.getDescription(), ContentMode.HTML);
                labelDescription.setWidth("300px");
                PopupView popup = new PopupView(null, labelDescription);

                Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O);
                buttonDescription.addClickListener(ce -> {
                    popup.setPopupVisible(true);
                });

                sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription);
                sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER);
                sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER);
                sourceLayout.setColumnExpandRatio(2, 5);
                sourceLayout.setSpacing(true);

                sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "")
                        .replaceAll("_", ""), sourceLayout);
                sourcesLayout.addComponent(sourceLayout);
            });

    sourcesPanel.setContent(sourcesLayout);
    sourcesPanel.setHeight("100%");
    sourcesPanel.setCaption(Language.get(Word.SOURCES));
    Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s));
    windowLayout.addComponent(sourcesPanel);
    windowLayout.setExpandRatio(sourcesPanel, 1);
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);

    CheckBox checkBoxSelectAll = new CheckBox();
    Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s));
    checkBoxSelectAll.setWidth("100%");
    checkBoxSelectAll.addValueChangeListener(e -> {
        profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue());
        checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue()));
    });

    TextField textFieldSearch = new TextField();
    Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s));
    textFieldSearch.setWidth("100%");
    textFieldSearch.setMaxLength(255);
    textFieldSearch.setPlaceholder(Language.get(Word.SEARCH));
    textFieldSearch.addValueChangeListener(searchValue -> {
        sourceLayouts.forEach((sourceName, sourceLayout) -> {
            if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "")
                    .replaceAll("-", "").replaceAll("_", ""))) {
                sourcesLayout.removeComponent(sourceLayout);
            } else {
                sourcesLayout.addComponent(sourceLayout);
            }
        });
    });

    Label placeholder = new Label();
    placeholder.setWidth("100%");

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setMargin(new MarginInfo(true, false, false, false));
    footer.addStyleName("menubar");
    footer.setWidth("100%");
    footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder);
    footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT);
    footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(footer);
    windowLayout.setHeight("350px");
    return windowLayout;
}

From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java

public Component getCategories(InterestProfile profile) {
    Map<Category, Boolean> categories = profile.getCategories();
    VerticalLayout categoriesLayout = new VerticalLayout();
    categoriesLayout.setWidth("100%");
    Panel categoriesPanel = new Panel(categoriesLayout);

    categories.entrySet().stream().sorted((e1, e2) -> e1.getKey().getName().compareTo(e2.getKey().getName()))
            .forEach(e -> {//ww  w  . j  a  v a2 s .c  om
                Category category = e.getKey();
                boolean enabled = e.getValue();
                GridLayout categoryLayout = new GridLayout(3, 1);
                categoryLayout.setWidth("100%");

                CheckBox categorySelected = new CheckBox();
                categorySelected.setValue(enabled);
                categorySelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                categorySelected.addValueChangeListener(v -> categories.replace(category, v.getValue()));

                Label categoryIcon = new Label(category.getIcon().getHtml(), ContentMode.HTML);
                categoryIcon.addStyleName(ValoTheme.LABEL_H3);
                categoryIcon.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                Label categoryName = new Label(category.getName(), ContentMode.HTML);
                Language.setCustom(null, s -> categoryName.setValue(category.getName()));
                categoryName.addStyleName(ValoTheme.LABEL_H3);
                categoryName.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                categoryLayout.addComponents(categorySelected, categoryIcon, categoryName);
                categoryLayout.setComponentAlignment(categorySelected, Alignment.MIDDLE_CENTER);
                categoryLayout.setComponentAlignment(categoryIcon, Alignment.MIDDLE_LEFT);
                categoryLayout.setComponentAlignment(categoryName, Alignment.MIDDLE_LEFT);
                categoryLayout.setColumnExpandRatio(2, 5);
                categoryLayout.setSpacing(true);

                categoriesLayout.addComponent(categoryLayout);
            });

    categoriesPanel.setContent(categoriesLayout);
    categoriesPanel.setHeight("100%");
    categoriesPanel.setCaption(Language.get(Word.CATEGORIES));
    Language.setCustom(Word.CATEGORIES, s -> categoriesPanel.setCaption(s));

    return categoriesPanel;
}

From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java

public Component getTags(InterestProfile profile) {
    GridLayout allTagsLayout = new GridLayout(2, 1);
    Panel allTagsPanel = new Panel(allTagsLayout);
    allTagsPanel.setWidth("100%");
    allTagsPanel.setHeight("265px");
    allTagsPanel.setCaption(Language.get(Word.TAGS));
    Language.setCustom(Word.TAGS, s -> allTagsPanel.setCaption(s));

    VerticalLayout includedTagsLayout = new VerticalLayout();
    includedTagsLayouts.put(profile, includedTagsLayout);
    includedTagsLayout.setWidth("100%");
    includedTagsLayout.addStyleName("tags");
    Label labelIncludedTags = new Label(Language.get(Word.INCLUDE_TAGS));//Evtl only included
    Language.setCustom(Word.INCLUDE_TAGS, s -> labelIncludedTags.setValue(s));
    Component addIncludeTagGroup = getAddTagGroup(profile, true);
    includedTagsLayout.addComponents(labelIncludedTags, addIncludeTagGroup);
    includedTagsLayout.setComponentAlignment(labelIncludedTags, Alignment.MIDDLE_CENTER);
    includedTagsLayout.setComponentAlignment(addIncludeTagGroup, Alignment.MIDDLE_CENTER);

    VerticalLayout excludedTagsLayout = new VerticalLayout();
    excludedTagsLayouts.put(profile, excludedTagsLayout);
    excludedTagsLayout.setWidth("100%");
    excludedTagsLayout.addStyleName("tags");
    Label labelExcludedTags = new Label(Language.get(Word.EXCLUDE_TAGS));//Evtl only included
    Language.setCustom(Word.EXCLUDE_TAGS, s -> labelExcludedTags.setValue(s));
    Component addExcludeTagGroup = getAddTagGroup(profile, false);
    excludedTagsLayout.addComponents(labelExcludedTags, addExcludeTagGroup);
    excludedTagsLayout.setComponentAlignment(labelExcludedTags, Alignment.MIDDLE_CENTER);
    excludedTagsLayout.setComponentAlignment(addExcludeTagGroup, Alignment.MIDDLE_CENTER);

    profile.getTags().forEach((tag, included) -> addRow(profile, included, tag));

    allTagsLayout.addComponents(includedTagsLayout, excludedTagsLayout);
    allTagsLayout.setWidth("100%");
    return allTagsPanel;
}

From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

public Component getSources(GroupInterestProfile profile, boolean isAdmin) {
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setWidth("100%");
    VerticalLayout sourcesLayout = new VerticalLayout();
    sourcesLayout.setWidth("100%");
    Panel sourcesPanel = new Panel(sourcesLayout);

    List<CheckBox> checkBoxes = new ArrayList<>();
    HashMap<String, GridLayout> sourceLayouts = new HashMap<>();
    profile.getSources().entrySet().stream()
            .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> {
                Source source = e.getKey();
                boolean enabled = e.getValue();
                GridLayout sourceLayout = new GridLayout(5, 1);
                sourceLayout.setSizeFull();

                CheckBox sourceSelected = new CheckBox();
                sourceSelected.setValue(enabled);
                sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue()));
                sourceSelected.setEnabled(isAdmin);
                checkBoxes.add(sourceSelected);

                Image sourceLogo = new Image();
                sourceLogo.addStyleName("logosmall");
                sourceLogo.setSource(new ExternalResource(source.getLogo()));
                if (isAdmin) {
                    sourceLogo.addClickListener(c -> {
                        sourceSelected.setValue(!sourceSelected.getValue());
                        profile.getSources().replace(source, sourceSelected.getValue());
                    });/*from  w  w w  .j ava 2  s.  c o  m*/
                }
                VerticalLayout layoutLogo = new VerticalLayout(sourceLogo);
                layoutLogo.setWidth("150px");
                layoutLogo.setHeight("50px");
                layoutLogo.setMargin(false);
                layoutLogo.setSpacing(false);
                layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT);

                Label labelHeadLine = new Label(
                        source.getCategory().getIcon().getHtml() + "  " + source.getName(), ContentMode.HTML);
                labelHeadLine.addStyleName(ValoTheme.LABEL_H3);

                Label labelDescription = new Label(source.getDescription(), ContentMode.HTML);
                labelDescription.setWidth("300px");
                PopupView popup = new PopupView(null, labelDescription);

                Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O);
                buttonDescription.addClickListener(ce -> {
                    popup.setPopupVisible(true);
                });

                sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription);
                sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER);
                sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER);
                sourceLayout.setColumnExpandRatio(2, 5);
                sourceLayout.setSpacing(true);

                sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "")
                        .replaceAll("_", ""), sourceLayout);
                sourcesLayout.addComponent(sourceLayout);
            });

    sourcesPanel.setContent(sourcesLayout);
    sourcesPanel.setHeight("100%");
    sourcesPanel.setCaption(Language.get(Word.SOURCES));
    Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s));
    windowLayout.addComponent(sourcesPanel);
    windowLayout.setExpandRatio(sourcesPanel, 1);
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);

    CheckBox checkBoxSelectAll = new CheckBox();
    Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s));
    checkBoxSelectAll.setWidth("100%");
    checkBoxSelectAll.addValueChangeListener(e -> {
        profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue());
        checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue()));
    });
    checkBoxSelectAll.setEnabled(isAdmin);

    TextField textFieldSearch = new TextField();
    Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s));
    textFieldSearch.setWidth("100%");
    textFieldSearch.setMaxLength(255);
    textFieldSearch.setPlaceholder(Language.get(Word.SEARCH));
    textFieldSearch.addValueChangeListener(searchValue -> {
        sourceLayouts.forEach((sourceName, sourceLayout) -> {
            if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "")
                    .replaceAll("-", "").replaceAll("_", ""))) {
                sourcesLayout.removeComponent(sourceLayout);
            } else {
                sourcesLayout.addComponent(sourceLayout);
            }
        });
    });

    Label placeholder = new Label();
    placeholder.setWidth("100%");

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setMargin(new MarginInfo(true, false, false, false));
    footer.addStyleName("menubar");
    footer.setWidth("100%");
    footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder);
    footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT);
    footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(footer);
    windowLayout.setHeight("350px");
    return windowLayout;
}

From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

public Component getCategories(GroupInterestProfile profile, boolean isAdmin) {
    Map<Category, Boolean> categories = profile.getCategories();
    VerticalLayout categoriesLayout = new VerticalLayout();
    categoriesLayout.setWidth("100%");
    Panel categoriesPanel = new Panel(categoriesLayout);

    categories.entrySet().stream().sorted((e1, e2) -> e1.getKey().getName().compareTo(e2.getKey().getName()))
            .forEach(e -> {/*www.  ja v  a  2  s.  c  o  m*/
                Category category = e.getKey();
                boolean enabled = e.getValue();
                GridLayout categoryLayout = new GridLayout(3, 1);
                categoryLayout.setWidth("100%");

                CheckBox categorySelected = new CheckBox();
                categorySelected.setValue(enabled);
                categorySelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                categorySelected.addValueChangeListener(v -> categories.replace(category, v.getValue()));
                categorySelected.setEnabled(isAdmin);

                Label categoryIcon = new Label(category.getIcon().getHtml(), ContentMode.HTML);
                categoryIcon.addStyleName(ValoTheme.LABEL_H3);
                categoryIcon.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                Label categoryName = new Label(category.getName(), ContentMode.HTML);
                Language.setCustom(null, s -> categoryName.setValue(category.getName()));
                categoryName.addStyleName(ValoTheme.LABEL_H3);
                categoryName.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                categoryLayout.addComponents(categorySelected, categoryIcon, categoryName);
                categoryLayout.setComponentAlignment(categorySelected, Alignment.MIDDLE_CENTER);
                categoryLayout.setComponentAlignment(categoryIcon, Alignment.MIDDLE_LEFT);
                categoryLayout.setComponentAlignment(categoryName, Alignment.MIDDLE_LEFT);
                categoryLayout.setColumnExpandRatio(2, 5);
                categoryLayout.setSpacing(true);

                categoriesLayout.addComponent(categoryLayout);
            });

    categoriesPanel.setContent(categoriesLayout);
    categoriesPanel.setHeight("100%");
    categoriesPanel.setCaption(Language.get(Word.CATEGORIES));
    Language.setCustom(Word.CATEGORIES, s -> categoriesPanel.setCaption(s));

    return categoriesPanel;
}