@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()); }
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); }
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); }
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); }
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)); } } }); } } }
public DateSelector() { initWidget( textBox ); textBox.addFocusHandler( new FocusHandler() { @Override public void onFocus( FocusEvent event ) { if( !enabled ) return; showPopup(); } } ); }
/** * 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 ); } } }); }
/** * 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); } } }
@Override FocusHandler getFocusHandler() { return new FocusHandler() { @Override public void onFocus(FocusEvent event) { cmB.focus(); } }; }
@Override FocusHandler getFocusHandler() { return new FocusHandler() { @Override public void onFocus(FocusEvent event) { cm.focus(); } }; }
public void enableDefaultSuggestions() { textBox.addFocusHandler( new FocusHandler() { @Override public void onFocus(FocusEvent focusEvent) { if (textBox.getText().equals("")) { suggestBox.showSuggestionList(); } } }); }
public PropertyEditorPasswordTextBox() { initWidget(uiBinder.createAndBindUi(this)); passwordTextBox.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { passwordTextBox.selectAll(); } }); }
public PropertyEditorTextBox() { initWidget(uiBinder.createAndBindUi(this)); textBox.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { textBox.selectAll(); } }); }
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); } }; }
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); } }; }
@Override public HandlerRegistration addFocusHandler(final FocusHandler handler) { if (!focusHandlerAdded) { focusHandlerAdded = true; this.codeMirror.on(this.editorOverlay, FOCUS, new EventHandlers.EventHandlerNoParameters() { @Override public void onEvent() { fireFocusEvent(); } }); } return addHandler(handler, FocusEvent.getType()); }
public void addField(final MetadataField metadataField, final String existingValue, String labelString) { if (flexTable == null) { flexTable = new FlexTable(); flexTable.setStylePrimaryName("metadataTable"); outerPanel.add(flexTable); } final int rowCount = flexTable.getRowCount(); final Label label = new Label(labelString); flexTable.setWidget(rowCount, 0, label); final TextBox textBox = new TextBox(); textBox.setStylePrimaryName("metadataOK"); textBox.setText((existingValue == null) ? "" : existingValue); textBox.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { addKeyboardPadding(); // scrollToPosition(label.getAbsoluteTop()); } }); // textBox.addBlurHandler(new BlurHandler() { // // @Override // public void onBlur(BlurEvent event) { // removeKeyboardPadding(); // } // }); flexTable.setWidget(rowCount + 1, 0, textBox); fieldBoxes.put(metadataField, textBox); if (firstTextBox == null) { firstTextBox = textBox; } }
@Override public void addEventListeners() { // we create these to map the event names to their events. see // DomEvent.Type for details. new Type<FocusHandler>("focusin", new FocusInEvent()); new Type<BlurHandler>("focusout", new FocusOutEvent()); addEventListeners_(); }
/** * {@inheritDoc} */ @Override public HasHTML addTextArea(final RichTextElementDTO richTextElement, final FoldPanel sectionPanel, final boolean draftMode) { if (draftMode) { final RichTextArea textArea = new RichTextArea(); textArea.setHTML(richTextElement.getText()); textArea.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { globalFormatterArray[0] = textArea.getFormatter(); } }); sectionPanel.add(textArea); return textArea; } else { final HTML html = new HTML(); final String value = richTextElement.getText(); if (ClientUtils.isBlank(value)) { html.setText(I18N.CONSTANTS.reportEmptySection()); html.addStyleName(STYLE_PROJECT_REPORT_FIELD_EMPTY); } else { html.setHTML(value); html.addStyleName(STYLE_PROJECT_REPORT_FIELD); } sectionPanel.add(html); return null; } }
@Override public HandlerRegistration addFocusHandler(FocusHandler handler) { return addHandler(handler, FocusEvent.getType()); }
@Override public HandlerRegistration addFocusHandler(FocusHandler handler) { return addDomHandler(handler, FocusEvent.getType()); }
@Override public HandlerRegistration addFocusHandler(FocusHandler handler) { return iText.addFocusHandler(handler); }
@Override public HandlerRegistration addFocusHandler(FocusHandler handler) { return iFilter.addFocusHandler(handler); }
@Override public HandlerRegistration addFocusHandler(FocusHandler handler) { return iFilter.getWidget().addFocusHandler(handler); }
public HandlerRegistration addFocusHandler(FocusHandler handler) { return addDomHandler(handler, FocusEvent.getType()); }
/** * @param isFieldHidden * @param index * @param field * @param alternateValuesSet * @param fieldTypeDescription * @param tempTextArea * @param isReadOnly * @param fieldNameString * @param sampleValueString * @return */ private int setTextAreaTypeFields(boolean isFieldHidden, int index, final DocField field, List<String> alternateValuesSet, String fieldTypeDescription, ValidatableWidget<TextArea> tempTextArea, boolean isReadOnly, final String fieldNameString, final String sampleValueString) { int indexLocal = index; if (!isFieldHidden) { final ValidatableWidget<TextArea> textAreaWidget = tempTextArea; for (int k = 0; k < alternateValuesSet.size(); k++) { textAreaWidget.getWidget().setTitle(field.getName()); } textAreaWidget.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> arg0) { if (presenter.batchDTO.getFieldValueChangeScriptSwitchState().equalsIgnoreCase("ON")) { currentFieldSet = false; presenter.setScriptExecuted(true); presenter.setFieldValueChangeName(field.getName()); setTimerToExecuteScript(); } } }); textAreaWidget.getWidget().addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { if (!currentFieldSet) { currentFieldSet = true; setFieldAlreadySelected(true); presenter.setCurrentFieldName(field.getName()); } presenter.setCurrentDocumentFieldName(field.getName()); setCurrentDocFieldWidget(field.getName()); ValidatePanel.this.fireEvent(new ValidationFieldChangeEvent(field)); ValidatePanel.this.fireEvent(new ValidationFieldChangeEvent(true, sampleValueString, fieldNameString, true)); if (presenter.isScriptExecuted()) { presenter.executeScriptOnFieldChange(presenter.getFieldValueChangeName()); } } }); Label fieldLabel = null; if (fieldTypeDescription != null && !fieldTypeDescription.isEmpty()) { fieldLabel = new Label(fieldTypeDescription); validationTable.setWidget(indexLocal++, 0, fieldLabel); } else { fieldLabel = new Label(field.getName()); validationTable.setWidget(indexLocal++, 0, fieldLabel); } validationTable.setWidget(indexLocal++, 0, textAreaWidget.getWidget()); addDocFieldWidget(presenter.document.getIdentifier(), fieldLabel, field, null, null, textAreaWidget, isReadOnly); } return indexLocal; }
@Override public HandlerRegistration addFocusHandler(final FocusHandler handler) { return this.addDomHandler(handler, FocusEvent.getType()); }
public static HandlerRegistration addFocusHandler(FocusHandler fh) { return BUS.addHandler(FocusEvent.getType(), fh); }