Example usage for com.vaadin.ui CssLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:gov.va.ehtac.myappsonfhir.ui.ImmunizationRequest.java

private Popover getPopoverResults(String umaResults) {
    popover = new Popover();
    popover.setModal(true);//  www.  j ava  2  s .c om
    popover.setClosable(true);
    popover.setWidth("500px");
    popover.setHeight("350px");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption("Request Completed");
    Label lbl = new Label(umaResults);

    CssLayout layout2 = new CssLayout();
    layout2.addComponent(lbl);
    setTable();
    layout2.addComponent(immunizationTable);
    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            popover.removeFromParent();
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);
    popover.setContent(navView);

    return popover;
}

From source file:info.magnolia.messages.app.MessagesViewImpl.java

License:Open Source License

@Inject
public MessagesViewImpl(SimpleTranslator i18n) {

    this.i18n = i18n;

    // create form and data item
    final Message message = new Message(); // message POJO
    BeanItem<Message> messageItem = new BeanItem<Message>(message);

    final FieldGroup form = new FieldGroup();
    form.setItemDataSource(messageItem);

    Field<String> subjectField = createSubjectTextField();
    Field<String> messageBodyField = createMessageBodyTextField();
    Field<?> typeField = createTypeSelectionField();
    Field<?> scopeField = createScopeSelectionField();
    userOrGroupIdField = createUserOrGroupIdTextField();

    // disable user/group field if not necessary
    scopeField.addValueChangeListener(new ValueChangeListener() {

        @Override//from  ww w  .j  a v  a2  s  . c o  m
        public void valueChange(ValueChangeEvent event) {
            updateUserOrGroupField((String) event.getProperty().getValue());
        }
    });

    form.bind(subjectField, "title");
    form.bind(messageBodyField, "content");
    form.bind(typeField, "type");
    form.bind(scopeField, "scope");
    form.bind(userOrGroupIdField, "user");
    // FieldGroup overrides fields' own enabled property with its own.
    updateUserOrGroupField(message.getScope());

    FormLayout layout = new FormLayout();
    layout.addComponent(subjectField);
    layout.addComponent(messageBodyField);
    layout.addComponent(typeField);
    layout.addComponent(scopeField);
    layout.addComponent(userOrGroupIdField);

    layout.setSpacing(true);
    layout.setMargin(false);
    layout.setWidth("100%");

    // send button
    NativeButton sendButton = new NativeButton(i18n.translate("messages-app.app.button.sendMessage"),
            new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    try {
                        form.commit();
                        String subject = message.getTitle();
                        String content = message.getContent();
                        MessageType type = message.getType();
                        String scope = message.getScope();

                        if (MESSAGE_SCOPE_LOCAL.equals(scope)) {
                            listener.handleLocalMessage(type, subject, content);
                        } else if (MESSAGE_SCOPE_GLOBAL.equals(scope)) {
                            listener.handleGlobalMessage(type, subject, content);
                        } else if (MESSAGE_SCOPE_GROUP.equals(scope)) {
                            // message is bound to FieldGroup - hence the group name is to be retrieved from the user field of the message
                            final String groupName = message.getUser();
                            listener.handleGroupMessage(groupName, type, subject, content);
                        } else {
                            // User...
                            final String userName = message.getUser();
                            listener.handleUserMessage(userName, type, subject, content);
                        }
                    } catch (CommitException e) {

                    }
                }
            });
    sendButton.addStyleName("btn-dialog");
    sendButton.addStyleName("commit");

    // reset button
    NativeButton resetButton = new NativeButton(i18n.translate("messages-app.app.button.reset"),
            new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    message.reset();
                    form.discard();
                }
            });
    resetButton.addStyleName("btn-dialog");
    resetButton.addStyleName("cancel");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addStyleName("buttons");
    buttons.setSpacing(true);
    buttons.addComponent(sendButton);
    buttons.addComponent(resetButton);
    layout.addComponent(buttons);

    // intro text
    Label intro = new Label(i18n.translate("messages-app.app.label.intro"), ContentMode.HTML);
    intro.addStyleName("intro");

    CssLayout container = new CssLayout();
    container.setSizeFull();
    container.addStyleName("small-app-panel");
    container.addComponent(layout);

    CssLayout root = new CssLayout();
    root.setSizeFull();
    root.setWidth("900px");
    root.setStyleName("small-app");
    root.addComponent(intro);
    root.addComponent(container);

    component = root;
}

