當前位置: 首頁>>代碼示例>>Java>>正文


Java Style.setPaddingTop方法代碼示例

本文整理匯總了Java中com.google.gwt.dom.client.Style.setPaddingTop方法的典型用法代碼示例。如果您正苦於以下問題:Java Style.setPaddingTop方法的具體用法?Java Style.setPaddingTop怎麽用?Java Style.setPaddingTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.dom.client.Style的用法示例。


在下文中一共展示了Style.setPaddingTop方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setRatio

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
public void setRatio() {
    Style style = element.getStyle();

    style.clearWidth();
    style.clearHeight();

    style.setPaddingTop(initialRatio, Style.Unit.PCT);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:9,代碼來源:ElementScaler.java

示例2: QuickDocViewImpl

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
@Inject
public QuickDocViewImpl() {
  super(true, true);
  addCloseHandler(
      new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
          if (delegate != null) {
            delegate.onCloseView();
          }
        }
      });

  setSize("400px", "200px");
  Style style = getElement().getStyle();
  style.setProperty("resize", "both");
  style.setPaddingBottom(0, Style.Unit.PX);
  style.setPaddingTop(3, Style.Unit.PX);
  style.setPaddingLeft(3, Style.Unit.PX);
  style.setPaddingRight(3, Style.Unit.PX);
  createFrame();
  add(frame);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:24,代碼來源:QuickDocViewImpl.java

示例3: TextLine

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
TextLine(int minY, int maxY, int prevY, TextPage parent, List<Zone> lineTokens) {
	Style style = getElement().getStyle();
	double marginTop = round((prevY - maxY) * 100.0 / parent.width, PCT_ACCURACY);
	if (parent.getWidgetCount() == 0) {
		style.setPaddingTop(marginTop, Unit.PCT);
	} else {
		style.setMarginTop(marginTop, Unit.PCT);
	}
	style.setHeight(round((maxY - minY) * 100.0 / parent.height, PCT_ACCURACY), Unit.PCT);
	
	Token lastToken = null;
	int prevXmax = 0;
	for (Zone zone : lineTokens) {
		Token token = new Token(zone, prevXmax, parent);
		if (token.text.isEmpty()) {
			if (lastToken != null)
				lastToken.setText(lastToken.getText() + token.getText());
			continue;
		}
		add(token);
		lastToken = token;
		if (token.text.length() > 1 || lineTokens.size() == 1) {
			tokens.add(token);
		}
		prevXmax = zone.xmax;
	}

	parent.textLines.add(this);
	parent.add(this);
}
 
開發者ID:mateusz-matela,項目名稱:djvu-html5,代碼行數:31,代碼來源:TextLayer.java

