This is an automated email from the git hooks/post-receive script. New commit to branch feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit 2f926190b295b680ae3f05cca5e80279e02bd42c Author: servantie <servantie.c@gmail.com> Date: Fri Jul 15 10:03:51 2016 +0200 logs and corrected an actioncommand, removed useless null checks --- src/main/java/org/chorem/jtimer/data/TimerCore.java | 5 ++++- .../java/org/chorem/jtimer/entities/SyncInfo.java | 6 ------ .../chorem/jtimer/io/GTimerIncrementalSaver.java | 1 - .../jtimer/ui/report/TimerTaskSyncInfoEditor.java | 21 +++++++++++++-------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/data/TimerCore.java b/src/main/java/org/chorem/jtimer/data/TimerCore.java index 21c5b8d..02297c1 100644 --- a/src/main/java/org/chorem/jtimer/data/TimerCore.java +++ b/src/main/java/org/chorem/jtimer/data/TimerCore.java @@ -194,6 +194,9 @@ public class TimerCore { // add the tasks that haven't been synced before to the synchronizer + if (log.isDebugEnabled()) { + log.debug("Adding tasks that were not synchronized at last jTimer exit"); + } for (TimerTask project : data.getProjectsList()) { project.getSubTasks().forEach(this::addTaskToSync); } @@ -207,7 +210,7 @@ public class TimerCore { protected void addTaskToSync(TimerTask task) { if (log.isDebugEnabled()) { - log.debug("Adding tasks that were not synchronized at last jTimer exit"); + log.debug("Adding task " + task.getName() + " to the synchronizer"); } for (SyncInfo sync : task.getSynchronizingInfoList()) { if (sync.getIsToSyncAtStartUp()) { diff --git a/src/main/java/org/chorem/jtimer/entities/SyncInfo.java b/src/main/java/org/chorem/jtimer/entities/SyncInfo.java index e20edbe..ac04854 100644 --- a/src/main/java/org/chorem/jtimer/entities/SyncInfo.java +++ b/src/main/java/org/chorem/jtimer/entities/SyncInfo.java @@ -26,12 +26,6 @@ public class SyncInfo { protected boolean isToSyncAtStartUp; /** - * Empty constructor (necessary for yaml) - */ - public SyncInfo(){ - } - - /** * constructor with all parameters * @param syncURL the url to sync to * @param lastSync the last time it was synced successfully diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index de3dbaf..a204740 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -616,7 +616,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, JsonObject res = (JsonObject) obj; SyncInfo sync = gson.fromJson(res, SyncInfo.class); task.addSyncInfo(sync); - } } } diff --git a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java index 6598e2e..da1a341 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java @@ -366,10 +366,11 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener } else{ infoToUse = (SyncInfo) urlComboBox.getSelectedItem(); + urlToUse = infoToUse.getSyncURL(); } if ("deleteURL".equals(actionCommand)) { //if the delete button has been clicked, delete the task (if it exists) - if ((infoToUse != null) && (task.getSynchronizingInfoList().contains(infoToUse))) { + if ((task.getSynchronizingInfoList().contains(infoToUse))) { task.removeSyncInfo(infoToUse); urlComboBox.removeItem(infoToUse); core.getData().deleteSyncInfo(task, infoToUse); @@ -377,29 +378,33 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener errorBox(getResourceMap().getString("deleteErrorMessage"), getResourceMap().getString("deleteErrorTitle")); } } - else if ("comboBox".equals(actionCommand)) { - if ((infoToUse != null) && !task.getSynchronizingInfoList().contains(infoToUse)) { + else if ("comboBoxEdited".equals(actionCommand)) { + if (!task.getSynchronizingInfoList().contains(infoToUse)) { if (log.isDebugEnabled()) { log.debug("New URL added"); } - itemAdded(infoToUse.getSyncURL()); + itemAdded(urlToUse); } else if (log.isDebugEnabled()) { - log.debug("URL already existing in SyncInfo, no addition."); + log.debug("No addition"); } } else if ("testURL".equals(actionCommand)) { //if the test button has been clicked, test the sync on the URL and returns a message to the user //tests only if the info exists - if ((infoToUse != null) && task.getSynchronizingInfoList().contains(infoToUse)) { - JsonObject testObject = TimerTaskHelper.taskURLToJSONObject(task, infoToUse.getSyncURL(), isIncludingAnnotations(), timezone); + if (task.getSynchronizingInfoList().contains(infoToUse)) { + JsonObject testObject = TimerTaskHelper.taskURLToJSONObject(task, urlToUse, isIncludingAnnotations(), timezone); int responseCode = TimerTaskSynchronizer.synchronizeTaskOnURL(testObject); if (responseCode > 199 && responseCode < 300) { infoBox(getResourceMap().getString("testSyncSuccessMessage"), getResourceMap().getString("testSyncSuccessTitle")); Calendar cal = Calendar.getInstance(); infoToUse.setLastSync(cal.getTime()); core.getData().taskSynchronized(task, infoToUse); + //update the last synctime displayed + lastUpdate.setVisible(true); + lastSyncDateLabel.setVisible(true); + lastUpdate.setText(df.format(infoToUse.getLastSync())); } else { errorBox(getResourceMap().getString("testSyncFailureMessage"), getResourceMap().getString("testSyncFailureTitle")); @@ -408,7 +413,7 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener } else { if (log.isDebugEnabled()) { - log.debug("Action performed. Action: " + actionEvent.getActionCommand()); + log.debug("Action performed. Action: " + actionCommand); } } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.