本文整理汇总了Java中com.google.gwt.user.client.ui.Image.setUrl方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setUrl方法的具体用法?Java Image.setUrl怎么用?Java Image.setUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Image
的用法示例。
在下文中一共展示了Image.setUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scrollTableAscending
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
@Override
public AbstractImagePrototype scrollTableAscending() {
return new AbstractImagePrototype() {
public void applyTo(Image image) {
image.setUrl("img/sort_asc.gif");
}
public Image createImage() {
return new Image("img/sort_asc.gif");
}
public String getHTML() {
return "<img border=\"0\" src=\"img/sort_asc.gif\"/>";
}
};
}
示例2: scrollTableDescending
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
@Override
public AbstractImagePrototype scrollTableDescending() {
return new AbstractImagePrototype() {
public void applyTo(Image image) {
image.setUrl("img/sort_desc.gif");
}
public Image createImage() {
return new Image("img/sort_desc.gif");
}
public String getHTML() {
return "<img border=\"0\" src=\"img/sort_desc.gif\"/>";
}
};
}
示例3: scrollTableFillWidth
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
@Override
public AbstractImagePrototype scrollTableFillWidth() {
return new AbstractImagePrototype() {
public void applyTo(Image image) {
image.setUrl("img/fill_width.gif");
}
public Image createImage() {
return new Image("img/fill_width.gif");
}
public String getHTML() {
return "<img border=\"0\" src=\"img/fill_width.gif\"/>";
}
};
}
示例4: updateImage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Updates the provided image with the data stored at
* the specified index of the data holders array
* @param dataHolders the list of data holders
* @param index the index of the required data holder
* @param image the image to update
* @param percentWidth the % of client area width that the image is allowed to take
* @param percentHeight the % of client area height that the image is allowed to take
*/
private static void updateImage( final List<BackgroundImageHolder> dataHolders,
final int index, final Image image,
final int percentWidth, final int percentHeight ){
//Check for the proper bounds to avoid index out of bounds exception!!!
if( dataHolders.size() > 0 ) {
final int actual_index = index % dataHolders.size();
if( actual_index >= 0 ) {
final BackgroundImageHolder dataHolder = dataHolders.get( actual_index );
dataHolder.recommendImageSize( percentWidth, percentHeight );
image.setVisible(false);
image.setUrl( dataHolder.url );
image.setSize( dataHolder.getRecommendedWidth()+"px",
dataHolder.getRecommendedHeight()+"px" );
image.setVisible(true);
}
}
}
示例5: loadImage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Shows a resource as the {@code <img>} element.
*/
public void loadImage(String url) {
ClientUtils.setMembers(display, imgContainer);
image = new Image();
image.addLoadHandler(this);
image.addErrorHandler(this);
image.setUrl(url);
drawHandler = imgContainer.addDrawHandler(this);
resizedHandler = imgContainer.addResizedHandler(this);
ClientUtils.fine(LOG, "loadImage url: %s, width: %s", url, image.getWidth());
if (image.getWidth() == 0) {
WidgetCanvas widgetCanvas = new WidgetCanvas(image);
widgetCanvas.setVisible(false);
widgetCanvas.setWidth(1);
widgetCanvas.setHeight(1);
widgetCanvas.draw();
Img loadingImg = new Img("[SKIN]/loadingSmall.gif", 16, 16);
// Img loadingImg = new Img("[SKIN]/shared/progressCursorTracker.gif", 16, 16);
loadingImg.setAltText(i18n.ImportBatchDataSource_State_LOADING());
loadingImg.setPrompt(i18n.ImportBatchDataSource_State_LOADING());
loadingImg.setLayoutAlign(Alignment.CENTER);
imgContainer.setMembers(loadingImg, widgetCanvas);
}
scheduleForRender();
}
示例6: 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;
}
示例7: 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;
}
示例8: prepareMissingTileImage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
private CanvasElement prepareMissingTileImage() {
int tileSize = DjvuContext.getTileSize();
CanvasElement canvas = createImage(tileSize, tileSize);
Context2d context2d = canvas.getContext2d();
context2d.setFillStyle("white");
context2d.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
Image image = new Image();
final ImageElement imageElement = image.getElement().cast();
imageElement.getStyle().setProperty("visibility", "hidden");
Event.setEventListener(imageElement, event -> {
if (Event.ONLOAD == event.getTypeInt()) {
missingTileImage.getContext2d().drawImage(imageElement, 0, 0);
RootPanel.get().getElement().removeChild(imageElement);
}
});
RootPanel.get().getElement().appendChild(imageElement);
image.setUrl(getBlankImageUrl());
return canvas;
}
示例9: buildLoadScreen
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Create main VerticalPanel, add it to the RootPanel and display a loading message
*/
private void buildLoadScreen() {
// Create new main vertical panel to which all other GUI panels shall be added
mainVerPanel = new VerticalPanel();
// Add header image
Image image = new Image();
image.setUrl("/images/header.png");
mainVerPanel.add(image);
// Add loading label
Label loadingLabel = new Label("Loading Application. Please wait...");
mainVerPanel.add(loadingLabel);
// Vertical Panel Settings
mainVerPanel.setSpacing(25);
// Insert the main vertical panel into a scroll panel to allow for scrolling
ScrollPanel sp = new ScrollPanel();
sp.add(mainVerPanel);
// Add main vertical panel inside scroll panel to root panel
RootPanel.get().add(sp);
}
示例10: createTextureFromBytes
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Creates texture region from byte[].
* <p>
* GWT platform requires additional step (as far as i know) to deal with Pixmap. It is need to load Image element
* and wait until it is loaded.
*
* @param bytes Image byte[] representation, not null
* @param consumer Consumer where you should deal with region, not null
*/
public static void createTextureFromBytes(byte[] bytes, final Consumer<TextureRegion> consumer)
{
String base64 = "data:image/png;base64," + new String(Base64Coder.encode(bytes));
final Image image = new Image();
image.setVisible(false);
image.addLoadHandler(new LoadHandler()
{
@Override
public void onLoad(LoadEvent event)
{
ImageElement imageElement = image.getElement().cast();
Pixmap pixmap = new Pixmap(imageElement);
Gdx.app.log("ImageHelper", "pixmap: " + pixmap.getWidth() + "/" + pixmap.getHeight());
final int orgWidth = pixmap.getWidth();
final int orgHeight = pixmap.getHeight();
int width = MathUtils.nextPowerOfTwo(orgWidth);
int height = MathUtils.nextPowerOfTwo(orgHeight);
final Pixmap potPixmap = new Pixmap(width, height, pixmap.getFormat());
potPixmap.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
pixmap.dispose();
TextureRegion region = new TextureRegion(new Texture(potPixmap), 0, 0, orgWidth, orgHeight);
potPixmap.dispose();
RootPanel.get().remove(image);
consumer.accept(region);
}
});
image.setUrl(base64);
RootPanel.get().add(image);
}
示例11: updateAppImage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Helper method to update the app image
* @param url The URL of the image to show
* @param container The container that image widget resides
*/
private void updateAppImage(String url, final Panel container) {
image = new Image();
image.addStyleName("app-image");
image.setUrl(url);
// if the user has provided a gallery app image, we'll load it. But if not
// the error will occur and we'll load default image
image.addErrorHandler(new ErrorHandler() {
public void onError(ErrorEvent event) {
image.setUrl(GalleryApp.DEFAULTGALLERYIMAGE);
}
});
container.add(image);
if(gallery.getSystemEnvironment() != null &&
gallery.getSystemEnvironment().toString().equals("Development")){
final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(String newUrl) {
image.setUrl(newUrl + "?" + System.currentTimeMillis());
}
};
Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
}
}
示例12: initAppStats
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the app's stats fields
* @param container The container that stats fields reside
*/
private void initAppStats(Panel container) {
// Images for stats data
Image numDownloads = new Image();
numDownloads.setUrl(DOWNLOAD_ICON_URL);
Image numLikes = new Image();
numLikes.setUrl(HOLLOW_HEART_ICON_URL);
// Add stats data
container.addStyleName("app-stats");
container.add(numDownloads);
container.add(new Label(Integer.toString(app.getDownloads())));
// Adds dynamic like
initLikeSection(container);
// Adds dynamic feature
initFeatureSection(container);
// Adds dynamic tutorial
initTutorialSection(container);
// Adds dynamic salvage
initSalvageSection(container);
// We are not using views and comments at initial launch
/*
Image numViews = new Image();
numViews.setUrl(NUM_VIEW_ICON_URL);
Image numComments = new Image();
numComments.setUrl(NUM_COMMENT_ICON_URL);
container.add(numViews);
container.add(new Label(Integer.toString(app.getViews())));
container.add(numComments);
container.add(new Label(Integer.toString(app.getComments())));
*/
}
示例13: updateUserImage
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
/**
* Helper method to update the user's image
* @param url The URL of the image to show
* @param container The container that image widget resides
*/
private void updateUserImage(final String url, Panel container) {
userAvatar = new Image();
//setUrl if the new URL is the same one as it was before; an easy workaround is
//to make the URL unique so it forces the browser to reload
userAvatar.setUrl(url + "?" + System.currentTimeMillis());
userAvatar.addStyleName("app-image");
if (profileStatus == PRIVATE) {
//userAvatar.addStyleName("status-updating");
}
// if the user has provided a gallery app image, we'll load it. But if not
// the error will occur and we'll load default image
userAvatar.addErrorHandler(new ErrorHandler() {
public void onError(ErrorEvent event) {
userAvatar.setUrl(GalleryApp.DEFAULTUSERIMAGE);
}
});
container.add(userAvatar);
if(gallery.getSystemEnvironment() != null &&
gallery.getSystemEnvironment().toString().equals("Development")){
final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(String newUrl) {
userAvatar.setUrl(newUrl + "?" + System.currentTimeMillis());
}
};
Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
}
}
示例14: GalleryAppWidget
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
private GalleryAppWidget(final GalleryApp app) {
nameLabel = new Label(app.getTitle());
authorLabel = new Label(app.getDeveloperName());
numDownloadsLabel = new Label(Integer.toString(app.getDownloads()));
numLikesLabel = new Label(Integer.toString(app.getLikes()));
numViewsLabel = new Label(Integer.toString(app.getViews()));
numCommentsLabel = new Label(Integer.toString(app.getComments()));
image = new Image();
image.addErrorHandler(new ErrorHandler() {
public void onError(ErrorEvent event) {
image.setUrl(GalleryApp.DEFAULTGALLERYIMAGE);
}
});
String url = gallery.getCloudImageURL(app.getGalleryAppId());
image.setUrl(url);
if(gallery.getSystemEnvironment() != null &&
gallery.getSystemEnvironment().toString().equals("Development")){
final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(String newUrl) {
image.setUrl(newUrl + "?" + System.currentTimeMillis());
}
};
Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
}
}
示例15: createImageElement
import com.google.gwt.user.client.ui.Image; //导入方法依赖的package包/类
public Image createImageElement(int resourceId, String title, String url) {
final Image image = new Image();
image.getElement().setId(IMG_ID_PREFIX + resourceId);
image.setUrl(url);
image.getElement().setAttribute(ATTR_DATA_IMAGE, url);
image.getElement().setAttribute(ATTR_DATA_DESCRIPTION, title);
image.getElement().setAttribute(ATTR_ALT, title);
image.getElement().setAttribute(ATTR_STYLE, HIDDEN);
return image;
}