@Test public void testGridTemplateCreateForDiagramsCase12() { final List<CampaignDashboardElement> dashboardElements = new ArrayList<>(); dashboardElements.add(new CampaignDashboardElement("d1", null, 1, 30, 60)); dashboardElements.add(new CampaignDashboardElement("d2", null, 2, 30, 60)); dashboardElements.add(new CampaignDashboardElement("d3", null, 3, 70, 90)); final String expectedResult = "'d1 d1 d1 d2 d2 d2 area0 area0 area0 area0''d1 d1 d1 d2 d2 d2 area1 area1 area1 area1''d3 d3 d3 d3 d3 d3 d3 area2 area2 area2''d3 d3 d3 d3 d3 d3 d3 area3 area3 area3''d3 d3 d3 d3 d3 d3 d3 area4 area4 area4'"; Assert.assertEquals(expectedResult, new GridTemplateAreaCreator(dashboardElements).getFormattedGridTemplate()); }
public String getFormattedGridTemplate() { final StringBuilder result = new StringBuilder(); for (int x = 0; x < nrOfGridAreaRows; x++) { if (rowIsNull(x, nrOfGridAreaColumns)) { continue; } else { result.append(APOSTROPHE); for (int y = 0; y < nrOfGridAreaColumns; y++) { final String diagramId = grid[y][x]; final String area = diagramId != null ? diagramId : ("area" + x); result.append(area + (y == nrOfGridAreaColumns - 1 ? StringUtils.EMPTY : StringUtils.SPACE)); } result.append(APOSTROPHE); } } return result.toString(); }
GridTemplateAreaCreator { public String getFormattedGridTemplate() { final StringBuilder result = new StringBuilder(); for (int x = 0; x < nrOfGridAreaRows; x++) { if (rowIsNull(x, nrOfGridAreaColumns)) { continue; } else { result.append(APOSTROPHE); for (int y = 0; y < nrOfGridAreaColumns; y++) { final String diagramId = grid[y][x]; final String area = diagramId != null ? diagramId : ("area" + x); result.append(area + (y == nrOfGridAreaColumns - 1 ? StringUtils.EMPTY : StringUtils.SPACE)); } result.append(APOSTROPHE); } } return result.toString(); } }
GridTemplateAreaCreator { public String getFormattedGridTemplate() { final StringBuilder result = new StringBuilder(); for (int x = 0; x < nrOfGridAreaRows; x++) { if (rowIsNull(x, nrOfGridAreaColumns)) { continue; } else { result.append(APOSTROPHE); for (int y = 0; y < nrOfGridAreaColumns; y++) { final String diagramId = grid[y][x]; final String area = diagramId != null ? diagramId : ("area" + x); result.append(area + (y == nrOfGridAreaColumns - 1 ? StringUtils.EMPTY : StringUtils.SPACE)); } result.append(APOSTROPHE); } } return result.toString(); } GridTemplateAreaCreator(List<CampaignDashboardElement> dashboardElements); }
GridTemplateAreaCreator { public String getFormattedGridTemplate() { final StringBuilder result = new StringBuilder(); for (int x = 0; x < nrOfGridAreaRows; x++) { if (rowIsNull(x, nrOfGridAreaColumns)) { continue; } else { result.append(APOSTROPHE); for (int y = 0; y < nrOfGridAreaColumns; y++) { final String diagramId = grid[y][x]; final String area = diagramId != null ? diagramId : ("area" + x); result.append(area + (y == nrOfGridAreaColumns - 1 ? StringUtils.EMPTY : StringUtils.SPACE)); } result.append(APOSTROPHE); } } return result.toString(); } GridTemplateAreaCreator(List<CampaignDashboardElement> dashboardElements); String getFormattedGridTemplate(); Integer getGridContainerHeight(); Integer getWidthsSum(); Integer getGridColumns(); int getGridRows(); }
GridTemplateAreaCreator { public String getFormattedGridTemplate() { final StringBuilder result = new StringBuilder(); for (int x = 0; x < nrOfGridAreaRows; x++) { if (rowIsNull(x, nrOfGridAreaColumns)) { continue; } else { result.append(APOSTROPHE); for (int y = 0; y < nrOfGridAreaColumns; y++) { final String diagramId = grid[y][x]; final String area = diagramId != null ? diagramId : ("area" + x); result.append(area + (y == nrOfGridAreaColumns - 1 ? StringUtils.EMPTY : StringUtils.SPACE)); } result.append(APOSTROPHE); } } return result.toString(); } GridTemplateAreaCreator(List<CampaignDashboardElement> dashboardElements); String getFormattedGridTemplate(); Integer getGridContainerHeight(); Integer getWidthsSum(); Integer getGridColumns(); int getGridRows(); static final String APOSTROPHE; }