本文整理汇总了Java中com.google.gwt.user.client.ui.Image.setAltText方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setAltText方法的具体用法?Java Image.setAltText怎么用?Java Image.setAltText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Image
的用法示例。
在下文中一共展示了Image.setAltText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IconCell
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
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);
}
iIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.stopPropagation();
UniTimeConfirmationDialog.info(title);
}
});
}
示例2: add
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
public IconsCell add(ImageResource resource, final String title) {
if (resource == null) return this;
Image icon = new Image(resource);
icon.setTitle(title);
icon.setAltText(title);
if (iPanel.getWidgetCount() > 0)
icon.getElement().getStyle().setPaddingLeft(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);
}
});
}
return this;
}
示例3: NoteCell
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
public NoteCell(String text, final String title) {
super(null);
if (Window.getClientWidth() <= 800 && title != null && !title.isEmpty()) {
iIcon = new Image(RESOURCES.note());
iIcon.setTitle(title);
iIcon.setAltText(title);
iIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.stopPropagation();
UniTimeConfirmationDialog.info(title);
}
});
} else {
iNote = new P("unitime-Note");
iNote.setHTML(text);
if (title != null) iNote.setTitle(title);
}
}
示例4: toAnchor
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
private static Anchor toAnchor(WebLinkInfoCommon info) {
Anchor a = new Anchor();
a.setHref(info.url);
if (info.target != null && !info.target.isEmpty()) {
a.setTarget(info.target);
}
if (info.imageUrl != null && !info.imageUrl.isEmpty()) {
Image img = new Image();
img.setAltText(info.name);
img.setUrl(info.imageUrl);
img.setTitle(info.name);
a.getElement().appendChild(img.getElement());
} else {
a.setText("(" + info.name + ")");
}
return a;
}
示例5: toAnchor
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
public final Anchor toAnchor() {
Anchor a = new Anchor();
a.setHref(url());
if (target() != null && !target().isEmpty()) {
a.setTarget(target());
}
if (imageUrl() != null && !imageUrl().isEmpty()) {
Image img = new Image();
img.setAltText(name());
img.setUrl(imageUrl());
img.setTitle(name());
a.getElement().appendChild(img.getElement());
} else {
a.setText("(" + name() + ")");
}
return a;
}
示例6: onChannelMessage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
@Override
public void onChannelMessage(Object p_message)
{
// redraw widget according to new presenceRoom
PresenceRoom newPresenceRoom = (PresenceRoom)p_message;
m_panel.clear();
Set<String> pseudoList = new HashSet<String>();
for( Presence presence : newPresenceRoom )
{
if( !pseudoList.contains( presence.getPseudo() ) )
{
pseudoList.add( presence.getPseudo() );
Panel panel = new HorizontalPanel();
Image image = new Image( presence.getAvatarUrl() );
image.setPixelSize( 32, 32 );
image.setAltText( presence.getPseudo() );
image.setTitle( presence.getPseudo() );
panel.add( image );
panel.add( new Label(presence.getPseudo()) );
m_panel.add( panel );
}
}
}
示例7: addImageWithLine
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* @param line
*/
public void addImageWithLine (String line) {
if (line.length() > 0) {
ConfigLine config = parseConfigLine(line);
if (config.url != null && config.url.length() > 0) {
Image image = new Image(config.url);
if (config.name != null) {
image.setTitle(config.name);
image.setAltText(config.caption);
}
((HTMLPanel) this.getWidget()).add(image);
if (config.caption != null) {
((HTMLPanel) this.getWidget())
.add(new HTMLPanel(SafeHtmlUtils.fromTrustedString(
PostHelper.makeMarkup(config.caption))));
}
}
}
}
示例8: onChannelMessage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
@Override
public void onChannelMessage(Object p_message)
{
// redraw widget according to new presenceRoom
PresenceRoom newPresenceRoom = (PresenceRoom)p_message;
m_panel.clear();
Set<String> pseudoList = new HashSet<String>();
for( Presence presence : newPresenceRoom )
{
if( !pseudoList.contains( presence.getPseudo() ) )
{
pseudoList.add( presence.getPseudo() );
Image image = new Image( presence.getAvatarUrl() );
image.setPixelSize( 32, 32 );
image.setAltText( presence.getPseudo() );
image.setTitle( presence.getPseudo() );
m_panel.add( image );
}
}
if( pseudoList.size() <= 1 )
{
// user is alone: don't display anything
m_panel.clear();
}
else
{
m_panel.add( m_btnChat );
}
}
示例9: addEditor
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
private EditorView addEditor() {
// Get the correct inner editor view to display, and add it.
final EditorView view = innerEditor.createAndSetView();
// We want the editor to use our view as the source of values.
innerEditor.setView(this);
views.add(view);
insert(view, getWidgetIndex(errorMessage));
// If this is not the first editor view, add a clickable image that, when
// clicked, will remove this editor from the view, as well as the image
// itself.
if (views.size() > 1) {
final Image remove = new Image(Resources.INSTANCE.removeParameter());
remove.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
removeView(view);
remove(remove);
}
});
remove.setAltText("Remove this value");
remove.addStyleName(Resources.INSTANCE.style().removeParameter());
insert(remove, getWidgetIndex(errorMessage));
} else {
insert(addMore, getWidgetIndex(errorMessage));
}
return view;
}
示例10: setResponseContent
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Set the value of the panel reserved for the formatted response. There are a couple different
* scenarios to tackle. If we can determine that the request returned an image, and the request is
* repeatable, we will create an image tag with a source of the original request.
*
* If the response is a non-JSON text type, we just show it directly.
*
* In all other cases we try to process the text as JSON and if for some reason that fails, we
* just hide it under an opaque tag that says as much information as we know about the response.
*
* @param request Request object with the API key replaced.
* @param response Response from the server.
* @param originalPath Path object before we replaced the API key.
* @param linkFactory Which links factory should be used when generating links and navigation
* menus.
*/
private void setResponseContent(ApiRequest request, ApiResponse response, String originalPath,
PrettifierLinkFactory linkFactory) {
HeaderValue authorization = response.getHeaders().get(AUTH_HEADER);
HeaderValue contentTypeHeader = response.getHeaders().get(CONTENT_TYPE_HEADER);
GWT.log("Headers: " + response.getHeaders().entrySet());
String contentType = contentTypeHeader == null ? "Unspecified" : contentTypeHeader.getValue();
if (request.getHttpMethod() == HttpMethod.GET && contentType.startsWith(IMAGE_TYPE_PREFIX)
&& authorization == null) {
// In the very special case that we performed a get and were given an
// image, display it
Image img = new Image();
img.setUrl(Config.getBaseUrl() + originalPath);
img.setAltText(Config.getBaseUrl() + request.getRequestPath());
responseBodyDiv.add(img);
} else if (contentType.startsWith(TEXT_TYPE_PREFIX)) {
// We have non-JSON text, just show it.
responseBodyDiv.add(new Label(response.getBodyAsString()));
} else {
// Treat the response as JSON, although we don't really know what it is
try {
JsonPrettifier.prettify(
request.getService(), responseBodyDiv, response.getBodyAsString(), linkFactory);
} catch (JsonFormatException e) {
// If JSON processing fails, just say what we know about the data
responseBodyDiv.add(new Label("[" + contentType + " data]"));
}
// Check if there was an error, and, if so, display it to the user.
ErrorCase error = getErrorMessage(response);
if (error != null) {
setErrorMessage(error.getErrorLabel());
}
}
}
示例11: close
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
public Image close() {
final Image image = new Image(CommonImages.INSTANCE.close());
image.setAltText(CommonConstants.INSTANCE.Close());
return image;
}