本文整理匯總了Java中com.google.gwt.event.dom.client.FocusHandler類的典型用法代碼示例。如果您正苦於以下問題:Java FocusHandler類的具體用法?Java FocusHandler怎麽用?Java FocusHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FocusHandler類屬於com.google.gwt.event.dom.client包,在下文中一共展示了FocusHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addFocusHandler
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的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());
}
示例2: View
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的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);
}
示例3: listenTo
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的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);
}
示例4: EnumEditorViewImpl
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的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);
}
示例5: setFocusGained
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的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));
}
}
});
}
}
}
示例6: DateSelector
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
public DateSelector()
{
initWidget( textBox );
textBox.addFocusHandler( new FocusHandler()
{
@Override
public void onFocus( FocusEvent event )
{
if( !enabled )
return;
showPopup();
}
} );
}
示例7: initialize
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的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 );
}
}
});
}
示例8: addFocusHandler
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
/**
* Sets the focus() event handler in many widgets
* @param handler the handler
* @param widgets the widgets
*/
public static void addFocusHandler(final FocusHandler handler,final HasFocusHandlers... widgets) {
if (handler != null && widgets != null && widgets.length > 0) {
for (HasFocusHandlers w : widgets) {
if (w != null) w.addFocusHandler(handler);
}
}
}
示例9: getFocusHandler
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
@Override
FocusHandler getFocusHandler() {
return new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
cmB.focus();
}
};
}
示例10: getFocusHandler
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
@Override
FocusHandler getFocusHandler() {
return new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
cm.focus();
}
};
}
示例11: enableDefaultSuggestions
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
public void enableDefaultSuggestions() {
textBox.addFocusHandler(
new FocusHandler() {
@Override
public void onFocus(FocusEvent focusEvent) {
if (textBox.getText().equals("")) {
suggestBox.showSuggestionList();
}
}
});
}
示例12: PropertyEditorPasswordTextBox
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
public PropertyEditorPasswordTextBox() {
initWidget(uiBinder.createAndBindUi(this));
passwordTextBox.addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
passwordTextBox.selectAll();
}
});
}
示例13: PropertyEditorTextBox
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
public PropertyEditorTextBox() {
initWidget(uiBinder.createAndBindUi(this));
textBox.addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
textBox.selectAll();
}
});
}
示例14: createFocusListener
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
public static FocusHandler createFocusListener(final EventListenerGVO ev, final List<InputVariableGVO> input) {
return new FocusHandler() {
public void onFocus(FocusEvent event) {
CallbackHandler.createCallBack(event.getSource(), QAMLConstants.EVENT_ONFOCUS, ev, input);
}
};
}
示例15: createFocusHandler
import com.google.gwt.event.dom.client.FocusHandler; //導入依賴的package包/類
private static FocusHandler createFocusHandler(final ComponentGVO componentGVO, final EventListenerGVO eventGVO, final NotifyHandler notifyHandler, final String windowId, final String context, final AbstractActivity activity) {
return new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
UIObject widget = (UIObject)event.getSource();
List<InputVariableGVO> inputVariables = eventGVO.getInputvariablesList();
handleEvent(componentGVO, widget, eventGVO, event, QAMLConstants.EVENT_ONFOCUS, inputVariables, notifyHandler, windowId, context, activity);
}
};
}