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

The following are Jave code examples for showing how to use setMarginTop() 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: 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 4
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 5
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 6
Project: djvu-html5   File: TextLayer.java   View Source Code Vote up 5 votes
TextLine(int minY, int maxY, int prevY, TextPage parent, List<Zone> lineTokens) {
	Style style = getElement().getStyle();
	double marginTop = round((prevY - maxY) * 100.0 / parent.width, PCT_ACCURACY);
	if (parent.getWidgetCount() == 0) {
		style.setPaddingTop(marginTop, Unit.PCT);
	} else {
		style.setMarginTop(marginTop, Unit.PCT);
	}
	style.setHeight(round((maxY - minY) * 100.0 / parent.height, PCT_ACCURACY), Unit.PCT);
	
	Token lastToken = null;
	int prevXmax = 0;
	for (Zone zone : lineTokens) {
		Token token = new Token(zone, prevXmax, parent);
		if (token.text.isEmpty()) {
			if (lastToken != null)
				lastToken.setText(lastToken.getText() + token.getText());
			continue;
		}
		add(token);
		lastToken = token;
		if (token.text.length() > 1 || lineTokens.size() == 1) {
			tokens.add(token);
		}
		prevXmax = zone.xmax;
	}

	parent.textLines.add(this);
	parent.add(this);
}
 
Example 7
Project: appformer   File: TextBoxDOMElement.java   View Source Code Vote up 5 votes
@Override
public void initialise(final GridBodyCellRenderContext context) {
    final Style style = widget.getElement().getStyle();
    style.setMarginTop((context.getCellHeight() - HEIGHT) / 2,
                       Style.Unit.PX);
    transform(context);
}
 
Example 8
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 9
Project: appformer   File: ListBoxDOMElement.java   View Source Code Vote up 5 votes
@Override
public void initialise(final GridBodyCellRenderContext context) {
    final Style style = widget.getElement().getStyle();
    style.setMarginTop((context.getCellHeight() - HEIGHT) / 2,
                       Style.Unit.PX);
    transform(context);
}
 
Example 10
Project: appformer   File: WorkbenchSplitLayoutPanel.java   View Source Code Vote up 5 votes
@Override
protected void setUpHoverStyle(final Style style,
                               int size) {
    style.setHeight(size,
                    Unit.PX);
    style.setMarginTop(-(size / 2),
                       Unit.PX);
}