Ich hab überall wo der Frame eingebunden werden muss die sachen auskommentiert und ToDos eingefügt
47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
/*
|
|
* 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) {
|
|
|
|
//ToDo: hier muss der gFrame aufgerufen werden
|
|
// evtl muss die Figur aber zuerst serialisiert werden
|
|
//view.getTxtChat().append(item.getNachricht());
|
|
this.subscription.request(1);
|
|
}
|
|
|
|
@Override
|
|
public void onError(Throwable throwable) {
|
|
}
|
|
|
|
@Override
|
|
public void onComplete(){
|
|
}
|
|
}
|