List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder SafeHtmlBuilder
public SafeHtmlBuilder()
From source file:nl.ru.languageininteraction.synaesthesia.client.view.ComplexView.java
License:Open Source License
public void addHtmlText(String textString) { HTML html = new HTML(new SafeHtmlBuilder().appendHtmlConstant(textString).toSafeHtml()); outerPanel.add(html);/*from w ww. ja v a 2s .c o m*/ }
From source file:nl.ru.languageininteraction.synaesthesia.client.view.ComplexView.java
License:Open Source License
public void addLink(String label, final String target) { final Anchor anchor = new Anchor(new SafeHtmlBuilder().appendEscapedLines(label).toSafeHtml()); // this link relies on the org.apache.cordova.inappbrowser which offers secure viewing of external html pages and handles user navigation such as back navigation. // in this case the link will be opend in the system browser rather than in the cordova application. outerPanel.add(anchor);// w ww. ja va 2s. c o m final SingleShotEventListner singleShotEventListner = new SingleShotEventListner() { @Override protected void singleShotFired() { Window.open(target, "_system", ""); } }; anchor.addClickHandler(singleShotEventListner); anchor.addTouchStartHandler(singleShotEventListner); anchor.addTouchMoveHandler(singleShotEventListner); anchor.addTouchEndHandler(singleShotEventListner); anchor.addStyleName("pageLink"); }
From source file:nl.ru.languageininteraction.synaesthesia.client.view.MenuView.java
License:Open Source License
public void addMenuItem(final PresenterEventListner menuItemListerner, final boolean menuEnabled) { checkFlexTableExists();/*from ww w. j a v a 2 s . c o m*/ final Button menuButton = new Button( new SafeHtmlBuilder().appendEscapedLines(menuItemListerner.getLabel()).toSafeHtml()); // tableMap.get(flexTable).add(menuButton); menuButton.addStyleName("menuButton"); menuButton.setEnabled(menuEnabled); final SingleShotEventListner singleShotEventListner = new SingleShotEventListner() { @Override protected void singleShotFired() { if (menuButton.isEnabled()) { menuItemListerner.eventFired(menuButton); } } }; menuButton.addClickHandler(singleShotEventListner); menuButton.addTouchStartHandler(singleShotEventListner); menuButton.addTouchMoveHandler(singleShotEventListner); menuButton.addTouchEndHandler(singleShotEventListner); final int rowCount = flexTable.getRowCount(); flexTable.setWidget(rowCount, 0, menuButton); }
From source file:nl.ru.languageininteraction.synaesthesia.client.view.RegisterView.java
License:Open Source License
public void addField(final String displayName, final String value) { if (flexTable == null) { flexTable = new FlexTable(); flexTable.setStylePrimaryName("metadataTable"); outerPanel.add(flexTable);/*w ww. jav a 2 s .com*/ } final int rowCount = flexTable.getRowCount(); flexTable.setWidget(rowCount, 0, new Label(displayName)); flexTable.setWidget(rowCount, 1, new HTML(new SafeHtmlBuilder().appendEscapedLines(value).toSafeHtml())); }
From source file:nl.ru.languageininteraction.synaesthesia.client.view.RegisterView.java
License:Open Source License
public CheckBox addCheckBox(String label) { final CheckBox checkBox = new CheckBox(new SafeHtmlBuilder().appendEscapedLines(label).toSafeHtml()); checkBox.addStyleName("optionCheckBox"); outerPanel.add(checkBox);//from w w w .java2 s . c om return checkBox; }
From source file:org.activityinfo.core.shared.validation.ValidationUtils.java
License:Open Source License
public static void addMessage(String message, DivElement divContainer) { final SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder.appendHtmlConstant(divContainer.getInnerHTML()).appendHtmlConstant("<br/>") .append(SafeHtmlUtils.fromString(message)); divContainer.setInnerHTML(safeHtmlBuilder.toSafeHtml().asString()); }
From source file:org.activityinfo.core.shared.validation.ValidationUtils.java
License:Open Source License
public static void showMessages(List<String> messages, DivElement divContainer) { final SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); for (String message : messages) { safeHtmlBuilder.append(SafeHtmlUtils.fromString(message)).appendHtmlConstant("<br/>"); }/*from w ww .ja v a2 s. com*/ divContainer.setInnerHTML(safeHtmlBuilder.toSafeHtml().asString()); }
From source file:org.activityinfo.ui.client.component.formdesigner.container.FieldWidgetContainer.java
License:Open Source License
public void syncWithModel() { final SafeHtmlBuilder label = new SafeHtmlBuilder(); if (!Strings.isNullOrEmpty(formField.getCode())) { // append code label.appendHtmlConstant("<span class='small'>" + SafeHtmlUtils.fromString(formField.getCode()).asString() + "</span> "); }/* ww w. j av a2s. c o m*/ label.append(SafeHtmlUtils.fromString(Strings.nullToEmpty(formField.getLabel()))); if (formField.isRequired()) { label.append(LABEL_TEMPLATE.mandatoryMarker()); } formFieldWidget.setReadOnly(formField.isReadOnly()); String labelHtml = label.toSafeHtml().asString(); if (!formField.isVisible()) { labelHtml = "<del>" + labelHtml + "</del>"; } widgetContainer.getLabel().setHTML(labelHtml); formFieldWidget.setType(formField.getType()); }
From source file:org.activityinfo.ui.client.component.table.InstanceTableHeaderBuilder.java
License:Open Source License
private void buildActionRow(int row, int columnCount) { AbstractCellTable.Style style = getTable().getResources().style(); TableRowBuilder tr = startRow();/*from ww w .j ava 2s . c o m*/ setTrWidth(tr, row); TableCellBuilder th = tr.startTH().colSpan(columnCount).className(style.header()); setTdWidth(th, row, 0); final SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.append(SafeHtmlUtils.fromString(table.getRootFormClass().getLabel())); sb.append(SafeHtmlUtils.fromTrustedString(" ")); for (TableHeaderAction buttonAction : table.getHeaderActions()) { final ButtonActionCell cell = new ButtonActionCell(buttonAction); cell.render(new Cell.Context(row, 0, table), "", sb); sb.append(SafeHtmlUtils.fromTrustedString(" ")); } th.html(sb.toSafeHtml()); th.endTH(); tr.endTR(); }
From source file:org.activityinfo.ui.client.page.entry.column.AdminColumnRenderer.java
License:Open Source License
private Object render(SiteDTO model) { StringBuilder qtip = new StringBuilder(); SafeHtmlBuilder summary = new SafeHtmlBuilder(); // we use this set to keep track of names that we've added // to the summary to avoid duplication that is common between // territories, zones de sante, provinces and districts, etc seen.clear();/*from w w w .ja v a2 s.c om*/ int summaryLines = 0; for (AdminLevelDTO level : levels) { AdminEntityDTO entity = model.getAdminEntity(level.getId()); if (entity != null) { String name = entity.getName(); if (qtip.length() > 0) { qtip.append("<br>"); } qtip.append(level.getName()).append(": ").append(name); if (summaryLines < 3 && !seen.contains(name)) { if (summaryLines > 0) { summary.appendHtmlConstant("<br/>"); } summary.appendEscaped(name); seen.add(name); summaryLines++; } } } // return summary.toSafeHtml().asString(); return ColumnTemplates.INSTANCE.adminCell(qtip.toString(), summary.toSafeHtml()).asString(); }