private WebPanel createInfoPanel(final String content) { WebPanel wplInfo = new WebPanel(); WebFlowLayout wflInfo = (WebFlowLayout) wplInfo.getWebLayout(); wflInfo.getArea().setAlign("left"); MarkupEmbedder wlbContent = new MarkupEmbedder(HTML.NBSP + content); wplInfo.add(wlbContent); return wplInfo; }
private WebPanel createHeadLinePanel() { WebPanel wplHeadLine = new WebPanel(); WebFlowLayout wflHeadLine = (WebFlowLayout) wplHeadLine.getWebLayout(); wflHeadLine.getArea().setAlign("left"); String headline = "<br><b> WebComponentStatistics</b> " + stats.getCreationTime() + "<br><hr>"; MarkupEmbedder wlbHeadline = new MarkupEmbedder(headline); wplHeadLine.add(wlbHeadline); return wplHeadLine; }
/** creates a panel that contains a table with the components counts from the registry. */ private WebPanel createWplComponentTable() { // get the data and init the grid WebPanel wplComponentTable = new WebPanel(); String[] componentCounts = stats.getComponentCountsText(); int size = componentCounts.length; WebGridLayout wglComponentTable = new WebGridLayout(size + 1, 2); wplComponentTable.setWebLayout(wglComponentTable); // the counts for the various types of components for (int i = 0; i < size - 1; i++) { int colonIndex = componentCounts[i].indexOf(":"); int rowNumber = i + 1; Area area = wglComponentTable.getArea(new Position(rowNumber, 1)); area.setAlign("right"); String numComponents = componentCounts[i].substring(0, colonIndex); WebLabel wlbNumComponents = new WebLabel(numComponents.trim()); wplComponentTable.add(wlbNumComponents, new Position(rowNumber, 1)); String cmpName = componentCounts[i].substring(colonIndex + 1).trim(); String nameComponent = "<code> " + cmpName + "</code><br>"; MarkupEmbedder wlbNameComponent = new MarkupEmbedder(nameComponent); wplComponentTable.add(wlbNameComponent, new Position(rowNumber, 2)); } // an empty row Position pos = new Position(size, 1); ((WebTableCell) wglComponentTable.getArea(pos)).setColspan("2"); MarkupEmbedder wlbNbsp = new MarkupEmbedder(HTML.NBSP); wplComponentTable.add(wlbNbsp, pos); // the count for all components altogether pos = new Position(size + 1, 1); wglComponentTable.getArea(pos).setAlign("right"); String compAltogether = String.valueOf(stats.getComponentCountAltogetherText()); int colonIndex = compAltogether.indexOf(":"); String compCount = "<code>" + compAltogether.substring(0, colonIndex) + "</code>"; MarkupEmbedder wlbNumAltogether = new MarkupEmbedder(compCount); wplComponentTable.add(wlbNumAltogether, pos); MarkupEmbedder wlbAltogether = new MarkupEmbedder(" Components altogether in the registry."); wplComponentTable.add(wlbAltogether, new Position(size + 1, 2)); return wplComponentTable; }