Example usage for com.vaadin.ui GridLayout addComponent

List of usage examples for com.vaadin.ui GridLayout addComponent

Introduction

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

Prototype

@Override
public void addComponent(Component component) 

Source Link

Document

Adds the component into this container to the cursor position.

Usage

From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleTab.java

License:Open Source License

private void init() {

    setMargin(true);/*  w ww .j  av  a 2 s.  c  om*/
    setSpacing(true);

    // ----------------------------------------------------
    // Title
    // ----------------------------------------------------

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setMargin(true);

    Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(),
            getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion()));
    title.addStyleName("h1");
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    addComponent(header);

    // ----------------------------------------------------
    // Action(s) Bar
    // ----------------------------------------------------

    HorizontalLayout actions = new HorizontalLayout();
    if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) {
        Button changeState = new Button();
        changeState.addClickListener(new StartBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Start");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png"));
        actions.addComponent(changeState);
    }
    if (BundleHelper.isState(bundle, Bundle.ACTIVE)) {
        Button changeState = new Button();
        changeState.addClickListener(new StopBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Stop");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png"));
        actions.addComponent(changeState);
    }

    // Update
    Button update = new Button();
    update.addClickListener(new UpdateBundleClickListener(bundle, notifierService));
    //update.addStyleName("no-padding");
    update.setCaption("Update");
    update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png"));
    actions.addComponent(update);

    // Trash
    Button trash = new Button();
    trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService));
    //trash.addStyleName("no-padding");
    trash.setCaption("Remove");
    trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png"));
    actions.addComponent(trash);
    addComponent(actions);
    setComponentAlignment(actions, Alignment.MIDDLE_RIGHT);

    // ----------------------------------------------------
    // Standard Section
    // ----------------------------------------------------

    Table table = new Table();
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setWidth("100%");

    Section mainSection = new Section("Standard", table);
    addComponent(mainSection);

    table.addContainerProperty("label", Label.class, null);
    table.addContainerProperty("value", Label.class, null);

    table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) },
            "bundle.id");
    for (Map.Entry<String, String> entry : HEADERS.entrySet()) {
        String value = getHeader(bundle, entry.getKey());
        if (value != null) {
            table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey());
        }
    }
    table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location");
    Date date = new Date(bundle.getLastModified());
    table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified");

    // ----------------------------------------------------
    // Packages Section
    // ----------------------------------------------------

    FilteredPackageTable exported = new FilteredPackageTable("Exported");

    FilteredPackageTable imported = new FilteredPackageTable("Imported");

    GridLayout packages = new GridLayout(2, 1);
    packages.addComponent(exported);
    packages.addComponent(imported);
    packages.setSpacing(true);
    packages.setWidth("100%");

    Section packagesSection = new Section("Packages", packages);
    addComponent(packagesSection);

    BundleWiring wiring = bundle.adapt(BundleWiring.class);
    if (wiring != null) {
        for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) {
            String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE);
            Version version = (Version) capability.getAttributes()
                    .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE);
            exported.addPackage(format("%s (%s)", name, version));
        }
        for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) {
            String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE);
            imported.addPackage(filter);
        }
    }

    // ----------------------------------------------------
    // Services Section
    // ----------------------------------------------------

    FilteredServiceTable registered = new FilteredServiceTable("Registered");

    FilteredServiceTable used = new FilteredServiceTable("Used Services");

    VerticalLayout services = new VerticalLayout(registered, used);
    services.setSpacing(true);
    services.setWidth("100%");

    ServiceReference<?>[] registeredServices = bundle.getRegisteredServices();
    if (registeredServices != null) {
        for (ServiceReference<?> reference : registeredServices) {
            registered.addService(reference);
        }
    }

    ServiceReference<?>[] inUseServices = bundle.getServicesInUse();
    if (inUseServices != null) {
        for (ServiceReference<?> reference : inUseServices) {
            used.addService(reference);
        }
    }

    if (!registered.isEmpty() || !used.isEmpty()) {
        Section servicesSection = new Section("Services", services);
        addComponent(servicesSection);
    }

    // ----------------------------------------------------
    // Raw Manifest Section
    // ----------------------------------------------------

    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".monospaced-font {font-family: monospace !important; }");

    Table manifest = new Table();
    manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    manifest.setWidth("100%");
    manifest.addStyleName("monospaced-font");
    manifest.setPageLength(15);
    manifest.addContainerProperty("name", String.class, null);
    manifest.addContainerProperty("value", String.class, null);

    Dictionary<String, String> headers = bundle.getHeaders();
    for (String key : Collections.list(headers.keys())) {
        manifest.addItem(new Object[] { key, headers.get(key) }, null);
    }

    Section manifestSection = new Section("Manifest", manifest);
    addComponent(manifestSection);

}

