-
Notifications
You must be signed in to change notification settings - Fork 921
Expand file tree
/
Copy pathClient.java
More file actions
174 lines (144 loc) · 4.95 KB
/
Client.java
File metadata and controls
174 lines (144 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package clienteditor;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
/**
* Information about one clinet.
*
* @author Jiri Vagner, Jan Stola
*/
public class Client {
/** First name of the client. */
private String firstName;
/** Surname of the client. */
private String surname;
/** Nickname of the client. */
private String nickname;
/** Age of the client. */
private int age;
/** Sex of the client (0 - female, 1 - male). */
private int sex;
/** Marital status of the client (0 - single, 1 - married, 2 - separated, 3 - divorced) */
private int maritalStatus;
/** E-mail of the client. */
private String email;
/** Home web page of the client. */
private String web;
/** Instant messenger of the client. */
private String im;
// <editor-fold defaultstate="collapsed" desc="PropertyChange Stuff">
private final PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener listener) {
changeSupport.addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(listener);
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Get Methods">
public String getFirstName() {
return firstName;
}
public String getSurname() {
return surname;
}
public String getNickname() {
return nickname;
}
public int getAge() {
return age;
}
public String getEmail() {
return email;
}
public String getWeb() {
return web;
}
public String getIm() {
return im;
}
public int getSex() {
return sex;
}
public int getMaritalStatus() {
return maritalStatus;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Set Methods">
public void setFirstName(String firstName) {
String oldFirstName = this.firstName;
this.firstName = firstName;
changeSupport.firePropertyChange("firstName", oldFirstName, firstName);
}
public void setSurname(String surname) {
String oldSurname = this.surname;
this.surname = surname;
changeSupport.firePropertyChange("surname", oldSurname, surname);
}
public void setNickname(String nickname) {
String oldNickname = this.nickname;
this.nickname = nickname;
changeSupport.firePropertyChange("nickname", oldNickname, nickname);
}
public void setAge(int age) {
int oldAge = this.age;
this.age = age;
changeSupport.firePropertyChange("age", oldAge, age);
}
public void setEmail(String email) {
String oldEmail = this.email;
this.email = email;
changeSupport.firePropertyChange("email", oldEmail, email);
}
public void setWeb(String web) {
String oldWeb = this.web;
this.web = web;
changeSupport.firePropertyChange("web", oldWeb, web);
}
public void setIm(String im) {
String oldIm = this.im;
this.im = im;
changeSupport.firePropertyChange("im", oldIm, im);
}
public void setSex(int sex) {
int oldSex = this.sex;
this.sex = sex;
changeSupport.firePropertyChange("sex", oldSex, sex);
}
public void setMaritalStatus(int maritalStatus) {
int oldMaritalStatus = this.maritalStatus;
this.maritalStatus = maritalStatus;
changeSupport.firePropertyChange("maritalStatus", oldMaritalStatus, maritalStatus);
}
// </editor-fold>
public static Client createTestClient() {
Client client = new Client();
client.setFirstName("George");
client.setSurname("Foo");
client.setNickname("Juraj");
client.setAge(30);
client.setEmail("g.foo@foo.org");
client.setWeb("https://beansbinding.dev.java.net");
client.setIm("ICQ: 53 25 89 76");
client.setSex(1);
client.setMaritalStatus(2);
return client;
}
}