当前位置: 首页>>代码示例>>Java>>正文


Java SafeHtml类代码示例

本文整理汇总了Java中com.google.gwt.safehtml.shared.SafeHtml的典型用法代码示例。如果您正苦于以下问题:Java SafeHtml类的具体用法?Java SafeHtml怎么用?Java SafeHtml使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SafeHtml类属于com.google.gwt.safehtml.shared包,在下文中一共展示了SafeHtml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: VertexStyleComboBox

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
public VertexStyleComboBox(String width) {
	super(new ListStore<VertexStyleDef>(
			((VertexStyleDefProperties)GWT.create(VertexStyleDefProperties.class)).key()),
			((VertexStyleDefProperties)GWT.create(VertexStyleDefProperties.class)).name(),
			new AbstractSafeHtmlRenderer<VertexStyleDef>() {
				final VertexStyleComboTemplates comboBoxTemplates = GWT
						.create(VertexStyleComboTemplates.class);

				public SafeHtml render(VertexStyleDef item) {
					return comboBoxTemplates.vertexStyle(item.getImage()
							.getSafeUri(), item.getName());
				}
			});
	
	setWidth(width);
	setTypeAhead(true);
	setEmptyText(UIMessages.INSTANCE.sbLayerComboEmptyText());
	setTriggerAction(TriggerAction.ALL);
	setForceSelection(true);
	setEditable(false);
	enableEvents();
	
	getStore().addAll(VertexStyles.getAll());
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:25,代码来源:VertexStyleComboBox.java

示例2: getImageHtml

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
private SafeHtml getImageHtml(ImageResource res, VerticalAlignmentConstant valign) {
	AbstractImagePrototype proto = AbstractImagePrototype.create(res);
	SafeHtml image = SafeHtmlUtils.fromTrustedString(proto.getHTML());

	// Create the wrapper based on the vertical alignment.
	SafeStylesBuilder cssStyles =
			new SafeStylesBuilder().appendTrustedString(direction + ":0px;");
	if (HasVerticalAlignment.ALIGN_TOP == valign) {
		return templates.imageWrapperTop(cssStyles.toSafeStyles(), image);
	} else if (HasVerticalAlignment.ALIGN_BOTTOM == valign) {
		return templates.imageWrapperBottom(cssStyles.toSafeStyles(), image);
	} else {
		int halfHeight = (int) Math.round(res.getHeight() / 2.0);
		cssStyles.appendTrustedString("margin-top:-" + halfHeight + "px;");
		return templates.imageWrapperMiddle(cssStyles.toSafeStyles(), image);
	}
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:18,代码来源:ActionIconCellDecorator.java

示例3: testShowError

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
@Test
public void testShowError() {
    final ClientRuntimeError error = mock(ClientRuntimeError.class);
    when(error.getCause()).thenReturn("errorCause");
    presenter.afterPreviewCommand = mock(Command.class);
    presenter.showError(error);
    verify(loadingBox, times(1)).hide();
    verify(view, times(1)).showErrorNotification(any(SafeHtml.class));
    verify(errorEvent, times(1)).fire(any(ErrorEvent.class));
    verify(presenter.afterPreviewCommand, times(1)).execute();
    verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class));
    verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class));
    verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class));
    verify(view, times(0)).showConfigurationTab();
    verify(view, times(0)).showPreviewTab();
    verify(view, times(0)).showAdvancedTab();
    verify(view, times(0)).openColumnsFilterPanel(anyString());
    verify(view, times(0)).closeColumnsFilterPanel(anyString());
    verify(view, times(0)).clearErrorNotification();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:DataSetEditorTest.java

