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.

PerformanceExtension.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.vaadin.tests.widgetset.server;
  2. import com.vaadin.server.AbstractExtension;
  3. import com.vaadin.tests.widgetset.client.PerformanceExtensionClientRpc;
  4. import com.vaadin.tests.widgetset.client.PerformanceExtensionConnector;
  5. import com.vaadin.ui.Label;
  6. public class PerformanceExtension extends AbstractExtension {
  7. private Label label;
  8. private PerformanceExtension() {
  9. registerRpc(
  10. new PerformanceExtensionConnector.PerformanceExtensionServerRpc() {
  11. @Override
  12. public void total(int total) {
  13. label.setValue("Total: " + total);
  14. }
  15. });
  16. }
  17. public static PerformanceExtension wrap(Label label) {
  18. PerformanceExtension extension = new PerformanceExtension();
  19. extension.label = label;
  20. extension.extend(label);
  21. return extension;
  22. }
  23. public void start() {
  24. getRpcProxy(
  25. PerformanceExtensionClientRpc.class)
  26. .start();
  27. }
  28. public void stop() {
  29. getRpcProxy(
  30. PerformanceExtensionClientRpc.class)
  31. .stop();
  32. }
  33. }