Example usage for com.vaadin.ui Panel setContent

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

Introduction

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

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from  w w w  . j av a2  s .c  om*/
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<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
            .getDataContainer(DocumentStatusContainer.class);

    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);

    final DocumentElement documentElement = documentElementDataContainer.load(pageId);

    if (documentElement != null) {

        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
                .findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
                        DocumentData.class, DocumentData_.id, pageId);

        LabelFactory.createHeader2Label(panelContent, DOCUMENT_DETAILS);

        if (documentStatusContainer != null && documentStatusContainer.getDocumentDetailContainer() != null
                && documentStatusContainer.getDocumentDetailContainer().getDocumentDetailList() != null) {
            final BeanItemContainer<DocumentDetailData> documentDetailDataDataDataSource = new BeanItemContainer<>(
                    DocumentDetailData.class,
                    documentStatusContainer.getDocumentDetailContainer().getDocumentDetailList());

            getGridFactory().createBasicBeanItemGrid(panelContent, documentDetailDataDataDataSource,
                    "Document details", new String[] { "code", "detailName", "text" }, new String[] { "hjid" },
                    null, null, null);
        }

        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.DocumentOverviewPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//ww  w .  ja  v a2  s  .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<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
            .getDataContainer(DocumentStatusContainer.class);

    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);

    final DocumentElement documentElement = documentElementDataContainer.load(pageId);

    if (documentElement != null) {

        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
                .findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
                        DocumentData.class, DocumentData_.id, pageId);

        LabelFactory.createHeader2Label(panelContent, OVERVIEW);

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

        panelContent.addComponent(overviewLayout);
        panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

        getDocumentMenuItemFactory().createOverviewPage(overviewLayout, pageId);

        getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(documentElement),
                DocumentElement.class,
                Arrays.asList(new String[] { "id", "org", "documentType", "subType", "rm", "status", "title",
                        "subTitle", "madePublicDate", "createdDate", "systemDate", "relatedId", "label",
                        "tempLabel", "numberValue", "kallId", "documentFormat" }));

        if (documentStatusContainer != null) {
            getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(documentStatusContainer),
                    DocumentStatusContainer.class, Arrays.asList(new String[] { "documentCategory" }));

            getFormFactory().addFormPanelTextFields(panelContent,
                    new BeanItem<>(documentStatusContainer.getDocument()), DocumentData.class,
                    Arrays.asList(new String[] { "id", "org", "documentType", "subType", "rm", "status",
                            "title", "subTitle", "madePublicDate", "label", "tempLabel", "numberValue",
                            "hangarId", }));
        }

        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.DocumentPageVisitHistoryPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from w  w  w .  j a  va2s  . c  om*/
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);

    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);

    final DocumentElement documentElement = documentElementDataContainer.load(pageId);

    if (documentElement != null) {

        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

        createPageVisitHistory(NAME, pageId, panelContent);

        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.DocumentPersonReferencesPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from   ww  w  . jav a 2 s  .  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<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
            .getDataContainer(DocumentStatusContainer.class);

    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);

    final DocumentElement documentElement = documentElementDataContainer.load(pageId);

    if (documentElement != null) {

        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
                .findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
                        DocumentData.class, DocumentData_.id, pageId);

        LabelFactory.createHeader2Label(panelContent, PERSON_REFERENCES);

        if (documentStatusContainer != null
                && documentStatusContainer.getDocumentPersonReferenceContainer() != null
                && documentStatusContainer.getDocumentPersonReferenceContainer()
                        .getDocumentPersonReferenceList() != null) {
            final BeanItemContainer<DocumentPersonReferenceData> documentPersonReferenceDataDataSource = new BeanItemContainer<>(
                    DocumentPersonReferenceData.class, documentStatusContainer
                            .getDocumentPersonReferenceContainer().getDocumentPersonReferenceList());

            getGridFactory().createBasicBeanItemGrid(panelContent, documentPersonReferenceDataDataSource,
                    "Document person references",
                    new String[] { "personReferenceId", "referenceName", "partyShortCode", "orderNumber",
                            "roleDescription" },
                    new String[] { "personReferenceId", "hjid" },
                    new PageItemPropertyClickListener(UserViews.POLITICIAN_VIEW_NAME, "personReferenceId"),
                    null, null);

        }

        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.DocumentReferencesPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/* www. j av  a 2  s . 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<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
            .getDataContainer(DocumentStatusContainer.class);

    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);

    final DocumentElement documentElement = documentElementDataContainer.load(pageId);

    if (documentElement != null) {

        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
                .findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
                        DocumentData.class, DocumentData_.id, pageId);

        LabelFactory.createHeader2Label(panelContent, DOCUMENT_REFERENCES);

        if (documentStatusContainer != null && documentStatusContainer.getDocumentReferenceContainer() != null
                && documentStatusContainer.getDocumentReferenceContainer().getDocumentReferenceList() != null) {
            final BeanItemContainer<DocumentReferenceData> documentReferenceDataDataSource = new BeanItemContainer<>(
                    DocumentReferenceData.class,
                    documentStatusContainer.getDocumentReferenceContainer().getDocumentReferenceList());

            getGridFactory().createBasicBeanItemGrid(panelContent, documentReferenceDataDataSource,
                    "Document references", new String[] { "referenceType", "referenceDocumentId", "detail" },
                    new String[] { "hjid" }, null, null, null);
        }

        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//from w  ww.  j  ava  2 s .c om
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;

}

From source file:com.haulmont.cuba.web.log.LogWindow.java

License:Apache License

private void initUI() {
    ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class);

    String closeShortcut = clientConfig.getCloseShortcut();
    KeyCombination closeCombination = KeyCombination.create(closeShortcut);

    com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction(
            "closeShortcutAction", closeCombination.getKey().getCode(),
            KeyCombination.Modifier.codes(closeCombination.getModifiers()));

    addActionHandler(new com.vaadin.event.Action.Handler() {
        @Override//from w ww .j ava 2  s .  co  m
        public com.vaadin.event.Action[] getActions(Object target, Object sender) {
            return new com.vaadin.event.Action[] { closeShortcutAction };
        }

        @Override
        public void handleAction(com.vaadin.event.Action action, Object sender, Object target) {
            if (Objects.equals(action, closeShortcutAction)) {
                close();
            }
        }
    });

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setSizeFull();
    setContent(layout);

    Panel scrollablePanel = new Panel();
    scrollablePanel.setSizeFull();
    VerticalLayout scrollContent = new VerticalLayout();
    scrollContent.setSizeUndefined();
    scrollablePanel.setContent(scrollContent);

    final Label label = new Label();
    label.setContentMode(ContentMode.HTML);
    label.setValue(writeLog());
    label.setSizeUndefined();
    label.setStyleName("c-log-content");

    ((Layout) scrollablePanel.getContent()).addComponent(label);

    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setHeightUndefined();

    Messages messages = AppBeans.get(Messages.NAME);
    Button refreshBtn = new CubaButton(messages.getMessage(getClass(), "logWindow.refreshBtn"),
            (Button.ClickListener) event -> label.setValue(writeLog()));

    topLayout.addComponent(refreshBtn);

    layout.addComponent(topLayout);
    layout.addComponent(scrollablePanel);

    layout.setExpandRatio(scrollablePanel, 1.0f);
}

From source file:com.hris.connection.ErrorLoggedNotification.java

public static void showErrorLoggedOnWindow(String error, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();/*from w ww.  j  a  v  a2  s.  com*/
    v.setMargin(true);

    Window sub = new Window("ERROR MESSAGE!", v);
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();

    sub.setContent(panel);
    sub.getContent().setHeightUndefined();
}