示例4: testShowErrors

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
@Test
public void testShowErrors() throws Exception {
    EditorError e1 = mockEditorError(presenter, "m1");
    EditorError e2 = mockEditorError(presenter, "m2");
    List<EditorError> errors = new ArrayList<EditorError>(2);
    errors.add(e1);
    errors.add(e2);
    presenter.showErrors(errors);
    final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);
    verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());
    verify(view, times(0)).init(presenter);
    verify(view, times(0)).clearError();
    verify(view, times(0)).setValue(anyString());
    final SafeHtml value = errorSafeHtmlCaptor.getValue();
    Assert.assertEquals("m1\nm2", value.asString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:ValueBoxEditorTest.java

示例5: getHTML

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
public SafeHtml getHTML() {
    SafeHtml result = null;
    if (libraryLoaded && initialized) {
        try {
            String contentHtml = getContentHtml(elementId); // TinyMCE takes care of the sanitization.
            if (contentHtml == null || contentHtml.trim().isEmpty()) {
                return SafeHtmlUtils.fromSafeConstant("");
            }
            // Remove the root block <p></p> that gets added automatically by TinyMCE
            if (contentHtml.startsWith("<p>") && contentHtml.endsWith("</p>")) {
                contentHtml = contentHtml.substring(3, contentHtml.length() - 4);
            }
            result = SafeHtmlUtils.fromTrustedString(contentHtml); 
        } catch (JavaScriptException e) {
            GWT.log("Unable to get the content from the TinyMCE editor.", e);
        }
    } else {
        String text = super.getText();
        if (text == null || text.trim().isEmpty()) {
            return SafeHtmlUtils.fromSafeConstant("");
        } else {
            return SafeHtmlUtils.fromString(text);
        }
    }
    return result;        
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:27,代码来源:HFRichTextEditor.java

示例6: setHTML

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
public void setHTML(SafeHtml html) {
    String text = html == null ? null: html.asString();
    if (libraryLoaded && (isInitialized() || isInitializing())) {
        if (isInitializing()) {
            pendingSetHtmlText = html;
            addPendingSetHtml();
            return;
        }
        try {
            setContent(elementId, text);
        } catch (JavaScriptException e) {
            // Don't do anything, just allow it to return.
            GWT.log("Unable to set the content on the TinyMCE editor.", e);
        }
        return;
    } else {
        super.setText(text);
    }
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:20,代码来源:HFRichTextEditor.java

示例7: assertViewNotUsed

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
protected void assertViewNotUsed() {
    verify(view, times(0)).init(any(DataSetEditor.class));
    verify(view, times(0)).initWidgets(
            any(DataSetDefBasicAttributesEditor.View.class),
            any(IsWidget.class),
            any(DataSetDefColumnsFilterEditor.View.class),
            any(DataSetDefPreviewTable.View.class),
            any(DataSetDefCacheAttributesEditorView.class),
            any(DataSetDefCacheAttributesEditorView.class),
            any(DataSetDefRefreshAttributesEditor.View.class)
    );
    verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class));
    verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class));
    verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class));
    verify(view, times(0)).showConfigurationTab();
    verify(view, times(0)).showPreviewTab();
    verify(view, times(0)).showAdvancedTab();
    verify(view, times(0)).openColumnsFilterPanel(anyString());
    verify(view, times(0)).closeColumnsFilterPanel(anyString());
    verify(view, times(0)).showErrorNotification(any(SafeHtml.class));
    verify(view, times(0)).clearErrorNotification();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:DataSetEditorTest.java

示例8: testOnSubmitComplete

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
@Test
public void testOnSubmitComplete() throws Exception {
    when(view.getFileName()).thenReturn("ff");
    presenter.onSubmitComplete("OK");
    assertEquals("ff", presenter.value);
    verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));
    verify(view, times(0)).init(presenter);
    verify(view, times(0)).setFileUploadName(anyString());
    verify(view, times(1)).setFileUploadVisible(true);
    verify(view, times(0)).setFileLabelText(anyString());
    verify(view, times(0)).setFileLabelVisible(anyBoolean());
    verify(view, times(1)).setLoadingImageVisible(false);
    verify(view, times(1)).getFileName();
    verify(view, times(0)).setFormAction(anyString());
    verify(view, times(0)).submit();
    verify(view, times(0)).showError(any(SafeHtml.class));
    verify(view, times(2)).clearError();
    verify( workbenchNotificationEvent, times( 1 ) ).fire(any(NotificationEvent.class));
    verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:FileUploadEditorTest.java

示例9: setMultiRowDragDecoration

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
/**
 * Styles a multi-row selection with the number of elements.
 *
 * @param drag
 *            the current drag event holding the context.
 */
