当前位置: 首页>>代码示例>>Java>>正文


Java WidgetUtil.findWidget方法代码示例

本文整理汇总了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);
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:32,代码来源:CalendarWeekDropHandler.java

示例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;
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:CubaSideMenuWidget.java

示例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");
                        }
                    }
                }
            });
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:Tools.java

示例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();
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:EscKeyDownHandler.java

示例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();
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:9,代码来源:CalendarWeekDropHandler.java

示例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();
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:9,代码来源:CalendarMonthDropHandler.java

示例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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:CubaGridWidget.java

示例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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:CubaGridKeyPressEvent.java

示例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;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:CubaPopupButtonConnector.java

示例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();
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:CubaSuggestionFieldWidget.java

示例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;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:CubaSideMenuWidget.java

示例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();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:FocusPreservingRefreshClientRpcImpl.java

示例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);
}
 
开发者ID:vaadin,项目名称:tree-grid,代码行数:10,代码来源:TreeGridClickEvent.java

示例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;
}
 
开发者ID:vaadin,项目名称:tree-grid,代码行数:16,代码来源:HierarchyRenderer.java

示例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();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:CubaGridWidget.java


注:本文中的com.vaadin.client.WidgetUtil.findWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。