本文整理了Java中com.google.gwt.dom.client.Element.getStyle()
方法的一些代码示例,展示了Element.getStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getStyle()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getStyle
[英]Gets this element's Style object.
[中]获取此元素的样式对象。
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to set the height of an element.
*
* @param elem the element
* @param height a CSS length value for the height
*/
static final void setHeight(Element elem, String height) {
elem.getStyle().setProperty("height", height);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void adjust(Element img, SafeUri url, int left, int top, int width, int height) {
String style = "url(\"" + url.asString() + "\") no-repeat " + (-left + "px ") + (-top + "px");
img.getStyle().setProperty("background", style);
img.getStyle().setPropertyPx("width", width);
img.getStyle().setPropertyPx("height", height);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to set the right offset of an element.
*
* @param elem the element
* @param right a CSS length value for right
*/
static final void setRight(Element elem, String right) {
elem.getStyle().setProperty("right", right);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* @param popup the popup
* @param rect the clip rect
*/
public void setClip(Element popup, String rect) {
popup.getStyle().setProperty("clip", rect);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Changes a DOM element's positioning to static.
*
* @param elem the DOM element
*/
private static void changeToStaticPositioning(Element elem) {
elem.getStyle().setProperty("left", "");
elem.getStyle().setProperty("top", "");
elem.getStyle().setProperty("position", "");
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Adds clipping to an element.
*
* @param elem the element
*/
static final void addClipping(final Element elem) {
elem.getStyle().setProperty("overflow", "hidden");
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Adds as-needed scrolling to an element.
*
* @param elem the element
*/
static final void addScrolling(final Element elem) {
elem.getStyle().setProperty("overflow", "auto");
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to set the top offset of an element.
*
* @param elem the element
* @param top a CSS length value for top
*/
static final void setTop(Element elem, String top) {
elem.getStyle().setProperty("top", top);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to set the left offset of an element.
*
* @param elem the element
* @param left a CSS length value for left
*/
static final void setLeft(Element elem, String left) {
elem.getStyle().setProperty("left", left);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets an elements positioning to absolute.
*
* @param elem the element
*/
static void addAbsolutePositoning(Element elem) {
elem.getStyle().setProperty("position", "absolute");
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to set bottom offset of an element.
*
* @param elem the element
* @param size a CSS length value for bottom
*/
static void setBottom(Element elem, String size) {
elem.getStyle().setProperty("bottom", size);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to set the width of an element.
*
* @param elem the element
* @param width a CSS length value for the width
*/
static final void setWidth(Element elem, String width) {
elem.getStyle().setProperty("width", width);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Setup the container around the widget.
*/
private Element createWidgetContainer() {
Element container = DOM.createDiv();
container.getStyle().setProperty("width", "100%");
container.getStyle().setProperty("height", "0px");
container.getStyle().setProperty("padding", "0px");
container.getStyle().setProperty("margin", "0px");
return container;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets an integer attribute on the given element's style.
*
* @param elem the element whose style attribute is to be set
* @param attr the name of the style attribute to be set
* @param value the style attribute's new integer value
*/
public static void setIntStyleAttribute(Element elem, String attr, int value) {
elem.getStyle().setProperty(attr, Integer.toString(value));
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets an attribute on the given element's style.
*
* @param elem the element whose style attribute is to be set
* @param attr the name of the style attribute to be set
* @param value the style attribute's new value
* @deprecated Use {@link Element#getStyle()} and
* {@link Style#setProperty(String, String)} instead.
*/
@Deprecated
public static void setStyleAttribute(Element elem, String attr, String value) {
elem.getStyle().setProperty(attr, value);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private static void expandToFitParentHorizontally(Element elem) {
addAbsolutePositoning(elem);
elem.getStyle().setProperty("left", "0");
elem.getStyle().setProperty("right", "0");
}
代码示例来源:origin: com.google.gwt/gwt-servlet
protected void setWidgetPositionImpl(Widget w, int left, int top) {
Element h = w.getElement();
if (left == -1 && top == -1) {
changeToStaticPositioning(h);
} else {
h.getStyle().setProperty("position", "absolute");
h.getStyle().setProperty("left", left + "px");
h.getStyle().setProperty("top", top + "px");
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onUpdate(double progress) {
int height = (int) (progress * scrollHeight);
if (!opening) {
height = scrollHeight - height;
}
// Issue 2338: If the height is 0px, IE7 will display all of the children
// instead of hiding them completely.
height = Math.max(height, 1);
curItem.childSpanElem.getStyle().setProperty("height", height + "px");
// We need to set the width explicitly of the item might be cropped
int scrollWidth = curItem.childSpanElem.getPropertyInt("scrollWidth");
curItem.childSpanElem.getStyle().setProperty("width", scrollWidth + "px");
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void setCellWidth(Widget w, String width) {
LayoutData data = (LayoutData) w.getLayoutData();
data.width = width;
if (data.td != null) {
data.td.getStyle().setProperty("width", data.width);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void setCellHeight(Widget w, String height) {
LayoutData data = (LayoutData) w.getLayoutData();
data.height = height;
if (data.td != null) {
data.td.getStyle().setProperty("height", data.height);
}
}
内容来源于网络,如有侵权,请联系作者删除!