1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.gui.builder.window.ctrl;
17
18 /**
19 * <p>
20 * A specialized {@code FormControllerEvent} class that is generated whenever a
21 * form field changes its visited status.
22 * </p>
23 * <p>
24 * Event objects of this type are sent to
25 * {@link FormControllerFieldStatusListener} objects registered at a
26 * {@link FormController} when a field in the controller's form is visited for
27 * the first time.
28 * </p>
29 *
30 * @author Oliver Heger
31 * @version $Id: FormControllerFieldStatusEvent.java 205 2012-01-29 18:29:57Z oheger $
32 */
33 public class FormControllerFieldStatusEvent extends FormControllerEvent
34 {
35 /**
36 * The serial version UID.
37 */
38 private static final long serialVersionUID = 20091210L;
39
40 /** The name of the field affected by this event. */
41 private final String fieldName;
42
43 /**
44 * Creates a new instance of {@code FormControllerFieldStatusEvent} and
45 * initializes it with the {@code FormController} that is the source of this
46 * event and the name of the field affected by this event.
47 *
48 * @param controller the {@code FormController} (must not be <b>null</b>)
49 * @param field the name of the field whose status has changed (must not be
50 * <b>null</b>)
51 * @throws IllegalArgumentException if a required parameter is missing
52 */
53 public FormControllerFieldStatusEvent(FormController controller,
54 String field)
55 {
56 super(controller);
57 if (field == null)
58 {
59 throw new IllegalArgumentException("Field name must not be null!");
60 }
61 fieldName = field;
62 }
63
64 /**
65 * Returns the name of the field whose status has changed.
66 *
67 * @return the name of the field affected by this event
68 */
69 public String getFieldName()
70 {
71 return fieldName;
72 }
73 }