本文整理汇总了Java中com.google.gwt.dom.client.Element类的典型用法代码示例。如果您正苦于以下问题:Java Element类的具体用法?Java Element怎么用?Java Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Element类属于com.google.gwt.dom.client包,在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scrollToSelectedRow
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
private void scrollToSelectedRow() {
int row = iTable.getSelectedRow();
if (row < 0) return;
Element scroll = iScroll.getElement();
Element item = iTable.getRowFormatter().getElement(iTable.getSelectedRow());
if (item==null) return;
int realOffset = 0;
while (item !=null && !item.equals(scroll)) {
realOffset += item.getOffsetTop();
item = item.getOffsetParent();
}
scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2);
}
示例2: getSubmitCompleteHandler
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
private SubmitCompleteHandler getSubmitCompleteHandler() {
return new SubmitCompleteHandler() {
public void onSubmitComplete(final SubmitCompleteEvent event) {
final Element label = DOM.createLabel();
label.setInnerHTML(event.getResults());
final String csvData = label.getInnerText();
if (hasError(csvData)) {
showAlert("Error: " + csvData);
} else {
parseCsvData(csvData);
autoMessageBox.hide();
}
}
private boolean hasError(final String contentFile) {
return contentFile.startsWith("413")
|| contentFile.startsWith("500");
}
};
}
示例3: scrollToSelectedRow
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
protected void scrollToSelectedRow() {
if (iCourses.getSelectedRow() < 0) return;
Element scroll = iCoursesPanel.getElement();
com.google.gwt.dom.client.Element item = iCourses.getRowFormatter().getElement(iCourses.getSelectedRow());
if (item==null) return;
int realOffset = 0;
while (item !=null && !item.equals(scroll)) {
realOffset += item.getOffsetTop();
item = item.getOffsetParent();
}
scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2);
}
示例4: scrollToSelectedRow
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
protected void scrollToSelectedRow() {
if (iDegreePlanTable.getSelectedRow() < 0) return;
Element scroll = iDegreePlanPanel.getElement();
com.google.gwt.dom.client.Element item = iDegreePlanTable.getRowFormatter().getElement(iDegreePlanTable.getSelectedRow());
if (item == null) return;
int realOffset = 0;
while (item !=null && !item.equals(scroll)) {
realOffset += item.getOffsetTop();
item = item.getOffsetParent();
}
scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2);
}
示例5: getAssessmentHeaderViewSocket
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
@Override
public ViewSocket getAssessmentHeaderViewSocket() {
Element element = getViewJs(extensionJsObject);
Widget widget = null;
if (element != null) {
widget = new ElementWrapperWidget(element);
}
final Widget widget2 = widget;
return new ViewSocket() {
@Override
public Widget getView() {
return widget2;
}
};
}
示例6: getElementByVaadinWidget
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
public static Element getElementByVaadinWidget(Widget widget, VaadinWidgetType widgetType) {
if (widgetType == null) {
return widget.getElement();
}
switch (widgetType) {
case TEXTFIELD:
return widget.getElement();
case DATEFIELD:
return ((VAbstractTextualDate) widget).text.getElement();
case COMBOBOX:
return ((VComboBox) widget).tb.getElement();
case CHECKBOXGROUP:
// returning the outer div for styling purpose
return widget.getElement();
case CHECKBOX:
// returning the outer div for styling purpose
return widget.getElement();
case NATIVESELECT:
return ((VNativeSelect) widget).getListBox().getElement();
default:
return widget.getElement();
}
}
示例7: getAssessmentFooterViewSocket
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
@Override
public ViewSocket getAssessmentFooterViewSocket() {
Element e = getViewJs(extensionJsObject);
Widget w = null;
if (e != null)
w = new ElementWrapperWidget(e);
final Widget w2 = w;
return new ViewSocket() {
@Override
public Widget getView() {
return w2;
}
};
}
示例8: registerTouchEvents
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
private native void registerTouchEvents(Element element)/*-{
var instance = this;
element.ontouchstart = function (e) {
e.preventDefault();
if (e.touches.length == 1) {
var touch = e.touches[0];
[email protected]::processOnTouchStartEvent(II)(touch.pageX, touch.pageY);
}
}
element.ontouchmove = function (e) {
e.preventDefault();
if (e.touches.length == 1) {
var touch = e.touches[0];
[email protected]::processOnTouchMoveEvent(II)(touch.pageX, touch.pageY);
}
}
element.ontouchend = function (e) {
e.preventDefault();
[email protected]::processOnTouchEndEvent()();
}
}-*/;
示例9: showHintForExam
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
public static void showHintForExam(final Element relativeObject, final Long examId, final Long periodId) {
sLastLocationId = examId;
sShowHint = true;
RPC.execute(RoomInterface.PeriodPreferenceRequest.loadForExam(examId, null), new AsyncCallback<RoomInterface.PeriodPreferenceModel>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(RoomInterface.PeriodPreferenceModel result) {
if (examId.equals(sLastLocationId) && sShowHint && result != null) {
if (periodId != null) result.setAssignedPeriodId(periodId);
GwtHint.showHint(relativeObject, content(result));
}
}
});
}
示例10: setPropertyTest
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
@Test
public void setPropertyTest() {
// prepare
Map<String, String> propertyStyle = new HashMap<String, String>();
propertyStyle.put("lineWidth", "0");
propertyStyle.put("lineCap", "miter");
propertyStyle.put("lineJoin", "square");
propertyStyle.put("miterLimit", "3");
// test
testObject.applyStyles(mock(Element.class), propertyStyle);
verify(nativeStyleHelper, times(4)).applyProperty(any(Element.class), any(String.class), any(String.class));
for (Map.Entry<String, String> entry : propertyStyle.entrySet()) {
verify(nativeStyleHelper).applyProperty(any(Element.class), Matchers.eq(entry.getKey()), Matchers.eq(entry.getValue()));
}
}
示例11: callFunctionTest
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
@Test
public void callFunctionTest() {
// prepare
Map<String, String> propertyStyle = new HashMap<String, String>();
propertyStyle.put("lineWidth", "0");
propertyStyle.put("lineCap", "miter");
propertyStyle.put("lineJoin", "square");
propertyStyle.put("miterLimit", "3");
propertyStyle.put("fn-lineCap", "miter");
propertyStyle.put("fn-lineJoin", "square");
propertyStyle.put("fn-miterLimit", "3");
// test
testObject.applyStyles(mock(Element.class), propertyStyle);
verify(nativeStyleHelper, times(0)).callFunction(any(Element.class), any(String.class), any(String.class));
testObject.addFunctionToWhiteList("lineCap");
testObject.addFunctionToWhiteList("miterLimit");
testObject.applyStyles(mock(Element.class), propertyStyle);
verify(nativeStyleHelper, times(2)).callFunction(any(Element.class), any(String.class), any(String.class));
}
示例12: showHint
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
public static void showHint(final Element relativeObject, final String instructorId, boolean includeNotAvailable, final String pattern) {
sLastInstructorId = instructorId;
RPC.execute(InstructorAvailabilityRequest.load(instructorId, includeNotAvailable), new AsyncCallback<InstructorAvailabilityModel>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(InstructorAvailabilityModel result) {
if (pattern != null)
result.setPattern(pattern);
if (instructorId.equals(sLastInstructorId) && result != null)
GwtHint.showHint(relativeObject, content(result));
}
});
}
示例13: onBrowserEvent
import com.google.gwt.dom.client.Element; //导入依赖的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);
}
示例14: getInput
import com.google.gwt.dom.client.Element; //导入依赖的package包/类
private Element getInput() {
if (VaadinWidgetType.CHECKBOX.equals(widgetType)) {
// we want to apply aria attributes to the input / not the styling div
return widgetElement.getFirstChildElement();
} else if (VaadinWidgetType.CHECKBOXGROUP.equals(widgetType)) {
// just a reminder - CheckBoxGroup can have the describedby here because
// the outer div has tabindex and is kinda like a fieldset for all inputs.
return widgetElement;
}
// anything else
return widgetElement;
}
示例15: getRowForWidget
import com.google.gwt.dom.client.Element; //导入依赖的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;
}