本文整理汇总了Java中com.google.gwt.event.dom.client.LoadEvent类的典型用法代码示例。如果您正苦于以下问题:Java LoadEvent类的具体用法?Java LoadEvent怎么用?Java LoadEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoadEvent类属于com.google.gwt.event.dom.client包,在下文中一共展示了LoadEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFrame
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
private Frame createFrame() {
final Frame frame = new Frame(DEFAULT_TEMPLATE_PATH);
frame.getElement().setId(DEFAULT_FRAME_NAME);
frame.setTitle(UIMessages.INSTANCE.previewTitle());
frame.setWidth("500px");
frame.setHeight("500px");
frame.getElement().getStyle().setBackgroundColor("gray");
frame.setVisible(true);
RootPanel.get().add(frame);
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
frame.getElement().getStyle().setBackgroundColor("white");
zoomPageComboBox.setValue(75);
}
});
return frame;
}
示例2: setImageUrl
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public void setImageUrl(String src, int width, int height) {
this.width = width;
this.height = height;
imageView = new Image();
imageView.setUrl(src);
RootPanel.get().add(imageView);
imageView.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(final LoadEvent event) {
imageView.removeFromParent();
createCanvasAndAddToView(imageView);
if (loadHandler.isPresent()) {
loadHandler.get().onLoad(event);
}
}
});
}
示例3: handleDoubleClick
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
protected void handleDoubleClick(TableData.Row row) {
VerticalPanel vp = new VerticalPanel();
final Image previewImage = new Image(getFullSizeUrl(row));
final HTML caption = new HTML(getPopUpCaption(row));
String title = getThumbnailDesc(row).replace("<em>", "").replace("</em>", "");
caption.setWidth("320px");
previewImage.addLoadHandler(new LoadHandler() {
public void onLoad(LoadEvent ev) {
caption.setWidth(previewImage.getWidth() + "px");
}
});
GwtUtil.setStyle(vp, "margin", "8px");
vp.setCellHorizontalAlignment(previewImage, HasHorizontalAlignment.ALIGN_CENTER);
vp.setCellVerticalAlignment(previewImage, HasVerticalAlignment.ALIGN_MIDDLE);
vp.add(previewImage);
vp.add(caption);
PopupPane popupPane = new PopupPane(title, vp, PopupType.STANDARD, false, false);
popupPane.show();
}
示例4: onLoad
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public void onLoad(LoadEvent ev) {
final Image imw = (Image) ev.getSource();
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
public void execute() {
if (_imageWidget.getWidgetIndex(imw) > -1) {
imw.setPixelSize(_tile._width, _tile._height);
ViewPortPt addPt= _plot.getViewPortCoords(new ScreenPt(_tile._x, _tile._y));
_imageWidget.setWidgetPosition(imw, addPt.getIX(), addPt.getIY());
if (!_firstReloadComplete) {
onFirstLoadComplete();
_firstReloadComplete = true;
}
}
}
});
}
示例5: startDownloadRequest
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public void startDownloadRequest(String aUrlPrefix, final int aRequestType, Map<String, String> aParams, RequestBuilder.Method aMethod) throws Exception {
final Frame frame = new Frame();
frame.setVisible(false);
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
Timer timer = new Timer() {
@Override
public void run() {
frame.removeFromParent();
}
};
timer.schedule(2000);
}
});
String query = "";
for (Map.Entry<String, String> ent : aParams.entrySet()) {
query += param(ent.getKey(), ent.getValue()) + "&";
}
query += param(PlatypusHttpRequestParams.TYPE, String.valueOf(aRequestType));
frame.setUrl(apiUrl + aUrlPrefix + "?" + query);
RootPanel.get().add(frame);
}
示例6: TileSet
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public TileSet(String path, int tileSize) {
this.tileSize = tileSize;
img = new Image();
// TODO add to a hidden block
RootPanel.get("resourceLoader").add(img);
img.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
imgElement = ImageElement.as(img.getElement());
initImageParameters(imgElement.getWidth(), imgElement.getHeight());
}
});
img.setUrl(path);
}
示例7: setHTML
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public void setHTML(final String html) {
if (!isLoaded) {
loadHandler = addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
Scheduler.get().scheduleDeferred(
new Scheduler.ScheduledCommand() {
@Override
public void execute() {
_setHTML(html);
}
});
}
});
} else {
_setHTML(html);
}
}
示例8: createHiddenFrame
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
private void createHiddenFrame(PrintFinishedInfo info) {
final Frame frame = new Frame();
frame.setVisible(false);
UrlBuilder builder = new UrlBuilder(info.getUrl());
for (String name : info.getParams().keySet()) {
builder.addParameter(name, info.getParams().get(name));
}
frame.setUrl(builder.toString());
frame.setPixelSize(0, 0);
frame.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
frame.getElement().getStyle().setBorderWidth(0, Style.Unit.PX);
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
frame.removeFromParent();
}
});
RootPanel.get().add(frame);
}
示例9: onLoad
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public void onLoad(LoadEvent event) {
loadHandler.removeHandler();
errHandler.removeHandler();
Image img = (Image) event.getSource();
if (img != null) {
img.setVisible(true);
realWidth = img.getWidth();
realHeight = img.getHeight();
}
if (containerId != null && RootPanel.get(containerId) != null) {
RootPanel.get(containerId).add(thisInstance);
}
if (onLoad != null) {
onLoad.onLoad(thisInstance);
}
}
示例10: checkSetSizeAttachesLoadHandler
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
@Test
public void checkSetSizeAttachesLoadHandler() {
navigatorThumbnailItemView.setItemPxSize(100,
200);
final ArgumentCaptor<LoadHandler> loadHandlerArgumentCaptor = ArgumentCaptor.forClass(LoadHandler.class);
when(thumbImage.getWidth()).thenReturn(100);
when(thumbImage.getHeight()).thenReturn(200);
verify(thumbImage).addLoadHandler(loadHandlerArgumentCaptor.capture());
final LoadHandler loadHandler = loadHandlerArgumentCaptor.getValue();
assertNotNull(loadHandler);
loadHandler.onLoad(mock(LoadEvent.class));
verify(body).setPixelSize(eq(100),
eq(200));
}
示例11: SpritePlateAnimation
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public SpritePlateAnimation(String imageUrl, double frameRate, int frameCount, int framesAcross)
{
m_frameRate = frameRate;
m_frameCount = frameCount;
m_framesAcross = framesAcross;
Image img = new Image();
m_image = ImageElement.as(img.getElement());
img.addLoadHandler(new LoadHandler()
{
@Override public void onLoad(LoadEvent event)
{
m_loaded = true;
m_frameWidth = m_image.getWidth() / m_framesAcross;
int framesDown = m_frameCount / m_framesAcross;
framesDown += (m_frameCount % m_framesAcross) > 0 ? 1 : 0;
m_frameHeight = m_image.getHeight() / framesDown;
}
});
img.setVisible(false);
RootPanel.get().add(img);
img.setUrl(imageUrl);
}
示例12: add
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
@Override
public void add(final Widget child) {
if(child instanceof GalleryImage) {
((GalleryImage) child).addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
if(thumbnailWidth != null) {
child.setWidth(thumbnailWidth);
}
if(thumbnailHeight != null) {
child.setHeight(thumbnailHeight);
}
}
});
super.add(child);
} else {
throw new IllegalArgumentException("Gallery can only contain GalleryImage's.");
}
}
示例13: init
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
public void init(final ExternalEmpiriaApi api, final ExternalFrameLoadHandler<T> onLoadHandler) {
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
T obj = init(frame.getElement(), api);
onLoadHandler.onExternalModuleLoaded(obj);
}
});
}
示例14: postConstruct
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的package包/类
@PostConstruct
public void postConstruct() {
canvasStubView.setPanelStyle(styleNameConstants.QP_COLORFILL_IMG());
canvasStubView.setImageLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
canvasStubViewLoded = true;
bindView();
}
});
}
示例15: createTextureFromBytes
import com.google.gwt.event.dom.client.LoadEvent; //导入依赖的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);
}