List of usage examples for com.vaadin.ui AbstractOrderedLayout setSizeUndefined
@Override public void setSizeUndefined()
From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java
License:Open Source License
public static AbstractOrderedLayout buildRegionLegend(boolean vertical, CaseMeasure caseMeasure, boolean emptyPopulationDistrictPresent, BigDecimal districtShapesLowerQuartile, BigDecimal districtShapesMedian, BigDecimal districtShapesUpperQuartile) { AbstractOrderedLayout regionLegendLayout = vertical ? new VerticalLayout() : new HorizontalLayout(); regionLegendLayout.setSpacing(true); CssStyles.style(regionLegendLayout, CssStyles.LAYOUT_MINIMAL); regionLegendLayout.setSizeUndefined(); HorizontalLayout legendEntry;/*w w w . j a va 2 s . c om*/ switch (caseMeasure) { case CASE_COUNT: legendEntry = buildMapIconLegendEntry("lowest-region-small", districtShapesLowerQuartile.compareTo(BigDecimal.ONE) > 0 ? "1 - " + districtShapesLowerQuartile + " " + I18nProperties.getString(Strings.entityCases) : "1 " + I18nProperties.getString(Strings.entityCase)); break; case CASE_INCIDENCE: legendEntry = buildMapIconLegendEntry("lowest-region-small", "<= " + DataHelper.getTruncatedBigDecimal(districtShapesLowerQuartile) + " " + I18nProperties.getString(Strings.entityCases) + " / " + DistrictDto.CASE_INCIDENCE_DIVISOR); break; default: throw new IllegalArgumentException(caseMeasure.toString()); } regionLegendLayout.addComponent(legendEntry); if (districtShapesLowerQuartile.compareTo(districtShapesMedian) < 0) { switch (caseMeasure) { case CASE_COUNT: legendEntry = buildMapIconLegendEntry("low-region-small", districtShapesMedian.compareTo(districtShapesLowerQuartile.add(BigDecimal.ONE)) > 0 ? districtShapesLowerQuartile.add(BigDecimal.ONE) + " - " + districtShapesMedian + " " + I18nProperties.getString(Strings.entityCases) : districtShapesMedian + " " + I18nProperties.getString(Strings.entityCases)); break; case CASE_INCIDENCE: legendEntry = buildMapIconLegendEntry("low-region-small", DataHelper .getTruncatedBigDecimal(districtShapesLowerQuartile.add(new BigDecimal(0.1)) .setScale(1, RoundingMode.HALF_UP)) + " - " + DataHelper.getTruncatedBigDecimal(districtShapesMedian) + " " + I18nProperties.getString(Strings.entityCases) + " / " + DistrictDto.CASE_INCIDENCE_DIVISOR); break; default: throw new IllegalArgumentException(caseMeasure.toString()); } regionLegendLayout.addComponent(legendEntry); } if (districtShapesMedian.compareTo(districtShapesUpperQuartile) < 0) { switch (caseMeasure) { case CASE_COUNT: legendEntry = buildMapIconLegendEntry("high-region-small", districtShapesUpperQuartile.compareTo(districtShapesMedian.add(BigDecimal.ONE)) > 0 ? districtShapesMedian.add(BigDecimal.ONE) + " - " + districtShapesUpperQuartile + " " + I18nProperties.getString(Strings.entityCases) : districtShapesUpperQuartile + " " + I18nProperties.getString(Strings.entityCases)); break; case CASE_INCIDENCE: legendEntry = buildMapIconLegendEntry("high-region-small", DataHelper.getTruncatedBigDecimal( districtShapesMedian.add(new BigDecimal(0.1)).setScale(1, RoundingMode.HALF_UP)) + " - " + DataHelper.getTruncatedBigDecimal(districtShapesUpperQuartile) + " " + I18nProperties.getString(Strings.entityCases) + " / " + DistrictDto.CASE_INCIDENCE_DIVISOR); break; default: throw new IllegalArgumentException(caseMeasure.toString()); } regionLegendLayout.addComponent(legendEntry); } switch (caseMeasure) { case CASE_COUNT: legendEntry = buildMapIconLegendEntry("highest-region-small", "> " + districtShapesUpperQuartile + " " + I18nProperties.getString(Strings.entityCases)); break; case CASE_INCIDENCE: legendEntry = buildMapIconLegendEntry("highest-region-small", "> " + DataHelper.getTruncatedBigDecimal(districtShapesUpperQuartile) + " " + I18nProperties.getString(Strings.entityCases) + " / " + DistrictDto.CASE_INCIDENCE_DIVISOR); break; default: throw new IllegalArgumentException(caseMeasure.toString()); } regionLegendLayout.addComponent(legendEntry); if (caseMeasure == CaseMeasure.CASE_INCIDENCE && emptyPopulationDistrictPresent) { legendEntry = buildMapIconLegendEntry("no-population-region-small", I18nProperties.getCaption(Captions.dashboardNoPopulationData)); regionLegendLayout.addComponent(legendEntry); } return regionLegendLayout; }