From 3f8daabe6168a2d785063e4bbdaa5ed5fbc73948 Mon Sep 17 00:00:00 2001 From: "Notmoo-PC\\Notmoo" Date: Sat, 4 Nov 2017 20:50:20 +0100 Subject: [PATCH] =?UTF-8?q?Module=20Client,=20=C3=A9cran=20Stat=20:=20corr?= =?UTF-8?q?ection=20d'un=20bug=20emp=C3=AAchant=20la=20mise=20=C3=A0=20jou?= =?UTF-8?q?r=20de=20l'affichage=20des=20statistiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/pqt/client/module/stat/StatDao.java | 1 + .../pqt/client/module/stat/listeners/IStatFirerer.java | 10 ++++------ .../client/module/stat/listeners/IStatListener.java | 8 +++++--- .../module/stat/listeners/SimpleStatFirerer.java | 10 ++++++++++ .../module/stat/listeners/StatListenerAdapter.java | 8 ++++++++ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java index 5a0444b5..57945add 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java @@ -57,6 +57,7 @@ public class StatDao { private synchronized void replaceStats(Map stats) { this.stats = new HashMap<>(stats); this.lastRefreshTimestamp = new Date(); + eventFirerer.fireStatChangedEvent(); } public void removeListener(IStatListener listener) { diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java index 105af3f2..25d61e83 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java @@ -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); } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java index 21c324b9..5e1349c9 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java @@ -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(); } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java index d84966e6..3e57a15a 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java @@ -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); diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java index c182895e..a96fd826 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java @@ -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() { + + } + }