1   /*
2    * Copyright 2002-2004 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package org.springframework.binding.value.swing;
17  
18  import javax.swing.JComponent;
19  
20  import org.springframework.richclient.form.builder.FormComponentInterceptor;
21  
22  /**
23   * @author Peter De Bruycker
24   */
25  public class TestableFormComponentInterceptor implements FormComponentInterceptor {
26  
27      private JComponent component;
28  
29      private int componentCount;
30  
31      private String componentProperty;
32  
33      private JComponent label;
34  
35      private int labelCount;
36  
37      private String labelProperty;
38  
39      public JComponent getComponent() {
40          return component;
41      }
42  
43      public int getComponentCount() {
44          return componentCount;
45      }
46  
47      public String getComponentProperty() {
48          return componentProperty;
49      }
50  
51      public JComponent getLabel() {
52          return label;
53      }
54  
55      public int getLabelCount() {
56          return labelCount;
57      }
58  
59      public String getLabelProperty() {
60          return labelProperty;
61      }
62  
63      public void processComponent(String propertyName, JComponent component) {
64          componentCount++;
65          componentProperty = propertyName;
66          this.component = component;
67      }
68  
69      public void processLabel(String propertyName, JComponent label) {
70          labelCount++;
71          labelProperty = propertyName;
72          this.label = label;
73      }
74  }