* fields, with the name (ID) of the desired property as the parameter. | * fields, with the name (ID) of the desired property as the parameter. | ||||
* <p> | * <p> | ||||
* In following usage example, the text field would be bound to property "foo" | * In following usage example, the text field would be bound to property "foo" | ||||
* in the Entity class. <code> | |||||
* in the Entity class. | |||||
* <pre> | * <pre> | ||||
* class Editor extends FormLayout { | |||||
class Editor extends FormLayout { | |||||
@PropertyId("foo") | @PropertyId("foo") | ||||
TextField myField = new TextField(); | TextField myField = new TextField(); | ||||
} | } | ||||
binder.bindInstanceFields(editor); | binder.bindInstanceFields(editor); | ||||
} | } | ||||
</pre> | </pre> | ||||
* </code> | |||||
* | * | ||||
* @since 8.0 | * @since 8.0 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd |
* | * | ||||
* <pre> | * <pre> | ||||
* <code> | * <code> | ||||
* HasDataProvider<String> listing = new CheckBoxGroup<>(); | |||||
* HasDataProvider<String> listing = new CheckBoxGroup<>(); | |||||
* listing.setItems(Arrays.asList("a","b")); | * listing.setItems(Arrays.asList("a","b")); | ||||
* ... | * ... | ||||
* | * | ||||
* | * | ||||
* <pre> | * <pre> | ||||
* <code> | * <code> | ||||
* HasDataProvider<String> listing = new CheckBoxGroup<>(); | |||||
* HasDataProvider<String> listing = new CheckBoxGroup<>(); | |||||
* listing.setItems(Stream.of("a","b")); | * listing.setItems(Stream.of("a","b")); | ||||
* ... | * ... | ||||
* | * | ||||
* Collection<String> collection = ((ListDataProvider<String>)listing.getDataProvider()).getItems(); | |||||
* Collection<String> collection = ((ListDataProvider<String>)listing.getDataProvider()).getItems(); | |||||
* </code> | * </code> | ||||
* </pre> | * </pre> | ||||
* <p> | * <p> |
* If all the added items were already selected and the removed items | * If all the added items were already selected and the removed items | ||||
* were not selected, this is a NO-OP. | * were not selected, this is a NO-OP. | ||||
* <p> | * <p> | ||||
* Duplicate items (in both add & remove sets) are ignored. | |||||
* Duplicate items (in both add & remove sets) are ignored. | |||||
* | * | ||||
* @param addedItems | * @param addedItems | ||||
* the items to add, not {@code null} | * the items to add, not {@code null} |
* For instance, the following validator checks if a number is positive: | * For instance, the following validator checks if a number is positive: | ||||
* | * | ||||
* <pre> | * <pre> | ||||
* Validator<Integer> v = num -> { | |||||
* if (num >= 0) | |||||
* Validator<Integer> v = num -> { | |||||
* if (num >= 0) | |||||
* return ValidationResult.ok(); | * return ValidationResult.ok(); | ||||
* else | * else | ||||
* return ValidationResult.error("number must be positive"); | * return ValidationResult.error("number must be positive"); | ||||
* 10, inclusive: | * 10, inclusive: | ||||
* | * | ||||
* <pre> | * <pre> | ||||
* Validator<Integer> v = Validator.from(num -> num >= 0 && num <= 10, | |||||
* Validator<Integer> v = Validator.from(num -> num >= 0 && num <= 10, | |||||
* "number must be between 0 and 10"); | * "number must be between 0 and 10"); | ||||
* </pre> | * </pre> | ||||
* | * |
* Insert one or more modifier characters before the character to use as | * Insert one or more modifier characters before the character to use as | ||||
* keycode. E.g <code>"&Save"</code> will make a shortcut responding to | * keycode. E.g <code>"&Save"</code> will make a shortcut responding to | ||||
* ALT-S, <code>"E^xit"</code> will respond to CTRL-X.<br/> | * ALT-S, <code>"E^xit"</code> will respond to CTRL-X.<br/> | ||||
* Multiple modifiers can be used, e.g <code>"&^Delete"</code> will respond | |||||
* Multiple modifiers can be used, e.g <code>"&^Delete"</code> will respond | |||||
* to CTRL-ALT-D (the order of the modifier characters is not important). | * to CTRL-ALT-D (the order of the modifier characters is not important). | ||||
* </p> | * </p> | ||||
* <p> | * <p> | ||||
* The modifier characters will be removed from the caption. The modifier | * The modifier characters will be removed from the caption. The modifier | ||||
* character is be escaped by itself: two consecutive characters are turned | * character is be escaped by itself: two consecutive characters are turned | ||||
* into the original character w/o the special meaning. E.g | * into the original character w/o the special meaning. E.g | ||||
* <code>"Save&&&close"</code> will respond to ALT-C, and the caption will | |||||
* say "Save&close". | |||||
* <code>"Save&&&close"</code> will respond to ALT-C, and the caption will | |||||
* say "Save&close". | |||||
* </p> | * </p> | ||||
* | * | ||||
* @param shorthandCaption | * @param shorthandCaption | ||||
* caption. I.e use any of the modifier characters in the caption to | * caption. I.e use any of the modifier characters in the caption to | ||||
* indicate the keycode, but the modifier will be the given set.<br/> | * indicate the keycode, but the modifier will be the given set.<br/> | ||||
* E.g | * E.g | ||||
* <code>new ShortcutAction("Do &stuff", new int[]{ShortcutAction.ModifierKey.CTRL}));</code> | |||||
* <code>new ShortcutAction("Do &stuff", new int[]{ShortcutAction.ModifierKey.CTRL}));</code> | |||||
* will respond to CTRL-S. | * will respond to CTRL-S. | ||||
* </p> | * </p> | ||||
* | * |
* Notifies the connector that it is connected to a VaadinSession (and | * Notifies the connector that it is connected to a VaadinSession (and | ||||
* therefore also to a UI). | * therefore also to a UI). | ||||
* <p> | * <p> | ||||
* The caller of this method is {@link #setParent(ClientConnector)} if the | |||||
* The caller of this method is {@link Connector#setParent(ClientConnector)} if the | |||||
* parent is itself already attached to the session. If not, the parent will | * parent is itself already attached to the session. If not, the parent will | ||||
* call the {@link #attach()} for all its children when it is attached to | * call the {@link #attach()} for all its children when it is attached to | ||||
* the session. This method is always called before the connector's data is | * the session. This method is always called before the connector's data is |
* <td width=120><b>Example</b></td> | * <td width=120><b>Example</b></td> | ||||
* </tr> | * </tr> | ||||
* <tr> | * <tr> | ||||
* <td><b></td> | |||||
* <td><b></td> | |||||
* <td>bold</td> | * <td>bold</td> | ||||
* <td><b>bold text</b></td> | * <td><b>bold text</b></td> | ||||
* </tr> | * </tr> | ||||
* <tr> | * <tr> | ||||
* <td><i></td> | |||||
* <td><i></td> | |||||
* <td>italic</td> | * <td>italic</td> | ||||
* <td><i>italic text</i></td> | * <td><i>italic text</i></td> | ||||
* </tr> | * </tr> | ||||
* <tr> | * <tr> | ||||
* <td><u></td> | |||||
* <td><u></td> | |||||
* <td>underlined</td> | * <td>underlined</td> | ||||
* <td><u>underlined text</u></td> | * <td><u>underlined text</u></td> | ||||
* </tr> | * </tr> | ||||
* <td>N/A</td> | * <td>N/A</td> | ||||
* </tr> | * </tr> | ||||
* <tr> | * <tr> | ||||
* <td><ul><br> | |||||
* <li>item1<br> | |||||
* <li>item1<br> | |||||
* </ul></td> | |||||
* <td><ul><br> | |||||
* <li>item1<br> | |||||
* <li>item1<br> | |||||
* </ul></td> | |||||
* <td>item list</td> | * <td>item list</td> | ||||
* <td> | * <td> | ||||
* <ul> | * <ul> |
* @param uri | * @param uri | ||||
* The uri to which the parameters should be added. | * The uri to which the parameters should be added. | ||||
* @param extraParams | * @param extraParams | ||||
* One or more parameters in the format "a=b" or "c=d&e=f". An | |||||
* One or more parameters in the format "a=b" or "c=d&e=f". An | |||||
* empty string is allowed but will not modify the url. | * empty string is allowed but will not modify the url. | ||||
* @return The modified URI with the get parameters in extraParams added. | * @return The modified URI with the get parameters in extraParams added. | ||||
*/ | */ |