From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesForm.java

License:Open Source License

private void init() {
    addStyleName("favorites-form");
    final VerticalLayout favoriteForm = new VerticalLayout();
    favoriteEntryForm = new InternalFavoriteEntryForm();
    favoriteGroupForm = new InternalFavoriteGroupForm();

    tabsheet = new TabSheet();
    tabsheet.addStyleName("favorites-tabs");
    tabsheet.addTab(favoriteEntryForm, i18n.translate("favorites.form.favorite.add"));
    tabsheet.addTab(favoriteGroupForm, i18n.translate("favorites.form.group.add"));

    tabsheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {

        @Override//from  w  w w . j  a v a 2 s .  co  m
        public void selectedTabChange(SelectedTabChangeEvent event) {
            if (event.getTabSheet().getSelectedTab() instanceof InternalFavoriteEntryForm) {
                favoriteGroupForm.removeEnterKeyShortcutListener();
                favoriteEntryForm.addEnterKeyShortcutListener();
            } else {
                favoriteEntryForm.removeEnterKeyShortcutListener();
                favoriteGroupForm.addEnterKeyShortcutListener();
            }
        }
    });

    final CssLayout header = new CssLayout();
    header.addStyleName("dialog-header");
    header.setSizeFull();
    header.addLayoutClickListener(new LayoutClickListener() {
        @Override
        public void layoutClick(LayoutClickEvent event) {
            // change the visibility of the group- and favorite-items
            if (event.getClickedComponent() == editIcon || event.getChildComponent() == editLabel) {
                if (!listener.hasItems() || listener.itemsAreEditable()) {
                    listener.setToInitialState();
                } else {
                    listener.setItemsEditable(true);
                }
            } else {
                // just open || close the FavoritesForm
                if (isOpen()) {
                    close();
                } else {
                    open();
                }
            }
        }
    });

    // add
    final Label addNewIcon = new Label();
    addNewIcon.setSizeUndefined();
    addNewIcon.addStyleName("icon");
    addNewIcon.addStyleName("icon-add-fav");
    final Label addNewLabel = new Label(i18n.translate("favorites.form.add"));
    addNewLabel.setSizeUndefined();
    addNewLabel.addStyleName("title");

    // edit
    editIcon = new Label();
    editIcon.setSizeUndefined();
    editIcon.addStyleName(EDIT_ACTION_STYLENAME);
    editIcon.addStyleName("icon");
    editIcon.addStyleName("icon-edit");

    editLabel = new Label(i18n.translate("favorites.form.favorite.edit"));
    editLabel.setSizeUndefined();
    editLabel.addStyleName("title");
    editLabel.addStyleName(EDIT_ACTION_STYLENAME);

    // arrow
    arrowIcon = new Label();
    arrowIcon.setSizeUndefined();
    arrowIcon.addStyleName("icon");
    arrowIcon.addStyleName("arrow");
    arrowIcon.addStyleName("icon-arrow2_n");

    // assemble
    header.addComponent(addNewIcon);
    header.addComponent(addNewLabel);
    header.addComponent(editIcon);
    header.addComponent(editLabel);
    header.addComponent(arrowIcon);
    favoriteForm.addComponent(header);
    favoriteForm.addComponent(tabsheet);

    // form is closed initially
    close();
    setCompositionRoot(favoriteForm);
}

From source file:info.magnolia.ui.dialog.formdialog.FormBuilder.java

License:Open Source License

