List of usage examples for com.vaadin.client Util escapeHTML
@Deprecated public static String escapeHTML(String html)
From source file:annis.gui.widgets.gwt.client.ui.VAnnotationGrid.java
License:Apache License
private void addRow(UIDL row, int rowNumber) { String caption = row.getStringAttribute("caption"); boolean showNamespace = row.getBooleanAttribute("show-namespace"); String name;// w w w. j a va 2s . c o m if (showNamespace) { name = caption; } else { String[] captionSplit = caption.split("::"); name = captionSplit[captionSplit.length - 1]; } boolean showCaption = row.getBooleanAttribute("show-caption"); int startColumn = 0; if (showCaption) { table.setHTML(rowNumber, 0, Util.escapeHTML(name)); formatter.addStyleName(rowNumber, 0, "header"); startColumn = 1; } int colspanOffset = 0; UIDL events = row.getChildByTagName("events"); for (int j = 0; j < events.getChildCount(); j++) { UIDL event = events.getChildUIDL(j); String id = event.getStringAttribute("id"); int left = event.getIntAttribute("left"); int right = event.getIntAttribute("right"); String value = event.getStringAttribute("value"); if (escapeHTML) { value = Util.escapeHTML(value); } // +1 because we also have a caption column, subtract columns we // jumped over by using colspan int col = left + startColumn - colspanOffset; table.setHTML(rowNumber, col, value); if (event.hasAttribute("tooltip")) { Element tdElement = table.getCellFormatter().getElement(rowNumber, col); tdElement.setTitle(event.getStringAttribute("tooltip")); } position2id.put(new Position(rowNumber, col), id); int colspan = right - left + 1; formatter.setColSpan(rowNumber, col, colspan); if (colspan > 1) { colspanOffset += (colspan - 1); } addStyleForEvent(event, rowNumber, col); } }
From source file:com.eternach.client.RichOptionGroupWidget.java
License:Apache License
@Override public void buildOptions(final UIDL uidl) { panel.clear();//from w w w . java 2s . c om optionsEnabled.clear(); for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) { boolean iconDisplayed = false; final UIDL opUidl = (UIDL) it.next(); CheckBox op; String itemHtml = opUidl.getStringAttribute("caption"); if (!htmlContentAllowed) { itemHtml = Util.escapeHTML(itemHtml); } final String icon = opUidl.getStringAttribute("icon"); if (icon != null && icon.length() != 0) { final String iconUrl = client.translateVaadinUri(icon); itemHtml = "<span style=\"white-space: normal;\">" + itemHtml + "</span><br/><img src=\"" + iconUrl + "\" class=\"" + Icon.CLASSNAME + "\" alt=\"\" />"; iconDisplayed = true; } if (isMultiselect()) { op = new VCheckBox(); } else { op = new RadioButton(paintableId, null, true); op.setStyleName("v-radiobutton"); } op.addStyleName(CLASSNAME_OPTION); op.setValue(opUidl.getBooleanAttribute("selected")); final boolean optionEnabled = !opUidl .getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED); final boolean enabled = optionEnabled && !isReadonly() && isEnabled(); op.setEnabled(enabled); optionsEnabled.add(optionEnabled); setStyleName(op.getElement(), ApplicationConnection.DISABLED_CLASSNAME, !(optionEnabled && isEnabled())); op.addClickHandler(this); optionsToKeys.put(op, opUidl.getStringAttribute("key")); String description = opUidl.getStringAttribute("description-text"); if (description == null) { description = ""; } if (opUidl.getStringAttribute("description-icon") != null) { description += "<br/><img src=\"" + client.translateVaadinUri(opUidl.getStringAttribute("description-icon")) + "\"\\>"; } final FocusableFlexTable table = new FocusableFlexTable(); table.setWidget(0, 0, op); table.setHTML(0, 1, itemHtml); table.setCellPadding(0); table.setCellSpacing(0); panel.add(table); if (description != null && description.length() != 0) { elementsToDescription.put(table.getElement(), description); } if (iconDisplayed) { Util.sinkOnloadForImages(table.getElement()); table.addHandler(iconLoadHandler, LoadEvent.getType()); } } }
From source file:org.vaadin.tltv.multiscrolltable.client.ui.Cell.java
License:Apache License
protected void formatValue() { if (getWidget() instanceof HTML) { ((HTML) getWidget())//from w w w. jav a 2 s. co m .setText((value != null) ? Util.escapeHTML(String.valueOf(value)) : Util.escapeHTML(" ")); } }