本文整理了Java中com.google.gwt.dom.client.Element.as()
方法的一些代码示例,展示了Element.as()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.as()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:as
[英]Assert that the given Node is an Element and automatically typecast it.
[中]断言给定节点是一个元素,并自动对其进行类型转换。
代码示例来源:origin: kaaproject/kaa
/**
* Instantiates a new CtlSchemasViewImpl.
*/
public CtlSchemasViewImpl() {
super(true);
if (displayShowHigherLevelScopeCheckBox()) {
showHigherScopeCheckBox = new CheckBox(Utils.constants.displayHigherScopes());
showHigherScopeCheckBox.addStyleName(Utils.kaaAdminStyle.bAppContentTitle());
Element.as(showHigherScopeCheckBox.getElement().getChild(0))
.getStyle().setMarginRight(10, Unit.PX);
showHigherScopeCheckBox.setValue(defaultShowHigherLevelScopes());
appendToolbarWidget(showHigherScopeCheckBox);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Does the event target one of the partner elements?
*
* @param event the native event
* @return true if the event targets a partner
*/
private boolean eventTargetsPartner(NativeEvent event) {
if (autoHidePartners == null) {
return false;
}
EventTarget target = event.getEventTarget();
if (Element.is(target)) {
for (Element elem : autoHidePartners) {
if (elem.isOrHasChild(Element.as(target))) {
return true;
}
}
}
return false;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Does the event target this popup?
*
* @param event the native event
* @return true if the event targets the popup
*/
private boolean eventTargetsPopup(NativeEvent event) {
EventTarget target = event.getEventTarget();
if (Element.is(target)) {
return getElement().isOrHasChild(Element.as(target));
}
return false;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private boolean isCaptionEvent(NativeEvent event) {
EventTarget target = event.getEventTarget();
if (Element.is(target)) {
return getCellElement(0, 1).getParentElement().isOrHasChild(
Element.as(target));
}
return false;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
return;
Element target = Element.as(eventTarget);
if (!getElement().isOrHasChild(Element.as(eventTarget))) {
return;
&& CellBasedWidgetImpl.get().isFocusable(Element.as(target))) {
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void onBrowserEvent(Context context, Element parent, C value,
NativeEvent event, ValueUpdater<C> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
if (CLICK.equals(event.getType())) {
EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
return;
}
if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
// Ignore clicks that occur outside of the main element.
onEnterKeyDown(context, parent, value, event, valueUpdater);
}
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void onBrowserEvent(Context context, Element parent, String value,
NativeEvent event, ValueUpdater<String> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
if (CLICK.equals(event.getType())) {
EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
return;
}
if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
// Ignore clicks that occur outside of the main element.
onEnterKeyDown(context, parent, value, event, valueUpdater);
}
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
Element cursor = Element.as(eventTarget);
代码示例来源:origin: com.google.gwt/gwt-servlet
Element target = Element.as(eventTarget);
if ("input".equals(target.getTagName().toLowerCase(Locale.ROOT))) {
commit(context, parent, viewData, valueUpdater);
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Overridden to send ValueChangeEvents only when appropriate.
*/
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
case Event.ONBLUR:
case Event.ONKEYDOWN:
// Note the old value for onValueChange purposes (in ONCLICK case)
oldValue = getValue();
break;
case Event.ONCLICK:
EventTarget target = event.getEventTarget();
if (Element.is(target) && labelElem.isOrHasChild(Element.as(target))) {
// They clicked the label. Note our pre-click value, and
// short circuit event routing so that other click handlers
// don't hear about it
oldValue = getValue();
return;
}
// It's not the label. Let our handlers hear about the
// click...
super.onBrowserEvent(event);
// ...and now maybe tell them about the change
ValueChangeEvent.fireIfNotEqual(RadioButton.this, oldValue, getValue());
return;
}
super.onBrowserEvent(event);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
// Hook the popup panel's event preview. We use this to keep it from
// auto-hiding when the parent menu is clicked.
if (!event.isCanceled()) {
switch (event.getTypeInt()) {
case Event.ONMOUSEDOWN:
// If the event target is part of the parent menu, suppress the
// event altogether.
EventTarget target = event.getNativeEvent().getEventTarget();
Element parentMenuElement = MenuBar.this.getElement();
if (parentMenuElement.isOrHasChild(Element.as(target))) {
event.cancel();
return;
}
super.onPreviewNativeEvent(event);
if (event.isCanceled()) {
selectItem(null);
}
return;
}
}
super.onPreviewNativeEvent(event);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
if (previewEvent.isCanceled() || !cellParent.isOrHasChild(Element.as(event.getEventTarget()))) {
return;
代码示例来源:origin: com.google.gwt/gwt-servlet
Element target = Element.as(event.getNativeEvent().getEventTarget());
isFocusable = CellBasedWidgetImpl.get().isFocusable(target);
display.setKeyboardSelectedRow(relRow, !isFocusable);
代码示例来源:origin: com.google.gwt/gwt-servlet
Element target = Element.as(event.getNativeEvent().getEventTarget());
stealFocus = !CellBasedWidgetImpl.get().isFocusable(target);
代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets
private void doUpdateAllElementsSize(int width, int height) {
Node element = elementsParent.getFirstChildElement();
while (element != null) {
doSetElementSize(width, height, Element.as(element));
element = element.getNextSibling();
}
}
代码示例来源:origin: org.jbpm/jbpm-gwt-form-api
public void removeItem(String item) {
int index = 0;
for (; index < element.getChildCount(); index++) {
Node child = element.getChild(index);
Element elemChild = Element.as(child);
String elemHTML = elemChild.getInnerHTML();
if (elemHTML != null && elemHTML.equals(item)) {
removeItem(index);
break;
}
}
}
代码示例来源:origin: gwtbootstrap/gwt-bootstrap
public ShowEvent(NativeEvent event) {
setNativeEvent(event);
if(Element.is(event.getRelatedEventTarget())) {
setRelativeElement(Element.as(event.getRelatedEventTarget()));
}
}
代码示例来源:origin: gwtbootstrap/gwt-bootstrap
public ShownEvent(NativeEvent event) {
setNativeEvent(event);
if(Element.is(event.getRelatedEventTarget())) {
setRelativeElement(Element.as(event.getRelatedEventTarget()));
}
}
代码示例来源:origin: fr.putnami.pwt/pwt
private boolean eventTargetsContainerOrPartner(NativePreviewEvent event) {
Event nativeEvent = Event.as(event.getNativeEvent());
EventTarget target = nativeEvent.getEventTarget();
if (Element.is(target)) {
return this.isOrHasChildOfContainerOrPartner(Element.as(target));
}
return false;
}
代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
super.onPreviewNativeEvent(event);
NativeEvent nativeEvent = event.getNativeEvent();
Element target = Element.as(nativeEvent.getEventTarget());
if (Event.ONCLICK == event.getTypeInt()) {
if (getElement().isOrHasChild(target)) {
Scheduler.get().scheduleDeferred(this::hide);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!