Re: How to detect if a Popup is showing
Any reason you don't use an enhanced for loop? for (Widget widget : RootPanel.get().getChildren()) { ... } It works because it's looping on widgets, not elements (look at the code, there's an ArrayListWidget to store the child widgets; there's no magic) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/SdJg2pOMhxkJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
getChildren() doesn't exist (in GWT 2.2.0). However, I could have used RootPanel.get().iterator(). I would have thought when GWT compiled the widgets, they would turn into a div or something similar, and their type would be lost, however, I'm clearly wrong, as it works a treat! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/sHlXpT7NcAYJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Sorry, getChildren() does exist, however, it's a protected method. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/EJo_4b9Lj6oJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Oh right, sorry, missed the 'protected' keyword in the javadoc. Note however that HasWidgets extends IterableWidget (hence the existence of RootPanel.get().iterator()) so you could write for (Widget w : RootPanel.get()) { ... } (not sure I like it though) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4-_n8g-6KCgJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
PopupPanels append themselves to RootPanel.get(), so you can loop over RootPanel.get().getChildren() and whenever you see a PopupPanel you can ask if it isShowing(). -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/fn-HhlW2b50J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Thanks Thomas. Much cleaner that way! New code: /** * @return the number of modal popups currently showing */ public static int getNumPopupsShowing() { int result = 0; for (int i=0; iRootPanel.get().getWidgetCount(); i++) { Widget widget = RootPanel.get().getWidget(i); if (widget instanceof PopupPanel) { if (((PopupPanel)widget).isShowing() ((PopupPanel)widget).isModal()) { result++; } } } return result; } I actually thought this wouldn't work when compiled, because I didn't know how it would tell which div was a popup panel, but somehow it does! Go GWT! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/aS7a8ASVEIEJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Thanks Thomas. Much cleaner that way! New code: /** * @return the number of modal popups currently showing */ public static int getNumPopupsShowing() { int result = 0; for (int i=0; iRootPanel.get().getWidgetCount(); i++) { Widget widget = RootPanel.get().getWidget(i); if (widget instanceof PopupPanel ((PopupPanel)widget).isShowing() ((PopupPanel)widget).isModal()) { result++; } } return result; } I actually thought this wouldn't work when compiled, because I didn't know how it would tell which div was a popup panel, but somehow it does! Go GWT! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Zbhl1FMbOXsJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
How to detect if a Popup is showing
Hi, I wanted to check if a popup is showing, so I wrote this method: public static int getNumPopupsShowing() { int result = 0; NodeListElement divs = Document.get().getElementsByTagName(div); for (int i=0; idivs.getLength(); i++) { if (gwt-PopupPanel.equals(divs.getItem(i).getClassName())) { result++; } } return result; } However, is there a better way? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Jwf77I4AUsoJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Popup Panels have a isShowing() method, use that to determine if its currently displayed ~Ashwin On Tue, Jul 12, 2011 at 6:30 AM, Craig Mitchell craig...@gmail.com wrote: Hi, I wanted to check if a popup is showing, so I wrote this method: public static int getNumPopupsShowing() { int result = 0; NodeListElement divs = Document.get().getElementsByTagName(div); for (int i=0; idivs.getLength(); i++) { if (gwt-PopupPanel.equals(divs.getItem(i).getClassName())) { result++; } } return result; } However, is there a better way? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Jwf77I4AUsoJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Thanks Ashwin. Yes, sorry, should have been a little more clear, I wanted to detect if a popup is showing, which I didn't already have the reference to. Apologies for not being more clear. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/IMNOU08ERt0J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to detect if a Popup is showing
Not sure, if there is a automatic way of detecting all child windows to a parent window on demand, but certainly you can main maintain, global array list and every popup window that you open, and call close on each of those. You can lot of examples in javascript - closing child windows to idea. On Jul 11, 7:19 pm, Craig Mitchell craig...@gmail.com wrote: Thanks Ashwin. Yes, sorry, should have been a little more clear, I wanted to detect if a popup is showing, which I didn't already have the reference to. Apologies for not being more clear. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.