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

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

Introduction

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

Prototype

public void setMarginRight(double value, Unit unit) 

Source Link

Usage

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

License:Apache License

public FieldSetPanel() {
    super();//from  w  w  w  . j a  v a2  s  .  com
    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);
}

From source file:org.kie.workbench.common.screens.search.client.widgets.SearchResultTable.java

License:Apache License

protected void setTableStyle() {
    final Style style = dataGrid.getElement().getStyle();
    style.setMarginLeft(0, Style.Unit.PX);
    style.setMarginRight(0, Style.Unit.PX);
}

From source file:org.kie.workbench.common.screens.server.management.client.widget.artifact.ArtifactListWidgetView.java

License:Apache License

@Override
public void init(final ArtifactListWidgetPresenter presenter) {
    this.presenter = presenter;

    search.addClickHandler(new ClickHandler() {
        @Override//from ww  w  .j  ava  2 s  .  c o  m
        public void onClick(ClickEvent event) {
            presenter.search(filter.getText());
        }
    });

    final ArtifactListView artifactListView = presenter.getArtifactListView();

    artifactListView.addColumn(buildSelectColumn(), getSelectColumnLabel());

    artifactListView.setContentHeight("200px");

    final Style style = artifactListView.asWidget().getElement().getStyle();
    style.setMarginLeft(0, Style.Unit.PX);
    style.setMarginRight(0, Style.Unit.PX);

    panel.add(artifactListView);
}

From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ui.TemplateMenuItem.java

License:Open Source License

public void addIcon(ImageResource icon) {
    Image iconImage = new Image(icon);
    wrapper_.insert(iconImage, 0);/*from w  w  w.j a v  a 2  s.  c  om*/
    Style imageStyle = iconImage.getElement().getStyle();
    imageStyle.setVerticalAlign(VerticalAlign.MIDDLE);
    imageStyle.setMarginRight(5, Unit.PX);
    imageStyle.setMarginBottom(2, Unit.PX);
}

From source file:org.waveprotocol.wave.client.editor.content.paragraph.DefaultParagraphHtmlRenderer.java

License:Apache License

@Override
public void updateRendering(HasImplNodelets element, String type, String listStyle, int indent,
        Alignment alignment, Direction direction) {

    Element implNodelet = element.getImplNodelet();
    ParagraphBehaviour behaviour = ParagraphBehaviour.of(type);
    boolean toListItem = behaviour == ParagraphBehaviour.LIST;
    boolean isListItem = implNodelet.getTagName().equalsIgnoreCase(LIST_IMPL_TAGNAME);

    if (isListItem != toListItem) {
        Element newNodelet = createNodeletInner(toListItem);
        DomHelper.replaceElement(implNodelet, newNodelet);
        element.setBothNodelets(newNodelet);
        // Ideally onRepair shouldn't require a ContentElement
        ParagraphHelper.INSTANCE.onRepair((ContentElement) element);

        implNodelet = newNodelet;/*from   ww  w .j  a  v  a 2 s  .c om*/
    }

    //// Type logic ////

    double fontSize = -1;
    FontWeight fontWeight = null;
    implNodelet.removeClassName(NUMBERED_CLASSNAME);

    switch (behaviour) {
    case LIST:
        if (Paragraph.LIST_STYLE_DECIMAL.equals(listStyle)) {
            implNodelet.addClassName(NUMBERED_CLASSNAME);
        }
        break;
    case HEADING:
        fontWeight = FontWeight.BOLD;
        double headingNum = Integer.parseInt(type.substring(1));
        // Do this with CSS instead.
        // h1 -> 1.75, h4 -> 1, others linearly in between.
        double factor = 1 - (headingNum - 1) / (Paragraph.NUM_HEADING_SIZES - 1);
        fontSize = MIN_HEADING_SIZE_EM + factor * (MAX_HEADING_SIZE_EM - MIN_HEADING_SIZE_EM);
        break;
    }

    //// Indent logic ////

    for (String bulletType : BULLET_CLASSNAMES) {
        implNodelet.removeClassName(bulletType);
    }

    if (behaviour == ParagraphBehaviour.LIST) {
        if (listStyle == null) {
            implNodelet.addClassName(bulletClassName(indent));
        }
        indent++;
    }

    int margin = indent * INDENT_UNIT_SIZE_PX;

    //// Update actual values ////

    // NOTE(danilatos): For these, it might be more efficient to check that the
    // value has changed before changing it. This is not currently  known.

    Style style = implNodelet.getStyle();

    if (fontSize != -1) {
        style.setFontSize(fontSize, Unit.EM);
    } else {
        style.clearFontSize();
    }

    if (fontWeight != null) {
        style.setFontWeight(fontWeight);
    } else {
        style.clearFontWeight();
    }

    if (alignment != null) {
        style.setProperty("textAlign", alignment.cssValue());
    } else {
        style.clearProperty("textAlign");
    }

    if (direction != null) {
        style.setProperty("direction", direction.cssValue());
    } else {
        style.clearProperty("direction");
    }

    if (margin == 0) {
        style.clearMarginLeft();
        style.clearMarginRight();
    } else {
        if (direction == Direction.RTL) {
            style.setMarginRight(margin, Unit.PX);
            style.clearMarginLeft();
        } else {
            style.setMarginLeft(margin, Unit.PX);
            style.clearMarginRight();
        }
    }
}