List of usage examples for com.google.gwt.dom.client Style setHeight
public void setHeight(double value, Unit unit)
From source file:com.google.walkaround.wave.client.Walkaround.java
License:Open Source License
/** Reveals the log div, and executes a task when done. */ // The async API for this method is intended to support two things: a cool // spew animation, and also the potential to runAsync the whole LogPanel code. private static void attachLogPanel() { Logs.get().addHandler(domLogger);/*w ww. j a va 2s.c om*/ final Panel logHolder = RootPanel.get("logHolder"); logHolder.setVisible(true); // Need one layout and paint cycle after revealing it to start animation. // Use high priority to avoid potential starvation by other tasks if a // problem is occurring. SchedulerInstance.getHighPriorityTimer().scheduleDelayed(new Task() { @Override public void execute() { logHolder.add(domLogger); Style waveStyle = Document.get().getElementById(WAVEPANEL_PLACEHOLDER).getStyle(); Style logStyle = logHolder.getElement().getStyle(); logStyle.setHeight(250, Unit.PX); waveStyle.setBottom(250, Unit.PX); } }, 50); }
From source file:com.haulmont.cuba.web.toolkit.ui.client.downloader.CubaFileDownloaderConnector.java
License:Apache License
public void downloadFileById(String resourceId) { final String url = getResourceUrl(resourceId); if (url != null && !url.isEmpty()) { final IFrameElement iframe = Document.get().createIFrameElement(); Style style = iframe.getStyle(); style.setVisibility(Style.Visibility.HIDDEN); style.setHeight(0, Style.Unit.PX); style.setWidth(0, Style.Unit.PX); iframe.setFrameBorder(0);//from w ww.j a v a2 s . c o m iframe.setTabIndex(-1); iframe.setSrc(url); RootPanel.getBodyElement().appendChild(iframe); Timer removeTimer = new Timer() { @Override public void run() { iframe.removeFromParent(); } }; removeTimer.schedule(60 * 1000); } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.fieldgrouplayout.CubaFieldGroupLayoutComponentSlot.java
License:Apache License
@Override public void positionVertically(double currentLocation, double allocatedSpace, double marginBottom) { if (!isCaptionInline()) { super.positionVertically(currentLocation, allocatedSpace, marginBottom); return;/*ww w . jav a 2 s . c o m*/ } // CAUTION copied from VLayoutSlot.positionVertically(~) Style style = wrapper.getStyle(); double contentHeight = allocatedSpace; int captionHeight; VCaption caption = getCaption(); if (caption == null || caption.shouldBePlacedAfterComponent() || isCaptionInline()) { style.clearPaddingTop(); captionHeight = 0; } else { captionHeight = getCaptionHeight(); contentHeight -= captionHeight; if (contentHeight < 0) { contentHeight = 0; } style.setPaddingTop(captionHeight, Style.Unit.PX); } if (marginBottom > 0) { style.setMarginBottom(marginBottom, Style.Unit.PX); } else { style.clearMarginBottom(); } if (isRelativeHeight()) { style.setHeight(contentHeight, Style.Unit.PX); } else { style.clearHeight(); } double allocatedContentHeight = 0; if (isRelativeHeight()) { String height = getWidget().getElement().getStyle().getHeight(); double percentage = parsePercent(height); allocatedContentHeight = contentHeight * (percentage / 100); reportActualRelativeHeight(Math.round((float) allocatedContentHeight)); } AlignmentInfo alignment = getAlignment(); if (!alignment.isTop()) { double usedHeight; if (isRelativeHeight()) { if (isCaptionInline()) { usedHeight = allocatedContentHeight; } else { usedHeight = captionHeight + allocatedContentHeight; } } else { usedHeight = getUsedHeight(); } if (alignment.isVerticalCenter()) { currentLocation += (allocatedSpace - usedHeight) / 2d; } else { currentLocation += (allocatedSpace - usedHeight); } } style.setTop(currentLocation, Style.Unit.PX); }
From source file:com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.CubaFileUploadProgressWindow.java
License:Apache License
private void fixIE8FocusCaptureIssue() { Element e = DOM.createInputText(); Style elemStyle = e.getStyle(); elemStyle.setPosition(Style.Position.ABSOLUTE); elemStyle.setTop(-10, Style.Unit.PX); elemStyle.setWidth(0, Style.Unit.PX); elemStyle.setHeight(0, Style.Unit.PX); contentPanel.getElement().appendChild(e); e.focus();//from w w w . j a v a2s .c om contentPanel.getElement().removeChild(e); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.gridlayout.VDDGridLayout.java
License:Apache License
/** * Emphasizes a component container when user is hovering a dragged * component over the container.//from ww w .j ava 2s .c o m * * @param cell * The container * @param event */ protected void emphasis(CellDetails cell, VDragEvent event) { Style shadowStyle = dragShadow.getElement().getStyle(); shadowStyle.setPosition(Position.ABSOLUTE); shadowStyle.setWidth(cell.width, Unit.PX); shadowStyle.setHeight(cell.height, Unit.PX); shadowStyle.setLeft(cell.x, Unit.PX); shadowStyle.setTop(cell.y, Unit.PX); // Remove any existing empasis deEmphasis(); // Ensure we are not dragging ourself into ourself ComponentConnector draggedConnector = (ComponentConnector) event.getTransferable() .getData(Constants.TRANSFERABLE_DETAIL_COMPONENT); if (draggedConnector != null && draggedConnector.getWidget() == VDDGridLayout.this) { return; } HorizontalDropLocation hl = getHorizontalDropLocation(cell, event); VerticalDropLocation vl = getVerticalDropLocation(cell, event); // Apply over style setStyleName(dragShadow.getElement(), OVER, true); // Add vertical location dependent style setStyleName(dragShadow.getElement(), OVER + "-" + vl.toString().toLowerCase(), true); // Add horizontal location dependent style setStyleName(dragShadow.getElement(), OVER + "-" + hl.toString().toLowerCase(), true); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.util.IframeCoverUtility.java
License:Apache License
/** * Adds an iframe cover over an Embedded component * //from w w w . ja v a 2s . c o m * @param iframe * The iframe element * @return The element which covers the iframe */ private static Element addIframeCover(Element iframe) { if (iframeCoverMap.containsKey(iframe)) { return iframeCoverMap.get(iframe); } // Get dimensions String iframeWidth = iframe.getAttribute("width"); String iframeHeight = iframe.getAttribute("height"); Style iframeStyle = iframe.getStyle(); if (!iframeWidth.equals("") && !iframeHeight.equals("")) { iframeStyle.setPosition(Position.ABSOLUTE); iframeStyle.setTop(0, Unit.PX); iframeStyle.setLeft(0, Unit.PX); } // Create the cover element Element coverContainer = DOM.createDiv(); DOM.setStyleAttribute(coverContainer, "width", iframeWidth); DOM.setStyleAttribute(coverContainer, "height", iframeHeight); coverContainer.setClassName("v-dragdrop-iframe-container"); coverContainer.getStyle().setPosition(Position.RELATIVE); iframe.getParentElement().appendChild(coverContainer); // Move iframe to cover container iframe.getParentElement().replaceChild(coverContainer, iframe); coverContainer.appendChild(iframe); // Style the cover Element cover = DOM.createDiv(); cover.setClassName(SHIM_STYLENAME); Style coverStyle = cover.getStyle(); coverStyle.setPosition(Position.ABSOLUTE); coverStyle.setWidth(100, Unit.PCT); coverStyle.setHeight(100, Unit.PCT); coverStyle.setTop(0, Unit.PX); coverStyle.setLeft(0, Unit.PX); coverContainer.appendChild(cover); iframeCoverMap.put(iframe, coverContainer); return coverContainer; }
From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java
License:Open Source License
/** * Show popup.//w w w .j a v a2s.c om * * @param attacheElement the attache element * @param w the w */ private void showPopup(Widget attacheElement, Widget w) { back_widget = attacheElement; if (w == null) { w = new HTMLPanel(""); w.setSize("100px", "100px"); m_ap_content.clear(); m_ap_content.add(w); } else { m_ap_content.clear(); m_ap_content.add(w); } m_ap_content.setVisible(true); m_ap_shadow.setVisible(true); m_ap_line.setVisible(true); int aleft = attacheElement.getAbsoluteLeft(); int atop = attacheElement.getAbsoluteTop(); int aw = attacheElement.getOffsetWidth(); int ah = attacheElement.getOffsetHeight(); int width = m_ap_content.getOffsetWidth(); int height = m_ap_content.getOffsetHeight(); int lbx = aleft; int lby = atop + ah; int rbx = lbx + aw; int rby = lby; Style style = m_ap_content.getElement().getStyle(); style.setLeft(rbx - width, Unit.PX); style.setTop(lby - 1, Unit.PX); style = m_ap_shadow.getElement().getStyle(); style.setLeft(rbx - width + 3, Unit.PX); style.setTop(lby + 2, Unit.PX); style.setWidth(width, Unit.PX); style.setHeight(height, Unit.PX); style = m_ap_line.getElement().getStyle(); style.setLeft(lbx + 1, Unit.PX); style.setTop(lby - 1, Unit.PX); style.setWidth(aw - 2, Unit.PX); back_css = attacheElement.getStyleName(); attacheElement.setStyleName("toolbar_over"); m_ap_content.getElement().focus(); m_b_show_popup = true; }
From source file:com.sciencegadgets.client.ui.LinkPrompt.java
License:Open Source License
protected void updateIframeCode() { Style iframeStyle = iframeDisplay.getStyle(); if (isValidSpec(widthLabel, widthTextBox, widthUnits)) { double value = Double.parseDouble(widthTextBox.getValue()); String unit = widthUnits.getValue(); iframeStyle.setWidth(value, Unit.valueOf(unit)); } else {/*from w ww.j a v a 2 s. c o m*/ iframeStyle.setWidth(100, Unit.PCT); } if (isValidSpec(heightLabel, heightTextBox, heightUnits)) { double value = Double.parseDouble(heightTextBox.getValue()); String unit = heightUnits.getValue(); iframeStyle.setHeight(value, Unit.valueOf(unit)); } else { iframeStyle.setHeight(100, Unit.PCT); } String iframeCode = JSNICalls.elementToString(iframeDisplay).replace("&", "&"); iframeHandler.revert(iframeCode); }
From source file:com.smartgwt.mobile.client.widgets.Canvas.java
License:Open Source License
@SGWTInternal protected static void _hideAddressBarNow() { // In iOS 7, the scrollTo() hack to hide the address bar does not work anymore. // http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review // We still run some code in _maybeHideAddressBar() on iPad, however, to work around // the issue that 20px is cut off from the top or bottom in landscape mode. // Also, on iPhone running in a UIWebView, we need to move up the RootLayoutPanel's // bottom coord. final Style rootLayoutPanelElementStyle = RootLayoutPanel.get().getElement().getStyle(); if (IMPL.isIOSMin7_0()) { if (!Canvas.isUIWebView()) { // Work around an issue with iOS 7 Mobile Safari on an iPad in landscape mode. // http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue // http://stackoverflow.com/questions/18855642/ios-7-css-html-height-100-692px if (Canvas.isIPad()) { if (Page.getOrientation() == PageOrientation.LANDSCAPE) { rootLayoutPanelElementStyle.setHeight(Window.getClientHeight() - 20, Style.Unit.PX); } else { rootLayoutPanelElementStyle.setHeight(100, Style.Unit.PCT); }/*from w w w.ja va2 s .c o m*/ // On iPhone running iOS 7.1 using the 'minimal-ui' viewport parameter, the top 20 CSS pixels // in landscape mode should not be used because tapping within this area causes the browser // chrome to be revealed: http://www.mobilexweb.com/blog/ios-7-1-safari-minimal-ui-bugs } else if (Canvas.isIPhone() && IMPL.isIOSMin7_1()) { if (Page.getOrientation() == PageOrientation.LANDSCAPE) { rootLayoutPanelElementStyle.clearHeight(); rootLayoutPanelElementStyle.setTop(20, Style.Unit.PX); } else { rootLayoutPanelElementStyle.setHeight(100, Style.Unit.PCT); rootLayoutPanelElementStyle.setTop(0, Style.Unit.PX); } } // Since, when running in a UIWebView, the device-width/device-height // includes the height of the status bar, set the bottom of the RootLayoutPanel's // element to 20px (the standard height of the status bar). } else if (Canvas.isUIWebView()) { rootLayoutPanelElementStyle.clearHeight(); rootLayoutPanelElementStyle.setBottom(20.0, Style.Unit.PX); } Window.scrollTo(0, 0); } else if (isIPhone() && !isStandAlone() && !isUIWebView()) { rootLayoutPanelElementStyle.setHeight(Window.getClientHeight() + 100 - 40, Style.Unit.PX); Window.scrollTo(0, 0); } else { rootLayoutPanelElementStyle.setHeight(Window.getClientHeight(), Style.Unit.PX); } }
From source file:com.vaadin.addon.charts.client.ui.ChartOptionsWidget.java
public ChartOptionsWidget() { HighchartsScriptLoader.ensureInjected(); setElement(Document.get().createDivElement()); Style style = getElement().getStyle(); style.setWidth(0, Unit.PX);/* w w w .j a v a2 s. c om*/ style.setHeight(0, Unit.PX); style.setOverflow(Overflow.HIDDEN); }