Java Code Examples for com.google.gwt.dom.client.Style.setMarginLeft()

The following are Jave code examples for showing how to use setMarginLeft() of the com.google.gwt.dom.client.Style class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: wbi   File: MaterialItem.java   View Source Code Vote up 8 votes
@Override
public void onClick(ClickEvent event) {
    if (animationEnabled) {
        Element inkElement = ink.getElement();

        inkElement.removeClassName(Class.ANIMATE.getName());

        Style style = inkElement.getStyle();
        int size = panel.getOffsetWidth();

        style.setWidth(size, Style.Unit.PX);
        style.setHeight(size, Style.Unit.PX);
        style.setMarginLeft(-size / 2, Style.Unit.PX);
        style.setMarginTop(-size / 2, Style.Unit.PX);

        style.setLeft(event.getX(), Style.Unit.PX);
        style.setTop(event.getY(), Style.Unit.PX);

        inkElement.addClassName(Class.ANIMATE.getName());
    }
}
 
Example 2
Project: kie-docker-ci   File: NavigationDateItemView.java   View Source Code Vote up 6 votes
private void positionItems() {
    
    // Day text.
    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);
}
 
Example 3
Project: che   File: StatusBarBranchPointer.java   View Source Code Vote up 6 votes
@Override
public void update(ActionEvent e) {
  panel.clear();

  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);
  }
}
 
Example 4
Project: wbi   File: MaterialButton.java   View Source Code Vote up 6 votes
@Override
public void onClick(ClickEvent event) {
    if (animationEnabled) {
        ink.removeClassName(Class.ANIMATE.getName());

        Style style = ink.getStyle();
        int size = anchor.getOffsetWidth();

        style.setWidth(size, Style.Unit.PX);
        style.setHeight(size, Style.Unit.PX);
        style.setMarginLeft(-size / 2, Style.Unit.PX);
        style.setMarginTop(-size / 2, Style.Unit.PX);

        style.setLeft(event.getX(), Style.Unit.PX);
        style.setTop(event.getY(), Style.Unit.PX);

        ink.addClassName(Class.ANIMATE.getName());
    }
}
 
Example 5
Project: kie-docker-ci   File: NavigationItemView.java   View Source Code Vote up 5 votes
private void show(final String id, final String _title, final String _text, final SafeUri imageUri, final int containersRunningCount) {
    showTitle(_title);
    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);
}
 
Example 6
Project: minus   File: LightBox.java   View Source Code Vote up 5 votes
private void addColumnElem(int i, Element elem, int elemWidth, int elemHeight, int rowspan) {
  ImageSize newSize = fitWidth(elemWidth, elemHeight, 1 + Math.abs(rowspan));
  newSize.height_ -= (columnsHeight_[i] + newSize.height_ + margin_) % DELTA;

  Style elemStyle = elem.getStyle();
  elemStyle.setMarginLeft(
      extraMargin_ + margin_ + (columnsWidth_ + margin_) * (i + (rowspan == -1 ? -1 : 0)),
      Style.Unit.PX);
  elemStyle.setMarginTop(columnsHeight_[i], Style.Unit.PX);
  elemStyle.setWidth(newSize.width_, Style.Unit.PX);
  elemStyle.setHeight(newSize.height_, Style.Unit.PX);

  int nextHeight = columnsHeight_[i] + newSize.height_ + margin_;
  columnsHeight_[i + rowspan] = columnsHeight_[i] = nextHeight;
}
 
Example 7
Project: appformer   File: CheckBoxDOMElement.java   View Source Code Vote up 5 votes
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);
}
 
Example 8
Project: appformer   File: WorkbenchSplitLayoutPanel.java   View Source Code Vote up 5 votes
@Override
protected void setUpHoverStyle(final Style style,
                               int size) {
    style.setWidth(size,
                   Unit.PX);
    style.setMarginLeft(-(size / 2),
                        Unit.PX);
}