From source file:com.peergreen.webconsole.scope.system.internal.service.ServiceReferenceItem.java

License:Open Source License

public Component getInterfaces() {
    if (!opened) {
        return new Label(searchInterfaces());
    } else {/*from ww w .j  a  v  a  2 s  . c  o  m*/
        GridLayout layout = new GridLayout(3, 1);

        for (String name : reference.getPropertyKeys()) {
            layout.addComponent(new Label(format("<b>%s</b>", name), ContentMode.HTML));
            layout.addComponent(new Label("&nbsp;", ContentMode.HTML));
            layout.addComponent(
                    new Label(convert(reference.getProperty(name)).toString(), ContentMode.PREFORMATTED));
            layout.newLine();
        }

        return layout;
    }
}

From source file:com.scipionyx.butterflyeffect.frontend.configuration.ui.view.AboutView.java

License:Apache License

/**
 * //from   ww w. ja  v  a2  s.  co  m
 * @param instancesBackend
 * @param justclean
 */
private void loadClusterInformation(List<ServiceInstance> instancesBackend, GridLayout layout,
        boolean justclean) {

    layout.removeAllComponents();

    int i = 0;
    for (ServiceInstance instance : instancesBackend) {

        Grid<GridProperty<?>> tableCluster = new Grid<>("Node [" + i + "]");
        tableCluster.addStyleName(ValoTheme.TABLE_COMPACT);
        tableCluster.setSizeFull();

        tableCluster.addColumn(GridProperty::getName).setCaption("Property");
        tableCluster.addColumn(GridProperty::getValue).setCaption("Value");

        List<GridProperty<?>> list = new ArrayList<>();
        list.add(new GridProperty<>("Host", instance.getHost()));
        list.add(new GridProperty<>("Service Id", instance.getServiceId()));
        list.add(new GridProperty<>("Port", instance.getPort()));
        list.add(new GridProperty<>("Uri", instance.getUri()));

        for (String key : instance.getMetadata().keySet()) {
            list.add(new GridProperty<>("Metadata[" + key + "]", instance.getMetadata().get(key)));
        }

        tableCluster.setItems(list);

        layout.addComponent(tableCluster);

        i++;

    }

}

From source file:com.tripoin.util.ui.calendar.CalendarActionsUI.java

License:Apache License

