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

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

Introduction

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

Prototype

public void setMarginLeft(double value, Unit unit) 

Source Link

Usage

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 w  w w .  j  ava 2  s  .co  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.rest.client.ui.desktop.MenuItemViewImpl.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    event.stopPropagation();/*from  w w w  . j  a  va2  s.  c  o m*/
    event.preventDefault();

    Element e = event.getNativeEvent().getCurrentEventTarget().cast();
    if (!(e != null && e.equals(getElement())))
        return;

    if (children.size() > 0) {
        setOpened(!isOpened());
    } else {
        if (place != null && listener != null) {
            listener.goTo(place);
        } else {
            //open and show "empty" info
            if (emptyLabel == null) {
                emptyLabel = new Label("empty");
                Style labelStyle = emptyLabel.getElement().getStyle();
                labelStyle.setColor("#7C7C7C");
                labelStyle.setMarginLeft(14, Unit.PX);
                labelStyle.setMarginTop(14, Unit.PX);
                labelStyle.setFontStyle(FontStyle.ITALIC);
                addChild(emptyLabel);
            }
            setOpened(true);
        }
    }
}

From source file:org.rstudio.core.client.widget.HelpButton.java

License:Open Source License

public static HelpButton createHelpButton(String rstudioLinkName) {
    HelpButton helpButton = new HelpButton(rstudioLinkName);
    Style style = helpButton.getElement().getStyle();
    style.setMarginTop(3, Unit.PX);/* w ww.jav a 2 s  .c  o m*/
    style.setMarginLeft(4, Unit.PX);
    return helpButton;
}

From source file:org.rstudio.studio.client.common.latex.LatexProgramSelectWidget.java

License:Open Source License

public LatexProgramSelectWidget() {
    super("Typeset LaTeX into PDF using:", latexProgramRegistry_.getTypeNames());

    HelpButton helpButton = new HelpButton("latex_program");
    Style style = helpButton.getElement().getStyle();
    style.setMarginTop(3, Unit.PX);/*w  w w  .ja  v a 2  s.c  om*/
    style.setMarginLeft(4, Unit.PX);
    addWidget(helpButton);
}

From source file:org.rstudio.studio.client.workbench.views.environment.ClearAllDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    progress_ = addProgressIndicator();// w  w  w  .  j ava2s .  c  om

    VerticalPanel panel = new VerticalPanel();

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // add image
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(images.dialog_warning());
    horizontalPanel.add(image);

    // add message widget
    String objects;
    if (numObjects_ == 0)
        objects = "all objects";
    else if (numObjects_ == 1)
        objects = "1 object";
    else
        objects = numObjects_ + " objects";
    Label label = new MultiLineLabel("Are you sure you want to remove " + objects + " from the "
            + "environment? This operation cannot be undone.");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    horizontalPanel.add(label);
    panel.add(horizontalPanel);

    // add include hidden option
    HorizontalPanel optionPanel = new HorizontalPanel();
    Style optionStyle = optionPanel.getElement().getStyle();
    optionStyle.setMarginLeft(image.getWidth(), Unit.PX);
    optionStyle.setMarginBottom(10, Unit.PX);

    chkIncludeHidden_ = new CheckBox("Include hidden objects");
    chkIncludeHidden_.setValue(prefs_.clearHidden().getValue());

    if (numObjects_ == 0) {
        chkIncludeHidden_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                prefs_.clearHidden().setGlobalValue(event.getValue());
                prefs_.writeUIPrefs();
            }
        });
        optionPanel.add(chkIncludeHidden_);
    }
    panel.add(optionPanel);

    return panel;
}

From source file:org.rstudio.studio.client.workbench.views.workspace.ClearAllDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    progress_ = addProgressIndicator();//  www .  j  a  va2s .c o m

    VerticalPanel panel = new VerticalPanel();

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // add image
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(images.dialog_warning());
    horizontalPanel.add(image);

    // add message widget
    Label label = new MultiLineLabel("Are you sure you want to remove all objects from the workspace?");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    horizontalPanel.add(label);
    panel.add(horizontalPanel);

    // add include hidden option
    HorizontalPanel optionPanel = new HorizontalPanel();
    Style optionStyle = optionPanel.getElement().getStyle();
    optionStyle.setMarginLeft(image.getWidth(), Unit.PX);
    optionStyle.setMarginBottom(10, Unit.PX);

    chkIncludeHidden_ = new CheckBox("Include hidden objects");
    chkIncludeHidden_.setValue(prefs_.clearHidden().getValue());
    chkIncludeHidden_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            prefs_.clearHidden().setGlobalValue(event.getValue());
            prefs_.writeUIPrefs();
        }
    });
    optionPanel.add(chkIncludeHidden_);
    panel.add(optionPanel);

    return panel;
}

From source file:org.uberfire.ext.wires.core.grids.client.widget.dom.impl.CheckBoxDOMElement.java

License:Apache License

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);//from  www.j a v  a2  s. co m
}

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;/*ww w.jav  a2s.  com*/
    }

    //// 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();
        }
    }
}

From source file:scrum.client.collaboration.EmoticonSelectorWidget.java

License:Open Source License

private Widget createEmoticonWidget(String emotion, boolean selected) {
    Image img = new Image(getEmotionImage(emotion), 0, 0, 16, 16);
    Style imgStyle = img.getElement().getStyle();
    imgStyle.setMarginLeft(1, Unit.PX);
    imgStyle.setMarginTop(1, Unit.PX);/*ww  w.j  av a  2s .c om*/

    FocusPanel panel = new FocusPanel(img);
    panel.setStyleName("EmoticonSelectorWidget-emoticon");
    if (selected) {
        panel.addStyleName("EmoticonSelectorWidget-emoticon-selected");
    } else {
        panel.addClickHandler(new SelectEmotionClickHandler(emotion));
    }
    return panel;
}