List of usage examples for com.google.gwt.dom.client Style setTop
public void setTop(double value, Unit unit)
From source file:com.gwtmobile.ui.client.widgets.ScrollPanel.java
License:Apache License
private void setStyleTop(int top) { Style style = getWidget().getElement().getStyle(); style.setTop(top, Unit.PX); }
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;//from w w w .ja v 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 ww . java 2 s . c o m*/ 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.// w w w. j a v a 2s. com * * @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 .j a va 2 s .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./*from ww w. jav a2s. c o m*/ * * @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.moesol.gwt.maps.client.controls.MapPanZoomControl.java
License:Open Source License
@SuppressWarnings("rawtypes") private void updateVelocity(MouseEvent e) { int eventRelativeX = e.getRelativeX(panButton.getElement()); int eventRelativeY = e.getRelativeY(panButton.getElement()); final int panButtonWidth = panButton.getOffsetWidth(); final int panButtonHeight = panButton.getOffsetHeight(); if (eventRelativeX > 0 && eventRelativeX < panButtonWidth && eventRelativeY > 0 && eventRelativeY < panButtonHeight) { final Style clickHighlightStyle = clickHighlight.getStyle(); clickHighlightStyle.setDisplay(Display.BLOCK); clickHighlightStyle.setLeft(eventRelativeX - (clickHighlight.getClientWidth() / 3), Unit.PX); clickHighlightStyle.setTop(eventRelativeY - (clickHighlight.getClientHeight() / 3), Unit.PX); m_dx = m_presenter.calculateDelta(panButtonWidth, eventRelativeX, m_maxPanPixels); m_dy = -m_presenter.calculateDelta(panButtonHeight, eventRelativeY, m_maxPanPixels); }// w w w. j a v a 2 s. co m }
From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControlLegacy.java
License:Open Source License
@SuppressWarnings("rawtypes") private void updateVelocity(MouseEvent e) { int eventRelativeX = e.getRelativeX(panButton.getElement()); int eventRelativeY = e.getRelativeY(panButton.getElement()); final int panButtonWidth = panButton.getOffsetWidth(); final int panButtonHeight = panButton.getOffsetHeight(); if (eventRelativeX > 0 && eventRelativeX < panButtonWidth && eventRelativeY > 0 && eventRelativeY < panButtonHeight) { final Style clickHighlightStyle = clickHighlight.getElement().getStyle(); clickHighlightStyle.setDisplay(Display.BLOCK); clickHighlightStyle.setLeft(eventRelativeX - (clickHighlight.getElement().getClientWidth() / 3), Unit.PX);/*from www . j a v a2 s . c om*/ clickHighlightStyle.setTop(eventRelativeY - (clickHighlight.getElement().getClientHeight() / 3), Unit.PX); m_dx = m_presenter.calculateDelta(panButtonWidth, eventRelativeX, m_maxPanPixels); m_dy = -m_presenter.calculateDelta(panButtonHeight, eventRelativeY, m_maxPanPixels); } }
From source file:com.moesol.gwt.maps.client.TiledImageLayer.java
License:Open Source License
private void positionOneImage(ViewBox vb, TileCoords tileCoords) { if (tileCoords == null) { return;//from w ww. j a v a 2s. c o m } ImageDiv image = (ImageDiv) m_tileImageMgr.findOrCreateImage(vb, tileCoords); setImageZIndex(image, m_layerSet.getZIndex()); int x = tileCoords.getOffsetX(); int y = tileCoords.getOffsetY(); int width = tileCoords.getTileWidth(); int height = tileCoords.getTileHeight(); BoxBounds b = m_divWorker.computePercentBounds(x, y, width, height); Style imageStyle = image.getElement().getStyle(); imageStyle.setLeft(b.left, Unit.PCT); imageStyle.setRight(100 - b.right, Unit.PCT); imageStyle.setTop(b.top, Unit.PCT); imageStyle.setBottom(100 - b.bottom, Unit.PCT); }
From source file:com.preferanser.client.application.mvp.BaseTableView.java
License:Open Source License
@Override public void prepositionCards(Card... cards) { for (Card card : cards) { CardWidget cardWidget = getOrCreateCardWidget(card); Style cardStyle = cardWidget.getElement().getStyle(); cardStyle.setTop(Window.getClientHeight() + 10, Style.Unit.PX); cardStyle.setLeft(Math.round((Window.getClientWidth() - cardWidget.getOffsetWidth()) / 2), Style.Unit.PX);/*from w w w . j a v a 2 s . c o m*/ } }