Module Client, écran Stat : correction d'un bug empêchant la mise à jour de l'affichage des statistiques

This commit is contained in:
Notmoo-PC\Notmoo 2017-11-04 20:50:20 +01:00
parent 0c64c49f0f
commit 3f8daabe61
5 changed files with 28 additions and 9 deletions

View File

@ -57,6 +57,7 @@ public class StatDao {
private synchronized void replaceStats(Map<String, String> stats) {
this.stats = new HashMap<>(stats);
this.lastRefreshTimestamp = new Date();
eventFirerer.fireStatChangedEvent();
}
public void removeListener(IStatListener listener) {

View File

@ -4,13 +4,11 @@ import java.util.Map;
public interface IStatFirerer {
public abstract void fireGetStatSuccess();
public abstract void fireGetStatError(Throwable cause);
public abstract void fireGetStatRefused(Throwable cause);
void fireGetStatSuccess();
void fireGetStatError(Throwable cause);
void fireGetStatRefused(Throwable cause);
void fireStatChangedEvent();
void removeListener(IStatListener listener);
void addListener(IStatListener listener);
}

View File

@ -5,10 +5,12 @@ import java.util.Map;
public interface IStatListener extends EventListener {
public abstract void onGetStatSuccess();
void onGetStatSuccess();
public abstract void onGetStatError(Throwable cause);
void onGetStatError(Throwable cause);
public abstract void onGetStatRefused(Throwable cause);
void onGetStatRefused(Throwable cause);
void onStatChangedEvent();
}

View File

@ -14,6 +14,7 @@ public class SimpleStatFirerer implements IStatFirerer {
/**
* @see com.pqt.client.module.stat.listeners.IStatFirerer#fireGetStatSuccess()
*/
@Override
public void fireGetStatSuccess() {
for(IStatListener l : listeners.getListeners(IStatListener.class)){
l.onGetStatSuccess();
@ -24,6 +25,7 @@ public class SimpleStatFirerer implements IStatFirerer {
/**
* @see com.pqt.client.module.stat.listeners.IStatFirerer#fireGetStatError(Throwable)
*/
@Override
public void fireGetStatError(Throwable cause) {
for(IStatListener l : listeners.getListeners(IStatListener.class)){
l.onGetStatError(cause);
@ -34,12 +36,20 @@ public class SimpleStatFirerer implements IStatFirerer {
/**
* @see com.pqt.client.module.stat.listeners.IStatFirerer#fireGetStatRefused(Throwable)
*/
@Override
public void fireGetStatRefused(Throwable cause) {
for(IStatListener l : listeners.getListeners(IStatListener.class)){
l.onGetStatRefused(cause);
}
}
@Override
public void fireStatChangedEvent() {
for(IStatListener l : listeners.getListeners(IStatListener.class)){
l.onStatChangedEvent();
}
}
@Override
public void removeListener(IStatListener listener) {
listeners.remove(IStatListener.class, listener);

View File

@ -6,6 +6,7 @@ public class StatListenerAdapter implements IStatListener {
/**
* @see com.pqt.client.module.stat.listeners.IStatListener#onGetStatSuccess()
*/
@Override
public void onGetStatSuccess() {
}
@ -14,6 +15,7 @@ public class StatListenerAdapter implements IStatListener {
/**
* @see com.pqt.client.module.stat.listeners.IStatListener#onGetStatError(Throwable)
*/
@Override
public void onGetStatError(Throwable cause) {
}
@ -22,8 +24,14 @@ public class StatListenerAdapter implements IStatListener {
/**
* @see com.pqt.client.module.stat.listeners.IStatListener#onGetStatRefused(Throwable)
*/
@Override
public void onGetStatRefused(Throwable cause) {
}
@Override
public void onStatChangedEvent() {
}
}