Example usage for com.vaadin.ui Panel setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:com.github.peholmst.i18n4vaadin.cdi.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);//from   w w w.jav  a2 s  .  c  o  m
    content.setSpacing(true);
    content.setSizeFull();
    setContent(content);

    languageChanger = new ComboBox();
    languageChanger.setContainerDataSource(
            new BeanItemContainer<java.util.Locale>(java.util.Locale.class, i18n.getSupportedLocales()));
    languageChanger.setImmediate(true);
    languageChanger.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (languageChanger.getValue() != null) {
                i18n.setLocale((java.util.Locale) languageChanger.getValue());
            }
        }
    });
    content.addComponent(languageChanger);

    Panel viewContent = new Panel();
    viewContent.setSizeFull();
    content.addComponent(viewContent);
    content.setExpandRatio(viewContent, 1);

    Navigator navigator = new Navigator(this, viewContent);
    navigator.addProvider(viewProvider);
    navigator.navigateTo("demo");
    setNavigator(navigator);

    updateStrings();
}

From source file:com.github.peholmst.i18n4vaadin.simple.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);//from www  .j  a v a 2 s  .c o  m
    content.setSpacing(true);
    content.setSizeFull();
    setContent(content);

    languageChanger = new ComboBox();
    languageChanger.setContainerDataSource(
            new BeanItemContainer<java.util.Locale>(java.util.Locale.class, i18n.getSupportedLocales()));
    languageChanger.setImmediate(true);
    languageChanger.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (languageChanger.getValue() != null) {
                i18n.setLocale((java.util.Locale) languageChanger.getValue());
            }
        }
    });
    content.addComponent(languageChanger);

    Panel viewContent = new Panel();
    viewContent.setSizeFull();
    content.addComponent(viewContent);
    content.setExpandRatio(viewContent, 1);

    Navigator navigator = new Navigator(this, viewContent);
    navigator.addView("demo", DemoView.class);
    navigator.navigateTo("demo");
    setNavigator(navigator);

    updateStrings();
}

From source file:com.github.tempora.view.MainView.java

License:Apache License

public MainView() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.addStyleName("outlined");
    vlayout.addStyleName("bg");
    vlayout.setSizeFull();/*from  w ww  . ja  v  a 2s. com*/
    vlayout.setMargin(true);
    HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.addStyleName("outlined");
    hlayout.setSizeFull();
    setContent(vlayout);

    // Title
    Label caption = new Label("Tempora");
    caption.setStyleName("logo-label", true);
    caption.setWidth(null);
    vlayout.addComponent(caption);
    vlayout.setExpandRatio(caption, 0.2f);

    vlayout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    vlayout.addComponent(hlayout);
    vlayout.setExpandRatio(hlayout, 0.7f);

    //
    // General information about the User's mailbox
    //
    final Panel generalInfoPanel = new Panel("<center>General Information</center>");
    generalInfoPanel.addStyleName("frame-bg-general-info");
    generalInfoPanel.setSizeFull();

    this.currentHistoryId = new Label("0");
    currentHistoryId.setStyleName("general-info-count", true);
    currentHistoryId.setCaption("History ID");

    this.messagesTotal = new Label("0");
    messagesTotal.setStyleName("general-info-count", true);
    messagesTotal.setCaption("Messages Total");

    this.threadsTotal = new Label("0");
    threadsTotal.setCaption("Threads Total");
    threadsTotal.setStyleName("general-info-count", true);

    FormLayout mailboxInfoLayout = new FormLayout(messagesTotal, currentHistoryId, threadsTotal);
    VerticalLayout mailboxInfoMainLayout = new VerticalLayout(mailboxInfoLayout);
    mailboxInfoMainLayout.setSizeFull();
    mailboxInfoMainLayout.setMargin(true);
    generalInfoPanel.setContent(mailboxInfoMainLayout);

    //
    // Stats
    //
    final Panel statsPanel = new Panel("<center>Statistics</center>");
    statsPanel.addStyleName("frame-bg-stats");
    statsPanel.setSizeFull();

    this.bodyAvgSize = new Label("0");
    bodyAvgSize.setCaption("Body Avg. Size");
    bodyAvgSize.setStyleName("stats-count", true);

    FormLayout statsLayout = new FormLayout(bodyAvgSize);
    VerticalLayout statsMainLayout = new VerticalLayout(statsLayout);
    statsMainLayout.setSizeFull();
    statsMainLayout.setMargin(true);
    statsPanel.setContent(statsMainLayout);

    //
    // Top 5
    //
    Panel top5Panel = new Panel("<center>Top 5</center>");
    top5Panel.addStyleName("frame-bg-top5");

    // Top 5 Senders
    Panel top5SendersPanel = new Panel("<center>Senders</center>");
    top5SendersPanel.addStyleName("frame-bg-top5");
    top5SendersPanel.setSizeFull();
    this.top5Senders = new Label("NO DATA", ContentMode.PREFORMATTED);
    top5Senders.setSizeUndefined();
    top5SendersPanel.setContent(top5Senders);

    // Top 5 Title Tags
    Panel top5TitleTagsPanel = new Panel("<center>Title Tags</center>");
    top5TitleTagsPanel.addStyleName("frame-bg-top5");
    top5TitleTagsPanel.setSizeFull();
    this.top5TitleTags = new Label("NO DATA", ContentMode.PREFORMATTED);
    top5TitleTags.setSizeUndefined();
    top5TitleTagsPanel.setContent(top5TitleTags);

    top5Panel.setSizeFull();

    VerticalLayout top5MainLayout = new VerticalLayout(top5SendersPanel, top5TitleTagsPanel);
    top5MainLayout.setMargin(true);
    top5MainLayout.setSpacing(true);
    top5MainLayout.setSizeFull();
    top5MainLayout.setComponentAlignment(top5SendersPanel, Alignment.MIDDLE_CENTER);
    top5MainLayout.setComponentAlignment(top5TitleTagsPanel, Alignment.MIDDLE_CENTER);
    top5Panel.setContent(top5MainLayout);

    hlayout.setSpacing(true);
    hlayout.addComponent(generalInfoPanel);
    hlayout.addComponent(statsPanel);
    hlayout.addComponent(top5Panel);

    this.currentUserEmail = new Label("-");
    currentUserEmail.setCaption("Email");

    Button reloadButton = new Button("\u27F3 Reload");
    reloadButton.addClickListener(e -> {
        getSession().getSession().invalidate();
        getUI().getPage().reload();
    });

    HorizontalLayout infoHLayout = new HorizontalLayout();
    infoHLayout.addStyleName("outlined");
    infoHLayout.setSizeFull();
    infoHLayout.setSpacing(true);
    infoHLayout.setMargin(true);

    infoHLayout.addComponent(reloadButton);
    reloadButton.setWidth(null);
    infoHLayout.setComponentAlignment(reloadButton, Alignment.BOTTOM_LEFT);

    infoHLayout.addComponent(currentUserEmail);
    currentUserEmail.setWidth(null);
    infoHLayout.setComponentAlignment(currentUserEmail, Alignment.BOTTOM_RIGHT);

    vlayout.addComponent(infoHLayout);
    vlayout.setExpandRatio(infoHLayout, 0.5f);
}

