本文整理汇总了Java中com.vaadin.client.WidgetUtil.findWidget方法的典型用法代码示例。如果您正苦于以下问题:Java WidgetUtil.findWidget方法的具体用法?Java WidgetUtil.findWidget怎么用?Java WidgetUtil.findWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.client.WidgetUtil
的用法示例。
在下文中一共展示了WidgetUtil.findWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isLocationValid
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
* Checks if the location is a valid drop location
*
* @param elementOver
* The element to check
* @return
*/
private boolean isLocationValid(Element elementOver) {
Element weekGridElement = calendarConnector.getWidget().getWeekGrid()
.getElement();
Element timeBarElement = calendarConnector.getWidget().getWeekGrid()
.getTimeBar().getElement();
Element todayBarElement = null;
if (calendarConnector.getWidget().getWeekGrid().hasToday()) {
todayBarElement = calendarConnector.getWidget().getWeekGrid()
.getDateCellOfToday().getTodaybarElement();
}
// drops are not allowed in:
// - weekday header
// - allday event list
// - todaybar
// - timebar
// - items
return DOM.isOrHasChild(weekGridElement, elementOver)
&& !DOM.isOrHasChild(timeBarElement, elementOver)
&& todayBarElement != elementOver
&& (WidgetUtil.findWidget(elementOver,
DateCellDayItem.class) == null);
}
示例2: onBrowserEvent
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (isEnabled()) {
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEOVER:
Element targetElement = DOM.eventGetTarget(event);
Object targetWidget = WidgetUtil.findWidget(targetElement, null);
if (targetWidget instanceof MenuItemWidget) {
setFocusedItem((MenuItemWidget) targetWidget);
}
break;
case Event.ONMOUSEOUT:
if (!focused) {
setFocusedItem(null);
}
break;
}
}
}
示例3: onPreviewNativeEvent
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@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()) {
final Widget hoveredButton = WidgetUtil.findWidget(target, null);
if (getElement().isOrHasChild(target)) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
hide();
if (BrowserInfo.get().isIE9()) {
if (hoveredButton instanceof CubaButtonWidget) {
hoveredButton.removeStyleName("ie9-hover");
}
}
}
});
}
}
}
示例4: onKeyDown
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent keyDownEvent) {
if (keyDownEvent.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);
if (panel != null) {
WidgetUtil.focus(panel.getParent().getElement());
// prevent further bubbling of the event as it has only
// navigational purpose if thrown at this depth. A subsequent
// press of ESC is not stopped, so ESC abort actions of the
// application should work as soon as the focus is in
// "navigational mode" on a grid-cell
keyDownEvent.preventDefault();
keyDownEvent.stopPropagation();
}
}
}
示例5: dragAccepted
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
protected void dragAccepted(VDragEvent drag) {
deEmphasis();
currentTargetElement = drag.getElementOver();
currentTargetDay = WidgetUtil.findWidget(currentTargetElement,
DateCell.class);
emphasis();
}
示例6: dragAccepted
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
protected void dragAccepted(VDragEvent drag) {
deEmphasis();
currentTargetElement = drag.getElementOver();
currentTargetDay = WidgetUtil.findWidget(currentTargetElement,
SimpleDayCell.class);
emphasis();
}
示例7: isEventHandlerShouldHandleEvent
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
protected boolean isEventHandlerShouldHandleEvent(Element targetElement) {
// by default, clicking on widget renderer prevents cell focus changing
// for some widget renderers we want to allow focus changing
Widget widget = WidgetUtil.findWidget(targetElement, null);
return !(widget instanceof com.vaadin.client.Focusable
|| widget instanceof com.google.gwt.user.client.ui.Focusable)
|| isClickThroughEnabled(targetElement);
}
示例8: getGrid
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public Grid<?> getGrid() {
EventTarget target = getNativeEvent().getEventTarget();
if (!Element.is(target)) {
return null;
}
return WidgetUtil.findWidget(Element.as(target), CubaGridWidget.class);
}
示例9: isLastChild
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
private boolean isLastChild(Element target) {
Widget widget = WidgetUtil.findWidget(target, null);
Widget widgetParent = widget.getParent();
VAbstractOrderedLayout layout = (VAbstractOrderedLayout) widgetParent.getParent();
int widgetIndex = layout.getWidgetIndex(widgetParent);
return widgetIndex == layout.getWidgetCount() - 1;
}
示例10: handleOnBlur
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
protected void handleOnBlur(BlurEvent event) {
removeStyleName(MODIFIED_STYLENAME);
if (BrowserInfo.get().isIE()) {
if (iePreventBlur) {
textField.setFocus(true);
iePreventBlur = false;
} else {
resetComponentState();
}
} else {
if (!suggestionsPopup.isShowing()) {
resetComponentState();
return;
}
EventTarget eventTarget = event.getNativeEvent().getRelatedEventTarget();
if (eventTarget == null) {
resetComponentState();
return;
}
if (Element.is(eventTarget)) {
Widget widget = WidgetUtil.findWidget(Element.as(eventTarget), null);
if (widget != suggestionsContainer) {
resetComponentState();
}
}
}
}
示例11: getTooltip
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
public String getTooltip(Element element) {
Object widget = WidgetUtil.findWidget(element, null);
if (widget instanceof MenuItemWidget) {
return ((MenuItemWidget) widget).getDescription();
}
return null;
}
示例12: saveFocus
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public void saveFocus() {
SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);
if (panel != null) {
focus = panel.getParent().getElement();
}
}
示例13: getGrid
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public TreeGrid getGrid() {
// Copied from AbstractGridMouseEvent.getGrid() and changed to find TreeGrid class
EventTarget target = getNativeEvent().getEventTarget();
if (!Element.is(target)) {
return null;
}
return WidgetUtil.findWidget(Element.as(target), TreeGrid.class);
}
示例14: isElementInHierarchyWidget
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
* Decides whether the element was rendered by {@link HierarchyRenderer}
*/
static boolean isElementInHierarchyWidget(Element element) {
Widget w = WidgetUtil.findWidget(element, null);
while (w != null) {
if (w instanceof HierarchyItem) {
return true;
}
w = w.getParent();
}
return false;
}
示例15: isClickThroughEnabled
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
protected boolean isClickThroughEnabled(Element e) {
Widget widget = WidgetUtil.findWidget(e, null);
return widget instanceof HasClickSettings &&
((HasClickSettings) widget).isClickThroughEnabled();
}