@Test public void testGridTemplateCreateForDiagramsCase3() { final List<CampaignDashboardElement> dashboardElements = new ArrayList<>(); dashboardElements.add(new CampaignDashboardElement("d1", null, 1, 50, 50)); dashboardElements.add(new CampaignDashboardElement("d2", null, 2, 50, 50)); dashboardElements.add(new CampaignDashboardElement("d3", null, 3, 50, 50)); dashboardElements.add(new CampaignDashboardElement("d4", null, 4, 50, 50)); dashboardElements.add(new CampaignDashboardElement("d5", null, 5, 50, 50)); dashboardElements.add(new CampaignDashboardElement("d6", null, 6, 50, 50)); final String expectedResult = "'d1 d2''d3 d4''d5 d6'"; 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; }