Example usage for com.google.gwt.dom.client Style setPaddingTop

List of usage examples for com.google.gwt.dom.client Style setPaddingTop

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Style setPaddingTop.

Prototype

public void setPaddingTop(double value, Unit unit) 

Source Link

Usage

From source file:com.vaadin.client.ui.panel.PanelConnector.java

License:Apache License

void updateSizes() {
    VPanel panel = getWidget();//  ww w  .j a  va 2  s.c o m

    LayoutManager layoutManager = getLayoutManager();
    Profiler.enter("PanelConnector.layout getHeights");
    int top = layoutManager.getOuterHeight(panel.captionNode);
    int bottom = layoutManager.getInnerHeight(panel.bottomDecoration);
    Profiler.leave("PanelConnector.layout getHeights");

    Profiler.enter("PanelConnector.layout modify style");
    Style style = panel.getElement().getStyle();
    panel.captionNode.getParentElement().getStyle().setMarginTop(-top, Unit.PX);
    panel.bottomDecoration.getStyle().setMarginBottom(-bottom, Unit.PX);
    style.setPaddingTop(top, Unit.PX);
    style.setPaddingBottom(bottom, 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");
}

From source file:com.vaadin.client.ui.window.WindowConnector.java

License:Apache License

@Override
public void layout() {
    LayoutManager lm = getLayoutManager();
    VWindow window = getWidget();/*from   w w  w.  j a v a  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.tests.widgetset.client.WidgetUtilTestWidget.java

License:Apache License

private void setPadding(Element e) {
    Style borderStyle = e.getStyle();
    borderStyle.setPaddingLeft(2.4, Unit.PX);
    borderStyle.setPaddingRight(3.5, Unit.PX);
    borderStyle.setPaddingTop(2.4, Unit.PX);
    borderStyle.setPaddingBottom(3.5, Unit.PX);
}

From source file:org.dashbuilder.renderer.client.metric.MetricViewImpl.java

License:Apache License

public void applySettings(DisplayerSettings displayerSettings) {
    this.displayerSettings = displayerSettings;
    int w = displayerSettings.getChartWidth();
    int h = displayerSettings.getChartHeight();
    int mtop = displayerSettings.getChartMarginTop();
    int mbottom = displayerSettings.getChartMarginBottom();
    int mleft = displayerSettings.getChartMarginLeft();
    int mright = displayerSettings.getChartMarginRight();

    // Hero panel (size)
    Style style = heroPanel.getElement().getStyle();
    style.setPadding(0, Style.Unit.PX);
    style.setWidth(w, Style.Unit.PX);
    style.setHeight(h, Style.Unit.PX);
    style.setTextAlign(Style.TextAlign.CENTER);
    style.setVerticalAlign(Style.VerticalAlign.MIDDLE);
    if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) {
        style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor());
    }//  w  w w  .  j  a  v a  2  s  . c o  m

    // Center panel (paddings)
    style = centerPanel.getElement().getStyle();
    style.setPaddingTop(mtop, Style.Unit.PX);
    style.setPaddingBottom(mbottom, Style.Unit.PX);
    style.setPaddingLeft(mleft, Style.Unit.PX);
    style.setPaddingRight(mright, Style.Unit.PX);

    // Title panel
    titlePanel.setVisible(displayerSettings.isTitleVisible());
    titlePanel.setText(displayerSettings.getTitle());
}

From source file:org.drools.workbench.screens.guided.dtable.client.widget.table.columns.dom.datepicker.DatePickerDOMElement.java

License:Apache License

public DatePickerDOMElement(final DatePicker 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);/*from   ww  w  . j  av  a2 s. com*/
}

From source file:org.drools.workbench.screens.scenariosimulation.client.domelements.CollectionEditorDOMElement.java

License:Apache License

/**
 *
 * @param widget/* w  w  w . j  ava 2 s  .  co  m*/
 * @param gridLayer
 * @param gridWidget
 */
public CollectionEditorDOMElement(final CollectionViewImpl 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(100, Style.Unit.PCT);
    style.setPaddingLeft(2, Style.Unit.PX);
    style.setPaddingRight(2, Style.Unit.PX);
    style.setPaddingTop(2, Style.Unit.PX);
    style.setPaddingBottom(2, Style.Unit.PX);
    style.setFontSize(10, Style.Unit.PX);
    style.setProperty("resize", "none");

    final SimplePanel widgetContainer = getContainer();
    final Element widgetContainerElement = widgetContainer.getElement();
    final Style widgetContainerElementStyle = widgetContainerElement.getStyle();

    widgetContainerElementStyle.setPaddingLeft(5, Style.Unit.PX);
    widgetContainerElementStyle.setPaddingRight(5, Style.Unit.PX);
    widgetContainerElementStyle.setPaddingTop(5, Style.Unit.PX);
    widgetContainerElementStyle.setPaddingBottom(5, Style.Unit.PX);

    widgetContainer.setWidget(widget);
}

From source file:org.drools.workbench.screens.scenariosimulation.client.domelements.ScenarioCellTextAreaDOMElement.java

License:Apache License

public ScenarioCellTextAreaDOMElement(final TextArea 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(100, Style.Unit.PCT);
    style.setPaddingLeft(2, Style.Unit.PX);
    style.setPaddingRight(2, Style.Unit.PX);
    style.setPaddingTop(2, Style.Unit.PX);
    style.setPaddingBottom(2, Style.Unit.PX);
    style.setFontSize(10, Style.Unit.PX);
    style.setProperty("resize", "none");

    getContainer().getElement().getStyle().setPaddingLeft(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingTop(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingBottom(5, Style.Unit.PX);
    getContainer().setWidget(widget);/*from w  w  w  .ja v  a2s  .  com*/
}

From source file:org.eclipse.che.ide.ext.java.client.documentation.QuickDocViewImpl.java

License:Open Source License

@Inject
public QuickDocViewImpl() {
    super(true, true);
    addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override/*w w  w . j  a v  a2  s  .  c  o m*/
        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);

}

From source file:org.jbpm.dashboard.renderer.client.panel.widgets.MetricViewExt.java

License:Apache License

public void applySettings(DisplayerSettings displayerSettings) {
    this.displayerSettings = displayerSettings;
    int w = displayerSettings.getChartWidth();
    int h = displayerSettings.getChartHeight();
    int mtop = displayerSettings.getChartMarginTop();
    int mbottom = displayerSettings.getChartMarginBottom();
    int mleft = displayerSettings.getChartMarginLeft();
    int mright = displayerSettings.getChartMarginRight();

    // Hero panel (size)
    Style style = centerPanel.getElement().getStyle();
    style.setPadding(0, Style.Unit.PX);
    style.setWidth(w, Style.Unit.PX);
    style.setHeight(h, Style.Unit.PX);
    style.setTextAlign(Style.TextAlign.CENTER);
    style.setVerticalAlign(Style.VerticalAlign.MIDDLE);
    if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) {
        style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor());
    }/*from  ww w.  jav  a2 s. c  o m*/

    // Center panel (paddings)
    style = centerPanel.getElement().getStyle();
    style.setPaddingTop(mtop, Style.Unit.PX);
    style.setPaddingBottom(mbottom, Style.Unit.PX);
    style.setPaddingLeft(mleft, Style.Unit.PX);
    style.setPaddingRight(mright, Style.Unit.PX);

    // Title panel
    titlePanel.setVisible(displayerSettings.isTitleVisible());
    titlePanel.setText(displayerSettings.getTitle());
}