From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminApplicationConfigurationPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override//  ww  w.  j  ava 2s  . c  o m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);
    final int pageNr = getPageNr(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    LabelFactory.createHeader2Label(content, ADMIN_APPLICATION_CONFIGURATION);

    final DataContainer<ApplicationConfiguration, Long> dataContainer = getApplicationManager()
            .getDataContainer(ApplicationConfiguration.class);

    final BeanItemContainer<ApplicationConfiguration> politicianDocumentDataSource = new BeanItemContainer<>(
            ApplicationConfiguration.class, dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE,
                    ApplicationConfiguration_.configurationGroup));

    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);

    getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "ApplicationConfiguration",
            new String[] { "hjid", "configurationGroup", "component", "componentTitle", "configTitle",
                    "configDescription", "componentDescription", "propertyId", "propertyValue" },
            new String[] { "hjid", "modelObjectId", "modelObjectVersion", "createdDate", "updatedDate",
                    "propertyId", "componentDescription", "componentTitle" },
            new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_CONFIGURATION_VIEW_NAME, "hjid"),
            null, null);

    if (pageId != null && !pageId.isEmpty()) {

        final ApplicationConfiguration applicationConfiguration = dataContainer.load(Long.valueOf(pageId));

        if (applicationConfiguration != null) {

            final VerticalLayout leftLayout = new VerticalLayout();
            leftLayout.setSizeFull();
            final VerticalLayout rightLayout = new VerticalLayout();
            rightLayout.setSizeFull();
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setWidth(ContentSize.FULL_SIZE);
            content.addComponent(horizontalLayout);
            horizontalLayout.addComponent(leftLayout);
            horizontalLayout.addComponent(rightLayout);

            getFormFactory().addFormPanelTextFields(leftLayout, new BeanItem<>(applicationConfiguration),
                    ApplicationConfiguration.class,
                    Arrays.asList(new String[] { "configurationGroup", "component", "configTitle",
                            "configDescription", "propertyValue", "createdDate", "updatedDate" }));

            final UpdateApplicationConfigurationRequest request = new UpdateApplicationConfigurationRequest();
            request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
            request.setApplicationConfigurationId(applicationConfiguration.getHjid());

            request.setConfigTitle(applicationConfiguration.getConfigTitle());
            request.setConfigDescription(applicationConfiguration.getConfigDescription());

            request.setComponentTitle(applicationConfiguration.getConfigTitle());
            request.setComponentDescription(applicationConfiguration.getComponentDescription());

            request.setPropertyValue(applicationConfiguration.getPropertyValue());

            final ClickListener buttonListener = new UpdateApplicationConfigurationClickListener(request,
                    getApplicationManager());

            final Panel updateFormPanel = new Panel();
            updateFormPanel.setSizeFull();

            rightLayout.addComponent(updateFormPanel);

            final FormLayout updateFormContent = new FormLayout();
            updateFormPanel.setContent(updateFormContent);

            getFormFactory().addRequestInputFormFields(updateFormContent, new BeanItem<>(request),
                    UpdateApplicationConfigurationRequest.class, Arrays.asList(new String[] { "configTitle",
                            "configDescription", "componentTitle", "componentDescription", "propertyValue" }),
                    "Update Configuration", buttonListener);

        }
    }

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_CONFIGURATION_VIEW,
            ApplicationEventGroup.ADMIN, NAME, null, pageId);

    return content;
}

