本文整理汇总了Java中com.google.gwt.event.dom.client.LoadHandler类的典型用法代码示例。如果您正苦于以下问题:Java LoadHandler类的具体用法?Java LoadHandler怎么用?Java LoadHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoadHandler类属于com.google.gwt.event.dom.client包,在下文中一共展示了LoadHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFrame
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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.LoadHandler; //导入依赖的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: onAreaClick
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的package包/类
@Test
public void onAreaClick() throws Exception {
// before
ColorfillAreaClickListener colorfillAreaClickListener = mock(ColorfillAreaClickListener.class);
instance.setAreaClickListener(colorfillAreaClickListener);
when(canvasImageDataProvider.getCanvasImageData(canvasStubView)).thenReturn(imageData);
ArgumentCaptor<LoadHandler> loadHandlerCaptor = ArgumentCaptor.forClass(LoadHandler.class);
verify(canvasStubView).setImageLoadHandler(loadHandlerCaptor.capture());
loadHandlerCaptor.getValue()
.onLoad(null);
ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
verify(userInteractionHandlerFactory).applyUserClickHandler(commandCaptor.capture(), eq(canvas));
NativeEvent nativeEvent = mock(NativeEvent.class);
commandCaptor.getValue()
.execute(nativeEvent);
ArgumentCaptor<Area> areaCaptor = ArgumentCaptor.forClass(Area.class);
verify(colorfillAreaClickListener).onAreaClick(areaCaptor.capture());
verify(nativeEvent).preventDefault();
Area area = areaCaptor.getValue();
assertThat(area.getX()).isEqualTo(POSITION_X);
assertThat(area.getY()).isEqualTo(POSITION_Y);
}
示例4: onAreaClickWrongCoordinates
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的package包/类
@Test
public void onAreaClickWrongCoordinates() throws Exception {
ColorfillAreaClickListener colorfillAreaClickListener = mock(ColorfillAreaClickListener.class);
instance.setAreaClickListener(colorfillAreaClickListener);
when(canvasImageDataProvider.getCanvasImageData(canvasStubView)).thenReturn(imageData);
doReturn(-10).when(positionHelper)
.getXPositionRelativeToTarget(any(NativeEvent.class), Matchers.any(Element.class));
doReturn(-15).when(positionHelper)
.getYPositionRelativeToTarget(any(NativeEvent.class), Matchers.any(Element.class));
ArgumentCaptor<LoadHandler> loadHandlerCaptor = ArgumentCaptor.forClass(LoadHandler.class);
verify(canvasStubView).setImageLoadHandler(loadHandlerCaptor.capture());
loadHandlerCaptor.getValue()
.onLoad(null);
ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
verify(userInteractionHandlerFactory).applyUserClickHandler(commandCaptor.capture(), eq(canvas));
NativeEvent nativeEvent = mock(NativeEvent.class);
commandCaptor.getValue()
.execute(nativeEvent);
verify(colorfillAreaClickListener, times(0)).onAreaClick(any(Area.class));
}
示例5: handleDoubleClick
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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();
}
示例6: startDownloadRequest
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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);
}
示例7: TileSet
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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);
}
示例8: setHTML
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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);
}
}
示例9: createHiddenFrame
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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);
}
示例10: checkSetSizeAttachesLoadHandler
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的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.LoadHandler; //导入依赖的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.LoadHandler; //导入依赖的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.LoadHandler; //导入依赖的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.LoadHandler; //导入依赖的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: bindView
import com.google.gwt.event.dom.client.LoadHandler; //导入依赖的package包/类
@Test
public void bindView() throws Exception {
// before
ColorfillAreaClickListener colorfillAreaClickListener = mock(ColorfillAreaClickListener.class);
when(canvasImageDataProvider.getCanvasImageData(canvasStubView)).thenReturn(imageData);
instance.setAreaClickListener(colorfillAreaClickListener);
ArgumentCaptor<LoadHandler> argumentCaptor = ArgumentCaptor.forClass(LoadHandler.class);
verify(canvasStubView).setImageLoadHandler(argumentCaptor.capture());
argumentCaptor.getValue()
.onLoad(null);
verify(userInteractionHandlerFactory).applyUserClickHandler(any(Command.class), eq(canvas));
verify(imageData).flush();
}