本文整理汇总了Java中com.google.gwt.user.client.ui.impl.FocusImpl类的典型用法代码示例。如果您正苦于以下问题:Java FocusImpl类的具体用法?Java FocusImpl怎么用?Java FocusImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FocusImpl类属于com.google.gwt.user.client.ui.impl包,在下文中一共展示了FocusImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setFocus
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
/**
* Sets/Removes the keyboard focus to the panel.
*
* @param focus
* If set to true then the focus is moved to the panel, if set to
* false the focus is removed
*/
public void setFocus(boolean focus) {
if (focus) {
FocusImpl.getFocusImplForPanel().focus(getElement());
} else {
FocusImpl.getFocusImplForPanel().blur(getElement());
}
}
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:15,代码来源:FocusableComplexPanel.java
示例2: SuggestionsContainer
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
public SuggestionsContainer(CubaSuggestionFieldWidget suggestionFieldWidget) {
this.suggestionFieldWidget = suggestionFieldWidget;
container = DOM.createDiv();
final Element outer = FocusImpl.getFocusImplForPanel().createFocusable();
DOM.appendChild(outer, container);
setElement(outer);
sinkEvents(Event.ONCLICK | Event.ONMOUSEDOWN | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONFOCUS | Event.ONKEYDOWN);
addDomHandler(event ->
selectItem(null), BlurEvent.getType());
setStylePrimaryName(STYLENAME);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:SuggestionsContainer.java
示例3: performItemCommand
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
protected void performItemCommand(final SuggestionItem item) {
selectedSuggestion = item;
Scheduler.ScheduledCommand cmd = item.getScheduledCommand();
if (cmd != null) {
FocusImpl.getFocusImplForPanel().blur(getElement());
Scheduler.get().scheduleFinally(cmd);
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:SuggestionsContainer.java
示例4: setFocus
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
protected void setFocus(boolean focus) {
if (focus) {
FocusImpl.getFocusImplForPanel().focus(getElement());
} else {
FocusImpl.getFocusImplForPanel().blur(getElement());
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:FocusableFlowPanel.java
示例5: focus
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
/**
* Focus the element, if possible
* @param element
*/
public static void focus(Element element) {
// NOTE(user): This may not work for divs, rather use getFocusImplForPanel
// for divs.
try {
FocusImpl.getFocusImplForWidget().focus(castToOld(element));
} catch (Exception e) {
// Suppress null pointer condition
}
}
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:14,代码来源:DomHelper.java
示例6: onShow
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
@Override
public void onShow(PopupEventSourcer source) {
// NOTE(user): Clear selection so that it doesn't get forcibly restored
// when applying operations. In Firefox, that would take focus away from the
// suggestion menu.
selectionHelper.clearSelection();
FocusImpl.getFocusImplForPanel().focus(menu.getElement());
}
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:9,代码来源:InteractiveSuggestionsManager.java
示例7: doItemAction
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
void doItemAction(final SuggestionMenuItem item, boolean fireCommand,
boolean focus) {
// Should not perform any action if the item is disabled
if (!item.isEnabled()) {
return;
}
// Ensure that the item is selected.
selectItem(item);
// if the command should be fired and the item has one, fire it
if (fireCommand && item.getScheduledCommand() != null) {
// Close this menu and all of its parents.
selectItem(null);
// Remove the focus from the menu
// FocusPanel.impl.blur(getElement());
FocusImpl.getFocusImplForPanel().blur(getElement());
// Fire the item's command. The command must be fired in the same
// event
// loop or popup blockers will prevent popups from opening.
final ScheduledCommand cmd = item.getScheduledCommand();
Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
cmd.execute();
}
});
}
}
开发者ID:markoradinovic,项目名称:suggestfield,代码行数:33,代码来源:SuggestionMenuBar.java
示例8: init
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
private void init() {
Element table = DOM.createTable();
body = DOM.createTBody();
DOM.appendChild(table, body);
Element outer = FocusImpl.getFocusImplForPanel().createFocusable();
DOM.appendChild(outer, table);
setElement(outer);
Roles.getMenubarRole().set(getElement());
sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT
| Event.ONFOCUS | Event.ONKEYDOWN);
setStyleName(STYLENAME_DEFAULT);
addStyleDependentName("vertical");
// Hide focus outline in Mozilla/Webkit/Opera
getElement().getStyle().setProperty("outline", "0px");
// Hide focus outline in IE 6/7
getElement().setAttribute("hideFocus", "true");
// Deselect items when blurring without a child menu.
addDomHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
selectItem(null);
}
}, BlurEvent.getType());
}
开发者ID:markoradinovic,项目名称:suggestfield,代码行数:32,代码来源:SuggestionMenuBar.java
示例9: setKeyboardSelected
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
/**
* Select or deselect this node with the keyboard.
*
* @param selected true if selected, false if not
* @param stealFocus true to steal focus
*/
void setKeyboardSelected(boolean selected, boolean stealFocus) {
if (tree.isKeyboardSelectionDisabled()) {
return;
}
// Apply the selected style.
if (!selected || tree.isFocused || stealFocus) {
setKeyboardSelectedStyle(selected);
}
// Make the node focusable or not.
Element cellParent = getCellParent();
if (!selected) {
// Chrome: Elements remain focusable after removing the tabIndex, so set
// it to -1 first.
cellParent.setTabIndex(-1);
cellParent.removeAttribute("tabIndex");
cellParent.removeAttribute("accessKey");
}
else {
FocusImpl focusImpl = FocusImpl.getFocusImplForWidget();
focusImpl.setTabIndex(cellParent, tree.getTabIndex());
char accessKey = tree.getAccessKey();
if (accessKey != 0) {
focusImpl.setAccessKey(cellParent, accessKey);
}
if (stealFocus && !tree.cellIsEditing) {
cellParent.focus();
}
}
// Update the selection model.
if (KeyboardSelectionPolicy.BOUND_TO_SELECTION == tree.getKeyboardSelectionPolicy()) {
setSelected(selected);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:43,代码来源:CellTreeNodeView.java
示例10: setAccessKey
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
@Override
public void setAccessKey(char key) {
FocusImpl.getFocusImplForWidget().setAccessKey(getElement(), key);
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:5,代码来源:ClickableHint.java
示例11: focus
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
/**
* TODO(user): use content document to set caret, and issue operation
*
* TODO(danilatos): This stuff seems out of date...
*
* TODO(danilatos): Make this method trivially idempotent
*
* {@inheritDoc}
*/
@Override
public void focus(boolean collapsed) {
if (!isAttached()) {
EditorStaticDeps.logger.error().log("Shouldn't focus a detached editor");
return;
}
// focus document
if (isEditing() && content != null) {
// first, handle DOM focus
FocusedPointRange<Node> htmlSelection = getHtmlSelection(); // save before focusing.
// element causes webkit based browsers to automatically scroll the element into view
// In wave, we want to be in charge of how things move, so we cancel this behaviour
// here by first recording the scrollTops of all the editor's ancestors, and
// then resetting them after calling focus.
Element docElement = getDocumentHtmlElement();
maybeSaveAncestorScrollPositions(docElement);
FocusImpl.getFocusImplForWidget().focus(DomHelper.castToOld(docElement));
maybeRestoreAncestorScrollPositions(docElement);
// then, handle the case when selection already existed inside the element:
if (htmlSelection != null) {
// NOTE(patcoleman): we may have killed it with the DOM focusing above, so restore
NativeSelectionUtil.set(htmlSelection);
if (!collapsed) {
// if we have selection, and we're not forcibly collapsing it, then nothing needs doing.
return;
} else {
// Otherwise, we might need to adjust it if we're collapsing it. So we'll fall through to
// the manual selection-restore-with-collapse, but first we save what we have anyway.
EditorStaticDeps.logger.trace().log("Saving...");
doSaveSelection();
}
}
// finally, make sure selection is correct:
safelyRestoreSelection(aggressiveSelectionHelper, collapsed);
scheduleUpdateNotification(true, true, false, false);
}
}
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:52,代码来源:EditorImpl.java
示例12: Tree
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
public Tree(
NodeStorage nodeStorage,
NodeLoader nodeLoader,
TreeStyles treeStyles,
EmptyStatus<Tree> emptyStatus) {
checkNotNull(nodeStorage);
checkNotNull(nodeLoader);
checkNotNull(treeStyles);
this.treeStyles = treeStyles;
this.treeStyles.styles().ensureInjected();
this.nodesByDom = new HashMap<>();
this.focusImpl = FocusImpl.getFocusImplForPanel();
this.storeHandlers = new GroupingHandlerRegistration();
ensureTreeElement();
ensureFocusElement();
setNodeStorage(nodeStorage);
setNodeLoader(nodeLoader);
setSelectionModel(new SelectionModel());
setGoInto(new DefaultGoInto());
setView(new TreeView());
setAllowTextSelection(false);
disableBrowserContextMenu(true);
// use as default
if (emptyStatus == null) {
emptyStatus = new StatusText<>();
}
this.emptyStatus = emptyStatus;
this.emptyStatus.init(
this,
new Predicate<Tree>() {
@Override
public boolean apply(@Nullable Tree tree) {
return tree.getNodeStorage().getRootCount() == 0;
}
});
}
开发者ID:eclipse,项目名称:che,代码行数:42,代码来源:Tree.java
示例13: focus
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
/**
* Give this MenuBar focus.
*/
public void focus() {
FocusImpl.getFocusImplForPanel().focus(getElement());
}
开发者ID:markoradinovic,项目名称:suggestfield,代码行数:7,代码来源:SuggestionMenuBar.java
示例14: onBrowserEvent
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
SuggestionMenuItem item = findItem(DOM.eventGetTarget(event));
switch (DOM.eventGetType(event)) {
case Event.ONCLICK: {
FocusImpl.getFocusImplForPanel().focus(getElement());
// Fire an item's command when the user clicks on it.
if (item != null) {
doItemAction(item, true, true);
}
break;
}
case Event.ONMOUSEOVER: {
if (item != null) {
itemOver(item, true);
}
break;
}
case Event.ONMOUSEOUT: {
if (item != null) {
itemOver(null, false);
}
break;
}
case Event.ONFOCUS: {
selectFirstItemIfNoneSelected();
break;
}
case Event.ONKEYDOWN: {
int keyCode = event.getKeyCode();
boolean isRtl = LocaleInfo.getCurrentLocale().isRTL();
keyCode = KeyCodes.maybeSwapArrowKeysForRtl(keyCode, isRtl);
switch (keyCode) {
case KeyCodes.KEY_UP:
moveSelectionUp();
eatEvent(event);
break;
case KeyCodes.KEY_DOWN:
moveSelectionDown();
eatEvent(event);
break;
case KeyCodes.KEY_ESCAPE:
selectItem(null);
eatEvent(event);
break;
case KeyCodes.KEY_TAB:
selectItem(null);
break;
case KeyCodes.KEY_ENTER:
if (!selectFirstItemIfNoneSelected()) {
doItemAction(selectedItem, true, true);
eatEvent(event);
}
break;
} // end switch(keyCode)
break;
} // end case Event.ONKEYDOWN
} // end switch (DOM.eventGetType(event))
super.onBrowserEvent(event);
}
开发者ID:markoradinovic,项目名称:suggestfield,代码行数:66,代码来源:SuggestionMenuBar.java
示例15: blur
import com.google.gwt.user.client.ui.impl.FocusImpl; //导入依赖的package包/类
/**
* Blur the element, if possible
* @param element
*
* NOTE(user): Dan thinks this method should be deprecated, but is not
* sure why... Dan, please update once you remember.
*/
public static void blur(Element element) {
FocusImpl.getFocusImplForWidget().blur(castToOld(element));
}
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:11,代码来源:DomHelper.java
注:本文中的com.google.gwt.user.client.ui.impl.FocusImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论