public void showHTMLCode(String codeSource) { final DialogBox codePopup = new DialogBox(true, true); codePopup.setGlassEnabled(true); codePopup.setText(constants.showCodeTitle()); String[] lignesCode = codeSource.split("\n"); VerticalPanel tab = new VerticalPanel(); for (String ligneCode : lignesCode) { String maLigne = new String(ligneCode); String[] ligne = ligneCode.split("\t"); for (String texte : ligne) { if (texte.equals("")) { maLigne = " " + maLigne; } } maLigne = maLigne.replace("<", "<"); maLigne = maLigne.replace("div", "<span style='color: blue;'>div</span>"); maLigne = maLigne.replace("id=", "<span style='color: red;'>id</span>="); maLigne = maLigne.replace("class", "<span style='color: red;'>class</span>"); int commentBegin = maLigne.indexOf("<!--"); if (commentBegin != -1) { int commentEnd = maLigne.indexOf("-->"); String comment = maLigne.substring(commentBegin, commentEnd + 3); maLigne = maLigne.replace(comment, "<span style='color: #008000;'>" + comment + "</span>"); } HTML htmlLine = new HTML(maLigne); htmlLine.setStyleName("builder-source"); tab.add(htmlLine); } Button closeButton = new Button( constants.close(), new ClickHandler() { public void onClick(ClickEvent event) { codePopup.hide(); } }); tab.add(closeButton); tab.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); codePopup.add(tab); codePopup.center(); codePopup.show(); }
public void showCloseButtonPanel() { CaptionPanel closePanel = new CaptionPanel(constants.closeTitle()); closePanel.setWidth("185px"); VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); closeButton = new Button(constants.close()); vp.add(closeButton); closePanel.setContentWidget(vp); builderContent.add(closePanel); }