本文整理匯總了Java中com.google.gwt.event.dom.client.FocusEvent類的典型用法代碼示例。如果您正苦於以下問題:Java FocusEvent類的具體用法?Java FocusEvent怎麽用?Java FocusEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FocusEvent類屬於com.google.gwt.event.dom.client包,在下文中一共展示了FocusEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onFocus
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event) {
debug("VComboBoxMultiselect: onFocus()");
/*
* When we disable a blur event in ie we need to refocus the textfield.
* This will cause a focus event we do not want to process, so in that
* case we just ignore it.
*/
if (BrowserInfo.get()
.isIE() && this.iePreventNextFocus) {
this.iePreventNextFocus = false;
return;
}
this.focused = true;
updatePlaceholder();
addStyleDependentName("focus");
this.connector.sendFocusEvent();
this.connector.getConnection()
.getVTooltip()
.showAssistive(this.connector.getTooltipInfo(getElement()));
}
示例2: addFocusHandler
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
if (!focusHandlerAdded) {
focusHandlerAdded = true;
final OrionTextViewOverlay textView = this.editorOverlay.getTextView();
textView.addEventListener(
OrionEventConstants.FOCUS_EVENT,
new OrionTextViewOverlay.EventHandlerNoParameter() {
@Override
public void onEvent() {
fireFocusEvent();
}
});
}
return addHandler(handler, FocusEvent.getType());
}
示例3: View
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
View(Window.Resources res, boolean showBottomPanel) {
this.res = res;
this.css = res.windowCss();
windowWidth = com.google.gwt.user.client.Window.getClientWidth();
clientLeft = Document.get().getBodyOffsetLeft();
clientTop = Document.get().getBodyOffsetTop();
initWidget(uiBinder.createAndBindUi(this));
footer = new HTMLPanel("");
if (showBottomPanel) {
footer.setStyleName(res.windowCss().footer());
contentContainer.add(footer);
}
handleEvents();
FocusPanel dummyFocusElement = new FocusPanel();
dummyFocusElement.setTabIndex(0);
dummyFocusElement.addFocusHandler(
new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
setFocus();
}
});
contentContainer.add(dummyFocusElement);
}
示例4: listenTo
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
public void listenTo(TextBoxBase tb) {
strings.put(tb, tb.getText().trim());
tb.addKeyPressHandler(this);
// Is there another way to capture middle button X11 pastes in browsers
// which do not yet support ONPASTE events (Firefox)?
tb.addMouseUpHandler(this);
// Resetting the "original text" on focus ensures that we are
// up to date with non-user updates of the text (calls to
// setText()...) and also up to date with user changes which
// occurred after enabling "widget".
tb.addFocusHandler(
new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
strings.put(tb, tb.getText().trim());
}
});
// CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or
// KeyDownEvents, the latter is better.
tb.addKeyDownHandler(this);
}
示例5: EnumEditorViewImpl
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
EnumEditorViewImpl(final List<String> enumValues, final List<String> enumDescriptions) {
// Sets up a SuggestOracle that, when the textbox has focus, displays the
// valid enum values and their descriptions.
MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
List<Suggestion> suggestions = Lists.newArrayList();
for (int i = 0; i < enumValues.size(); i++) {
suggestions.add(new EnumSuggestion(
enumValues.get(i), enumDescriptions == null ? "" : enumDescriptions.get(i)));
}
oracle.setDefaultSuggestions(suggestions);
this.suggestBox = new SuggestBox(oracle);
suggestBox.getTextBox().addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
suggestBox.showSuggestionList();
}
});
add(suggestBox);
this.errorMessage = new Label("This parameter is invalid.");
errorMessage.setVisible(false);
add(errorMessage);
}
示例6: setFocusGained
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
public void setFocusGained(JavaScriptObject aValue) {
if (focusGained != aValue) {
if (focusReg != null) {
focusReg.removeHandler();
focusReg = null;
}
focusGained = aValue;
if (focusGained != null && component instanceof HasFocusHandlers) {
focusReg = ((HasFocusHandlers) component).addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
if (focusGained != null) {
executeEvent(focusGained, EventsPublisher.publish(event));
}
}
});
}
}
}
示例7: DateSelector
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
public DateSelector()
{
initWidget( textBox );
textBox.addFocusHandler( new FocusHandler()
{
@Override
public void onFocus( FocusEvent event )
{
if( !enabled )
return;
showPopup();
}
} );
}
示例8: bindHandlers
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
private void bindHandlers() {
if (this.widget == null) {
return;
}
this.registrations.removeHandler();
switch (this.getTrigger()) {
case FOCUS:
this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, FocusEvent.getType()));
this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, BlurEvent.getType()));
break;
case HOVER:
this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, MouseOverEvent.getType()));
this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, MouseOutEvent.getType()));
break;
case MANUAL:
break;
default:
break;
}
}
示例9: onFocus
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event)
{
if( m_isFocused )
{
//smU_Debug.ASSERT(false, "onFocus1");
return;
}
m_currentElement = event.getRelativeElement();
ToolTipConfig config = m_tipMap.get(m_currentElement);
U_Debug.ASSERT(config!= null, "smToolTipSubManager_Focus::onFocus1");
m_toolTipManager.prepareTip(m_toolTip, m_currentElement, config);
m_toolTipManager.showTip(m_toolTip, null);
m_isFocused = true;
}
示例10: onBrowserEvent
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONBLUR:
BlurEvent.fireNativeEvent(event, this);
break;
case Event.ONFOCUS:
FocusEvent.fireNativeEvent(event, this);
break;
}
super.onBrowserEvent(event);
}
示例11: onFocus
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event) {
// Force cursor to end of input
if (input instanceof TextBox) {
TextBox inputBox = (TextBox)input;
inputBox.setCursorPos(inputBox.getText().length());
}
}
示例12: initialize
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
/**
* Allows to initialize the text box by setting up its listeners and styles.
*/
private void initialize() {
//Set the base values and styles
super.setStyleName( CommonResourcesContainer.GWT_TEXT_BOX_STYLE );
this.addStyleName( CommonResourcesContainer.USER_DIALOG_SUGG_TEXT_BOX_STYLE );
this.setText( helperText );
//On gaining the focus
addFocusHandler(new FocusHandler(){
public void onFocus(FocusEvent event) {
//If the focus is obtained and the text box value is set to empty if
//the user text was not set, i.e. he have the helper message there
if( TextBoxWithSuggText.super.getText().trim().equals( helperText ) ){
TextBoxWithSuggText.super.setText( "" );
}
//Remove the suggestion style making the text be in another color
removeStyleName( CommonResourcesContainer.USER_DIALOG_SUGG_TEXT_BOX_STYLE );
}
});
//On loosing the focus
addBlurHandler(new BlurHandler(){
public void onBlur(BlurEvent e) {
//If the text box looses the focus and the text is not set
//then we set the helper text and the corresponding style
if( TextBoxWithSuggText.super.getText().trim().isEmpty() ){
TextBoxWithSuggText.this.setText( null );
}
}
});
}
示例13: onFocus
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event) {
if (this.mouseClickEvent) {
// event is always mouseclick, so when we manually switch columns we
// set mouseclick false to get past this and normal mouseclicks wont
// have effects on this
return;
}
final boolean shiftKey = event.getNativeEvent()
.getShiftKey();
final GridFocusHandler currentThis = this;
final boolean currentStartAtBeginning = this.startAtBeginning;
final boolean currentSkipFocus = this.skipFocus;
if (this.focusTimer == null) {
this.focusTimer = new Timer() {
@Override
public void run() {
if (!currentSkipFocus) {
if (currentStartAtBeginning) {
NavigationUtil
.focusFirstEditableElementFromFirstElementOfRow(GridFocusHandler.this.grid, 0,
currentThis,
GridFocusHandler.this.shiftKeyDown);
}
NavigationUtil.focusInputField(GridFocusHandler.this.grid, GridFocusHandler.this.shiftKeyDown);
GridFocusHandler.this.shiftKeyDown = false;
} else {
setSkipFocus(shiftKey);
}
}
};
}
this.focusTimer.schedule(50);
}
示例14: extend
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
protected void extend(ServerConnector target) {
Grid grid = ((GridConnector) target).getWidget();
GridFocusHandler gridFocusHandler = new GridFocusHandler(grid);
grid.addDomHandler(gridFocusHandler, FocusEvent.getType());
grid.addDomHandler(new GridClickHandler(grid, gridFocusHandler), ClickEvent.getType());
grid.addDomHandler(new NavigationHandler(grid, gridFocusHandler), KeyDownEvent.getType());
}
開發者ID:vaadin,項目名稱:grid-renderers-collection-addon,代碼行數:10,代碼來源:GridNavigationExtensionConnector.java
示例15: getFocusHandler
import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
FocusHandler getFocusHandler() {
return new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
cmB.focus();
}
};
}