Example usage for com.google.gwt.user.client.ui AbstractImagePrototype getHTML

List of usage examples for com.google.gwt.user.client.ui AbstractImagePrototype getHTML

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui AbstractImagePrototype getHTML.

Prototype

public String getHTML() 

Source Link

Document

Gets an HTML fragment that displays the image represented by this prototype.

Usage

From source file:app.dnd.drag.DraggableCellDecorator.java

License:Apache License

/**
 * Get the HTML representation of an image. Visible for testing.
 *
 * @param res           the {@link ImageResource} to render as HTML
 * @param valign        the vertical alignment
 * @param isPlaceholder if true, do not include the background image
 * @return the rendered HTML//from  ww w  .j  a  v  a  2s . c  o  m
 */
SafeHtml getImageHtml(ImageResource res, HasVerticalAlignment.VerticalAlignmentConstant valign,
        boolean isPlaceholder) {
    // Get the HTML for the image.
    SafeHtml image;
    if (isPlaceholder) {
        image = SafeHtmlUtils.fromTrustedString("<div></div>");
    } else {
        AbstractImagePrototype proto = AbstractImagePrototype.create(res);
        image = SafeHtmlUtils.fromTrustedString(proto.getHTML());
    }

    // Create the wrapper based on the vertical alignment.
    if (HasVerticalAlignment.ALIGN_TOP == valign) {
        return template.imageWrapperTop(direction, image, dragHandlerClass);
    } else if (HasVerticalAlignment.ALIGN_BOTTOM == valign) {
        return template.imageWrapperBottom(direction, image, dragHandlerClass);
    } else {
        int halfHeight = (int) Math.round(res.getHeight() / 2.0);
        return template.imageWrapperMiddle(direction, halfHeight, image, dragHandlerClass);
    }
}

From source file:cc.alcina.framework.gwt.client.ide.node.CollectionProviderNode.java

License:Apache License

protected String imageItemHTML(AbstractImagePrototype imageProto, String title) {
    return imageProto.getHTML() + " " + title;
}

From source file:cc.alcina.framework.gwt.client.ide.node.UmbrellaProviderNode.java

License:Apache License

@Override
protected String imageItemHTML(AbstractImagePrototype imageProto, String title) {
    return imageProto.getHTML() + " " + title;
}

From source file:com.anzsoft.client.utils.ChatTextFormatter.java

License:Open Source License

private static String getImgHtml(final AbstractImagePrototype img) {
    final Image image = new Image();
    DOM.setStyleAttribute(image.getElement(), "vertical-align", "bottom");
    img.applyTo(image);//from   www .  j  a v  a  2  s  . com
    image.setStyleName("vamiddle");
    return img.getHTML();
}

From source file:com.chinarewards.gwt.elt.client.widget.SortableHeader.java

License:Apache License

private static String makeImage(ImageResource resource) {
    AbstractImagePrototype proto = AbstractImagePrototype.create(resource);
    String html = proto.getHTML().replace("style='", "style='position:absolute;right:0px;top:0px;");
    return html;// w  ww.j  av a  2  s .c  o m
}

From source file:com.dingziran.effective.client.ShowcaseShell.java

License:Apache License

/**
 * Construct the {@link ShowcaseShell}./* w w  w  .j  a va2  s  .  c om*/
 *
 * @param treeModel the treeModel that backs the main menu
 */
public ShowcaseShell(TreeViewModel treeModel) {
    AbstractImagePrototype proto = AbstractImagePrototype.create(Showcase.images.loading());
    loadingHtml = proto.getHTML();

    // Create the cell tree.
    mainMenu = new CellTree(treeModel, null);
    mainMenu.setAnimationEnabled(true);
    mainMenu.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    mainMenu.ensureDebugId("mainMenu");

    // Initialize the ui binder.
    initWidget(uiBinder.createAndBindUi(this));
    initializeLocaleBox();
    contentSource.getElement().getStyle().setBackgroundColor("#eee");
    contentSource.getElement().getStyle().setMargin(10.0, Unit.PX);
    contentSource.getElement().getStyle().setProperty("border", "1px solid #c3c3c3");
    contentSource.getElement().getStyle().setProperty("padding", "10px 2px");

    // In RTL mode, we need to set some attributes.
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        localeSelectionCell.setAlign("left");
        linkCell.setPropertyString("align", "left");
    }
    // Default to no content.
    contentPanel.ensureDebugId("contentPanel");
    setContent(null);
}

From source file:com.google.gwt.sample.expenses.client.SortableHeader.java

License:Apache License

private static SafeHtml makeImage(ImageResource resource) {
    AbstractImagePrototype proto = AbstractImagePrototype.create(resource);
    String html = proto.getHTML().replace("style='", "style='position:absolute;right:0px;top:0px;");
    return SafeHtmlUtils.fromTrustedString(html);
}

From source file:com.google.gwt.sample.showcase.client.ShowcaseShell.java

License:Apache License

/**
 * Construct the {@link ShowcaseShell}./* w  w w  .  j  a va 2 s  .c  o m*/
 *
 * @param treeModel the treeModel that backs the main menu
 */
public ShowcaseShell(TreeViewModel treeModel) {
    AbstractImagePrototype proto = AbstractImagePrototype.create(Showcase.images.loading());
    loadingHtml = proto.getHTML();

    // Create the cell tree.
    mainMenu = new CellTree(treeModel, null);
    mainMenu.setAnimationEnabled(true);
    mainMenu.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    mainMenu.ensureDebugId("mainMenu");

    // Initialize the ui binder.
    initWidget(uiBinder.createAndBindUi(this));
    initializeLocaleBox();
    contentSource.getElement().getStyle().setBackgroundColor("#eee");
    contentSource.getElement().getStyle().setMargin(10.0, Unit.PX);
    contentSource.getElement().getStyle().setProperty("border", "1px solid #c3c3c3");
    contentSource.getElement().getStyle().setProperty("padding", "10px 2px");

    // In RTL mode, we need to set some attributes.
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        localeSelectionCell.setAlign("left");
        linkCell.setPropertyString("align", "left");
    }

    // Handle events from the tabs.
    tabExample.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            showExample();
        }
    });
    tabStyle.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            showSourceStyles();
        }
    });
    tabSource.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            showSourceFile();
        }
    });
    tabSourceList.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            showSourceFile();
        }
    });

    // Default to no content.
    contentPanel.ensureDebugId("contentPanel");
    setContent(null);
}

From source file:com.isotrol.impe3.gui.common.util.Util.java

License:Open Source License

/**
 * <br/>//  w w  w .  ja v  a  2s  .c  om
 * @param tooltip
 * @return
 */
public Html createInvalidIcon(String tooltip) {
    AbstractImagePrototype prototype = GXT.IMAGES.field_invalid();

    Html html = new Html(TEMPLATE_ICON.replace(PATTERN_IMG, prototype.getHTML()));

    ToolTipConfig ttc = new ToolTipConfig(tooltip);
    html.setToolTip(ttc);
    html.getToolTip().addStyleName(guiCommonStyles.gxtInvalidTip());

    return html;
}

From source file:com.novartis.pcs.ontology.webapp.client.view.ActionIconCellDecorator.java

License:Apache License

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 {//from  ww  w  . j av a  2s.c  om
        int halfHeight = (int) Math.round(res.getHeight() / 2.0);
        cssStyles.appendTrustedString("margin-top:-" + halfHeight + "px;");
        return templates.imageWrapperMiddle(cssStyles.toSafeStyles(), image);
    }
}