List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder toSafeHtml
public SafeHtml toSafeHtml()
From source file:org.aksw.TripleCheckMate.client.widgets.EvaluationTable.java
License:Apache License
private void createTable() { // Link to data provider dataProvider.addDataDisplay(tblEvalTriples); // Table properties tblEvalTriples.setPageSize(arrPagerSizes[0]); // Set Pagers (add both bottom and top) pgrTop.setDisplay(tblEvalTriples);//from w ww .ja va 2s . co m pgrBottom.setDisplay(tblEvalTriples); // Table columns final SafeHtmlCell cellP = new SafeHtmlCell(); Column<EvaluateItem, SafeHtml> colPred = new Column<EvaluateItem, SafeHtml>(cellP) { public SafeHtml getValue(EvaluateItem item) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.appendHtmlConstant(item.P.toHTMLString()); return sb.toSafeHtml(); } }; tblEvalTriples.addColumn(colPred, "Predicate"); final SafeHtmlCell cellO = new SafeHtmlCell(); Column<EvaluateItem, SafeHtml> colObj = new Column<EvaluateItem, SafeHtml>(cellO) { public SafeHtml getValue(EvaluateItem item) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.appendHtmlConstant(item.O.toHTMLString()); return sb.toSafeHtml(); } }; tblEvalTriples.addColumn(colObj, "Object"); Column<EvaluateItem, Boolean> colIsValid = new Column<EvaluateItem, Boolean>( new CheckboxCell(true, false)) { public Boolean getValue(EvaluateItem item) { return item.isWrong; } }; tblEvalTriples.addColumn(colIsValid, "Is Wrong"); // Add a field updater to be notified when the user enters a new name. colIsValid.setFieldUpdater(new FieldUpdater<EvaluateItem, Boolean>() { public void update(int index, EvaluateItem object, Boolean value) { dataProvider.getList().get(index).isWrong = value; if (value == false) { dataProvider.getList().get(index).errorTittle = ""; tblEvalTriples.redraw(); } else { dlgEdit.setEvaluateItem(dataProvider.getList().get(index), true); dlgEdit.center(); dlgEdit.show(); } } }); tblEvalTriples.addCellPreviewHandler(new CellPreviewEvent.Handler<EvaluateItem>() { long lastClick = -1000; public void onCellPreview(CellPreviewEvent<EvaluateItem> event) { long clictAt = System.currentTimeMillis(); if (event.getNativeEvent().getType().contains("click")) { if (clictAt - lastClick < 600) { // dblclick on 2 clicks detected within 300 ms int index = event.getIndex(); dlgEdit.setEvaluateItem(dataProvider.getList().get(index), false); dlgEdit.center(); dlgEdit.show(); } lastClick = System.currentTimeMillis(); } } }); final SafeHtmlCell cellError = new SafeHtmlCell(); Column<EvaluateItem, SafeHtml> colError = new Column<EvaluateItem, SafeHtml>(cellError) { public SafeHtml getValue(EvaluateItem item) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.appendHtmlConstant(item.errorTittle); return sb.toSafeHtml(); } }; tblEvalTriples.addColumn(colError, "Error"); // Setup sorting colPred.setSortable(true); sortHandler.setComparator(colPred, new Comparator<EvaluateItem>() { public int compare(EvaluateItem o1, EvaluateItem o2) { return o1.P.toString().compareTo(o2.P.toString()); } }); colObj.setSortable(true); sortHandler.setComparator(colObj, new Comparator<EvaluateItem>() { public int compare(EvaluateItem o1, EvaluateItem o2) { return o1.P.toString().compareTo(o2.P.toString()); } }); colIsValid.setSortable(true); sortHandler.setComparator(colIsValid, new Comparator<EvaluateItem>() { public int compare(EvaluateItem o1, EvaluateItem o2) { if (o1.isWrong == o2.isWrong) return 0; else return (o1.isWrong ? 1 : -1); } }); colError.setSortable(true); sortHandler.setComparator(colError, new Comparator<EvaluateItem>() { public int compare(EvaluateItem o1, EvaluateItem o2) { return o1.errorTittle.compareTo(o2.errorTittle); } }); tblEvalTriples.addColumnSortHandler(sortHandler); tblEvalTriples.getColumnSortList().push(colObj); tblEvalTriples.getColumnSortList().push(colPred); for (int i = 0; i < arrPagerSizes.length; i++) { lstPager.addItem("" + arrPagerSizes[i]); } lstPager.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { tblEvalTriples.setPageSize(arrPagerSizes[lstPager.getSelectedIndex()]); } }); }
From source file:org.aksw.TripleCheckMate.client.widgets.UserStatisticsTable.java
License:Apache License
private void createTable() { // Link to data provider dataProvider.addDataDisplay(tblUserStats); // Table properties tblUserStats.setWidth("100%"); tblUserStats.setPageSize(50);/*from www. j a v a 2 s. c o m*/ // Table columns Column<UserRecord, SafeHtml> colUserName = new Column<UserRecord, SafeHtml>(new SafeHtmlCell()) { public SafeHtml getValue(UserRecord item) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.appendHtmlConstant(item.toHTMLString()); return sb.toSafeHtml(); } }; tblUserStats.addColumn(colUserName, "User"); colUserName.setSortable(true); sortHandler.setComparator(colUserName, new Comparator<UserRecord>() { public int compare(UserRecord o1, UserRecord o2) { return o1.name.compareTo(o2.name); } }); Column<UserRecord, String> colRes = new Column<UserRecord, String>(new TextCell()) { public String getValue(UserRecord object) { // TODO Auto-generated method stub return "" + object.recordCount; } }; tblUserStats.addColumn(colRes, "Resources"); colRes.setSortable(true); sortHandler.setComparator(colRes, new Comparator<UserRecord>() { public int compare(UserRecord o1, UserRecord o2) { Integer a1 = new Integer(o1.recordCount); Integer a2 = new Integer(o2.recordCount); return a1.compareTo(a2); } }); Column<UserRecord, String> colTriples = new Column<UserRecord, String>(new TextCell()) { public String getValue(UserRecord object) { // TODO Auto-generated method stub return "" + object.errorCount; } }; tblUserStats.addColumn(colTriples, "Wrong Triples"); colTriples.setSortable(true); sortHandler.setComparator(colTriples, new Comparator<UserRecord>() { public int compare(UserRecord o1, UserRecord o2) { Integer a1 = new Integer(o1.errorCount); Integer a2 = new Integer(o2.errorCount); return a1.compareTo(a2); } }); Column<UserRecord, String> colErrorTypes = new Column<UserRecord, String>(new TextCell()) { public String getValue(UserRecord object) { // TODO Auto-generated method stub return "" + object.distinctErrorCount; } }; tblUserStats.addColumn(colErrorTypes, "Error Types"); colErrorTypes.setSortable(true); sortHandler.setComparator(colErrorTypes, new Comparator<UserRecord>() { public int compare(UserRecord o1, UserRecord o2) { Integer a1 = new Integer(o1.distinctErrorCount); Integer a2 = new Integer(o2.distinctErrorCount); return a1.compareTo(a2); } }); tblUserStats.addColumnSortHandler(sortHandler); tblUserStats.getColumnSortList().push(colTriples); tblUserStats.getColumnSortList().push(colRes); }
From source file:org.apache.hupa.client.ui.MessagesCellTable.java
License:Apache License
protected Column<Message, SafeHtml> getFromColumn() { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x10x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x10x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x00x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x00x0"); return new Column<Message, SafeHtml>(new SafeHtmlCell()) { @Override/* ww w . ja v a 2 s . c o m*/ public SafeHtml getValue(Message object) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x3_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x20x0"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x00x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x00x10x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x00x1"); SafeHtmlBuilder sb = new SafeHtmlBuilder(); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x10x00x00x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x10x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x10x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x10x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x10x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x10x0"); sb.append(SafeHtmlUtils.fromString(object.getFrom() == null ? "" : object.getFrom())); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5556067aee0x20x00x00x2c87156fe0x30x20x0"); return sb.toSafeHtml(); } }; }
From source file:org.apache.hupa.client.ui.MessagesCellTable.java
License:Apache License
protected Column<Message, SafeHtml> getSubjectColumn() { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x10x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x10x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac008"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x00x2"); return new Column<Message, SafeHtml>(new SafeHtmlCell()) { @Override/*from w w w . j a va2 s.c o m*/ public SafeHtml getValue(Message object) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x3_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x20x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x0"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x00x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x00x10x00x0"); SafeHtmlBuilder sb = new SafeHtmlBuilder(); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x10x00x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x10x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x10x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x10x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x10x00x00x00x0_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x10x00x00x00x1_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x1"); sb.append(SafeHtmlUtils.fromString(object.getSubject() == null ? "" : object.getSubject())); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x2_____org_apache_hupa_client_ui_MessagesCellTable_java0x0f2ab3f5530cac0080x20x00x00x2c87156fe0x30x20x0"); return sb.toSafeHtml(); } }; }
From source file:org.appverse.web.framework.frontend.gwt.theme.bluetouch.client.button.AppverseWebButtonCellDefaultAppearance.java
License:sencha.com license
@Override public void render(final ButtonCell<C> cell, Context context, C value, SafeHtmlBuilder sb) { String constantHtml = cell.getHTML(); boolean hasConstantHtml = constantHtml != null && constantHtml.length() != 0; boolean isBoolean = value != null && value instanceof Boolean; // is a boolean always a toggle button? String text = hasConstantHtml ? cell.getText() : (value != null && !isBoolean) ? SafeHtmlUtils.htmlEscape(value.toString()) : ""; ImageResource icon = cell.getIcon(); IconAlign iconAlign = cell.getIconAlign(); String cls = style.button();// w w w . j a v a2 s. co m String arrowCls = ""; if (cell.getMenu() != null) { if (cell instanceof SplitButtonCell) { switch (cell.getArrowAlign()) { case RIGHT: arrowCls = style.split(); break; case BOTTOM: arrowCls = style.splitBottom(); break; } } else { switch (cell.getArrowAlign()) { case RIGHT: arrowCls = style.arrow(); break; case BOTTOM: arrowCls = style.arrowBottom(); break; } } } ButtonScale scale = cell.getScale(); switch (scale) { case SMALL: cls += " " + style.small(); break; case MEDIUM: cls += " " + style.medium(); break; case LARGE: cls += " " + style.large(); break; } SafeStylesBuilder stylesBuilder = new SafeStylesBuilder(); int width = -1; if (cell.getWidth() != -1) { int w = cell.getWidth(); if (w < cell.getMinWidth()) { w = cell.getMinWidth(); } stylesBuilder.appendTrustedString("width:" + w + "px;"); cls += " " + style.hasWidth() + " x-has-width"; width = w; } else { if (cell.getMinWidth() != -1) { TextMetrics.get().bind(style.text()); int length = TextMetrics.get().getWidth(text); length += 6; // frames if (icon != null) { switch (iconAlign) { case LEFT: case RIGHT: length += icon.getWidth(); break; } } if (cell.getMinWidth() > length) { stylesBuilder.appendTrustedString("width:" + cell.getMinWidth() + "px;"); cls += " " + style.hasWidth() + " x-has-width"; width = cell.getMinWidth(); } } } final int height = cell.getHeight(); if (height != -1) { stylesBuilder.appendTrustedString("height:" + height + "px;"); } if (icon != null) { switch (iconAlign) { case TOP: arrowCls += " " + style.iconTop(); break; case BOTTOM: arrowCls += " " + style.iconBottom(); break; case LEFT: arrowCls += " " + style.iconLeft(); break; case RIGHT: arrowCls += " " + style.iconRight(); break; } } else { arrowCls += " " + style.noIcon(); } // toggle button if (value == Boolean.TRUE) { cls += " " + frame.pressedClass(); } sb.append(templates.outer(cls, new SafeStylesBuilder().toSafeStyles())); SafeHtmlBuilder inside = new SafeHtmlBuilder(); String innerWrap = arrowCls; if (GXT.isIE6() || GXT.isIE7()) { arrowCls += " " + CommonStyles.get().inlineBlock(); } inside.appendHtmlConstant("<div class='" + innerWrap + "'>"); inside.appendHtmlConstant("<table cellpadding=0 cellspacing=0 class='" + style.mainTable() + "'>"); if (icon != null) { switch (iconAlign) { case LEFT: inside.appendHtmlConstant("<tr>"); writeIcon(inside, icon, height); if (text != null) { int w = width - (icon != null ? icon.getWidth() : 0) - 4; writeText(inside, text, w, height); } inside.appendHtmlConstant("</tr>"); break; case RIGHT: inside.appendHtmlConstant("<tr>"); if (text != null) { int w = width - (icon != null ? icon.getWidth() : 0) - 4; writeText(inside, text, w, height); } writeIcon(inside, icon, height); inside.appendHtmlConstant("</tr>"); break; case TOP: inside.appendHtmlConstant("<tr>"); writeIcon(inside, icon, height); inside.appendHtmlConstant("</tr>"); if (text != null) { inside.appendHtmlConstant("<tr>"); writeText(inside, text, width, height); inside.appendHtmlConstant("</tr>"); } break; case BOTTOM: if (text != null) { inside.appendHtmlConstant("<tr>"); writeText(inside, text, width, height); inside.appendHtmlConstant("</tr>"); } inside.appendHtmlConstant("<tr>"); writeIcon(inside, icon, height); inside.appendHtmlConstant("</tr>"); break; } } else { inside.appendHtmlConstant("<tr>"); if (text != null) { writeText(inside, text, width, height); } inside.appendHtmlConstant("</tr>"); } inside.appendHtmlConstant("</table>"); inside.appendHtmlConstant("</div>"); frame.render(sb, new Frame.FrameOptions(0, CommonStyles.get().noFocusOutline(), stylesBuilder.toSafeStyles()), inside.toSafeHtml()); sb.appendHtmlConstant("</div>"); }
From source file:org.daxplore.presenter.client.ui.PerspectiveQuestionsPanel.java
License:Open Source License
private PerspectiveQuestionsPanel(QuestionMetadata questions, Perspectives perspectives, UITexts uiTexts, PrefixProperties prefixProperties) { Label header = new Label(uiTexts.pickSelectionGroupHeader()); header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); header.addStyleName("daxplore-PerspectiveQuestionList-header"); this.add(header); perspectiveList = new Tree(); for (String questionID : perspectives.getQuestionIDs()) { SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendEscaped(questions.getShortText(questionID)); if (questions.hasSecondary(questionID)) { html.appendHtmlConstant(" <span class=\"super\">"); html.appendEscaped(prefixProperties.getSecondaryFlagText()); html.appendHtmlConstant("</span>"); }//from w w w .j av a2 s . c o m QuestionTreeItem item = new QuestionTreeItem(html.toSafeHtml(), questionID); perspectiveList.addItem(item); } this.add(perspectiveList); setWidth("100%"); setPerspective(perspectives.getQuestionIDs().get(0), false); }
From source file:org.daxplore.presenter.client.ui.QuestionPanel.java
License:Open Source License
@Inject protected QuestionPanel(QuestionMetadata questions, Groups groups, EventBus eventBus, UITexts uiTexts, UIResources uiResources, PrefixProperties prefixProperties) { this.eventBus = eventBus; treeRoot = new Tree(uiResources, false); Label header = new Label(uiTexts.pickAQuestionHeader()); header.addStyleName("daxplore-QuestionPanel-header"); vp.add(header);/*from w w w .j a v a2 s . c om*/ vp.setCellHeight(header, "30px"); // Set up questiontree treeRoot.addSelectionHandler(new QuestionSelectionHandler()); treeRoot.addOpenHandler(new GroupOpenHandler()); for (int i = 0; i < groups.getGroupCount(); i++) { String txt = groups.getGroupName(i); SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant("<span class=\"daxplore-QuestionPanel-branch\"> "); html.appendEscaped(txt); html.appendHtmlConstant(" </span>"); GroupItem gr = new GroupItem(html.toSafeHtml()); List<String> qlist = groups.getQuestionIDs(i); for (String q : qlist) { html = new SafeHtmlBuilder(); html.appendHtmlConstant(" "); html.appendEscaped(questions.getShortText(q)); if (questions.hasSecondary(q)) { html.appendHtmlConstant(" <span class=\"super\">"); html.appendEscaped(prefixProperties.getSecondaryFlagText()); html.appendHtmlConstant("</span>"); } html.appendHtmlConstant(" "); QuestionTreeItem qi = new QuestionTreeItem(html.toSafeHtml(), q); qi.setTitle(questions.getFullText(q)); gr.addItem(qi); } treeRoot.addItem(gr); } vp.add(treeRoot); vp.setCellVerticalAlignment(treeRoot, HasVerticalAlignment.ALIGN_TOP); vp.setWidth("100%"); initWidget(vp); QueryUpdateEvent.register(eventBus, this); }
From source file:org.drools.guvnor.client.decisiontable.widget.auditlog.AuditLogEntryCellHelper.java
License:Apache License
private SafeHtml getSafeHtml(final InsertRowAuditLogEntry event) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.append(TEMPLATE// w ww. j a va 2 s . c o m .commentHeader(Constants.INSTANCE.DecisionTableAuditLogInsertRowAt0(event.getRowIndex() + 1))); return sb.toSafeHtml(); }
From source file:org.drools.guvnor.client.decisiontable.widget.auditlog.AuditLogEntryCellHelper.java
License:Apache License
private SafeHtml getSafeHtml(final DeleteRowAuditLogEntry event) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.append(TEMPLATE/*from ww w. j a v a 2s .c om*/ .commentHeader(Constants.INSTANCE.DecisionTableAuditLogDeleteRowAt0(event.getRowIndex() + 1))); return sb.toSafeHtml(); }
From source file:org.drools.guvnor.client.decisiontable.widget.auditlog.AuditLogEntryCellHelper.java
License:Apache License
private SafeHtml getSafeHtml(final InsertColumnAuditLogEntry event) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); buildColumnDetailsInsert(event.getDetails(), sb); return sb.toSafeHtml(); }