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.

WertAdapter.java 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package subscriber;
  7. import java.util.concurrent.Flow.Subscriber;
  8. import java.util.concurrent.Flow.Subscription;
  9. /**
  10. *
  11. * @author le
  12. */
  13. public class WertAdapter implements Subscriber<Integer>
  14. {
  15. private SubscriberView view;
  16. private Datenmodell3 model;
  17. private Subscription subscription;
  18. public WertAdapter(SubscriberView view, Datenmodell3 model)
  19. {
  20. this.view = view;
  21. this.model = model;
  22. }
  23. public void einschreiben()
  24. {
  25. model.addWertSubscription(this);
  26. }
  27. @Override
  28. public void onSubscribe(Subscription subscription)
  29. {
  30. this.subscription = subscription;
  31. subscription.request(1);
  32. }
  33. @Override
  34. public void onNext(Integer item)
  35. {
  36. view.getLblZahl().setText(String.valueOf(item));
  37. subscription.request(1);
  38. }
  39. @Override
  40. public void onError(Throwable throwable)
  41. {
  42. }
  43. @Override
  44. public void onComplete()
  45. {
  46. }
  47. }