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

项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
private void testValidNumericValueConstraintMatch(final String scoreHolderClass,
                                                  final String constraintMatchValue) throws Exception {
    ConstraintMatchInputWidgetBlurHandler handler = new ConstraintMatchInputWidgetBlurHandler(widget,
                                                                                              translationService,
                                                                                              scoreHolderClass);

    when(widget.getConstraintMatchValue()).thenReturn(constraintMatchValue);
    when(translationService.getTranslation(GuidedRuleEditorConstants.ConstraintMatchInputWidgetBlurHandler_IntegerValueParsingError))
            .thenReturn("translation");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget,
           never()).showError("translation");
    verify(widget,
           times(1)).clearError();
}
项目:che    文件:OrionEditorWidget.java   
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
  if (!blurHandlerAdded) {
    blurHandlerAdded = true;
    final OrionTextViewOverlay textView = this.editorOverlay.getTextView();
    textView.addEventListener(
        OrionEventConstants.BLUR_EVENT,
        new OrionTextViewOverlay.EventHandlerNoParameter() {

          @Override
          public void onEvent() {
            fireBlurEvent();
          }
        });
  }
  return addHandler(handler, BlurEvent.getType());
}
项目:firefly    文件:TextBoxInputField.java   
private void addHandlers() {
    BlurHandler blurHandler =  new BlurHandler() {
        public void onBlur(BlurEvent ev) {
            checkForChange(true);
        }
    };
    _textBox.addKeyPressHandler(new KeyHandler());
    _textBox.addBlurHandler(blurHandler);
}
项目:fullmetalgalaxy    文件:WgtMessages.java   
@Override
public void onBlur(BlurEvent p_event)
{
  if( !m_isEditableMode && m_text.getText().isEmpty() )
  {
    return;
  }
  if( m_isEditableMode
      && m_text.getText().equalsIgnoreCase( GameEngine.model().getGame().getMessage() ) )
  {
    // message didn't change: don't send message event
    return;
  }
  if( GameEngine.model().getGame().isRecordingScript() )
  {
    // or we are recording user event
    GameEngine.model().getGame().setMessage( m_text.getText() );
    return;
  }
  EbEvtMessage message = new EbEvtMessage();
  message.setGame( GameEngine.model().getGame() );
  message.setMessage( m_text.getText().trim() );
  message.setAccountId( AppMain.instance().getMyAccount().getId() );
  GameEngine.model().runSingleAction( message );
}
项目:appformer    文件:SecretTextField.java   
private void addLostFocusHandler(final PropertyEditorFieldInfo property,
                                 final PropertyEditorPasswordTextBox passwordTextBox) {

    passwordTextBox.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            if (validate(property,
                         passwordTextBox.getText())) {
                passwordTextBox.clearOldValidationErrors();
                property.setCurrentStringValue(passwordTextBox.getText());
                propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,
                                                                                  passwordTextBox.getText()));
            } else {
                passwordTextBox.setValidationError(getValidatorErrorMessage(property,
                                                                            passwordTextBox.getText()));
                passwordTextBox.setText(property.getCurrentStringValue());
            }
        }
    });
}
项目:appformer    文件:TextField.java   
private void addLostFocusHandler(final PropertyEditorFieldInfo property,
                                 final PropertyEditorTextBox textBox) {

    textBox.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            if (validate(property,
                         textBox.getText())) {
                textBox.clearOldValidationErrors();
                property.setCurrentStringValue(textBox.getText());
                propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,
                                                                                  textBox.getText()));
            } else {
                textBox.setValidationError(getValidatorErrorMessage(property,
                                                                    textBox.getText()));
                textBox.setText(property.getCurrentStringValue());
            }
        }
    });
}
项目:appformer    文件:ListBoxSingletonDOMElementFactory.java   
@Override
public ListBoxDOMElement createDomElement(final GridLayer gridLayer,
                                          final GridWidget gridWidget,
                                          final GridBodyCellRenderContext context) {
    this.widget = createWidget();
    this.e = new ListBoxDOMElement(widget,
                                   gridLayer,
                                   gridWidget);
    widget.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(final BlurEvent event) {
            destroyResources();
            gridLayer.batch();
            gridPanel.setFocus(true);
        }
    });
    return e;
}
项目:appformer    文件:TextBoxSingletonDOMElementFactory.java   
@Override
public TextBoxDOMElement createDomElement(final GridLayer gridLayer,
                                          final GridWidget gridWidget,
                                          final GridBodyCellRenderContext context) {
    this.widget = createWidget();
    this.e = new TextBoxDOMElement(widget,
                                   gridLayer,
                                   gridWidget);
    widget.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(final BlurEvent event) {
            destroyResources();
            gridLayer.batch();
            gridPanel.setFocus(true);
        }
    });
    return e;
}
项目:appformer    文件:TextBoxDOMElementFactory.java   
@Override
public TextBoxDOMElement createDomElement(final GridLayer gridLayer,
                                          final GridWidget gridWidget,
                                          final GridBodyCellRenderContext context) {
    final TextBox widget = createWidget();
    final TextBoxDOMElement e = new TextBoxDOMElement(widget,
                                                      gridLayer,
                                                      gridWidget);
    widget.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(final BlurEvent event) {
            e.flush(widget.getValue());
            gridLayer.batch();
        }
    });
    return e;
}
项目:platypus-js    文件:EventsExecutor.java   
public void setFocusLost(JavaScriptObject aValue) {
    if (focusLost != aValue) {
        if (blurReg != null) {
            blurReg.removeHandler();
            blurReg = null;
        }
        focusLost = aValue;
        if (focusLost != null && component instanceof HasBlurHandlers) {
            blurReg = ((HasBlurHandlers) component).addBlurHandler(new BlurHandler() {
                @Override
                public void onBlur(BlurEvent event) {
                    if (focusLost != null) {
                        executeEvent(focusLost, EventsPublisher.publish(event));
                    }
                    mouseState = MOUSE.NULL;
                }
            });
        }
    }
}
项目:qafe-platform    文件:LabeledTextFieldWidget.java   
protected void handleTypeAttribute(UIObject uiObject, final String regExp, final String validationMessage, final String validationTitle) {
    if (uiObject instanceof TextBox) {
        TextBox textBox = (TextBox)uiObject;
        textBox.addBlurHandler(new BlurHandler(){
            public void onBlur(BlurEvent event) {
                String textValue = ((TextBoxBase)event.getSource()).getText();
                if ((textValue != null) && (regExp != null)) {                                          
                    if (textValue.replaceFirst(regExp, "").length() > 0) {                          
                        if (validationTitle != null) {
                            ClientApplicationContext.getInstance().log(validationTitle, validationMessage,true);
                        } else {
                            ClientApplicationContext.getInstance().log("Validation error", validationMessage,true);
                        }
                    }                       
                }                   
            }
        });
    }       
}
项目:gef-gwt    文件:Text.java   
public Text(Composite parent, int style) {
    this(new TextArea(), parent, style);
    textArea = (TextArea) getGwtWidget();
    panel = (LayoutPanel) getParent().getGwtWidget().getParent();
    panel.add(textArea);
    textArea.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setText(textArea.getText());
            textArea.removeFromParent();
            sendEvent(SWT.Modify);
            sendEvent(SWT.FocusOut);
        }
    });
}
项目: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;
    }
}
项目:putnami-web-toolkit    文件:InputList.java   
@Override
public void onBlur(BlurEvent event) {
    this.focused = false;
    if (this.input != null) {
        T val = this.input.flush();
        StyleUtils.toggleStyle(this.container, InputList.STYLE_ERROR, this.hasErrors());
        if (val == null && !this.hasErrors()) {
            InputList.this.removeEditor(this);
        } else {
            this.itemValue = val;
            this.output.edit(val);
        }
    }
    this.resetFocusHandler();
    this.redraw();
}
项目:droopy    文件:ValidatedTextBox.java   
public void onBlur(final BlurEvent event) {
  final String interval = getText();
  if (!interval.matches(regexp)) {
    // Steal the dateBoxFormatError :)
    addStyleName("dateBoxFormatError");
    event.stopPropagation();
    DeferredCommand.addCommand(new Command() {
      public void execute() {
        // TODO(tsuna): Understand why this doesn't work as expected, even
        // though we cancel the onBlur event and we put the focus afterwards
        // using a deferred command.
        //setFocus(true);
        selectAll();
      }
    });
  } else {
    removeStyleName("dateBoxFormatError");
  }
}
项目:kie-wb-common    文件:VariableListItemWidgetViewImplTest.java   
@Test
public void testNameBlurHandler() {
    VariablesEditorWidgetView.Presenter parent = mock(VariablesEditorWidgetView.Presenter.class);
    when(parent.isDuplicateName(anyString())).thenReturn(true);
    doReturn("anyName").when(name).getText();
    view.setParentWidget(parent);
    view.init();
    verify(name,
           times(1)).addBlurHandler(blurHandlerCaptor.capture());
    BlurHandler handler = blurHandlerCaptor.getValue();
    handler.onBlur(mock(BlurEvent.class));
    verify(parent,
           times(1)).isDuplicateName("anyName");
    verify(notification,
           times(1)).fire(new NotificationEvent(null,
                                                NotificationEvent.NotificationType.ERROR));
    verify(name,
           times(1)).setValue("");
}
项目:kie-wb-common    文件:AssignmentListItemWidgetViewImplTest.java   
@Test
public void testNameBlurHandler() {
    ActivityDataIOEditorWidget parent = mock(ActivityDataIOEditorWidget.class);
    when(parent.isDuplicateName(anyString())).thenReturn(true);
    doReturn("anyName").when(name).getText();
    view.setAllowDuplicateNames(false,
                                "ErrorMessage");
    view.setParentWidget(parent);
    view.init();
    verify(name,
           times(1)).addBlurHandler(blurHandlerCaptor.capture());
    BlurHandler handler = blurHandlerCaptor.getValue();
    handler.onBlur(mock(BlurEvent.class));
    verify(parent,
           times(1)).isDuplicateName("anyName");
    verify(notification,
           times(1)).fire(new NotificationEvent("ErrorMessage",
                                                NotificationEvent.NotificationType.ERROR));
    verify(name,
           times(1)).setValue("");
}
项目:empiria.player    文件:TextBoxChangeHandlerJUnitTest.java   
@Test
public void shouldHandleDropAsOnBlur() {
    // given
    DropEvent event = mock(DropEvent.class);

    // when
    testObj.bind(droppableObject, presenterHandler);
    testObj.onDrop(event);

    // then
    verify(presenterHandler).onBlur(Matchers.any(BlurEvent.class));
}
项目:empiria.player    文件:TextBoxChangeHandlerJUnitTest.java   
@Test
public void shouldHandleOnBlurWithPresenter() {
    // given
    BlurEvent blurEvent = mock(BlurEvent.class);

    // when
    testObj.bind(droppableObject, presenterHandler);
    testObj.onBlur(blurEvent);

    // then
    verify(presenterHandler).onBlur(Matchers.eq(blurEvent));
    verifyNoMoreInteractions(presenterHandler);
}
项目: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);
}
项目:cuba    文件:SuggestionsContainer.java   
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);
}
项目:cuba    文件:CubaComboBoxWidget.java   
@Override
public void onBlur(BlurEvent event) {
    super.onBlur(event);

    if (!readonly && !"".equals(inputPrompt)
            && ("".equals(selectedOptionKey) || null == selectedOptionKey)) {
        setPromptingOn();
    }
}
项目: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 );
            }
        }
    });
}
项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
@Test
public void nullConstraintMatch() throws Exception {
    when(widget.getConstraintMatchValue()).thenReturn(null);
    when(translationService.getTranslation(GuidedRuleEditorConstants.ConstraintMatchInputWidgetBlurHandler_EmptyValuesAreNotAllowedForModifyScore))
            .thenReturn("translation");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget).showError("translation");
    verify(widget,
           never()).clearError();
}
项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
@Test
public void emptyConstraintMatch() throws Exception {
    when(widget.getConstraintMatchValue()).thenReturn("");
    when(translationService.getTranslation(GuidedRuleEditorConstants.ConstraintMatchInputWidgetBlurHandler_EmptyValuesAreNotAllowedForModifyScore))
            .thenReturn("translation");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget).showError("translation");
    verify(widget,
           never()).clearError();
}
项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
@Test
public void whiteSpaceConstraintMatch() throws Exception {
    when(widget.getConstraintMatchValue()).thenReturn(" ");
    when(translationService.getTranslation(GuidedRuleEditorConstants.ConstraintMatchInputWidgetBlurHandler_EmptyValuesAreNotAllowedForModifyScore))
            .thenReturn("translation");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget).showError("translation");
    verify(widget,
           never()).clearError();
}
项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
@Test
public void numberConstraintMatch() throws Exception {
    when(widget.getConstraintMatchValue()).thenReturn("123");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget,
           never()).showError(anyString());
    verify(widget).clearError();
}
项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
private void testInvalidValueConstraintMatch(final String scoreHolderClass) {
    ConstraintMatchInputWidgetBlurHandler handler = new ConstraintMatchInputWidgetBlurHandler(widget,
                                                                                              translationService,
                                                                                              scoreHolderClass);
    when(widget.getConstraintMatchValue()).thenReturn("123zzz");
    when(translationService.getTranslation(anyString()))
            .thenReturn("translation");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget,
           times(1)).showError("translation");
    verify(widget,
           never()).clearError();
}
项目:optaplanner-wb    文件:ConstraintMatchInputWidgetBlurHandlerTest.java   
private void testValidExpressionConstraintMatch(final String scoreHolderClass) throws Exception {
    ConstraintMatchInputWidgetBlurHandler handler = new ConstraintMatchInputWidgetBlurHandler(widget,
                                                                                              translationService,
                                                                                              scoreHolderClass);
    when(widget.getConstraintMatchValue()).thenReturn("$person.getAge()");

    handler.onBlur(mock(BlurEvent.class));

    verify(widget,
           never()).showError(anyString());
    verify(widget).clearError();
}
项目:firefly    文件:TextAreaInputField.java   
private void addHandlers() {
    BlurHandler blurHandler =  new BlurHandler() {
        public void onBlur(BlurEvent ev) {
            checkForChange();
        }
    };
    _textArea.addKeyPressHandler(new KeyHandler());
    _textArea.addBlurHandler(blurHandler);
}
项目: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);
}
项目:qafe-platform    文件:EventFactory.java   
public static BlurHandler createOnExitListener(final EventListenerGVO ev, final List<InputVariableGVO> input) {
    return new BlurHandler() {
        public void onBlur(BlurEvent event) {
            CallbackHandler.createCallBack(event.getSource(), QAMLConstants.EVENT_ONEXIT, ev, input);
        }
    };
}
项目:qafe-platform    文件:ActivityHelper.java   
private static BlurHandler createBlurHandler(final ComponentGVO componentGVO, final EventListenerGVO eventGVO, final NotifyHandler notifyHandler, final String windowId, final String context, final AbstractActivity activity) {
    return new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            UIObject widget = (UIObject)event.getSource();
            List<InputVariableGVO> inputVariables = eventGVO.getInputvariablesList();
            handleEvent(componentGVO, widget, eventGVO, event, QAMLConstants.EVENT_ONEXIT, inputVariables, notifyHandler, windowId, context, activity);
        }
    };
}
项目:plugin-editor-codemirror    文件:CodeMirrorEditorWidget.java   
@Override
public HandlerRegistration addBlurHandler(final BlurHandler handler) {
    if (!blurHandlerAdded) {
        blurHandlerAdded = true;
        this.codeMirror.on(this.editorOverlay, BLUR, new EventHandlers.EventHandlerNoParameters() {

            @Override
            public void onEvent() {
                fireBlurEvent();
            }
        });
    }
    return addHandler(handler, BlurEvent.getType());
}
项目:suggestfield    文件:SuggestionMenuBar.java   
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());
}
项目:avro-ui    文件:NumberBox.java   
@Override
public void onBlur(BlurEvent event) {
    if (Utils.isNotBlank(promptText) && Utils.isBlank(super.getText())) {
        setPrompts();
    } else {
        setText(renderer.render(getValue()));
    }
}
项目:putnami-web-toolkit    文件:InputDatePicker.java   
public void popup(Widget container, Widget relativeTo) {
    this.setVisible(true);
    StyleUtils.addStyle(this, InputDatePicker.STYLE_POPUP);
    RootPanel.get().add(this);

    Element positioningElement = this.getElement();
    Element relativeElement = relativeTo.getElement();

    int targetHeight = relativeElement.getOffsetHeight();
    int targetTop = relativeElement.getAbsoluteTop();

    int positioningWidth = positioningElement.getOffsetWidth();
    int targetRight = relativeElement.getAbsoluteRight();

    Style elementStyle = positioningElement.getStyle();
    elementStyle.setPosition(Position.ABSOLUTE);
    elementStyle.setLeft(targetRight - positioningWidth, Unit.PX);
    elementStyle.setTop(targetTop + targetHeight, Unit.PX);

    StyleUtils.addStyle(this, InputDatePicker.STYLE_FADE);
    StyleUtils.addStyle(this, InputDatePicker.STYLE_SHOW);

    this.setFocus(true);

    if (this.popupBlurHandler == null) {
        this.popupBlurHandler = this.addBlurHandler(new BlurHandler() {

            @Override
            public void onBlur(BlurEvent event) {
                InputDatePicker.this.hide();
            }
        });
    }
}
项目:ineform    文件:DateTimeTextBox.java   
@Override
public void onBlur(BlurEvent event) {
    if (wrappedtb.getValue().length() != 0 || precision == Precision.OOO_HM
        || precision == Precision.OOO_HMS) {
        String cval = complete(wrappedtb.getValue());
        wrappedtb.setValue(cval);
        prevValue = cval;
    }

    fireEvent(new DateTimeTextBoxEvent());
}