branch develop updated (a4f8192 -> 8a7047e)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git from a4f8192 Downgrade testng new dd09cbd Update libs new b8fe6a6 Code style and fix analysis new 8a7047e Use default methods to remove a lot of empty implemented methods 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 8a7047ea99c3c6e529e06fe90eeefe8e0af31aaf Author: CHRE <CHATELLIER@codelutin.com> Date: Wed Jun 8 13:29:05 2016 +0200 Use default methods to remove a lot of empty implemented methods commit b8fe6a6b763859c83fd4840485c7082de4aef2e9 Author: CHRE <CHATELLIER@codelutin.com> Date: Wed Jun 8 13:15:03 2016 +0200 Code style and fix analysis commit dd09cbdb8f5ac26d209ccd6d73796252c531e36b Author: CHRE <CHATELLIER@codelutin.com> Date: Wed Jun 8 12:27:17 2016 +0200 Update libs Summary of changes: pom.xml | 4 +- src/main/java/org/chorem/jtimer/JTimerFactory.java | 4 +- .../org/chorem/jtimer/data/CommonVetoable.java | 141 +++------- .../org/chorem/jtimer/data/DataEventListener.java | 112 +++++--- .../java/org/chorem/jtimer/data/TimerCore.java | 5 +- .../org/chorem/jtimer/data/TimerDataManager.java | 5 +- .../jtimer/data/VetoableDataEventListener.java | 82 ++++-- .../org/chorem/jtimer/entities/TimerAlert.java | 13 +- .../java/org/chorem/jtimer/entities/TimerTask.java | 5 +- .../chorem/jtimer/entities/TimerTaskHelper.java | 52 ++-- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 309 +++++---------------- .../java/org/chorem/jtimer/io/GTimerTimeUtil.java | 13 +- .../jtimer/system/macos/ApplicationServices.java | 16 +- src/main/java/org/chorem/jtimer/ui/HelpFrame.java | 4 +- .../java/org/chorem/jtimer/ui/NewTaskView.java | 2 +- src/main/java/org/chorem/jtimer/ui/StatusBar.java | 92 +----- .../java/org/chorem/jtimer/ui/TimerTaskEditor.java | 20 +- .../chorem/jtimer/ui/alert/AlertCellEditor.java | 20 +- .../chorem/jtimer/ui/alert/AlertCellRenderer.java | 3 - .../org/chorem/jtimer/ui/alert/AlertEditor.java | 11 +- .../chorem/jtimer/ui/alert/AlertTableModel.java | 20 +- .../org/chorem/jtimer/ui/report/ReportUtils.java | 60 ++-- .../org/chorem/jtimer/ui/report/ReportView.java | 35 ++- .../chorem/jtimer/ui/systray/SystrayManager.java | 202 +------------- .../org/chorem/jtimer/ui/tasks/IdleDialog.java | 7 +- .../chorem/jtimer/ui/tasks/RefreshTreeTask.java | 6 +- .../org/chorem/jtimer/ui/tasks/RunTaskJob.java | 51 ++-- .../jtimer/ui/tree/CheckBoxTreeCellEditor.java | 10 +- .../jtimer/ui/treetable/ProjectsAndTasksModel.java | 99 +------ .../ProjectsAndTasksRunningCellRenderer.java | 123 -------- .../jtimer/ui/treetable/ProjectsAndTasksTable.java | 2 - .../ui/treetable/dnd/TimerTaskTranferable.java | 13 +- .../chorem/jtimer/ui/widget/DurationEditor.java | 6 +- .../chorem/jtimer/ui/widget/JPopupTrayIcon.java | 39 +-- .../org/chorem/jtimer/io/AbstractSaverTest.java | 13 +- .../jtimer/io/GTimerIncrementalSaverTest.java | 3 +- .../chorem/jtimer/utils/DailySortedMapTest.java | 6 +- 37 files changed, 390 insertions(+), 1218 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 develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit dd09cbdb8f5ac26d209ccd6d73796252c531e36b Author: CHRE <CHATELLIER@codelutin.com> Date: Wed Jun 8 12:27:17 2016 +0200 Update libs --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 083f8c2..bf4167d 100644 --- a/pom.xml +++ b/pom.xml @@ -273,13 +273,13 @@ <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> - <version>2.5</version> + <version>2.6</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-jcl</artifactId> - <version>2.5</version> + <version>2.6</version> <scope>runtime</scope> </dependency> <dependency> -- 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 develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit b8fe6a6b763859c83fd4840485c7082de4aef2e9 Author: CHRE <CHATELLIER@codelutin.com> Date: Wed Jun 8 13:15:03 2016 +0200 Code style and fix analysis --- src/main/java/org/chorem/jtimer/JTimerFactory.java | 4 +- .../org/chorem/jtimer/data/DataEventListener.java | 4 +- .../java/org/chorem/jtimer/data/TimerCore.java | 5 +- .../org/chorem/jtimer/data/TimerDataManager.java | 5 +- .../org/chorem/jtimer/entities/TimerAlert.java | 13 +- .../java/org/chorem/jtimer/entities/TimerTask.java | 5 +- .../chorem/jtimer/entities/TimerTaskHelper.java | 52 ++--- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 252 ++++++--------------- .../java/org/chorem/jtimer/io/GTimerTimeUtil.java | 13 +- .../jtimer/system/macos/ApplicationServices.java | 16 +- src/main/java/org/chorem/jtimer/ui/HelpFrame.java | 4 +- .../java/org/chorem/jtimer/ui/NewTaskView.java | 2 +- src/main/java/org/chorem/jtimer/ui/StatusBar.java | 52 +---- .../java/org/chorem/jtimer/ui/TimerTaskEditor.java | 20 +- .../chorem/jtimer/ui/alert/AlertCellEditor.java | 20 +- .../chorem/jtimer/ui/alert/AlertCellRenderer.java | 3 - .../org/chorem/jtimer/ui/alert/AlertEditor.java | 11 +- .../chorem/jtimer/ui/alert/AlertTableModel.java | 20 +- .../org/chorem/jtimer/ui/report/ReportUtils.java | 60 ++--- .../org/chorem/jtimer/ui/report/ReportView.java | 35 ++- .../chorem/jtimer/ui/systray/SystrayManager.java | 4 +- .../org/chorem/jtimer/ui/tasks/IdleDialog.java | 7 +- .../chorem/jtimer/ui/tasks/RefreshTreeTask.java | 6 +- .../org/chorem/jtimer/ui/tasks/RunTaskJob.java | 51 ++--- .../jtimer/ui/tree/CheckBoxTreeCellEditor.java | 10 +- .../jtimer/ui/treetable/ProjectsAndTasksModel.java | 79 +------ .../jtimer/ui/treetable/ProjectsAndTasksTable.java | 2 - .../ui/treetable/dnd/TimerTaskTranferable.java | 13 +- .../chorem/jtimer/ui/widget/DurationEditor.java | 6 +- .../chorem/jtimer/ui/widget/JPopupTrayIcon.java | 39 +--- .../org/chorem/jtimer/io/AbstractSaverTest.java | 13 +- .../jtimer/io/GTimerIncrementalSaverTest.java | 3 +- .../chorem/jtimer/utils/DailySortedMapTest.java | 6 +- 33 files changed, 225 insertions(+), 610 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimerFactory.java b/src/main/java/org/chorem/jtimer/JTimerFactory.java index 021a3eb..2a4392b 100644 --- a/src/main/java/org/chorem/jtimer/JTimerFactory.java +++ b/src/main/java/org/chorem/jtimer/JTimerFactory.java @@ -47,7 +47,7 @@ public class JTimerFactory { * Constructeur. */ protected JTimerFactory() { - // disable instanciation + // disable instantiation } /** @@ -77,7 +77,7 @@ public class JTimerFactory { } catch (InstantiationException e) { if (log.isErrorEnabled()) { - log.error("Can't instanciate class : " + saverClass, e); + log.error("Can't instantiate class : " + saverClass, e); } } catch (IllegalAccessException e) { if (log.isErrorEnabled()) { diff --git a/src/main/java/org/chorem/jtimer/data/DataEventListener.java b/src/main/java/org/chorem/jtimer/data/DataEventListener.java index 272dcfd..961b5df 100644 --- a/src/main/java/org/chorem/jtimer/data/DataEventListener.java +++ b/src/main/java/org/chorem/jtimer/data/DataEventListener.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -147,7 +147,7 @@ public interface DataEventListener extends EventListener { /** * Stop task. * - * @param task stoped task + * @param task stopped task */ void stopTask(TimerTask task); diff --git a/src/main/java/org/chorem/jtimer/data/TimerCore.java b/src/main/java/org/chorem/jtimer/data/TimerCore.java index 2234d9b..da6150a 100644 --- a/src/main/java/org/chorem/jtimer/data/TimerCore.java +++ b/src/main/java/org/chorem/jtimer/data/TimerCore.java @@ -23,7 +23,6 @@ package org.chorem.jtimer.data; import java.io.File; -import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -109,9 +108,7 @@ public class TimerCore { } // exclude internal backup directory from recursion - FileUtils.copyDirectory(oldDataDirectory, newDataDirectory, (FileFilter)pathName -> { - return !pathName.equals(oldBackupDirectory); - }); + FileUtils.copyDirectory(oldDataDirectory, newDataDirectory, pathName -> !pathName.equals(oldBackupDirectory)); } // migrate backup diff --git a/src/main/java/org/chorem/jtimer/data/TimerDataManager.java b/src/main/java/org/chorem/jtimer/data/TimerDataManager.java index 1afccff..25453c6 100644 --- a/src/main/java/org/chorem/jtimer/data/TimerDataManager.java +++ b/src/main/java/org/chorem/jtimer/data/TimerDataManager.java @@ -36,7 +36,6 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.jtimer.JTimer; -import org.chorem.jtimer.entities.TimerAlert; import org.chorem.jtimer.entities.TimerProject; import org.chorem.jtimer.entities.TimerTask; @@ -549,9 +548,7 @@ public class TimerDataManager { } // copy alerts - for (TimerAlert alert : otherTask.getAlerts()) { - destinationTask.addAlert(alert); - } + otherTask.getAlerts().forEach(destinationTask::addAlert); // finally otherTask still exist // empty, but still exist diff --git a/src/main/java/org/chorem/jtimer/entities/TimerAlert.java b/src/main/java/org/chorem/jtimer/entities/TimerAlert.java index 1220138..6eb2a7b 100644 --- a/src/main/java/org/chorem/jtimer/entities/TimerAlert.java +++ b/src/main/java/org/chorem/jtimer/entities/TimerAlert.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2009 - 2012 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -107,12 +107,9 @@ public class TimerAlert implements Serializable, Cloneable { this.duration = duration; } - /* - * @see java.lang.Object#clone() - */ @Override public TimerAlert clone() { - TimerAlert clone = null; + TimerAlert clone; try { clone = (TimerAlert)super.clone(); } catch (CloneNotSupportedException e) { @@ -121,9 +118,6 @@ public class TimerAlert implements Serializable, Cloneable { return clone; } - /* - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { int result = 1; @@ -132,9 +126,6 @@ public class TimerAlert implements Serializable, Cloneable { return result; } - /* - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(Object obj) { boolean result = false; diff --git a/src/main/java/org/chorem/jtimer/entities/TimerTask.java b/src/main/java/org/chorem/jtimer/entities/TimerTask.java index fd3e443..586baa8 100644 --- a/src/main/java/org/chorem/jtimer/entities/TimerTask.java +++ b/src/main/java/org/chorem/jtimer/entities/TimerTask.java @@ -93,7 +93,7 @@ public class TimerTask implements Cloneable, */ public TimerTask() { allDaysTimes = new DailySortedMap<>(); - // les annoation sont à la seconde pres + // les annotation sont à la seconde pres allDaysAnnotations = new TreeMap<>(); subTasks = new ArrayList<>(); alerts = new ArrayList<>(); @@ -333,9 +333,6 @@ public class TimerTask implements Cloneable, return result; } - /* - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(Object o) { diff --git a/src/main/java/org/chorem/jtimer/entities/TimerTaskHelper.java b/src/main/java/org/chorem/jtimer/entities/TimerTaskHelper.java index ded3a96..e6f8eb2 100644 --- a/src/main/java/org/chorem/jtimer/entities/TimerTaskHelper.java +++ b/src/main/java/org/chorem/jtimer/entities/TimerTaskHelper.java @@ -36,10 +36,10 @@ import java.util.TreeMap; /** * Helper to remove process code from entity - * + * * @author chatellier * @version $Revision$ - * + * * Last update : $Date$ By : $Author$ */ public class TimerTaskHelper { @@ -69,7 +69,7 @@ public class TimerTaskHelper { /** * Get tasks ordered alphabetically. - * + * * @param tasks tasks * @return {@code tasks} */ @@ -80,7 +80,7 @@ public class TimerTaskHelper { /** * Get total task time without subtasks time. - * + * * @param task task to get time * @return the alldays task time */ @@ -97,7 +97,7 @@ public class TimerTaskHelper { /** * Get total task time including subtasks total time. - * + * * @param task task to get time * @return the alldaysTime */ @@ -119,13 +119,13 @@ public class TimerTaskHelper { /** * Get time for specified date including subtasks time. - * + * * @param task task * @param date date for day * @return time in seconds */ public static long getTotalTime(TimerTask task, Date date) { - long result = 0L; + long result; // only task time result = task.getTime(date); @@ -140,7 +140,7 @@ public class TimerTaskHelper { /** * Get first date of timing for a task. - * + * * @param task task to find time * @return date */ @@ -158,7 +158,7 @@ public class TimerTaskHelper { /** * Get last date of timing for a task. - * + * * @param task task to find time * @return date */ @@ -176,9 +176,9 @@ public class TimerTaskHelper { /** * Return project associated to a task. - * + * * Explore recursively all parent. - * + * * @param task task * @return associated project */ @@ -194,10 +194,10 @@ public class TimerTaskHelper { /** * Build task path. - * + * * @param task task - * @return a list containing all ancestor task name (and task itself) - * ordered by ancestorness. + * @return a list containing all ancestor task name (and task itself) + * ordered by ancestorness. */ public static List<String> getTaskPath(TimerTask task) { List<String> result = new ArrayList<>(); @@ -212,11 +212,11 @@ public class TimerTaskHelper { /** * Get all annotations of the day. - * + * * @param date date * @param task the task - * - * @return all annotations of the specified day + * + * @return all annotations of the specified day */ public static Map<Date, String> getAnnotationMap(TimerTask task, Date date) { @@ -232,22 +232,20 @@ public class TimerTaskHelper { SortedMap<Date, String> annotations = new TreeMap<>(); - for (Date day : task.getAllDaysAnnotations().keySet()) { - if (day.compareTo(beginCal.getTime()) >= 0 - && day.compareTo(endCal.getTime()) < 0) { - annotations.put(day, task.getAllDaysAnnotations().get(day)); - } - } + task.getAllDaysAnnotations().keySet().stream().filter(day -> day.compareTo(beginCal.getTime()) >= 0 + && day.compareTo(endCal.getTime()) < 0).forEach(day -> + annotations.put(day, task.getAllDaysAnnotations().get(day)) + ); return annotations; } /** * Get all annotations of the day. - * + * * @param date date * @param task the task - * + * * @return annotation list */ public static List<String> getAnnotation(TimerTask task, Date date) { @@ -262,7 +260,7 @@ public class TimerTaskHelper { /** * Remove all annotations of the day. - * + * * @param task the task * @param date date */ @@ -290,7 +288,7 @@ public class TimerTaskHelper { /** * Check if task is present in tasks collection and recursive subtasks. - * + * * @param tasks task collection to search into * @param task task to search * @return {@code true} if task has been found diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index 0871e41..59d47dc 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -73,16 +73,16 @@ import org.chorem.jtimer.entities.TimerTask; /** * Charge et sauve les fichiers au format gTimer. - * + * * Le format de fichier utilisé ici est 1.2. => Format: 1.2 - * - * Changes: + * + * Changes: * - contrairement à la premiere version, ce Saver sauve les * projets/taches/annotations seulement si elles ont été modifiées. - * + * * @author chatellier * @version $Revision$ - * + * * Last update : $Date$ * By : $Author$ */ @@ -94,7 +94,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Separateur pour les sous taches. - * + * * Utilise pour assurer une compatibilite avec gTimer, qui ne permet pas de * stocker des sous taches. */ @@ -144,7 +144,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, protected long autoSaveDelay = 1000 * 60 * 5; // 5 min /** Running task list. */ - protected Collection<TimerTask> runningTasks; + protected final Collection<TimerTask> runningTasks; /** * Constructor. @@ -159,9 +159,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, autoSaveTimer = new Timer(); } - /* - * @see org.chorem.jtimer.io.Saver#setAutoSaveDelay(long) - */ @Override public void setAutoSaveDelay(long autoSaveDelay) { @@ -181,9 +178,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.io.Saver#lock() - */ @Override public void lock() throws DataLockingException { @@ -220,9 +214,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.io.Saver#unlock() - */ @Override public void unlock() throws DataLockingException { @@ -254,9 +245,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.io.Saver#load() - */ + @Override public Collection<TimerProject> load() { // be sure that directory exists @@ -271,7 +260,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Load from gtimer file format. - * + * * @return projects loaded */ protected Collection<TimerProject> gTimerLoad() { @@ -303,8 +292,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } catch (NumberFormatException e) { if (log.isWarnEnabled()) { - log.warn("Can't parse " + f.getName() - + " as gtimer file", e); + log.warn("Can't parse " + f.getName() + " as gtimer file", e); } } catch (IOException e) { if (log.isErrorEnabled()) { @@ -317,8 +305,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // loop 2 , reading tasks // task file "0.task" - pPatronNommage = Pattern.compile("^(\\d+)\\." + GTIMER_TASK_EXTENSION - + "$"); + pPatronNommage = Pattern.compile("^(\\d+)\\." + GTIMER_TASK_EXTENSION + "$"); // map to remember tasks to manage after load // sorted on / number in their name @@ -390,7 +377,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Load a project in his file. - * + * * @param projectFile project file * @return a project * @throws IOException if ioexception occurs @@ -403,18 +390,18 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, try (InputStream is = new BufferedInputStream(new FileInputStream(projectFile))) { Properties prop = new Properties(); prop.load(is); - + // log if (log.isDebugEnabled()) { log.debug("Load project (" + projectFile.getName() + ") : " + prop.getProperty("Name")); } - - + + if (GTIMER_FILE_VERSION.equals(prop.get("Format"))) { p = new TimerProject(); p.setName(prop.getProperty("Name")); - + // manage creation timestamp (conversion to long) try { String creationTimeStamp = prop.getProperty("Created"); @@ -426,7 +413,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } p.setCreationDate(new Date(0)); } - + p.setClosed(prop.getProperty("Options").equals("1")); } else { if (log.isWarnEnabled()) { @@ -441,7 +428,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Parse task file. - * + * * @param mapNumberProject map entre les projets reels et leur numero gtimer * @param taskFile gtimer task file * @param taskToManage sorted map to remember task to post process @@ -459,10 +446,10 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, try (InputStream is = new BufferedInputStream(new FileInputStream(taskFile))) { Properties prop = new Properties(); prop.load(is); - + if (GTIMER_FILE_VERSION.equals(prop.get("Format"))) { t = new TimerTask(); - + // manage creation timestamp (convertion to long) try { String creationTimeStamp = prop.getProperty("Created"); @@ -474,9 +461,9 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } t.setCreationDate(new Date(0)); } - + t.setClosed(prop.getProperty("Options").equals("1")); - + // name = task // name = task/subtask1 // name = task/subtask1/subsubtask1 @@ -484,16 +471,16 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, t.setName(gtimerTaskName); // yes put all names // will be corrected later - + // log if (log.isDebugEnabled()) { log.debug("Load task (" + taskFile.getName() + ") : " + gtimerTaskName); } - + // analyse des donnees (temps) for (Object key : prop.keySet()) { String sKey = (String) key; - + // test if key format match Matcher m = dataPattern.matcher(sKey); if (m.find()) { @@ -512,12 +499,12 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } // else not data entry } - + // find associated project instance with number String taskProjectNumber = (String) prop.get("Project"); TimerProject associatedProject = mapNumberProject .get(taskProjectNumber); - + // fix bug case task has no associated project // can do that in gtimer if (associatedProject == null && taskProjectNumber.equals("-1")) { @@ -525,12 +512,12 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, associatedProject.setName(GTIMER_EMPTY_PROJECT_NAME); mapNumberProject.put(taskProjectNumber, associatedProject); } - + if (associatedProject != null) { // used to correct bug #1636 : [jTimer] Bug du rechargement des // sous taches taskToManage.put(t, associatedProject); - + if (log.isDebugEnabled()) { log.debug("Put " + t.getName() + ", " + associatedProject.getName()); } @@ -540,7 +527,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, + " is associated with a wrong project number " + prop.get("Project")); } } - + } else { if (log.isWarnEnabled()) { log.warn("File " + taskFile + ": Invalid format. Excepted " + GTIMER_FILE_VERSION @@ -554,7 +541,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Try to find and load annotations from task. - * + * * @param task task to load annotations * @throws IOException if can't read ann file */ @@ -572,20 +559,20 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, try (InputStream is = new BufferedInputStream(new FileInputStream(annotationsTaskFile))) { Properties prop = new Properties(); prop.load(is); - + // analyse des donnees (temps) for (Object key : prop.keySet()) { String sKey = (String) key; - + // test if key format match try { - + // key of annotation is in seconds long timestamp = Long.parseLong(sKey); Date dateTS = new Date(timestamp * 1000); - + String annoText = (String) prop.get(sKey); - + task.addAnnotation(dateTS, annoText); } catch (NumberFormatException e) { if (log.isErrorEnabled()) { @@ -599,10 +586,10 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Find task alert and load it. - * + * * This file can't be loaded by {@code Properties#load(java.io.InputStream)}. * Constains duplicated keys. - * + * * @param task task to load alert * @throws IOException if can't read ann file */ @@ -622,13 +609,13 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // skip first line : "format: 1.2" String line = alertIn.readLine(); while ((line = alertIn.readLine()) != null) { - + line = line.trim(); if (!line.isEmpty()) { String alertType = line.substring(0, line.indexOf(' ')); String alertDuration = line.substring( line.indexOf(' ') + 1, line.length()); - + try { if ("reachtotaltime".equals(alertType)) { Long duration = Long.parseLong(alertDuration) * 1000; @@ -659,7 +646,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Post process task to manage subtask loaded before parent task. - * + * * @param taskToManage sorted map of those task */ protected void parseTaskFromSavedMap( @@ -716,7 +703,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Find a task in task's subtask - * + * * @param parentTask task * @param taskNames names * @return a task or <tt>null</tt> @@ -741,9 +728,9 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * For development. - * + * * Save gtimer files (because project collection is sometimes erased) - * + * * @return success flag fro creating backup */ protected boolean backupGTimerFiles() { @@ -787,13 +774,13 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, try (FileInputStream inFileStream = new FileInputStream(fileInIt)) { outZip.putNextEntry(new ZipEntry(filename)); - + // Transfer bytes from the file to the ZIP file int len; while ((len = inFileStream.read(buffer)) > 0) { outZip.write(buffer, 0, len); } - + // Complete the entry outZip.closeEntry(); } @@ -844,9 +831,9 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Check if a file denoted by his name is a gtimer file. - * + * * Check that the name end with .project, .task or .ann - * + * * @param filename filename * @return answer */ @@ -865,7 +852,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Save a unique project. - * + * * @param project project to save */ protected void saveProject(TimerProject project) { @@ -916,9 +903,9 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Save task, found correct prefix, and project. - * + * * Then call {@link #saveTask(TimerTask, int, String)} - * + * * @param task task to save */ protected void saveTask(TimerTask task) { @@ -944,11 +931,11 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Save a task. - * + * * taskPrefixName represents the task prefix is case, it is represented in * jTimer as a subtask. It is saved in gTimer format in a new task, which * name is composed of parents task name. - * + * * @param task task to save * @param associatedToProject associated project number * @param taskPrefixName task prefix name @@ -984,7 +971,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // encode it to iso-8859-1, because props.load() use this encoding try (Writer out = new OutputStreamWriter(new FileOutputStream(taskfile), "ISO-8859-1")) { - + // first make backup backupfile = makeBackupFile(taskfile); @@ -1035,7 +1022,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Save annotation for a task. - * + * * @param task task to save annotation */ protected void saveTaskAnnotation(TimerTask task) { @@ -1083,7 +1070,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Save task alerts. - * + * * @param task task to save alert */ protected void saveAlerts(TimerTask task) { @@ -1136,9 +1123,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void addProject(TimerProject project) { @@ -1154,14 +1138,9 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, saveProject(project); // loop on subtasks to set correct task number (only on add) - for (TimerTask subtask : project.getSubTasks()) { - addTask(subtask); - } + project.getSubTasks().forEach(this::addTask); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void addTask(TimerTask task) { @@ -1177,16 +1156,14 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, saveTask(task); // loop on subtasks to set correct task number (only on add) - for (TimerTask subtask : task.getSubTasks()) { - addTask(subtask); - } + task.getSubTasks().forEach(this::addTask); } /** * Explore directory and find a non used number for project. - * + * * @param extension to check (ie ".project" or ".task") - * + * * @return a non used project number */ protected int getUnusedNumber(String extension) { @@ -1194,7 +1171,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // init -1, ++ start with 0 int foundProjectNumber = -1; - File aGtimerFile = null; + File aGtimerFile; // en esperant que sera pas infini :) do { @@ -1206,25 +1183,16 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, return foundProjectNumber; } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#dataLoaded(java.util.Collection) - */ @Override public void dataLoaded(Collection<TimerProject> projects) { // do nothing } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void deleteProject(TimerProject project) { deleteTaskOrProject(project, GTIMER_PROJECT_EXTENSION); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void deleteTask(TimerTask task) { deleteTaskOrProject(task, GTIMER_TASK_EXTENSION); @@ -1232,7 +1200,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Delete associated file or project files on disk. - * + * * @param taskOrProject task or project to delete file * @param extension extension without . */ @@ -1288,17 +1256,11 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void modifyProject(TimerProject project) { saveProject(project); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void modifyTask(TimerTask task) { @@ -1319,22 +1281,14 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // fix a bug with the gtimer subtask // save format du to composed task name // subtasks have to be resaved - for (TimerTask subtask : task.getSubTasks()) { - modifyTask(subtask); - } + task.getSubTasks().forEach(this::modifyTask); } - /* - * @see org.chorem.jtimer.event.DataEventListener#setAnnotation(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.String) - */ @Override public void setAnnotation(TimerTask task, Date date, String annotation) { saveTaskAnnotation(task); } - /* - * @see org.chorem.jtimer.event.DataEventListener#setTaskTime(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.Long) - */ @Override public void setTaskTime(TimerTask task, Date date, Long time) { // ne sauve la tache que si elle n'est pas @@ -1344,9 +1298,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#changeClosedState(org.chorem.jtimer.entities.TimerTask) - */ @Override public void changeClosedState(TimerTask task) { if (task instanceof TimerProject) { @@ -1360,9 +1311,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#preMoveTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void preMoveTask(TimerTask task) { if (log.isDebugEnabled()) { @@ -1370,9 +1318,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#postMoveTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void moveTask(TimerTask task) { @@ -1383,12 +1328,8 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, modifyTask(task); } - /* - * @see org.chorem.jtimer.data.DataEventListener#postMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ @Override - public void postMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { + public void postMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { // destination task need to be updated modifyTask(destinationTask); @@ -1401,18 +1342,11 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // some otherTasks subtasks must be deleted too } - /* - * @see org.chorem.jtimer.data.DataEventListener#preMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ @Override - public void preMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { + public void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#startTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void startTask(TimerTask task) { @@ -1424,9 +1358,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#stopTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void stopTask(TimerTask task) { @@ -1439,9 +1370,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, saveTask(task); } - /* - * @see java.util.TimerTask#run() - */ @Override public void run() { @@ -1456,34 +1384,21 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, * Save runing tasks. */ protected void saveRunningTasks() { - synchronized (runningTasks) { - - for (TimerTask task : runningTasks) { - saveTask(task); - } + runningTasks.forEach(this::saveTask); } } - /* - * {@inheritDoc} - */ @Override public void checkSetAnnotation(TimerTask task, Date date, String value) { } - /* - * {@inheritDoc} - */ @Override public void checkAddProject(TimerProject project) { checkName(project); } - /* - * {@inheritDoc} - */ @Override public void checkAddTask(TimerTask parent, TimerTask task) { checkName(task); @@ -1491,85 +1406,58 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, /** * Check task name. - * + * * @param task task to check */ protected void checkName(TimerTask task) { String name = task.getName(); if (name.trim().length() <= 0) { - throw new DataViolationException("Can't add task", - "vetoable.saver.empty.name"); + throw new DataViolationException("Can't add task", "vetoable.saver.empty.name"); } if (name.contains(GTIMER_SUBTASK_SEPARATOR)) { - throw new DataViolationException("Can't add task", - "vetoable.saver.invalid.characters"); + throw new DataViolationException("Can't add task", "vetoable.saver.invalid.characters"); } } - /* - * {@inheritDoc} - */ @Override public void checkChangeClosedState(TimerTask task) { } - /* - * {@inheritDoc} - */ @Override public void checkDeleteProject(TimerProject project) { } - /* - * {@inheritDoc} - */ @Override public void checkDeleteTask(TimerTask task) { } - /* - * {@inheritDoc} - */ @Override public void checkModifyProject(TimerProject project) { } - /* - * {@inheritDoc} - */ @Override public void checkModifyTask(TimerTask task) { checkName(task); } - /* - * {@inheritDoc} - */ @Override public void checkMoveTask(TimerTask destination, Collection<TimerTask> tasksToMove) { } - /* - * {@inheritDoc} - */ @Override public void checkSetTaskTime(TimerTask task, Date date, Long value) { } - /* - * {@inheritDoc} - */ @Override - public void checkMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { + public void checkMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { } } diff --git a/src/main/java/org/chorem/jtimer/io/GTimerTimeUtil.java b/src/main/java/org/chorem/jtimer/io/GTimerTimeUtil.java index 32686c6..feb8937 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerTimeUtil.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerTimeUtil.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -44,8 +44,7 @@ public class GTimerTimeUtil { private static Log log = LogFactory.getLog(GTimerTimeUtil.class); /** gtimer day string date format */ - protected static final DateFormat GTIMERDATEFORMAT = new SimpleDateFormat( - "yyyyMMdd"); + protected static final DateFormat GTIMERDATEFORMAT = new SimpleDateFormat("yyyyMMdd"); /** * Protected constructor. @@ -64,7 +63,7 @@ public class GTimerTimeUtil { public static Date yyyyMMdd2Date(String dateAsString) { int year, mouth, day; - Date date = null; + Date date; try { String syear = dateAsString.substring(0, 4); @@ -83,11 +82,9 @@ public class GTimerTimeUtil { date = calendar.getTime(); } catch (NumberFormatException e) { if (log.isWarnEnabled()) { - log.warn("Can't parse string " + dateAsString + " in yyyyMMdd format", - e); + log.warn("Can't parse string " + dateAsString + " in yyyyMMdd format", e); } - throw new IllegalArgumentException("Can't parse string " + dateAsString - + " in yyyyMMdd format", e); + throw new IllegalArgumentException("Can't parse string " + dateAsString + " in yyyyMMdd format", e); } return date; diff --git a/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java b/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java index be75e66..a195034 100644 --- a/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java +++ b/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java @@ -27,27 +27,22 @@ import com.sun.jna.Native; /** * Quartz 2D API. - * + * * @author chatellier * @version $Revision$ * @since 1.3.2 - * + * * Last update : $Date$ * By : $Author: chatellier $ */ public interface ApplicationServices extends Library { - ApplicationServices INSTANCE = (ApplicationServices) Native.loadLibrary( - "ApplicationServices", ApplicationServices.class); + ApplicationServices INSTANCE = (ApplicationServices) Native.loadLibrary("ApplicationServices", ApplicationServices.class); /** Constants that specify an input event. */ int kCGAnyInputEventType = -1; - /** Specifies that an event source should use a private event state table. */ - int kCGEventSourceStatePrivate = -1; /** Specifies that an event source should use the event state table that reflects the combined state of all event sources posting to the current user login session. */ int kCGEventSourceStateCombinedSessionState = 0; - /** Specifies that an event source should use the event state table that reflects the combined state of all hardware event sources posting from the HID system. */ - int kCGEventSourceStateHIDSystemState = 1; /** * Returns the elapsed time since the last event for a Quartz event source. @@ -55,9 +50,8 @@ public interface ApplicationServices extends Library { * @param sourceStateId The source state to access * @param eventType The event type to access * @return the time in seconds since the previous input event of the specified type - * + * * @see <a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventSourceSecondsSinceLastEventType">Quartz API</a> */ - double CGEventSourceSecondsSinceLastEventType(int sourceStateId, - int eventType); + double CGEventSourceSecondsSinceLastEventType(int sourceStateId, int eventType); } diff --git a/src/main/java/org/chorem/jtimer/ui/HelpFrame.java b/src/main/java/org/chorem/jtimer/ui/HelpFrame.java index 070a19e..44c3009 100644 --- a/src/main/java/org/chorem/jtimer/ui/HelpFrame.java +++ b/src/main/java/org/chorem/jtimer/ui/HelpFrame.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -185,7 +185,7 @@ public class HelpFrame extends FrameView implements HyperlinkListener { } } catch (UnsupportedOperationException e) { if (log.isWarnEnabled()) { - log.warn("Cannot open link (maybe defaut browser in not configured ?)"); + log.warn("Cannot open link (maybe default browser in not configured ?)"); } if (log.isDebugEnabled()) { log.debug("Error while opening link", e); diff --git a/src/main/java/org/chorem/jtimer/ui/NewTaskView.java b/src/main/java/org/chorem/jtimer/ui/NewTaskView.java index 915430c..17be9cd 100644 --- a/src/main/java/org/chorem/jtimer/ui/NewTaskView.java +++ b/src/main/java/org/chorem/jtimer/ui/NewTaskView.java @@ -75,7 +75,7 @@ public class NewTaskView extends DialogView { actionMap = parent.getContext().getActionMap(this); // modify frame name - // otherwise, get parent frame dimention + // otherwise, get parent frame dimension getDialog().setName("newTask"); getDialog().setTitle(getResourceMap().getString("newTaskTitle")); diff --git a/src/main/java/org/chorem/jtimer/ui/StatusBar.java b/src/main/java/org/chorem/jtimer/ui/StatusBar.java index 99ff3d3..8a86311 100644 --- a/src/main/java/org/chorem/jtimer/ui/StatusBar.java +++ b/src/main/java/org/chorem/jtimer/ui/StatusBar.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2007 - 2012 CodeLutin, Chatellier Eric + * Copyright (C) 2007 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -118,27 +118,18 @@ public class StatusBar extends JPanel implements DataEventListener { .formatDuration(duration, "HH:mm:ss"))); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void addProject(TimerProject project) { // can happen for synchronized project updateTodayTime(); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void addTask(TimerTask task) { // can happen for synchronized project updateTodayTime(); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#dataLoaded(java.util.Collection) - */ @Override public void dataLoaded(Collection<TimerProject> projects) { lblMessage.setText(resourceMap.getString("idleMessage")); @@ -147,74 +138,47 @@ public class StatusBar extends JPanel implements DataEventListener { modifyTask(null); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void deleteProject(TimerProject project) { updateTodayTime(); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void deleteTask(TimerTask task) { updateTodayTime(); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void modifyProject(TimerProject project) { } - /* - * @see org.chorem.jtimer.event.DataEventListener#setTaskTime(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.Long) - */ @Override public void setTaskTime(TimerTask task, Date date, Long time) { modifyTask(task); } - /* - * @see org.chorem.jtimer.event.DataEventListener#setAnnotation(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.String) - */ @Override public void setAnnotation(TimerTask task, Date date, String annotation) { } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void modifyTask(TimerTask task) { updateTodayTime(); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#changeClosedState(org.chorem.jtimer.entities.TimerTask) - */ @Override public void changeClosedState(TimerTask task) { } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#startTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void startTask(TimerTask task) { startStopTask(task, true); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#stopTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void stopTask(TimerTask task) { startStopTask(task, false); @@ -237,7 +201,7 @@ public class StatusBar extends JPanel implements DataEventListener { } // display message - String message = null; + String message; if (nbTasksRunning == 0) { message = resourceMap.getString("idleMessage"); } else { @@ -250,34 +214,22 @@ public class StatusBar extends JPanel implements DataEventListener { lblMessage.setText(message); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#postMoveTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void moveTask(TimerTask task) { } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#preMoveTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void preMoveTask(TimerTask task) { } - /* - * @see org.chorem.jtimer.data.DataEventListener#postMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ @Override public void postMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { } - /* - * @see org.chorem.jtimer.data.DataEventListener#preMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ @Override public void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { diff --git a/src/main/java/org/chorem/jtimer/ui/TimerTaskEditor.java b/src/main/java/org/chorem/jtimer/ui/TimerTaskEditor.java index 633a5fc..8ecfbb0 100644 --- a/src/main/java/org/chorem/jtimer/ui/TimerTaskEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/TimerTaskEditor.java @@ -26,7 +26,6 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridLayout; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashSet; @@ -34,6 +33,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; +import java.util.stream.Collectors; import javax.swing.ActionMap; import javax.swing.JButton; @@ -170,9 +170,9 @@ public class TimerTaskEditor extends DialogView { updateFlaggedDates(); // display last selectable day tasktime and annotation - Calendar yesterDay = Calendar.getInstance(); - yesterDay.add(Calendar.DAY_OF_YEAR, -1); - setSelectedDay(yesterDay.getTime()); + Calendar yesterday = Calendar.getInstance(); + yesterday.add(Calendar.DAY_OF_YEAR, -1); + setSelectedDay(yesterday.getTime()); } /** @@ -582,16 +582,8 @@ public class TimerTaskEditor extends DialogView { * flag calendar days according to tasktime */ public void updateFlaggedDates() { - List<Date> dates = new ArrayList<>(); - - for (Date date : cloneTask.getAllDaysAndTimes().keySet()) { - if (cloneTask.getTime(date) > 0) { - dates.add(date); - } - } - for (Date date : cloneTask.getAllDaysAnnotations().keySet()) { - dates.add(date); - } + List<Date> dates = cloneTask.getAllDaysAndTimes().keySet().stream().filter(date -> cloneTask.getTime(date) > 0).collect(Collectors.toList()); + dates.addAll(cloneTask.getAllDaysAnnotations().keySet()); monthView.setFlaggedDates(dates.toArray(new Date[dates.size()])); } diff --git a/src/main/java/org/chorem/jtimer/ui/alert/AlertCellEditor.java b/src/main/java/org/chorem/jtimer/ui/alert/AlertCellEditor.java index cabe6c5..e2271e2 100644 --- a/src/main/java/org/chorem/jtimer/ui/alert/AlertCellEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/alert/AlertCellEditor.java @@ -53,15 +53,6 @@ public class AlertCellEditor extends AbstractCellEditor implements TableCellEdit /** Current editor. */ protected Component editor; - /** - */ - public AlertCellEditor() { - //super(new JTextField()); - } - - /* - * @see javax.swing.CellEditor#getCellEditorValue() - */ @Override public Object getCellEditorValue() { @@ -75,9 +66,6 @@ public class AlertCellEditor extends AbstractCellEditor implements TableCellEdit return value; } - /* - * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) - */ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { @@ -105,7 +93,7 @@ public class AlertCellEditor extends AbstractCellEditor implements TableCellEdit break; } - // restore supercomponent properties + // restore super component properties if (isSelected) { editor.setBackground(table.getSelectionBackground()); } @@ -113,17 +101,11 @@ public class AlertCellEditor extends AbstractCellEditor implements TableCellEdit return editor; } - /* - * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) - */ @Override public void itemStateChanged(ItemEvent e) { stopCellEditing(); } - /* - * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) - */ @Override public void propertyChange(PropertyChangeEvent evt) { stopCellEditing(); diff --git a/src/main/java/org/chorem/jtimer/ui/alert/AlertCellRenderer.java b/src/main/java/org/chorem/jtimer/ui/alert/AlertCellRenderer.java index 9cd129f..2e1103c 100644 --- a/src/main/java/org/chorem/jtimer/ui/alert/AlertCellRenderer.java +++ b/src/main/java/org/chorem/jtimer/ui/alert/AlertCellRenderer.java @@ -45,9 +45,6 @@ public class AlertCellRenderer extends DefaultTableCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -363052829182024180L; - /* - * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) - */ @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { diff --git a/src/main/java/org/chorem/jtimer/ui/alert/AlertEditor.java b/src/main/java/org/chorem/jtimer/ui/alert/AlertEditor.java index 9b6a79d..4a905bc 100644 --- a/src/main/java/org/chorem/jtimer/ui/alert/AlertEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/alert/AlertEditor.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2009 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,6 +27,7 @@ import java.awt.GridBagLayout; import java.awt.Insets; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import javax.swing.JButton; import javax.swing.JComponent; @@ -89,10 +90,7 @@ public class AlertEditor extends FrameView implements ListSelectionListener { this.timerDataManager = timerDataManager; // build a new editing list for alerts - alerts = new ArrayList<>(); - for (TimerAlert alert : task.getAlerts()) { - alerts.add(alert.clone()); - } + alerts = task.getAlerts().stream().map(TimerAlert::clone).collect(Collectors.toList()); // rename frame to get proper position getFrame().setName("alertFrame"); @@ -215,9 +213,6 @@ public class AlertEditor extends FrameView implements ListSelectionListener { getApplication().hide(this); } - /* - * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) - */ @Override public void valueChanged(ListSelectionEvent e) { // used to update remove button property diff --git a/src/main/java/org/chorem/jtimer/ui/alert/AlertTableModel.java b/src/main/java/org/chorem/jtimer/ui/alert/AlertTableModel.java index 01c3e9b..ddf617d 100644 --- a/src/main/java/org/chorem/jtimer/ui/alert/AlertTableModel.java +++ b/src/main/java/org/chorem/jtimer/ui/alert/AlertTableModel.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2009 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -60,17 +60,11 @@ public class AlertTableModel extends AbstractTableModel { this.columnIdentifiers = columnIdentifiers; } - /* - * @see javax.swing.table.TableModel#getColumnCount() - */ @Override public int getColumnCount() { return 2; } - /* - * @see javax.swing.table.AbstractTableModel#getColumnName(int) - */ @Override public String getColumnName(int column) { @@ -78,17 +72,11 @@ public class AlertTableModel extends AbstractTableModel { return columnName; } - /* - * @see javax.swing.table.TableModel#getRowCount() - */ @Override public int getRowCount() { return alerts.size(); } - /* - * @see javax.swing.table.TableModel#getValueAt(int, int) - */ @Override public Object getValueAt(int rowIndex, int columnIndex) { @@ -112,9 +100,6 @@ public class AlertTableModel extends AbstractTableModel { return result; } - /* - * @see javax.swing.table.AbstractTableModel#setValueAt(java.lang.Object, int, int) - */ @Override public void setValueAt(Object value, int rowIndex, int columnIndex) { TimerAlert alert = alerts.get(rowIndex); @@ -135,9 +120,6 @@ public class AlertTableModel extends AbstractTableModel { } } - /* - * @see javax.swing.table.AbstractTableModel#isCellEditable(int, int) - */ @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return true; diff --git a/src/main/java/org/chorem/jtimer/ui/report/ReportUtils.java b/src/main/java/org/chorem/jtimer/ui/report/ReportUtils.java index e96063e..47bbcc3 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/ReportUtils.java +++ b/src/main/java/org/chorem/jtimer/ui/report/ReportUtils.java @@ -430,8 +430,6 @@ public class ReportUtils { */ public Map<Date, String> getWeeklyTaskAnnotation(TimerTask task, Date week, Date fromDay, Date toDay) { - - Map<Date, String> result = new HashMap<>(); Calendar beginPeriodDate = Calendar.getInstance(); beginPeriodDate.setTime(week); @@ -442,22 +440,7 @@ public class ReportUtils { endPeriodDate.add(Calendar.WEEK_OF_YEAR, 1); endPeriodDate.add(Calendar.DAY_OF_YEAR, -1); // take the day before - Calendar loopPeriodDate = beginPeriodDate; - - while (loopPeriodDate.compareTo(endPeriodDate) <= 0) { - - if ((fromDay == null || fromDay.compareTo(loopPeriodDate.getTime()) <= 0) - && (toDay == null || toDay.compareTo(loopPeriodDate - .getTime()) >= 0)) { - Map<Date, String> anns = TimerTaskHelper - .getAnnotationMap(task, loopPeriodDate.getTime()); - result.putAll(anns); - } - - loopPeriodDate.add(Calendar.DAY_OF_YEAR, 1); - } - - return result; + return getPeriodTaskAnnotation(task, beginPeriodDate, endPeriodDate, fromDay, toDay); } /** @@ -473,7 +456,6 @@ public class ReportUtils { */ public Map<Date, String> getMonthlyTaskAnnotation(TimerTask task, Date month, Date fromDay, Date toDay) { - Map<Date, String> result = new HashMap<>(); Calendar beginPeriodDate = Calendar.getInstance(); beginPeriodDate.setTime(month); @@ -483,22 +465,7 @@ public class ReportUtils { endPeriodDate.add(Calendar.MONTH, 1); endPeriodDate.add(Calendar.DAY_OF_YEAR, -1); // take the day before - Calendar loopPeriodDate = beginPeriodDate; - - while (loopPeriodDate.compareTo(endPeriodDate) <= 0) { - - if ((fromDay == null || fromDay.compareTo(loopPeriodDate.getTime()) <= 0) - && (toDay == null || toDay.compareTo(loopPeriodDate - .getTime()) >= 0)) { - Map<Date, String> anns = TimerTaskHelper - .getAnnotationMap(task, loopPeriodDate.getTime()); - result.putAll(anns); - } - - loopPeriodDate.add(Calendar.DAY_OF_YEAR, 1); - } - - return result; + return getPeriodTaskAnnotation(task, beginPeriodDate, endPeriodDate, fromDay, toDay); } /** @@ -514,8 +481,6 @@ public class ReportUtils { */ public Map<Date, String> getYearlyTaskAnnotation(TimerTask task, Date year, Date fromDay, Date toDay) { - - Map<Date, String> result = new HashMap<>(); Calendar beginPeriodDate = Calendar.getInstance(); beginPeriodDate.setTime(year); @@ -526,15 +491,30 @@ public class ReportUtils { endPeriodDate.add(Calendar.YEAR, 1); endPeriodDate.add(Calendar.DAY_OF_YEAR, -1); // take the day before - Calendar loopPeriodDate = beginPeriodDate; + return getPeriodTaskAnnotation(task, beginPeriodDate, endPeriodDate, fromDay, toDay); + } + + /** + * Get task annotations for a period. + * + * @param task task + * @param beginPeriodDate begin period calendar + * @param endPeriodDate end period calendar + * @param fromDay from day (inclusive) + * @param toDay to day (inclusive) + * @return annotations of the year + */ + protected Map<Date, String> getPeriodTaskAnnotation(TimerTask task, Calendar beginPeriodDate, Calendar endPeriodDate, Date fromDay, Date toDay) { + Map<Date, String> result = new HashMap<>(); + Calendar loopPeriodDate = beginPeriodDate; while (loopPeriodDate.compareTo(endPeriodDate) <= 0) { if ((fromDay == null || fromDay.compareTo(loopPeriodDate.getTime()) <= 0) && (toDay == null || toDay.compareTo(loopPeriodDate - .getTime()) >= 0)) { + .getTime()) >= 0)) { Map<Date, String> anns = TimerTaskHelper - .getAnnotationMap(task, loopPeriodDate.getTime()); + .getAnnotationMap(task, loopPeriodDate.getTime()); result.putAll(anns); } diff --git a/src/main/java/org/chorem/jtimer/ui/report/ReportView.java b/src/main/java/org/chorem/jtimer/ui/report/ReportView.java index a34bad6..62ec1e8 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/ReportView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/ReportView.java @@ -144,7 +144,7 @@ public class ReportView extends FrameView implements DocumentListener { super(application); // modify frame name - // otherwise, get parent frame dimention + // otherwise, get parent frame dimension getFrame().setName("reportFrame"); getFrame().setTitle(getResourceMap().getString("reportTitle")); @@ -361,7 +361,7 @@ public class ReportView extends FrameView implements DocumentListener { calendarEnd.add(Calendar.WEEK_OF_YEAR, 1); calendarEnd.add(Calendar.DAY_OF_YEAR, -1); // take the day before - // apply delai + // apply delay calendarBegin.add(Calendar.WEEK_OF_YEAR, delay); calendarEnd.add(Calendar.WEEK_OF_YEAR, delay); @@ -394,7 +394,7 @@ public class ReportView extends FrameView implements DocumentListener { public void generateReport() { // Choose selected project type - Type reportType = null; + Type reportType; if (radioByDay.isSelected()) { reportType = Type.BY_DAY_REPORT; } else if (radioByMonth.isSelected()) { @@ -435,23 +435,20 @@ public class ReportView extends FrameView implements DocumentListener { List<TimerProject> projects, Collection<TimerTask> uncheckedTaskList) { List<TimerProject> currentProjects = new ArrayList<>(); - for (TimerProject project : projects) { - - // take care of show closed option - if (!project.isClosed() || showHiddenProjectBox.isSelected()) { - List<TimerTask> subTasks = getSelectedTasks(project.getSubTasks(), - uncheckedTaskList); - - // add current project only of at least one subtask is selected - // or current project is selected - if (!uncheckedTaskList.contains(project) || !subTasks.isEmpty()) { - TimerProject clonedProject = project.clone(); - clonedProject.getSubTasks().clear(); - clonedProject.getSubTasks().addAll(subTasks); - currentProjects.add(clonedProject); - } + // take care of show closed option + projects.stream().filter(project -> !project.isClosed() || showHiddenProjectBox.isSelected()).forEach(project -> { + List<TimerTask> subTasks = getSelectedTasks(project.getSubTasks(), + uncheckedTaskList); + + // add current project only of at least one subtask is selected + // or current project is selected + if (!uncheckedTaskList.contains(project) || !subTasks.isEmpty()) { + TimerProject clonedProject = project.clone(); + clonedProject.getSubTasks().clear(); + clonedProject.getSubTasks().addAll(subTasks); + currentProjects.add(clonedProject); } - } + }); return currentProjects; } diff --git a/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java b/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java index 4a5b5f3..c3fc5f8 100644 --- a/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java +++ b/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -295,7 +295,7 @@ public class SystrayManager implements ActionListener, DataEventListener, --nbTasksRunning; } - String message = null; + String message; if (nbTasksRunning == 0) { message = resourceMap.getString("tooltipIdleText"); diff --git a/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java b/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java index 85671df..c9c6881 100644 --- a/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java +++ b/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java @@ -37,7 +37,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JToggleButton; -import javax.swing.JTree; import javax.swing.SwingConstants; import javax.swing.WindowConstants; import javax.swing.tree.TreePath; @@ -85,7 +84,7 @@ public class IdleDialog extends JDialog { private static final long serialVersionUID = 7669429291708466753L; /** Dialog response type. */ - public static enum IdleOption { + public enum IdleOption { REVERT, CONTINUE, RESUME, ASSIGN } @@ -93,7 +92,7 @@ public class IdleDialog extends JDialog { private static Log log = LogFactory.getLog(IdleDialog.class); /** Mutex object (multiples running tasks are waiting on it) */ - protected static Object mutex = new Object(); + protected static final Object mutex = new Object(); /** Singleton dialog instance. */ protected static IdleDialog idleDialog; @@ -440,7 +439,7 @@ public class IdleDialog extends JDialog { // only the first call must display dialog // (can happen if multiples task are running) - boolean mustShow = false; + boolean mustShow; synchronized (idleDialog) { mustShow = !idleDialog.isVisible(); } diff --git a/src/main/java/org/chorem/jtimer/ui/tasks/RefreshTreeTask.java b/src/main/java/org/chorem/jtimer/ui/tasks/RefreshTreeTask.java index 08b48ab..3cde04a 100644 --- a/src/main/java/org/chorem/jtimer/ui/tasks/RefreshTreeTask.java +++ b/src/main/java/org/chorem/jtimer/ui/tasks/RefreshTreeTask.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -83,13 +83,13 @@ public class RefreshTreeTask extends java.util.TimerTask { for (TimerTask task : tasks) { - // first refresk sub tasks + // first refresh sub tasks refreshTasks(task.getSubTasks()); // fire event Date now = new Date(); // TODO find a better way to do that ! - // Only useflull for UI listeners + // Only useful for UI listeners dataManager.changeTaskTime(task, now, task.getTime(now)); } } diff --git a/src/main/java/org/chorem/jtimer/ui/tasks/RunTaskJob.java b/src/main/java/org/chorem/jtimer/ui/tasks/RunTaskJob.java index d458691..1c3414b 100644 --- a/src/main/java/org/chorem/jtimer/ui/tasks/RunTaskJob.java +++ b/src/main/java/org/chorem/jtimer/ui/tasks/RunTaskJob.java @@ -26,7 +26,6 @@ import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.HashSet; -import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; @@ -74,16 +73,16 @@ public class RunTaskJob extends Task<Void, Void> { protected TimerDataManager dataManager; /** System information (idle...). */ - protected Optional<SystemInfo> systemInfo; + protected SystemInfo systemInfo; /** Already thrown alert. */ - protected Collection<TimerAlert> alreadyTrownAlerts; + protected Collection<TimerAlert> alreadyThrownAlerts; /** Last publish time to detect hibernate. */ protected AtomicLong lastUserActivity; /** Want to stop flag. */ - protected AtomicBoolean bWantToStop; + protected final AtomicBoolean bWantToStop; /** * Constructor. @@ -107,11 +106,11 @@ public class RunTaskJob extends Task<Void, Void> { this.dataManager = dataManager; // must be init here, checkAlreadyThrownAlerts is called multiples times - alreadyTrownAlerts = new HashSet<>(); + alreadyThrownAlerts = new HashSet<>(); checkAlreadyThrownAlerts(managedTask); // init system info to get idleTime - systemInfo = SystemInfoFactory.getSystemInfo(); + systemInfo = SystemInfoFactory.getSystemInfo().orElse(null); } /** @@ -130,11 +129,11 @@ public class RunTaskJob extends Task<Void, Void> { if (alert.getType().equals(Type.REACH_DAILY_TIME) && TimerTaskHelper.getTotalTime(task, now) > alert .getDuration()) { - alreadyTrownAlerts.add(alert.clone()); + alreadyThrownAlerts.add(alert.clone()); } else if (alert.getType().equals(Type.REACH_TOTAL_TIME) && TimerTaskHelper.getAllTotalTime(task) > alert .getDuration()) { - alreadyTrownAlerts.add(alert.clone()); + alreadyThrownAlerts.add(alert.clone()); } } @@ -185,8 +184,8 @@ public class RunTaskJob extends Task<Void, Void> { // check user idle time long idleTime = 0; - if (systemInfo.isPresent()) { // idle time available - idleTime = systemInfo.get().getIdleTime(); + if (systemInfo != null) { // idle time available + idleTime = systemInfo.getIdleTime(); if (log.isDebugEnabled()) { log.debug("User is idle since " + (idleTime / 1000) + " s"); @@ -207,7 +206,7 @@ public class RunTaskJob extends Task<Void, Void> { parentApplication.postIdleDetect(); // restart timing from current time after idle - // mandadory call, otherwise, next iteration will display idle + // mandatory call, otherwise, next iteration will display idle // dialog again oldUserActivity = lastUserActivity.getAndSet(System.currentTimeMillis()); delta = lastUserActivity.get() - oldUserActivity; @@ -301,23 +300,21 @@ public class RunTaskJob extends Task<Void, Void> { Date now = new Date(); // check alert to be fired - for (TimerAlert alert : task.getAlerts()) { - if (!alreadyTrownAlerts.contains(alert)) { - if (alert.getType().equals(Type.REACH_DAILY_TIME) - && TimerTaskHelper.getTotalTime(task, now) >= alert - .getDuration()) { - displayAlert(task, Type.REACH_DAILY_TIME, - alert.getDuration()); - alreadyTrownAlerts.add(alert.clone()); - } else if (alert.getType().equals(Type.REACH_TOTAL_TIME) - && TimerTaskHelper.getAllTotalTime(task) >= alert - .getDuration()) { - displayAlert(task, Type.REACH_TOTAL_TIME, - alert.getDuration()); - alreadyTrownAlerts.add(alert.clone()); - } + task.getAlerts().stream().filter(alert -> !alreadyThrownAlerts.contains(alert)).forEach(alert -> { + if (alert.getType().equals(Type.REACH_DAILY_TIME) + && TimerTaskHelper.getTotalTime(task, now) >= alert + .getDuration()) { + displayAlert(task, Type.REACH_DAILY_TIME, + alert.getDuration()); + alreadyThrownAlerts.add(alert.clone()); + } else if (alert.getType().equals(Type.REACH_TOTAL_TIME) + && TimerTaskHelper.getAllTotalTime(task) >= alert + .getDuration()) { + displayAlert(task, Type.REACH_TOTAL_TIME, + alert.getDuration()); + alreadyThrownAlerts.add(alert.clone()); } - } + }); // lance aussi les alertes sur les taches parentes // par exemple, si une tache passe en temps journaliers a 1h diff --git a/src/main/java/org/chorem/jtimer/ui/tree/CheckBoxTreeCellEditor.java b/src/main/java/org/chorem/jtimer/ui/tree/CheckBoxTreeCellEditor.java index 57ac9d6..885038b 100644 --- a/src/main/java/org/chorem/jtimer/ui/tree/CheckBoxTreeCellEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/tree/CheckBoxTreeCellEditor.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2009 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -150,7 +150,7 @@ public class CheckBoxTreeCellEditor extends CheckBoxTreeCellComponent implements if (log.isDebugEnabled()) { log.debug("Current edition = " + editingPath); } - updateChildreen(editingPath, checkbox.isSelected()); + updateChildren(editingPath, checkbox.isSelected()); // too refresh selected/unselected checkbox parentTree.repaint(); @@ -166,7 +166,7 @@ public class CheckBoxTreeCellEditor extends CheckBoxTreeCellComponent implements * @param treePath current tree path * @param select select (true) or deselect */ - protected void updateChildreen(TreePath treePath, boolean select) { + protected void updateChildren(TreePath treePath, boolean select) { TimerTask lastPathComponent = (TimerTask) treePath .getLastPathComponent(); @@ -185,12 +185,12 @@ public class CheckBoxTreeCellEditor extends CheckBoxTreeCellComponent implements if (parentTree.getModel().getRoot() == lastPathComponent) { for (TimerProject project : core.getData().getProjectsList()) { TreePath subTreePath = treePath.pathByAddingChild(project); - updateChildreen(subTreePath, select); + updateChildren(subTreePath, select); } } else { for (TimerTask subtask : lastPathComponent.getSubTasks()) { TreePath subTreePath = treePath.pathByAddingChild(subtask); - updateChildreen(subTreePath, select); + updateChildren(subTreePath, select); } } } diff --git a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java index e2aeeff..abe1601 100644 --- a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java +++ b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java @@ -117,25 +117,16 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements subTasksCache = new HashMap<>(); } - /* - * @see org.jdesktop.swingx.treetable.TreeTableModel#getColumnCount() - */ @Override public int getColumnCount() { return columnIdentifiers.size(); } - /* - * @see org.jdesktop.swingx.treetable.TreeTableModel#getColumnName(int) - */ @Override public String getColumnName(int column) { return columnIdentifiers.get(column); } - /* - * @see org.jdesktop.swingx.treetable.DefaultTreeTableModel#getValueAt(java.lang.Object, int) - */ @Override public Object getValueAt(Object object, int column) { @@ -169,18 +160,12 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements return value; } - /* - * @see org.jdesktop.swingx.treetable.DefaultTreeTableModel#isCellEditable(java.lang.Object, int) - */ @Override public boolean isCellEditable(Object object, int column) { // non editable return false; } - /* - * @see org.jdesktop.swingx.treetable.DefaultTreeTableModel#getChild(java.lang.Object, int) - */ @Override public Object getChild(Object parent, int index) { @@ -188,9 +173,6 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements return t; } - /* - * @see org.jdesktop.swingx.treetable.DefaultTreeTableModel#getChildCount(java.lang.Object) - */ @Override public int getChildCount(Object parent) { @@ -255,9 +237,6 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements return result; } - /* - * @see org.jdesktop.swingx.treetable.DefaultTreeTableModel#getIndexOfChild(java.lang.Object, java.lang.Object) - */ @Override public int getIndexOfChild(Object parent, Object child) { @@ -265,9 +244,6 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements return childIndex; } - /* - * @see org.jdesktop.swingx.treetable.DefaultTreeTableModel#isLeaf(java.lang.Object) - */ @Override public boolean isLeaf(Object node) { return getChildCount(node) == 0; @@ -365,33 +341,21 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements return updated; } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void addProject(TimerProject project) { notifyTaskChanged(project, OPERATION_ADD); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void addTask(TimerTask task) { notifyTaskChanged(task, OPERATION_ADD); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#dataLoaded(java.util.Collection) - */ @Override public void dataLoaded(Collection<TimerProject> projects) { // save size - final Collection<TableColumn> tcs = new ArrayList<>(); - for (TableColumn tc : projectsAndTaskTable.getColumns()) { - tcs.add(tc); - } + final Collection<TableColumn> tcs = new ArrayList<>(projectsAndTaskTable.getColumns()); taskNameCache.clear(); subTasksCache.clear(); @@ -409,59 +373,38 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements }); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void deleteProject(TimerProject project) { notifyTaskChanged(project, OPERATION_DELETE); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void deleteTask(TimerTask task) { notifyTaskChanged(task, OPERATION_DELETE); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyProject(org.chorem.jtimer.entities.TimerProject) - */ @Override public void modifyProject(TimerProject project) { notifyTaskChanged(project, OPERATION_MODIFY); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void modifyTask(TimerTask task) { notifyTaskChanged(task, OPERATION_MODIFY); } - /* - * @see org.chorem.jtimer.event.DataEventListener#setAnnotation(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.String) - */ @Override public void setAnnotation(TimerTask task, Date date, String annotation) { } - /* - * @see org.chorem.jtimer.event.DataEventListener#setTaskTime(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.Long) - */ @Override public void setTaskTime(TimerTask task, Date date, Long time) { notifyTaskChanged(task, OPERATION_MODIFY); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#changeClosedState(org.chorem.jtimer.entities.TimerTask) - */ @Override public void changeClosedState(TimerTask task) { @@ -485,17 +428,11 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#startTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void startTask(TimerTask task) { } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#stopTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void stopTask(TimerTask task) { @@ -512,25 +449,16 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements dataLoaded(null); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#postMoveTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void moveTask(TimerTask task) { notifyTaskChanged(task, OPERATION_ADD); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#preMoveTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void preMoveTask(TimerTask task) { notifyTaskChanged(task, OPERATION_DELETE); } - - /* - * @see org.chorem.jtimer.data.DataEventListener#postMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ + @Override public void postMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { @@ -541,9 +469,6 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements } } - /* - * @see org.chorem.jtimer.data.DataEventListener#preMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ @Override public void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { diff --git a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksTable.java b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksTable.java index 1245a7b..6cc9a11 100644 --- a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksTable.java +++ b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksTable.java @@ -26,8 +26,6 @@ import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import javax.swing.AbstractAction; diff --git a/src/main/java/org/chorem/jtimer/ui/treetable/dnd/TimerTaskTranferable.java b/src/main/java/org/chorem/jtimer/ui/treetable/dnd/TimerTaskTranferable.java index 25e99d9..01032ca 100644 --- a/src/main/java/org/chorem/jtimer/ui/treetable/dnd/TimerTaskTranferable.java +++ b/src/main/java/org/chorem/jtimer/ui/treetable/dnd/TimerTaskTranferable.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -75,14 +75,11 @@ public class TimerTaskTranferable implements Transferable { } } - /* - * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor) - */ @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - List<TimerTask> tasks = null; + List<TimerTask> tasks; if (flavor == null) { throw new IOException("flavor is null"); @@ -97,17 +94,11 @@ public class TimerTaskTranferable implements Transferable { return tasks; } - /* - * @see java.awt.datatransfer.Transferable#getTransferDataFlavors() - */ @Override public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[] { myData }; } - /* - * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor) - */ @Override public boolean isDataFlavorSupported(DataFlavor flavor) { return flavor.equals(myData); diff --git a/src/main/java/org/chorem/jtimer/ui/widget/DurationEditor.java b/src/main/java/org/chorem/jtimer/ui/widget/DurationEditor.java index 25e2ae3..3e9c11a 100644 --- a/src/main/java/org/chorem/jtimer/ui/widget/DurationEditor.java +++ b/src/main/java/org/chorem/jtimer/ui/widget/DurationEditor.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2009 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -112,7 +112,7 @@ public class DurationEditor extends JPanel implements ChangeListener { @Override public void stateChanged(ChangeEvent e) { - // clic on minute spinner + // click on minute spinner if (e.getSource() == minuteSpinnerModel) { int value = minuteSpinnerModel.getNumber().intValue(); // up @@ -135,7 +135,7 @@ public class DurationEditor extends JPanel implements ChangeListener { } } - // clic on seconds spinner + // click on seconds spinner else if (e.getSource() == secondSpinnerModel) { int value = secondSpinnerModel.getNumber().intValue(); // up diff --git a/src/main/java/org/chorem/jtimer/ui/widget/JPopupTrayIcon.java b/src/main/java/org/chorem/jtimer/ui/widget/JPopupTrayIcon.java index 1bdd27e..2b110b3 100644 --- a/src/main/java/org/chorem/jtimer/ui/widget/JPopupTrayIcon.java +++ b/src/main/java/org/chorem/jtimer/ui/widget/JPopupTrayIcon.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2009 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -44,9 +44,6 @@ import javax.swing.event.PopupMenuListener; * (http://weblogs.java.net/blog/alexfromsun/archive/2008/02/jtrayicon_updat.htm...) * but uses a JWindow instead of a JDialog to workaround some bugs on linux. * - * Use code based from, with some modifications : - * https://fishfarm.dev.java.net/source/browse/fishfarm/trunk/FishFarm/src/net/java/fishfarm/ui/JPopupTrayIcon.java?rev=198&view=markup - * * @author Michael Bien * @author Chatellier Eric */ @@ -57,8 +54,7 @@ public class JPopupTrayIcon extends TrayIcon implements MouseListener, private Window window; - private static final boolean IS_WINDOWS = System.getProperty("os.name") - .toLowerCase().contains("windows"); + private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().contains("windows"); public JPopupTrayIcon(Image image, String tooltip, JPopupMenu popup) { super(image, tooltip); @@ -79,8 +75,7 @@ public class JPopupTrayIcon extends TrayIcon implements MouseListener, window.setAlwaysOnTop(true); Dimension size = menu.getPreferredSize(); - Point centerPoint = GraphicsEnvironment - .getLocalGraphicsEnvironment().getCenterPoint(); + Point centerPoint = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); if (e.getY() > centerPoint.getY()) { window.setLocation(e.getX(), e.getY() - size.height); } else { @@ -97,10 +92,6 @@ public class JPopupTrayIcon extends TrayIcon implements MouseListener, } } - public JPopupMenu getJPopupMenu() { - return menu; - } - public void setJPopupMenu(JPopupMenu menu) { if (this.menu != null) { this.menu.removePopupMenuListener(this); @@ -109,17 +100,11 @@ public class JPopupTrayIcon extends TrayIcon implements MouseListener, menu.addPopupMenuListener(this); } - /* - * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent) - */ @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { } - /* - * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent) - */ @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (window != null) { @@ -128,9 +113,6 @@ public class JPopupTrayIcon extends TrayIcon implements MouseListener, } } - /* - * @see javax.swing.event.PopupMenuListener#popupMenuCanceled(javax.swing.event.PopupMenuEvent) - */ @Override public void popupMenuCanceled(PopupMenuEvent e) { if (window != null) { @@ -139,42 +121,27 @@ public class JPopupTrayIcon extends TrayIcon implements MouseListener, } } - /* - * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) - */ @Override public void mouseClicked(MouseEvent e) { } - /* - * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent) - */ @Override public void mouseEntered(MouseEvent e) { } - /* - * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent) - */ @Override public void mouseExited(MouseEvent e) { } - /* - * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) - */ @Override public void mousePressed(MouseEvent e) { showJPopupMenu(e); } - /* - * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) - */ @Override public void mouseReleased(MouseEvent e) { showJPopupMenu(e); diff --git a/src/test/java/org/chorem/jtimer/io/AbstractSaverTest.java b/src/test/java/org/chorem/jtimer/io/AbstractSaverTest.java index 34b12cb..ddc0d96 100644 --- a/src/test/java/org/chorem/jtimer/io/AbstractSaverTest.java +++ b/src/test/java/org/chorem/jtimer/io/AbstractSaverTest.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -24,6 +24,7 @@ package org.chorem.jtimer.io; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import org.apache.commons.io.FileUtils; import org.chorem.jtimer.AbstractJTimerTest; @@ -65,7 +66,7 @@ public class AbstractSaverTest extends AbstractJTimerTest { @Test public void restoreBackupFileTest() throws IOException { File file = File.createTempFile("test", ".test"); - FileUtils.writeStringToFile(file, "oldcontent"); + FileUtils.writeStringToFile(file, "oldcontent", StandardCharsets.UTF_8); AbstractSaver saver = new GTimerIncrementalSaver(); File backupFile = saver.makeBackupFile(file); @@ -73,15 +74,15 @@ public class AbstractSaverTest extends AbstractJTimerTest { Assert.assertNotNull(backupFile); Assert.assertTrue(backupFile.isFile()); - FileUtils.writeStringToFile(file, "newcontent"); - Assert.assertEquals(FileUtils.readFileToString(file), "newcontent"); - Assert.assertEquals(FileUtils.readFileToString(backupFile), "oldcontent"); + FileUtils.writeStringToFile(file, "newcontent", StandardCharsets.UTF_8); + Assert.assertEquals(FileUtils.readFileToString(file, StandardCharsets.UTF_8), "newcontent"); + Assert.assertEquals(FileUtils.readFileToString(backupFile, StandardCharsets.UTF_8), "oldcontent"); boolean result = saver.restoreBackupFile(backupFile); Assert.assertTrue(result); Assert.assertFalse(backupFile.isFile()); - Assert.assertEquals(FileUtils.readFileToString(file), "oldcontent"); + Assert.assertEquals(FileUtils.readFileToString(file, StandardCharsets.UTF_8), "oldcontent"); } /** diff --git a/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java b/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java index 9aaafc3..d436038 100644 --- a/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java +++ b/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java @@ -24,6 +24,7 @@ package org.chorem.jtimer.io; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.*; import org.apache.commons.io.FileUtils; @@ -397,7 +398,7 @@ public class GTimerIncrementalSaverTest extends AbstractJTimerTest { String taskFileName = gsaver.dataSaveDirectory + File.separator + task.getNumber() + "." + GTimerIncrementalSaver.GTIMER_TASK_EXTENSION; File taskFile = new File(taskFileName); - List<String> lines = FileUtils.readLines(taskFile); + List<String> lines = FileUtils.readLines(taskFile, StandardCharsets.UTF_8); Assert.assertTrue(lines.stream().noneMatch(line -> line.startsWith("2016"))); /*FIXME testSaver.unlock(); diff --git a/src/test/java/org/chorem/jtimer/utils/DailySortedMapTest.java b/src/test/java/org/chorem/jtimer/utils/DailySortedMapTest.java index d586e6b..e936584 100644 --- a/src/test/java/org/chorem/jtimer/utils/DailySortedMapTest.java +++ b/src/test/java/org/chorem/jtimer/utils/DailySortedMapTest.java @@ -445,9 +445,9 @@ public class DailySortedMapTest { DailySortedMap<Long> newMap = new DailySortedMap<>(); newMap.putAll(map); - Assert.assertEquals(map.size(), 2); - Assert.assertEquals(map.get(d1).longValue(), 2l); - Assert.assertEquals(map.get(d3).longValue(), 5l); + Assert.assertEquals(newMap.size(), 2); + Assert.assertEquals(newMap.get(d1).longValue(), 2l); + Assert.assertEquals(newMap.get(d3).longValue(), 5l); } /** -- 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 develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit 8a7047ea99c3c6e529e06fe90eeefe8e0af31aaf Author: CHRE <CHATELLIER@codelutin.com> Date: Wed Jun 8 13:29:05 2016 +0200 Use default methods to remove a lot of empty implemented methods --- .../org/chorem/jtimer/data/CommonVetoable.java | 141 ++++----------- .../org/chorem/jtimer/data/DataEventListener.java | 108 +++++++---- .../jtimer/data/VetoableDataEventListener.java | 82 +++++---- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 61 ------- src/main/java/org/chorem/jtimer/ui/StatusBar.java | 40 ----- .../chorem/jtimer/ui/systray/SystrayManager.java | 198 +-------------------- .../jtimer/ui/treetable/ProjectsAndTasksModel.java | 20 --- .../ProjectsAndTasksRunningCellRenderer.java | 123 ------------- 8 files changed, 165 insertions(+), 608 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/data/CommonVetoable.java b/src/main/java/org/chorem/jtimer/data/CommonVetoable.java index 0e6914f..8510936 100644 --- a/src/main/java/org/chorem/jtimer/data/CommonVetoable.java +++ b/src/main/java/org/chorem/jtimer/data/CommonVetoable.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2007 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2007 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -23,7 +23,6 @@ package org.chorem.jtimer.data; import java.util.Collection; -import java.util.Date; import java.util.List; import org.apache.commons.logging.Log; @@ -34,39 +33,46 @@ import org.chorem.jtimer.entities.TimerTaskHelper; /** * Common jtimer vetoable politics. - * - * Check that: - * - a task name doesn't appears twice in the same level. - * - creation - * - modification - * - move * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ + * Check that: + * - a task name doesn't appears twice in the same level. + * - creation + * - modification + * - move */ public class CommonVetoable implements VetoableDataEventListener { /** log. */ private static Log log = LogFactory.getLog(CommonVetoable.class); - /** Duplicated project violation key. */ + /** + * Duplicated project violation key. + */ protected static final String DUPLICATED_PROJECT_VIOLATION = "vetoable.common.duplicated.project.name"; - /** Duplicated task violation key. */ + + /** + * Duplicated task violation key. + */ protected static final String DUPLICATED_TASK_VIOLATION = "vetoable.common.duplicated.task.name"; - /** Violation if try to move project into task. */ + + /** + * Violation if try to move project into task. + */ protected static final String MOVE_INVALID_TYPES_VIOLATION = "vetoable.common.move.invalid.types"; - /** Violation if try to merge task and project. */ + + /** + * Violation if try to merge task and project. + */ protected static final String MERGE_INVALID_TYPES_VIOLATION = "vetoable.common.merge.invalid.types"; - /** Data manager */ + /** + * Data manager. + */ protected TimerDataManager manager; /** * Constructor. - * + * * @param manager data manager */ public CommonVetoable(TimerDataManager manager) { @@ -75,13 +81,13 @@ public class CommonVetoable implements VetoableDataEventListener { /** * Test if task name is found is tasks list. - * - * @param task task to check + * + * @param task task to check * @param tasks tasks list to search into * @return founded */ protected boolean isSameTaskName(TimerTask task, - List<? extends TimerTask> tasks) { + List<? extends TimerTask> tasks) { boolean found = false; for (TimerTask currentTask : tasks) { @@ -93,9 +99,6 @@ public class CommonVetoable implements VetoableDataEventListener { return found; } - /* - * {@inheritDoc} - */ @Override public void checkAddProject(TimerProject project) { @@ -104,14 +107,10 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Duplicated name, checkAddProject won't pass"); } - throw new DataViolationException("Can't add project", - DUPLICATED_PROJECT_VIOLATION); + throw new DataViolationException("Can't add project", DUPLICATED_PROJECT_VIOLATION); } } - /* - * {@inheritDoc} - */ @Override public void checkAddTask(TimerTask parent, TimerTask task) { @@ -120,38 +119,10 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Duplicated name, checkAddTask won't pass"); } - throw new DataViolationException("Can't add task", - DUPLICATED_TASK_VIOLATION); + throw new DataViolationException("Can't add task", DUPLICATED_TASK_VIOLATION); } } - /* - * {@inheritDoc} - */ - @Override - public void checkChangeClosedState(TimerTask task) { - - } - - /* - * {@inheritDoc} - */ - @Override - public void checkDeleteProject(TimerProject project) { - - } - - /* - * {@inheritDoc} - */ - @Override - public void checkDeleteTask(TimerTask task) { - - } - - /* - * {@inheritDoc} - */ @Override public void checkModifyProject(TimerProject project) { @@ -160,14 +131,10 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Duplicated name, checkModifyProject won't pass"); } - throw new DataViolationException("Can't modify project", - DUPLICATED_PROJECT_VIOLATION); + throw new DataViolationException("Can't modify project", DUPLICATED_PROJECT_VIOLATION); } } - /* - * {@inheritDoc} - */ @Override public void checkModifyTask(TimerTask task) { @@ -176,15 +143,11 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Duplicated name, checkModifyTask won't pass"); } - throw new DataViolationException("Can't modify task", - DUPLICATED_TASK_VIOLATION); + throw new DataViolationException("Can't modify task", DUPLICATED_TASK_VIOLATION); } } - /* - * {@inheritDoc} - */ @Override public void checkMoveTask(TimerTask destination, Collection<TimerTask> tasksToMove) { @@ -194,8 +157,7 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Move task into himself, impossible"); } - throw new DataViolationException("Can't move task into himself", - MOVE_INVALID_TYPES_VIOLATION); + throw new DataViolationException("Can't move task into himself", MOVE_INVALID_TYPES_VIOLATION); } for (TimerTask taskToMove : tasksToMove) { @@ -205,8 +167,7 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Move project, impossible"); } - throw new DataViolationException("Can't move project", - MOVE_INVALID_TYPES_VIOLATION); + throw new DataViolationException("Can't move project", MOVE_INVALID_TYPES_VIOLATION); } // check duplicated task name @@ -214,55 +175,31 @@ public class CommonVetoable implements VetoableDataEventListener { if (log.isDebugEnabled()) { log.debug("Duplicated name, checkMoveTask won't pass"); } - throw new DataViolationException("Can't move task", - DUPLICATED_TASK_VIOLATION); + throw new DataViolationException("Can't move task", DUPLICATED_TASK_VIOLATION); } } } - /* - * {@inheritDoc} - */ - @Override - public void checkSetAnnotation(TimerTask task, Date date, String value) { - - } - - /* - * {@inheritDoc} - */ - @Override - public void checkSetTaskTime(TimerTask task, Date date, Long value) { - - } - - /* - * {@inheritDoc} - */ @Override public void checkMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { + List<TimerTask> otherTasks) { // tous les taches sont des projets if (destinationTask instanceof TimerProject) { for (TimerTask otherTask : otherTasks) { if (!(otherTask instanceof TimerProject)) { - throw new DataViolationException("Can't merge task", - MERGE_INVALID_TYPES_VIOLATION); + throw new DataViolationException("Can't merge task", MERGE_INVALID_TYPES_VIOLATION); } } - } - else { + } else { // ou toutes des taches for (TimerTask otherTask : otherTasks) { if (otherTask instanceof TimerProject) { - throw new DataViolationException("Can't merge task", - MERGE_INVALID_TYPES_VIOLATION); + throw new DataViolationException("Can't merge task", MERGE_INVALID_TYPES_VIOLATION); } } // mais pas une combinaison des deux } } - } diff --git a/src/main/java/org/chorem/jtimer/data/DataEventListener.java b/src/main/java/org/chorem/jtimer/data/DataEventListener.java index 961b5df..78a30b5 100644 --- a/src/main/java/org/chorem/jtimer/data/DataEventListener.java +++ b/src/main/java/org/chorem/jtimer/data/DataEventListener.java @@ -42,119 +42,151 @@ public interface DataEventListener extends EventListener { /** * Add project event. - * + * * @param project project to add */ - void addProject(TimerProject project); + default void addProject(TimerProject project) { + + } /** * Add task event. - * + * * @param task task to add */ - void addTask(TimerTask task); + default void addTask(TimerTask task) { + + } /** * Modify project. - * + * * @param project modified project */ - void modifyProject(TimerProject project); + default void modifyProject(TimerProject project) { + + } /** * Modify task. - * + * * @param task modified task */ - void modifyTask(TimerTask task); - + default void modifyTask(TimerTask task) { + + } + /** * Delete project. - * + * * @param project deleted project */ - void deleteProject(TimerProject project); + default void deleteProject(TimerProject project) { + + } /** * Delete task. - * + * * @param task deleted task */ - void deleteTask(TimerTask task); + default void deleteTask(TimerTask task) { + + } /** * Add annotation. - * - * @param task task where annotation is changed - * @param date date + * + * @param task task where annotation is changed + * @param date date * @param annotation new annotation value */ - void setAnnotation(TimerTask task, Date date, String annotation); + default void setAnnotation(TimerTask task, Date date, String annotation) { + + } /** * Set task time. - * + * * @param task task where time is changed * @param date date * @param time task time */ - void setTaskTime(TimerTask task, Date date, Long time); + default void setTaskTime(TimerTask task, Date date, Long time) { + + } /** * Change task state. - * + * * @param task task */ - void changeClosedState(TimerTask task); + default void changeClosedState(TimerTask task) { + + } /** * Pre move task. - * + * * @param task task */ - void preMoveTask(TimerTask task); + default void preMoveTask(TimerTask task) { + + } /** * Post move task. - * + * * @param task task */ - void moveTask(TimerTask task); - + default void moveTask(TimerTask task) { + + } + /** * Pre merge task. - * + * * @param destinationTask task where all other task will be merged - * @param otherTasks other tasks to merge + * @param otherTasks other tasks to merge */ - void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks); + default void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { + + } /** * Post merge task. - * + * * @param destinationTask task where all other task will be merged - * @param otherTasks other tasks to merge + * @param otherTasks other tasks to merge */ - void postMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks); + default void postMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { + + } /** * Start task. - * + * * @param task started task */ - void startTask(TimerTask task); + default void startTask(TimerTask task) { + + } /** * Stop task. - * + * * @param task stopped task */ - void stopTask(TimerTask task); + default void stopTask(TimerTask task) { + + } /** * All data loaded. - * + * * @param projects projects collection */ - void dataLoaded(Collection<TimerProject> projects); + default void dataLoaded(Collection<TimerProject> projects) { + + } } diff --git a/src/main/java/org/chorem/jtimer/data/VetoableDataEventListener.java b/src/main/java/org/chorem/jtimer/data/VetoableDataEventListener.java index 0f8a9da..ac7a801 100644 --- a/src/main/java/org/chorem/jtimer/data/VetoableDataEventListener.java +++ b/src/main/java/org/chorem/jtimer/data/VetoableDataEventListener.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2010 CodeLutin, Chatellier Eric + * Copyright (C) 2008 - 2016 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -42,86 +42,108 @@ public interface VetoableDataEventListener extends EventListener { /** * Check add project. - * + * * @param project project to add */ - void checkAddProject(TimerProject project); + default void checkAddProject(TimerProject project) { + + } /** * Check add task. - * + * * @param parent parent task - * @param task task to add + * @param task task to add */ - void checkAddTask(TimerTask parent, TimerTask task); + default void checkAddTask(TimerTask parent, TimerTask task) { + + } /** * Check modify project. - * + * * @param project modified project */ - void checkModifyProject(TimerProject project); + default void checkModifyProject(TimerProject project) { + + } /** * Check modify task. - * + * * @param task modified task */ - void checkModifyTask(TimerTask task); + default void checkModifyTask(TimerTask task) { + + } /** * Check delete project. - * + * * @param project deleted project */ - void checkDeleteProject(TimerProject project); + default void checkDeleteProject(TimerProject project) { + + } /** * Check delete task. - * + * * @param task deleted task */ - void checkDeleteTask(TimerTask task); + default void checkDeleteTask(TimerTask task) { + + } /** * Check update task annotation. - * - * @param task task to update - * @param date day of change + * + * @param task task to update + * @param date day of change * @param value new annotation */ - void checkSetAnnotation(TimerTask task, Date date, String value); + default void checkSetAnnotation(TimerTask task, Date date, String value) { + + } /** * Check update task time. - * - * @param task task to update - * @param date day of change + * + * @param task task to update + * @param date day of change * @param value new time in seconds */ - void checkSetTaskTime(TimerTask task, Date date, Long value); + default void checkSetTaskTime(TimerTask task, Date date, Long value) { + + } /** * Check change task state. - * + * * @param task task */ - void checkChangeClosedState(TimerTask task); + default void checkChangeClosedState(TimerTask task) { + + } /** * Check move task. - * + * * @param destination task to move to * @param tasksToMove tasks to move */ - void checkMoveTask(TimerTask destination, Collection<TimerTask> tasksToMove); - + default void checkMoveTask(TimerTask destination, Collection<TimerTask> tasksToMove) { + + } + /** * Check merge task. - * + * * @param destinationTask task result of merge - * @param otherTasks other task to merge + * @param otherTasks other task to merge */ - void checkMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks); + default void checkMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { + + } } diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index 59d47dc..67f2f01 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -1184,11 +1184,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } @Override - public void dataLoaded(Collection<TimerProject> projects) { - // do nothing - } - - @Override public void deleteProject(TimerProject project) { deleteTaskOrProject(project, GTIMER_PROJECT_EXTENSION); } @@ -1312,13 +1307,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } @Override - public void preMoveTask(TimerTask task) { - if (log.isDebugEnabled()) { - log.debug("preMoveTask event received"); - } - } - - @Override public void moveTask(TimerTask task) { if (log.isDebugEnabled()) { @@ -1343,11 +1331,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } @Override - public void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { - - } - - @Override public void startTask(TimerTask task) { if (log.isDebugEnabled()) { @@ -1390,11 +1373,6 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } @Override - public void checkSetAnnotation(TimerTask task, Date date, String value) { - - } - - @Override public void checkAddProject(TimerProject project) { checkName(project); } @@ -1421,43 +1399,4 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, } } - @Override - public void checkChangeClosedState(TimerTask task) { - - } - - @Override - public void checkDeleteProject(TimerProject project) { - - } - - @Override - public void checkDeleteTask(TimerTask task) { - - } - - @Override - public void checkModifyProject(TimerProject project) { - - } - - @Override - public void checkModifyTask(TimerTask task) { - checkName(task); - } - - @Override - public void checkMoveTask(TimerTask destination, Collection<TimerTask> tasksToMove) { - - } - - @Override - public void checkSetTaskTime(TimerTask task, Date date, Long value) { - - } - - @Override - public void checkMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { - - } } diff --git a/src/main/java/org/chorem/jtimer/ui/StatusBar.java b/src/main/java/org/chorem/jtimer/ui/StatusBar.java index 8a86311..cd069c0 100644 --- a/src/main/java/org/chorem/jtimer/ui/StatusBar.java +++ b/src/main/java/org/chorem/jtimer/ui/StatusBar.java @@ -25,7 +25,6 @@ package org.chorem.jtimer.ui; import java.awt.GridLayout; import java.util.Collection; import java.util.Date; -import java.util.List; import javax.swing.BorderFactory; import javax.swing.JLabel; @@ -149,40 +148,23 @@ public class StatusBar extends JPanel implements DataEventListener { } @Override - public void modifyProject(TimerProject project) { - - } - - @Override public void setTaskTime(TimerTask task, Date date, Long time) { modifyTask(task); } @Override - public void setAnnotation(TimerTask task, Date date, String annotation) { - - } - - @Override public void modifyTask(TimerTask task) { updateTodayTime(); } @Override - public void changeClosedState(TimerTask task) { - - } - - @Override public void startTask(TimerTask task) { startStopTask(task, true); - } @Override public void stopTask(TimerTask task) { startStopTask(task, false); - } /** @@ -213,26 +195,4 @@ public class StatusBar extends JPanel implements DataEventListener { } lblMessage.setText(message); } - - @Override - public void moveTask(TimerTask task) { - - } - - @Override - public void preMoveTask(TimerTask task) { - - } - - @Override - public void postMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { - - } - - @Override - public void preMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { - - } } diff --git a/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java b/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java index c3fc5f8..700b0b8 100644 --- a/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java +++ b/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java @@ -30,11 +30,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; -import java.util.Collection; -import java.util.Date; -import java.util.List; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -43,7 +41,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.jtimer.JTimer; import org.chorem.jtimer.data.DataEventListener; -import org.chorem.jtimer.entities.TimerProject; import org.chorem.jtimer.entities.TimerTask; import org.chorem.jtimer.ui.widget.JPopupTrayIcon; import org.jdesktop.application.ApplicationContext; @@ -59,8 +56,8 @@ import org.jdesktop.application.ResourceMap; * Last update : $Date$ * By : $Author$ */ -public class SystrayManager implements ActionListener, DataEventListener, - MouseListener, Runnable, WindowListener { +public class SystrayManager extends WindowAdapter implements ActionListener, DataEventListener, + MouseListener, Runnable { /** Log. */ private static Log log = LogFactory.getLog(SystrayManager.class); @@ -197,81 +194,11 @@ public class SystrayManager implements ActionListener, DataEventListener, } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addProject(org.chorem.jtimer.entities.TimerProject) - */ - @Override - public void addProject(TimerProject project) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void addTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#dataLoaded(java.util.Collection) - */ - @Override - public void dataLoaded(Collection<TimerProject> projects) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteProject(org.chorem.jtimer.entities.TimerProject) - */ - @Override - public void deleteProject(TimerProject project) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void deleteTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyProject(org.chorem.jtimer.entities.TimerProject) - */ - @Override - public void modifyProject(TimerProject project) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void modifyTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#changeClosedState(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void changeClosedState(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.ui.systray.SystrayManager#startTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void startTask(TimerTask task) { startStopTask(task, true); } - /* - * @see org.chorem.jtimer.ui.systray.SystrayManager#stopTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void stopTask(TimerTask task) { startStopTask(task, false); @@ -350,9 +277,7 @@ public class SystrayManager implements ActionListener, DataEventListener, } } - /* - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ + @Override public void actionPerformed(ActionEvent e) { // This is only popop menu action here @@ -377,58 +302,6 @@ public class SystrayManager implements ActionListener, DataEventListener, } - /* - * @see org.chorem.jtimer.event.DataEventListener#setAnnotation(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.String) - */ - @Override - public void setAnnotation(TimerTask task, Date date, String annotation) { - - } - - /* - * @see org.chorem.jtimer.event.DataEventListener#setTaskTime(org.chorem.jtimer.entities.TimerTask, java.util.Calendar, java.lang.Long) - */ - public void setTaskTime(TimerTask task, Date date, Long time) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#postMoveTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void moveTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#preMoveTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void preMoveTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.DataEventListener#postMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ - @Override - public void postMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { - - } - - /* - * @see org.chorem.jtimer.data.DataEventListener#preMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ - @Override - public void preMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { - - } - - /* - * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) - */ @Override public void mouseClicked(MouseEvent e) { @@ -457,41 +330,26 @@ public class SystrayManager implements ActionListener, DataEventListener, } } - /* - * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent) - */ @Override public void mouseEntered(MouseEvent e) { } - /* - * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent) - */ @Override public void mouseExited(MouseEvent e) { } - /* - * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) - */ @Override public void mousePressed(MouseEvent e) { } - /* - * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) - */ @Override public void mouseReleased(MouseEvent e) { } - /* - * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent) - */ @Override public void windowClosing(WindowEvent e) { @@ -505,52 +363,4 @@ public class SystrayManager implements ActionListener, DataEventListener, parent.exit(e); } } - - /* - * @see java.awt.event.WindowListener#windowActivated(java.awt.event.WindowEvent) - */ - @Override - public void windowActivated(WindowEvent e) { - - } - - /* - * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent) - */ - @Override - public void windowClosed(WindowEvent e) { - - } - - /* - * @see java.awt.event.WindowListener#windowDeactivated(java.awt.event.WindowEvent) - */ - @Override - public void windowDeactivated(WindowEvent e) { - - } - - /* - * @see java.awt.event.WindowListener#windowDeiconified(java.awt.event.WindowEvent) - */ - @Override - public void windowDeiconified(WindowEvent e) { - - } - - /* - * @see java.awt.event.WindowListener#windowIconified(java.awt.event.WindowEvent) - */ - @Override - public void windowIconified(WindowEvent e) { - - } - - /* - * @see java.awt.event.WindowListener#windowOpened(java.awt.event.WindowEvent) - */ - @Override - public void windowOpened(WindowEvent e) { - - } } diff --git a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java index abe1601..3a167ec 100644 --- a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java +++ b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksModel.java @@ -396,11 +396,6 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements } @Override - public void setAnnotation(TimerTask task, Date date, String annotation) { - - } - - @Override public void setTaskTime(TimerTask task, Date date, Long time) { notifyTaskChanged(task, OPERATION_MODIFY); } @@ -428,16 +423,6 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements } } - @Override - public void startTask(TimerTask task) { - - } - - @Override - public void stopTask(TimerTask task) { - - } - /** * Change closed task property. * @@ -468,9 +453,4 @@ public class ProjectsAndTasksModel extends AbstractTreeTableModel implements notifyTaskChanged(otherTask, OPERATION_DELETE); } } - - @Override - public void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks) { - - } } diff --git a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksRunningCellRenderer.java b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksRunningCellRenderer.java index 1ee3b36..905fa9d 100644 --- a/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksRunningCellRenderer.java +++ b/src/main/java/org/chorem/jtimer/ui/treetable/ProjectsAndTasksRunningCellRenderer.java @@ -29,9 +29,7 @@ import java.awt.image.ImageObserver; import java.net.URL; import java.util.Collection; import java.util.Collections; -import java.util.Date; import java.util.HashSet; -import java.util.List; import java.util.Set; import javax.swing.ImageIcon; @@ -41,7 +39,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.jtimer.data.DataEventListener; import org.chorem.jtimer.data.TimerCore; -import org.chorem.jtimer.entities.TimerProject; import org.chorem.jtimer.entities.TimerTask; import org.jdesktop.swingx.JXTreeTable; @@ -159,73 +156,6 @@ public class ProjectsAndTasksRunningCellRenderer extends ProjectsAndTasksCellRen } } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addProject(org.chorem.jtimer.entities.TimerProject) - */ - @Override - public void addProject(TimerProject project) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#addTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void addTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#dataLoaded(java.util.Collection) - */ - @Override - public void dataLoaded(Collection<TimerProject> projects) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteProject(org.chorem.jtimer.entities.TimerProject) - */ - @Override - public void deleteProject(TimerProject project) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#deleteTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void deleteTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyProject(org.chorem.jtimer.entities.TimerProject) - */ - @Override - public void modifyProject(TimerProject project) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#modifyTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void modifyTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#changeClosedState(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void changeClosedState(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#startTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void startTask(TimerTask task) { @@ -237,9 +167,6 @@ public class ProjectsAndTasksRunningCellRenderer extends ProjectsAndTasksCellRen runningTasks.add(task); } - /* - * @see org.chorem.jtimer.data.event.DataEventListener#stopTask(org.chorem.jtimer.entities.TimerTask) - */ @Override public void stopTask(TimerTask task) { @@ -250,54 +177,4 @@ public class ProjectsAndTasksRunningCellRenderer extends ProjectsAndTasksCellRen // remember don't running task runningTasks.remove(task); } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#postMoveTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void moveTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.event.DataEventListener#preMoveTask(org.chorem.jtimer.entities.TimerTask) - */ - @Override - public void preMoveTask(TimerTask task) { - - } - - /* - * @see org.chorem.jtimer.data.DataEventListener#postMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ - @Override - public void postMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { - - } - - /* - * @see org.chorem.jtimer.data.DataEventListener#preMergeTasks(org.chorem.jtimer.entities.TimerTask, java.util.List) - */ - @Override - public void preMergeTasks(TimerTask destinationTask, - List<TimerTask> otherTasks) { - - } - - /* - * @see org.chorem.jtimer.event.DataEventListener#setTaskTime(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.Long) - */ - @Override - public void setTaskTime(TimerTask task, Date date, Long time) { - - } - - /* - * @see org.chorem.jtimer.event.DataEventListener#setAnnotation(org.chorem.jtimer.entities.TimerTask, java.util.Date, java.lang.String) - */ - @Override - public void setAnnotation(TimerTask task, Date date, String annotation) { - - } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm