List of usage examples for com.google.gwt.user.client.ui Widget isAttached
@Override public boolean isAttached()
From source file:gwtupload.client.SingleUploader.java
License:Apache License
/** * This constructor allows to use an existing form panel. * /*from ww w .j a v a 2 s .co m*/ * @param type * file input to use * @param status * Customized status widget to use * @param submitButton * Customized button which submits the form * @param form * Customized form panel */ public SingleUploader(FileInputType type, IUploadStatus status, Widget submitButton, FormPanel form) { super(type, form); final Uploader thisInstance = this; if (status == null) { status = new BaseUploadStatus(); } super.setStatusWidget(status); this.button = submitButton; if (submitButton != null) { submitButton.addStyleName("submit"); if (submitButton instanceof HasClickHandlers) { ((HasClickHandlers) submitButton).addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { thisInstance.submit(); } }); } if (submitButton instanceof HasText) { ((HasText) submitButton).setText(I18N_CONSTANTS.uploaderSend()); } // The user could have attached the button anywhere in the page. if (!submitButton.isAttached()) { super.add(submitButton); } } }
From source file:nz.co.doltech.gwtjui.core.client.Wrapper.java
License:Apache License
/** * Sets the widget to be wrapped by the wrapper. The wrapped widget must be * set before calling any {@link Widget} methods on this object, or adding it * to a panel. This method may only be called once for a given wrapper. * * @param widget the widget to be wrapped */// w ww . j a v a 2 s . com @Override public void setWidget(Widget widget) { // Validate. Make sure the widget is not being set twice. if (this.widget != null) { throw new IllegalStateException("Wrapper.initWidget() may only be " + "called once."); } if (widget == null) { throw new NullPointerException("widget cannot be null"); } // Use the contained widget's element as the composite's element, // effectively merging them within the DOM. setElement((Element) widget.getElement()); // Logical attach. this.widget = widget; this.widget.addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { onLoad(); } else { onUnload(); } } }); if (widget.isAttached()) { // Forcefully invoke the wrapper load. // This can be the case when applying // an already attached widget. onLoad(); } }
From source file:org.bonitasoft.console.client.view.cases.AbstractCaseEditorWidget.java
License:Open Source License
protected void toggleToOverviewMode() { updateOpenStepsPanel();//from w ww . ja v a 2s .co m updateCommentsPanel(); updateRecapPanel(); if (myOverviewInnerPanel.getWidgetIndex(myCaseRecapWidget) == -1) { myOverviewInnerPanel.add(myCaseRecapWidget); if (myCaseHistoryWidget != null) { myOverviewInnerPanel.remove(myCaseHistoryWidget); if (DOMUtils.getInstance().isInternetExplorer()) { myCaseHistoryWidget = null; } } } // if(UserRightsManager.getInstance().isAllowed(RuleType., // myCase.getUUID().getProcessDefinition())) Widget theModeChooser = buildModeChooser(); if (!theModeChooser.isAttached()) { myOverviewInnerPanel.insert(theModeChooser, myOverviewInnerPanel.getWidgetIndex(myCaseRecapWidget)); } // } }
From source file:org.bonitasoft.console.client.view.cases.AbstractCaseEditorWidget.java
License:Open Source License
protected void toggleToStepDetailsMode() { updateOpenStepsPanel();//from ww w. ja v a 2 s .c om updateCommentsPanel(); updateHistoryPanel(); if (myCaseRecapWidget != null) { myOverviewInnerPanel.remove(myCaseRecapWidget); if (DOMUtils.getInstance().isInternetExplorer()) { myCaseRecapWidget = null; } } if (!myCaseHistoryWidget.isAttached()) { myOverviewInnerPanel.add(myCaseHistoryWidget); } // if(UserRightsManager.getInstance().isAllowed(RuleType., // myCase.getUUID().getProcessDefinition())) Widget theModeChooser = buildModeChooser(); if (!theModeChooser.isAttached()) { myOverviewInnerPanel.insert(theModeChooser, myOverviewInnerPanel.getWidgetIndex(myCaseHistoryWidget)); } // } }
From source file:org.gwtportlets.portlet.client.edit.PageEditor.java
License:Open Source License
private void pickupOrAddWidget(LayoutEditor src, Widget widget, String description) { Event ev = DOM.eventGetCurrentEvent(); startWidgetDrag(src, widget, ev == null ? -1 : DOM.eventGetClientX(ev), ev == null ? -1 : DOM.eventGetClientY(ev)); raiseOverlay();//from w w w. j a va 2 s. com pickupBusy = true; boolean pickup = widget.isAttached(); if (pickup) { moveIndicator(heldIndicator, widget); } this.description = description; status.beginOperation(description, "Choose position for widget and click", false, discardHeldWidget); }
From source file:org.gwtportlets.portlet.client.edit.PageEditor.java
License:Open Source License
/** * Move the indicator to cover 'over' and show it. *//* w w w. j av a 2 s.c o m*/ private void moveIndicator(Widget indicator, Widget over) { Rectangle r = LDOM.getBounds(over); if (!indicator.isAttached()) { RootPanel.get().add(indicator); } LDOM.setBounds(indicator, r); }
From source file:org.gwtportlets.portlet.client.edit.PageEditor.java
License:Open Source License
/** * Hide the indicator if it is showing.//w w w . j a v a 2s .c o m */ private void hideIndicator(Widget indicator) { if (indicator.isAttached()) { RootPanel.get().remove(indicator); } }
From source file:org.jboss.errai.common.client.dom.DOMUtil.java
License:Apache License
/** * Appends the underlying {@link HTMLElement} of a {@link Widget} to another {@link HTMLElement}, in a way that does * not break GWT Widget events.//from w ww . j a va 2 s. c o m * * @param parent * The parent element that is appended to. Must not be null. * @param child * The child Widget, whose underlying HTML element will be appended to the parent. Must not be null. */ public static void appendWidgetToElement(final HTMLElement parent, final Widget child) { if (child.isAttached()) { child.removeFromParent(); } RootPanel.detachOnWindowClose(child); parent.appendChild(nativeCast(child.getElement())); onAttach(child); }
From source file:org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil.java
License:Apache License
/** * Appends the underlying {@link HTMLElement} of a {@link Widget} to another {@link HTMLElement}, * in a way that does not break GWT Widget events. * @param parent The parent element that is appended to. Must not be null. * @param child The child Widget, whose underlying HTML element will be * appended to the parent. Must not be null. */// ww w . j av a 2 s . c o m public void appendWidgetToElement(final HTMLElement parent, final Widget child) { if (child.isAttached()) { child.removeFromParent(); } RootPanel.detachOnWindowClose(child); HTMLElement newChild = asHTMLElement(child.getElement()); parent.appendChild(newChild); onAttach(child); }
From source file:org.jboss.errai.workspaces.client.layout.LayoutHint.java
License:Apache License
public static void hintAll() { LayoutHintProvider p;// w w w . j a v a2 s . com for (String s : MANAGED_SUBJECTS.keySet()) { if ((p = findProvider(s)) != null && p.getWidthHint() > 0 && p.getHeightHint() > 0) { MessageBuilder.createMessage().toSubject(s).with(LayoutParts.Width, p.getWidthHint()) .with(LayoutParts.Height, p.getHeightHint()).noErrorHandling().sendNowWith(ErraiBus.get()); } } for (Widget w : MANAGED_WIDGETS.keySet()) { p = findProvider(w); if (p != null && w.isAttached() && p.getWidthHint() > 0 && p.getHeightHint() > 0) { w.setPixelSize(p.getWidthHint(), p.getHeightHint()); } } }