Example usage for com.vaadin.ui CssLayout CssLayout

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

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultRowEditingFormView.java

License:Apache License

private void buildViewComponents(boolean addSwitchModeButton) {
    fieldLayout = new FormLayout();
    addComponent(fieldLayout);//from  www  .  ja v a 2 s .c o m

    errorLabel = new Label();
    errorLabel.setStyleName("error");
    errorLabel.setVisible(false);
    addComponent(errorLabel);

    footerLayout = new CssLayout();
    footerLayout.setStyleName("actions");
    addComponent(footerLayout);

    if (addSwitchModeButton) {
        switchModeButton = new Button(getMessage("portlet.crud.button.editMode"));
        switchModeButton.addClickListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                presenter.changeMode();
            }
        });
        footerLayout.addComponent(switchModeButton);
    }

    saveButton = new Button(getMessage("portlet.crud.button.save"));
    saveButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.save();
        }
    });

    resetButton = new Button(getMessage("portlet.crud.button.reset"));
    resetButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.resetFields();
        }
    });

    deleteButton = new Button(getMessage("portlet.crud.button.remove"));
    deleteButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.delete();
        }
    });

    previousRowButton = new Button(getMessage("portlet.crud.button.previousRow"));
    previousRowButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.previousRow();
        }
    });

    nextRowButton = new Button(getMessage("portlet.crud.button.nextRow"));
    nextRowButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.nextRow();
        }
    });

    Button cancelButton = new Button(getMessage("portlet.crud.button.cancel"));
    cancelButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.cancel();
        }
    });
    footerLayout.addComponents(saveButton, saveButton, deleteButton, previousRowButton, nextRowButton,
            cancelButton);
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultTableView.java

License:Apache License

private Layout initButtonBar() {
    CssLayout buttonbar = new CssLayout();
    buttonbar.setStyleName("actions");

    if (tableModel.isEditable()) {
        if (tableModel.isModeChangeable()) {
            editButton = new Button(getMessage("portlet.crud.button.editMode"));
            editButton.setEnabled(true);
            buttonbar.addComponent(editButton);
        } else if (!tableModel.isFormEditEnabled()) {
            saveButton = new Button(getMessage("portlet.crud.button.save"));
            saveButton.setVisible(false);
            saveButton.setEnabled(true);
            buttonbar.addComponent(saveButton);
        }//ww  w .  j  a v a  2  s .c  om

        revertButton = new Button(getMessage("portlet.crud.button.reset"));
        revertButton.setVisible(false);
        revertButton.setEnabled(true);
        buttonbar.addComponent(revertButton);

        insertButton = new Button(getMessage("portlet.crud.button.blankRow"));
        insertButton.setVisible(false);
        insertButton.setEnabled(presenter.isInsertable());
        buttonbar.addComponent(insertButton);

        removeButton = new Button(getMessage("portlet.crud.button.removeRow"));
        removeButton.setVisible(false);
        removeButton.setEnabled(presenter.isDeleteable());
        buttonbar.addComponent(removeButton);
    }
    if (presenter.isExcelExport()) {
        excelExportButton = new Button("Excel");
        buttonbar.addComponent(excelExportButton);
    }

    if (presenter.isCSVExport()) {
        csvExportButton = new Button("CSV");
        buttonbar.addComponent(csvExportButton);
    }

    for (TableAction action : tableModel.getActions()) {
        Button actionButton = new Button(action.getTitle());
        if (action.getId() != null) {
            actionButtons.put(action.getId(), actionButton);
        } else {
            actionButtons.put("table-action-" + tableActionDummyIdCounter++, actionButton);
        }
        buttonToTableActionMap.put(actionButton, action);
        buttonbar.addComponent(actionButton);
    }

    return buttonbar;
}

From source file:de.uni_leipzig.informatik.pcai042.boa.gui.goldstandard.GoldstandardGUI.java

License:Open Source License

