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 ba2e1ce02a5e477ceb1b14ccf1bf0e3e07ffb18d Author: servantie <servantie.c@gmail.com> Date: Thu Jun 16 15:02:07 2016 +0200 showing last sync associated with url picked in combobox --- .../jtimer/ui/report/TimerTaskUpdaterView.java | 55 +++++++++++++++------- .../resources/TimerTaskUpdaterView.properties | 7 +-- .../resources/TimerTaskUpdaterView_fr.properties | 1 + 3 files changed, 42 insertions(+), 21 deletions(-) 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 263ded8..3b6058f 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java @@ -29,6 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.jtimer.JTimer; import org.chorem.jtimer.data.TimerCore; +import org.chorem.jtimer.entities.SyncInfo; import org.chorem.jtimer.entities.TimerTask; import org.jdesktop.application.*; import org.jdesktop.application.Action; @@ -81,6 +82,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, /** ComboBox of URLs */ protected JComboBox<String> urlComboBox; + /** LastSync */ + protected JLabel lastUpdate; + /** task to update */ protected TimerTask task; @@ -190,19 +194,7 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, panelOption.add(checkIncludesAnnotations, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); - //display the lastSyncDate -// JLabel lastSyncDate = new JLabel(getResourceMap().getString("lastUpdateLabel")); - //if there has been an update before, display its date -// LocalDateTime lastSyncTime = task.getLastSync(); -// if (lastSyncTime != null) { -// JLabel lastUpdate = new JLabel(lastSyncTime.toString()); -// panelOption.add(lastSyncDate, new GridBagConstraints(1, 2, 1, 1, 0, 0, -// GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 1, 1), 0, 0)); -// panelOption.add(lastUpdate, new GridBagConstraints(2, 2, 1, 1, 0, 0, -// GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1, 2, 1, 1), 0, 0)); -// } - - //display the various urls to sync to in a combobox to choose which one will be updated + //url combobox JLabel urlcomboBoxLabel = new JLabel(getResourceMap().getString("urlComboLabel")); urlComboBox = new JComboBox<>(); //make it editable to add new urls @@ -217,6 +209,23 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, panelOption.add(urlComboBox, new GridBagConstraints(2,3,1,1,0,0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1,3,1,1), 0, 0)); + JLabel lastSyncDateLabel = new JLabel(getResourceMap().getString("lastUpdateLabel")); + panelOption.add(lastSyncDateLabel, new GridBagConstraints(1, 2, 1, 1, 0, 0, + GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 1, 1), 0, 0)); + //display last Sync time + lastUpdate = new JLabel(""); + if (urlComboBox.getSelectedItem() != null) { + if (task.getSynchronizingURLList().contains(urlComboBox.getSelectedItem())){ + SyncInfo syncInfo = task.getSynchronizingInfo((String) urlComboBox.getSelectedItem()); + LocalDateTime lastSyncTime = syncInfo.getLastSync(); + //if there has been an update before, display its date + if ((lastSyncTime != null) && lastSyncTime.isAfter(LocalDateTime.MIN)) { + lastUpdate.setText(lastSyncTime.toString()); + } + } + } + panelOption.add(lastUpdate, new GridBagConstraints(2, 2, 1, 1, 0, 0, + GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1, 2, 1, 1), 0, 0)); configComponent.add(panelGeneral); configComponent.add(panelOption); @@ -378,12 +387,17 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, } } updateArea.setText(builder.toString()); + if (task.getSynchronizingInfo(urlSelected).getLastSync().isAfter(LocalDateTime.MIN)) { + lastUpdate.setText(task.getSynchronizingInfo(urlSelected).getLastSync().toString()); + } + else { + lastUpdate.setText(""); + } } else { updateArea.setText("No data"); } - } /** @@ -429,6 +443,12 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, synchronizeTaskOnURL(task, object); } } + if (task.getSynchronizingInfo(urlSelected).getLastSync().isAfter(LocalDateTime.MIN)) { + lastUpdate.setText(task.getSynchronizingInfo(urlSelected).getLastSync().toString()); + } + else { + lastUpdate.setText(""); + } } /** @@ -546,11 +566,10 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, public void itemAdded(){ String urlToAdd = (String) urlComboBox.getSelectedItem(); if ((!urlToAdd.isEmpty()) && (!task.getSynchronizingURLList().contains(urlToAdd))) { - urlComboBox.addItem(urlToAdd); - task.addSyncInfo(urlToAdd, LocalDateTime.MIN, true); - core.getData().changeSyncInfo(task, urlToAdd); + urlComboBox.addItem(urlToAdd); + task.addSyncInfo(urlToAdd, LocalDateTime.MIN, true); + core.getData().changeSyncInfo(task, urlToAdd); } - } @Override public void actionPerformed(ActionEvent actionEvent) { 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 70ef7be..963ee35 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 @@ -47,19 +47,20 @@ updateAnnotations.Action.shortDescription = Include annotations generateUpdate.Action.text = &Generate generateUpdate.Action.icon = applications-system.png generateUpdate.Action.shortDescription = Generate synchronisation +updateSyncTime = No recent synchronization sendUpdate.Action.text = &Send sendUpdate.Action.icon = mail-forward.png -sendUpdate.Action.shortDescription = Send synchronisation +sendUpdate.Action.shortDescription = Send synchronization closeView.Action.text = &Close closeView.Action.icon = dialog-close.png closeView.Action.shortDescription = Close -action.updateError = Synchronisation failed +action.updateError = Synchronization failed action.update400 = Bad Request action.update404 = Not found action.update500 = Server error -action.updateErrorTitle = Synchronisation error +action.updateErrorTitle = Synchronization error action.updateEncodingError = Encoding error action.updateURLError = URL error \ No newline at end of file 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 329a948..aa37b4b 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 @@ -47,6 +47,7 @@ isIncludingAnnotations.Action.text = Inclure les annotations generateUpdate.Action.text = &G\u00E9n\u00E9rer generateUpdate.Action.icon = applications-system.png generateUpdate.Action.shortDescription = G\u00E9n\u00E9rer les donn\u00E9es de synchronisation +updateSyncTime = Pas de synchronisation r\u00E9cente sendUpdate.Action.text = &Envoyer sendUpdate.Action.icon = mail-forward.png -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.