本文整理汇总了Java中com.google.gwt.user.client.DOM.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java DOM.getParent方法的具体用法?Java DOM.getParent怎么用?Java DOM.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.DOM
的用法示例。
在下文中一共展示了DOM.getParent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContainerOffsetLeft
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
protected int getContainerOffsetLeft() {
if (containerOffsetLeft < 0 || !sync) {
int scrollLeft = 0;
Element parent = DOM.getParent(getWidget().getElement());
while (parent != null) {
if (getScrollLeft(parent) > 0) {
scrollLeft += getScrollLeft(parent);
GWT.log("Scroll left detected : " + scrollLeft);
}
if (containerFinder.isContainer(parent)) {
containerOffsetLeft = DOM.getAbsoluteLeft(parent) - scrollLeft;
}
parent = DOM.getParent(parent);
}
}
return containerOffsetLeft;
}
示例2: getContainerOffsetTop
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
protected int getContainerOffsetTop() {
if (containerOffsetTop < 0 || !sync) {
int scrollTop = 0;
Element parent = DOM.getParent(getWidget().getElement());
while (parent != null) {
if (getScrollTop(parent) > 0) {
scrollTop += getScrollTop(parent);
GWT.log("Scroll Top detected : " + scrollTop);
}
if (containerFinder.isContainer(parent)) {
containerOffsetTop = DOM.getAbsoluteTop(parent) - scrollTop;
}
parent = DOM.getParent(parent);
}
}
return containerOffsetTop;
}
示例3: onBrowserEvent
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public void onBrowserEvent(final Event event) {
Element td = getEventTargetCell(event);
if (td==null) return;
final Element tr = DOM.getParent(td);
int col = DOM.getChildIndex(tr, td);
Element body = DOM.getParent(tr);
int row = DOM.getChildIndex(body, tr);
Widget widget = getWidget(row, col);
if (widget != null && widget instanceof UniTimeHeaderPanel) {
super.onBrowserEvent(event);
return;
}
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEOVER:
getRowFormatter().addStyleName(row, "hover");
break;
case Event.ONMOUSEOUT:
getRowFormatter().removeStyleName(row, "hover");
break;
}
super.onBrowserEvent(event);
}
示例4: getCellForWidget
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public int getCellForWidget(Widget w) {
for (Element e = w.getElement(); e != null; e = DOM.getParent(e)) {
if (e.getPropertyString("tagName").equalsIgnoreCase("span")) {
if (DOM.getParent(e) == getElement())
return DOM.getChildIndex(getElement(), e);
}
if (e == getElement()) { return -1; }
}
return -1;
}
示例5: onBrowserEvent
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
Element td = getEventTargetCell(event);
if (td==null) return;
Element tr = DOM.getParent(td);
Element body = DOM.getParent(tr);
final int row = DOM.getChildIndex(body, tr);
final ChainedCommand command = iRowClicks.get(row);
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEOVER:
getRowFormatter().setStyleName(row, "unitime-TableRowHover");
if (command == null) getRowFormatter().getElement(row).getStyle().setCursor(Cursor.AUTO);
break;
case Event.ONMOUSEOUT:
getRowFormatter().setStyleName(row, null);
break;
case Event.ONCLICK:
if (command == null) break;
if (command.getLoadingMessage() != null)
LoadingWidget.getInstance().show(command.getLoadingMessage());
getRowFormatter().setStyleName(row, "unitime-TableRowSelected");
iSelectedRow = row;
command.execute(new ConditionalCommand() {
@Override
public void executeOnSuccess() {
//getRowFormatter().setStyleName(row, null);
if (command.getLoadingMessage() != null)
LoadingWidget.getInstance().hide();
}
@Override
public void executeOnFailure() {
getRowFormatter().setStyleName(row, "unitime-TableRowHover");
if (command.getLoadingMessage() != null)
LoadingWidget.getInstance().hide();
}
});
break;
}
}
示例6: getRowForWidget
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public int getRowForWidget(Widget w) {
for (Element td = w.getElement(); td != null; td = DOM.getParent(td)) {
if (td.getPropertyString("tagName").equalsIgnoreCase("td")) {
Element tr = DOM.getParent(td);
Element body = DOM.getParent(tr);
if (body == getBodyElement())
return DOM.getChildIndex(body, tr);
}
if (td == getBodyElement()) { return -1; }
}
return -1;
}
示例7: onBrowserEvent
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
Element td = getEventTargetCell(event);
if (td==null) return;
Element tr = DOM.getParent(td);
Element body = DOM.getParent(tr);
int row = DOM.getChildIndex(body, tr);
int col = DOM.getChildIndex(tr, td);
if (row == 0 || col ==0) return;
processMouseEvent(DOM.eventGetType(event), row - 1, col - 1);
}
示例8: moveRow
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
private void moveRow(Element tr, Element before) {
Element body = DOM.getParent(tr);
body.removeChild(tr);
DOM.insertBefore(body, tr, before);
}
示例9: CurriculaCourses
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public CurriculaCourses() {
iTable = new UniTimeTable<String>();
iTable.addStyleName("unitime-CurriculaCourseProjections");
initWidget(iTable);
iCourseChangedHandler = new CourseSelectionHandler() {
@Override
public void onCourseSelection(CourseSelectionEvent event) {
CurriculumStudentsInterface[] c = (iLastCourses == null ? null : iLastCourses.get(event.getCourse()));
for (int col = 0; col < iClassifications.getClassifications().size(); col ++) {
setEnrollmentAndLastLike(event.getCourse(), col,
c == null || c[col] == null ? null : c[col].getEnrollment(),
c == null || c[col] == null ? null : c[col].getLastLike(),
c == null || c[col] == null ? null : c[col].getProjection(),
c == null || c[col] == null ? null : c[col].getRequested(),
c == null || c[col] == null ? null : (!c[col].isSessionHasSnapshotData() ? null : c[col].getSnapshotProjection()));
}
Element td = ((Widget)event.getSource()).getElement();
while (td != null && !td.getPropertyString("tagName").equalsIgnoreCase("td")) {
td = DOM.getParent(td);
}
Element tr = DOM.getParent(td);
Element body = DOM.getParent(tr);
int row = DOM.getChildIndex(body, tr);
if (event.getCourse().isEmpty()) {
iTable.getRowFormatter().addStyleName(row, "unitime-NoPrint");
} else {
iTable.getRowFormatter().removeStyleName(row, "unitime-NoPrint");
}
if (row + 1 == iTable.getRowCount() && !event.getCourse().isEmpty())
addBlankLine();
}
};
iNewGroupDialog = new GroupDialogBox();
iTable.setHintProvider(new HintProvider<String>() {
@Override
public Widget getHint(TableEvent<String> event) {
if (!canShowStudentsTable(event.getRow())) return null;
StudentsTable studentsTable = new StudentsTable(event.getRow());
if (studentsTable.canShow()) return studentsTable;
return null;
}
});
}
示例10: onBrowserEvent
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
if (iDummy) return;
Element target = DOM.eventGetTarget(event);
boolean anchor = false;
for (; target != null; target = DOM.getParent(target)) {
String tag = target.getPropertyString("tagName");
if ("a".equalsIgnoreCase(tag)) {
anchor = true;
break;
} else if ("div".equalsIgnoreCase(tag)) {
break;
}
}
EventTarget related = event.getRelatedEventTarget();
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
select(false);
if (!anchor) {
MeetingClickEvent e = new MeetingClickEvent(Meeting.this);
for (MeetingClickHandler h: iMeetingClickHandlers)
h.onMeetingClick(e);
}
break;
case Event.ONMOUSEOVER:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(true);
}
break;
case Event.ONMOUSEOUT:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(false);
}
break;
case Event.ONMOUSEMOVE:
int relativeX = event.getClientX() - getElement().getAbsoluteLeft() + getElement().getScrollLeft() + getElement().getOwnerDocument().getScrollLeft();
if (relativeX < iLeft - 6 - getDay() * iCellWidth || relativeX > iLeft - 2 - getDay() * iCellWidth + iWidth) {
select(false);
}
break;
}
super.onBrowserEvent(event);
}