From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.EmailPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override/*from w  w  w .  j av a2  s. c o  m*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    LabelFactory.createHeader2Label(content, ADMIN_EMAIL);

    final VerticalLayout emailLayout = new VerticalLayout();
    emailLayout.setSizeFull();

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();

    emailLayout.addComponent(formPanel);

    final FormLayout formContent = new FormLayout();
    formPanel.setContent(formContent);

    final SendEmailRequest sendEmailRequest = new SendEmailRequest();
    sendEmailRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    sendEmailRequest.setEmail("");
    sendEmailRequest.setSubject("");
    sendEmailRequest.setContent("");
    final ClickListener sendEmailListener = new SendEmailClickListener(sendEmailRequest,
            getApplicationManager());
    getFormFactory().addRequestInputFormFields(formContent, new BeanItem<>(sendEmailRequest),
            SendEmailRequest.class, Arrays.asList(new String[] { "email", "subject", "content" }), "Email",
            sendEmailListener);

    content.addComponent(emailLayout);
    content.setExpandRatio(emailLayout, ContentRatio.LARGE_FORM);

    panel.setCaption("Admin email");
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_EMAIL_VIEW, ApplicationEventGroup.ADMIN,
            NAME, null, pageId);

    return content;

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.chartfactory.impl.AbstractChartDataManagerImpl.java

License:Apache License

/**
 * Adds the chart.// ww w .  ja v a 2  s.c o m
 *
 * @param content
 *            the content
 * @param caption
 *            the caption
 * @param chart
 *            the chart
 */
