GWT:从ClickHandler中的函数返回VerticalPanel
我试图在点击图像时弹出一个窗口。下面是一段代码:GWT:从ClickHandler中的函数返回VerticalPanel,gwt,return,popuppanel,Gwt,Return,Popuppanel,我试图在点击图像时弹出一个窗口。下面是一段代码: while(index<bookList.size()){ if(cellCount<4){ image[index] = new Image(imageList.get(index)); final int imageIndex = index; table.setWidget(row, cellCount, new Image(bookList
while(index<bookList.size()){
if(cellCount<4){
image[index] = new Image(imageList.get(index));
final int imageIndex = index;
table.setWidget(row, cellCount, new Image(bookList.get(index)));
table.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
VerticalPanel vPanel = new VerticalPanel();
vPanel = imageDetail.getPopup(popup, image[imageIndex]);
popup.setAnimationEnabled(true);
popup.setGlassEnabled(true);
popup.setAutoHideEnabled(false);
popup.setWidth("300px");
popup.setHeight("300px");
popup.add(vPanel);
popup.center();
}});
table.getFlexCellFormatter().setStyleName(row, cellCount, "ImageCell");
cellCount++;
index++;
}
我的问题如下:
1) 从功能返回面板可以吗?若否,原因为何?如果是,为什么上面的代码会给出“未捕获的异常转义com.google.gwt.event.shared.umbleraexception:3捕获的异常:null;null;null”
2) 当我尝试在“getPopup”函数中将垂直面板添加到弹出面板并从中获取弹出面板时,代码返回的错误与第一个问题中提到的相同。我错过了什么
我是否缺少任何initWidget(w)函数调用
谢谢雨伞例外情况没有多大帮助。尝试使用DevMode或SuperDevMode来获取实际的异常。嗨,Baz,我只是想知道为什么我会得到这个异常,以及我应该做些什么来消除它。我不能告诉你,因为
umbralleexception
是javascript代码抛出的所有异常的包装器。它可能是任何东西。如果您能找出实际的异常情况,我们可能会提供帮助。向下滚动堆栈跟踪。最后一个是真正的异常。我运行了调试器,发现没有调用“getPopup”方法。调试器对onClick方法的前两行进行了三次迭代(imageList的长度为3),然后抛出null异常。现在我试图弄清楚为什么不调用“getPopup”函数。
public class ImageDetails extends Composite {
private Image closeButton;
VerticalPanel getPopup(final PopupPanel popup, Image image){
VerticalPanel vPanel = new VerticalPanel();
//Close Button
HorizontalPanel closePanel = new HorizontalPanel();
closeButton = new Image("/Images/closebutton.jpg");
closeButton.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
popup.hide();
}});
closePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
closePanel.add(closeButton);
vPanel.add(closePanel);
VerticalPanel imagePanel = new VerticalPanel();
imagePanel.add(image);
vPanel.add(imagePanel);
return vPanel;
}