branch feature/sync updated (81724c1 -> 2f92619)
This is an automated email from the git hooks/post-receive script. New change to branch feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git from 81724c1 save of syncInfo with json instead of yaml (+ tests adapted) new b79b74b removed useless declarations new 140520c no longer adding syncInfo if the url is empty new 2f92619 logs and corrected an actioncommand, removed useless null checks The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: 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 commit 140520c03e4ecf00ab5c5907d59b12d638fe5ce7 Author: servantie <servantie.c@gmail.com> Date: Wed Jul 13 12:10:39 2016 +0200 no longer adding syncInfo if the url is empty commit b79b74bde56cbfc4c3e25efb95ed47da07c64f59 Author: servantie <servantie.c@gmail.com> Date: Wed Jul 13 11:50:09 2016 +0200 removed useless declarations Summary of changes: .../java/org/chorem/jtimer/data/TimerCore.java | 5 +++- .../java/org/chorem/jtimer/entities/SyncInfo.java | 6 ---- .../java/org/chorem/jtimer/entities/TimerTask.java | 9 +++--- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 1 - .../jtimer/ui/report/TimerTaskSyncInfoEditor.java | 33 ++++++++++++---------- 5 files changed, 26 insertions(+), 28 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 b79b74bde56cbfc4c3e25efb95ed47da07c64f59 Author: servantie <servantie.c@gmail.com> Date: Wed Jul 13 11:50:09 2016 +0200 removed useless declarations --- src/main/java/org/chorem/jtimer/entities/TimerTask.java | 9 ++++----- .../org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java | 4 ---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/entities/TimerTask.java b/src/main/java/org/chorem/jtimer/entities/TimerTask.java index dab5a27..a8015e5 100644 --- a/src/main/java/org/chorem/jtimer/entities/TimerTask.java +++ b/src/main/java/org/chorem/jtimer/entities/TimerTask.java @@ -295,14 +295,13 @@ public class TimerTask implements Cloneable, /** * Adds a new synchronization info if the url isn't already present in the list + * sync activity true by default, annotations false by default * @param url a string * @param time a LocalDateTime - * @param isActive a boolean for activity (true to sync auto) - * @param isWithAnnotations a boolean for annotations (false default) */ - public void addSyncInfo(String url, Date time, boolean isActive, boolean isWithAnnotations) { + public void addSyncInfo(String url, Date time) { if (!url.isEmpty() && !getSynchronizingURLList().contains(url)) { - synchronisingInfoList.add(new SyncInfo(url, time, isActive, isWithAnnotations)); + synchronisingInfoList.add(new SyncInfo(url, time, true, false)); } } @@ -311,7 +310,7 @@ public class TimerTask implements Cloneable, * (default isActive = true and isWithAnnotations false) * @param url a String */ - public void addSyncInfo(String url) { addSyncInfo(url, new Date(0), true, false); } + public void addSyncInfo(String url) { addSyncInfo(url, new Date(0)); } /** * Adds a SyncInfo to the task 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 40fa29f..f236052 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java @@ -81,9 +81,6 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener /** button to test a url */ protected JButton testSyncUrlButton; - /** task in json format (1/synchronizing url) */ - protected List<JsonObject> updateJson; - /** ComboBox of URLs */ protected JComboBox<SyncInfo> urlComboBox; @@ -117,7 +114,6 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener this.core = core; this.task = task; timezone = "+01:00"; - updateJson = new ArrayList<>(); df = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); setComponent(getMainComponent()); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 140520c03e4ecf00ab5c5907d59b12d638fe5ce7 Author: servantie <servantie.c@gmail.com> Date: Wed Jul 13 12:10:39 2016 +0200 no longer adding syncInfo if the url is empty --- .../java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 f236052..6598e2e 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskSyncInfoEditor.java @@ -31,10 +31,8 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; -import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; @@ -86,6 +84,7 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener /** LastSync */ protected JLabel lastUpdate; + /** lastSync Label */ protected JLabel lastSyncDateLabel; @@ -295,7 +294,7 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener * add it to the url displayed, and to the syncInfo of the task */ public void itemAdded(String urlToAdd){ - if ((urlToAdd != null) && ((!task.getSynchronizingURLList().contains(urlToAdd)))) { + if ((urlToAdd != null) && (!urlToAdd.isEmpty()) && ((!task.getSynchronizingURLList().contains(urlToAdd)))) { SyncInfo infoToAdd = new SyncInfo(urlToAdd); core.getData().syncInfoChanged(task, infoToAdd); urlComboBox.addItem(infoToAdd); @@ -318,8 +317,11 @@ public class TimerTaskSyncInfoEditor extends FrameView implements ActionListener String urlToDisplay; if (urlComboBox.getSelectedItem() instanceof String) { urlToDisplay = (String)urlComboBox.getSelectedItem(); + //trim the whitespaces + urlToDisplay = urlToDisplay.trim(); syncInfo = new SyncInfo(urlToDisplay); urlComboBox.setSelectedItem(syncInfo); + } else { syncInfo = (SyncInfo) urlComboBox.getSelectedItem(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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>.
participants (1)
-
chorem.org scm