/**
 * The constructor should first build the main layout, set the composition
 * root and then do any custom initialization.
 * /*  w ww.j  a  va  2s . c om*/
 * The constructor will not be automatically regenerated by the visual
 * editor.
 */
public GoldstandardGUI() {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // user code

    for (Type t : BoaAnnotation.Type.values()) {
        comboBoxTypes.addItem(t);
    }
    comboBoxTypes.setTextInputAllowed(false);
    listSelectAnnotations.setMultiSelect(false);
    comboBoxTypes.setNullSelectionAllowed(false);
    listSelectAnnotations.setNullSelectionAllowed(false);

    // with this layout components will get wrapped
    cssLayoutTokens = new CssLayout() {
        @Override
        protected String getCss(Component c) {
            return "float:left;margin-right:5px;";
        }
    };
    cssLayoutTokens.setWidth("100%");
    // auto; becomes vertical scroll-able since verticalLayout_tokens height
    // is also auto
    cssLayoutTokens.setHeight(SIZE_UNDEFINED, 0);
    verticalLayoutTokens.addComponent(cssLayoutTokens);

    resetComponents();

    buttonNext.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (sentence != null) {
                SentenceServer.returnSentence(sentence);
            }

            resetComponents();
            sentence = SentenceServer.getSentence();

            if (sentence == null) {
                getWindow().showNotification("No more senentences.", Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            // create new check boxes for tokens
            CheckBox checkbox;
            Label label;
            VerticalLayout vertLayout;
            for (int i = 0; i < sentence.getTokens().size(); i++) {
                checkbox = new CheckBox();
                checkbox.setImmediate(true);
                checkbox.addListener(new Property.ValueChangeListener() {
                    public void valueChange(ValueChangeEvent event) {
                        Iterator<Component> iterator = cssLayoutTokens.getComponentIterator();
                        Label l;
                        CheckBox cb;
                        VerticalLayout vl;
                        String s = "";
                        while (iterator.hasNext()) {
                            vl = (VerticalLayout) iterator.next();
                            l = (Label) vl.getComponent(0);
                            cb = (CheckBox) vl.getComponent(1);
                            if (cb.booleanValue()) {
                                s += l.getValue();
                            }
                        }
                        if (s.isEmpty())
                            s = "";
                        textFieldLabel.setReadOnly(false);
                        textFieldLabel.setValue(s);
                        textFieldLabel.setReadOnly(true);
                    }
                });
                label = new Label(sentence.getTokens().get(i));
                label.setSizeUndefined();
                vertLayout = new VerticalLayout();
                vertLayout.addComponent(label);
                vertLayout.addComponent(checkbox);
                vertLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
                vertLayout.setComponentAlignment(checkbox, Alignment.MIDDLE_CENTER);
                vertLayout.setSizeUndefined();
                cssLayoutTokens.addComponent(vertLayout);
            }
        }
    });

    buttonDiscard.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (sentence != null) {
                SentenceServer.discardSentence(sentence);
                resetComponents();
            }
        }
    });

    buttonAddAnno.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (!textFieldLabel.getValue().equals("") && comboBoxTypes.getValue() != null) {
                Iterator<Component> iterator = cssLayoutTokens.getComponentIterator();
                Label l;
                CheckBox cb;
                VerticalLayout vl;
                ArrayList<String> selected = new ArrayList<String>();
                while (iterator.hasNext()) {
                    vl = (VerticalLayout) iterator.next();
                    l = (Label) vl.getComponent(0);
                    cb = (CheckBox) vl.getComponent(1);
                    if (cb.booleanValue()) {
                        selected.add((String) l.getValue());
                        cb.setValue(false);
                    }
                }
                BoaAnnotation anno = new BoaAnnotation((Type) comboBoxTypes.getValue(), selected);
                boolean isDuplicate = false;
                boolean isColliding = false;
                for (BoaAnnotation a : sentence.getAnnotations()) {
                    if (a.getTokens().size() == anno.getTokens().size()) {
                        boolean sameTokens = true;
                        for (int i = 0; i < a.getTokens().size(); i++) {
                            sameTokens = a.getTokens().get(i) == anno.getTokens().get(i);
                            if (!sameTokens)
                                break;
                        }
                        if (sameTokens) {
                            isColliding = !(isDuplicate = a.getType().equals(anno.getType()));
                            break;
                        }
                    }
                }
                if (isDuplicate) {
                    getWindow().showNotification("Duplicate was dismissed.", Notification.TYPE_WARNING_MESSAGE);
                } else if (isColliding) {
                    getWindow().showNotification("Label is already assigned to<br/> a different type.",
                            Notification.TYPE_ERROR_MESSAGE);
                } else {
                    sentence.getAnnotations().add(anno);
                    listSelectAnnotations.addItem(anno);
                }
            } else
                getWindow().showNotification("Label or type is inavlid.", Notification.TYPE_ERROR_MESSAGE);
        }
    });

    buttonDelAnno.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (listSelectAnnotations.getValue() != null) {
                sentence.getAnnotations().remove(listSelectAnnotations.getValue());
                listSelectAnnotations.removeItem(listSelectAnnotations.getValue());
            }
        }
    });
}

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

