r2903 - in branches/2.0.0-evol-499-storage: . src/main/java/org/chorem/jtimer src/main/java/org/chorem/jtimer/data src/main/java/org/chorem/jtimer/entities src/main/java/org/chorem/jtimer/system src/main/java/org/chorem/jtimer/system/macos src/main/java/org/chorem/jtimer/system/unix src/main/java/org/chorem/jtimer/system/win32 src/test/java/org/chorem/jtimer src/test/java/org/chorem/jtimer/entities src/test/java/org/chorem/jtimer/storage src/test/java/org/chorem/jtimer/system
Author: echatellier Date: 2013-07-11 23:34:52 +0200 (Thu, 11 Jul 2013) New Revision: 2903 Url: http://chorem.org/projects/jtimer/repository/revisions/2903 Log: Prepare 2.0.0 branch for html5 ui Added: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfo.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfoFactory.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/UnsupportedSystemInfoException.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/package-info.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/system/ Removed: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimer.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerFactory.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/utils/ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/ui/ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/utils/ Modified: branches/2.0.0-evol-499-storage/pom.xml branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerActions.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerConfig.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/data/TimerCore.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/entities/TimerTask.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/MacOSSystemInfo.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/package-info.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/UnixSystemInfo.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/X11.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/Xss.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/package-info.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/Kernel32.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/User32.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/Win32SystemInfo.java branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/package-info.java branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/AbstractJTimerTest.java branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/storage/StorageTest.java branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/system/SystemInfoFactoryTest.java Modified: branches/2.0.0-evol-499-storage/pom.xml =================================================================== --- branches/2.0.0-evol-499-storage/pom.xml 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/pom.xml 2013-07-11 21:34:52 UTC (rev 2903) @@ -1,16 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom4redmine</artifactId> - <version>3.4</version> + <version>3.4.12</version> </parent> <groupId>org.chorem</groupId> <artifactId>jtimer</artifactId> - <version>1.4.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> <name>jTimer</name> <description> @@ -78,25 +79,17 @@ </distributionManagement> <properties> - - <!-- redmine platform --> <platform>chorem.org</platform> + <license.licenseName>gpl_v3</license.licenseName> - <!--Main class in JAR --> + <javaVersion>1.7</javaVersion> <maven.jar.main.class>org.chorem.jtimer.JTimer</maven.jar.main.class> + <seleniumVersion>2.33.0</seleniumVersion> - <!-- license to use --> - <license.licenseName>gpl_v3</license.licenseName> - - <!--Multilanguage maven-site --> - <locales>fr,en</locales> - - <!-- files to deploy to redmine --> <redmine.releaseFiles> target/${project.artifactId}-${project.version}-bin.zip, target/${project.artifactId}-${project.version}-src.zip, </redmine.releaseFiles> - </properties> <build> @@ -136,8 +129,74 @@ </execution> </executions> </plugin> + <plugin> + <groupId>ro.isdc.wro4j</groupId> + <artifactId>wro4j-maven-plugin</artifactId> + <version>1.7.0</version> + + <dependencies> + <dependency> + <groupId>org.nuiton.js</groupId> + <artifactId>nuiton-js-wro</artifactId> + <version>1.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.nuiton.js</groupId> + <artifactId>nuiton-js-angular</artifactId> + <version>1.1.5-1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.nuiton.js</groupId> + <artifactId>nuiton-js-bootstrap</artifactId> + <version>2.3.2-1</version> + </dependency> + </dependencies> + + <executions> + <execution> + <phase>compile</phase> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + + <configuration> + <targetGroups>jtimer</targetGroups> + <minimize>false</minimize> + <destinationFolder>${basedir}/target/classes/html/</destinationFolder> + <contextFolder>${basedir}/src/main/resources/html/</contextFolder> + <wroFile>${basedir}/src/main/resources/nuiton-js/wro.xml</wroFile> + <wroManagerFactory>org.nuiton.js.wro.NuitonJsMavenWroManagerFactory</wroManagerFactory> + <extraConfigFile>${basedir}/src/main/resources/nuiton-js/wro.properties</extraConfigFile> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-maven-plugin</artifactId> + <version>9.0.4.v20130625</version> + <executions> + <execution> + <id>start-jetty</id> + <phase>pre-integration-test</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <daemon>true</daemon> + </configuration> + </execution> + <execution> + <id>stop-jetty</id> + <phase>post-integration-test</phase> + <goals> + <goal>stop</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> - + <pluginManagement> <plugins> <plugin> @@ -154,6 +213,9 @@ </plugin> <plugin> <artifactId>maven-site-plugin</artifactId> + <configuration> + <locales>en</locales> + </configuration> <dependencies> <dependency> <groupId>org.nuiton.jrst</groupId> @@ -166,40 +228,11 @@ </pluginManagement> </build> - <reporting> - <plugins> - <plugin> - <artifactId>maven-checkstyle-plugin</artifactId> - <version>2.9.1</version> - <configuration> - <configLocation>${maven.src.dir}/main/config/checkstyle.xml - </configLocation> - <excludes>**/Xss.java,**/User32.java,**/ApplicationServices.java</excludes> - </configuration> - </plugin> - - <plugin> - <artifactId>maven-changelog-plugin</artifactId> - <version>2.2</version> - <configuration> - <type>range</type> - <range>365</range> - </configuration> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - <version>2.5.1</version> - </plugin> - </plugins> - </reporting> - <dependencies> <dependency> <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - <version>2.5.3</version> + <artifactId>nuiton-config</artifactId> + <version>2.6.12</version> <scope>compile</scope> <exclusions> <exclusion> @@ -214,35 +247,33 @@ <groupId>org.nuiton.i18n</groupId> <artifactId>nuiton-i18n</artifactId> </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.jdesktop.bsaf</groupId> - <artifactId>bsaf</artifactId> - <version>1.9.2</version> - <scope>compile</scope> - <exclusions> <exclusion> - <groupId>javax.jnlp</groupId> - <artifactId>jnlp</artifactId> + <artifactId>commons-vfs2</artifactId> + <groupId>org.apache.commons</groupId> </exclusion> + <exclusion> + <artifactId>guava</artifactId> + <groupId>com.google.guava</groupId> + </exclusion> + <exclusion> + <artifactId>commons-collections</artifactId> + <groupId>commons-collections</groupId> + </exclusion> + <exclusion> + <artifactId>commons-io</artifactId> + <groupId>commons-io</groupId> + </exclusion> </exclusions> </dependency> <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-core</artifactId> - <version>1.6.4</version> - <scope>compile</scope> - </dependency> - <dependency> <groupId>com.nativelibs4java</groupId> <artifactId>bridj</artifactId> - <version>0.6.1</version> + <version>0.6.2</version> <scope>compile</scope> <exclusions> <exclusion> + <artifactId>dx</artifactId> <groupId>com.google.android.tools</groupId> - <artifactId>dx</artifactId> </exclusion> </exclusions> </dependency> @@ -252,23 +283,21 @@ <scope>runtime</scope> </dependency> <dependency> - <groupId>org.freemarker</groupId> - <artifactId>freemarker</artifactId> - <version>2.3.19</version> - </dependency> - <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> - <version>1.3.168</version> + <version>1.3.172</version> <scope>runtime</scope> </dependency> + <dependency> + <groupId>com.oracle</groupId> + <artifactId>javafx</artifactId> + <version>2.2.25</version> + <scope>system</scope> + <systemPath>${java.home}/lib/jfxrt.jar</systemPath> + </dependency> <!-- commons-xxx lib --> <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> @@ -277,23 +306,49 @@ <artifactId>commons-logging</artifactId> </dependency> <dependency> + <artifactId>commons-io</artifactId> <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> </dependency> - <!-- tests dependencies --> + <!-- tests --> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> - <version>6.7</version> + <version>6.8.5</version> <scope>test</scope> <exclusions> - <exclusion> - <artifactId>junit</artifactId> - <groupId>junit</groupId> - </exclusion> + <exclusion> + <artifactId>junit</artifactId> + <groupId>junit</groupId> + </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.easytesting</groupId> + <artifactId>fest-assert-core</artifactId> + <version>2.0M10</version> + <scope>test</scope> + </dependency> + + <!-- integration-tests --> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-java</artifactId> + <version>${seleniumVersion}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-firefox-driver</artifactId> + <version>${seleniumVersion}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-chrome-driver</artifactId> + <version>${seleniumVersion}</version> + <scope>test</scope> + </dependency> </dependencies> <profiles> @@ -325,7 +380,7 @@ <jar>jtimer.jar</jar> <errTitle>${project.name}</errTitle> <jre> - <minVersion>1.6.0</minVersion> + <minVersion>1.7.0</minVersion> </jre> </configuration> </execution> Deleted: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimer.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimer.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimer.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -1,1476 +0,0 @@ -/* - * #%L - * jTimer - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2007 - 2012 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 - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.jtimer; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.io.File; -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Timer; - -import javax.swing.ButtonGroup; -import javax.swing.InputMap; -import javax.swing.JButton; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButtonMenuItem; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JToolBar; -import javax.swing.KeyStroke; -import javax.swing.ListSelectionModel; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreePath; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.jtimer.data.DataViolationException; -import org.chorem.jtimer.data.TimerCore; -import org.chorem.jtimer.entities.TimerProject; -import org.chorem.jtimer.entities.TimerTask; -import org.chorem.jtimer.ui.HelpFrame; -import org.chorem.jtimer.ui.StatusBar; -import org.chorem.jtimer.ui.TimerTaskEditor; -import org.chorem.jtimer.ui.alert.AlertEditor; -import org.chorem.jtimer.ui.report.ReportView; -import org.chorem.jtimer.ui.systray.SystrayManager; -import org.chorem.jtimer.ui.tasks.IdleDialog; -import org.chorem.jtimer.ui.tasks.RefreshTreeTask; -import org.chorem.jtimer.ui.tasks.RunTaskJob; -import org.chorem.jtimer.ui.treetable.ProjectsAndTasksTable; -import org.chorem.jtimer.ui.widget.WindowProperty2; -import org.jdesktop.application.Action; -import org.jdesktop.application.Application; -import org.jdesktop.application.ApplicationContext; -import org.jdesktop.application.ResourceMap; -import org.jdesktop.application.SingleFrameApplication; -import org.jdesktop.application.Task; -import org.jdesktop.application.TaskMonitor; - -/** - * Main jTimer application window. - * - * Respect JSR-296 - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class JTimer extends SingleFrameApplication implements - TreeSelectionListener, MouseListener { - - /** log. */ - private static Log log = LogFactory.getLog(JTimer.class); - - /** Timer core controller. */ - protected TimerCore core; - - /** Tree structure. */ - protected ProjectsAndTasksTable projectsAndTasksTable; - - /** Systray manager. */ - protected SystrayManager systrayManager; - - /** I18n resources map. */ - protected ResourceMap resourceMap; - - /** Jtimer application config. */ - public static JTimerConfig config; - - /** Single project selection property. */ - protected boolean selectedSingleProject; - - /** Single task selection property. */ - protected boolean selectedSingleTask; - - /** Single task or project selection. */ - protected boolean selectedSingleElement; - - /** Single running task selection. */ - protected boolean selectedSingleRunningTask; - - /** Single non running task selection. */ - protected boolean selectedSingleStoppedTask; - - /** Multiples projects selection. */ - protected boolean selectedMultiplesProjects; - - /** Multiples tasks selection. */ - protected boolean selectedMultiplesTasks; - - /** Multiples elements selection. */ - protected boolean selectedMultiplesElements; - - /** - * Main. launch UI - * - * @param args args - */ - public static void main(String[] args) { - - if (log.isInfoEnabled()) { - log.info("Starting " + JTimer.class.getSimpleName() + " at " - + new Date()); - } - - // load configuration and run actions - loadConfiguration(args); - config.doAction(JTimerConfig.STEP_BEFORE_UI); - - launch(JTimer.class, args); - } - - /** - * Initialize application. Called before UI build. - * - * @param args args - * @see Application#initialize(String[]) - */ - @Override - protected void initialize(String[] args) { - - // super, but does nothing - super.initialize(args); - - // init resources map - ApplicationContext ctxt = getContext(); - resourceMap = ctxt.getResourceMap(); - - // fixme awt application name. Can be seen only with gnome-shell - // tray icon is displayed with name "org-chorem-jtimer-JTimer" instead of - // only "jTimer" with following fix : - try { - Toolkit xToolkit = Toolkit.getDefaultToolkit(); - java.lang.reflect.Field awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName"); - awtAppClassNameField.setAccessible(true); - awtAppClassNameField.set(xToolkit, resourceMap.getString("Application.title")); - } catch (Exception ex) { - if (log.isWarnEnabled()) { - log.warn("Can change awt application name", ex); - } - } - - // fix start in iconified mode - ctxt.getSessionStorage().putProperty(JFrame.class, new WindowProperty2()); - - // init timercore - core = new TimerCore(); - - // Systray mgr - systrayManager = new SystrayManager(this); - core.getData().addDataEventListener(systrayManager); - - IdleDialog.init(this); - } - - /** - * Load configuration. - * - * @param args args to parse command line options - */ - protected static void loadConfiguration(String[] args) { - - config = new JTimerConfig(); - - // add file migration for configuration file created before version 1.4 - File homeDir = new File(System.getProperty("user.home"), ".jtimer"); - File oldFile = new File(homeDir, "JTimer.properties"); - File newFile = new File(config.appConfig.getUserConfigDirectory(), config.appConfig.getConfigFileName()); - if (oldFile.isFile() && !newFile.isFile()) { - if (log.isInfoEnabled()) { - log.info("Migration configuration file location"); - } - try { - FileUtils.copyFile(oldFile, newFile); - } catch (IOException ex) { - if (log.isErrorEnabled()) { - log.error("Can't copy config file to new location", ex); - } - } - } - - // parse after file migration - config.parse(args); - } - - /** - * startup. - * - * Create frame menu bar. Create main component. - * - * @see Application#startup() - */ - @Override - protected void startup() { - - // set Menu Bar - getMainFrame().setJMenuBar(createMenuBar()); - - // show main panel components - show(createMainComponent()); - - } - - /** - * Create main component. - * - * Toolbar on top. Tree middle. Status bar on bottom. - * - * @return The component - */ - protected JComponent createMainComponent() { - - // panel = main component - JPanel panel = new JPanel(new BorderLayout()); - - // toolbar on top (north) - panel.add(createToolBar(), BorderLayout.NORTH); - - // tree middle (center-top) - ProjectsAndTasksTable projectTreeTable = createTreeTable(); - JScrollPane scrollPaneProjectTreeTable = new JScrollPane( - projectTreeTable); - panel.add(scrollPaneProjectTreeTable, BorderLayout.CENTER); - - // status bar bottom - StatusBar sb = new StatusBar(this, core.getData()); - // status bar ui will be notified from events - core.getData().addDataEventListener(sb); - panel.add(sb, BorderLayout.SOUTH); - - // taille par defaut au premier lancement de l'application - // sera ecrasee par la restauration de la session - panel.setPreferredSize(new Dimension(640, 480)); - - return panel; - } - - /** - * Create complex tree table. - * - * @return ProjectsAndTaskTable instance - */ - protected ProjectsAndTasksTable createTreeTable() { - - projectsAndTasksTable = new ProjectsAndTasksTable(this, core); - - // name used in properties files - projectsAndTasksTable.setName("projectslist"); - projectsAndTasksTable.addTreeSelectionListener(this); - projectsAndTasksTable.addMouseListener(this); - projectsAndTasksTable.setShowClosed(config.isShowClosed()); - - // since merge option, selection can be multiple - projectsAndTasksTable - .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - - // remove F2 KeyStroke from table - KeyStroke keyToRemove = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); - InputMap imap = projectsAndTasksTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - while (imap != null) { - imap.remove(keyToRemove); - imap = imap.getParent(); - } - - return projectsAndTasksTable; - } - - /** - * Create toolbar. - * - * @return tool bar builded - */ - protected JComponent createToolBar() { - String[] toolbarActionNames = { "startTask", "stopTask", "newProject", - "newTask", "---", "addAnnotation", "editAlert" }; - JToolBar toolBar = new JToolBar(); - toolBar.setFloatable(false); - for (String actionName : toolbarActionNames) { - - if (actionName.equals("---")) { - toolBar.add(new JToolBar.Separator()); - } else { - JButton button = new JButton(); - button.setAction(getAction(actionName)); - - // hide text - // button.setVerticalTextPosition(JButton.BOTTOM); - // button.setHorizontalTextPosition(JButton.CENTER); - button.setHideActionText(true); - - button.setFocusable(false); - toolBar.add(button); - } - } - return toolBar; - } - - /** - * Create application menu bar. - * - * @return menu bar - */ - protected JMenuBar createMenuBar() { - - JMenuBar menuBar = new JMenuBar(); - String[] fileMenuActionNames = { "quit" }; - menuBar.add(createMenu("fileMenu", fileMenuActionNames)); - - String[] projectMenuActionNames = { "newProject", "editProject", - "closeProject", "deleteProject" }; - menuBar.add(createMenu("projectMenu", projectMenuActionNames)); - - String[] taskMenuActionNames = { "newTask", "editTask", "closeTask", - "deleteTask", "---", "startTask", "stopTask", "---", - "addAnnotation", "editAlert", "increment1Task", - "increment5Task", "increment30Task", "decrement1Task", - "decrement5Task", "decrement30Task", "setToZero", "mergeTasks" }; - menuBar.add(createMenu("taskMenu", taskMenuActionNames)); - - String[] reportMenuActionNames = { "makeReport" }; - menuBar.add(createMenu("reportMenu", reportMenuActionNames)); - - JMenu optionmMenu = createOptionMenu(); - menuBar.add(optionmMenu); - - String[] helpMenuActionNames = { "about" }; - menuBar.add(createMenu("helpMenu", helpMenuActionNames)); - - return menuBar; - } - - /** - * Create option dynamic menu. - * - * @return option menu - */ - protected JMenu createOptionMenu() { - JMenu menu = new JMenu(); - menu.setName("optionMenu"); - - // show closed - JMenuItem showClosedItem = new JCheckBoxMenuItem(); - showClosedItem.setAction(getAction("isShowClosed")); - showClosedItem.setSelected(config.isShowClosed()); - showClosedItem.setIcon(null); - menu.add(showClosedItem); - - // close to systray - JMenuItem closeToSysItem = new JCheckBoxMenuItem(); - closeToSysItem.setAction(getAction("isCloseToSystray")); - closeToSysItem.setSelected(config.isCloseToSystray()); - closeToSysItem.setIcon(null); - menu.add(closeToSysItem); - - // report first day of week - JMenu reportFDoW = new JMenu(); - reportFDoW.setName("optionReportFirstDayMenu"); - Calendar calendar = Calendar.getInstance(); - ButtonGroup bg = new ButtonGroup(); - // affiche la liste des jours dans l'ordre de la locale utilisateur - for (int day = calendar.getFirstDayOfWeek() ; day < calendar.getFirstDayOfWeek() + 7 ; day++) { - int realDay = (day - 1) % 7 + 1; - JRadioButtonMenuItem fdowItem = new JRadioButtonMenuItem(); - fdowItem.setAction(getAction("isReportFirstDayOfWeek" + realDay)); - fdowItem.setSelected(realDay == JTimer.config.getReportFirstDayOfWeek()); - fdowItem.setIcon(null); - reportFDoW.add(fdowItem); - bg.add(fdowItem); - } - menu.add(reportFDoW); - - return menu; - } - - /** - * Create single menu. - * - * @param menuName menu name - * @param actionNames associated actions - * @return menu - */ - protected JMenu createMenu(String menuName, String[] actionNames) { - JMenu menu = new JMenu(); - menu.setName(menuName); - addActionToMenu(menu, actionNames); - return menu; - } - - /** - * Add saf action to an existing menu. - * - * Menu have to be a JMenu or JPopupMenu. - * - * @param menu parent menu - * @param actionNames action names - */ - protected void addActionToMenu(JComponent menu, String[] actionNames) { - for (String actionName : actionNames) { - if (actionName.equals("---")) { - menu.add(new JSeparator()); - } else if (actionName.startsWith("is")) { - // if action name start by is - // display it as CheckBox - JMenuItem menuItem = new JCheckBoxMenuItem(); - // link to an @Action - menuItem.setAction(getAction(actionName)); - menuItem.setIcon(null); - menu.add(menuItem); - } else { - JMenuItem menuItem = new JMenuItem(); - // link to an @Action - menuItem.setAction(getAction(actionName)); - menuItem.setIcon(null); - menu.add(menuItem); - } - } - } - - /** - * Ready. Called when UI is ready and displayed. - * - * @see Application#ready() - */ - @Override - protected void ready() { - - // init core, load list, synchronization, etc... - boolean init = core.init(); - - if (init) { - // schedule tree refresh at midnight - scheduleTreeRefresh(); - - // install icon (do it at last action) - systrayManager.install(); - - // run action after ui - config.putObject(this); - config.doAction(JTimerConfig.STEP_AFTER_UI); - } else { - String failTitle = resourceMap.getString("startFail.title"); - String failMessage = resourceMap.getString("startFail.message"); - JOptionPane.showMessageDialog(getMainFrame(), failMessage, - failTitle, JOptionPane.ERROR_MESSAGE); - exit(); - } - } - - /** - * Called on application shutdown. - * - * Save context. - * - * @see SingleFrameApplication#shutdown() - */ - @Override - protected void shutdown() { - log.debug("Shutdown called"); - - // save context - // super, sauve le context des fenetres, etc... - super.shutdown(); - } - - /** - * Refresh tree at midnight. - */ - protected void scheduleTreeRefresh() { - - // task used to refresh tree - java.util.TimerTask refreshTreeTask = new RefreshTreeTask(core); - - Timer timer = new Timer(); - - Calendar date = Calendar.getInstance(); - date.setTimeInMillis(System.currentTimeMillis()); - date.set(Calendar.HOUR_OF_DAY, 0); - date.set(Calendar.MINUTE, 0); - date.set(Calendar.SECOND, 0); - date.set(Calendar.MILLISECOND, 0); - date.add(Calendar.DAY_OF_YEAR, 1); // run only next day - - // Schedule to run every day in midnight - // task,firstTime,period - timer.schedule(refreshTreeTask, date.getTime(), // at date - 1000 * 60 * 60 * 24 // every day - ); - } - - /** - * Display a popup error message. - * - * @param errorMessageKey saf error message key - */ - protected void displayErrorMessage(String errorMessageKey) { - String title = resourceMap.getString("action.invalidActionTitle"); - String message = resourceMap.getString(errorMessageKey); - - // check untranslated string - if (StringUtils.isEmpty(message)) { - message = resourceMap.getString("action.missingErrorMessage", - errorMessageKey); - } - - JOptionPane.showMessageDialog(getMainFrame(), message, title, - JOptionPane.ERROR_MESSAGE); - } - - /** - * New project action. - * - * Ask user for project name - */ - @Action - public void newProject() { - - String projectName = JOptionPane.showInputDialog(getMainFrame(), - resourceMap.getString("input.newProjectMessage"), resourceMap - .getString("input.newProjectTitle"), - JOptionPane.QUESTION_MESSAGE); - - if (projectName != null) { - - // remove unneeded spaces - projectName = projectName.trim(); - - TimerProject p = new TimerProject(projectName); - - // add creation date - p.setCreationDate(new Date()); - - try { - core.getData().addProject(p); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - } - - /** - * Edit project - * - * Enabled when a project is selected - */ - @Action(enabledProperty = "selectedSingleProject") - public void editProject() { - TimerProject project = projectsAndTasksTable.getSelectedProjects().get( - 0); - - String newProjectName = (String) JOptionPane.showInputDialog(getMainFrame(), resourceMap - .getString("input.editProjectMessage"), resourceMap - .getString("input.editProjectTitle"), - JOptionPane.INFORMATION_MESSAGE, null, null, project.getName()); - - if (newProjectName != null) { - - // remove unneeded spaces - newProjectName = newProjectName.trim(); - - try { - core.getData().editProject(project, newProjectName); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - } - - /** - * Create new task action. - * - * Enabled when a project or a task is selected - */ - @Action(enabledProperty = "selectedSingleElement") - public void newTask() { - - // select task to add new task - TimerTask selectedTask = projectsAndTasksTable.getSelectedElements() - .get(0); - - String taskName = JOptionPane.showInputDialog(getMainFrame(), - resourceMap.getString("input.newTaskMessage", selectedTask - .getName()), resourceMap - .getString("input.newTaskTitle"), - JOptionPane.QUESTION_MESSAGE); - - if (taskName != null) { - - // remove unneeded spaces - taskName = taskName.trim(); - - TimerTask t = new TimerTask(taskName); - - // Fix creation date - t.setCreationDate(new Date()); - - try { - core.getData().addTask(selectedTask, t); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - - } - - /** - * Edit task. - * - * Enabled when a task is selected - */ - @Action(enabledProperty = "selectedSingleTask") - public void editTask() { - - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - - TimerTaskEditor editor = new TimerTaskEditor(this, task, core); - editor.setLocationByPlatform(true); - editor.setVisible(true); - } - - /** - * Start selected task in tree. - * - * If it not already been running - * - * @return TimerTask scheduled for start - * @see Task - */ - @Action(enabledProperty = "selectedSingleStoppedTask") - public Task<?, ?> startTask() { - - // search for selected task in tree - // can't be null - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - - RunTaskJob jobToRun = new RunTaskJob(this, task, core.getData()); - core.getData().startTask(task); - - return jobToRun; - } - - /** - * Start task pointed by taskPath. - * - * @param taskPath task path to start (from root to task) - */ - public void startTask(String taskPath) { - TimerTask task = core.getData().getTaskForPath(taskPath); - if (task != null) { - RunTaskJob jobToRun = new RunTaskJob(this, task, core.getData()); - getContext().getTaskService().execute(jobToRun); - core.getData().startTask(task); - } else { - if (log.isWarnEnabled()) { - log.warn("Can't find task '" + taskPath + "'"); - } - } - } - - /** - * Called by task job manager when task as been started. - * - * @param task started task - */ - public void startedTask(TimerTask task) { - setSelectedSingleRunningTask(true); - setSelectedSingleStoppedTask(false); - } - - /** - * Return job that manage running task. - * - * @param task timer task to get job - * @return job or null - */ - protected RunTaskJob getJobForRunningTask(TimerTask task) { - RunTaskJob job = null; - - TaskMonitor tm = getContext().getTaskMonitor(); - for (Task t : tm.getTasks()) { - TimerTask localtask = ((RunTaskJob) t).getTask(); - if (task.equals(localtask)) { - job = (RunTaskJob) t; - } - } - - return job; - } - - /** - * Stop selected task in tree. - * - * Verify if it has been started - */ - @Action(enabledProperty = "selectedSingleRunningTask") - public void stopTask() { - - // task can't be null - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - stopTask(task); - - } - - /** - * Stop a task. - * - * Delegate method. Called by idle detect ? - * Called by delete method too. - * - * @param task task to stop - */ - public void stopTask(TimerTask task) { - - RunTaskJob rtt = getJobForRunningTask(task); - // test if task is already running - if (rtt != null) { - rtt.wantToStop(); - core.getData().stopTask(task); - - // re-enable/disable buttons - setSelectedSingleRunningTask(false); - setSelectedSingleStoppedTask(true); - } - } - - /** - * Stop all running tasks. - */ - public void stopAllTasks() { - - TaskMonitor tm = getContext().getTaskMonitor(); - for (Task t : tm.getTasks()) { - // task - TimerTask ttask = ((RunTaskJob) t).getTask(); - stopTask(ttask); - } - } - - /** - * Close project. - */ - @Action(enabledProperty = "selectedSingleProject") - public void closeProject() { - TimerProject project = projectsAndTasksTable.getSelectedProjects().get(0); - - core.getData().changeProjectCloseState(project); - } - - /** - * Close task. - */ - @Action(enabledProperty = "selectedSingleTask") - public void closeTask() { - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - - core.getData().changeTaskCloseState(task); - } - - /** - * Delete project. - */ - @Action(enabledProperty = "selectedSingleProject") - public void deleteProject() { - - TimerProject project = projectsAndTasksTable.getSelectedProjects().get( - 0); - - if (project != null) { - int confirm = JOptionPane.showConfirmDialog(getMainFrame(), - resourceMap.getString("input.deleteProjectMessage", project - .getName()), resourceMap - .getString("input.deleteProjectTitle"), - JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - - if (confirm == JOptionPane.YES_OPTION) { // approved - try { - core.getData().deleteProject(project); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - - } - - } - - /** - * Delete task. - */ - @Action(enabledProperty = "selectedSingleTask") - public void deleteTask() { - - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - - if (task != null) { - int confirm = JOptionPane.showConfirmDialog(getMainFrame(), - resourceMap.getString("input.deleteTaskMessage", task - .getName()), resourceMap - .getString("input.deleteTaskTitle"), - JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - - if (confirm == JOptionPane.YES_OPTION) { // approved - try { - stopTask(task); - core.getData().deleteTask(task); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - } - } - - /** - * Change show closed option. - * - * @param event action event - */ - @Action - public void isShowClosed(ActionEvent event) { - JCheckBoxMenuItem source = (JCheckBoxMenuItem) event.getSource(); - boolean showClosed = source.isSelected(); - projectsAndTasksTable.setShowClosed(showClosed); - config.setShowClosed(showClosed); - } - - /** - * Change close to systray option. - * - * @param event action event - */ - @Action - public void isCloseToSystray(ActionEvent event) { - JCheckBoxMenuItem source = (JCheckBoxMenuItem) event.getSource(); - boolean closeToSystray = source.isSelected(); - config.setCloseToSystray(closeToSystray); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek1() { - config.setReportFirstDayOfWeek(1); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek2() { - config.setReportFirstDayOfWeek(2); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek3() { - config.setReportFirstDayOfWeek(3); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek4() { - config.setReportFirstDayOfWeek(4); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek5() { - config.setReportFirstDayOfWeek(5); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek6() { - config.setReportFirstDayOfWeek(6); - } - - /** - * Change report first day of week. - */ - @Action - public void isReportFirstDayOfWeek7() { - config.setReportFirstDayOfWeek(7); - } - - /** - * Increment task time. - */ - @Action(enabledProperty = "selectedSingleTask") - public void increment5Task() { - incrementTaskTime(5 * 60000); - } - - /** - * Increment task time. - */ - @Action(enabledProperty = "selectedSingleTask") - public void increment30Task() { - incrementTaskTime(30 * 60000); - } - - /** - * Decrement task time. - */ - @Action(enabledProperty = "selectedSingleTask") - public void decrement1Task() { - incrementTaskTime(-60000); - } - - /** - * Decrement task time. - */ - @Action(enabledProperty = "selectedSingleTask") - public void decrement5Task() { - incrementTaskTime(-5 * 60000); - } - - /** - * Decrement task time. - */ - @Action(enabledProperty = "selectedSingleTask") - public void decrement30Task() { - incrementTaskTime(-30 * 60000); - } - - /** - * Increment task time. - */ - @Action(enabledProperty = "selectedSingleTask") - public void increment1Task() { - incrementTaskTime(60000); - } - - /** - * Increment task time. - * - * To decrement, set negative increment:) - * - * @param increment increment in ms - */ - protected void incrementTaskTime(long increment) { - TimerTask selectedTask = projectsAndTasksTable.getSelectedTasks() - .get(0); - - // task is not running - Date now = new Date(); - long todayTime = selectedTask.getTime(now); - - long newTodayTime = todayTime + increment; - - try { - // check if + negative increment still positive - if (newTodayTime > 0) { - core.getData().changeTaskTime(selectedTask, now, - newTodayTime); - } else { - // force to 0 - core.getData().changeTaskTime(selectedTask, now, 0L); - } - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - - /** - * Reset task time to zero. - */ - @Action(enabledProperty = "selectedSingleTask") - public void setToZero() { - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - incrementTaskTime(-task.getTime(new Date())); - } - - /** - * Merge multiples tasks action. - */ - @Action(enabledProperty = "selectedMultiplesTasks") - public void mergeTasks() { - List<TimerTask> tasks = projectsAndTasksTable.getSelectedTasks(); - - TimerTask destinationTask = tasks.get(0); - List<TimerTask> otherTasks = tasks.subList(1, tasks.size()); - int confirm = JOptionPane.showConfirmDialog(getMainFrame(), - resourceMap.getString("input.mergeTaskMessage", tasks.size(), - destinationTask.getName()), resourceMap - .getString("input.mergeTaskTitle"), - JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - if (confirm == JOptionPane.YES_OPTION) { - - try { - core.getData().mergeTasks(destinationTask, otherTasks); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - } - - /** - * Add annotation action. - */ - @Action(enabledProperty = "selectedSingleTask") - public void addAnnotation() { - // select task to add new annotation - TimerTask selectedTask = projectsAndTasksTable.getSelectedTasks() - .get(0); - - String annotation = JOptionPane.showInputDialog(getMainFrame(), - resourceMap.getString("input.addAnnotationMessage", - selectedTask.getName()), resourceMap - .getString("input.addAnnotationTitle"), - JOptionPane.QUESTION_MESSAGE); - - if (annotation != null) { - // remove useless spaces - annotation = annotation.trim(); - - try { - core.getData().addAnnotation(selectedTask, new Date(), - annotation); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } - } - - /** - * Edit alert action. - */ - @Action(enabledProperty = "selectedSingleTask") - public void editAlert() { - // select task to edit alert - TimerTask selectedTask = projectsAndTasksTable.getSelectedTasks() - .get(0); - - AlertEditor alertEditor = new AlertEditor(this, core.getData(), - selectedTask); - show(alertEditor); - } - - /** - * Create report. - */ - @Action - public void makeReport() { - ReportView view = new ReportView(this, core); - show(view); - } - - /** - * Show about frame. - */ - @Action - public void about() { - HelpFrame aboutFrame = new HelpFrame(this); - show(aboutFrame); - } - - /** - * Is selected project. - * - * @return selected project property - */ - public boolean isSelectedSingleProject() { - return selectedSingleProject; - } - - /** - * Change selected project property. - * - * @param selectedSingleProject selected project property - */ - public void setSelectedSingleProject(boolean selectedSingleProject) { - boolean oldValue = this.selectedSingleProject; - this.selectedSingleProject = selectedSingleProject; - firePropertyChange("selectedSingleProject", oldValue, - selectedSingleProject); - } - - /** - * Is selected task. - * - * @return selected task property - */ - public boolean isSelectedSingleTask() { - return selectedSingleTask; - } - - /** - * Change selected task property. - * - * @param selectedSingleTask selected task property - */ - public void setSelectedSingleTask(boolean selectedSingleTask) { - boolean oldValue = this.selectedSingleTask; - this.selectedSingleTask = selectedSingleTask; - firePropertyChange("selectedSingleTask", oldValue, selectedSingleTask); - } - - /** - * Is selected task or project. - * - * @return selected task or project property - */ - public boolean isSelectedSingleElement() { - return selectedSingleElement; - } - - /** - * Change selected task or project property. - * - * @param selectedSingleElement selected task or project property - */ - public void setSelectedSingleElement(boolean selectedSingleElement) { - boolean oldValue = this.selectedSingleElement; - this.selectedSingleElement = selectedSingleElement; - firePropertyChange("selectedSingleElement", oldValue, - selectedSingleElement); - } - - /** - * Is selected running task. - * - * @return the selectedSingleRunningTask - */ - public boolean isSelectedSingleRunningTask() { - return selectedSingleRunningTask; - } - - /** - * Change selected running task property. - * - * @param selectedSingleRunningTask selected running task property - */ - public void setSelectedSingleRunningTask(boolean selectedSingleRunningTask) { - boolean oldValue = this.selectedSingleRunningTask; - this.selectedSingleRunningTask = selectedSingleRunningTask; - firePropertyChange("selectedSingleRunningTask", oldValue, - selectedSingleRunningTask); - } - - /** - * Is selected non running task. - * - * @return selected non running task - */ - public boolean isSelectedSingleStoppedTask() { - return selectedSingleStoppedTask; - } - - /** - * Change selected non running task property. - * - * @param selectedSingleStoppedTask selected non running task - */ - public void setSelectedSingleStoppedTask(boolean selectedSingleStoppedTask) { - boolean oldValue = this.selectedSingleStoppedTask; - this.selectedSingleStoppedTask = selectedSingleStoppedTask; - firePropertyChange("selectedSingleStoppedTask", oldValue, - selectedSingleStoppedTask); - } - - /** - * Is selected multiples projects. - * - * @return selected multiples projects - */ - public boolean isSelectedMultiplesProjects() { - return selectedMultiplesProjects; - } - - /** - * Change selected multiples projects property. - * - * @param selectedMultiplesProjects selected multiples projects - */ - public void setSelectedMultiplesProjects(boolean selectedMultiplesProjects) { - boolean oldValue = this.selectedMultiplesProjects; - this.selectedMultiplesProjects = selectedMultiplesProjects; - firePropertyChange("selectedMultiplesProjects", oldValue, - selectedMultiplesProjects); - } - - /** - * Is selected multiples tasks. - * - * @return selected multiples tasks - */ - public boolean isSelectedMultiplesTasks() { - return selectedMultiplesTasks; - } - - /** - * Change selected multiples tasks property. - * - * @param selectedMultiplesTasks selected multiples tasks - */ - public void setSelectedMultiplesTasks(boolean selectedMultiplesTasks) { - boolean oldValue = this.selectedMultiplesTasks; - this.selectedMultiplesTasks = selectedMultiplesTasks; - firePropertyChange("selectedMultiplesTasks", oldValue, - selectedMultiplesTasks); - } - - /** - * Is selected multiples elements. - * - * @return selected multiples elements - */ - public boolean isSelectedMultiplesElements() { - return selectedMultiplesElements; - } - - /** - * Change selected multiples elements property. - * - * @param selectedMultiplesElements selected multiples elements - */ - public void setSelectedMultiplesElements(boolean selectedMultiplesElements) { - boolean oldValue = this.selectedMultiplesElements; - this.selectedMultiplesElements = selectedMultiplesElements; - firePropertyChange("selectedMultiplesElements", oldValue, - selectedMultiplesElements); - } - - /* - * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent) - */ - @Override - public void valueChanged(TreeSelectionEvent e) { - // get selected elements - List<TimerTask> elements = projectsAndTasksTable.getSelectedElements(); - List<TimerProject> projects = projectsAndTasksTable - .getSelectedProjects(); - List<TimerTask> tasks = projectsAndTasksTable.getSelectedTasks(); - - // notify application that tree selection has changed - if (tasks.size() == 1 && projects.size() == 0) { - TimerTask task = tasks.get(0); - setSelectedSingleTask(true); - - // ask for SAF job manager if task is running - RunTaskJob job = getJobForRunningTask(task); - if (job == null || job.isStopping()) { - setSelectedSingleStoppedTask(true); - setSelectedSingleRunningTask(false); - } else { - setSelectedSingleStoppedTask(false); - setSelectedSingleRunningTask(true); - } - setSelectedMultiplesTasks(false); - setSelectedSingleProject(false); - setSelectedMultiplesProjects(false); - } else { - setSelectedSingleTask(false); - setSelectedSingleStoppedTask(false); - setSelectedSingleRunningTask(false); - - if (tasks.size() > 1) { - setSelectedMultiplesTasks(projects.size() == 0); - } else { - setSelectedSingleProject(tasks.size() == 0 - && projects.size() == 1); - setSelectedMultiplesProjects(tasks.size() == 0 - && projects.size() > 1); - } - } - setSelectedSingleElement(elements.size() == 1); - setSelectedMultiplesElements(elements.size() > 1); - } - - /** - * Get action for named component. - * - * Util method. - * - * @param actionName action name - * @return swing action - */ - protected javax.swing.Action getAction(String actionName) { - return getContext().getActionMap().get(actionName); - } - - /** - * Show window - */ - @Action - public void show() { - // TODO better code ? that use SAF methods ? - getMainFrame().setVisible(true); - getMainFrame().toFront(); - } - - /** - * Show window - */ - @Action - public void hide() { - // TODO better code ? that use SAF methods ? - getMainFrame().setVisible(false); - } - - /** - * Notified by job on pre idle detect. - */ - public void preIdleDetect() { - systrayManager.preIdleDetect(); - } - - /** - * Notified by job on post idle detect. - */ - public void postIdleDetect() { - systrayManager.postIdleDetect(); - } - - /* - * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) - */ - public void mouseClicked(MouseEvent e) { - - if (log.isDebugEnabled()) { - log.debug("Mouse clicked (" + e.getClickCount() - + " clics), source = " - + e.getSource().getClass().getName()); - } - - switch (e.getButton()) { - - // clic gauche - case MouseEvent.BUTTON1: - // clic sur l'arbre des projets - if (e.getSource() == projectsAndTasksTable) { - // demarre la tache lors d'un double clic dessus - if (e.getClickCount() == 2) { - - if (isSelectedSingleStoppedTask()) { // can only launch non running tasks - Task<?, ?> appTask = startTask(); - if (appTask != null) { - - // first, on dlb click stop all running tasks - stopAllTasks(); - - getContext().getTaskService().execute(appTask); - } - /* TODO EC-20100416 temp disable, called twice, can display - -1 task running :( - } else if (isSelectedSingleRunningTask()) { - TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - stopTask(task); */ - } else { - if (log.isDebugEnabled()) { - log.debug("Non selected non running task to launch"); - } - } - } else { - if (log.isDebugEnabled()) { - log.debug("Single clic on tree, do nothing"); - } - } - } - break; - - // gestion du clic droit - case MouseEvent.BUTTON3: - - // force task selection on rigth clic - TreePath path = projectsAndTasksTable.getPathForLocation(e.getX(), - e.getY()); - int selectedRow = projectsAndTasksTable.getRowForPath(path); - projectsAndTasksTable.getSelectionModel().setSelectionInterval( - selectedRow, selectedRow); - - // fix item selection - JPopupMenu menu = new JPopupMenu(); - - String[] actionNames = null; - - // construct menu in function of selection - if (isSelectedSingleProject()) { - actionNames = new String[] { "newTask", "---", "newProject", - "editProject", "closeProject", "deleteProject" }; - } - - if (isSelectedSingleTask()) { - actionNames = new String[] { "startTask", "stopTask", "---", - "newTask", "editTask", "closeTask", "deleteTask", - "---", "addAnnotation", "editAlert", "increment1Task", - "increment5Task", "increment30Task", "decrement1Task", - "decrement5Task", "decrement30Task", "setToZero" }; - } - - if (isSelectedMultiplesTasks()) { - actionNames = new String[] { "mergeTasks" }; - } - - // case, right clic, but nothing selected - if (actionNames != null) { - addActionToMenu(menu, actionNames); - - menu.show(e.getComponent(), e.getX(), e.getY()); - } - } - } - - public void mouseEntered(MouseEvent e) { - } - - public void mouseExited(MouseEvent e) { - } - - public void mousePressed(MouseEvent e) { - } - - public void mouseReleased(MouseEvent e) { - } -} Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerActions.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerActions.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerActions.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -26,8 +26,8 @@ package org.chorem.jtimer; import org.chorem.jtimer.JTimerConfig.JTimerAction; -import org.nuiton.util.ApplicationConfig; -import org.nuiton.util.ApplicationConfig.Action.Step; +import org.nuiton.util.config.ApplicationConfig; +import org.nuiton.util.config.ApplicationConfig.Action.Step; /** * JTimer actions class run from command line. @@ -75,7 +75,6 @@ @Step(JTimerConfig.STEP_AFTER_UI) public void start(String taskPath) { - JTimer ui = config.getObject(JTimer.class); - ui.startTask(taskPath); + } } Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerConfig.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerConfig.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerConfig.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -25,8 +25,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.util.ApplicationConfig; -import org.nuiton.util.ArgumentsParserException; +import org.nuiton.util.config.ApplicationConfig; +import org.nuiton.util.config.ArgumentsParserException; /** * JTimer configuration. Deleted: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerFactory.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerFactory.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/JTimerFactory.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -1,97 +0,0 @@ -/* - * #%L - * jTimer - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2007 - 2012 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 - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.jtimer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.jtimer.io.Saver; - -/** - * JTimer config class. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class JTimerFactory { - - /** Logger */ - private static Log log = LogFactory.getLog(JTimerFactory.class); - - /** Saver */ - protected static Saver saver; - - /** - * Constructeur. - */ - protected JTimerFactory() { - // disable instanciation - } - - /** - * Get saver manager. - * - * @return saver manager - */ - public static Saver getFileSaver() { - - if (saver == null) { - - Class saverClass = JTimer.config.getIOSaverClass(); - - // log - if (log.isInfoEnabled()) { - log.info("Using saver class : " + saverClass); - log.info(" with saver home directory : " + JTimer.config.getIOSaverDirectory()); - log.info(" with auto save delay : " + JTimer.config.getIOSaverAutoSaveDelay()); - } - - try { - // get instance - saver = (Saver) saverClass.newInstance(); - - // init instance - saver.setSaveDirectory(JTimer.config.getIOSaverDirectory()); - - // set delay to saver - saver.setAutoSaveDelay(JTimer.config.getIOSaverAutoSaveDelay() * 1000); - - } catch (InstantiationException e) { - if (log.isErrorEnabled()) { - log.error("Can't instanciate class : " + saverClass, e); - } - } catch (IllegalAccessException e) { - if (log.isErrorEnabled()) { - log.error("Can't access class : " + saverClass, e); - } - } - } - - return saver; - } -} Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/data/TimerCore.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/data/TimerCore.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/data/TimerCore.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -25,18 +25,8 @@ package org.chorem.jtimer.data; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.jtimer.JTimer; -import org.chorem.jtimer.JTimerFactory; -import org.chorem.jtimer.entities.TimerProject; -import org.chorem.jtimer.io.DataLockingException; -import org.chorem.jtimer.io.Saver; import org.chorem.jtimer.storage.Storage; /** @@ -68,7 +58,7 @@ data = new TimerDataManager(); // init storage - storage = new Storage(JTimer.config); + //storage = new Storage(JTimer.config); data.addDataEventListener(storage); // add commmon vetoable Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/entities/TimerTask.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/entities/TimerTask.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/entities/TimerTask.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -32,8 +32,6 @@ import java.util.SortedMap; import java.util.TreeMap; -import org.chorem.jtimer.utils.DailySortedMap; - /** * Represents a task. * @@ -91,7 +89,7 @@ * Constructor. */ public TimerTask() { - allDaysTimes = new DailySortedMap<Long>(); + //allDaysTimes = new DailySortedMap<Long>(); // les annoation sont à la seconde pres allDaysAnnotations = new TreeMap<Date, String>(); subTasks = new ArrayList<TimerTask>(); @@ -363,7 +361,7 @@ : (Date) creationDate.clone(); // make new list instance - task.allDaysTimes = new DailySortedMap<Long>(allDaysTimes); + //task.allDaysTimes = new DailySortedMap<Long>(allDaysTimes); task.allDaysAnnotations = new TreeMap<Date, String>(allDaysAnnotations); task.subTasks = new ArrayList<TimerTask>(subTasks); } catch (CloneNotSupportedException e) { Copied: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfo.java (from rev 2902, branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/SystemInfo.java) =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfo.java (rev 0) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfo.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -0,0 +1,45 @@ +/* + * #%L + * jTimer + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2007 - 2011 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 + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.jtimer.system; + +/** + * System info interface for all systems. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public interface SystemInfo { + + /** + * Get system idle time in milliseconds. + * + * @return system idle time in milliseconds + */ + public long getIdleTime(); +} Copied: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfoFactory.java (from rev 2902, branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/SystemInfoFactory.java) =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfoFactory.java (rev 0) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/SystemInfoFactory.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -0,0 +1,94 @@ +/* + * #%L + * jTimer + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2007 - 2011 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 + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.jtimer.system; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.bridj.Platform; +import org.chorem.jtimer.system.macos.MacOSSystemInfo; +import org.chorem.jtimer.system.unix.UnixSystemInfo; +import org.chorem.jtimer.system.win32.Win32SystemInfo; + +/** + * Build system info determined from system. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class SystemInfoFactory { + + /** log */ + private static Log log = LogFactory.getLog(SystemInfoFactory.class); + + /** Single instance */ + protected static SystemInfo instance; + + /** + * SystemInfoFactory Constructor. + */ + protected SystemInfoFactory() { + + } + + /** + * Return system info depending on system. + * + * @return SystemInfo instance + * @see SystemInfo + * @throws UnsupportedSystemInfoException if system info is not supported + * for system + */ + public static SystemInfo getSystemInfo() + throws UnsupportedSystemInfoException { + + if (instance == null) { + String os = System.getProperty("os.name"); + + // log it + if (log.isInfoEnabled()) { + log.info("Try do build system info for system : " + os); + } + + // try windows + if (Platform.isWindows()) { + instance = new Win32SystemInfo(); + } else if (Platform.isLinux()) { + instance = new UnixSystemInfo(); + } else if (Platform.isMacOSX()) { + instance = new MacOSSystemInfo(); + } else { + // system unknown + throw new UnsupportedSystemInfoException( + "Can't get system info for " + os); + } + } + + return instance; + } +} Copied: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/UnsupportedSystemInfoException.java (from rev 2902, branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/UnsupportedSystemInfoException.java) =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/UnsupportedSystemInfoException.java (rev 0) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/UnsupportedSystemInfoException.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -0,0 +1,69 @@ +/* + * #%L + * jTimer + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2007 - 2011 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 + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.jtimer.system; + +/** + * Exception thrown when system info is not available. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class UnsupportedSystemInfoException extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 138458861335881500L; + + /** + * Constructor. + * + * @param message message + * @param cause cause + */ + public UnsupportedSystemInfoException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructor. + * + * @param message message + */ + public UnsupportedSystemInfoException(String message) { + super(message); + } + + /** + * Constructor. + * + * @param cause cause. + */ + public UnsupportedSystemInfoException(Throwable cause) { + super(cause); + } +} Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/macos/ApplicationServices.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/ApplicationServices.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,7 +23,7 @@ * #L% */ -package org.chorem.jtimer.ui.system.macos; +package org.chorem.jtimer.system.macos; import org.bridj.BridJ; import org.bridj.ann.Library; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/MacOSSystemInfo.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/macos/MacOSSystemInfo.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/MacOSSystemInfo.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,9 +23,9 @@ * #L% */ -package org.chorem.jtimer.ui.system.macos; +package org.chorem.jtimer.system.macos; -import org.chorem.jtimer.ui.system.SystemInfo; +import org.chorem.jtimer.system.SystemInfo; /** * MacOSSystemInfo Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/package-info.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/macos/package-info.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/macos/package-info.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -25,4 +25,4 @@ /** * Mac OS specific system info implementation. */ -package org.chorem.jtimer.ui.system.macos; +package org.chorem.jtimer.system.macos; Copied: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/package-info.java (from rev 2902, branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/package-info.java) =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/package-info.java (rev 0) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/package-info.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -0,0 +1,28 @@ +/* + * #%L + * jTimer + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2007 - 2012 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 + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +/** + * System interface using Bridj to get system information. + */ +package org.chorem.jtimer.system; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/UnixSystemInfo.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/unix/UnixSystemInfo.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/UnixSystemInfo.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,12 +23,12 @@ * #L% */ -package org.chorem.jtimer.ui.system.unix; +package org.chorem.jtimer.system.unix; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.bridj.Pointer; -import org.chorem.jtimer.ui.system.SystemInfo; +import org.chorem.jtimer.system.SystemInfo; /** * Linux system info. Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/X11.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/unix/X11.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/X11.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -1,4 +1,4 @@ -package org.chorem.jtimer.ui.system.unix; +package org.chorem.jtimer.system.unix; import org.bridj.BridJ; import org.bridj.Pointer; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/Xss.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/unix/Xss.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/Xss.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,7 +23,7 @@ * #L% */ -package org.chorem.jtimer.ui.system.unix; +package org.chorem.jtimer.system.unix; import org.bridj.BridJ; import org.bridj.Pointer; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/package-info.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/unix/package-info.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/unix/package-info.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -25,4 +25,4 @@ /** * Linux specific system info implementation. */ -package org.chorem.jtimer.ui.system.unix; +package org.chorem.jtimer.system.unix; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/Kernel32.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/win32/Kernel32.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/Kernel32.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,7 +23,7 @@ * #L% */ -package org.chorem.jtimer.ui.system.win32; +package org.chorem.jtimer.system.win32; import org.bridj.*; import org.bridj.ann.*; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/User32.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/win32/User32.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/User32.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,7 +23,7 @@ * #L% */ -package org.chorem.jtimer.ui.system.win32; +package org.chorem.jtimer.system.win32; import org.bridj.BridJ; import org.bridj.Pointer; Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/Win32SystemInfo.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/win32/Win32SystemInfo.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/Win32SystemInfo.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,10 +23,10 @@ * #L% */ -package org.chorem.jtimer.ui.system.win32; +package org.chorem.jtimer.system.win32; import org.bridj.Pointer; -import org.chorem.jtimer.ui.system.SystemInfo; +import org.chorem.jtimer.system.SystemInfo; /** * Win32 System info. Modified: branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/package-info.java =================================================================== --- branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/ui/system/win32/package-info.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/main/java/org/chorem/jtimer/system/win32/package-info.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -25,4 +25,4 @@ /** * Windows specific system info implementation. */ -package org.chorem.jtimer.ui.system.win32; +package org.chorem.jtimer.system.win32; Modified: branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/AbstractJTimerTest.java =================================================================== --- branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/AbstractJTimerTest.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/AbstractJTimerTest.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -95,9 +95,6 @@ props.put("jtimer.io.saver.directory", testDataDirectory .getAbsolutePath()); - JTimer.config = new JTimerConfig(); - JTimer.config.appConfig.setOptions(props); // not call parse in test - if (log.isDebugEnabled()) { log.debug("Copy resource test directory to " + testDataDirectory.getAbsolutePath()); @@ -108,10 +105,6 @@ FileUtils.copyDirectory(new File("src/test/resources/testdata"), testDataDirectory, HiddenFileFilter.VISIBLE); - // force null, to force new instance - JTimerFactory.saver = null; - testSaver = JTimerFactory.getFileSaver(); - } /** Modified: branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java =================================================================== --- branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -27,9 +27,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.jtimer.io.GTimerIncrementalSaver; -import org.chorem.jtimer.io.Saver; -import org.testng.Assert; import org.testng.annotations.Test; /** @@ -56,13 +53,13 @@ log.info("Test property loading " + JTimerFactoryTest.class); } - Assert.assertEquals(JTimer.config.getIdleTime(), 299); + //Assert.assertEquals(JTimer.config.getIdleTime(), 299); - Assert.assertEquals(JTimer.config.getIOSaverClass(), GTimerIncrementalSaver.class); + //Assert.assertEquals(JTimer.config.getIOSaverClass(), GTimerIncrementalSaver.class); // Temp dir is dynamic //Assert.assertEquals(AbstractJTimerTest.getTempDirPath() + "/testngdata", // JTimer.config.getIOSaverDirectory()); - Assert.assertEquals(JTimer.config.getIOSaverAutoSaveDelay(), 199); + //Assert.assertEquals(JTimer.config.getIOSaverAutoSaveDelay(), 199); } @@ -71,8 +68,8 @@ */ @Test public void getFileSaverTest() { - Saver saver = JTimerFactory.getFileSaver(); + //Saver saver = JTimerFactory.getFileSaver(); - Assert.assertNotNull(saver); + //Assert.assertNotNull(saver); } } Modified: branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java =================================================================== --- branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -28,7 +28,6 @@ import java.util.Date; import org.chorem.jtimer.AbstractJTimerTest; -import org.chorem.jtimer.utils.DailySortedMap; import org.testng.Assert; import org.testng.annotations.Test; @@ -66,8 +65,8 @@ TimerTask clonedTask = task.clone(); - Assert.assertTrue(clonedTask.allDaysTimes instanceof DailySortedMap<?>, "Clone put invalid type for map"); - Assert.assertFalse(clonedTask.allDaysAnnotations instanceof DailySortedMap<?>, "Clone put invalid type for map"); + //Assert.assertTrue(clonedTask.allDaysTimes instanceof DailySortedMap<?>, "Clone put invalid type for map"); + //Assert.assertFalse(clonedTask.allDaysAnnotations instanceof DailySortedMap<?>, "Clone put invalid type for map"); } /** Modified: branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/storage/StorageTest.java =================================================================== --- branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/storage/StorageTest.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/storage/StorageTest.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -3,7 +3,6 @@ import java.io.File; import org.chorem.jtimer.AbstractJTimerTest; -import org.chorem.jtimer.JTimer; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -20,9 +19,9 @@ @BeforeMethod public void setUp() { String location = System.getProperty("java.io.tmpdir") + File.separator + "jtimer"; - JTimer.config.setStrorageDatabaseLocation(location); + //JTimer.config.setStrorageDatabaseLocation(location); - storage = new Storage(JTimer.config); + //storage = new Storage(JTimer.config); } @Test Modified: branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/system/SystemInfoFactoryTest.java =================================================================== --- branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/ui/system/SystemInfoFactoryTest.java 2013-07-11 20:30:35 UTC (rev 2902) +++ branches/2.0.0-evol-499-storage/src/test/java/org/chorem/jtimer/system/SystemInfoFactoryTest.java 2013-07-11 21:34:52 UTC (rev 2903) @@ -23,15 +23,14 @@ * #L% */ -package org.chorem.jtimer.ui.system; +package org.chorem.jtimer.system; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.jtimer.AbstractJTimerTest; -import org.chorem.jtimer.ui.report.ReportGeneratorTest; -import org.chorem.jtimer.ui.system.SystemInfo; -import org.chorem.jtimer.ui.system.SystemInfoFactory; -import org.chorem.jtimer.ui.system.UnsupportedSystemInfoException; +import org.chorem.jtimer.system.SystemInfo; +import org.chorem.jtimer.system.SystemInfoFactory; +import org.chorem.jtimer.system.UnsupportedSystemInfoException; import org.testng.Assert; import org.testng.annotations.Test; @@ -47,7 +46,7 @@ public class SystemInfoFactoryTest extends AbstractJTimerTest { /** log. */ - private static Log log = LogFactory.getLog(ReportGeneratorTest.class); + private static Log log = LogFactory.getLog(SystemInfoFactoryTest.class); /** * Test to get system info.
participants (1)
-
echatellier@users.chorem.org