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:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget horizontalLine(int margin) {
    SimplePanel spacer = new SimplePanel();
    Style style = spacer.getElement().getStyle();
    style.setFloat(Float.LEFT);//from   www.ja  v a2  s. c  o  m
    style.setWidth(1, Unit.PX);
    style.setHeight(100, Unit.PCT);
    style.setBackgroundColor("#999999");
    style.setMarginLeft(margin, Unit.PX);
    style.setMarginRight(margin, Unit.PX);
    return spacer;
}

From source file:ilarkesto.gwt.client.desktop.Workspace.java

License:Open Source License

public void addToolbarAction(AAction action) {
    if (action == null)
        return;/*  w  ww  .j a  v  a  2  s  .c o  m*/
    // if (true) {
    // addMenuAction(action);
    // return;
    // }
    ActionButton button = new ActionButton(action);
    Style style = button.getElement().getStyle();
    style.setMarginLeft(Widgets.defaultSpacing, Unit.PX);
    if (action.getIcon() == null)
        style.setPadding(4, Unit.PX);
    // button.getElement().getStyle().setMargin(0, Unit.PX);
    addToActionbar(button);
}

From source file:info.magnolia.ui.vaadin.gwt.client.magnoliashell.viewport.connector.ViewportConnector.java

License:Open Source License

protected void alignContent(Element e, LayoutManager layoutManager) {
    if (getWidget().isVisible() && !Display.NONE.getCssName().equals(e.getStyle().getDisplay())) {
        int width = layoutManager.getInnerWidth(e);
        final Style style = e.getStyle();
        style.setLeft(50, Unit.PCT);/*from  w  w w  .  j  ava  2 s .com*/
        style.setMarginLeft(-width / 2, Unit.PX);
    }
}

From source file:io.pelle.mango.client.gwt.widgets.Spacer.java

License:Open Source License

public Spacer(double width) {
    setElement(DOM.createSpan());//from  ww w. ja  v a 2 s  .  c  o  m
    Style style = getElement().getStyle();
    style.setVisibility(Visibility.HIDDEN);
    style.setMarginLeft(width, Unit.EM);
}

From source file:org.anstis.client.grid.widget.dom.CheckBoxDOMElement.java

License:Apache License

public CheckBoxDOMElement(final GridLayer gridLayer, final BaseGridWidget<?, ?> gridWidget,
        final IDOMElementFactory<Boolean, ?> factory, final AbsolutePanel domElementContainer) {
    super(gridLayer, gridWidget, factory, domElementContainer);
    final Style style = cb.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);

    getContainer().setWidget(cb);/*from w  ww.  ja  v a  2s. com*/

    cb.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            flush();
        }
    });
    cb.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(final BlurEvent event) {
            if (context != null) {
                factory.freeUnusedResources();
            }
        }
    });
}

From source file:org.eclipse.che.ide.ext.git.client.action.StatusBarBranchPointer.java

License:Open Source License

@Override
public void update(ActionEvent e) {
    panel.clear();//www .  ja  v  a2 s .  co m

    Project project = appContext.getRootProject();
    if (project != null && project.getAttributes().containsKey(GIT_CURRENT_HEAD_NAME)) {
        Label projectNameLabel = new Label(project.getName());
        projectNameLabel.ensureDebugId("statusBarProjectBranchRepositoryName");
        projectNameLabel.getElement().getStyle().setMarginLeft(5., Unit.PX);
        panel.add(projectNameLabel);

        SVGImage branchIcon = new SVGImage(resources.checkoutReference());
        branchIcon.getSvgElement().getStyle().setMarginLeft(5., Unit.PX);
        panel.add(branchIcon);

        Label headLabel = new Label(project.getAttribute(GIT_CURRENT_HEAD_NAME));
        headLabel.ensureDebugId("statusBarProjectBranchName");
        headLabel.setTitle(constant.branchesControlTitle());
        Style headLabelStyle = headLabel.getElement().getStyle();
        headLabelStyle.setCursor(Cursor.POINTER);
        headLabelStyle.setMarginLeft(5., Unit.PX);
        headLabel.addClickHandler(event -> branchPresenter.showBranches(project));
        panel.add(headLabel);
    }
}

From source file:org.guvnor.ala.ui.client.widget.artifact.ArtifactSelectorView.java

License:Apache License

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

    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);

    artifactListContainer.add(artifactListView);
}

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  a2s .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);
}

From source file:org.kie.dockerui.client.widgets.container.navigator.item.view.NavigationDateItemView.java

License:Apache License

private void positionItems() {

    // Day text./*ww  w .ja v  a 2 s  .  c  o  m*/
    final Style dayStyle = day.getElement().getStyle();
    dayStyle.setPosition(Style.Position.ABSOLUTE);
    dayStyle.setMarginTop((ICON_SIZE / 2) * -1, Style.Unit.PX);
    dayStyle.setMarginLeft((ICON_SIZE / 2) + 10, Style.Unit.PX);

    // Month text.
    final Style monthStyle = month.getElement().getStyle();
    monthStyle.setPosition(Style.Position.ABSOLUTE);
    monthStyle.setMarginTop(25, Style.Unit.PX);
    monthStyle.setMarginLeft((ICON_SIZE / 2) + (month.getOffsetWidth() / 2), Style.Unit.PX);

    // Count number.
    final Style countStyle = countText.getElement().getStyle();
    countStyle.setPosition(Style.Position.ABSOLUTE);
    countStyle.setMarginTop(20, Style.Unit.PX);
    countStyle.setMarginLeft((ICON_SIZE - 20), Style.Unit.PX);
}

From source file:org.kie.dockerui.client.widgets.container.navigator.item.view.NavigationItemView.java

License:Apache License

private void show(final String id, final String _title, final String _text, final SafeUri imageUri,
        final int containersRunningCount) {
    showTitle(_title);// w  w w  . j ava  2 s. c o m
    showRunningContainers(id, containersRunningCount);

    // Show the navigation item image.
    final boolean isImage = imageUri != null;
    if (isImage) {
        image.setUrl(imageUri);
        image.setSize(getSizeInPx(), getSizeInPx());
    }
    image.setVisible(isImage);

    // Show the navigation item text.
    final boolean isText = _text != null;
    if (isText) {
        text.setText(new SafeHtmlBuilder().appendEscaped(_text).toSafeHtml().asString());
    }

    // Styles for placing the text over the image.
    final Style textStyle = text.getElement().getStyle();
    if (isImage && isText) {
        textStyle.setPosition(Style.Position.ABSOLUTE);
        textStyle.setMarginTop(size / 2, Style.Unit.PX);
        final int tSize = (int) (_text.length() * 5);
        textStyle.setMarginLeft((size / 2) - tSize, Style.Unit.PX);
    } else if (isText) {
        textStyle.setPosition(Style.Position.RELATIVE);
        textStyle.clearMarginTop();
        textStyle.clearMarginLeft();
    }
    text.setVisible(isText);

    // Add the click handler.
    addItemDetailClickHandler(id);
}