List of usage examples for com.google.gwt.user.client.ui RootPanel detachNow
public static void detachNow(Widget widget)
From source file:bz.davide.dmweb.shared.view.DMGwtWidgetHostAttachHandler.java
License:Open Source License
@Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { if (this.gwtWidget == null) { this.gwtWidget = this.factory.create(); }//from w ww . jav a2 s.co m (this.htmlPanel = HTMLPanel.wrap(this.widget.getElement())).add(this.gwtWidget); } else { RootPanel.detachNow(this.htmlPanel); this.htmlPanel = null; } }
From source file:com.arcbees.gquery.tooltip.client.TooltipImpl.java
License:Apache License
private void detachWidget() { if (widget != null && RootPanel.isInDetachList(widget.asWidget())) { RootPanel.detachNow(widget.asWidget()); $(widget.asWidget()).get(0).removeFromParent(); }// ww w .j a va 2s . c o m }
From source file:com.cgxlib.xq.client.plugins.widgets.WidgetsHtmlPanel.java
License:Apache License
/** * Adopt the {@link Widget widet} <code>w</code>. if the current parent of the * widget is an {@link HTMLPanel} or is null, the widget will not detach * physically in order to maintain the html structure. If the parent is an * other widget, it will be physically detach and reattach to this panel. * * @param w//from w w w . j ava 2 s .c om */ protected void doAdopt(Widget w) { Widget parent = w.getParent(); boolean mustBePhysicallyReattach = false; if (parent == null) { if (RootPanel.isInDetachList(w)) { RootPanel.detachNow(w); } } else if (parent instanceof HTMLPanel) { WidgetsUtils.doLogicalDetachFromHtmlPanel(w); } else { // the widget will be physically detach w.removeFromParent(); mustBePhysicallyReattach = true; } getChildren().add(w); if (mustBePhysicallyReattach) { DOM.appendChild(getElement(), w.getElement()); } adopt(w); }
From source file:com.google.gerrit.client.Gerrit.java
License:Apache License
private void onModuleLoad2(HostPageData hpd) { RESOURCES.gwt_override().ensureInjected(); RESOURCES.css().ensureInjected();//from w ww . jav a 2s. c om final RootPanel gTopMenu = RootPanel.get("gerrit_topmenu"); final RootPanel gStarting = RootPanel.get("gerrit_startinggerrit"); final RootPanel gBody = RootPanel.get("gerrit_body"); final RootPanel gBottomMenu = RootPanel.get("gerrit_btmmenu"); gTopMenu.setStyleName(RESOURCES.css().gerritTopMenu()); gBody.setStyleName(RESOURCES.css().gerritBody()); final Grid menuLine = new Grid(1, 3); menuLeft = new MorphingTabPanel(); menuRight = new LinkMenuBar(); searchPanel = new SearchPanel(); menuLeft.setStyleName(RESOURCES.css().topmenuMenuLeft()); menuLine.setStyleName(RESOURCES.css().topmenu()); gTopMenu.add(menuLine); final FlowPanel menuRightPanel = new FlowPanel(); menuRightPanel.setStyleName(RESOURCES.css().topmenuMenuRight()); menuRightPanel.add(searchPanel); menuRightPanel.add(menuRight); menuLine.setWidget(0, 0, menuLeft); menuLine.setWidget(0, 1, new FlowPanel()); menuLine.setWidget(0, 2, menuRightPanel); final CellFormatter fmt = menuLine.getCellFormatter(); fmt.setStyleName(0, 0, RESOURCES.css().topmenuTDmenu()); fmt.setStyleName(0, 1, RESOURCES.css().topmenuTDglue()); fmt.setStyleName(0, 2, RESOURCES.css().topmenuTDmenu()); siteHeader = RootPanel.get("gerrit_header"); siteFooter = RootPanel.get("gerrit_footer"); body = new ViewSite<Screen>() { @Override protected void onShowView(Screen view) { final String token = view.getToken(); if (!token.equals(History.getToken())) { History.newItem(token, false); dispatchHistoryHooks(token); } if (view instanceof ChangeListScreen) { lastChangeListToken = token; } super.onShowView(view); view.onShowView(); } }; gBody.add(body); RpcStatus.INSTANCE = new RpcStatus(gTopMenu); JsonUtil.addRpcStartHandler(RpcStatus.INSTANCE); JsonUtil.addRpcCompleteHandler(RpcStatus.INSTANCE); JsonUtil.setDefaultXsrfManager(new XsrfManager() { @Override public String getToken(JsonDefTarget proxy) { return xGerritAuth; } @Override public void setToken(JsonDefTarget proxy, String token) { // Ignore the request, we always rely upon the cookie. } }); gStarting.getElement().getParentElement().removeChild(gStarting.getElement()); RootPanel.detachNow(gStarting); applyUserPreferences(); initHistoryHooks(); populateBottomMenu(gBottomMenu, hpd); refreshMenuBar(); History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(final ValueChangeEvent<String> event) { display(event.getValue()); } }); JumpKeys.register(body); String token = History.getToken(); if (token.isEmpty()) { token = isSignedIn() ? PageLinks.MINE : PageLinks.toChangeQuery("status:open"); } if (signInAnchor != null) { signInAnchor.setHref(loginRedirect(token)); } saveDefaultTheme(); loadPlugins(hpd, token); }
From source file:org.nsesa.editor.gwt.amendment.client.ui.amendment.AmendmentViewImpl.java
License:EUPL
@Override public void detach() { if (isAttached()) { onDetach();//from w ww . j a va 2s . c o m if (getElement().getParentElement() == null) RootPanel.detachNow(this); } }
From source file:org.nuxeo.ecm.platform.gwt.client.ui.SmartWidget.java
License:Apache License
@Override protected void onDestroy() { boolean attached = widget.isAttached(); if (attached) { RootPanel.detachNow(widget); }//www .j av a 2 s. c om widget = null; }
From source file:org.xwiki.gwt.wysiwyg.client.WysiwygEditorApi.java
License:Open Source License
/** * Releases the editor so that it can be garbage collected before the page is unloaded. Call this method before the * editor is physically detached from the DOM document. *///from www . ja v a 2 s .c om public void release() { if (editor != null) { // Logical detach. Widget container = editor.getUI(); while (container.getParent() != null) { container = container.getParent(); } RootPanel.detachNow(container); editor = null; } }
From source file:ru.codeinside.gses.vaadin.client.VJsonFormIntegration.java
License:Mozilla Public License
@Override protected void onDetach() { if (frame != null) { RootPanel.detachNow(frame); }/*from ww w . ja v a2s . c o m*/ if (browserElement != null) { browserElement.setAttribute("src", "about:blank"); } super.onDetach(); }