本文整理汇总了Java中com.google.gwt.safehtml.shared.SafeUri类的典型用法代码示例。如果您正苦于以下问题:Java SafeUri类的具体用法?Java SafeUri怎么用?Java SafeUri使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SafeUri类属于com.google.gwt.safehtml.shared包,在下文中一共展示了SafeUri类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUrl
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
/**
* @see com.google.gwt.user.client.ui.Image#setUrl(com.google.gwt.safehtml.shared
* .SafeUri)
*/
@Override
public void setUrl(final SafeUri url) {
if ( isHiddenAndAttached() ) {
super.setUrl(url);
} else {
// Do this later to avoid problems in IE
hide();
this.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
setUrl(url);
}
});
}
}
示例2: emptySVGResource
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
private static SVGResource emptySVGResource() {
return new SVGResource() {
@Override
public OMSVGSVGElement getSvg() {
return new OMSVGSVGElement();
}
@Override
public SafeUri getSafeUri() {
return null;
}
@Override
public String getUrl() {
return null;
}
@Override
public String getName() {
return null;
}
};
}
示例3: injectScript
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
public static void injectScript(SafeUri js, AsyncCallback<Void> callback) {
final ScriptElement[] script = new ScriptElement[1];
script[0] =
ScriptInjector.fromUrl(js.asString())
.setWindow(ScriptInjector.TOP_WINDOW)
.setCallback(
new Callback<Void, Exception>() {
@Override
public void onSuccess(Void result) {
script[0].removeFromParent();
callback.onSuccess(result);
}
@Override
public void onFailure(Exception reason) {
callback.onFailure(reason);
}
})
.inject()
.cast();
}
示例4: FooterPart
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
private FooterPart () {
initWidget(uiBinder.createAndBindUi(this));
PropertyController controller = PropertyController.get();
SafeUri url = controller.copyrightHolderUrl();
String urlAsString = url.asString();
if (urlAsString.contains(ApiHelper.HOST)
|| urlAsString.startsWith("#")) {
divCopyright.setInnerSafeHtml(FooterTemplates.FOOTER_TEMPLATES
.copyrightNoticeInternal(url, controller.copyrightHolder(),
years(controller), controller.title(), version()));
} else {
divCopyright.setInnerSafeHtml(FooterTemplates.FOOTER_TEMPLATES
.copyrightNotice(url, controller.copyrightHolder(),
years(controller), controller.title(),
Resources.RES.styles().externalLink(), version()));
}
}
示例5: render
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
@Override
public SafeHtml render (Tag object) {
SafeHtmlBuilder builder = new SafeHtmlBuilder();
if (displayLabel) {
builder.appendHtmlConstant("<span class=\"glyphicon glyphicon-tags\" style=\"margin-right:2px;\"></span> ");
}
SafeUri href = PageTypeHelper.asHref(PageType.TagPostsPageType,
object.slug == null ? PostHelper.slugify(object.name)
: object.slug);
if (displayCount) {
builder.append(TagTemplate.INSTANCE.tagWithCount(href,
object.name,
object.posts == null ? 0 : object.posts.size()));
} else {
builder.append(TagTemplate.INSTANCE.tag(href, object.name));
}
return builder.toSafeHtml();
}
示例6: testShowErrors
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的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());
}
示例7: showHeader
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
@Override
public DataSetPanel.View showHeader(final String uuid, final String parentCollapseId,
final SafeUri dataSetTypeImageUri, final String dataSetTypeImageTitle, final String dataSetTitle) {
typeIcon.setUrl(dataSetTypeImageUri);
typeIcon.setTitle(dataSetTypeImageTitle);
typeIcon.setAltText(dataSetTypeImageTitle);
title.setText(dataSetTitle);
setDynamicToggleId(uuid, parentCollapseId);
collapsePanel.addShowHandler(new ShowHandler() {
@Override
public void onShow(final ShowEvent shownEvent) {
presenter.open();
}
});
return this;
}
示例8: getImageUri
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
SafeUri getImageUri(final ColumnType type) {
SafeUri result = null;
switch (type) {
case DATE:
result = DataSetClientResources.INSTANCE.images().dateIcon32().getSafeUri();
break;
case NUMBER:
result = DataSetClientResources.INSTANCE.images().numberIcon32V3().getSafeUri();
break;
case TEXT:
result = DataSetClientResources.INSTANCE.images().textIcon32().getSafeUri();
break;
case LABEL:
result = DataSetClientResources.INSTANCE.images().labelIcon32().getSafeUri();
break;
}
return result;
}
示例9: testShow
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
@Test
public void testShow() throws Exception {
final String iconTitle = "iconTitle";
doReturn(iconTitle).when(presenter).getTypeIconTitle(dataSetDef);
final SafeUri iconUri = mock(SafeUri.class);
doReturn(iconUri).when(presenter).getTypeIconUri(dataSetDef);
final String parentPanelId = "parentPanel";
presenter.show(dataSetDef, parentPanelId);
assertEquals(dataSetDef, presenter.getDataSetDef());
verify(view, times(0)).init(presenter);
verify(view, times(0)).configure(any(DataSetSummary.View.class));
verify(view, times(1)).showHeader("uuid1", parentPanelId, iconUri, iconTitle, "name1");
verify(view, times(0)).showSummary();
verify(view, times(0)).hideSummary();
verify(view, times(0)).enableActionButton(anyString(), any(ClickHandler.class));
verify(view, times(0)).disableActionButton();
}
示例10: decorate
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
public static String decorate(SafeHtml toDecorate, String aId, PublishedCell aCell, VerticalAlignmentConstant valign, SafeHtmlBuilder sb) {
SafeStylesBuilder stb = new SafeStylesBuilder();
SafeUri imgSrc = null;
if (aCell != null) {
stb.append(SafeStylesUtils.fromTrustedString(aCell.toStyledWOBackground()));
if (aCell.getIcon() != null) {
ImageResource icon = aCell.getIcon();
imgSrc = icon.getSafeUri();
}
}
String decorId;
if (aId != null && !aId.isEmpty()) {
decorId = aId;
} else {
decorId = Document.get().createUniqueId();
}
if (imgSrc != null)
sb.append(RenderedEditorCell.PaddedCell.INSTANCE.generate(stb.toSafeStyles(), imgSrc, decorId, toDecorate));
else
sb.append(RenderedEditorCell.PaddedCell.INSTANCE.generate(stb.toSafeStyles(), decorId, toDecorate));
return decorId;
}
示例11: link
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
@Override
public void link(final NGScope scope, final JQElement element, JSON attrs) {
DataResource resource = scope.get(getName());
if (resource == null) {
LOG.log(Level.WARNING, "Mandatory attribute " + getName() + " value is mssing");
return;
}
SafeUri safeUri = resource.getSafeUri();
String url = safeUri.asString();
Promise<Response> promise = HttpUtils.get(q, url);
promise.then(new Done<Response>() {
@Override
public void call(Response value) {
String text = value.getText();
element.append(text);
}
});
return;
}
示例12: addImage
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
public void addImage(SafeUri imagePath, final String linkUrl, int percentWidth) {
final Image image = new Image(imagePath);
image.setWidth(percentWidth + "%");
final SingleShotEventListner singleShotEventListner = new SingleShotEventListner() {
@Override
protected void singleShotFired() {
Window.open(linkUrl, "_system", "");
}
};
image.addClickHandler(singleShotEventListner);
image.addTouchStartHandler(singleShotEventListner);
image.addTouchMoveHandler(singleShotEventListner);
image.addTouchEndHandler(singleShotEventListner);
outerPanel.add(image);
}
示例13: submitFile
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
@Override
public void submitFile(ChangeType type, SafeUri action, SimpleEntry<String, String>... hiddenParameters) {
this.answerForm.setAction(action);
if (this.hiddenParams != null)
{// remove old params from former upload..
for(Hidden h: this.hiddenParams)
{
this.answerFormHiddenContainer.remove(h);
}
this.hiddenParams = null;
}
// add new hidden params if given
if (hiddenParameters != null)
{
this.hiddenParams = new LinkedList<Hidden>();
for (int i = 0; i< hiddenParameters.length; i++)
{
SimpleEntry<String, String> e = hiddenParameters[i];
Hidden ip = new Hidden(e.getKey(), e.getValue());
hiddenParams.add(ip);
this.answerFormHiddenContainer.add(ip);
}
}
this.answerForm.submit();
}
示例14: setUserDataList
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
@Override
public void setUserDataList(List<PacketUserData> userDataList) {
panelUserCodeList.clear();
radioButtonToUserData = Maps.newHashMap();
for (PacketUserData userData : userDataList) {
SafeUri imageUrl = UriUtils.fromString(Constant.ICON_URL_PREFIX
+ userData.imageFileName);
SafeHtml label = TEMPLATE.image(imageUrl, userData.userCode, userData.playerName);
RadioButton radioButton = new RadioButton(GROUP_USER_CODE, label);
radioButtonToUserData.put(radioButton, userData);
panelUserCodeList.add(radioButton);
if (this.userData.getUserCode() == userData.userCode) {
radioButton.setValue(true);
}
}
}
示例15: show
import com.google.gwt.safehtml.shared.SafeUri; //导入依赖的package包/类
public void show(final DiagramRepresentation diagramRepresentation,
final int widthInPx,
final int heightInPx,
final Command callback) {
this.callback = callback;
this.name = diagramRepresentation.getName();
view.setUUID(name);
view.setItemTitle(diagramRepresentation.getTitle());
//Set size before Uri/data as we cannot scale until the image is loaded and it's real size known
view.setItemPxSize(widthInPx,
heightInPx);
//Set Uri/data. Image's LoadHandler will set size requested above after image is loaded from Uri/data
final String thumbData = diagramRepresentation.getThumbImageData();
if (isEmpty(thumbData)) {
final String defSetId = diagramRepresentation.getDefinitionSetId();
final SafeUri thumbUri = shapeManager.getThumbnail(defSetId);
view.setThumbUri(thumbUri);
} else {
view.setThumbData(thumbData);
}
}