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


Java WidgetUtil.focus方法代码示例

本文整理汇总了Java中com.vaadin.client.WidgetUtil.focus方法的典型用法代码示例。如果您正苦于以下问题:Java WidgetUtil.focus方法的具体用法?Java WidgetUtil.focus怎么用?Java WidgetUtil.focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.client.WidgetUtil的用法示例。


在下文中一共展示了WidgetUtil.focus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: focusInputField

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
private void focusInputField(Element componentElement) {
    for (int i = 0; i < componentElement.getChildNodes().getLength(); i++) {
        Node node = componentElement.getChildNodes().getItem(i);
        if (node.getNodeName().equals("INPUT") || node.getNodeName().equals("SELECT")) {
            WidgetUtil.focus((Element) node);
            break;
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:EnterKeyDownHandler.java

示例3: focusInputField

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
 * Focus into input field below given element. Note! Element needs to be a
 * table TD element so we don't mistakenly recurse too much.
 *
 * @param componentElement
 *            TD element to be searched for input and focused
 * @param shiftKeyDown
 *            if shiftkey was down when event was triggered
 */
protected static void focusInputField(final Element componentElement, boolean shiftKeyDown) {
	if (componentElement == null || !componentElement.getNodeName()
		.equals("TD")) {
		return;
	}

	Element input = getInputElement(componentElement.getChildNodes(), shiftKeyDown);
	if (input != null) {
		WidgetUtil.focus(input);
		input.scrollIntoView();
	}
}
 
开发者ID:vaadin,项目名称:grid-renderers-collection-addon,代码行数:22,代码来源:NavigationUtil.java

示例4: restoreFocus

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public void restoreFocus() {
    WidgetUtil.focus(focus);

}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:FocusPreservingRefreshClientRpcImpl.java

示例5: onKeyDown

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public void onKeyDown(GridKeyDownEvent event) {

    if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {


        if (isCellContainingComponent(event.getFocusedCell())) {

            // if the ENTER key-event's propagation is not stopped it would
            // be propagated to the newly focused component, which e.g. in the
            // case of a button leads to an immediate button press
            event.preventDefault();
            event.stopPropagation();

            Element componentElement = extractComponentElement(event.getFocusedCell());

            WidgetUtil.focus(componentElement);
            focusInputField(componentElement);

        }

    }


}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:EnterKeyDownHandler.java


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