java类com.google.gwt.event.dom.client.BlurHandler的实例源码

OrionEditorWidget.java 文件源码 项目:che 阅读 27 收藏 0 点赞 0 评论 0
@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());
}
TextBoxInputField.java 文件源码 项目:firefly 阅读 22 收藏 0 点赞 0 评论 0
private void addHandlers() {
    BlurHandler blurHandler =  new BlurHandler() {
        public void onBlur(BlurEvent ev) {
            checkForChange(true);
        }
    };
    _textBox.addKeyPressHandler(new KeyHandler());
    _textBox.addBlurHandler(blurHandler);
}
SecretTextField.java 文件源码 项目:appformer 阅读 21 收藏 0 点赞 0 评论 0
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());
            }
        }
    });
}
TextField.java 文件源码 项目:appformer 阅读 22 收藏 0 点赞 0 评论 0
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());
            }
        }
    });
}
ListBoxSingletonDOMElementFactory.java 文件源码 项目:appformer 阅读 25 收藏 0 点赞 0 评论 0
@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;
}
TextBoxSingletonDOMElementFactory.java 文件源码 项目:appformer 阅读 25 收藏 0 点赞 0 评论 0
@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;
}
TextBoxDOMElementFactory.java 文件源码 项目:appformer 阅读 26 收藏 0 点赞 0 评论 0
@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;
}
EventsExecutor.java 文件源码 项目:platypus-js 阅读 24 收藏 0 点赞 0 评论 0
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;
                }
            });
        }
    }
}
LabeledTextFieldWidget.java 文件源码 项目:qafe-platform 阅读 29 收藏 0 点赞 0 评论 0
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);
                        }
                    }                       
                }                   
            }
        });
    }       
}
Text.java 文件源码 项目:gef-gwt 阅读 25 收藏 0 点赞 0 评论 0
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);
        }
    });
}
CVRichTextArea.java 文件源码 项目:vaadin-crichtextarea 阅读 25 收藏 0 点赞 0 评论 0
private void createRTAComponents() {
   rta = new CRichTextArea();
   rta.setWidth("100%");
   rta.addKeyDownHandler(this);
   formatter = new VRichTextToolbar(rta);

   // Add blur handlers
   for (Entry<BlurHandler, HandlerRegistration> handler : blurHandlers
           .entrySet()) {

      // Remove old registration
      handler.getValue().removeHandler();

      // Add blur handlers
      addBlurHandler(handler.getKey());
   }
}
VariableListItemWidgetViewImplTest.java 文件源码 项目:kie-wb-common 阅读 24 收藏 0 点赞 0 评论 0
@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("");
}
AssignmentListItemWidgetViewImplTest.java 文件源码 项目:kie-wb-common 阅读 24 收藏 0 点赞 0 评论 0
@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("");
}
TimeSelector.java 文件源码 项目:unitimes 阅读 19 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
    return iText.addBlurHandler(handler);
}
TextBoxWithSuggText.java 文件源码 项目:x-cure-chat 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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 );
            }
        }
    });
}
ConstraintMatchInputWidget.java 文件源码 项目:optaplanner-wb 阅读 26 收藏 0 点赞 0 评论 0
public HandlerRegistration addConstraintMatchBlurHandler(final BlurHandler blurHandler) {
    HandlerRegistration registration = constraintMatchTextBox.addBlurHandler(blurHandler);
    DomEvent.fireNativeEvent(Document.get().createBlurEvent(),
                             constraintMatchTextBox);

    return registration;
}
TextAreaInputField.java 文件源码 项目:firefly 阅读 23 收藏 0 点赞 0 评论 0
private void addHandlers() {
    BlurHandler blurHandler =  new BlurHandler() {
        public void onBlur(BlurEvent ev) {
            checkForChange();
        }
    };
    _textArea.addKeyPressHandler(new KeyHandler());
    _textArea.addBlurHandler(blurHandler);
}
EventFactory.java 文件源码 项目:qafe-platform 阅读 25 收藏 0 点赞 0 评论 0
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);
        }
    };
}
ActivityHelper.java 文件源码 项目:qafe-platform 阅读 24 收藏 0 点赞 0 评论 0
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);
        }
    };
}
CodeMirrorEditorWidget.java 文件源码 项目:plugin-editor-codemirror 阅读 20 收藏 0 点赞 0 评论 0
@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());
}
CVRichTextArea.java 文件源码 项目:vaadin-crichtextarea 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Removes a blur handler.
 *
 * @param blurHandler the handler to remove
 */