@SuppressWarnings("deprecation")
@Override// w w  w . j  a  v a2  s.  co  m
protected void init(VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();
    setContent(content);

    final Calendar calendar = new Calendar();
    calendar.setLocale(new Locale("fi", "FI"));

    calendar.setSizeFull();
    calendar.setStartDate(new Date(100, 1, 1));
    calendar.setEndDate(new Date(100, 2, 1));

    calendar.addActionHandler(new Action.Handler() {

        /**
        * 
        */
        private static final long serialVersionUID = -9176166330213062162L;
        public final Action NEW_EVENT = new Action("Add event");
        @SuppressWarnings("unused")
        public final Action EDIT_EVENT = new Action("Edit event");
        public final Action REMOVE_EVENT = new Action("Remove event");

        /*
         * (non-Javadoc)
         * 
         * @see
         * com.vaadin.event.Action.Handler#handleAction(com.vaadin.event
         * .Action, java.lang.Object, java.lang.Object)
         */
        @Override
        public void handleAction(Action action, Object sender, Object target) {
            Date date = (Date) target;
            if (action == NEW_EVENT) {
                BasicEvent event = new BasicEvent("New event", "Hello world", date, date);
                calendar.addEvent(event);
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @see com.vaadin.event.Action.Handler#getActions(java.lang.Object,
         * java.lang.Object)
         */
        @Override
        public Action[] getActions(Object target, Object sender) {
            CalendarDateRange date = (CalendarDateRange) target;

            java.util.Calendar cal = java.util.Calendar.getInstance();
            cal.set(2000, 1, 1, 12, 0, 0);

            if (date.inRange(cal.getTime())) {
                return new Action[] { NEW_EVENT, };
            }

            cal.add(java.util.Calendar.DAY_OF_WEEK, 1);

            if (date.inRange(cal.getTime())) {
                return new Action[] { REMOVE_EVENT };
            }

            return null;
        }
    });

    content.addComponent(calendar);

    content.addComponent(new Button("Set week view", new Button.ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = -9193155583440680362L;

        @Override
        public void buttonClick(ClickEvent event) {
            calendar.setEndDate(new Date(100, 1, 7));
        }
    }));

    content.setRowExpandRatio(0, 1);

}

From source file:com.tripoin.util.ui.calendar.HiddenFwdBackButtons.java

License:Apache License

@SuppressWarnings("deprecation")
@Override/* w ww  . java  2  s . co m*/
protected void init(VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();
    setContent(content);

    final Calendar calendar = new Calendar();
    calendar.setLocale(new Locale("fi", "FI"));

    calendar.setSizeFull();
    calendar.setStartDate(new Date(100, 1, 1));
    calendar.setEndDate(new Date(100, 1, 7));
    content.addComponent(calendar);
    Button button = new Button("Hide forward and back buttons");
    button.addClickListener(new ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = 7195717021662140155L;

        @Override
        public void buttonClick(ClickEvent event) {
            // This should hide the forward and back navigation buttons
            calendar.setHandler((BackwardHandler) null);
            calendar.setHandler((ForwardHandler) null);
        }
    });
    content.addComponent(button);

    content.setRowExpandRatio(0, 1);

}

From source file:com.tripoin.util.ui.calendar.NotificationTestUI.java

License:Apache License

@Override
protected void init(com.vaadin.server.VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();//  w  ww .  j  av  a 2 s .c  om
    content.setRowExpandRatio(1, 1.0f);
    setContent(content);
    final Button btn = new Button("Show working notification", new Button.ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = -165570248584063787L;

        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("This will disappear when you move your mouse!");
        }
    });
    content.addComponent(btn);

    provider = new DummyEventProvider();
    final Calendar cal = new Calendar(provider);
    cal.setLocale(Locale.US);
    cal.setSizeFull();
    cal.setHandler(new DateClickHandler() {
        /**
        * 
        */
        private static final long serialVersionUID = 1903111449161995776L;

        @Override
        public void dateClick(DateClickEvent event) {
            provider.addEvent(event.getDate());
            Notification.show("This should disappear, but if wont unless clicked.");

            // this requestRepaint call interferes with the notification
            cal.markAsDirty();
        }
    });
    content.addComponent(cal);

    java.util.Calendar javaCal = java.util.Calendar.getInstance();
    javaCal.set(java.util.Calendar.YEAR, 2000);
    javaCal.set(java.util.Calendar.MONTH, 0);
    javaCal.set(java.util.Calendar.DAY_OF_MONTH, 1);
    Date start = javaCal.getTime();
    javaCal.set(java.util.Calendar.DAY_OF_MONTH, 31);
    Date end = javaCal.getTime();

    cal.setStartDate(start);
    cal.setEndDate(end);
}

From source file:de.catma.ui.tagger.TagInstanceTree.java

License:Open Source License

