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

VCustomField.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2000-2016 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;
  17. import com.vaadin.client.Focusable;
  18. public class VCustomField extends VCustomComponent implements Focusable {
  19. private Focusable focusDelegate;
  20. @Override
  21. public void focus() {
  22. if (focusDelegate != null) {
  23. focusDelegate.focus();
  24. }
  25. }
  26. /**
  27. * Sets the focusable widget to focus instead of this custom field.
  28. *
  29. * @param focusDelegate
  30. * the widget to delegate focus to
  31. */
  32. public void setFocusDelegate(Focusable focusDelegate) {
  33. this.focusDelegate = focusDelegate;
  34. }
  35. /**
  36. * Sets the focusable widget to focus instead of this custom field.
  37. *
  38. * @param focusDelegate
  39. * the widget to delegate focus to
  40. */
  41. public void setFocusDelegate(
  42. final com.google.gwt.user.client.ui.Focusable focusDelegate) {
  43. this.focusDelegate = () -> focusDelegate.setFocus(true);
  44. }
  45. }