List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder append
public SafeHtmlBuilder append(SafeHtml html)
From source file:org.drools.guvnor.client.widgets.drools.decoratedgrid.CheckboxCellImpl.java
License:Apache License
@Override public void render(Context context, Boolean value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); Boolean viewData = getViewData(key); if (viewData != null && viewData.equals(value)) { clearViewData(key);//from w w w .j a v a2s .c o m viewData = null; } if (value != null && ((viewData != null) ? viewData : value)) { if (isReadOnly) { sb.append(READ_ONLY_INPUT_CHECKED); } else { sb.append(INPUT_CHECKED); } } else { if (isReadOnly) { sb.append(READ_ONLY_INPUT_UNCHECKED); } else { sb.append(INPUT_UNCHECKED); } } }
From source file:org.drools.guvnor.client.widgets.drools.explorer.ArtifactDependenciesExplorerWidget.java
License:Apache License
private void addItem(final TreeItem root, final MavenArtifact artifact, final Collection<MavenArtifact> unchecked) { final SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.append(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(images.modelAsset()).getHTML())); sb.appendEscaped(" ").appendEscaped(artifact.toLabel()); final CheckBox checkBox = new CheckBox(sb.toSafeHtml()); if (!unchecked.contains(artifact)) { checkBox.setValue(true);/*ww w. j a va 2s . c om*/ } final TreeItem newTreeItem = root.addItem(checkBox); newTreeItem.setUserObject(artifact); if (artifact.hasChild()) { for (MavenArtifact chilldren : artifact.getChild()) { addItem(newTreeItem, chilldren, unchecked); } } checkBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final CheckBox me = ((CheckBox) event.getSource()); boolean checked = me.getValue(); if (newTreeItem.getChildCount() > 0) { for (int i = 0; i < newTreeItem.getChildCount(); i++) { defineState(newTreeItem.getChild(i), checked); } } } private void defineState(TreeItem currentItem, boolean checked) { ((CheckBox) currentItem.getWidget()).setValue(checked); if (currentItem.getChildCount() > 0) { for (int i = 0; i < currentItem.getChildCount(); i++) { defineState(currentItem.getChild(i), checked); } } } }); }
From source file:org.drools.guvnor.client.widgets.drools.tables.SnapshotComparisonTypeCell.java
License:Apache License
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { sb.append(template.comparisonType(getClassName(value), getTextToRender(value))); }
From source file:org.drools.guvnor.client.widgets.drools.wizards.assets.decisiontable.cells.ActionInsertFactFieldCell.java
License:Apache License
@Override public void render(Context context, ActionInsertFactCol52 value, SafeHtmlBuilder sb) { StringBuilder b = new StringBuilder(); appendHeader(b, value);//from ww w.ja v a 2s. co m b.append(value.getFactField()); sb.append(TEMPLATE.text(getCssStyleName(value), b.toString())); }
From source file:org.drools.guvnor.client.widgets.drools.wizards.assets.decisiontable.cells.ActionInsertFactFieldPatternCell.java
License:Apache License
@Override public void render(Context context, ActionInsertFactFieldsPattern value, SafeHtmlBuilder sb) { String binding = value.getBoundName(); StringBuilder b = new StringBuilder(); if (binding == null || "".equals(binding)) { b.append(value.getFactType());//from ww w.ja va 2s . c o m } else { b.append(value.getBoundName()); b.append(" : "); b.append(value.getFactType()); } sb.append(TEMPLATE.text(getCssStyleName(value), b.toString())); }
From source file:org.drools.guvnor.client.widgets.drools.wizards.assets.decisiontable.cells.ActionSetFieldCell.java
License:Apache License
@Override public void render(Context context, ActionSetFieldCol52 value, SafeHtmlBuilder sb) { StringBuilder b = new StringBuilder(); appendHeader(b, value);/* w w w. j av a 2s. c o m*/ b.append(value.getFactField()); sb.append(TEMPLATE.text(getCssStyleName(value), b.toString())); }
From source file:org.drools.guvnor.client.widgets.drools.wizards.assets.decisiontable.cells.AvailableFieldCell.java
License:Apache License
@Override public void render(Context context, AvailableField value, SafeHtmlBuilder sb) { StringBuilder b = new StringBuilder(); b.append(value.getName());/*from ww w .java 2 s . c o m*/ if (value.getCalculationType() == BaseSingleFieldConstraint.TYPE_LITERAL || value.getCalculationType() == BaseSingleFieldConstraint.TYPE_RET_VALUE) { appendType(b, value); } sb.append(TEMPLATE.text(b.toString())); }
From source file:org.drools.guvnor.client.widgets.drools.wizards.assets.decisiontable.cells.ConditionCell.java
License:Apache License
@Override public void render(Context context, ConditionCol52 value, SafeHtmlBuilder sb) { StringBuilder b = new StringBuilder(); switch (value.getConstraintValueType()) { case BaseSingleFieldConstraint.TYPE_LITERAL: makeLiteral(b, value);/*from w w w . j a v a2 s . c o m*/ break; case BaseSingleFieldConstraint.TYPE_RET_VALUE: makeFormula(b, value); break; case BaseSingleFieldConstraint.TYPE_PREDICATE: makePredicate(b, value); } sb.append(TEMPLATE.text(getCssStyleName(value), b.toString())); }
From source file:org.drools.guvnor.client.widgets.drools.wizards.assets.decisiontable.cells.PatternCell.java
License:Apache License
@Override public void render(Context context, Pattern52 pattern, SafeHtmlBuilder sb) { String binding = pattern.getBoundName(); StringBuilder b = new StringBuilder(); if (binding == null || "".equals(binding)) { b.append(pattern.getFactType()); } else {/*w w w .jav a 2 s . com*/ b.append(pattern.getBoundName()); b.append(" : "); b.append(pattern.getFactType()); } sb.append(TEMPLATE.text(getCssStyleName(pattern), b.toString())); }
From source file:org.drools.guvnor.client.widgets.tables.ComparableImageResourceCell.java
License:Apache License
@Override public void render(Context context, ComparableImageResource value, SafeHtmlBuilder sb) { if (value != null) { // The template will sanitize the URI. sb.append(SafeHtmlUtils.fromTrustedString(value.getImageHTML())); }/*from ww w .j a v a2s .c om*/ }