當前位置: 首頁>>代碼示例>>Java>>正文


Java DOM.getChildIndex方法代碼示例

本文整理匯總了Java中com.google.gwt.user.client.DOM.getChildIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java DOM.getChildIndex方法的具體用法?Java DOM.getChildIndex怎麽用?Java DOM.getChildIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.user.client.DOM的用法示例。


在下文中一共展示了DOM.getChildIndex方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:26,代碼來源:SimpleEditPage.java

示例2: 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;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:FlowForm.java

示例3: 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;
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:41,代碼來源:CourseCurriculaTable.java

示例4: 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;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:13,代碼來源:UniTimeTable.java

示例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);
    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);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:FreeTimePicker.java

示例6: 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;
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:47,代碼來源:CurriculaCourses.java


注:本文中的com.google.gwt.user.client.DOM.getChildIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。