本文整理汇总了Java中com.google.gwt.dom.client.Style.setMarginTop方法的典型用法代码示例。如果您正苦于以下问题:Java Style.setMarginTop方法的具体用法?Java Style.setMarginTop怎么用?Java Style.setMarginTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.Style
的用法示例。
在下文中一共展示了Style.setMarginTop方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
@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());
}
}
示例2: positionItems
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
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);
}
示例3: onClick
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
@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());
}
}
示例4: show
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
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);
}
示例5: addColumnElem
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
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;
}
示例6: TextLine
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
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);
}
示例7: initialise
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
@Override
public void initialise(final GridBodyCellRenderContext context) {
final Style style = widget.getElement().getStyle();
style.setMarginTop((context.getCellHeight() - HEIGHT) / 2,
Style.Unit.PX);
transform(context);
}
示例8: CheckBoxDOMElement
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
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);
}
示例9: setUpHoverStyle
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
@Override
protected void setUpHoverStyle(final Style style,
int size) {
style.setHeight(size,
Unit.PX);
style.setMarginTop(-(size / 2),
Unit.PX);
}