public GroupView() {
    User user = UserUtils.getCurrent();//  w w w .j  a  va  2  s  .c  om
    Set<Group> groups = UserUtils.getAllGroups(user);

    CssLayout newGroupGroup = new CssLayout();
    newGroupGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    TextField textFieldNewGroupName = new TextField();
    Language.setCustom(Word.GROUP_NAME, s -> textFieldNewGroupName.setPlaceholder(s));
    textFieldNewGroupName.setWidth("260px");
    textFieldNewGroupName.setMaxLength(255);
    newGroupGroup.addComponent(textFieldNewGroupName);

    Button buttonNewGroup = new Button();
    buttonNewGroup.setIcon(VaadinIcons.PLUS);
    buttonNewGroup.addStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonNewGroup.addClickListener(e -> {
        TabSheet.Tab newTab = accordion.addTab(createTab(createEmptyGroup(textFieldNewGroupName.getValue())),
                textFieldNewGroupName.getValue());
        accordion.setSelectedTab(newTab);
        accordion.setWidth("100%");
        textFieldNewGroupName.clear();
    });
    newGroupGroup.addComponent(buttonNewGroup);
    textFieldNewGroupName
            .addFocusListener(f -> buttonNewGroup.setClickShortcut(ShortcutAction.KeyCode.ENTER, null));
    textFieldNewGroupName.addBlurListener(f -> buttonNewGroup.removeClickShortcut());

    groups.forEach(g -> {
        accordion.addTab(createTab(g), g.getName());
    });
    addComponents(newGroupGroup, accordion);
    //SESSIONS.put(user, this);
}

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  ww  w .j  a  va2s  .  c o m*/

    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);// w  w  w  .  j  a va 2  s .  c o  m
    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 InterestProfileView() {
    User user = UserUtils.getCurrent();/*from ww w.ja v  a 2s.c  o m*/
    Set<InterestProfile> profiles = UserUtils.getAllInterestProfiles(user);

    CssLayout newProfileGroup = new CssLayout();
    newProfileGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    TextField textFieldNewProfileName = new TextField();
    Language.setCustom(Word.PROFILE_NAME, s -> textFieldNewProfileName.setPlaceholder(s));
    textFieldNewProfileName.setWidth("260px");
    textFieldNewProfileName.setMaxLength(255);
    newProfileGroup.addComponent(textFieldNewProfileName);

    Button buttonNewProfile = new Button();
    buttonNewProfile.setIcon(VaadinIcons.PLUS);
    buttonNewProfile.addStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonNewProfile.addClickListener(e -> {
        Tab newTab = accordion.addTab(createTab(createEmptyProfile(textFieldNewProfileName.getValue())),
                textFieldNewProfileName.getValue());
        accordion.setSelectedTab(newTab);
        accordion.setWidth("100%");
        textFieldNewProfileName.clear();
    });
    newProfileGroup.addComponent(buttonNewProfile);
    textFieldNewProfileName
            .addFocusListener(f -> buttonNewProfile.setClickShortcut(ShortcutAction.KeyCode.ENTER, null));
    textFieldNewProfileName.addBlurListener(f -> buttonNewProfile.removeClickShortcut());

    profiles.forEach((InterestProfile profile) -> {
        accordion.addTab(createTab(profile), profile.getName());
    });
    addComponents(newProfileGroup, accordion);
    SESSIONS.put(user, this);
}

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

