Kudos kjmoroney
Thanks to everyone who participated in this thread.
I had to deal with this very issue this evening and kjmoroney's solution worked flawlessly.
Since I wanted to access non-static members in my dualPaneDragEvent method, I passed in a reference and used slighlty different JSNI:
As for those interested in the mask, I had a Canvas element with a full size HTMLPane that hosted an iframe containing Google maps. Then I just displayed a Mask made up of a canvas with a really high Z-index:
Finally, i Connected the event dragging by using a class Method on my Canvas with the map:
And my drag event ahndler:
I add my drag event support after I call _appRootLayout.draw() in my entry point method. I didn't add an onDraw handler or have to search for children as discussed in this thread.
It would be nice if there was inherit support for capturing resize bar start and stop events in 4.0.
Thanks to everyone who participated in this thread.
I had to deal with this very issue this evening and kjmoroney's solution worked flawlessly.
Since I wanted to access non-static members in my dualPaneDragEvent method, I passed in a reference and used slighlty different JSNI:
Code:
private native void addDragResizeEventsSupport(Canvas container) /*-{ $wnd.icf_dragStartDualPane = function() { container.@com.web.ui.client.MyLayout::dualPaneDragEvent(Ljava/lang/String;)('dragStart'); }; $wnd.icf_dragStopDualPane = function() { container.@com.web.ui.client.MyLayout::dualPaneDragEvent(Ljava/lang/String;)('dragStop'); }; }-*/;
Code:
this.setWidth100(); this.setHeight100(); // Create HTMLPane to hold map div _mapPane = new HTMLPane(); _mapPane.setWidth100(); _mapPane.setHeight100(); _mapPane.setStyleName("map_holder"); // This creates the iFrame to hold the map _mapPane.setContents("<iframe id='" + MAP_IFRAME_ID + "' src='" + "map/map.html" + "' />"); _mapPane.setContentsType(ContentsType.PAGE); _dragMask = new Canvas(); _dragMask.setWidth100(); _dragMask.setHeight100(); _dragMask.setVisible(false); _dragMask.setZIndex(999999); // Add Pane to layout this.addChild(_mapPane); // Add Mask to layout this.addChild(_dragMask);
Code:
public void setShowDragMask(boolean show) { _dragMask.setVisible(show); }
Code:
private void dualPaneDragEvent(String action) { System.out.println("Resize bar dragging event: " + action); if (_map.isVisible()) _map.setShowDragMask(action.equals("dragStart")); }
It would be nice if there was inherit support for capturing resize bar start and stop events in 4.0.
Comment