private void initComponents() {
    tagInstanceTree = new TreeTable();
    tagInstanceTree.setImmediate(true);/*from ww w.  ja  v  a 2 s.c  o  m*/
    tagInstanceTree.setSizeFull();
    tagInstanceTree.setSelectable(true);
    tagInstanceTree.setMultiSelect(true);
    tagInstanceTree.setColumnReorderingAllowed(true);
    tagInstanceTree.setColumnCollapsingAllowed(true);

    tagInstanceTree.setContainerDataSource(new HierarchicalContainer());
    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.caption, String.class, null);
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.caption, "Tag Instance");

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.icon, Resource.class, null);

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.path, String.class, null);

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.instanceId, String.class, null);

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.umc, String.class, null);

    tagInstanceTree.setItemCaptionPropertyId(TagInstanceTreePropertyName.caption);
    tagInstanceTree.setItemIconPropertyId(TagInstanceTreePropertyName.icon);

    tagInstanceTree.addGeneratedColumn(TagInstanceTreePropertyName.color,
            new ColorLabelColumnGenerator(new ColorLabelColumnGenerator.TagInstanceTagDefinitionProvider()));

    tagInstanceTree.setVisibleColumns(new Object[] { TagInstanceTreePropertyName.caption,
            TagInstanceTreePropertyName.color, TagInstanceTreePropertyName.path,
            TagInstanceTreePropertyName.instanceId, TagInstanceTreePropertyName.umc });
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.color, "Tag Color");
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.path, "Tag Path");
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.instanceId, "Tag Instance ID");
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.umc, "User Markup Collection");
    addComponent(tagInstanceTree);
    setExpandRatio(tagInstanceTree, 1.0f);

    GridLayout buttonGrid = new GridLayout(1, 2);
    buttonGrid.setMargin(false, true, true, true);
    buttonGrid.setSpacing(true);

    btRemoveTagInstance = new Button("Remove Tag Instance");
    buttonGrid.addComponent(btRemoveTagInstance);

    btEditPropertyValues = new Button("Edit Property values");
    buttonGrid.addComponent(btEditPropertyValues);

    addComponent(buttonGrid);
}

From source file:de.catma.ui.tagmanager.TagsetTree.java

License:Open Source License