private Component getAddTagGroup(InterestProfile profile, boolean included) {
    CssLayout newTagGroup = new CssLayout();
    newTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    TextField textFieldTag = new TextField();
    textFieldTag.setWidth("325px");
    textFieldTag.setMaxLength(255);/*w  w w .  jav a 2 s.c o m*/
    Language.setCustom(Word.NEW_TAG, s -> textFieldTag.setPlaceholder(s));

    Button buttonAddTag = new Button(VaadinIcons.PLUS);
    buttonAddTag.addStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
    buttonAddTag.addClickListener(event -> {
        addRow(profile, included, textFieldTag.getValue());
        profile.getTags().put(textFieldTag.getValue(), included);
        textFieldTag.clear();
    });
    textFieldTag.addFocusListener(f -> buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null));
    textFieldTag.addBlurListener(f -> buttonAddTag.removeClickShortcut());

    newTagGroup.addComponents(textFieldTag, buttonAddTag);
    newTagGroup.setWidth("100%");
    return newTagGroup;
}

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

private Component getAddTagGroup(GroupInterestProfile profile, boolean included) {
    CssLayout newTagGroup = new CssLayout();
    newTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    TextField textFieldTag = new TextField();
    textFieldTag.setWidth("325px");
    textFieldTag.setMaxLength(255);//from w  ww .  ja  va  2 s .com
    Language.setCustom(Word.NEW_TAG, s -> textFieldTag.setPlaceholder(s));

    Button buttonAddTag = new Button(VaadinIcons.PLUS);
    buttonAddTag.addStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
    buttonAddTag.addClickListener(event -> {
        addRow(profile, included, textFieldTag.getValue(), true);
        profile.getTags().put(textFieldTag.getValue(), included);
        textFieldTag.clear();
    });
    textFieldTag.addFocusListener(f -> buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null));
    textFieldTag.addBlurListener(f -> buttonAddTag.removeClickShortcut());

    newTagGroup.addComponents(textFieldTag, buttonAddTag);
    newTagGroup.setWidth("100%");
    return newTagGroup;
}

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

