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.

LabelPropertySourceValue.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.vaadin.tests.components.label;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractReindeerTestUI;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.v7.data.util.ObjectProperty;
  6. import com.vaadin.v7.ui.Label;
  7. public class LabelPropertySourceValue extends AbstractReindeerTestUI {
  8. private Label label;
  9. @Override
  10. public void setup(VaadinRequest request) {
  11. label = new Label("Hello Vaadin user");
  12. addComponent(label);
  13. Button button = new Button("Give label a new property data source...");
  14. button.addClickListener(event -> {
  15. ObjectProperty<String> p = new ObjectProperty<>(
  16. "This text should appear on the label after clicking the button.");
  17. label.setPropertyDataSource(p);
  18. });
  19. addComponent(button);
  20. button = new Button("Remove data source",
  21. event -> label.setPropertyDataSource(null));
  22. addComponent(button);
  23. button = new Button("Set label value to 'foo'",
  24. event -> label.setValue("foo"));
  25. addComponent(button);
  26. }
  27. @Override
  28. protected String getTestDescription() {
  29. return "The value should change by clicking the button";
  30. }
  31. @Override
  32. protected Integer getTicketNumber() {
  33. return 9618;
  34. }
  35. }