Search in sources :

Example 96 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.

the class ChoiceFieldCheckBoxEditor method setChoices.

@Override
public void setChoices(List<ChoiceDescriptor> choices) {
    container.clear();
    checkBoxes.clear();
    for (ChoiceDescriptor choiceDescriptor : choices) {
        CheckBox checkBox = new CheckBox(new SafeHtmlBuilder().appendHtmlConstant(choiceDescriptor.getLabel()).toSafeHtml());
        checkBoxes.put(checkBox, choiceDescriptor);
        container.add(checkBox);
        checkBox.getElement().getStyle().setDisplay(Style.Display.BLOCK);
        checkBox.addValueChangeHandler(checkBoxValueChangedHandler);
        checkBox.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
        checkBox.addFocusHandler(event -> {
            checkBox.addStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
            checkBox.removeStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
        });
        checkBox.addBlurHandler(event -> {
            checkBox.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
            checkBox.removeStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
        });
    }
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox) ChoiceDescriptor(edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 97 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.

the class EntityCrudKitSettingsEditorImpl method validatePrefix.

private void validatePrefix() {
    int selectedIndex = suffixSelectorListBox.getSelectedIndex();
    if (selectedIndex == -1) {
        return;
    }
    String prefix = iriPrefixEditor.getText().trim();
    EntityCrudKit<?> crudKit = descriptors.get(selectedIndex);
    Optional<String> validationMessage = crudKit.getPrefixValidationMessage(prefix);
    if (validationMessage.isPresent()) {
        prefixValidatorMessage.setHTML(new SafeHtmlBuilder().appendHtmlConstant(validationMessage.get()).toSafeHtml());
        prefixValidatorMessage.setVisible(true);
    } else {
        prefixValidatorMessage.setVisible(false);
    }
}
Also used : SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 98 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.

the class CommentPostedEventView method setValue.

public void setValue(CommentPostedEvent event) {
    Comment comment = event.getComment();
    UserId createdBy = comment.getCreatedBy();
    userNameLabel.setText(createdBy.getUserName());
    userIconHolder.setWidget(UserIcon.get(createdBy));
    final java.util.Optional<OWLEntityData> targetAsEntityData = event.getEntity();
    if (targetAsEntityData.isPresent()) {
        entityLabel.setEntity(targetAsEntityData.get());
        entityLabel.setVisible(true);
    } else {
        entityLabel.setVisible(false);
    }
    timeLabel.setBaseTime(comment.getCreatedAt());
    final SafeHtmlBuilder builder = new SafeHtmlBuilder();
    bodyLabel.setHTML(builder.appendHtmlConstant(comment.getRenderedBody()).toSafeHtml());
}
Also used : Comment(edu.stanford.bmir.protege.web.shared.issues.Comment) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) OWLEntityData(edu.stanford.bmir.protege.web.shared.entity.OWLEntityData) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 99 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.

the class CommentViewImpl method setBody.

@Override
public void setBody(String body) {
    bodyField.setText(body);
    bodyField.setHTML(new SafeHtmlBuilder().appendHtmlConstant(body).toSafeHtml());
}
Also used : SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 100 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.

the class MessageBox method showErrorMessage.

public static void showErrorMessage(String mainMessage, Throwable throwable) {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    sb.appendEscaped("Details: ");
    sb.appendEscaped(throwable.getMessage());
    showAlert(mainMessage, sb.toSafeHtml().toString());
}
Also used : SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Aggregations

SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)143 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)26 Test (org.junit.Test)18 Column (com.google.gwt.user.cellview.client.Column)17 Cell (com.google.gwt.cell.client.Cell)14 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)12 Context (com.google.gwt.cell.client.Cell.Context)7 MenuItem (com.google.gwt.user.client.ui.MenuItem)7 NativeEvent (com.google.gwt.dom.client.NativeEvent)6 Command (com.google.gwt.user.client.Command)6 ArrayList (java.util.ArrayList)6 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)5 GWT (com.google.gwt.core.client.GWT)5 Element (com.google.gwt.dom.client.Element)5 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 ClickableTextCell (com.google.gwt.cell.client.ClickableTextCell)4 TextCell (com.google.gwt.cell.client.TextCell)4 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)4 ImageResource (com.google.gwt.resources.client.ImageResource)4 Map (java.util.Map)4