From source file:org.jbpm.form.builder.ng.model.common.panels.FieldSetPanel.java

License:Apache License

public FieldSetPanel() {
    super();/*from  w  ww .  j a v a  2 s.  c o m*/
    Style divStyle = getElement().getStyle();
    Style lgndStyle = legend.getStyle();

    divStyle.setBorderWidth(2, Unit.PX);
    divStyle.setBorderStyle(BorderStyle.SOLID);
    divStyle.setMarginTop(0.5, Unit.EM);
    divStyle.setMarginBottom(0.5, Unit.EM);
    divStyle.setMarginRight(0, Unit.PX);
    divStyle.setMarginLeft(0, Unit.PX);
    divStyle.setPaddingTop(0, Unit.PX);
    divStyle.setPaddingBottom(0, Unit.PX);
    divStyle.setPaddingRight(0.5, Unit.EM);
    divStyle.setPaddingLeft(0.5, Unit.EM);

    lgndStyle.setFontSize(100.0, Unit.PCT);
    lgndStyle.setFontWeight(FontWeight.NORMAL);
    lgndStyle.setMarginTop(-0.5, Unit.EM);
    lgndStyle.setMarginRight(0, Unit.PX);
    lgndStyle.setMarginLeft(0, Unit.PX);
    lgndStyle.setMarginBottom(0, Unit.PX);
    lgndStyle.setBackgroundColor("white");
    lgndStyle.setColor("black");
    lgndStyle.setFloat(Style.Float.LEFT);
    lgndStyle.setPaddingTop(0, Unit.PX);
    lgndStyle.setPaddingBottom(0, Unit.PX);
    lgndStyle.setPaddingRight(2, Unit.PX);
    lgndStyle.setPaddingLeft(2, Unit.PX);

    getElement().appendChild(legend);
}