Example usage for com.google.gwt.resources.client ImageResource getLeft

List of usage examples for com.google.gwt.resources.client ImageResource getLeft

Introduction

In this page you can find the example usage for com.google.gwt.resources.client ImageResource getLeft.

Prototype

int getLeft();

Source Link

Document

Returns the horizontal position of the image within the composite image.

Usage

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.widget.ActionsLabel.java

License:Apache License

public void addMenuItem(ImageResource image, String text, final ActionMenuItemListener listener) {

    SafeHtml html = null;/*from  w ww  . ja  v  a 2s.  c o m*/
    if (image != null) {
        SafeUri uri = image.getSafeUri();
        int left = image.getLeft();
        int top = image.getTop();
        int width = image.getWidth();
        int height = image.getHeight();
        int paddingRight = width + 8;

        String background = "url(\"" + uri.asString() + "\") no-repeat " + (-left + "px ") + (-top + "px");

        SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.trustedNameAndValue("background", background).width(width, Unit.PX).height(height, Unit.PX)
                .paddingRight(paddingRight, Unit.PX);

        SafeStyles style = SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString());

        html = template.menuImageItemContent(style, text);
    } else {
        html = template.menuItemContent(text);
    }
    MenuItem item = new MenuItem(html, new Command() {

        @Override
        public void execute() {
            if (actionsPopup != null && actionsPopup.isVisible()) {
                actionsPopup.hide();
            }
            listener.onMenuItemSelected();
        }

    });

    menu.addItem(item);
}

From source file:org.onebusaway.webapp.gwt.mobile_application.MobileApplication.java

License:Apache License

private NavigationController createNavigationController(String id, String title, ImageResource img,
        ViewController firstView) {//from w w w.j a  v a2s  . co  m

    Image image = new Image(img.getURL(), img.getLeft(), img.getTop(), img.getWidth(), img.getHeight());

    NavigationController navigationController = new NavigationController();
    navigationController.getTabBarItem().setName(title);
    navigationController.getTabBarItem().setImage(image);
    navigationController.getNavigationItem().setId(id);
    navigationController.getNavigationItem().setTitle(title);
    navigationController.pushViewController(firstView);
    return navigationController;
}

From source file:org.onebusaway.webapp.gwt.viewkit.NavigationBar.java

License:Apache License

private Grid createButton(EBarButtonSystemItem systemItem) {
    ViewKitResources resources = ViewKitResources.INSTANCE;
    ImageResource r = null;
    switch (systemItem) {
    case CROSS_HAIRS:
        r = resources.BarButtonSystemCrossHairsImage();
        break;// w  w  w.j a  v a  2  s .c  o  m
    case REFRESH:
    default:
        r = resources.BarButtonSystemRefreshImage();
        break;
    }
    Image image = new Image(r.getURL(), r.getLeft(), r.getTop(), r.getWidth(), r.getHeight());
    Grid button = createButton();
    button.setWidget(0, 1, image);
    return button;
}

From source file:sk.seges.acris.widget.client.table.PagingOptions.java

License:Apache License

protected void applyImage(Image image, ImageResource imageResource) {
    image.setUrlAndVisibleRect(imageResource.getURL(), imageResource.getLeft(), imageResource.getTop(),
            imageResource.getWidth(), imageResource.getHeight());
}