本文整理了Java中com.google.gwt.dom.client.Element.getOffsetTop()
方法的一些代码示例,展示了Element.getOffsetTop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getOffsetTop()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getOffsetTop
[英]The number of pixels that the upper top corner of the current element is offset to the top within the offsetParent node.
[中]
代码示例来源:origin: stephenh/tessell
@Override
public int getOffsetTop() {
return element.getOffsetTop();
}
代码示例来源:origin: com.googlecode.mgwt/mgwt
private int[] offSet(com.google.gwt.dom.client.Element el) {
int left = -el.getOffsetLeft();
int top = -el.getOffsetTop();
com.google.gwt.dom.client.Element domElem = el;
while (true) {
domElem = domElem.getOffsetParent();
if (domElem == null)
break;
left -= domElem.getOffsetLeft();
top -= domElem.getOffsetTop();
}
if (el != this.wrapper.getElement()) {
left *= this.scale;
top *= this.scale;
}
return new int[] {left, top};
}
代码示例来源:origin: dankurka/mgwt
private int[] offSet(com.google.gwt.dom.client.Element el) {
int left = -el.getOffsetLeft();
int top = -el.getOffsetTop();
com.google.gwt.dom.client.Element domElem = el;
while (true) {
domElem = domElem.getOffsetParent();
if (domElem == null)
break;
left -= domElem.getOffsetLeft();
top -= domElem.getOffsetTop();
}
if (el != this.wrapper.getElement()) {
left *= this.scale;
top *= this.scale;
}
return new int[] {left, top};
}
代码示例来源:origin: Putnami/putnami-web-toolkit
private int getElementTop(Element heading) {
if (this.isBodyScrollWidget()) {
return heading.getAbsoluteTop();
}
return heading.getOffsetTop() - this.scrollWidget.getElement().getOffsetTop();
}
代码示例来源:origin: fr.putnami.pwt/pwt
private int getElementTop(Element heading) {
if (this.isBodyScrollWidget()) {
return heading.getAbsoluteTop();
}
return heading.getOffsetTop() - this.scrollWidget.getElement().getOffsetTop();
}
代码示例来源:origin: sk.seges.acris/acris-recorder-client-core
private int getSubPixelAbsoluteTop(com.google.gwt.dom.client.Element elem) {
int top = 0;
com.google.gwt.dom.client.Element curr = elem;
while (curr.getOffsetParent() != null) {
top -= curr.getScrollTop();
curr = curr.getParentElement();
}
while (elem != null) {
top += elem.getOffsetTop();
elem = elem.getOffsetParent();
}
return top;
};
代码示例来源:origin: Putnami/putnami-web-toolkit
private void openMonthOfYear(int year) {
String yearString = String.valueOf(year);
this.monthPickerUlMonthElement.removeFromParent();
for (int i = 0; i < this.monthPickerInner.getChildCount(); i++) {
Element child = (Element) this.monthPickerInner.getChild(i);
if (yearString.equals(child.getAttribute(InputDatePicker.ATTRIBUTE_DATA_YEAR))) {
this.monthPickerInner.insertAfter(this.monthPickerUlMonthElement, child);
Date monthButtonDate = new Date(this.cursor.getTime());
monthButtonDate.setYear(year - InputDatePicker.YEAR_OFFSET);
if (this.monthPickerUlMonthElement.getChildCount() == 0) {
for (int month = 0; month < 12; month++) {
LIElement monthElement = Document.get().createLIElement();
this.monthPickerUlMonthElement.appendChild(monthElement);
Event.sinkEvents(monthElement, Event.ONCLICK);
monthButtonDate.setMonth(month);
monthElement.setInnerText(InputDatePicker.MONTH_ABBR_FORMAT.format(monthButtonDate));
}
}
for (int month = 0; month < 12; month++) {
LIElement monthElement = (LIElement) this.monthPickerUlMonthElement.getChild(month);
monthButtonDate.setMonth(month);
monthElement.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
.format(monthButtonDate));
}
this.monthPicker.setScrollTop(child.getOffsetTop());
break;
}
}
}
代码示例来源:origin: fr.putnami.pwt/pwt
private void openMonthOfYear(int year) {
String yearString = String.valueOf(year);
this.monthPickerUlMonthElement.removeFromParent();
for (int i = 0; i < this.monthPickerInner.getChildCount(); i++) {
Element child = (Element) this.monthPickerInner.getChild(i);
if (yearString.equals(child.getAttribute(InputDatePicker.ATTRIBUTE_DATA_YEAR))) {
this.monthPickerInner.insertAfter(this.monthPickerUlMonthElement, child);
Date monthButtonDate = new Date(this.cursor.getTime());
monthButtonDate.setYear(year - InputDatePicker.YEAR_OFFSET);
if (this.monthPickerUlMonthElement.getChildCount() == 0) {
for (int month = 0; month < 12; month++) {
LIElement monthElement = Document.get().createLIElement();
this.monthPickerUlMonthElement.appendChild(monthElement);
Event.sinkEvents(monthElement, Event.ONCLICK);
monthButtonDate.setMonth(month);
monthElement.setInnerText(InputDatePicker.MONTH_ABBR_FORMAT.format(monthButtonDate));
}
}
for (int month = 0; month < 12; month++) {
LIElement monthElement = (LIElement) this.monthPickerUlMonthElement.getChild(month);
monthButtonDate.setMonth(month);
monthElement.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
.format(monthButtonDate));
}
this.monthPicker.setScrollTop(child.getOffsetTop());
break;
}
}
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui
/**
* Scroll focus element into specific node. Set focus on the tree when {@code isFocusRequired} is
* {@code true}. Does not perform any operations with focus when {@code isFocusRequired} is {@code
* false}
*
* @param node node to scroll
* @param isFocusRequired whether tree should take focus after scroll
*/
public void scrollIntoView(Node node, boolean isFocusRequired) {
checkNotNull(node, NULL_NODE_MSG);
NodeDescriptor descriptor = getNodeDescriptor(node);
if (descriptor == null) {
return;
}
Element container = descriptor.getNodeContainerElement();
if (container == null) {
return;
}
int scrollLeft = getElement().getScrollLeft();
container.scrollIntoView();
getElement().setScrollLeft(scrollLeft);
focusEl.getStyle().setLeft((nodeStorage.getDepth(node) - 1) * 16, Style.Unit.PX);
focusEl.getStyle().setTop(container.getOffsetTop(), Style.Unit.PX);
if (isFocusRequired) {
setFocus(true);
}
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material-addins
/**
* Setups the cut out position when the screen changes size or is scrolled.
*/
protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) {
float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop()));
float left = relativeTo.getAbsoluteLeft();
float width = relativeTo.getOffsetWidth();
float height = relativeTo.getOffsetHeight();
if (circle) {
if (width != height) {
float dif = width - height;
if (width > height) {
height += dif;
top -= dif / 2;
} else {
dif = -dif;
width += dif;
left -= dif / 2;
}
}
}
top -= padding;
left -= padding;
width += padding * 2;
height += padding * 2;
$(cutOut).css("top", top + "px");
$(cutOut).css("left", left + "px");
$(cutOut).css("width", width + "px");
$(cutOut).css("height", height + "px");
}
代码示例来源:origin: fr.putnami.pwt/pwt
int targetTop = relativeElement.getOffsetTop();
int targetLeft = relativeElement.getOffsetLeft();
代码示例来源:origin: Putnami/putnami-web-toolkit
int targetTop = relativeElement.getOffsetTop();
int targetLeft = relativeElement.getOffsetLeft();
代码示例来源:origin: com.extjs/gxt
Element p = rowEl, stope = el.dom;
while (p != null && p != stope) {
ctop += p.getOffsetTop();
p = p.getOffsetParent().cast();
内容来源于网络,如有侵权,请联系作者删除!