List of usage examples for com.google.gwt.user.client.ui Widget getParent
public Widget getParent()
From source file:com.sencha.gxt.widget.core.client.container.Container.java
License:sencha.com license
protected final void adopt(Widget child) { assert (child.getParent() == null); ComponentHelper.setParent(this, child); }
From source file:com.sencha.gxt.widget.core.client.container.Container.java
License:sencha.com license
protected final void orphan(Widget child) { assert (child.getParent() == this); ComponentHelper.setParent(null, child); }
From source file:com.sencha.gxt.widget.core.client.container.ResizeContainer.java
License:sencha.com license
private boolean isParentLayoutRunning() { Widget parent = getParentLayoutWidget(); while ((parent = parent.getParent()) != null) { if (parent instanceof HasWidgets || parent instanceof IndexedPanel) { if (parent instanceof HasLayout && ((HasLayout) parent).isLayoutRunning()) { return true; }/*from w ww. j a v a 2s. com*/ } else { return false; } } return false; }
From source file:com.sencha.gxt.widget.core.client.container.ResizeContainer.java
License:sencha.com license
private boolean parentIsOrWasLayoutRunning() { Widget parent = getParentLayoutWidget(); while ((parent = parent.getParent()) != null) { if (parent instanceof HasWidgets || parent instanceof IndexedPanel) { if (parent instanceof HasLayout) { if (((HasLayout) parent).isOrWasLayoutRunning()) { return true; } else { return false; }/* ww w . java 2s . c o m*/ } } else { return true; } } return true; }
From source file:com.sencha.gxt.widget.core.client.TabPanel.java
License:sencha.com license
/** * Sets the active widget.// w ww . j a v a2 s.c o m * * @param item the widget * @param fireEvents {@code true} to fire events */ public void setActiveWidget(Widget item, boolean fireEvents) { if (item == null || item.getParent() != container) { return; } if (getActiveWidget() != item) { if (fireEvents) { BeforeSelectionEvent<Widget> event = BeforeSelectionEvent.fire(this, item); // event can be null if no handlers if (event != null && event.isCanceled()) { return; } } if (getActiveWidget() != null) { appearance.onDeselect(findItem(getWidgetIndex(getActiveWidget()))); } appearance.onSelect(findItem(getWidgetIndex(item))); container.setActiveWidget(item); if (stack == null) { stack = new AccessStack<Widget>(); } stack.add(item); focusTab(item, false); if (fireEvents) { SelectionEvent.fire(this, item); } delegateUpdates(); } }
From source file:com.smartgwt.mobile.client.widgets.tableview.TableView.java
License:Open Source License
public void setParentNavStack(final NavStack parentNavStack) { if (beforePanelShownRegistration != null) { beforePanelShownRegistration.removeHandler(); beforePanelShownRegistration = null; }/*from w w w .j av a 2 s . c o m*/ this.parentNavStack = parentNavStack; if (parentNavStack == null) { if (_ul != null) _ul.removeClassName(_CSS.tableViewHasParentNavStackClass()); } else { beforePanelShownRegistration = parentNavStack ._addBeforePanelShownHandler(new BeforePanelShownHandler() { @Override public void _onBeforePanelShown(BeforePanelShownEvent event) { if (navigationMode != NavigationMode.WHOLE_RECORD) return; if (TableView.this.parentNavStack != parentNavStack) return; if (!parentNavStack.equals(event.getSource())) return; if (TableView.this.getSelectionType() == SelectionStyle.SINGLE) { final Panel panel = event.getPanel(); if (panel == null) return; Widget w = TableView.this; do { if (w.equals(panel)) { final Record selectedRecord = getSelectedRecord(); if (selectedRecord != null) deselectRecord(selectedRecord); break; } } while ((w = w.getParent()) != null); } } }); } }
From source file:com.smvp4g.mvp.client.core.utils.WidgetUtils.java
License:Open Source License
/** * Remove widget form parent./*from w w w.jav a2 s . co m*/ * * @param widget */ public static void removeFormParent(Object widget) { if (widget instanceof Widget) { Widget parent = ((Widget) widget).getParent(); if (parent != null) { if (parent instanceof WidgetComponent) { //It was wrapped by WidgetComponent. parent = parent.getParent(); } // if (parent instanceof LayoutContainer) { // ((LayoutContainer) parent).remove((Widget)widget); // } // else { ((Widget) widget).removeFromParent(); } } } else if (widget != null) { Log.error("Can't remove cass " + widget.getClass()); } }
From source file:com.square.composants.graphiques.lib.client.composants.IconeErreurChamp.java
License:Open Source License
@Override public void onErreur(ControleIntegriteExceptionEvent event) { final RapportModel rapport = event.getRapport(); final SousRapportModel sousRapport = rapport.recupererElement(nomChamp); if (sousRapport != null && sousRapport.getErreur().booleanValue()) { imgIcone.setTitle(sousRapport.getMessage()); imgIcone.setVisible(true);/*from w w w . j ava 2 s . c om*/ // Si le champ en erreur appartient un bloc dpliable ferm on ouvre le bloc Widget parent = this.getParent(); while (parent != null) { if (parent instanceof CustomDisclosurePanel && !((CustomDisclosurePanel) parent).isOpen()) { ((CustomDisclosurePanel) parent).setOpen(true); } parent = parent.getParent(); } } else { hide(); } }
From source file:com.square.composants.graphiques.lib.client.event.IconeErreurChampManager.java
License:Open Source License
@Override public void fireEvent(final GwtEvent<?> event) { super.fireEvent(event); DeferredCommand.addCommand(new Command() { public void execute() { // On vrifie que l'une des icnes d'erreur a t rendue visible boolean erreurRemontee = false; for (IconeErreurChamp icone : icones) { boolean erreur = icone.isErreur(); Widget parent = icone; while (parent != null) { erreur &= parent.isVisible(); parent = parent.getParent(); }//from w ww . j a v a 2 s . c o m erreurRemontee |= erreur; } // si a n'est pas le cas on affiche l'erreur dans un popup if (event instanceof ControleIntegriteExceptionEvent) { final ControleIntegriteExceptionEvent ciee = (ControleIntegriteExceptionEvent) event; // on affiche la popup dans tous les cas isForcerPopupErreur = true if (!erreurRemontee || (ciee.isForcerPopupErreur() != null && ciee.isForcerPopupErreur())) { final Set<String> messages = new HashSet<String>(); final StringBuilder messageSb = new StringBuilder(); for (SousRapportModel sousRapport : ciee.getRapport().getRapports().values()) { if (sousRapport.getMessage() != null && !sousRapport.getMessage().isEmpty()) { messages.add(sousRapport.getMessage()); } } if (messages.size() > 0) { final String listeAPuce = messages.size() > 1 ? "• " : ""; for (String message : messages) { messageSb.append(listeAPuce).append(message).append("<br/>"); } ErrorPopup.afficher(new ErrorPopupConfiguration(messageSb.toString())); } } } } }); }
From source file:com.sun.labs.aura.dbbrowser.client.query.AttnPanel.java
License:Open Source License
public AttnPanel(AttnDesc[] attns, final TabbedQueryUI parent) { this.attns = attns; this.parent = parent; results = new FlexTable(); setStylePrimaryName("db-ResultsPanel"); setSpacing(5);// w w w . j a va2 s. c o m // // Put in the headers results.setText(0, TYPE_COL, "Type"); results.setText(0, SRC_COL, "Source Key"); results.setText(0, TRG_COL, "Target Key"); results.setText(0, TIME_COL, "Timestamp"); results.setText(0, STRVAL_COL, "String Val"); results.setText(0, LONGVAL_COL, "Long Val"); RowFormatter rf = results.getRowFormatter(); rf.setStylePrimaryName(0, "db-TableHeader"); fillAttns(); center.add(results); add(center, CENTER); Button close = new Button("Close"); close.addClickListener(new ClickListener() { public void onClick(Widget arg0) { parent.removeAttnTab(arg0.getParent()); } }); timeStamp = new Label(); add(timeStamp, SOUTH); AttnDesc info = attns[0]; setQueryInfo(info.getQueryTime(), attns.length - 1, info.getNumTotal()); add(close, SOUTH); service = GWTMainEntryPoint.getDBService(); }