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