Init mit Aufgabe10
This commit is contained in:
commit
22efa7c18f
22 files changed
+3188
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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(){
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user