示例4: TextBoxDOMElement

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
public TextBoxDOMElement(final TextBox widget,
                         final GridLayer gridLayer,
                         final GridWidget gridWidget) {
    super(widget,
          gridLayer,
          gridWidget);
    final Style style = widget.getElement().getStyle();
    style.setWidth(100,
                   Style.Unit.PCT);
    style.setHeight(HEIGHT,
                    Style.Unit.PX);
    style.setPaddingLeft(2,
                         Style.Unit.PX);
    style.setPaddingRight(2,
                          Style.Unit.PX);
    style.setFontSize(10,
                      Style.Unit.PX);

    // --- Workaround for BS2 ---
    style.setPosition(Style.Position.RELATIVE);
    style.setPaddingTop(0,
                        Style.Unit.PX);
    style.setPaddingBottom(0,
                           Style.Unit.PX);
    style.setProperty("WebkitBoxSizing",
                      "border-box");
    style.setProperty("MozBoxSizing",
                      "border-box");
    style.setProperty("boxSizing",
                      "border-box");
    style.setProperty("lineHeight",
                      "normal");
    // --- End workaround ---

    getContainer().getElement().getStyle().setPaddingLeft(5,
                                                          Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(5,
                                                           Style.Unit.PX);
    getContainer().setWidget(widget);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:41,代碼來源:TextBoxDOMElement.java

示例5: CheckBoxDOMElement

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
public CheckBoxDOMElement(final CheckBox widget,
                          final GridLayer gridLayer,
                          final GridWidget gridWidget) {
    super(widget,
          gridLayer,
          gridWidget);
    final Style style = widget.getElement().getStyle();
    style.setMarginTop(0,
                       Style.Unit.PX);
    style.setMarginLeft(2,
                        Style.Unit.PX);
    style.setWidth(SIZE,
                   Style.Unit.PX);
    style.setHeight(SIZE,
                    Style.Unit.PX);

    // --- Workaround for BS2 ---
    style.setPosition(Style.Position.RELATIVE);
    style.setPaddingTop(0,
                        Style.Unit.PX);
    style.setPaddingBottom(0,
                           Style.Unit.PX);
    style.setProperty("WebkitBoxSizing",
                      "border-box");
    style.setProperty("MozBoxSizing",
                      "border-box");
    style.setProperty("boxSizing",
                      "border-box");
    style.setProperty("lineHeight",
                      "normal");
    // --- End workaround ---

    getContainer().setWidget(widget);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:35,代碼來源:CheckBoxDOMElement.java

示例6: ListBoxDOMElement

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
public ListBoxDOMElement(final ListBox widget,
                         final GridLayer gridLayer,
                         final GridWidget gridWidget) {
    super(widget,
          gridLayer,
          gridWidget);
    final Style style = widget.getElement().getStyle();
    style.setWidth(100,
                   Style.Unit.PCT);
    style.setHeight(HEIGHT,
                    Style.Unit.PX);
    style.setPaddingLeft(2,
                         Style.Unit.PX);
    style.setPaddingRight(2,
                          Style.Unit.PX);
    style.setFontSize(10,
                      Style.Unit.PX);

    // --- Workaround for BS2 ---
    style.setPosition(Style.Position.RELATIVE);
    style.setPaddingTop(0,
                        Style.Unit.PX);
    style.setPaddingBottom(0,
                           Style.Unit.PX);
    style.setProperty("WebkitBoxSizing",
                      "border-box");
    style.setProperty("MozBoxSizing",
                      "border-box");
    style.setProperty("boxSizing",
                      "border-box");
    style.setProperty("lineHeight",
                      "normal");
    // --- End workaround ---

    getContainer().getElement().getStyle().setPaddingLeft(5,
                                                          Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(5,
                                                           Style.Unit.PX);
    getContainer().setWidget(widget);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:41,代碼來源:ListBoxDOMElement.java

示例7: positionVertically

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
@Override
public void positionVertically(double currentLocation, double allocatedSpace, double marginBottom) {
    if (!isCaptionInline()) {
        super.positionVertically(currentLocation, allocatedSpace, marginBottom);
        return;
    }

    // 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);
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:69,代碼來源:CubaFieldGroupLayoutComponentSlot.java

示例8: layoutGroupBox

import com.google.gwt.dom.client.Style; //導入方法依賴的package包/類
protected void layoutGroupBox() {
    CubaGroupBoxWidget panel = getWidget();
    LayoutManager layoutManager = getLayoutManager();

    if (isBordersVisible()) {
        int captionWidth = layoutManager.getOuterWidth(panel.captionNode);
        int captionStartWidth = layoutManager.getInnerWidth(panel.captionStartDeco);
        int totalMargin = captionWidth + captionStartWidth;

        panel.captionNode.getStyle().setWidth(captionWidth, Unit.PX);
        panel.captionWrap.getStyle().setPaddingLeft(totalMargin, Unit.PX);
        panel.captionStartDeco.getStyle().setMarginLeft(0 - totalMargin, Unit.PX);
    }

    Profiler.enter("CubaGroupBoxConnector.layout getHeights");
    // Haulmont API get max height of caption components
    int top = layoutManager.getOuterHeight(panel.captionNode);
    top = Math.max(layoutManager.getOuterHeight(panel.captionStartDeco), top);
    top = Math.max(layoutManager.getOuterHeight(panel.captionEndDeco), top);

    int bottom = layoutManager.getInnerHeight(panel.bottomDecoration);
    Profiler.leave("PanelConnector.layout getHeights");

    Style style = panel.getElement().getStyle();
    int paddingTop = 0;
    int paddingBottom = 0;
    if (panel.hasAnyOuterMargin()) {
        Profiler.enter("PanelConnector.layout get values from styles");
        // Clear previously set values

        style.clearPaddingTop();
        style.clearPaddingBottom();
        // Calculate padding from styles
        ComputedStyle computedStyle = new ComputedStyle(panel.getElement());
        paddingTop = computedStyle.getIntProperty("padding-top");
        paddingBottom = computedStyle.getIntProperty("padding-bottom");
        Profiler.leave("PanelConnector.layout get values from styles");
    }

    Profiler.enter("PanelConnector.layout modify style");
    panel.captionWrap.getStyle().setMarginTop(-top, Style.Unit.PX);
    panel.bottomDecoration.getStyle().setMarginBottom(-bottom, Style.Unit.PX);
    style.setPaddingTop(top + paddingTop, Style.Unit.PX);
    style.setPaddingBottom(bottom + paddingBottom, Style.Unit.PX);
    Profiler.leave("PanelConnector.layout modify style");

    // Update scroll positions
    Profiler.enter("PanelConnector.layout update scroll positions");
    panel.contentNode.setScrollTop(panel.scrollTop);
    panel.contentNode.setScrollLeft(panel.scrollLeft);
    Profiler.leave("PanelConnector.layout update scroll positions");

    // Read actual value back to ensure update logic is correct
    Profiler.enter("PanelConnector.layout read scroll positions");
    panel.scrollTop = panel.contentNode.getScrollTop();
    panel.scrollLeft = panel.contentNode.getScrollLeft();
    Profiler.leave("PanelConnector.layout read scroll positions");
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:59,代碼來源:CubaGroupBoxConnector.java


注:本文中的com.google.gwt.dom.client.Style.setPaddingTop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。