@Override public void buttonClick(Button.ClickEvent event) { if (event.getButton().equals(btnSubmit)) { try { bodyField.commit(); binder.commit(); comment = binder.getItemDataSource().getBean(); Comment newComment = HybridbpmUI.getCommentAPI().saveComment(comment); ((AbstractOrderedLayout)getParent()).addComponent(new CommentViewLayout(newComment), ((AbstractOrderedLayout)getParent()).getComponentIndex(this)); if (deleteOnSave){ ((AbstractOrderedLayout)getParent()).removeComponent(this); } else { bodyField.setValue(null); } } catch (Exception ex) { Notification.show("Error", ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); Logger.getLogger(CommentFormLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } } }
@Override public void createDocumentHistoryChartByOrg(final AbstractOrderedLayout content, final String org) { final String searchOrg = org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING) .replace(MINUS_SIGN, EMPTY_STRING).trim(); final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); final Map<String, List<ViewRiksdagenOrgDocumentDailySummary>> allMap = getViewRiksdagenOrgDocumentDailySummaryMap(); final List<ViewRiksdagenOrgDocumentDailySummary> itemList = allMap.get(searchOrg); if (itemList != null) { addDocumentHistoryByOrgData(dataSeries, series, itemList); } addChart(content, DOCUMENT_HISTORY_BY_ORG, new DCharts().setDataSeries(dataSeries) .setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
@Override public void createDocumentHistoryPartyChart(final AbstractOrderedLayout content,final String org) { final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); final Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> allMap = getViewRiksdagenPartyDocumentDailySummaryMap(); final List<ViewRiksdagenPartyDocumentDailySummary> itemList = allMap .get(org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim()); if (itemList != null) { final Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> map = itemList.parallelStream() .filter(Objects::nonNull).collect(Collectors.groupingBy( t -> StringUtils.defaultIfBlank(t.getEmbeddedId().getDocumentType(), NO_INFO))); addDocumentHistoryByPartyData(dataSeries, series, map); } addChart(content, DOCUMENT_HISTORY_PARTY,new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
@Override public void createDocumentTypeChart(final AbstractOrderedLayout content) { final Map<String, List<ViewRiksdagenDocumentTypeDailySummary>> map = getDocumentTypeMap(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final SimpleDateFormat parseInputDateFormat = new SimpleDateFormat("yyyy-MM-dd"); final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); for (final Entry<String, List<ViewRiksdagenDocumentTypeDailySummary>> entry : map.entrySet()) { if (entry.getKey() != null && !EMPTY_STRING.equals(entry.getKey())) { addDataSeries(simpleDateFormat, parseInputDateFormat, dataSeries, series, entry); } } addChart(content, "Document type", new DCharts().setDataSeries(dataSeries) .setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
private void addOrderedLayoutComponents(AbstractOrderedLayout container, Element element, SlideContainerPresenter presenter, Supplier<Unit> unitsGetter, Supplier<Float> sizeGetter, Consumer<String> sizeSetter) { DocumentUtility.getContainerComponents(element, ValidationSets.VALID_CONTAINER_CHILDREN).stream() .map(m -> createComponentFromElement(m, presenter)).filter(Objects::nonNull).forEach(e -> { Component component = e.getComponent(); container.addComponent(component); container.setComponentAlignment(component, e.getAlignment()); if (Objects.nonNull(unitsGetter) && Objects.nonNull(sizeGetter) && Objects.nonNull(sizeSetter)) { float ratio = 1.0f; if (unitsGetter.get() == Unit.PERCENTAGE) { ratio = sizeGetter.get() / 100; sizeSetter.accept("100%"); } container.setExpandRatio(component, ratio); } }); }
/** * Add a spacer to the given layout that will expand automatically. * * @param layout * The layout to add the spacer to */ public static Spacer addToLayout(AbstractOrderedLayout layout) { Objects.requireNonNull(layout, "Layout may not be null"); Spacer spacer = new Spacer(); layout.addComponent(spacer); layout.setExpandRatio(spacer, 1); return spacer; }
private final void init() { if (content instanceof AbstractOrderedLayout) { ((AbstractOrderedLayout) content).setSpacing(true); ((AbstractOrderedLayout) content).setMargin(true); } if (content instanceof GridLayout) { addStyleName("marginTop"); } if (content != null) { mainLayout.addComponent(content); mainLayout.setExpandRatio(content, 1.0F); } createMandatoryLabel(); final HorizontalLayout buttonLayout = createActionButtonsLayout(); mainLayout.addComponent(buttonLayout); mainLayout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER); setCaption(caption); setCaptionAsHtml(true); setContent(mainLayout); setResizable(false); center(); setModal(true); addStyleName("fontsize"); setOrginaleValues(); addComponentListeners(); }
@Override public void createIndicatorChart(final AbstractOrderedLayout content,final List<WorldBankData> list, final ViewWorldbankIndicatorDataCountrySummary summary) { final Map<Country, List<WorldBankData>> countryIndicatorsMap = list.stream() .collect(Collectors.groupingBy(WorldBankData::getCountry, Collectors.toList())); final Series series = new Series(); final DataSeries dataSeries = new DataSeries(); for (final Entry<Country, List<WorldBankData>> entry : countryIndicatorsMap.entrySet() ) { series.addSeries(new XYseries().setLabel(entry.getKey().getValue())); dataSeries.newSeries(); for (final WorldBankData item : entry.getValue()) { if (item != null && item.getYearDate() != null && item.getDataValue() != null && !item.getDataValue().isEmpty()) { dataSeries.add(item.getYearDate() + "-01-01", Float.valueOf(item.getDataValue())); } } } addChart(content,summary.getIndicatorName(), new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsCountryLineChart(series)).show(), false); }
/** * Adds the chart. * * @param content * the content * @param caption * the caption * @param chart * the chart * @param fullPage * the full page */ protected final void addChart(final AbstractOrderedLayout content,final String caption, final DCharts chart, final boolean fullPage) { final HorizontalLayout horizontalLayout = new HorizontalLayout(); final int browserWindowWidth = getChartWindowWidth(); final int browserWindowHeight = getChartWindowHeight(fullPage); horizontalLayout.setWidth(browserWindowWidth, Unit.PIXELS); horizontalLayout.setHeight(browserWindowHeight, Unit.PIXELS); horizontalLayout.setMargin(true); horizontalLayout.setSpacing(false); horizontalLayout.addStyleName("v-layout-content-overview-panel-level1"); final Panel formPanel = new Panel(); formPanel.setSizeFull(); formPanel.setContent(horizontalLayout); formPanel.setCaption(caption); content.addComponent(formPanel); content.setExpandRatio(formPanel, ContentRatio.LARGE); chart.setWidth(100, Unit.PERCENTAGE); chart.setHeight(100, Unit.PERCENTAGE); chart.setMarginRight(CHART_RIGHT_MARGIN); chart.setMarginLeft(CHART_LEFT_MARGIN); chart.setMarginBottom(CHART_BOTTOM_MARGIN_SIZE); chart.setMarginTop(CHART_TOP_MARGIN_SIZE); horizontalLayout.addComponent(chart); chart.setCaption(caption); }
@Override public void createMinistryGovernmentBodyHeadcountSummaryChart(final AbstractOrderedLayout content, final String name) { final Map<Integer, List<GovernmentBodyAnnualSummary>> map = esvApi.getDataPerMinistry(name); final List<String> governmentBodyNames = esvApi.getGovernmentBodyNames(name); final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); for (final String govBodyName : governmentBodyNames) { series.addSeries(new XYseries().setLabel(govBodyName)); dataSeries.newSeries(); for (final Entry<Integer, List<GovernmentBodyAnnualSummary>> entry : map.entrySet()) { final List<GovernmentBodyAnnualSummary> item = entry.getValue(); final Integer totalHeadcount = item.stream().filter(p -> p.getName().equalsIgnoreCase(govBodyName)) .collect(Collectors.summingInt(GovernmentBodyAnnualSummary::getHeadCount)); if (entry.getKey() != null && item != null && totalHeadcount > 0) { dataSeries.add(FIRST_OF_JAN + entry.getKey(), totalHeadcount); } } } addChart(content, name + ANNUAL_HEADCOUNT_SUMMARY_ALL_GOVERNMENT_BODIES, new DCharts().setDataSeries(dataSeries) .setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true); }
@Override public void createChart(final Tab tab,final AbstractOrderedLayout content,final ViewRiksdagenVoteDataBallotSummary viewRiksdagenVoteDataBallotSummary) { final DataSeries dataSeries = new DataSeries(); dataSeries.newSeries().add("Yes", viewRiksdagenVoteDataBallotSummary.getYesVotes()); dataSeries.newSeries().add("No", viewRiksdagenVoteDataBallotSummary.getNoVotes()); dataSeries.newSeries().add("Abstain", viewRiksdagenVoteDataBallotSummary.getAbstainVotes()); dataSeries.newSeries().add("Absent", viewRiksdagenVoteDataBallotSummary.getAbsentVotes()); final String caption = "Summary : " +viewRiksdagenVoteDataBallotSummary.getEmbeddedId().getIssue() + " " + viewRiksdagenVoteDataBallotSummary.getEmbeddedId().getConcern(); tab.setCaption(caption); addChart(content,caption, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsDonoutChart()).show(), true); }
@Override public void createChart(final Tab tab,final AbstractOrderedLayout content,final List<ViewRiksdagenVoteDataBallotPartySummary> partyList) { final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); series.addSeries(new XYseries().setLabel("Yes")); series.addSeries(new XYseries().setLabel("No")); series.addSeries(new XYseries().setLabel("Abstain")); series.addSeries(new XYseries().setLabel("Absent")); String caption=null; for (final ViewRiksdagenVoteDataBallotPartySummary viewRiksdagenVoteDataBallotPartySummary : partyList) { if (caption == null) { caption = "Party Summary : " + viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getIssue() + " " + viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getConcern(); content.setCaption(caption); tab.setCaption(caption); } dataSeries.newSeries() .add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()), viewRiksdagenVoteDataBallotPartySummary.getPartyYesVotes()) .add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()),viewRiksdagenVoteDataBallotPartySummary.getPartyNoVotes()) .add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()),viewRiksdagenVoteDataBallotPartySummary.getPartyAbstainVotes()) .add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()),viewRiksdagenVoteDataBallotPartySummary.getPartyAbsentVotes()); } addChart(content,caption + " ( 4 circles Yes/No/Abstain/Absent votes by party )", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsDonoutChartWithSeries(series)).show(), true); }
@Override public void createApplicationActionEventPageDailySummaryChart(final AbstractOrderedLayout content) { final Map<String, List<ViewApplicationActionEventPageDailySummary>> map = getApplicationActionEventPageDailySummaryMap(); final DataSeries dataSeries = new DataSeries(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final Series series = new Series(); for (final Entry<String, List<ViewApplicationActionEventPageDailySummary>> entry : map.entrySet()) { if (entry.getKey() != null) { series.addSeries(new XYseries().setLabel(entry.getKey())); dataSeries.newSeries(); final List<ViewApplicationActionEventPageDailySummary> list = entry.getValue(); for (final ViewApplicationActionEventPageDailySummary viewRiksdagenVoteDataBallotPartySummaryDaily : list) { if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) { dataSeries.add(simpleDateFormat.format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getCreatedDate()), viewRiksdagenVoteDataBallotPartySummaryDaily.getHits()); } } } } addChart(content,"Application Action Events daily Summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true); }
@Override public void createApplicationActionEventPageModeDailySummaryChart(final AbstractOrderedLayout content,final String page) { final Map<String, List<ViewApplicationActionEventPageModeDailySummary>> map = getApplicationActionEventPageModeDailySummaryMap(page); final DataSeries dataSeries = new DataSeries(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final Series series = new Series(); for (final Entry<String, List<ViewApplicationActionEventPageModeDailySummary>> entry : map.entrySet()) { if (entry.getKey() != null) { series.addSeries(new XYseries().setLabel(entry.getKey())); dataSeries.newSeries(); final List<ViewApplicationActionEventPageModeDailySummary> list = entry.getValue(); for (final ViewApplicationActionEventPageModeDailySummary item : list) { if (item != null) { dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getCreatedDate()), item.getHits()); } } } } addChart(content,"Page Action Events daily Summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true); }
@Override public void createDecisionTypeChart(final AbstractOrderedLayout content) { final Map<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> map = getCommitteeDecisionTypeMap(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> entry : map.entrySet()) { if (entry.getKey() != null) { series.addSeries(new XYseries().setLabel(entry.getKey())); dataSeries.newSeries(); final List<ViewRiksdagenCommitteeDecisionTypeDailySummary> list = entry.getValue(); for (final ViewRiksdagenCommitteeDecisionTypeDailySummary item : list) { if (item != null) { dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()), item.getTotal()); } } } } addChart(content,"Decision type daily summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
/** * Creates the party ballot chart. * * @param dataValueCalculator * the data value calculator * @return the d charts */ private void createPartyBallotChart(final AbstractOrderedLayout content,final DataValueCalculator dataValueCalculator) { final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> map = getPartyMap(); final DataSeries dataSeries = new DataSeries(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final Series series = new Series(); for (final Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> entry : map.entrySet()) { if (!"-".equals(entry.getKey())) { series.addSeries(new XYseries().setLabel(getPartyName(entry.getKey()))); dataSeries.newSeries(); final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> list = entry.getValue(); for (final ViewRiksdagenVoteDataBallotPartySummaryDaily viewRiksdagenVoteDataBallotPartySummaryDaily : list) { if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) { dataSeries.add( simpleDateFormat .format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getVoteDate()), dataValueCalculator.getDataValue(viewRiksdagenVoteDataBallotPartySummaryDaily)); } } } } addChart(content,"Party ballot chart", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
@Override public <T extends Serializable> void createBasicBeanItemGrid(final AbstractOrderedLayout panelContent,final Class<T> dataType, final List<T> datasource, final String caption, final String[] columnOrder, final String[] hideColumns, final AbstractPageItemRendererClickListener<?> listener, final String actionId, final ListPropertyConverter[] collectionPropertyConverters) { createBasicBeanItemNestedPropertiesGrid(panelContent,dataType,datasource, caption, null, columnOrder, hideColumns, listener, actionId, collectionPropertyConverters); }
/** * Add component to detail-container. */ public void addDetailComponent(Component c, int index) { if(mainPanel.getContent() instanceof AbstractOrderedLayout) { ((AbstractOrderedLayout) mainPanel.getContent()).addComponent(c, index); } else { throw new UnsupportedOperationException("Cannot add components indexed component, detail content is not AbstractOrderedLayout"); } }
/** * Set expand-ratio of detail-component */ public void setDetailExpandRatio(Component component, float ratio) { if(mainPanel.getContent() instanceof AbstractOrderedLayout) { ((AbstractOrderedLayout) mainPanel.getContent()).setExpandRatio(component, ratio); } else { throw new UnsupportedOperationException("Cannot set ExpandRatio, detail content is not AbstractOrderedLayout"); } }
protected AbstractOrderedLayout createMainContainer() { VerticalLayout mainComponentContainer = new VerticalLayout(); mainComponentContainer.setSizeFull(); mainComponentContainer.setMargin(false); table = createTable(); return mainComponentContainer; }
public void addComponentToParent(VisualTreeNode parent, VisualTreeNode child) throws ElementFactoryException { if (parent.getComponent() instanceof AbstractComponentContainer) { Component childComponent = child.getComponent(); AbstractComponentContainer parentContainer = parent.getComponent(); parentContainer.addComponent(childComponent); if (parentContainer instanceof AbstractOrderedLayout) { Alignment alignment = parseAlignment(child.getAdditionalParameter("alignment", "MIDDLE_LEFT")); ((AbstractOrderedLayout) parentContainer).setComponentAlignment(childComponent, alignment); } } }
private static void setLayoutSpacing(AbstractOrderedLayout component, Map<String, String> properties) { // TODO how to handle with spacing value? // int value = stringMap.getInteger(SlideXmlConstants.SPACING, -1); // if (value > 0) boolean value = ConversionUtility.getBooleanOrDefault(properties.get(DocumentConstants.SPACING), false); component.setSpacing(value); }
/** * Try to imitate a HorizalGlue of Swing BoxLayout. * A invisible component that get all extra space. * @param layout layout to add glue */ public static void addHorizontalGlue(AbstractOrderedLayout layout) { Label label = new Label(); label.setWidth("100%"); layout.addComponent(label); layout.setExpandRatio(label, 1.0f); }
/** * Try to imitate a VerticalGlue of Swing BoxLayout */ public static void addVerticalGlue(AbstractOrderedLayout layout) { Label label = new Label(" "); label.setHeight("100%"); layout.addComponent(label); layout.setExpandRatio(label, 1.0f); }
/** * Try to imitate HorizontalStruct on Swing BoxLayout * @param layout Layout to add the struct * @param width struct withd */ public static void addHorizontalStruct(AbstractOrderedLayout layout, int width) { Label label = new Label(); label.setWidth(width + "px"); layout.addComponent(label); layout.setExpandRatio(label, 0f); }
/** * Try to imitate VerticalStruct of Swing BoxLayout * @param layout layout to add struct * @param height struct height */ public static void addVerticalStruct(AbstractOrderedLayout layout, int height) { Label label = new Label(); label.setHeight(height + "px"); layout.addComponent(label); layout.setExpandRatio(label, 0f); }
private void initializeLayout(AbstractOrderedLayout layout) { layout.setImmediate(false); layout.setWidth("100%"); layout.setHeight("-1px"); layout.setMargin(false); }
public void setLayoutStyle(AbstractOrderedLayout page) { // Center align layout page.setWidth("100%"); page.setMargin(new MarginInfo(false, true)); }
protected AbstractOrderedLayout getContent() { return (AbstractOrderedLayout) component.getComponent(0); }
protected AbstractOrderedLayout getComponentContent() { return ((AbstractOrderedLayout) component.getContent()); }
@Override public AbstractOrderedLayout createGridHeader() { return new RolloutGroupTargetsListHeader(eventBus, i18n, rolloutUIState); }
@Override public AbstractOrderedLayout createGridHeader() { return new RolloutListHeader(permissionChecker, rolloutUIState, eventBus, rolloutManagement, targetManagement, uiNotification, uiProperties, entityFactory, i18n, targetFilterQueryManagement, rolloutGroupManagement, quotaManagement); }
/** * Creates the paging controls. * * @param content * the content * @param name * the name * @param pageId * the page id * @param size * the size * @param pageNr * the page nr * @param resultPerPage * the result per page */ protected final void createPagingControls(final AbstractOrderedLayout content, final String name, final String pageId, final int size, final int pageNr, final int resultPerPage) { final HorizontalLayout pagingControls = new HorizontalLayout(); pagingControls.setSpacing(true); pagingControls.setMargin(true); final int maxPages = (size +resultPerPage-1) / resultPerPage; final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(PAGE_HEADER) .append(pageNr) .append(PAGE_SEPARATOR) .append(maxPages) .append(PAGES_TOTAL_RESULTS) .append(size) .append(RESULTS_PER_PAGE) .append(resultPerPage) .append(SHOW); final Label pageInfo = new Label(stringBuilder.toString()); pagingControls.addComponent(pageInfo); pagingControls.setExpandRatio(pageInfo, ContentRatio.SMALL); if (pageNr > PAGE_ONE) { addPagingLink(PREVIOUS_PAGE,name, pageId, pageNr -1,pagingControls); } if (maxPages > PAGE_ONE && pageNr < maxPages) { addPagingLink(NEXT_PAGE,name, pageId, pageNr +1,pagingControls); } if (maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr > PAGE_ONE) { addPagingLink(FIRST_PAGE,name, pageId, 1,pagingControls); } if (maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr < maxPages) { addPagingLink(LAST_PAGE,name, pageId, maxPages,pagingControls); } content.addComponent(pagingControls); content.setExpandRatio(pagingControls, ContentRatio.SMALL2); }
@Override public void createPersonDocumentHistoryChart(final AbstractOrderedLayout content,final String personId) { final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> allMap = getViewRiksdagenPoliticianDocumentDailySummaryMap(); final List<ViewRiksdagenPoliticianDocumentDailySummary> itemList = allMap .get(personId.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim()); if (itemList != null) { final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> map = itemList.parallelStream() .filter(Objects::nonNull).collect(Collectors.groupingBy( t -> StringUtils.defaultIfBlank(t.getEmbeddedId().getDocumentType(), NO_INFO))); addDocumentHistoryByPersonData(simpleDateFormat, dataSeries, series, map); } addChart(content,DOCUMENT_HISTORY, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
@Override public void createPersonLineChart(final AbstractOrderedLayout content,final String personId) { final List<ViewRiksdagenVoteDataBallotPoliticianSummaryDaily> list = dataChartManager.findByValue(personId); final Series series = new Series().addSeries(new XYseries().setLabel(WON)) .addSeries(new XYseries().setLabel(PARTY_REBEL)).addSeries(new XYseries().setLabel(ABSENT)) .addSeries(new XYseries().setLabel(NUMBER_BALLOTS)); final DataSeries dataSeries = new DataSeries().newSeries(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); if (list != null) { addPoliticianIndicatorData(list, dataSeries, simpleDateFormat); } addChart(content,"Ballot indicators", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsPersonLineChart(series)).show(), true); }
@Override public void createDecisionTypeChart(final AbstractOrderedLayout content,final String org) { final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH); final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> allMap = getCommitteeDecisionTypeOrgMap(); final List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary> itemList = allMap .get(org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim()); if (itemList != null) { final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> map = itemList.parallelStream() .filter(t -> t != null && t.getEmbeddedId().getDecisionDate() != null) .collect(Collectors.groupingBy(t -> t.getEmbeddedId().getDecisionType())); addDecisionTypeByOrgData(simpleDateFormat, dataSeries, series, map); } addChart(content,"Org Decision type daily summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true); }
@Override public void createPartyAgeChart(final AbstractOrderedLayout content) { createPartyBallotChart(content,viewRiksdagenVoteDataBallotPartySummaryDaily -> DateUtils.toCalendar(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getVoteDate()).get(Calendar.YEAR) - viewRiksdagenVoteDataBallotPartySummaryDaily.getPartyAvgBornYear().intValue()); }
@Override protected AbstractOrderedLayout createMainContainer() { AbstractOrderedLayout main = super.createMainContainer(); form = createForm(); return main; }