void setMultiRowDragDecoration(VDragEvent drag) {
    Widget widget = drag.getTransferable().getDragSource().getWidget();

    if (widget instanceof VScrollTable) {
        VScrollTable table = (VScrollTable) widget;
        int rowCount = table.selectedRowKeys.size();

        Element dragCountElement = Document.get().getElementById(SP_DRAG_COUNT);
        if (rowCount > 1 && table.selectedRowKeys.contains(table.focusedRow.getKey())) {
            if (dragCountElement == null) {
                dragCountElement = Document.get().createStyleElement();
                dragCountElement.setId(SP_DRAG_COUNT);
                HeadElement head = HeadElement.as(Document.get().getElementsByTagName(HeadElement.TAG).getItem(0));
                head.appendChild(dragCountElement);
            }
            SafeHtml formattedCssStyle = getDraggableTemplate().multiSelectionStyle(determineActiveTheme(drag),
                    String.valueOf(rowCount));
            StyleElement dragCountStyleElement = StyleElement.as(dragCountElement);
            dragCountStyleElement.setInnerSafeHtml(formattedCssStyle);
        } else if (dragCountElement != null) {
            dragCountElement.removeFromParent();
        }
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:31,代码来源:ViewClientCriterion.java

示例10: testShowErrors

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
public void testShowErrors() throws Exception {
    EditorError e1 = mockEditorError(presenter, "m1");
    EditorError e2 = mockEditorError(presenter, "m2");
    List<EditorError> errors = new ArrayList<EditorError>(2);
    errors.add(e1);
    errors.add(e2);
    
    presenter.showErrors(errors);
    final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);
    verify(view, times(0)).clear();
    verify(view, times(0)).init(any(ImageListEditor.class));
    verify(view, times(0)).clearError();
    verify(view, times(0)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class),
            any(SafeHtml.class), anyBoolean(), any(Command.class));
    verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());
    final SafeHtml value = errorSafeHtmlCaptor.getValue();
    Assert.assertEquals("m1\nm2", value.asString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:ImageListEditorTest.java

示例11: testShowErrors

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
@Test
public void testShowErrors() throws Exception {
    EditorError e1 = mockEditorError(presenter, "m1");
    EditorError e2 = mockEditorError(presenter, "m2");
    List<EditorError> errors = new ArrayList<EditorError>(2);
    errors.add(e1);
    errors.add(e2);
    presenter.showErrors(errors);
    final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);
    verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());
    verify(view, times(0)).init(presenter);
    verify(view, times(0)).clearError();
    verify(view, times(0)).setValue(anyBoolean());
    final SafeHtml value = errorSafeHtmlCaptor.getValue();
    Assert.assertEquals("m1\nm2", value.asString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:ToggleSwitchEditorTest.java

示例12: assertSetViewValue

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
protected void assertSetViewValue(final int size) {
    verify(view, times(3)).removeColumn(0);
    verify(view, times(1)).clearError();
    verify(view, times(1)).addButtonColumn(anyInt(), anyString(), anyInt());
    verify(view, times(2)).addTextColumn(anyInt(), anyString(), anyBoolean(), anyInt());
    verify(view, times(1)).setEmptyText(anyString());
    verify(view, times(1)).setRowCount(size);
    final ArgumentCaptor<List> dataCaptor =  ArgumentCaptor.forClass(List.class);
    verify(view, times(1)).setData(dataCaptor.capture());
    final List dataValue = dataCaptor.getValue();
    assertNotNull(dataValue);
    assertEquals(size, dataValue.size());
    verify(view, times(0)).init(presenter);
    verify(view, times(0)).showError(any(SafeHtml.class));
    verify(view, times(0)).setAddText(anyString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:MapEditorTest.java

示例13: testConfigure

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
@Test
public void testConfigure() throws Exception {
    FileUploadEditor.FileUploadEditorCallback callback = mock(FileUploadEditor.FileUploadEditorCallback.class);
    presenter.configure("f1", callback);
    assertEquals(view.asWidget(), presenter.asWidget());
    assertEquals(callback, presenter.callback);
    verify(view, times(0)).init(presenter);
    verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));
    verify(view, times(1)).setFileUploadName("f1");
    verify(view, times(0)).setFileUploadVisible(anyBoolean());
    verify(view, times(0)).setFileLabelText(anyString());
    verify(view, times(0)).setFileLabelVisible(anyBoolean());
    verify(view, times(0)).setLoadingImageVisible(false);
    verify(view, times(0)).getFileName();
    verify(view, times(0)).setFormAction(anyString());
    verify(view, times(0)).submit();
    verify(view, times(0)).showError(any(SafeHtml.class));
    verify(view, times(0)).clearError();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:FileUploadEditorTest.java

示例14: MenuButton

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
public MenuButton(SafeHtml content, ItemsProvider itemsProvider) {
  super();

  this.itemsProvider = itemsProvider;

  addStyleName(RESOURCES.css().menuButton());

  showMenuTimer =
      new Timer() {
        @Override
        public void run() {
          showMenu();
        }
      };

  final FocusWidget mainButton = new MainButton(content);
  final FocusWidget dropButton = new DropButton();

  add(mainButton);
  add(dropButton);

  attachMouseEventHandlers(mainButton);
  attachMouseEventHandlers(dropButton);
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:MenuButton.java

示例15: MainButton

import com.google.gwt.safehtml.shared.SafeHtml; //导入依赖的package包/类
MainButton(SafeHtml content) {
  super(Document.get().createDivElement());

  getElement().setInnerSafeHtml(content);

  addStyleName(RESOURCES.css().button());
  addStyleName(RESOURCES.css().mainButton());

  addClickHandler(
      event -> {
        if (menu != null && menu.isShowing()) {
          return;
        }

        final Optional<MenuItem> defaultItem = itemsProvider.getDefaultItem();

        if (defaultItem.isPresent()) {
          getActionHandler()
              .ifPresent(actionHandler -> actionHandler.onAction(defaultItem.get()));
        } else {
          showMenu();
        }
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:MenuButton.java


注:本文中的com.google.gwt.safehtml.shared.SafeHtml类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。