List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder appendEscaped
public SafeHtmlBuilder appendEscaped(String text)
From source file:org.rstudio.studio.client.workbench.views.vcs.common.diff.LineActionButtonRenderer.java
License:Open Source License
public void render(SafeHtmlBuilder builder, String text, String action) { {// www. ja v a 2s. c om builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().button() + " " + ThemeStyles.INSTANCE.handCursor(), "data-action", action)); { builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().left())); builder.appendHtmlConstant("<br/></div>"); builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().center())); { builder.appendEscaped(text); } builder.appendHtmlConstant("</div>"); builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().right())); builder.appendHtmlConstant("<br/></div>"); } builder.appendHtmlConstant("</div>"); } }
From source file:org.uberfire.ext.widgets.common.client.tables.SortableHeader.java
License:Apache License
@Override public void render(Cell.Context context, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<div style='position: relative; cursor: pointer; padding: 0px;'>"); sb.appendHtmlConstant("<span style='padding-right: 10px'>"); sb.appendEscaped(text); sb.appendHtmlConstant("</span>"); // sb.appendHtmlConstant("<div style='position:absolute;right:0px;top:0px;'></div>"); switch (sortDirection) { case NONE:/* w ww . jav a 2 s. co m*/ // nothing break; case ASCENDING: sb.appendHtmlConstant(sortIndex == 0 ? UP_ARROW : SMALL_UP_ARROW); break; case DESCENDING: sb.appendHtmlConstant(sortIndex == 0 ? DOWN_ARROW : SMALL_DOWN_ARROW); break; default: throw new IllegalArgumentException("Unknown sortDirection (" + sortDirection + ")."); } sb.appendHtmlConstant("</div>"); // sb.appendHtmlConstant("<div>"); // sb.appendHtmlConstant("</div></div>"); }
From source file:org.zanata.webtrans.client.ui.ValidationMessagePanelView.java
License:Apache License
@Override public void updateValidationMessages(Map<ValidationAction, List<String>> messages) { if (messages == null || messages.isEmpty()) { clear();/*from www . j av a 2 s . c om*/ return; } this.displayMessages = messages; contents.clear(); int warningCount = 0; int errorCount = 0; for (Entry<ValidationAction, List<String>> entry : messages.entrySet()) { for (String message : entry.getValue()) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendEscaped(message); HTMLPanel liElement = new HTMLPanel("li", builder.toSafeHtml().asString()); liElement.setTitle(entry.getKey().getId().getDisplayName()); if (isErrorLocked(entry.getKey().getRules())) { liElement.addStyleName("txt--danger"); errorCount++; } else { liElement.addStyleName("txt--warning"); warningCount++; } contents.add(liElement); } } headerLabel.setText(this.messages.validationNotificationHeading(warningCount, errorCount)); removeStyleName("is-hidden"); }
From source file:org.zanata.webtrans.client.ui.ValidationWarningPanel.java
License:Open Source License
private void refreshView(Map<ValidationAction, List<String>> errorMessages) { translations.clear();//from w ww .java 2 s . c o m errorList.clear(); saveAsFuzzyOpt = false; for (String target : targets) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(TextContentsDisplay.asSyntaxHighlight(Lists.newArrayList(target)).toSafeHtml()); translations.add(new HTMLPanel("li", builder.toSafeHtml().asString())); } for (List<String> messages : errorMessages.values()) { for (String message : messages) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendEscaped(message); errorList.add(new HTMLPanel("li", builder.toSafeHtml().asString())); } } }
From source file:py.edu.uca.intercajas.client.menumail.Mailboxes.java
License:Apache License
/** * Generates HTML for a tree item with an attached icon. * /*from www . j a v a2 s. c o m*/ * @param imageProto the image prototype to use * @param title the title of the item * @return the resultant HTML */ private SafeHtml imageItemHTML(ImageResource imageProto, String title) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(AbstractImagePrototype.create(imageProto).getSafeHtml()); builder.appendHtmlConstant(" "); builder.appendEscaped(title); return builder.toSafeHtml(); }
From source file:strat.mining.multipool.stats.client.component.cell.DateCell.java
License:Open Source License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, Date value, SafeHtmlBuilder sb) { sb.appendEscaped(dateTimeFormat.format(value)); }
From source file:strat.mining.multipool.stats.client.component.cell.HashrateCell.java
License:Open Source License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, Float value, SafeHtmlBuilder sb) { if (threshold != null && value < threshold) { sb.appendHtmlConstant("<span style=\"color: red;\">" + numberFormat.format(value) + "</span>"); } else {// ww w . j av a 2s . c o m sb.appendEscaped(numberFormat.format(value)); } }
From source file:strat.mining.multipool.stats.client.component.cell.StalerateCell.java
License:Open Source License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, Float value, SafeHtmlBuilder sb) { if (threshold != null && value > threshold) { sb.appendHtmlConstant("<span style=\"color: red;\">" + numberFormat.format(value) + " %</span>"); } else {// www . j a v a 2 s . co m sb.appendEscaped(numberFormat.format(value == null ? 0 : value) + " %"); } }
From source file:strat.mining.multipool.stats.client.component.cell.WorkerNameCell.java
License:Open Source License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) { String[] usernameSplit = value.split("_"); String name = (usernameSplit != null && usernameSplit.length > 1) ? usernameSplit[1] : value; sb.appendEscaped(name); }
From source file:stroom.dashboard.client.table.TablePresenter.java
License:Apache License
private void addColumn(final Field field, final int pos) { final Column<Row, SafeHtml> column = new Column<Row, SafeHtml>(new SafeHtmlCell()) { @Override//from w w w . j av a2 s.com public SafeHtml getValue(final Row row) { if (row == null) { return null; } final List<String> values = row.getValues(); if (values != null) { final String value = values.get(pos); if (value != null) { if (field.getGroup() != null && field.getGroup() >= row.getDepth()) { final SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.appendHtmlConstant("<b>"); sb.appendEscaped(value); sb.appendHtmlConstant("</b>"); return sb.toSafeHtml(); } return SafeHtmlUtils.fromString(value); } } return null; } @Override public String getCellStyleNames(Cell.Context context, Row object) { if (field.getFormat() != null && field.getFormat().getWrap() != null && field.getFormat().getWrap()) { return super.getCellStyleNames(context, object) + " " + getView().getResources().dataGridStyle().dataGridCellWrapText(); } return super.getCellStyleNames(context, object); } }; final FieldHeader fieldHeader = new FieldHeader(fieldsManager, field); fieldHeader.setUpdater(value -> getView().redrawHeaders()); getView().addResizableColumn(column, fieldHeader, field.getWidth()); existingColumns.add(column); }