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 4bf37eb06dc9bf13e047a32e2df6deb142ef7dda Author: servantie <servantie.c@gmail.com> Date: Fri Jun 10 11:10:54 2016 +0200 added possibility to edit a url and adds it to the syncURLList of the task (not updated in the combobox yet, but saved) --- .../java/org/chorem/jtimer/entities/TimerTask.java | 11 +++++++++ .../jtimer/ui/report/TimerTaskUpdaterView.java | 26 +++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/chorem/jtimer/entities/TimerTask.java b/src/main/java/org/chorem/jtimer/entities/TimerTask.java index a75d4b7..ae3acb4 100644 --- a/src/main/java/org/chorem/jtimer/entities/TimerTask.java +++ b/src/main/java/org/chorem/jtimer/entities/TimerTask.java @@ -276,6 +276,17 @@ public class TimerTask implements Cloneable, } /** + * Add one URL to the task's syncURLList + * @param urlToAdd : the url to add + */ + public void addURLToSyncList(String urlToAdd) { + //no need to have redundant elements + if (!synchronisingURLList.contains(urlToAdd)) { + synchronisingURLList.add(urlToAdd); + } + } + + /** * Add task's subtask. * * Also add parent reference. 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 5f46583..19e838c 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java @@ -40,6 +40,10 @@ import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.*; @@ -56,7 +60,7 @@ import static org.chorem.jtimer.entities.TimerTaskHelper.taskToJSONFormat; * * Created by servantie on 13/05/16. */ -public class TimerTaskUpdaterView extends FrameView implements DocumentListener { +public class TimerTaskUpdaterView extends FrameView implements DocumentListener, ActionListener { /** Class logger */ protected static Log log = LogFactory.getLog(TimerTaskUpdaterView.class); @@ -207,6 +211,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener //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<>(); + //make it editable to add new urls -todo: save these urls to the task- + urlComboBox.setEditable(true); + urlComboBox.addActionListener(this); //add the urls to the combobox for (String url : urlSyncList) { urlComboBox.addItem(url); @@ -521,4 +528,21 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener protected void documentChanged() { setUpdatingEnabled(updateArea.getText().trim().length() > 0); } + + /** + * when an item is added to the list, + * add it to the urls + */ + public void itemAdded(){ + String urlToAdd = (String) urlComboBox.getSelectedItem(); + if (!urlToAdd.isEmpty()) { + task.addURLToSyncList(urlToAdd); + } + + } + + @Override + public void actionPerformed(ActionEvent actionEvent) { + itemAdded(); + } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.