protected final void addChart(final AbstractOrderedLayout content, final String caption, final DCharts chart) {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();

    final int browserWindowWidth = Page.getCurrent().getBrowserWindowWidth() - 50;
    final int browserWindowHeight = Page.getCurrent().getBrowserWindowHeight() - 200;

    horizontalLayout.setWidth(browserWindowWidth, Unit.PIXELS);
    horizontalLayout.setHeight(browserWindowHeight, Unit.PIXELS);

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();
    formPanel.setContent(horizontalLayout);

    content.addComponent(formPanel);
    content.setExpandRatio(formPanel, ContentRatio.LARGE);

    chart.setWidth(browserWindowWidth - 50, Unit.PIXELS);
    chart.setHeight(browserWindowHeight - 100, Unit.PIXELS);
    chart.setMarginRight(5);
    chart.setMarginLeft(5);
    chart.setMarginBottom(5);
    chart.setMarginTop(5);

    chart.setEnableDownload(true);
    chart.setChartImageFormat(ChartImageFormat.PNG);

    horizontalLayout.addComponent(chart);
    chart.setCaption(caption);
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.formfactory.impl.FormFactoryImpl.java

License:Apache License

@Override
public <T extends Serializable> void addFormPanelTextFields(final AbstractOrderedLayout panelContent,
        final BeanItem<T> item, final Class<T> beanType, final List<String> displayProperties) {

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();

    panelContent.addComponent(formPanel);
    panelContent.setExpandRatio(formPanel, ContentRatio.GRID);

    final FormLayout formContent = new FormLayout();
    formPanel.setContent(formContent);//from  www . j a  v a  2 s.  co m

    final BeanFieldGroup<T> fieldGroup = new BeanFieldGroup<>(beanType);
    fieldGroup.setItemDataSource(item);
    fieldGroup.setReadOnly(true);

    for (final String property : displayProperties) {

        final Field<?> buildAndBind = fieldGroup.buildAndBind(property);
        buildAndBind.setWidth(ContentSize.FULL_SIZE);

        formContent.addComponent(buildAndBind);
    }
    final Collection<Object> unboundPropertyIds = fieldGroup.getUnboundPropertyIds();
    for (final Object property : unboundPropertyIds) {
        LOGGER.debug(LOG_MSG_PROPERTY, property);
    }

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.MainViewRegisterPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS" })
@Override/*from ww  w  .ja  v  a 2  s  . c  o m*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();
    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    final VerticalLayout registerLayout = new VerticalLayout();
    registerLayout.setSizeFull();

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();

    registerLayout.addComponent(formPanel);

    final FormLayout formContent = new FormLayout();
    formPanel.setContent(formContent);

    final RegisterUserRequest reqisterRequest = new RegisterUserRequest();
    reqisterRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    reqisterRequest.setUsername("");
    reqisterRequest.setEmail("");
    reqisterRequest.setCountry("");
    reqisterRequest.setUserpassword("");
    final ClickListener reqisterListener = new RegisterUserClickListener(reqisterRequest,
            getApplicationManager());
    getFormFactory().addRequestInputFormFields(formContent, new BeanItem<>(reqisterRequest),
            RegisterUserRequest.class,
            Arrays.asList(new String[] { "username", "email", "country", "userpassword" }), "Register",
            reqisterListener);

    content.addComponent(registerLayout);

    panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN);
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER,
            CommonsViews.MAIN_VIEW_NAME, parameters, pageId);

    return content;

}

From source file:com.hack23.cia.web.impl.ui.application.views.user.document.pagemode.DocumentDataPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//  w  w  w.j a  v a 2s . c o  m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    final String pageId = getPageId(parameters);

    final DataContainer<DocumentElement, String> documentElementDataContainer = getApplicationManager()
            .getDataContainer(DocumentElement.class);

    final DataContainer<DocumentContentData, String> documentContentDataDataContainer = getApplicationManager()
            .getDataContainer(DocumentContentData.class);

    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);

    final DocumentElement documentElement = documentElementDataContainer.load(pageId);

    if (documentElement != null) {

        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

        LabelFactory.createHeader2Label(panelContent, DOCUMENT_DATA);

        final List<DocumentContentData> documentContentlist = documentContentDataDataContainer
                .getAllBy(DocumentContentData_.id, pageId);

        if (!documentContentlist.isEmpty()) {

            final Panel formPanel = new Panel();
            formPanel.setSizeFull();

            panelContent.addComponent(formPanel);

            final FormLayout formContent = new FormLayout();
            formPanel.setContent(formContent);

            final Label htmlContent = new Label(documentContentlist.get(0).getContent(), ContentMode.HTML);

            formContent.addComponent(htmlContent);

            panelContent.setExpandRatio(formPanel, ContentRatio.GRID);

        }

        panel.setContent(panelContent);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER,
                NAME, parameters, pageId);
    }

    return panelContent;

}

From source file:com.hack23.cia.web.impl.ui.application.views.user.document.pagemode.SearchDocumentPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override// w w w.j a  v  a2  s  .  co m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    final VerticalLayout searchLayout = new VerticalLayout();
    searchLayout.setSizeFull();
    panelContent.addComponent(searchLayout);

    final VerticalLayout searchresultLayout = new VerticalLayout();
    searchresultLayout.setSizeFull();

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();

    searchresultLayout.addComponent(formPanel);

    final FormLayout formContent = new FormLayout();
    formPanel.setContent(formContent);

    panelContent.addComponent(searchresultLayout);

    final SearchDocumentRequest searchRequest = new SearchDocumentRequest();
    searchRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    searchRequest.setMaxResults(MAX_RESULT_SIZE);
    searchRequest.setSearchExpression("");
    final SearchDocumentResponseHandler handler = new SearchDocumentResponseHandler() {

        /** The Constant serialVersionUID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(final SearchDocumentResponse response) {
            searchresultLayout.removeAllComponents();

            final BeanItemContainer<DocumentElement> documentActivityDataDataDataSource = new BeanItemContainer<>(
                    DocumentElement.class, response.getResultElement());

            getGridFactory().createBasicBeanItemGrid(searchresultLayout, documentActivityDataDataDataSource,
                    "Document",
                    new String[] { "rm", "createdDate", "madePublicDate", "documentType", "subType", "title",
                            "subTitle", "status" },
                    new String[] { "label", "id", "hit", "relatedId", "org", "tempLabel", "numberValue",
                            "systemDate", "kallId", "documentFormat", "documentUrlText", "documentUrlHtml",
                            "documentStatusUrlXml", "committeeReportUrlXml" },
                    null, null, null);

        }
    };
    final ClickListener searchListener = new SearchDocumentClickListener(searchRequest, getApplicationManager(),
            handler);
    getFormFactory().addRequestInputFormFields(formContent, new BeanItem<>(searchRequest),
            SearchDocumentRequest.class, Arrays.asList(new String[] { "searchExpression" }), "Search",
            searchListener);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME,
            parameters, pageId);

    return panelContent;

}