Java Code Examples for com.google.gwt.user.client.ui.Image#setAltText()

The following examples show how to use com.google.gwt.user.client.ui.Image#setAltText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text) {
	super(null);
	iIcon = new Image(resource);
	iIcon.setTitle(title);
	iIcon.setAltText(title);
	if (text != null && !text.isEmpty()) {
		iLabel = new HTML(text, false);
		iPanel = new HorizontalPanel();
		iPanel.setStyleName("icon");
		iPanel.add(iIcon);
		iPanel.add(iLabel);
		iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
		iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
	}
	if (title != null && !title.isEmpty()) {
		iIcon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title);
			}
		});
	}
}
 
Example 2
Source File: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public IconsCell add(ImageResource resource, final String title, final boolean html) {
	if (resource == null) return this;
	Image icon = new Image(resource);
	String text = title;
	if (html) { HTML h = new HTML(title); text = h.getText(); }
	icon.setTitle(text);
	icon.setAltText(text);
	if (iPanel.getWidgetCount() > 0)
		icon.getElement().getStyle().setMarginLeft(3, Unit.PX);
	iPanel.add(icon);
	iPanel.setCellVerticalAlignment(icon, HasVerticalAlignment.ALIGN_MIDDLE);
	if (title != null && !title.isEmpty()) {
		icon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title, html);
			}
		});
	}
	return this;
}
 
Example 3
Source File: Clipboard.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public Clipboard(String text) {
	this.text = text;

	// Show clipboard icon
	imgCopyDav = new Image(OKMBundleResources.INSTANCE.clipboardSmall());
	imgCopyDav.setStyleName("okm-Hyperlink");
	imgCopyDav.setAltText(text);
	imgCopyDav.setTitle(text);
	imgCopyDav.addClickHandler(this);

	// All composites must call initWidget() in their constructors.
	initWidget(imgCopyDav);
}
 
Example 4
Source File: WebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text, boolean reverse) {
	super(null);
	iIcon = new Image(resource);
	iIcon.setTitle(title);
	iIcon.setAltText(title);
	if (text != null && !text.isEmpty()) {
		iLabel = new HTML(text, false);
		iPanel = new HorizontalPanel();
		iPanel.setStyleName("icon");
		if (reverse) {
			iPanel.add(iLabel);
			iPanel.add(iIcon);
			iLabel.getElement().getStyle().setPaddingRight(3, Unit.PX);
			iLabel.setWidth("100%");
			iPanel.setWidth("100%");
			iIcon.getElement().getStyle().setFloat(Float.RIGHT);
		} else {
			iPanel.add(iIcon);
			iPanel.add(iLabel);
			iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
		}
		iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
	}
	if (title != null && !title.isEmpty()) {
		iIcon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title);
			}
		});
	}
}
 
Example 5
Source File: Header.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget getProductSection() {

        final HorizontalPanel panel = new HorizontalPanel();
        panel.getElement().setAttribute("role", "presentation");
        panel.getElement().setAttribute("aria-hidden", "true");

        final Image logo = new Image();
        logo.getElement().setAttribute("style", "cursor:pointer");
        logo.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                toggleNavigation(false);
                placeManager.revealPlace(new PlaceRequest(NameTokens.HomepagePresenter));
            }
        });
        logo.setStyleName("logo");
        panel.add(logo);

        if (ProductConfig.Profile.PRODUCT.equals(productConfig.getProfile())) {
            logo.addErrorHandler(new ErrorHandler() {
                @Override
                public void onError(ErrorEvent event) {
                    panel.remove(logo);
                    Label productName = new Label(productConfig.getProductName());
                    productName.setStyleName("header-product-name");
                    panel.insert(productName, 0);
                }
            });
            logo.setUrl("images/logo/" + logoName(productConfig.getProductName()) + ".png");
            logo.setAltText(productConfig.getProductName());
        } else {
            logo.setUrl("images/logo/community_title.png");
            logo.setAltText("Wildlfy Application Server");
        }

        return panel;
    }