View Javadoc

1   /*
2    * This file is part of NetPisteur.
3    * 
4    * Copyright 2001-2002 : Olivier CORNEC, David BOUANCHEAU, Loic LOPEZ,
5    *                       Gaetan BOUDARD, Mael LE LANNOU, Julien ROBINEAU
6    * 
7    * Copyright 2002-2003 : Olivier BRIENS, Simon DEZE, Florence FRIGOULT,
8    *                       Olivier JOURNEAULT, Francois MARTINIER, Damien RAUDE-MORVAN
9    * 
10   * Copyright 2004-2007 : Damien RAUDE-MORVAN
11   * 
12   * NetPisteur is free software; you can redistribute it and/or modify
13   * it under the terms of the GNU General Public License as published by
14   * the Free Software Foundation; either version 2 of the License, or
15   * (at your option) any later version.
16   *
17   * NetPisteur is distributed in the hope that it will be useful,
18   * but WITHOUT ANY WARRANTY; without even the implied warranty of
19   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20   * GNU General Public License for more details.
21   *
22   * You should have received a copy of the GNU General Public License
23   * along with NetPisteur; if not, write to the Free Software
24   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
25   */
26  package com.drazzib.netpisteur.monitor;
27  
28  import java.util.Calendar;
29  import java.util.GregorianCalendar;
30  
31  /**
32   * Represents the class Click which is used to get informations about the mouse
33   * 's coordinates and the date when the mouse is clicked.
34   * 
35   * @author NetPisteur Team
36   */
37  public class Click {
38  
39  	// /////////////////////////////////////
40  	// attributes
41  
42  	/**
43  	 * Represents the mouse's position(x-coordinates & ordinates) & the date
44  	 * 
45  	 */
46  	// mouse's positions
47  	private int x, y;
48  
49  	// the Calendar
50  	private GregorianCalendar calen;
51  
52  	// time of System
53  	private long millisec;
54  
55  	// /////////////////////////////////////
56  	// associations
57  
58  	/**
59  	 * empty constructor which initializes the coordinates at zero and the Date
60  	 * as null
61  	 * 
62  	 */
63  	public Click() {
64  		this.x = 0;
65  		this.y = 0;
66  		this.calen = null;
67  		this.millisec = System.currentTimeMillis();
68  	} // Click's end
69  
70  	/**
71  	 * normal constructor which initializes the coordinates and the date as
72  	 * those entered as parameter in this constructor
73  	 * 
74  	 * @param _x //
75  	 *            the x-coordinates
76  	 * @param _y //
77  	 *            the y-coordinates
78  	 * @param leCalen //
79  	 *            Gregorian Calendar
80  	 */
81  
82  	public Click(int _x, int _y, GregorianCalendar leCalen) {
83  		this.x = _x;
84  		this.y = _y;
85  		this.calen = leCalen;
86  		this.millisec = System.currentTimeMillis();
87  	} // Click's end
88  
89  	// /////////////////////////////////////
90  	// access methods for attributes
91  
92  	/**
93  	 * get the x-coordinates of the mouse's position when it is clicked
94  	 * 
95  	 * @return the x-coordinates
96  	 * 
97  	 */
98  	public int getAbs() {
99  		return (this.x);
100 	} // getAbs'end
101 
102 	/**
103 	 * get the ordinates of the mouse's position when it is clicked
104 	 * 
105 	 * @return the ordinates
106 	 * 
107 	 */
108 	public int getOrd() {
109 		return (this.y);
110 	} // getOrd's end
111 
112 	/**
113 	 * get the time's hour when someone clicks on the mouse
114 	 * 
115 	 * @return the hours when it is clicked
116 	 */
117 	public int getHours() {
118 		return this.calen.get(Calendar.HOUR_OF_DAY);
119 	} // getDateHours'end
120 
121 	/**
122 	 * get the time's minute when someone clicks on the mouse
123 	 * 
124 	 * @return the minutes when it is clicked
125 	 */
126 	public int getMinutes() {
127 		return this.calen.get(Calendar.MINUTE);
128 	} // getDateMinutes'end
129 
130 	/**
131 	 * get the time's second when someone clicks on the mouse
132 	 * 
133 	 * @return the seconds when it is clicked
134 	 * 
135 	 */
136 	public int getSeconds() {
137 		return this.calen.get(Calendar.SECOND);
138 	} // getDateSeconds'end
139 
140 	/**
141 	 * get the time in millisec since 1970 when someone clicks on the * mouse
142 	 * 
143 	 * @return the milliseconds when it is clicked
144 	 * 
145 	 */
146 
147 	public long getMilliSec() {
148 		return this.millisec;
149 	}
150 
151 	/**
152 	 * get the Gregorian Calendar when someone clicks on the mouse
153 	 * 
154 	 * @return the Gregorian Calendar when it is clicked
155 	 * 
156 	 */
157 	public GregorianCalendar getCalen() {
158 		return this.calen;
159 	}
160 	// getCalen()
161 
162 } // Click class'end