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 917eba7f1f90a18a858d475e3dd05eec2211d8d6 Author: servantie <servantie.c@gmail.com> Date: Thu Jun 9 16:25:23 2016 +0200 added a combobox in manual sync to pick which url to sync on (if one sync fails, pop up shows to say so, but textarea isn't updated on "generate update" button pressing) --- .../jtimer/ui/report/TimerTaskUpdaterView.java | 37 +++++++++++++++++++--- .../resources/TimerTaskUpdaterView.properties | 3 +- .../resources/TimerTaskUpdaterView_fr.properties | 1 + 3 files changed, 36 insertions(+), 5 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 d98fcb9..0af876d 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java @@ -73,8 +73,15 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener /** update output view*/ protected JTextArea updateArea; + /** task in json format (1/synchronizing url) */ protected List<JsonObject> updateJson; + /** list of URLs to sync to */ + protected List<String> urlSyncList; + + /** ComboBox of URLs */ + protected JComboBox<String> urlComboBox; + /** task to update */ protected TimerTask task; @@ -101,6 +108,8 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener this.core = core; this.task = task; timezone = "+0100"; + urlSyncList = task.getSynchronisingURLList(); + setComponent(getMainComponent()); updateJson = new ArrayList<>(); @@ -189,13 +198,26 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener //if there has been an update before, display its date LocalDateTime lastSyncTime = task.getLastSync(); if (lastSyncTime != null) { - JLabel lastUpdate = new JLabel(lastSyncTime.toLocalDate().toString()); + 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 + JLabel urlcomboBoxLabel = new JLabel(getResourceMap().getString("urlComboLabel")); + urlComboBox = new JComboBox<>(); + //add the urls to the combobox + for (String url : urlSyncList) { + urlComboBox.addItem(url); + } + panelOption.add(urlcomboBoxLabel, new GridBagConstraints(1,3,1,1,0,0, + GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(3,1,1,1), 0, 0)); + panelOption.add(urlComboBox, new GridBagConstraints(2,3,1,1,0,0, + GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1,3,1,1), 0, 0)); + + configComponent.add(panelGeneral); configComponent.add(panelOption); @@ -343,11 +365,14 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener updateJson = taskToJSONFormat(task, datePickerFrom.getDate(), datePickerTo.getDate(), isIncludingAnnotations(), timezone); if (!updateJson.isEmpty()) { + String urlSelected = (String) urlComboBox.getSelectedItem(); //to make it human readable Gson gson = new GsonBuilder().setPrettyPrinting().create(); StringBuilder builder = new StringBuilder(); for (JsonObject object : updateJson) { - builder.append(gson.toJson(object)); + if (urlSelected.equals(object.get("URL").getAsString())) { + builder.append(gson.toJson(object)); + } } updateArea.setText(builder.toString()); @@ -390,12 +415,16 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener } /** - * goes through the Jsons to send and sends them + * sends the sync of the task associated with the current url selected + * in the combobox (urlComboBox) */ @Action(enabledProperty = "updatingEnabled") public void sendUpdate() { + String urlSelected = (String) urlComboBox.getSelectedItem(); for (JsonObject object : updateJson) { - synchronizeTaskOnURL(task, object); + if (urlSelected.equals(object.get("URL").getAsString())) { + synchronizeTaskOnURL(task, object); + } } } 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 ddeae17..dca4916 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 @@ -25,7 +25,8 @@ updateOptions=Options updateFrom=From : updateTo=To : -lastUpdateLabel=Last Sync at: +lastUpdateLabel=Last Synchronisation at: +urlComboLabel = Synchronisation Url: 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 908ccad..d34c270 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 @@ -27,6 +27,7 @@ updateFrom=De : updateTo=\u00C0 : lastUpdateLabel=Derni\u00E8re synchronisation : +urlComboLabel=Url de synchronisation : 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>.