Java 类com.google.gwt.event.dom.client.FocusEvent 实例源码

项目:vaadin-combobox-multiselect    文件:VComboBoxMultiselect.java   
@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()));
}
项目:vaadin-combobox-multiselect    文件:VComboBoxMultiselect.java   
@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()));
}
项目:che    文件:OrionEditorWidget.java   
@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());
}
项目:che    文件:View.java   
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);
}
项目:gerrit    文件:OnEditEnabler.java   
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);
}
项目:google-apis-explorer    文件:EnumEditor.java   
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);
}
项目:platypus-js    文件:EventsExecutor.java   
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));
                    }
                }
            });
        }
    }
}
项目:hexa.tools    文件:DateSelector.java   
public DateSelector()
{
    initWidget( textBox );

    textBox.addFocusHandler( new FocusHandler()
    {
        @Override
        public void onFocus( FocusEvent event )
        {
            if( !enabled )
                return;

            showPopup();
        }
    } );
}
项目:putnami-web-toolkit    文件:AbstractHover.java   
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;
    }
}
项目:swarm    文件:ToolTipSubManager_Focus.java   
@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;
}
项目:unitimes    文件:AriaSuggestBox.java   
@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);
}
项目:unitimes    文件:TimeSelector.java   
@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);
}
项目:WebConsole    文件:FormField.java   
@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());
    }
}
项目:x-cure-chat    文件:TextBoxWithSuggText.java   
/**
 * 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 );
            }
        }
    });
}
项目:grid-renderers-collection-addon    文件:GridFocusHandler.java   
@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);
}
项目:grid-renderers-collection-addon    文件:GridNavigationExtensionConnector.java   
@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());
}
项目:gerrit    文件:SideBySide.java   
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cmB.focus();
    }
  };
}
项目:gerrit    文件:Unified.java   
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cm.focus();
    }
  };
}
项目:gerrit    文件:RemoteSuggestBox.java   
public void enableDefaultSuggestions() {
  textBox.addFocusHandler(
      new FocusHandler() {
        @Override
        public void onFocus(FocusEvent focusEvent) {
          if (textBox.getText().equals("")) {
            suggestBox.showSuggestionList();
          }
        }
      });
}
项目:unitime    文件:AriaSuggestBox.java   
@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);
}
项目:unitime    文件:TimeSelector.java   
@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);
}
项目:appformer    文件:PropertyEditorPasswordTextBox.java   
public PropertyEditorPasswordTextBox() {
    initWidget(uiBinder.createAndBindUi(this));
    passwordTextBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            passwordTextBox.selectAll();
        }
    });
}
项目:appformer    文件:PropertyEditorTextBox.java   
public PropertyEditorTextBox() {
    initWidget(uiBinder.createAndBindUi(this));
    textBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            textBox.selectAll();
        }
    });
}
项目:qafe-platform    文件:EventFactory.java   
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);
        }
    };
}
项目:qafe-platform    文件:ActivityHelper.java   
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);
        }
    };
}
项目:plugin-editor-codemirror    文件:CodeMirrorEditorWidget.java   
@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());
}
项目:GraphemeColourSynaesthesiaApp    文件:MetadataView.java   
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;
        }
    }
项目:sigmah    文件:ReportsView.java   
/**
 * {@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;
    }
}
项目:putnami-web-toolkit    文件:InputList.java   
@Override
public void onFocus(FocusEvent event) {
    if (this.input == null) {
        this.input = InputList.this.editorProvider.getEditorForTraversal(false, InputList.this.items.indexOf(this));
    }
    if (!this.hasErrors()) {
        this.input.edit(this.itemValue);
    }
    this.focused = true;
    this.resetFocusHandler();
    this.redraw();
}
项目:socom    文件:InfluenceAnswerFreeTextView.java   
@UiHandler("answerTextBox")
public void onFocusTextBox(FocusEvent event)
{
    if (this.answerTextBox.getValue().equals(defaultTextBoxValue))
    {
        this.answerTextBox.setValue("");
    }
}
项目:LanguageMemoryApp    文件:MetadataView.java   
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;
        }
    }
项目:swarm    文件:ToolTipSubManager_Focus.java   
@Override
public void addTip(IsWidget widget, ToolTipConfig config)
{
    m_tipMap.put(widget.asWidget().getElement(), config);

    widget.asWidget().addDomHandler(this, FocusEvent.getType());
    widget.asWidget().addDomHandler(this, BlurEvent.getType());
}
项目:touchkit    文件:VSwitch.java   
private void addHandlers() {
    addDomHandler(this, KeyUpEvent.getType());
    if (TouchEvent.isSupported()) {
        addDomHandler(this, TouchStartEvent.getType());
        addDomHandler(this, TouchMoveEvent.getType());
        addDomHandler(this, TouchEndEvent.getType());
        addDomHandler(this, TouchCancelEvent.getType());
    } else {
        addDomHandler(this, MouseDownEvent.getType());
        addDomHandler(this, MouseUpEvent.getType());
        addDomHandler(this, MouseMoveEvent.getType());
    }
    addDomHandler(this, FocusEvent.getType());
    addDomHandler(this, BlurEvent.getType());
}
项目:unitimes    文件:AriaSuggestBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
项目:unitimes    文件:ImageButton.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addDomHandler(handler, FocusEvent.getType());
}
项目:unitimes    文件:TimeSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
项目:appinventor-extensions    文件:HandlerPanel.java   
public HandlerRegistration addFocusHandler(FocusHandler handler) {
  return addDomHandler(handler, FocusEvent.getType());
}
项目:cuba    文件:CubaCheckBoxWidget.java   
@Override
public void onFocus(FocusEvent arg) {
    addStyleDependentName("focus");
}
项目:cuba    文件:CubaTreeWidget.java   
@Override
public void onFocus(FocusEvent event) {
    super.onFocus(event);

    addStyleDependentName("focus");
}
项目:ephesoft    文件:ValidatePanel.java   
/**
 * @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;
}