public View buildView(FormDefinition formDefinition, Item item) {

    final CssLayout view = new CssLayout();
    view.setSizeFull();

    for (TabDefinition tabDefinition : formDefinition.getTabs()) {
        List<FieldDefinition> fields = tabDefinition.getFields();
        if (fields.size() == 0) { // skip empty tabs
            continue;
        }//w w  w .  j  av a  2 s  .c o  m
        for (final FieldDefinition fieldDefinition : fields) {
            final FieldFactory formField = fieldFactoryFactory.createFieldFactory(fieldDefinition, item);
            if (formField == null) {
                continue;
            }
            formField.setComponentProvider(componentProvider);

            final View fieldView = formField.getView();

            view.addComponent(fieldView.asVaadinComponent());

        }
    }
    return new View() {
        @Override
        public Component asVaadinComponent() {
            return view;
        }
    };
}

From source file:me.uni.emuseo.view.common.form.SearchFormLayout.java

License:Open Source License

private CssLayout createButtonsLayout() {
    CssLayout buttonsLayout = new CssLayout();
    Button searchButton = new Button();
    searchButton.addStyleName("primary");
    searchButton.setIcon(FontAwesome.SEARCH);
    searchButton.addClickListener(new Button.ClickListener() {

        /**//from www. j a v a2 s .c om
         * 
         */
        private static final long serialVersionUID = -8034803606737706285L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                formBuilder.commit();
                eventPropagator.fireChangeEvent(formBuilder.getBean());
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button clearButton = new Button();
    clearButton.addStyleName("primary");
    clearButton.setIcon(FontAwesome.ERASER);
    clearButton.addClickListener(new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = -8684340029871714722L;

        @Override
        public void buttonClick(ClickEvent event) {
            T bean = getBean();
            formBuilder.setBean(bean);
            eventPropagator.fireClearEvent(formBuilder.getBean());
        }

    });
    buttonsLayout.addComponents(clearButton, searchButton);
    buttonsLayout.setSizeFull();
    buttonsLayout.addStyleName("buttons-layout");
    return buttonsLayout;
}

From source file:org.activiti.explorer.ui.custom.DetailPanel.java

License:Apache License

public DetailPanel() {
    setSizeFull();// ww  w  .  jav a 2  s  .  c  o  m
    addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    setMargin(true);

    CssLayout cssLayout = new CssLayout(); // Needed for rounded corners
    cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    cssLayout.setSizeFull();
    super.addComponent(cssLayout);

    mainPanel = new Panel();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    mainPanel.setSizeFull();
    cssLayout.addComponent(mainPanel);

    // Use default layout
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth(100, UNITS_PERCENTAGE);
    verticalLayout.setMargin(true);
    mainPanel.setContent(verticalLayout);
}

From source file:org.bubblecloud.ilves.component.flow.AbstractFlowViewlet.java

License:Apache License

@Override
public final void attach() {
    super.attach();

    setStyleName("ui-content");

    final CssLayout layout = new CssLayout();
    layout.setSizeFull();
    this.setCompositionRoot(layout);

    topLayout = new CssLayout();
    topLayout.setStyleName("flow-top");

    topBackButton = new Button(getSite().localize("button-back"));
    topBackButton.addClickListener(this);
    topLayout.addComponent(topBackButton);

    topPathLabel = new Label("", ContentMode.HTML);
    topPathLabel.setSizeUndefined();/*from www.j  a v a 2s  .com*/

    topLayout.addComponent(topPathLabel);

    topRightLayout = new CssLayout();
    topLayout.addComponent(topRightLayout);
    topLayout.setWidth(100, Unit.PERCENTAGE);

    bottomLayout = new CssLayout();
    bottomLayout.setStyleName("flow-bottom");

    bottomBackButton = new Button(getSite().localize("button-back"));
    bottomBackButton.addClickListener(this);
    bottomLayout.addComponent(bottomBackButton);

    bottomPathLabel = new Label("", ContentMode.HTML);
    bottomPathLabel.setSizeUndefined();

    bottomLayout.addComponent(bottomPathLabel);

    bottomRightLayout = new CssLayout();
    bottomLayout.addComponent(bottomRightLayout);
    bottomLayout.setWidth(100, Unit.PERCENTAGE);

    tabSheet = new TabSheet();
    tabSheet.setStyleName("flow-sheet");
    tabSheet.hideTabs(true);
    tabSheet.setSizeFull();

    layout.addComponent(topLayout);
    layout.addComponent(tabSheet);
    layout.addComponent(bottomLayout);

    addFlowlets();

    tabSheet.setSelectedTab((Component) getRootFlowlet());
}

From source file:org.eclipse.skalli.view.component.RadioSelect.java

License:Open Source License

private void renderEntries() {
    int row = 0;/*from  w w  w  .  j  a v a  2  s  .c o  m*/
    radios = new ArrayList<Button>(entries.size());
    for (Entry entry : entries) {
        Button b = new Button();
        b.setIcon(row == selected ? SELECTED : UNSELECTED);
        b.setStyleName(Button.STYLE_LINK);
        b.addListener((Button.ClickListener) this);
        entriesGrid.addComponent(b, 0, row);
        radios.add(b);

        StringBuilder sb = new StringBuilder();
        sb.append("<span style=\"font-weight:bold\">"); //$NON-NLS-1$
        sb.append(StringEscapeUtils.escapeHtml(entry.getCaption()));
        sb.append("</span><br>"); //$NON-NLS-1$
        sb.append("<span style=\"white-space:normal\">"); //$NON-NLS-1$
        sb.append(HtmlUtils.clean(entry.getDescription()));
        sb.append("</span>"); //$NON-NLS-1$

        CssLayout css = new CssLayout() {

            private static final long serialVersionUID = 7370808823922141846L;

            @Override
            protected String getCss(Component c) {
                return "margin-bottom:10px;margin-left:3px"; //$NON-NLS-1$
            }
        };
        css.setSizeFull();
        Label comment = new Label(sb.toString(), Label.CONTENT_XHTML);
        css.addComponent(comment);

        entriesGrid.addComponent(css, 1, row);
        entriesGrid.setColumnExpandRatio(1, 1.0f);
        ++row;
    }
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectAboutBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    CssLayout layout = new CssLayout();
    layout.addStyleName(STYLE_ABOUT_INFOBOX);
    layout.setSizeFull();

    String description = "No description available";
    if (StringUtils.isNotBlank(project.getDescription())) {
        description = HtmlUtils.clean(StringUtils.replace(project.getDescription(), "\n", "<br />")); //$NON-NLS-1$ //$NON-NLS-2$
        createLabel(layout, description, STYLE_ABOUT);
    }/*w ww.jav  a 2  s  .c  o  m*/

    InfoExtension ext = project.getExtension(InfoExtension.class);
    if (ext != null && StringUtils.isNotBlank(ext.getPageUrl())) {
        createLink(layout, "Project Homepage", ext.getPageUrl(), DEFAULT_TARGET, STYLE_HOMEPAGE);
    }

    TaggingService taggingService = Services.getService(TaggingService.class);
    if (taggingService != null) {
        TagComponent tagComponent = new TagComponent(project, taggingService, util);
        layout.addComponent(tagComponent);
    }

    if (!util.getProjectTemplate().isHidden(Project.class.getName(), Project.PROPERTY_PHASE,
            util.isUserProjectAdmin(project))) {
        createLabel(layout, MessageFormat.format("This project is in the <b>{0}</b> phase.",
                StringEscapeUtils.escapeHtml(project.getPhase())), STYLE_PHASE);
    }

    // for ui testing
    // TODO need to understand why vaadin does not accept the layout to have the id
    // (it then cannot render a second project, throws ISE)
    layout.addComponent(new Label("<div id=" + DEBUG_ID + "></div>", Label.CONTENT_XHTML)); //$NON-NLS-1$ //$NON-NLS-2$

    addLastModifiedInfo(layout, project);

    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectReviewBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    CssLayout layout = new CssLayout() {
        @Override// ww  w  .j  a va  2 s. co m
        protected String getCss(Component c) {
            return "padding-left: 3px;";
        }
    };
    layout.setMargin(false);
    layout.setSizeFull();

    ReviewProjectExt ext = project.getExtension(ReviewProjectExt.class);
    if (ext != null) {
        ReviewComponent reviewComponent = new ReviewComponent(project, DEFAULT_PAGE_LENGH, MAX_PAGE_LENGH,
                util);
        layout.addComponent(reviewComponent);
    }
    return layout;
}