List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminAgencyPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override//from www .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_AGENCY); final DataContainer<Agency, Long> dataContainer = getApplicationManager().getDataContainer(Agency.class); final BeanItemContainer<Agency> politicianDocumentDataSource = new BeanItemContainer<>(Agency.class, dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, Agency_.agencyName)); createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE); getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "Agency", new String[] { "hjid", "agencyName", "description", "portals", "modelObjectVersion" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion" }, new PageItemPropertyClickListener(AdminViews.ADMIN_AGENCY_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter(List.class, "portalName", "portals") }); if (pageId != null && !pageId.isEmpty()) { 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); content.setExpandRatio(horizontalLayout, ContentRatio.LARGE_FORM); horizontalLayout.addComponent(leftLayout); horizontalLayout.addComponent(rightLayout); final Agency agency = dataContainer.load(Long.valueOf(pageId)); agency.getPortals().getClass(); if (agency != null) { getFormFactory().addFormPanelTextFields(leftLayout, new BeanItem<>(agency), Agency.class, Arrays.asList(new String[] { "agencyName", "description" })); final BeanItemContainer<Portal> portalItemContainer = new BeanItemContainer<>(Portal.class, agency.getPortals()); getGridFactory().createBasicBeanItemGrid(rightLayout, portalItemContainer, "Portal", new String[] { "hjid", "portalName", "description", "portalType", "googleMapApiKey", "modelObjectVersion" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion", "googleMapApiKey" }, new PageItemPropertyClickListener(AdminViews.ADMIN_PORTAL_VIEW_NAME, "hjid"), null, null); } } getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_AGENCY_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminApplicationConfigurationPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override/*from www.j a v a 2 s .com*/ 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.AdminApplicationSessionPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override/*from w w w.ja v a2 s .c om*/ 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_SESSION); final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager() .getDataContainer(ApplicationSession.class); final BeanItemContainer<ApplicationSession> politicianDocumentDataSource = new BeanItemContainer<>( ApplicationSession.class, dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate)); createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE); getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "ApplicationSession", new String[] { "hjid", "createdDate", "sessionType", "userId", "events", "operatingSystem", "locale", "ipInformation", "userAgentInformation", "sessionId" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion", "userAgentInformation", "sessionId", "ipInformation" }, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter(List.class, "page", "events", "actionName") }); if (pageId != null && !pageId.isEmpty()) { final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId)); if (applicationSession != null) { final VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setSizeFull(); final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth(ContentSize.FULL_SIZE); content.addComponent(horizontalLayout); content.setExpandRatio(horizontalLayout, ContentRatio.GRID); getFormFactory().addFormPanelTextFields(horizontalLayout, new BeanItem<>(applicationSession), ApplicationSession.class, Arrays.asList(new String[] { "createdDate", "sessionType", "userId", "sessionId", "operatingSystem", "locale", "ipInformation", "userAgentInformation" })); horizontalLayout.addComponent(rightLayout); horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID); final BeanItemContainer<ApplicationActionEvent> eventsItemContainer = new BeanItemContainer<>( ApplicationActionEvent.class, applicationSession.getEvents()); getGridFactory().createBasicBeanItemGrid(rightLayout, eventsItemContainer, "ApplicationActionEvent", new String[] { "hjid", "createdDate", "eventGroup", "actionName", "applicationOperation", "page", "pageMode", "elementId", "errorMessage", "applicationMessage", "modelObjectVersion" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion", "userId", "sessionId" }, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null); } } getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminMonitoringPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override/*from ww w. j a 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 BrowserFrame browser = new BrowserFrame(ADMIN_MONITORING, new ExternalResource(MONITORING_CONTEXT_PATH)); browser.setSizeFull(); content.addComponent(browser); content.setExpandRatio(browser, ContentRatio.FULL_SIZE); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_MONITORING_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 a v a2 s . co 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.AbstractView.java
License:Apache License
/** * Creates the basic layout with panel and footer. * * @param panelName//w w w . j a v a 2 s . co m * the panel name */ protected final void createBasicLayoutWithPanelAndFooter(final String panelName) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); final VerticalLayout pageModeContent = new VerticalLayout(); pageModeContent.setMargin(true); pageModeContent.setSpacing(true); pageModeContent.setWidth(100, Unit.PERCENTAGE); pageModeContent.setHeight(100, Unit.PERCENTAGE); layout.addComponent(pageModeContent); final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png"); final Image ciaLogoImage = new Image(null, ciaLogoResource); final HorizontalLayout topHeader = new HorizontalLayout(); topHeader.addComponent(ciaLogoImage); ciaLogoImage.setWidth("75px"); ciaLogoImage.setHeight("75px"); topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL); final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout(); final Label titleLabel = new Label("Citizen Intelligence Agency"); titleLabel.setStyleName("Header"); topTitleHeadertPanel.addComponent(titleLabel); topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final Label sloganLabel = new Label("// Tracking politicians like bugs!"); sloganLabel.setStyleName("HeaderSlogan"); topTitleHeadertPanel.addComponent(sloganLabel); topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT); topHeader.addComponent(topTitleHeadertPanel); topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID); topHeaderRightPanel.removeAllComponents(); topHeader.addComponent(topHeaderRightPanel); topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT); topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink(); topHeaderRightPanel.addComponent(userHomePageLink); topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT); final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT); final LogoutRequest logoutRequest = new LogoutRequest(); logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager)); topHeaderRightPanel.addComponent(logoutButton); topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT); } else { final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink(); topHeaderRightPanel.addComponent(createRegisterPageLink); topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT); final Link createLoginPageLink = pageLinkFactory.createLoginPageLink(); topHeaderRightPanel.addComponent(createLoginPageLink); topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT); } topHeaderRightPanel.setWidth("100%"); topHeaderRightPanel.setHeight("60px"); topHeader.setWidth("100%"); topHeader.setHeight("60px"); pageModeContent.addComponent(topHeader); pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER); pageModeContent.addComponent(getBarmenu()); pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER); panel = new Panel(panelName); panel.setSizeFull(); pageModeContent.addComponent(panel); pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE); pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink()); setContent(layout); setWidth(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); setSizeFull(); }
From source file:com.hack23.cia.web.impl.ui.application.views.common.chartfactory.impl.AbstractGhantChartManagerImpl.java
License:Apache License
/** * Creates the role ghant./*from w w w.j av a 2 s. com*/ * * @param roleSummaryLayoutTabsheet * the role summary layout tabsheet * @param assignmentList * the assignment list */ public final void createRoleGhant(final VerticalLayout roleSummaryLayoutTabsheet, final List<T> assignmentList) { final Comparator<T> compare = getComparator(); final List<T> list = assignmentList.stream().filter( x -> new DateTime(getStepMapping().getFromDate(x).getTime()).getYear() > FILTER_DATA_BEFORE_YEAR) .collect(Collectors.toList()); Collections.sort(list, compare); final Gantt createGantt = createGenericGantt(list, getRoleMapping(), getStepMapping()); roleSummaryLayoutTabsheet.addComponent(createGantt); roleSummaryLayoutTabsheet.setExpandRatio(createGantt, ContentRatio.GRID); }
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 addRequestInputFormFields(final FormLayout panelContent, final BeanItem<T> item, final Class<T> beanType, final List<String> displayProperties, final String buttonLabel, final ClickListener buttonListener) { final BeanFieldGroup<T> fieldGroup = new BeanFieldGroup<>(beanType); fieldGroup.setItemDataSource(item);/*from w w w . j av a 2s .c om*/ fieldGroup.setReadOnly(true); for (final String property : displayProperties) { final Field<?> buildAndBind; if (property.contains(HIDDEN_FIELD_NAME)) { buildAndBind = fieldGroup.buildAndBind(property, property, PasswordField.class); } else { buildAndBind = fieldGroup.buildAndBind(property); } buildAndBind.setId(MessageFormat.format("{0}.{1}", buttonLabel, property)); buildAndBind.setReadOnly(false); buildAndBind.setWidth(ContentSize.HALF_SIZE); panelContent.addComponent(buildAndBind); } final Collection<Object> unboundPropertyIds = fieldGroup.getUnboundPropertyIds(); for (final Object property : unboundPropertyIds) { LOGGER.debug(LOG_MSG_PROPERTY, property); } final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth("50%"); final Button button = new Button(buttonLabel, new CommitFormWrapperClickListener(fieldGroup, buttonListener)); button.setId(buttonLabel); button.setWidth("25%"); button.setIcon(FontAwesome.PAW); verticalLayout.addComponent(button); verticalLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT); panelContent.addComponent(verticalLayout); }
From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java
License:Apache License
protected final GridLayout createGridLayout(final VerticalLayout panelContent) { final GridLayout grid = new GridLayout(2, 1); grid.setWidth(100, Unit.PERCENTAGE); grid.setHeight(100, Unit.PERCENTAGE); grid.setColumnExpandRatio(0, 1);//w ww . j a va 2s . c o m grid.setColumnExpandRatio(1, 1); grid.setSpacing(true); panelContent.addComponent(grid); panelContent.setExpandRatio(grid, ContentRatio.LARGE); return grid; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractPageModContentFactoryImpl.java
License:Apache License
/** * Creates the page visit history.// w ww. j a v a 2 s . c om * * @param pageName * the page name * @param pageId * the page id * @param panelContent * the panel content */ protected final void createPageVisitHistory(final String pageName, final String pageId, final VerticalLayout panelContent) { final TabSheet tabsheet = new TabSheet(); tabsheet.setWidth(100, Unit.PERCENTAGE); tabsheet.setHeight(100, Unit.PERCENTAGE); panelContent.addComponent(tabsheet); panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE); final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout(); tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE); tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE); final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory); tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY); adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart( tabContentPageItemRankHistory, pageName, pageId); final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout(); tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE); tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE); final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary); tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT); adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary, pageName); }