1 /*
2 * Copyright (c) 2003-2008 by Cosylab d. d.
3 *
4 * This file is part of Java-Common.
5 *
6 * Java-Common 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 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Java-Common 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 Java-Common. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package com.cosylab.events;
21
22 import java.util.EventObject;
23
24
25 /**
26 * Notifys listeners that user set action was performed on number displayer.
27 *
28 * @author Ales Pucelj
29 * @version $$id$$
30 */
31 public class SetEvent extends EventObject
32 {
33 private final Number value;
34
35 /**
36 * Constructor for SliderSetEvent.
37 *
38 * @param source Object
39 * @param newValue double
40 */
41 public SetEvent(Object source, double newValue)
42 {
43 super(source);
44 value = new Double(newValue);
45 }
46
47 /**
48 * Constructor for SliderSetEvent.
49 *
50 * @param source Object
51 * @param newValue Object
52 *
53 * @throws NullPointerException DOCUMENT ME!
54 */
55 public SetEvent(Object source, Number newValue)
56 {
57 super(source);
58
59 if (newValue == null) {
60 throw new NullPointerException("newValue == null");
61 }
62
63 value = newValue;
64 }
65
66 /**
67 * Returns value which was set by user.
68 *
69 * @return Number
70 */
71 public Number getValue()
72 {
73 return value;
74 }
75
76 /**
77 * Returns set value as double.
78 *
79 * @return double
80 */
81 public double getDoubleValue()
82 {
83 return value.doubleValue();
84 }
85
86 /**
87 * Returns set value as long.
88 *
89 * @return double
90 */
91 public long getLongValue()
92 {
93 return value.longValue();
94 }
95 }
96
97 /* __oOo__ */