List of usage examples for com.vaadin.ui Panel setContent
@Override public void setContent(Component content)
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();/* w ww .j a v a2s .co m*/ 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//from w w w. j av 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); 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 www . j a v a 2 s. c om 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./*from w ww . j a v a 2s.co 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();/*w w w. jav a 2 s .c o m*/ panelContent.addComponent(formPanel); panelContent.setExpandRatio(formPanel, ContentRatio.GRID); final FormLayout formContent = new FormLayout(); formPanel.setContent(formContent); 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 www.j ava2s. 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.DocumentActivityPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override/*ww w .ja 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<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_ACTIVITY); if (documentStatusContainer != null && documentStatusContainer.getDocumentActivityContainer() != null && documentStatusContainer.getDocumentActivityContainer().getDocumentActivities() != null) { final BeanItemContainer<DocumentActivityData> documentActivityDataDataDataSource = new BeanItemContainer<>( DocumentActivityData.class, documentStatusContainer.getDocumentActivityContainer().getDocumentActivities()); getGridFactory().createBasicBeanItemGrid(panelContent, documentActivityDataDataDataSource, "Document activities", new String[] { "createdDate", "code", "activityName", "orderNumber", "process", "status" }, 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.DocumentAttachementsPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override//from ww w.j a v a 2 s .co 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_ATTACHMENTS); if (documentStatusContainer != null && documentStatusContainer.getDocumentAttachmentContainer() != null && documentStatusContainer.getDocumentAttachmentContainer() .getDocumentAttachmentList() != null) { final BeanItemContainer<DocumentAttachment> documentAttachmentDataSource = new BeanItemContainer<>( DocumentAttachment.class, documentStatusContainer.getDocumentAttachmentContainer().getDocumentAttachmentList()); getGridFactory().createBasicBeanItemGrid(panelContent, documentAttachmentDataSource, "Document attachements", new String[] { "fileName", "fileSize", "fileType", "fileUrl" }, new String[] { "hjid" }, null, null, null); final List<DocumentAttachment> documentAttachmentList = documentStatusContainer .getDocumentAttachmentContainer().getDocumentAttachmentList(); final VerticalLayout verticalLayout = new VerticalLayout(); panelContent.addComponent(verticalLayout); panelContent.setExpandRatio(verticalLayout, ContentRatio.SMALL); for (final DocumentAttachment documentAttachment : documentAttachmentList) { final ExternalAttachmentDownloadLink link = new ExternalAttachmentDownloadLink( documentAttachment.getFileName(), documentAttachment.getFileType(), documentAttachment.getFileUrl()); verticalLayout.addComponent(link); } } 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.DocumentDataPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override/*from w ww . j av 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<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.DocumentDecisionPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override/*from w w w . j a va 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_DECISION); if (documentStatusContainer != null && documentStatusContainer.getDocumentProposal() != null && documentStatusContainer.getDocumentProposal().getProposal() != null) { getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(documentStatusContainer.getDocumentProposal().getProposal()), DocumentProposalData.class, Arrays.asList(new String[] { "committee", "chamber", "processedIn", "decisionType", "proposalNumber", "designation", "wording", "wording2", "wording3", "wording4" })); } panel.setContent(panelContent); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }