本文介绍了GWT自举3库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试运行gwt引导3库的演示功能。
当我在GWTBootstrap3演示中打开一张图片时,它会以弹出窗口的形式打开。当我在应用程序中打开它时。它跟随着我选择的图片的链接。我做错了什么?
我的UI绑定器代码是
<gallery:Gallery ui:field="gallery" thumbnailWidth="100px" thumbnailHeight="100px">
<gallery:GalleryImage url="https://farm1.static.flickr.com/655/21391422043_68c98789bf_b.jpg" />
<gallery:GalleryImage url="https://farm1.static.flickr.com/582/21830878218_f7e24ec74d_b.jpg" />
<gallery:GalleryImage url="https://farm6.static.flickr.com/5707/21832711448_02e33b3b3b_b.jpg" />
<gallery:GalleryImage url="https://farm1.static.flickr.com/567/22011206725_9d0b3dc1ae_b.jpg" />
<gallery:GalleryImage url="https://farm1.static.flickr.com/670/22016240921_6fca2b20ce_b.jpg" />
<gallery:GalleryImage url="https://farm6.static.flickr.com/5833/21401954003_27f145bc32_b.jpg" />
<gallery:GalleryImage url="https://farm6.static.flickr.com/5686/21997628766_9845a40fdc_b.jpg" />
<gallery:GalleryImage url="https://farm6.static.flickr.com/5637/21393309814_17ca189d39_b.jpg" />
<gallery:GalleryImage url="https://farm1.static.flickr.com/660/22018439171_06358ee107_b.jpg" />
<gallery:GalleryImage url="https://farm6.static.flickr.com/5757/21829896778_e9febcfec8_b.jpg" />
<gallery:GalleryImage url="https://farm6.static.flickr.com/5799/21837884439_b5cfe23d60_b.jpg" />
<gallery:GalleryImage url="https://farm1.static.flickr.com/616/21833374820_2c2a1ee5a7_b.jpg" />
</gallery:Gallery>
与http://gwtbootstrap3.github.io/gwtbootstrap3-demo/snapshot/#gallery
中的示例代码完全相同推荐答案
因为我无法解决原始问题,所以我解决了设置DecoretedPopupPanel&o;的问题。我的样例代码如下所示。首先,我使用点击处理程序添加图片缩略图:
ClickHandler cH= new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Image iImg=(Image)event.getSource();
showPicture (iImg.getUrl());
}
};
如果按下拇指,我将打开弹出窗口...
/**
* Zeige in einem PopupFenster ein Bild möglichst groß an
* @param strURL
*/
public static void showPicture(String strURL) {
po.clear();
Image iNew=new Image(strURL);
float iY=iNew.getHeight();
float iX=iNew.getWidth();
float iWX=Window.getClientWidth();
float iWY=Window.getClientHeight()-120;
boolean bDo=true;
//adjustiere die Bildgröße
while (bDo) {
float iXAdjust=iX/iWX;
float iYAdjust=iY/iWY;
if (iXAdjust<0.5 && iYAdjust<0.5) {
iY=iY*2;
iX=iX*2;
}
else if (iXAdjust>1 || iYAdjust>1) {
if (iXAdjust>iYAdjust) {
iY=iY/iXAdjust;
iX=iX/iXAdjust;
}
else {
iY=iY/iYAdjust;
iX=iX/iYAdjust;
}
bDo=false;
//iY=iY/2;
//iX=iX/2;
}
else {
bDo=false;
}
}
mI.setImageData(strURL);
//neu
mI.iImage.setUrl(iNew.getUrl());//=iNew;
mI.iImage.setPixelSize((int)iX, (int)iY);
mI.iImage.addClickHandler( new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
po.hide();
}
});
po.add(mI);
po.center();
po.setGlassEnabled(true);
po.setAutoHideEnabled(true);
po.show();
}
这篇关于GWT自举3库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!