1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /*
- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
- * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
- */
- package ChatProgramm.model;
-
- import ChatProgramm.view.ChatView;
- import java.util.concurrent.Flow;
- import java.util.concurrent.Flow.Subscriber;
-
- /**
- *
- * @author ahren
- */
- public class ReceiveAdapter implements Subscriber<Nachricht> {
-
- private ChatView view;
- private Flow.Subscription subscription;
-
- public ReceiveAdapter(ChatView view) {
- this.view = view;
- }
-
- @Override
- public void onSubscribe(Flow.Subscription subscription) {
- this.subscription = subscription;
- this.subscription.request(1);
- }
-
- @Override
- public void onNext(Nachricht item) {
-
- view.getTxtChat().append(item.getNachricht());
- this.subscription.request(1);
- }
-
- @Override
- public void onError(Throwable throwable) {
- }
-
- @Override
- public void onComplete(){
- }
- }
|