Example usage for com.vaadin.ui.themes ValoTheme LAYOUT_COMPONENT_GROUP

List of usage examples for com.vaadin.ui.themes ValoTheme LAYOUT_COMPONENT_GROUP

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme LAYOUT_COMPONENT_GROUP.

Prototype

String LAYOUT_COMPONENT_GROUP

To view the source code for com.vaadin.ui.themes ValoTheme LAYOUT_COMPONENT_GROUP.

Click Source Link

Document

Add this style name to a CssLayout to create a grouped set of components, i.e.

Usage

From source file:com.cxplonka.feature.ui.vaadin.VaadinUI.java

private void initLayout() {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();//from  ww  w  .java  2  s.c  om
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    navigationBar.addComponent(createNavigationButton("Default View", DefaultView.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("Data View", DataTableView.VIEW_NAME));

    root.addComponent(navigationBar);

    final Panel viewContainer = new Panel();
    viewContainer.setSizeFull();
    root.addComponent(viewContainer);
    root.setExpandRatio(viewContainer, 1.0f);

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);
}

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

public GroupView() {
    User user = UserUtils.getCurrent();/*from w ww .jav  a 2  s . co m*/
    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);//w w w. ja  v a 2  s .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);//ww  w . j  a v a2s .  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 InterestProfileView() {
    User user = UserUtils.getCurrent();// w w  w . j  a v  a2 s. c  om
    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  .j a v  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 ww  w. j av  a2s .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(), 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;/*w  w w.  ja  v a 2 s.  c  om*/
    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;
}

From source file:fr.ortec.dsi.pointage.presentation.ihm.view.TextFields.java

License:Apache License

public TextFields() {
    setMargin(true);//from w ww.  j av a 2  s.  c  o  m
    setSpacing(true);

    Label h1 = new Label("Text Fields");
    h1.addStyleName(ValoTheme.LABEL_H1);
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    addComponent(row);

    TextField tf = new TextField("Normal");
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField("Custom color");
    tf.addStyleName("color1");
    row.addComponent(tf);

    tf = new TextField("User Color");
    tf.addStyleName("color2");
    row.addComponent(tf);

    tf = new TextField("Themed");
    tf.addStyleName("color3");
    row.addComponent(tf);

    tf = new TextField("Error");
    tf.setValue("Somethings wrong");
    tf.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(tf);

    tf = new TextField("Error, borderless");
    tf.setValue("Somethings wrong");
    tf.setComponentError(new UserError("Fix it, now!"));
    tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
    row.addComponent(tf);

    tf = new TextField("Small");
    tf.setValue("Field value");
    tf.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    row.addComponent(tf);

    tf = new TextField("Large");
    tf.setValue("Field value");
    tf.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    tf.setIcon(testIcon.get(true));
    row.addComponent(tf);

    tf = new TextField();
    tf.setValue("Font, no caption");
    tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    tf.setIcon(testIcon.get());
    row.addComponent(tf);

    tf = new TextField();
    tf.setValue("Image, no caption");
    tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    tf.setIcon(testIcon.get(true, 16));
    row.addComponent(tf);

    CssLayout group = new CssLayout();
    group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    row.addComponent(group);

    Button button = new Button("Do It");
    // button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    group.addComponent(button);

    tf = new TextField("Right-aligned");
    tf.setValue("1,234");
    tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT);
    row.addComponent(tf);

    tf = new TextField("Tiny");
    tf.setValue("Field value");
    tf.addStyleName(ValoTheme.TEXTFIELD_TINY);
    row.addComponent(tf);

    tf = new TextField("Huge");
    tf.setValue("Field value");
    tf.addStyleName(ValoTheme.TEXTFIELD_HUGE);
    row.addComponent(tf);

    h1 = new Label("Text Areas");
    h1.addStyleName(ValoTheme.LABEL_H1);
    addComponent(h1);

    row = new HorizontalLayout();
    row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    addComponent(row);

    RichTextArea rta = new RichTextArea();
    rta.setValue("<b>Some</b> <i>rich</i> content");
    row.addComponent(rta);

    rta = new RichTextArea("Read-only");
    rta.setValue("<b>Some</b> <i>rich</i> content");
    rta.setReadOnly(true);
    row.addComponent(rta);
}

From source file:io.pivotal.pde.demo.tracker.gemfire.CheckInEditor.java

@Autowired
public CheckInEditor(CheckInRepository repository) {
    this.repository = repository;

    addComponents(plate, location, actions);

    // Configure and style components
    setSpacing(true);/*from  w w w.j av  a  2 s. co m*/
    actions.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    save.setStyleName(ValoTheme.BUTTON_PRIMARY);
    save.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    // wire action buttons to save, delete and reset
    save.addClickListener(e -> save());
    cancel.addClickListener(e -> cancel());

    setVisible(false);
}