Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. mainPanel.add(successPanel);
  2.  
  3. mainPanel.add(errorPanel);
  4.  
  5. public static void removeWidget(Widget w) {
  6. if (w.getParent() == null) {
  7. RootPanel.get().add(w);
  8. if (RootPanel.isInDetachList(w)) {
  9. RootPanel.detachNow(w);
  10. } else {
  11. try {
  12. // onUnload() gets called *before* everything else (the opposite of
  13. // onLoad()).
  14. w.onUnload();
  15. AttachEvent.fire(w, false);
  16. } catch (Exception e) {
  17. // ??? throws "Should only call onDetach when the widget is attached to the browser's document"
  18. } finally {
  19. // Put this in a finally, just in case onUnload throws an exception.
  20. try {
  21. w.doDetachChildren();
  22. } catch (Exception e) {
  23. // ???
  24. } finally {
  25. // Put this in a finally, in case doDetachChildren throws an exception.
  26. DOM.setEventListener(w.getElement(), null);
  27. //w.attached = false; // ??
  28. }
  29. }
  30. }
  31. } else if (w instanceof HasWidgets) {
  32. ((HasWidgets) w).remove(w);
  33. } else if (w != null) {
  34. throw new IllegalStateException("This widget's parent does not implement HasWidgets");
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement