Author: echatellier Date: 2012-03-16 12:01:06 +0100 (Fri, 16 Mar 2012) New Revision: 2829 Url: http://chorem.org/repositories/revision/jtimer/2829 Log: Revert commit on test code (never been used) Removed: trunk/src/main/java/org/chorem/jtimer/entities/TimerObject.java trunk/src/main/java/org/chorem/jtimer/entities/TimerProjectsList.java Modified: trunk/src/main/java/org/chorem/jtimer/entities/TimerAlert.java trunk/src/main/java/org/chorem/jtimer/entities/TimerTask.java Modified: trunk/src/main/java/org/chorem/jtimer/entities/TimerAlert.java =================================================================== --- trunk/src/main/java/org/chorem/jtimer/entities/TimerAlert.java 2012-03-16 11:00:21 UTC (rev 2828) +++ trunk/src/main/java/org/chorem/jtimer/entities/TimerAlert.java 2012-03-16 11:01:06 UTC (rev 2829) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2011 CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 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 @@ -36,14 +36,11 @@ * Last update : $Date$ * By : $Author$ */ -public class TimerAlert extends TimerObject implements Serializable, Cloneable { +public class TimerAlert implements Serializable, Cloneable { /** serialVersionUID. */ private static final long serialVersionUID = 584921087501157113L; - public static final String PROPERTY_TYPE = "type"; - public static final String PROPERTY_DURATION = "duration"; - /** * Alert type. */ @@ -92,10 +89,7 @@ * @param type the type to set */ public void setType(Type type) { - getVetoableSupport().firePropertyChange(PROPERTY_TYPE, this.type, type); - Type oldValue = this.type; this.type = type; - getChangeSupport().firePropertyChange(PROPERTY_TYPE, oldValue, this.type); } /** @@ -113,10 +107,7 @@ * @param duration the duration to set (in seconds) */ public void setDuration(long duration) { - getVetoableSupport().firePropertyChange(PROPERTY_DURATION, this.duration, duration); - long oldValue = this.duration; this.duration = duration; - getChangeSupport().firePropertyChange(PROPERTY_DURATION, oldValue, this.duration); } /* Deleted: trunk/src/main/java/org/chorem/jtimer/entities/TimerObject.java =================================================================== --- trunk/src/main/java/org/chorem/jtimer/entities/TimerObject.java 2012-03-16 11:00:21 UTC (rev 2828) +++ trunk/src/main/java/org/chorem/jtimer/entities/TimerObject.java 2012-03-16 11:01:06 UTC (rev 2829) @@ -1,93 +0,0 @@ -/* - * #%L - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 - 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.entities; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -/** - * Timer object. - * - * Contains listener. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public abstract class TimerObject { - - /** Property change support for vetoable actions (private to use getter). */ - private transient PropertyChangeSupport vetoableSupport; - - /** Property change support for change actions (private to use getter). */ - private transient PropertyChangeSupport changeSupport; - - protected PropertyChangeSupport getVetoableSupport() { - if (vetoableSupport == null) { - vetoableSupport = new PropertyChangeSupport(this); - } - return vetoableSupport; - } - - protected PropertyChangeSupport getChangeSupport() { - if (changeSupport == null) { - changeSupport = new PropertyChangeSupport(this); - } - return changeSupport; - } - - public void addVetoableListener(PropertyChangeListener listener) { - vetoableSupport.addPropertyChangeListener(listener); - } - - public void removeVetoableListener(PropertyChangeListener listener) { - vetoableSupport.removePropertyChangeListener(listener); - } - - public void addVetoableListener(String propertyName, PropertyChangeListener listener) { - vetoableSupport.addPropertyChangeListener(propertyName, listener); - } - - public void removeVetoableListener(String propertyName, PropertyChangeListener listener) { - vetoableSupport.removePropertyChangeListener(propertyName, listener); - } - - public void addChangeListener(PropertyChangeListener listener) { - changeSupport.addPropertyChangeListener(listener); - } - - public void removeChangeListener(PropertyChangeListener listener) { - changeSupport.removePropertyChangeListener(listener); - } - - public void addChangeListener(String propertyName, PropertyChangeListener listener) { - changeSupport.addPropertyChangeListener(propertyName, listener); - } - - public void removeChangeListener(String propertyName, PropertyChangeListener listener) { - changeSupport.removePropertyChangeListener(propertyName, listener); - } -} Deleted: trunk/src/main/java/org/chorem/jtimer/entities/TimerProjectsList.java =================================================================== --- trunk/src/main/java/org/chorem/jtimer/entities/TimerProjectsList.java 2012-03-16 11:00:21 UTC (rev 2828) +++ trunk/src/main/java/org/chorem/jtimer/entities/TimerProjectsList.java 2012-03-16 11:01:06 UTC (rev 2829) @@ -1,72 +0,0 @@ -/* - * #%L - * jTimer - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 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.entities; - -import java.util.ArrayList; -import java.util.List; - -/** - * Simply manage a project list for listener to register on that object. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class TimerProjectsList extends TimerObject { - - protected List<TimerProject> projects; - - public static final String PROPERTY_PROJECTS = "projects"; - - /** - * Constructor. - */ - public TimerProjectsList() { - projects = new ArrayList<TimerProject>(); - } - - /** - * Get project list. - * - * @return project list - */ - public List<TimerProject> getProjects() { - return projects; - } - - /** - * Add new project to project list. - * - * @param project project - */ - public void addProject(TimerProject project) { - getVetoableSupport().firePropertyChange(PROPERTY_PROJECTS, null, projects); - projects.add(project); - getChangeSupport().firePropertyChange(PROPERTY_PROJECTS, null, projects); - } -} Modified: trunk/src/main/java/org/chorem/jtimer/entities/TimerTask.java =================================================================== --- trunk/src/main/java/org/chorem/jtimer/entities/TimerTask.java 2012-03-16 11:00:21 UTC (rev 2828) +++ trunk/src/main/java/org/chorem/jtimer/entities/TimerTask.java 2012-03-16 11:01:06 UTC (rev 2829) @@ -49,22 +49,12 @@ * * @see SerializationUtils */ -public class TimerTask extends TimerObject implements Cloneable, +public class TimerTask implements Cloneable, Comparable<TimerTask>, Serializable { /** serialVersionUID */ private static final long serialVersionUID = -7590755569706702695L; - public static final String PROPERTY_NUMBER = "number"; - public static final String PROPERTY_NAME = "name"; - public static final String PROPERTY_CREATION_DATE = "creationDate"; - public static final String PROPERTY_CLOSED = "closed"; - public static final String PROPERTY_PARENT = "parent"; - public static final String PROPERTY_ALL_DAYS_TIMES = "allDaysTimes"; - public static final String PROPERTY_ALL_DAYS_ANNOTATIONS = "allDaysAnnotations"; - public static final String PROPERTY_SUB_TASKS = "subTasks"; - public static final String PROPERTY_ALERTS = "alerts"; - /** Task uuid used to managed task equality. */ protected String uuid = UUID.randomUUID().toString(); @@ -145,10 +135,7 @@ * @param number the number to set */ public void setNumber(int number) { - getVetoableSupport().firePropertyChange(PROPERTY_NUMBER, this.number, number); - int oldValue = this.number; this.number = number; - getChangeSupport().firePropertyChange(PROPERTY_NUMBER, oldValue, this.number); } /** @@ -166,10 +153,7 @@ * @param name the name to set */ public void setName(String name) { - getVetoableSupport().firePropertyChange(PROPERTY_NAME, this.name, name); - String oldValue = this.name; this.name = name; - getChangeSupport().firePropertyChange(PROPERTY_NAME, oldValue, this.name); } /** @@ -187,10 +171,7 @@ * @param creationDate creation date */ public void setCreationDate(Date creationDate) { - getVetoableSupport().firePropertyChange(PROPERTY_CREATION_DATE, this.creationDate, creationDate); - Date oldValue = this.creationDate; this.creationDate = creationDate; - getChangeSupport().firePropertyChange(PROPERTY_CREATION_DATE, oldValue, this.creationDate); } /** @@ -208,10 +189,7 @@ * @param closed closed */ public void setClosed(boolean closed) { - getVetoableSupport().firePropertyChange(PROPERTY_CLOSED, this.closed, closed); - boolean oldValue = this.closed; this.closed = closed; - getChangeSupport().firePropertyChange(PROPERTY_CLOSED, oldValue, this.closed); } /** @@ -231,16 +209,12 @@ * @param parent the parent to set */ protected void setParent(TimerTask parent) { - // will cause an infinite loop if (parent == this) { throw new IllegalArgumentException("Parent can't be current task"); } - - getVetoableSupport().firePropertyChange(PROPERTY_PARENT, this.parent, parent); - TimerTask oldValue = this.parent; this.parent = parent; - getChangeSupport().firePropertyChange(PROPERTY_PARENT, oldValue, this.parent); + } /** @@ -264,10 +238,7 @@ // set parent t.setParent(this); - - getVetoableSupport().firePropertyChange(PROPERTY_SUB_TASKS, null, subTasks); boolean result = subTasks.add(t); - getChangeSupport().firePropertyChange(PROPERTY_SUB_TASKS, null, this.parent); return result; } @@ -280,9 +251,7 @@ * @param seconds seconds */ public void setTime(Date date, Long seconds) { - getVetoableSupport().firePropertyChange(PROPERTY_ALL_DAYS_TIMES, null, allDaysTimes); allDaysTimes.put(date, seconds); - getChangeSupport().firePropertyChange(PROPERTY_ALL_DAYS_TIMES, null, this.allDaysTimes); } /** @@ -318,9 +287,7 @@ * @param note note text */ public void addAnnotation(Date date, String note) { - getVetoableSupport().firePropertyChange(PROPERTY_ALL_DAYS_ANNOTATIONS, null, allDaysAnnotations); allDaysAnnotations.put(date, note); - getChangeSupport().firePropertyChange(PROPERTY_ALL_DAYS_ANNOTATIONS, null, this.allDaysAnnotations); } /** @@ -338,9 +305,7 @@ * @param alert */ public void addAlert(TimerAlert alert) { - getVetoableSupport().firePropertyChange(PROPERTY_ALERTS, null, alerts); alerts.add(alert); - getChangeSupport().firePropertyChange(PROPERTY_ALERTS, null, alerts); } /** @@ -358,9 +323,7 @@ * @param alerts new alerts list */ public void setAlert(List<TimerAlert> alerts) { - getVetoableSupport().firePropertyChange(PROPERTY_ALERTS, null, alerts); this.alerts = alerts; - getChangeSupport().firePropertyChange(PROPERTY_ALERTS, null, alerts); } /*
participants (1)
-
echatellier@users.chorem.org