Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mainPanel.add(successPanel);
- mainPanel.add(errorPanel);
- public static void removeWidget(Widget w) {
- if (w.getParent() == null) {
- RootPanel.get().add(w);
- if (RootPanel.isInDetachList(w)) {
- RootPanel.detachNow(w);
- } else {
- try {
- // onUnload() gets called *before* everything else (the opposite of
- // onLoad()).
- w.onUnload();
- AttachEvent.fire(w, false);
- } catch (Exception e) {
- // ??? throws "Should only call onDetach when the widget is attached to the browser's document"
- } finally {
- // Put this in a finally, just in case onUnload throws an exception.
- try {
- w.doDetachChildren();
- } catch (Exception e) {
- // ???
- } finally {
- // Put this in a finally, in case doDetachChildren throws an exception.
- DOM.setEventListener(w.getElement(), null);
- //w.attached = false; // ??
- }
- }
- }
- } else if (w instanceof HasWidgets) {
- ((HasWidgets) w).remove(w);
- } else if (w != null) {
- throw new IllegalStateException("This widget's parent does not implement HasWidgets");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement