Generators implementiert

This commit is contained in:
2023-11-20 17:38:28 +01:00
parent d8454b90de
commit 6ae236facd
10 changed files with 402 additions and 114 deletions
+68
View File
@@ -0,0 +1,68 @@
/*
* 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 bandit.Schnittstelle;
import bandit.Model.Zahlengenerator;
import bandit.View.ZahlenView;
import java.util.concurrent.Flow;
import java.util.concurrent.Flow.Subscriber;
import java.util.concurrent.Flow.Subscription;
/**
*
* @author le
*/
public class WertAdapter implements Subscriber<Integer[]>
{
private ZahlenView view;
private Zahlengenerator model;
private Subscription subscription;
public WertAdapter(ZahlenView view, Zahlengenerator model)
{
this.view = view;
this.model = model;
}
@Override
public void onSubscribe(Flow.Subscription subscription)
{
this.subscription = subscription;
this.subscription.request(1);
}
@Override
public void onNext(Integer item[])
{
String strWert = String.valueOf(item[0]);
switch(item[1]){
case 1:
view.getLblZahl1().setText(strWert);
break;
case 2:
view.getLblZahl2().setText(strWert);
break;
case 3:
view.getLblZahl3().setText(strWert);
break;
}
this.subscription.request(1);
}
@Override
public void onError(Throwable throwable)
{
}
@Override
public void onComplete()
{
}
}