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 f3431bc78f4c0a54271cddef2da6928f09438883 Author: servantie <servantie.c@gmail.com> Date: Tue Jun 21 17:27:12 2016 +0200 added some logging (more to come) and added properties --- .../java/org/chorem/jtimer/entities/SyncInfo.java | 6 +++++ .../jtimer/ui/report/TimerTaskUpdaterView.java | 30 +++++++++++++++++----- .../resources/TimerTaskUpdaterView.properties | 8 +++--- .../resources/TimerTaskUpdaterView_fr.properties | 2 ++ 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/entities/SyncInfo.java b/src/main/java/org/chorem/jtimer/entities/SyncInfo.java index cf81350..f1fee01 100644 --- a/src/main/java/org/chorem/jtimer/entities/SyncInfo.java +++ b/src/main/java/org/chorem/jtimer/entities/SyncInfo.java @@ -9,8 +9,14 @@ import java.time.LocalDateTime; * Created by servantie on 13/06/16. */ public class SyncInfo { + + /** the url to synchronize on */ String syncURL; + + /** the last time the synchronization happened successfully */ LocalDateTime lastSync; + + /** true if the synchronization is active */ boolean isActiveSync; /** diff --git a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java index 202baa2..7bc1787 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java @@ -214,13 +214,14 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, panelOption.add(urlComboBox, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1, 2, 1, 1), 0, 0)); + //display last Sync time JLabel lastSyncDateLabel = new JLabel(getResourceMap().getString("lastUpdateLabel")); panelOption.add(lastSyncDateLabel, new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(3, 1, 1, 1), 0, 0)); - //display last Sync time - lastUpdate = new JLabel(""); - //todo : properties - checkIsActiveSync = new JCheckBox("active"); + + lastUpdate = new JLabel(); + //checkbox for active sync + checkIsActiveSync = new JCheckBox(getResourceMap().getString("isActiveSync")); checkIsActiveSync.setAction(getContext().getActionMap(this).get("isActiveSync")); if (urlComboBox.getSelectedItem() != null) { if (task.getSynchronizingURLList().contains(urlComboBox.getSelectedItem())){ @@ -233,6 +234,7 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, checkIsActiveSync.setSelected(task.getSynchronizingInfo((String) urlComboBox.getSelectedItem()).getActiveSync()); } } + panelOption.add(lastUpdate, new GridBagConstraints(2, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1, 3, 1, 1), 0, 0)); panelOption.add(checkIsActiveSync, new GridBagConstraints(1, 4, 1, 1, 0, 0, @@ -397,8 +399,7 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, } } if (!task.getSynchronizingInfo(urlSelected).getActiveSync()) { - //todo : get in properties - updateArea.setText("Url inactive"); + updateArea.setText(getResourceMap().getString("isNotActiveURL")); } else { updateArea.setText(builder.toString()); @@ -410,7 +411,7 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, } /** - * Show annotation checkbox checked. + * Add annotation checkbox checked. */ @Action public boolean isIncludingAnnotations() { @@ -418,6 +419,14 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, return ischeckedIncludeAnnotations; } + /** + * Active sync checkbox checked + */ + @Action + public boolean isActiveSync() { + boolean isActiveSyncURL = checkIsActiveSync.isSelected(); + return isActiveSyncURL; + } /** @@ -479,9 +488,16 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestMethod("POST"); + //logging connection + log.info("Sending json to : " + syncURL); + postDataBytes = updateJsonString.getBytes(charset); connection.getOutputStream().write(postDataBytes); int code = connection.getResponseCode(); + + //logging code return + log.info("Code return : " + code); + if ((code == 200) || (code == 2001) || (code == 202)) { hasUpdated = true; } diff --git a/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView.properties b/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView.properties index 963ee35..1e8718e 100644 --- a/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView.properties +++ b/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView.properties @@ -19,14 +19,16 @@ # <http://www.gnu.org/licenses/gpl-3.0.html>. # #L% ### -updateTitle=${Application.title} - Synchronisation +updateTitle=${Application.title} - Synchronization updateGeneral=General updateOptions=Options updateFrom=From : updateTo=To : -lastUpdateLabel=Last Synchronisation at: -urlComboLabel = Synchronisation Url: +lastUpdateLabel=Last Synchronization at: +urlComboLabel = Synchronization Url: +isActiveSync = Active sync +isNotActiveURL = Inactive Synchronization pickCurrentMonth.Action.text = Select current month diff --git a/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView_fr.properties b/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView_fr.properties index aa37b4b..0febdcb 100644 --- a/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView_fr.properties +++ b/src/main/resources/org/chorem/jtimer/ui/report/resources/TimerTaskUpdaterView_fr.properties @@ -28,6 +28,8 @@ updateTo=\u00C0 : lastUpdateLabel=Derni\u00E8re synchronisation : urlComboLabel=Url de synchronisation : +isActiveSync= Synchronisation active +isNotActiveURL = Synchronisation vers cette URL d\u00E9sactiv\u00E9e pickCurrentMonth.Action.text = Selectionner le mois courant -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.