handlerManager = new HandlerManager(this);
carousel.addPhotoClickHandler(new PhotoClickHandler() {
public void photoClicked(PhotoClickEvent event) {
if (event.getPhotoIndex() == target.getCurrentPhotoIndex()) {
PhotoFocusEvent evt = new PhotoFocusEvent();
evt.setPhoto(event.getPhoto());
evt.setPhotoIndex(event.getPhotoIndex());
lastFocusEvent = evt;
handlerManager.fireEvent(evt);
}
}
});
addPhotoFocusHandler(new PhotoFocusHandler() {
public void photoFocused(PhotoFocusEvent event) {
if (popup == null) {
lightbox = DOM.createDiv();
lightbox.setClassName("lightbox");
if (getUserAgent().contains("msie")) {
lightbox.setClassName("lightbox lightboxIE");
}
lightbox.getStyle().setProperty("zIndex", "100");
RootPanel.getBodyElement().appendChild(lightbox);
popup = new PopupPanel(true,true);
popupImage = new Image();
dockPanel.add(popupImage, DockPanel.CENTER);
popup.add(dockPanel);
popup.getElement().getStyle().setProperty("zIndex", "150");
popup.addCloseHandler(new CloseHandler<PopupPanel>(){
public void onClose(CloseEvent<PopupPanel> event) {
popup.hide();
lightbox.getStyle().setProperty("display", "none");
PhotoUnfocusEvent evt = new PhotoUnfocusEvent();
evt.setPhotoIndex(lastFocusEvent.getPhotoIndex());
evt.setPhoto(lastFocusEvent.getPhoto());
handlerManager.fireEvent(evt);
}
});
}