public Component getThirdStage(Source s) {
    Label header = new Label(Language.get(Word.CRAWLER));
    header.addStyleName(ValoTheme.LABEL_H1);

    Crawler crawler;/*from ww  w.  j  a v  a 2  s  .co m*/
    if (s.getCrawler() != null) {
        crawler = s.getCrawler();
    } else {
        crawler = new Crawler(s);
        s.setCrawler(crawler);
    }

    GridLayout mainGrid = new GridLayout(2, 2);
    mainGrid.setSizeFull();
    mainGrid.setSpacing(true);

    FormLayout layoutForms = new FormLayout();

    //Exclude or Include
    RadioButtonGroup<Boolean> radios = new RadioButtonGroup<>();
    radios.setItems(true, false);
    radios.setItemCaptionGenerator(b -> b ? Language.get(Word.INCLUDE_TAGS) : Language.get(Word.EXCLUDE_TAGS));
    radios.setItemIconGenerator(b -> b ? VaadinIcons.CHECK : VaadinIcons.CLOSE);
    radios.setSelectedItem(true);
    radios.addValueChangeListener(event -> include = event.getValue());

    //By Class
    CssLayout addByClassGroup = new CssLayout();
    addByClassGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByClass = new TextField();
    textFieldAddByClass.setWidth("465px");
    Button buttonAddByClass = new Button(VaadinIcons.PLUS);
    buttonAddByClass.addClickListener(e -> {
        crawler.addByClass(textFieldAddByClass.getValue(), include);
        refreshList(mainGrid, crawler);
        textFieldAddByClass.clear();
    });
    addByClassGroup.addComponents(textFieldAddByClass, buttonAddByClass);
    addByClassGroup.setCaption(Language.get(Word.BYCLASS));

    //ByTag
    CssLayout addByTagGroup = new CssLayout();
    addByTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByTag = new TextField();
    Button buttonAddByTag = new Button(VaadinIcons.PLUS);
    textFieldAddByTag.setWidth("465px");
    buttonAddByTag.addClickListener(e -> {
        crawler.addByTag(textFieldAddByTag.getValue(), include);
        refreshList(mainGrid, crawler);
        textFieldAddByTag.clear();
    });
    addByTagGroup.addComponents(textFieldAddByTag, buttonAddByTag);
    addByTagGroup.setCaption(Language.get(Word.BYTAG));

    //ByID
    CssLayout addByIDGroup = new CssLayout();
    addByIDGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByID = new TextField();
    textFieldAddByID.setWidth("465px");
    Button buttonAddByID = new Button(VaadinIcons.PLUS);
    buttonAddByID.addClickListener(e -> {
        crawler.addByID(textFieldAddByID.getValue(), include);
        refreshList(mainGrid, crawler);
        textFieldAddByID.clear();
    });
    addByIDGroup.addComponents(textFieldAddByID, buttonAddByID);
    addByIDGroup.setCaption(Language.get(Word.BYID));

    //ByAttribute
    CssLayout addByAttributeGroup = new CssLayout();
    addByAttributeGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByAttributeKey = new TextField();
    textFieldAddByAttributeKey.setWidth("233px");
    TextField textFieldAddByAttributeValue = new TextField();
    textFieldAddByAttributeValue.setWidth("232px");
    Button buttonAddByAttribute = new Button(VaadinIcons.PLUS);
    buttonAddByAttribute.addClickListener(e -> {
        crawler.addByAttribute(textFieldAddByAttributeKey.getValue(), textFieldAddByAttributeValue.getValue(),
                include);
        refreshList(mainGrid, crawler);
        textFieldAddByAttributeKey.clear();
        textFieldAddByAttributeValue.clear();
    });
    addByAttributeGroup.addComponents(textFieldAddByAttributeKey, textFieldAddByAttributeValue,
            buttonAddByAttribute);
    addByAttributeGroup.setCaption(Language.get(Word.BYATTRIBUTEVALUE));

    layoutForms.addComponents(radios, addByClassGroup, addByTagGroup, addByIDGroup, addByAttributeGroup);
    mainGrid.addComponent(layoutForms);

    Label labelResult = new Label();
    Panel panelResult = new Panel(labelResult);
    labelResult.setWidth("100%");
    panelResult.setWidth("100%");
    panelResult.setHeight("175px");
    mainGrid.addComponent(panelResult, 0, 1, 1, 1);

    Button buttonTestURL = new Button();
    buttonTestURL.setIcon(VaadinIcons.EXTERNAL_LINK);
    buttonTestURL.setCaption(Language.get(Word.OPEN_LINK));

    Button buttonTest = new Button(Language.get(Word.TEST), VaadinIcons.CLIPBOARD_CHECK);
    buttonTest.addClickListener(ce -> {
        Article a = CrawlerUtils.executeRandom(crawler);
        labelResult.setValue(a.getBody());
        if (reg != null) {
            reg.remove();
        }
        reg = buttonTestURL
                .addClickListener(cev -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false));
    });

    refreshList(mainGrid, crawler);

    Runnable cancel = () -> close();
    Runnable next = () -> validateThirdStage(s);

    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.addComponents(header, mainGrid, getFooter(cancel, next, buttonTest, buttonTestURL));
    windowLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER);
    windowLayout.setExpandRatio(mainGrid, 5);
    windowLayout.setWidth("1250px");
    return windowLayout;
}