From source file:com.jain.addon.web.layout.JainPanelLayout.java

License:Apache License

private JainLayout createOrUpdateCurrentLayout(JNIGroup group, String groupName) {
    if (group != null && group.getParent() != null) {
        JainLayout parentLayout = groupLayoutMap.get(group.getParent().getName());
        if (parentLayout == null) {
            parentLayout = createOrUpdateCurrentLayout(group.getParent(), group.getParent().getName());
        }//from w w w  .j a v a  2  s.c  o m

        if (parentLayout != null) {
            Panel panel = new Panel(group.getDisplayName());
            panel.setWidth("100%");
            JainLayout layout = new JainLayout(spacing, margin,
                    group.getParent() == null ? group.getColumns() : group.getParent().getColumns());
            panel.setContent(layout);
            parentLayout.addComponent(panel, group.getColSpan());
            groupLayoutMap.put(groupName, layout);
            return layout;
        }
    }

    Panel panel = new Panel(group == null ? "" : group.getDisplayName());
    panel.setWidth("100%");
    JainLayout layout = new JainLayout(spacing, margin, group == null ? columns : group.getColumns());
    panel.setContent(layout);
    super.addComponent(panel);
    groupLayoutMap.put(groupName, layout);
    return layout;
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 *  ????//from  www. java2  s .c  om
 * @param panelContent
 */
private void createCsrSelectTables(VerticalLayout panelContent) {
    csrSelectHLayout = new HorizontalLayout();
    csrSelectHLayout.setSpacing(true);
    csrSelectHLayout.setVisible(false);
    csrSelectHLayout.setWidth("100%");
    panelContent.addComponent(csrSelectHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    caption.setDescription("<B>??</B>");
    csrSelectHLayout.addComponent(caption);

    // ???
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setMargin(false, true, false, true);
    panelLayout.setWidth("100%");

    Panel tablePanel = new Panel();
    tablePanel.setContent(panelLayout);
    csrSelectHLayout.addComponent(tablePanel);
    csrSelectHLayout.setExpandRatio(tablePanel, 1.0f);

    // (??)
    VerticalLayout leftComponents = createLeftComponents();
    panelLayout.addComponent(leftComponents);
    panelLayout.setExpandRatio(leftComponents, 0.4f);

    // ??("?")
    VerticalLayout middleComponents = createMiddleComponents();
    panelLayout.addComponent(middleComponents);
    panelLayout.setComponentAlignment(middleComponents, Alignment.MIDDLE_CENTER);
    panelLayout.setExpandRatio(middleComponents, 0.2f);

    // ?(????)
    VerticalLayout rightComponents = createRightComponents();
    panelLayout.addComponent(rightComponents);
    panelLayout.setExpandRatio(rightComponents, 0.4f);
}