immediate, 'a');
}
- public static Container getParentLayout(Widget component) {
- Widget parent = component.getParent();
- while (parent != null && !(parent instanceof Container)) {
- parent = parent.getParent();
- }
- if (parent != null && ((Container) parent).hasChildComponent(component)) {
- return (Container) parent;
- }
- return null;
- }
-
/**
* Update generic component features.
*
component.setVisible(visible);
// Set captions
if (manageCaption) {
- final Container parent = getParentLayout(component);
+ final Container parent = Util.getParentLayout(component);
if (parent != null) {
parent.updateCaption((Paintable) component, uidl);
}
// Switch to correct implementation if needed
if (!widgetSet.isCorrectImplementation(component, uidl)) {
- final Container parent = getParentLayout(component);
+ final Container parent = Util.getParentLayout(component);
if (parent != null) {
final Widget w = widgetSet.createWidget(uidl);
parent.replaceChildComponent(component, w);
*
*/
public static native void browserDebugger() /*-{
- if(window.console)
- debugger;
- }-*/;
+ if(window.console)
+ debugger;
+ }-*/;
/**
* Detects if current browser is IE.
* @return true if IE
*/
public static native boolean isIE() /*-{
- var browser=$wnd.navigator.appName;
- if (browser=="Microsoft Internet Explorer") {
- return true;
- }
- return false;
- }-*/;
+ var browser=$wnd.navigator.appName;
+ if (browser=="Microsoft Internet Explorer") {
+ return true;
+ }
+ return false;
+ }-*/;
/**
* Detects if current browser is IE6.
* @return true if IE6
*/
public static native boolean isIE6() /*-{
- var browser=$wnd.navigator.appName;
- if (browser=="Microsoft Internet Explorer") {
- var ua = navigator.userAgent;
- var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
- if (re.exec(ua) != null)
- rv = parseFloat(RegExp.$1);
- if(rv == 6) return true;
- }
- return false;
- }-*/;
+ var browser=$wnd.navigator.appName;
+ if (browser=="Microsoft Internet Explorer") {
+ var ua = navigator.userAgent;
+ var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+ if (re.exec(ua) != null)
+ rv = parseFloat(RegExp.$1);
+ if(rv == 6) return true;
+ }
+ return false;
+ }-*/;
/**
* Nulls oncontextmenu function on given element. We need to manually clear
* @param el
*/
public native static void removeContextMenuEvent(Element el) /*-{
- el.oncontextmenu = null;
- }-*/;
+ el.oncontextmenu = null;
+ }-*/;
/**
* Traverses recursively ancestors until ContainerResizedListener child
}
}
}
+
+ /**
+ * Returns closest parent Widget in hierarchy that implements Container
+ * interface
+ *
+ * @param component
+ * @return closest parent Container
+ */
+ public static Container getParentLayout(Widget component) {
+ Widget parent = component.getParent();
+ while (parent != null && !(parent instanceof Container)) {
+ parent = parent.getParent();
+ }
+ if (parent != null && ((Container) parent).hasChildComponent(component)) {
+ return (Container) parent;
+ }
+ return null;
+ }
}