public String getInnerHTML() { // if this canvas is being redrawn, detach underlying gwt widget so that onDraw() // can correctly reassociate it with container div if (widget.isAttached()) widget.removeFromParent(); return "<DIV STYLE='width:100%;height:100%' ID=" + this.getID() + "_widget></DIV>"; }
/** * This constructor allows to use an existing form panel. * * @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.add(status.getWidget()); } 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); } } }
@Override public void onResize(final ResizeEvent event) { if (!widget.isAttached()) { return; } widget.setHeight(getHeight() + "px"); }
Candidate(DropController dropController) { this.dropController = dropController; Widget target = dropController.getDropTarget(); if (!target.isAttached()) { throw new IllegalStateException( "Unattached drop target. You must call DragController#unregisterDropController for all drop targets not attached to the DOM."); } targetArea = new WidgetArea(target, null); }
protected void onDraw() { // a GWT widget must be attached to a GWT Panel for its events to fire. boolean attached = widget.isAttached(); if (!attached) { RootPanel rp = RootPanel.get(this.getID() + "_widget"); rp.add(widget); String width = DOM.getStyleAttribute(widget.getElement(), "width"); if (width != null && !width.equals("")) { setWidth(width); } String height = DOM.getStyleAttribute(widget.getElement(), "height"); if (height != null && !height.equals("")) { setHeight(height); } } }
@Override public void forceResize() { if (!widget.isAttached()) { return; } if (widget.getOffsetHeight() != getHeight()) { DeferredCommand.addCommand( new Command() { @Override public void execute() { widget.setHeight(getHeight() + "px"); } }); } }
@Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { // super.onConnectorHierarchyChange(event); // Remove old children for (ComponentConnector child : event.getOldChildren()) { if (child.getParent() != this) { Widget widget = child.getWidget(); if (widget.isAttached()) { getWidget().remove(widget); } } } // Add or move children int index = 0; for (ComponentConnector child : getChildComponents()) { getWidget().addOrMove(child.getWidget(), index); ++index; } }