List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder appendEscaped
public SafeHtmlBuilder appendEscaped(String text)
From source file:org.obiba.opal.web.gwt.app.client.ui.GroupSuggestOracle.java
License:Open Source License
@Override public void requestSuggestions(final Request request, final Callback callback) { String originalQuery = request.getQuery(); if (originalQuery == null || originalQuery.trim().isEmpty()) return;//from ww w . ja v a2 s . c o m final String query = originalQuery; // Get groups candidates from search words. ResourceRequestBuilderFactory.<JsArray<GroupDto>>newBuilder() .forResource(UriBuilders.GROUPS.create().build()).get() .withCallback(com.google.gwt.http.client.Response.SC_BAD_REQUEST, ResponseCodeCallback.NO_OP)// .withCallback(new ResourceCallback<JsArray<GroupDto>>() { @Override public void onResource(com.google.gwt.http.client.Response response, JsArray<GroupDto> resources) { if (response.getStatusCode() == com.google.gwt.http.client.Response.SC_OK) { List<GroupSuggestion> suggestions = new ArrayList<GroupSuggestion>(); for (int i = 0; i < resources.length(); i++) { if (resources.get(i).getName().toLowerCase().contains(query.toLowerCase())) { suggestions.add(convertToFormattedSuggestions(query, resources.get(i))); } } // Convert candidates to suggestions. Response r = new Response(suggestions); callback.onSuggestionsReady(request, r); } } private GroupSuggestion convertToFormattedSuggestions(String query, GroupDto group) { SafeHtmlBuilder accum = new SafeHtmlBuilder(); accum.appendEscaped(group.getName()); return createSuggestion(query, accum.toSafeHtml().asString(), group.getName()); } })// .send(); }
From source file:org.obiba.opal.web.gwt.app.client.ui.TableVariableSuggestOracle.java
License:Open Source License
@Override protected VariableSuggestion convertToFormattedSuggestions(String query, Map<String, String> attributes) { SafeHtmlBuilder accum = new SafeHtmlBuilder(); accum.appendHtmlConstant("<span class='variable-search-suggest-box'>"); accum.appendHtmlConstant("<strong>"); accum.appendEscaped(attributes.get("name")); accum.appendHtmlConstant("</strong>"); if (attributes.containsKey("label")) { accum.appendHtmlConstant("<br>"); String label = attributes.get("label"); if (label.length() > LABEL_MAX_SIZE) { label = label.substring(0, LABEL_MAX_SIZE) + " ..."; }//from www . j a v a2s. c om accum.appendEscaped(label); } accum.appendHtmlConstant("</span>"); return createSuggestion(query, accum.toSafeHtml().asString(), attributes.get("datasource"), attributes.get("table"), attributes.get("name")); }
From source file:org.obiba.opal.web.gwt.app.client.ui.VariableSuggestOracle.java
License:Open Source License
protected VariableSuggestion convertToFormattedSuggestions(String query, Map<String, String> attributes) { SafeHtmlBuilder accum = new SafeHtmlBuilder(); String prefix = attributes.get("datasource") + "." + attributes.get("table"); String name = attributes.get("name"); accum.appendHtmlConstant("<span class='variable-search-suggest-box' id='" + prefix + "." + name + "'>"); accum.appendHtmlConstant("<strong>"); accum.appendEscaped(name); accum.appendHtmlConstant("</strong>"); accum.appendHtmlConstant(" <i>"); accum.appendEscaped(prefix);/*from ww w. jav a 2 s.c o m*/ accum.appendHtmlConstant("</i>"); if (attributes.containsKey("label")) { accum.appendHtmlConstant("<br>"); String label = attributes.get("label"); if (label.length() > LABEL_MAX_SIZE) { label = label.substring(0, LABEL_MAX_SIZE) + " ..."; } accum.appendEscaped(label); } accum.appendHtmlConstant("</span>"); return createSuggestion(query, accum.toSafeHtml().asString(), attributes.get("datasource"), attributes.get("table"), name); }
From source file:org.openelis.modules.sample1.client.ResultCell.java
License:Open Source License
public SafeHtml bulkRender(Object value) { SafeHtmlBuilder builder; builder = new SafeHtmlBuilder(); builder.appendEscaped(display(value)); return builder.toSafeHtml(); }
From source file:org.openelis.modules.worksheetCompletion1.client.WorksheetResultCell.java
License:Open Source License
public SafeHtml bulkRender(Object value) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendEscaped(display(value)); return builder.toSafeHtml(); }
From source file:org.openelis.ui.widget.table.AutoCompleteCell.java
License:Open Source License
public SafeHtml bulkRender(Object value) { SafeHtmlBuilder builder; builder = new SafeHtmlBuilder(); builder.appendEscaped(display(value)); return builder.toSafeHtml(); }
From source file:org.openelis.ui.widget.table.DropdownCell.java
License:Open Source License
public SafeHtml bulkRender(Object value) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); query = false;/*ww w . ja v a 2 s .c o m*/ editor.setQueryMode(false); builder.appendEscaped(display(value)); return builder.toSafeHtml(); }
From source file:org.openremote.modeler.client.utils.CheckboxCellHeader.java
License:Open Source License
@Override public void render(Context context, SafeHtmlBuilder sb) { super.render(context, sb.appendEscaped("")); }
From source file:org.pepstock.jem.gwt.client.panels.administration.nodesconfig.NodeCell.java
License:Open Source License
@Override public void render(Context context, NodeInfoBean value, SafeHtmlBuilder sb) { if (value != null) { sb.appendHtmlConstant("<table cellpadding=0 cellspacing=0><tr><td style='padding: 5px 3px 1px 3px;'>"); sb.appendEscaped(value.getLabel()); sb.appendHtmlConstant("</td></tr><tr><td style='font-size: 0.7em; padding: 1px 3px 5px 3px;'>"); sb.appendEscaped(value.getHostname()); sb.appendHtmlConstant("</td></tr></table>"); }/*from w ww. j a v a2s .com*/ }
From source file:org.pepstock.jem.gwt.client.panels.nodes.commons.inspector.JobNameCell.java
License:Open Source License
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { if (value != null) { sb.appendHtmlConstant("<table cellpadding=0 cellspacing=0><tr><td style='padding: 5px 3px 1px 3px;'>"); sb.appendEscaped(value); sb.appendHtmlConstant("</td></tr></table>"); }//from w w w.j av a 2 s.com }