You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PropertyId.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2000-2014 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.data.fieldgroup;
  17. import java.lang.annotation.ElementType;
  18. import java.lang.annotation.Retention;
  19. import java.lang.annotation.RetentionPolicy;
  20. import java.lang.annotation.Target;
  21. /**
  22. * Defines the custom property name to be bound to a {@link Field} using
  23. * {@link FieldGroup} or {@link BeanFieldGroup}.
  24. * <p>
  25. * The automatic data binding in FieldGroup and BeanFieldGroup relies on a
  26. * naming convention by default: properties of an item are bound to similarly
  27. * named field components in given a editor object. If you want to map a
  28. * property with a different name (ID) to a {@link com.vaadin.client.ui.Field},
  29. * you can use this annotation for the member fields, with the name (ID) of the
  30. * desired property as the parameter.
  31. * <p>
  32. * In following usage example, the text field would be bound to property "foo"
  33. * in the Entity class. <code>
  34. * <pre>
  35. * class Editor extends FormLayout {
  36. &#64;PropertyId("foo")
  37. TextField myField = new TextField();
  38. }
  39. class Entity {
  40. String foo;
  41. }
  42. {
  43. Editor e = new Editor();
  44. BeanFieldGroup.bindFieldsUnbuffered(new Entity(), e);
  45. }
  46. </pre>
  47. * </code>
  48. *
  49. * @since 7.0
  50. * @author Vaadin Ltd
  51. */
  52. @Target({ ElementType.FIELD })
  53. @Retention(RetentionPolicy.RUNTIME)
  54. public @interface PropertyId {
  55. String value();
  56. }