View Javadoc

1   /*
2    *  File: TimeBarMarkerImpl.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation; either version 2 of the License, or
9    *  (at your option) any later version.
10   *
11   *  This program is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   *  GNU General Public License for more details.
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  package de.jaret.util.ui.timebars;
21  
22  import de.jaret.util.date.JaretDate;
23  
24  /**
25   * A simple implementation of a marker for the TimeBarViewer.
26   * 
27   * @author Peter Kliem
28   * @version $Id: TimeBarMarkerImpl.java 821 2009-02-04 21:12:16Z kliem $
29   */
30  public class TimeBarMarkerImpl extends AbstractTimeBarMarker {
31      /** current date of the marker. */
32      protected JaretDate _date;
33  
34      /** description string. */
35      protected String _description;
36  
37      /** tooltip. */
38      protected String _tooltip;
39  
40      /**
41       * Construct a time bar marker.
42       * 
43       * @param draggable true if the marker should be draggable
44       * @param date the initial date of the marker
45       */
46      public TimeBarMarkerImpl(boolean draggable, JaretDate date) {
47          super(draggable);
48          _date = date;
49      }
50  
51  
52      /**
53       * {@inheritDoc}
54       */
55      public JaretDate getDate() {
56          return _date;
57      }
58  
59      /**
60       * Set the date of the marker.
61       * 
62       * @param date The date to set.
63       */
64      public void setDate(JaretDate date) {
65          JaretDate oldVal = _date;
66          _date = date.copy();
67          fireMarkerChanged(oldVal, _date);
68      }
69  
70      /**
71       * {@inheritDoc}
72       */
73      public String getDescription() {
74          return _description;
75      }
76  
77      /**
78       * {@inheritDoc}
79       */
80      public void setDescription(String description) {
81          String oldVal = _description;
82          _description = description;
83          fireMarkerDescriptionChanged(oldVal, _description);
84      }
85  
86      /**
87       * {@inheritDoc}
88       */
89      public String getTooltipText() {
90          return _tooltip;
91      }
92  
93      /**
94       * {@inheritDoc}
95       */
96      public void setTooltipText(String tooltip) {
97          _tooltip = tooltip;
98      }
99  }