private void initComponents() {
    setSizeFull();//  ww w.  j a  va  2 s  .  co  m

    tagTree = new EndorsedTreeTable();
    tagTree.setImmediate(true);
    tagTree.setSizeFull();
    tagTree.setSelectable(true);
    tagTree.setMultiSelect(false);

    tagTree.setContainerDataSource(new HierarchicalContainer());

    tagTree.addContainerProperty(TagTreePropertyName.caption, String.class, null);
    tagTree.setColumnHeader(TagTreePropertyName.caption, "Tagsets");

    tagTree.addContainerProperty(TagTreePropertyName.icon, Resource.class, null);

    tagTree.setItemCaptionPropertyId(TagTreePropertyName.caption);
    tagTree.setItemIconPropertyId(TagTreePropertyName.icon);
    tagTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);

    tagTree.setVisibleColumns(new Object[] { TagTreePropertyName.caption });

    if (colorButtonListener != null) {
        tagTree.addGeneratedColumn(TagTreePropertyName.color,
                new ColorButtonColumnGenerator(colorButtonListener));
        tagTree.setColumnReorderingAllowed(true);
    } else {
        tagTree.addGeneratedColumn(TagTreePropertyName.color, new ColorLabelColumnGenerator());
    }
    tagTree.setColumnHeader(TagTreePropertyName.color, "Tag Color");
    addComponent(tagTree);
    setExpandRatio(tagTree, 2);

    GridLayout buttonGrid = new GridLayout(1, 19);
    buttonGrid.setMargin(true);
    buttonGrid.setSpacing(true);

    buttonGrid.addStyleName("taglibrary-action-grid");
    int buttonGridRowCount = 0;

    if (withTagsetButtons) {
        btReload = new Button("");
        btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication()));
        btReload.addStyleName("icon-button");
        buttonGrid.addComponent(btReload);
        buttonGrid.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);
        buttonGridRowCount++;

        Label tagsetLabel = new Label();
        tagsetLabel.setIcon(new ClassResource("ui/tagmanager/resources/grndiamd.gif", application));
        tagsetLabel.setCaption("Tagset");

        buttonGrid.addComponent(tagsetLabel);
        buttonGridRowCount++;

        btInsertTagset = new Button("Create Tagset");
        btInsertTagset.setEnabled(true);
        btInsertTagset.setWidth("100%");
        buttonGrid.addComponent(btInsertTagset);
        buttonGridRowCount++;

        btRemoveTagset = new Button("Remove Tagset");
        btRemoveTagset.setWidth("100%");
        buttonGrid.addComponent(btRemoveTagset);
        buttonGridRowCount++;

        btEditTagset = new Button("Edit Tagset");
        btEditTagset.setWidth("100%");
        buttonGrid.addComponent(btEditTagset);
        buttonGridRowCount++;
    }

    Label tagLabel = new Label();
    tagLabel.setIcon(new ClassResource("ui/tagmanager/resources/reddiamd.gif", application));
    tagLabel.setCaption("Tag");

    buttonGrid.addComponent(tagLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(tagLabel, Alignment.BOTTOM_LEFT);

    btInsertTag = new Button("Create Tag");
    btInsertTag.setWidth("100%");
    if (withTagsetButtons) {
        btInsertTag.setEnabled(true);
    }
    buttonGrid.addComponent(btInsertTag);
    buttonGridRowCount++;

    btRemoveTag = new Button("Remove Tag");
    btRemoveTag.setWidth("100%");
    buttonGrid.addComponent(btRemoveTag);
    buttonGridRowCount++;

    btEditTag = new Button("Edit Tag");
    btEditTag.setWidth("100%");
    buttonGrid.addComponent(btEditTag);
    buttonGridRowCount++;

    Label propertyLabel = new Label();
    propertyLabel.setIcon(new ClassResource("ui/tagmanager/resources/ylwdiamd.gif", application));
    propertyLabel.setCaption("Property");

    buttonGrid.addComponent(propertyLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(propertyLabel, Alignment.BOTTOM_LEFT);

    btInsertProperty = new Button("Create Property");
    btInsertProperty.setWidth("100%");
    buttonGrid.addComponent(btInsertProperty);
    buttonGridRowCount++;

    btRemoveProperty = new Button("Remove Property");
    // commented out on purpose: somehow this forces all the other buttons to 
    // show up in natural size...
    //      btRemoveProperty.setWidth("100%");
    buttonGrid.addComponent(btRemoveProperty);
    buttonGridRowCount++;

    btEditProperty = new Button("Edit Property");
    btEditProperty.setWidth("100%");
    buttonGrid.addComponent(btEditProperty);
    buttonGridRowCount++;

    addComponent(buttonGrid);
    setExpandRatio(buttonGrid, 0);

    if (!withButtonPanel) {
        buttonGrid.setVisible(false);
    }

}

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

private Component generateLine(Path file, GridLayout layout) {
    Label fileName = new Label(file.getFileName().toString());
    layout.addComponent(fileName);
    layout.setComponentAlignment(fileName, Alignment.MIDDLE_LEFT);

    Button downloadButton = new Button();
    downloadButton.setIcon(VaadinIcons.DOWNLOAD);
    FileDownloader downloader = new FileDownloader(new FileResource(file.toFile()));
    downloader.extend(downloadButton);/*from   ww  w . j  a va  2s  .  co m*/
    layout.addComponent(downloadButton);
    layout.setComponentAlignment(downloadButton, Alignment.MIDDLE_CENTER);

    if (file.getFileName().toString().endsWith("pdf")) {
        Button viewButton = new Button();
        viewButton.setIcon(VaadinIcons.EYE);
        viewButton.addClickListener(ce -> UI.getCurrent().addWindow(PDFWindow.get(file)));
        layout.addComponent(viewButton);
        layout.setComponentAlignment(viewButton, Alignment.MIDDLE_CENTER);
    } else {
        layout.addComponent(new Label(" "));
    }

    return layout;
}

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

public VerticalLayout createTab(Group g) {
    User u = UserUtils.getCurrent();/*  w w  w.jav  a2  s.com*/
    VerticalLayout groupSettingsLayout = new VerticalLayout();
    groupSettingsLayouts.put(g, groupSettingsLayout);
    GridLayout tabContent;
    TextField textFieldName = new TextField();
    if (GroupUtils.isAdmin(g, u)) {
        tabContent = new GridLayout(3, 2);
        Language.set(Word.NAME, textFieldName);
        textFieldName.setWidth("100%");
        textFieldName.setValue(g.getName());
        textFieldName.setMaxLength(255);
        tabContent.addComponent(textFieldName);
        tabContent.setComponentAlignment(textFieldName, Alignment.MIDDLE_LEFT);
    } else {
        tabContent = new GridLayout(3, 1);
    }

    buttonLeave = new Button();
    Language.set(Word.LEAVE, buttonLeave);
    buttonLeave.setIcon(VaadinIcons.MINUS);
    buttonLeave.addStyleName(ValoTheme.BUTTON_DANGER);
    buttonLeave.addClickListener(ce -> {
        ConfirmationDialog.show(Language.get(Word.REALLY_LEAVE_GROUP).replace("[GROUP]", g.getName()), () -> {
            long amountAdmins = g.getUsers().entrySet().stream().filter(e -> e.getValue()).count();
            if (amountAdmins > 1 || !GroupUtils.isAdmin(g, u)) {
                GroupUtils.removeUser(g, u);
                refreshAll(g);
            } else {
                VaadinUtils.errorNotification(Language.get(Word.NOT_ENOUGH_ADMINS_IN_GROUP));
            }
        });
    });

    buttonDelete = new Button();
    Language.set(Word.DELETE, buttonDelete);
    buttonDelete.setIcon(VaadinIcons.TRASH);
    buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER);
    buttonDelete.addClickListener(ce -> {
        ConfirmationDialog.show(Language.get(Word.REALLY_DELETE_GROUP).replace("[GROUP]", g.getName()), () -> {
            GroupUtils.removeGroup(g);
            refreshAll(g);
        });
    });

    Button buttonSave = new Button();
    Language.set(Word.SAVE, buttonSave);
    buttonSave.setIcon(VaadinIcons.CHECK);
    buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonSave.addClickListener(ce -> {
        if (GroupUtils.isAdmin(g, u)) {
            GroupUtils.changeName(g, textFieldName.getValue());
            accordion.getTab(groupSettingsLayout).setCaption(textFieldName.getValue());
        }
        VaadinUtils.infoNotification(Language.get(Word.SUCCESSFULLY_SAVED));
    });
    buttonSave.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);

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

    GridLayout footer = new GridLayout(4, 1);
    footer.setSpacing(true);
    footer.setMargin(new MarginInfo(false, true));
    footer.setSizeUndefined();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth("100%");
    footer.addStyleName("menubar");
    if (GroupUtils.isAdmin(g, u)) {
        footer.addComponents(placeholder, buttonDelete, buttonLeave, buttonSave);
        footer.setComponentAlignment(buttonDelete, Alignment.MIDDLE_CENTER);
    } else {
        footer.addComponents(placeholder, placeholder3, buttonLeave, buttonSave);
    }
    footer.setColumnExpandRatio(0, 5);
    footer.setComponentAlignment(buttonLeave, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(buttonSave, Alignment.MIDDLE_CENTER);

    if (GroupUtils.isAdmin(g, u)) {
        tabContent.addComponent(getProfiles(g), 0, 1, 1, 1);
        tabContent.addComponent(getMembers(g), 2, 1);
    } else {
        tabContent.addComponent(getProfiles(g), 0, 0, 1, 0);
        tabContent.addComponent(getMembers(g), 2, 0);
    }
    tabContent.setWidth("100%");
    tabContent.setSpacing(true);
    tabContent.setMargin(true);
    tabContent.addStyleName("profiles");
    groupSettingsLayout.addComponents(tabContent, footer);
    groupSettingsLayout.setMargin(false);
    groupSettingsLayout.setSpacing(false);
    groupSettingsLayout.setWidth("100%");
    return groupSettingsLayout;
}