您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TextFieldConnector.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.client.ui.textfield;
  17. import com.vaadin.client.event.InputEvent;
  18. import com.vaadin.client.ui.VTextField;
  19. import com.vaadin.shared.ui.Connect;
  20. import com.vaadin.shared.ui.Connect.LoadStyle;
  21. import com.vaadin.shared.ui.textfield.TextFieldState;
  22. import com.vaadin.ui.TextField;
  23. /**
  24. * Connector class for TextField.
  25. */
  26. @Connect(value = TextField.class, loadStyle = LoadStyle.EAGER)
  27. public class TextFieldConnector extends AbstractTextFieldConnector {
  28. @Override
  29. protected void init() {
  30. super.init();
  31. getWidget().addChangeHandler(event -> sendValueChange());
  32. getWidget().addDomHandler(
  33. event -> getValueChangeHandler().scheduleValueChange(),
  34. InputEvent.getType());
  35. }
  36. @Override
  37. public TextFieldState getState() {
  38. return (TextFieldState) super.getState();
  39. }
  40. @Override
  41. public VTextField getWidget() {
  42. return (VTextField) super.getWidget();
  43. }
  44. }