List of usage examples for com.google.gwt.dom.client Style setMarginTop
public void setMarginTop(double value, Unit unit)
From source file:client.ui.components.MaterialButton.java
License:Open Source License
@Override public void onClick(ClickEvent event) { if (animationEnabled) { ink.removeClassName(Class.ANIMATE.getName()); Style style = ink.getStyle(); int size = anchor.getOffsetWidth(); style.setWidth(size, Style.Unit.PX); style.setHeight(size, Style.Unit.PX); style.setMarginLeft(-size / 2, Style.Unit.PX); style.setMarginTop(-size / 2, Style.Unit.PX); style.setLeft(event.getX(), Style.Unit.PX); style.setTop(event.getY(), Style.Unit.PX); ink.addClassName(Class.ANIMATE.getName()); }//from w w w . j a v a 2 s .co m }
From source file:client.ui.components.MaterialItem.java
License:Open Source License
@Override public void onClick(ClickEvent event) { if (animationEnabled) { Element inkElement = ink.getElement(); inkElement.removeClassName(Class.ANIMATE.getName()); Style style = inkElement.getStyle(); int size = panel.getOffsetWidth(); style.setWidth(size, Style.Unit.PX); style.setHeight(size, Style.Unit.PX); style.setMarginLeft(-size / 2, Style.Unit.PX); style.setMarginTop(-size / 2, Style.Unit.PX); style.setLeft(event.getX(), Style.Unit.PX); style.setTop(event.getY(), Style.Unit.PX); inkElement.addClassName(Class.ANIMATE.getName()); }/* w w w .jav a2 s. c o m*/ }
From source file:com.dianaui.universal.core.client.ui.InlineHelpBlock.java
License:Apache License
public InlineHelpBlock() { super();/*ww w .j a v a 2 s . co m*/ Style style = getElement().getStyle(); style.setDisplay(Display.INLINE_BLOCK); style.setMarginTop(0, Unit.PX); style.setMarginBottom(5, Unit.PX); style.setPaddingLeft(10, Unit.PX); }
From source file:com.ephesoft.gxt.core.client.ui.widget.MultiFileUploader.java
License:Open Source License
private void setDimension(final Widget parent) { if (null != parent) { final Element element = dragDropLabel.getElement(); final Style style = element.getStyle(); final int height = parent.getOffsetHeight() - UPLOADER_BUTTON_HEIGHT - 2; final int heightToAssign = (height / 2) - FONT_SIZE; style.setHeight(heightToAssign, Unit.PX); style.setFontSize(FONT_SIZE, Unit.PX); style.setPaddingTop(heightToAssign, Unit.PX); style.setLineHeight(1, Unit.PX); dragDropLabel.setWidth("99%"); style.setLeft(6, Unit.PX);/* w ww. j a v a 2 s . co m*/ isInitialized = true; Style uploadProgressStyle = uploadProgress.getElement().getStyle(); uploadProgressStyle.setMarginTop(height / 2, Unit.PX); } }
From source file:com.vaadin.addon.spreadsheet.client.GroupingWidget.java
protected void copyfields(GroupingWidget newWidget) { newWidget.collapsed = collapsed;/*from w w w . ja va2 s . c o m*/ newWidget.index = index; newWidget.inversed = inversed; newWidget.btn.setInnerText(btn.getInnerText()); Style style = newWidget.getElement().getStyle(); newWidget.setStyleName(getStyleName()); if (marginLeft > -1) { style.setMarginLeft(marginLeft, Unit.PX); } if (marginTop > -1) { style.setMarginTop(marginTop, Unit.PX); } if (height > -1) { style.setHeight(height, Unit.PX); } if (width > -1) { style.setWidth(width, Unit.PX); } if (top > -1) { style.setTop(top, Unit.PX); } if (left > -1) { style.setLeft(left, Unit.PX); } }
From source file:com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout.java
License:Apache License
/** * Update the offset off the caption relative to the slot * <p>//from w w w.j a va 2 s . com * For internal use only. May be removed or replaced in the future. * * @param caption * The caption element * @deprecated As of 7.2, call or override * {@link #updateCaptionOffset(Element)} instead */ @Deprecated public void updateCaptionOffset(com.google.gwt.user.client.Element caption) { Element captionWrap = caption.getParentElement(); Style captionWrapStyle = captionWrap.getStyle(); captionWrapStyle.clearPaddingTop(); captionWrapStyle.clearPaddingRight(); captionWrapStyle.clearPaddingBottom(); captionWrapStyle.clearPaddingLeft(); Style captionStyle = caption.getStyle(); captionStyle.clearMarginTop(); captionStyle.clearMarginRight(); captionStyle.clearMarginBottom(); captionStyle.clearMarginLeft(); // Get caption position from the classname CaptionPosition captionPosition = getCaptionPositionFromElement(captionWrap); if (captionPosition == CaptionPosition.LEFT || captionPosition == CaptionPosition.RIGHT) { int captionWidth; if (layoutManager != null) { captionWidth = layoutManager.getOuterWidth(caption) - layoutManager.getMarginWidth(caption); } else { captionWidth = caption.getOffsetWidth(); } if (captionWidth > 0) { if (captionPosition == CaptionPosition.LEFT) { captionWrapStyle.setPaddingLeft(captionWidth, Unit.PX); captionStyle.setMarginLeft(-captionWidth, Unit.PX); } else { captionWrapStyle.setPaddingRight(captionWidth, Unit.PX); captionStyle.setMarginRight(-captionWidth, Unit.PX); } } } if (captionPosition == CaptionPosition.TOP || captionPosition == CaptionPosition.BOTTOM) { int captionHeight; if (layoutManager != null) { captionHeight = layoutManager.getOuterHeight(caption) - layoutManager.getMarginHeight(caption); } else { captionHeight = caption.getOffsetHeight(); } if (captionHeight > 0) { if (captionPosition == CaptionPosition.TOP) { captionWrapStyle.setPaddingTop(captionHeight, Unit.PX); captionStyle.setMarginTop(-captionHeight, Unit.PX); } else { captionWrapStyle.setPaddingBottom(captionHeight, Unit.PX); captionStyle.setMarginBottom(-captionHeight, Unit.PX); } } } }
From source file:com.vaadin.client.ui.VCustomScrollTable.java
License:Apache License
private void announceScrollPosition() { if (scrollPositionElement == null) { scrollPositionElement = DOM.createDiv(); scrollPositionElement.setClassName(getStylePrimaryName() + "-scrollposition"); scrollPositionElement.getStyle().setPosition(Position.ABSOLUTE); scrollPositionElement.getStyle().setDisplay(Display.NONE); getElement().appendChild(scrollPositionElement); }//from ww w.ja v a2 s .c o m Style style = scrollPositionElement.getStyle(); style.setMarginLeft(getElement().getOffsetWidth() / 2 - 80, Unit.PX); style.setMarginTop(-scrollBodyPanel.getOffsetHeight(), Unit.PX); // indexes go from 1-totalRows, as rowheaders in index-mode indicate int last = (firstRowInViewPort + pageLength); if (last > totalRows) { last = totalRows; } scrollPositionElement .setInnerHTML("<span>" + (firstRowInViewPort + 1) + " – " + (last) + "..." + "</span>"); style.setDisplay(Display.BLOCK); }
From source file:com.vaadin.client.ui.window.WindowConnector.java
License:Apache License
@Override public void layout() { LayoutManager lm = getLayoutManager(); VWindow window = getWidget();// ww w . j a va 2 s. co m ComponentConnector content = getContent(); boolean hasContent = (content != null); Element contentElement = window.contentPanel.getElement(); Style contentStyle = window.contents.getStyle(); int headerHeight = lm.getOuterHeight(window.header); contentStyle.setPaddingTop(headerHeight, Unit.PX); contentStyle.setMarginTop(-headerHeight, Unit.PX); int footerHeight = lm.getOuterHeight(window.footer); contentStyle.setPaddingBottom(footerHeight, Unit.PX); contentStyle.setMarginBottom(-footerHeight, Unit.PX); int minWidth = lm.getOuterWidth(window.header) - lm.getInnerWidth(window.header); int minHeight = footerHeight + headerHeight; getWidget().getElement().getStyle().setPropertyPx("minWidth", minWidth); getWidget().getElement().getStyle().setPropertyPx("minHeight", minHeight); /* * Must set absolute position if the child has relative height and * there's a chance of horizontal scrolling as some browsers will * otherwise not take the scrollbar into account when calculating the * height. */ if (hasContent) { Element layoutElement = content.getWidget().getElement(); Style childStyle = layoutElement.getStyle(); // IE8 needs some hackery to measure its content correctly WidgetUtil.forceIE8Redraw(layoutElement); if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) { childStyle.setPosition(Position.ABSOLUTE); Style wrapperStyle = contentElement.getStyle(); if (window.getElement().getStyle().getWidth().length() == 0 && !content.isRelativeWidth()) { /* * Need to lock width to make undefined width work even with * absolute positioning */ int contentWidth = lm.getOuterWidth(layoutElement); wrapperStyle.setWidth(contentWidth, Unit.PX); } else { wrapperStyle.clearWidth(); } } else { childStyle.clearPosition(); } } }
From source file:com.vaadin.client.widgets.Overlay.java
License:Apache License
@Override public void setPopupPosition(int left, int top) { // TODO, this should in fact be part of // Document.get().getBodyOffsetLeft/Top(). Would require overriding DOM // for all permutations. Now adding fix as margin instead of fixing // left/top because parent class saves the position. Style style = getElement().getStyle(); style.setMarginLeft(-adjustByRelativeLeftBodyMargin(), Unit.PX); style.setMarginTop(-adjustByRelativeTopBodyMargin(), Unit.PX); super.setPopupPosition(left, top); positionOrSizeUpdated(isAnimationEnabled() ? 0 : 1); }
From source file:com.vaadin.terminal.gwt.client.ui.VCustomScrollTable.java
License:Apache License
protected void announceScrollPosition() { if (scrollPositionElement == null) { scrollPositionElement = DOM.createDiv(); scrollPositionElement.setClassName(CLASSNAME + "-scrollposition"); scrollPositionElement.getStyle().setPosition(Position.ABSOLUTE); scrollPositionElement.getStyle().setDisplay(Display.NONE); getElement().appendChild(scrollPositionElement); }//from www .ja v a 2s. c om Style style = scrollPositionElement.getStyle(); style.setMarginLeft(getElement().getOffsetWidth() / 2 - 80, Unit.PX); style.setMarginTop(-scrollBodyPanel.getOffsetHeight(), Unit.PX); // indexes go from 1-totalRows, as rowheaders in index-mode indicate int last = (firstRowInViewPort + pageLength); if (last > totalRows) { last = totalRows; } scrollPositionElement .setInnerHTML("<span>" + (firstRowInViewPort + 1) + " – " + (last) + "..." + "</span>"); style.setDisplay(Display.BLOCK); }