
Conflicts: src/wuerfelthreads/Start.java src/wuerfelthreads/view/WuerfelView.form src/wuerfelthreads/view/WuerfelView.java
68 lines
1.3 KiB
Java
68 lines
1.3 KiB
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package graphicChat.controller;
|
|
|
|
import java.util.concurrent.Flow;
|
|
import java.util.logging.Logger;
|
|
import graphicChat.logger.OhmLogger;
|
|
import graphicChat.model.ChatModel;
|
|
import graphicChat.model.Figure;
|
|
import graphicChat.view.ChatView;
|
|
import java.util.List;
|
|
|
|
/**
|
|
*
|
|
* @author hd, chris
|
|
*/
|
|
|
|
public class ReceiveAdapter implements Flow.Subscriber<List<Figure>>
|
|
{
|
|
private static Logger lg = OhmLogger.getLogger();
|
|
|
|
private ChatView view;
|
|
private ChatModel model;
|
|
private Flow.Subscription subscription;
|
|
|
|
public ReceiveAdapter(ChatView view, ChatModel model)
|
|
{
|
|
this.view = view;
|
|
this.model = model;
|
|
}
|
|
|
|
public void subscribe()
|
|
{
|
|
model.addSubscription(this);
|
|
}
|
|
|
|
@Override
|
|
public void onSubscribe(Flow.Subscription subscription)
|
|
{
|
|
this.subscription = subscription;
|
|
subscription.request(1);
|
|
}
|
|
|
|
@Override
|
|
public void onNext(List<Figure> msg)
|
|
{
|
|
view.getLblStatus().setText("Nachricht empfangen");
|
|
view.repaint();
|
|
subscription.request(1);
|
|
}
|
|
|
|
@Override
|
|
public void onError(Throwable throwable)
|
|
{
|
|
}
|
|
|
|
@Override
|
|
public void onComplete()
|
|
{
|
|
}
|
|
|
|
|
|
}
|