1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.x.impl.swing;
14
15 import java.awt.BorderLayout;
16 import java.awt.Dimension;
17
18 import javax.swing.JComponent;
19 import javax.swing.JPanel;
20
21 import com.eviware.soapui.support.components.JFormComponent;
22
23 public class JComponentFormField extends AbstractSwingXFormField<JPanel>
24 {
25 private JComponent component;
26
27 public JComponentFormField(String label, String description)
28 {
29 super( new JPanel( new BorderLayout() ) );
30 getComponent().setPreferredSize(new Dimension( 350, 200 ));
31 }
32
33 public void setValue(String value)
34 {
35 if( component instanceof JFormComponent )
36 ((JFormComponent)component).setValue(value);
37 }
38
39 public String getValue()
40 {
41 if( component instanceof JFormComponent )
42 return ((JFormComponent)component).getValue();
43 else
44 return null;
45 }
46
47 @Override
48 public void setProperty(String name, Object value)
49 {
50 if( name.equals("component"))
51 {
52 getComponent().removeAll();
53 if( value != null )
54 getComponent().add( (JComponent)value, BorderLayout.CENTER );
55 }
56 else
57 {
58 super.setProperty(name, value);
59 }
60 }
61 }