List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder append
public SafeHtmlBuilder append(SafeHtml html)
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.repositories.CheckboxCell.java
License:Apache License
@Override public void render(final Context context, final Boolean value, final SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); Boolean viewData = getViewData(key); if (viewData != null && viewData.equals(value)) { clearViewData(key);// w w w . jav a 2 s .com viewData = null; } if (value != null && ((viewData != null) ? viewData : value)) { sb.append(isEnabled() ? INPUT_CHECKED_ENABLED : INPUT_CHECKED_DISABLED); } else { sb.append(isEnabled() ? INPUT_UNCHECKED_ENABLED : INPUT_UNCHECKED_DISABLED); } }
From source file:org.kie.workbench.common.services.refactoring.client.usages.ShowAssetUsagesDisplayerViewViewImpl.java
License:Apache License
private void initTable() { usedByTable.columnPickerButton.setVisible(true); usedByFilesProvider.addDataDisplay(usedByTable); Column<Path, String> nameColumn = new TextColumn<Path>() { @Override/* w w w . j av a 2s. c om*/ public String getValue(Path row) { return row != null ? row.getFileName() : null; } @Override public void render(Cell.Context context, Path object, SafeHtmlBuilder sb) { final String currentValue = getValue(object); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("<div title=\"")); sb.append(SafeHtmlUtils.fromString(currentValue)); sb.append(SafeHtmlUtils.fromTrustedString("\">")); } super.render(context, object, sb); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("</div>")); } } }; usedByTable.addColumn(nameColumn, translationService.getTranslation(RefactoringConstants.ShowAssetUsagesDisplayerViewViewImplName)); Column<Path, String> assetType = new TextColumn<Path>() { @Override public String getValue(Path row) { return row != null ? presenter.getAssetType(row) : null; } @Override public void render(Cell.Context context, Path object, SafeHtmlBuilder sb) { final String currentValue = getValue(object); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("<div title=\"")); sb.append(SafeHtmlUtils.fromString(currentValue)); sb.append(SafeHtmlUtils.fromTrustedString("\">")); } super.render(context, object, sb); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("</div>")); } } }; usedByTable.addColumn(assetType, translationService .getTranslation(RefactoringConstants.ShowAssetUsagesDisplayerViewViewImplAssetType)); Column<Path, String> pathColumn = new TextColumn<Path>() { @Override public String getValue(Path row) { String pathStr = null; if (row != null && row.getFileName() != null) { pathStr = row.toURI().substring(0, row.toURI().lastIndexOf('/')); } return pathStr; } @Override public void render(Cell.Context context, Path object, SafeHtmlBuilder sb) { final String currentValue = getValue(object); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("<div title=\"")); sb.append(SafeHtmlUtils.fromString(currentValue)); sb.append(SafeHtmlUtils.fromTrustedString("\">")); } super.render(context, object, sb); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("</div>")); } } }; usedByTable.addColumn(pathColumn, translationService.getTranslation(RefactoringConstants.ShowAssetUsagesDisplayerViewViewImplPath)); }
From source file:org.kie.workbench.common.services.verifier.reporting.client.panel.AnalysisLineCell.java
License:Apache License
@Override public void render(final Context context, final Issue issue, final SafeHtmlBuilder safeHtmlBuilder) { safeHtmlBuilder.append(TEMPLATE.text(getStyleName(issue.getSeverity()), getIcon(issue.getSeverity()), getLineNumbers(issue.getRowNumbers()), ExplanationProvider.toTitle(issue))); }
From source file:org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.widget.NotificationWidgetViewImpl.java
License:Apache License
private void initDelete() { AbstractCell<NotificationRow> buttonCell = new AbstractCell<NotificationRow>( ClickEvent.getType().getName()) { @Override// w ww. ja v a 2s . c om public void render(Context context, NotificationRow value, SafeHtmlBuilder sb) { Button button = new Button(); button.setSize(ButtonSize.SMALL); button.add(new Icon(IconType.TRASH)); sb.append(SafeHtmlUtils.fromTrustedString(button.toString())); } @Override public void onBrowserEvent(Context context, Element parent, NotificationRow value, NativeEvent event, ValueUpdater<NotificationRow> valueUpdater) { if (!readOnly) { delete(value); } } }; Column<NotificationRow, NotificationRow> deleteColumn = new Column<NotificationRow, NotificationRow>( buttonCell) { @Override public NotificationRow getValue(NotificationRow object) { return object; } }; deleteColumn.setSortable(false); table.addColumn(deleteColumn, presenter.getDeleteLabel()); table.setColumnWidth(deleteColumn, 60, Style.Unit.PX); }
From source file:org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.widget.NotificationWidgetViewImpl.java
License:Apache License
private void initEdit() { AbstractCell<NotificationRow> buttonCell = new AbstractCell<NotificationRow>( ClickEvent.getType().getName()) { @Override// www .ja v a 2 s . c o m public void render(Context context, NotificationRow value, SafeHtmlBuilder sb) { Button button = new Button(); button.setSize(ButtonSize.SMALL); button.add(new Icon(IconType.EDIT)); sb.append(SafeHtmlUtils.fromTrustedString(button.toString())); } @Override public void onBrowserEvent(Context context, Element parent, NotificationRow value, NativeEvent event, ValueUpdater<NotificationRow> valueUpdater) { if (!readOnly) { addOrEdit(value); } } }; Column<NotificationRow, NotificationRow> editColumn = new Column<NotificationRow, NotificationRow>( buttonCell) { @Override public NotificationRow getValue(NotificationRow object) { return object; } }; editColumn.setSortable(false); table.addColumn(editColumn, StunnerFormsClientFieldsConstants.INSTANCE.Edit()); table.setColumnWidth(editColumn, 50, Style.Unit.PX); }
From source file:org.kie.workbench.common.stunner.bpmn.client.forms.fields.reassignmentsEditor.widget.ReassignmentWidgetViewImpl.java
License:Apache License
private void initDelete() { AbstractCell<ReassignmentRow> buttonCell = new AbstractCell<ReassignmentRow>( ClickEvent.getType().getName()) { @Override/*from w w w. j ava 2s . c o m*/ public void render(Context context, ReassignmentRow value, SafeHtmlBuilder sb) { Button button = new Button(); button.setSize(ButtonSize.SMALL); button.add(new Icon(IconType.REMOVE)); sb.append(SafeHtmlUtils.fromTrustedString(button.toString())); } @Override public void onBrowserEvent(Context context, Element parent, ReassignmentRow value, NativeEvent event, ValueUpdater<ReassignmentRow> valueUpdater) { if (!readOnly) { delete(value); } } }; Column<ReassignmentRow, ReassignmentRow> deleteColumn = new Column<ReassignmentRow, ReassignmentRow>( buttonCell) { @Override public ReassignmentRow getValue(ReassignmentRow object) { return object; } }; deleteColumn.setSortable(false); table.addColumn(deleteColumn, presenter.getDeleteLabel()); table.setColumnWidth(deleteColumn, 60, Style.Unit.PX); }
From source file:org.kie.workbench.common.stunner.bpmn.client.forms.fields.reassignmentsEditor.widget.ReassignmentWidgetViewImpl.java
License:Apache License
private void initEdit() { AbstractCell<ReassignmentRow> buttonCell = new AbstractCell<ReassignmentRow>( ClickEvent.getType().getName()) { @Override/*from w w w . j a va 2s . com*/ public void render(Context context, ReassignmentRow value, SafeHtmlBuilder sb) { Button button = new Button(); button.setSize(ButtonSize.SMALL); button.add(new Icon(IconType.EDIT)); sb.append(SafeHtmlUtils.fromTrustedString(button.toString())); } @Override public void onBrowserEvent(Context context, Element parent, ReassignmentRow value, NativeEvent event, ValueUpdater<ReassignmentRow> valueUpdater) { if (!readOnly) { addOrEdit(value); } } }; Column<ReassignmentRow, ReassignmentRow> editColumn = new Column<ReassignmentRow, ReassignmentRow>( buttonCell) { @Override public ReassignmentRow getValue(ReassignmentRow object) { return object; } }; editColumn.setSortable(false); table.addColumn(editColumn, StunnerFormsClientFieldsConstants.INSTANCE.Edit()); table.setColumnWidth(editColumn, 50, Style.Unit.PX); }
From source file:org.kie.workbench.common.stunner.client.widgets.marshaller.MarshallingResponsePopupView.java
License:Apache License
private void initTable() { messagesTable.setColumnPickerButtonVisible(true); messagesTableProvider.addDataDisplay(messagesTable); final Column<MarshallingResponsePopup.Row, String> levelColumn = new TextColumn<MarshallingResponsePopup.Row>() { @Override/* ww w .j a v a2s.com*/ public String getValue(MarshallingResponsePopup.Row row) { return row.getLevel(); } }; messagesTable.addColumn(levelColumn, translationService.getValue(StunnerWidgetsConstants.MarshallingResponsePopup_LevelTableColumnName)); messagesTable.setColumnWidth(levelColumn, 80, Style.Unit.PX); final Column<MarshallingResponsePopup.Row, String> messageColumn = new TextColumn<MarshallingResponsePopup.Row>() { @Override public String getValue(MarshallingResponsePopup.Row row) { return row.getMessage(); } @Override public void render(Cell.Context context, MarshallingResponsePopup.Row row, SafeHtmlBuilder sb) { final String currentValue = getValue(row); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("<div title=\"")) .append(SafeHtmlUtils.fromString(currentValue)) .append(SafeHtmlUtils.fromTrustedString("\">")); } super.render(context, row, sb); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("</div>")); } } }; messagesTable.addColumn(messageColumn, translationService .getValue(StunnerWidgetsConstants.MarshallingResponsePopup_MessageTableColumnName)); setOnShownCommand(modal.getElement(), () -> messagesTable.redraw()); }
From source file:org.kie.workbench.common.widgets.decoratedgrid.client.widget.cells.AbstractProxyPopupDropDownDatePicker.java
License:Apache License
@Override public void render(final Cell.Context context, final Date value, final SafeHtmlBuilder sb, final SafeHtmlRenderer<String> renderer) { //Render value if (value != null) { sb.append(renderer.render((value == null ? "" : convertToString(value)))); }//www .jav a 2 s . c o m }
From source file:org.kie.workbench.common.widgets.decoratedgrid.client.widget.cells.AbstractProxyPopupDropDownListBox.java
License:Apache License
@Override public void render(final Cell.Context context, final C value, final SafeHtmlBuilder sb, final SafeHtmlRenderer<String> renderer) { //Render value if (value != null) { String label = getLabel(convertToString(value)); sb.append(renderer.render(label)); }/* w ww . jav a 2 s.c om*/ }