List of usage examples for com.google.gwt.dom.client Style clearMarginBottom
public void clearMarginBottom()
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.j a v a 2 s .co 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.vaadin.client.ui.layout.VLayoutSlot.java
License:Apache License
public void positionVertically(double currentLocation, double allocatedSpace, double marginBottom) { Style style = wrapper.getStyle(); double contentHeight = allocatedSpace; int captionHeight; VCaption caption = getCaption();/*from w ww . j av a2 s . co m*/ if (caption == null || caption.shouldBePlacedAfterComponent()) { style.clearPaddingTop(); captionHeight = 0; } else { captionHeight = getCaptionHeight(); contentHeight -= captionHeight; if (contentHeight < 0) { contentHeight = 0; } style.setPaddingTop(captionHeight, Unit.PX); } if (marginBottom > 0) { style.setMarginBottom(marginBottom, Unit.PX); } else { style.clearMarginBottom(); } style.setHeight(contentHeight, Unit.PX); double allocatedContentHeight = 0; if (isRelativeHeight()) { String height = getWidget().getElement().getStyle().getHeight(); double percentage = parsePercent(height); allocatedContentHeight = contentHeight * (percentage / 100); reportActualRelativeHeight(Math.round((float) allocatedContentHeight)); } style.setTop(currentLocation, Unit.PX); double padding = 0; AlignmentInfo alignment = getAlignment(); if (!alignment.isTop()) { double usedHeight; if (isRelativeHeight()) { usedHeight = captionHeight + allocatedContentHeight; } else { usedHeight = getUsedHeight(); } if (alignment.isVerticalCenter()) { padding = (allocatedSpace - usedHeight) / 2d; } else { padding = (allocatedSpace - usedHeight); } padding += captionHeight; widget.getElement().getStyle().setTop(padding, Unit.PX); } else { // Reset top when changing back to align top widget.getElement().getStyle().clearTop(); } }
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 ww w .j a v a 2 s . c o m*/ * 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); } } } }