private void fixIE8FocusCaptureIssue() { Element e = DOM.createInputText(); Style elemStyle = e.getStyle(); elemStyle.setPosition(Position.ABSOLUTE); elemStyle.setTop(-10, Unit.PX); elemStyle.setWidth(0, Unit.PX); elemStyle.setHeight(0, Unit.PX); contentPanel.getElement().appendChild(e); e.focus(); contentPanel.getElement().removeChild(e); }
/** * Sets the title to display with this menu button. * * @param label */ public void setLabel(String label) { this.label = label; HTMLPanel labelHtml = new HTMLPanel(label); Style labelStyle = labelHtml.getElement().getStyle(); labelStyle.setColor("white"); labelStyle.setFontSize(0.8, Unit.EM); labelStyle.setFontWeight(FontWeight.BOLD); labelStyle.setPosition(Position.ABSOLUTE); labelStyle.setTextAlign(TextAlign.CENTER); labelStyle.setTop(75, Unit.PCT); labelStyle.setWidth(100, Unit.PCT); panel.add(labelHtml); }
NodePresenter(VGraphExplorer parent, NodeProxy model) { this.parent = parent; this.model = model; graph = parent.getGraph(); view.setTitle(model.getId()); Style style = view.getElement().getStyle(); style.setLeft(model.getX(), Unit.PX); style.setTop(model.getY(), Unit.PX); view.addDomHandler(this, MouseDownEvent.getType()); view.addDomHandler(this, MouseMoveEvent.getType()); view.addDomHandler(this, MouseUpEvent.getType()); parent.add(view); }
/** * Sets the image to use in this menu button. * * @param image */ public void setImage(ImageResource image) { this.image = image; Image imageHtml = new Image(image.getSafeUri()); Style imageStyle = imageHtml.getElement().getStyle(); imageStyle.setDisplay(Display.BLOCK); imageStyle.setProperty("margin", "1.25em auto 0"); imageStyle.setProperty("maxWidth", "60%"); imageStyle.setPosition(Position.ABSOLUTE); imageStyle.setTop(0, Unit.PX); imageStyle.setRight(0, Unit.PX); imageStyle.setBottom(0, Unit.PX); imageStyle.setLeft(0, Unit.PX); panel.add(imageHtml); }
protected ProgressIndicator addProgressIndicator() { final SlideLabel label = new SlideLabel(true); Element labelEl = label.getElement(); Style labelStyle = labelEl.getStyle(); labelStyle.setPosition(Style.Position.ABSOLUTE); labelStyle.setLeft(0, Style.Unit.PX); labelStyle.setRight(0, Style.Unit.PX); labelStyle.setTop(-12, Style.Unit.PX); getWidget().getElement().getParentElement().appendChild(labelEl); return new ProgressIndicator() { public void onProgress(String message) { if (message == null) { label.setText("", true); if (showing_) endProgress(); } else { label.setText(message, false); if (!showing_) { enableControls(false); label.show(); showing_ = true; } } } public void onCompleted() { endProgress(); closeDialog(); } public void onError(String message) { endProgress(); RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage("Error", message); } private void endProgress() { if (showing_) { enableControls(true); label.hide(); showing_ = false; } } private boolean showing_; }; }
private void limitToBoundingBox() { Element element = view.getElement(); Style style = element.getStyle(); int width = element.getOffsetWidth(); model.setWidth(width); int xRadius = width / 2; int leftEdge = model.getX() - xRadius; leftEdge = limit(0, leftEdge, parent.getOffsetWidth() - width); model.setX(leftEdge + xRadius); style.setLeft(leftEdge, Unit.PX); int height = element.getOffsetHeight(); model.setHeight(height); int yRadius = height / 2; int topEdge = model.getY() - yRadius; topEdge = limit(0, topEdge, parent.getOffsetHeight() - height); model.setY(topEdge + yRadius); style.setTop(topEdge, Unit.PX); }
/** * Internal method which opens the gallery dialog. * * <p> */ protected void openGalleryDialog() { String title = org.opencms.gwt.client.Messages.get() .key(org.opencms.gwt.client.Messages.GUI_GALLERY_SELECT_DIALOG_TITLE_0); final CmsFramePopup popup = new CmsFramePopup(title, buildGalleryUrl()); popup.setCloseHandler( new Runnable() { public void run() { m_textbox.setGhostMode(false); } }); popup.setId(m_id); popup.getFrame().setSize("700px", "490px"); popup.center(); CmsPushButton button = new CmsPushButton(I_CmsImageBundle.INSTANCE.style().closeIcon()); Style style = button.getElement().getStyle(); style.setRight(4, Unit.PX); style.setTop(0, Unit.PX); style.setPosition(Position.ABSOLUTE); style.setCursor(Cursor.POINTER); button.addClickHandler( new ClickHandler() { /** * @see * com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ public void onClick(ClickEvent event) { popup.hide(); } }); popup.insertFront(button); }
/** * Constructor. * * <p> */ @SuppressWarnings("unused") private DebugLog() { if (!DEBUG) { return; } m_html = new HTML(); initWidget(m_html); Style style = getElement().getStyle(); style.setWidth(200, Unit.PX); style.setHeight(500, Unit.PX); style.setPadding(10, Unit.PX); style.setOverflow(Overflow.AUTO); style.setBorderStyle(BorderStyle.SOLID); style.setBorderColor(I_LayoutBundle.INSTANCE.constants().css().borderColor()); style.setBorderWidth(1, Unit.PX); style.setPosition(Position.FIXED); style.setTop(50, Unit.PX); style.setRight(50, Unit.PX); style.setBackgroundColor(I_LayoutBundle.INSTANCE.constants().css().backgroundColorDialog()); style.setZIndex(10); }