public void removeBlurHandler(BlurHandler blurHandler) {
   HandlerRegistration registration = blurHandlers.remove(blurHandler);
   if (registration != null) {
      registration.removeHandler();
   }
}
SuggestionMenuBar.java 文件源码 项目:suggestfield 阅读 22 收藏 0 点赞 0 评论 0
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());
}
ViewportImplIE.java 文件源码 项目:gwt-traction 阅读 27 收藏 0 点赞 0 评论 0
@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_();
   }
InputDatePicker.java 文件源码 项目:putnami-web-toolkit 阅读 26 收藏 0 点赞 0 评论 0
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();
            }
        });
    }
}
DefaultValidatorMixin.java 文件源码 项目:gwtbootstrap3 阅读 21 收藏 0 点赞 0 评论 0
protected HandlerRegistration setupBlurValidation() {
    return inputWidget.addDomHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            validate(validateOnBlur);
        }
    }, BlurEvent.getType());
}
ListBoxSingletonDOMElementFactoryTest.java 文件源码 项目:drools-wb 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void checkDOMElementCreationChecksListBoxIsMultipleSelect() {
    factory.createDomElement(gridLayer,
                             gridWidget,
                             cellRenderContext);

    verify(listBox).addMouseDownHandler(any(MouseDownHandler.class));
    verify(listBox).addKeyDownHandler(any(KeyDownHandler.class));
    verify(listBox).addBlurHandler(any(BlurHandler.class));
    verify(listBox).isMultipleSelect();
}
ListBoxSingletonDOMElementFactoryTest.java 文件源码 项目:drools-wb 阅读 32 收藏 0 点赞 0 评论 0
@Test
@SuppressWarnings("unchecked")
public void checkDOMElementCreationBlurHandler() {
    final InOrder order = inOrder(factory);

    final GridBodyCellRenderContext context = mock(GridBodyCellRenderContext.class);
    final Callback<ListBoxDOMElement<String, ListBox>> onCreation = mock(Callback.class);
    final Callback<ListBoxDOMElement<String, ListBox>> onDisplay = mock(Callback.class);
    when(context.getTransform()).thenReturn(mock(Transform.class));

    factory.attachDomElement(context,
                             onCreation,
                             onDisplay);

    final ArgumentCaptor<BlurHandler> blurHandlerCaptor = ArgumentCaptor.forClass(BlurHandler.class);

    verify(listBox).addBlurHandler(blurHandlerCaptor.capture());

    final BlurEvent e = mock(BlurEvent.class);
    final BlurHandler blurHandler = blurHandlerCaptor.getValue();
    blurHandler.onBlur(e);

    order.verify(factory).flush();
    order.verify(factory).destroyResources();
    verify(gridLayer).batch();
    verify(gridLienzoPanel).setFocus(eq(true));
}
VariableNameTextBoxTest.java 文件源码 项目:kie-wb-common 阅读 27 收藏 0 点赞 0 评论 0
@Before
public void init() {
    GwtMockito.initMocks(this);
    textBox = GWT.create(VariableNameTextBox.class);
    doCallRealMethod().when(textBox).setRegExp(anyString(),
                                               anyString(),
                                               anyString());
    doCallRealMethod().when(textBox).setInvalidValues(anySet(),
                                                      anyBoolean(),
                                                      anyString());
    doCallRealMethod().when(textBox).isValidValue(anyString(),
                                                  anyBoolean());
    doCallRealMethod().when(textBox).setText(anyString());
    doCallRealMethod().when(textBox).testForInvalidValue(anyString());
    doCallRealMethod().when(textBox).makeValidValue(anyString());
    doCallRealMethod().when(textBox).getInvalidCharsInName(anyString());
    doCallRealMethod().when(textBox).isValidChar(anyChar());
    doCallRealMethod().when(textBox).setup();
    doCallRealMethod().when(textBox).addBlurHandler(any(BlurHandler.class));
    doCallRealMethod().when(textBox).addKeyPressHandler(any(KeyPressHandler.class));
    textBox.setRegExp(ALPHA_NUM_REGEXP,
                      ERROR_REMOVED,
                      ERROR_TYPED);
    INVALID_VALUES.clear();
    INVALID_VALUES.add("abc");
    INVALID_VALUES.add("CdE");
    INVALID_VALUES.add("a#$%1");
    textBox.setInvalidValues(INVALID_VALUES,
                             caseSensitive,
                             ERROR_MESSAGE);
}
AriaSuggestBox.java 文件源码 项目:unitimes 阅读 23 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
    return addHandler(handler, BlurEvent.getType());
}
ImageButton.java 文件源码 项目:unitimes 阅读 23 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
    return addDomHandler(handler, BlurEvent.getType());
}


问题


面经


文章

微信
公众号

扫码关注公众号