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.components;
17
18 /**
19 * <p>
20 * An interface for describing call back operations that can be registered at
21 * the central builder data object.
22 * </p>
23 * <p>
24 * Constructing a user GUI and an accompaning
25 * {@link net.sf.jguiraffe.gui.forms.Form Form} object is a complex
26 * and non linear process. For instance it can happen that a component is
27 * created that must be connected to another component, which has not yet been
28 * created (e.g. a label that is associated with another GUI widget). Such
29 * references cannot savely be resolved before the building process has
30 * finished.
31 * </p>
32 * <p>
33 * This interface provides a solution to the mentioned problem. It allows
34 * interested objects to register themselves as call backs at the builder data
35 * object. These call backs are executed when the building process ends. At this
36 * time all GUI components have been created and are accessable through the
37 * builder data object. So the registered objects should be able to resolve all
38 * valid references to components created during the building operation.
39 * </p>
40 * <p>
41 * But implementations of this interface are not limited to resolving
42 * references. They can perform arbitrary actions that need to be executed after
43 * the building process has been completed.
44 * </p>
45 *
46 * @author Oliver Heger
47 * @version $Id: ComponentBuilderCallBack.java 205 2012-01-29 18:29:57Z oheger $
48 */
49 public interface ComponentBuilderCallBack
50 {
51 /**
52 * Executes the call back. In this method implementing classes can pack
53 * arbitrary logic that should be executed after the building process has
54 * been completed. The passed in parameters can be used to access all
55 * information gathered at the building process. If an implementation throws
56 * an exception, this exception is passed through to the caller of the
57 * building operation.
58 *
59 * @param builderData the builder data object of the current building
60 * process
61 * @param params an arbitrary parameter object that has been registered with
62 * the call back object
63 * @throws FormBuilderException an implementation can throw this exception
64 * to indicate that the building process should fail
65 */
66 void callBack(ComponentBuilderData builderData, Object params)
67 throws FormBuilderException;
68 }