View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.x.impl.swing;
14  
15  import java.awt.Dimension;
16  
17  import javax.swing.Action;
18  import javax.swing.JButton;
19  
20  import com.eviware.x.form.XFormTextField;
21  
22  public class ActionFormFieldComponent extends AbstractSwingXFormField<JButton> implements XFormTextField
23  {
24  	public ActionFormFieldComponent( String name, String description )
25  	{
26  		super( new JButton( name ) );
27  	}
28  
29  	public void setWidth( int columns )
30  	{
31  		getComponent().setPreferredSize( new Dimension( columns, 20 ) );
32  	}
33  
34  	public String getValue()
35  	{
36  		return null;
37  	}
38  
39  	public void setValue( String value )
40  	{
41  	}
42  
43  	@Override
44  	public void setProperty( String name, Object value )
45  	{
46  		if( name.equals( "action" ) )
47  		{
48  			getComponent().setAction( ( Action )value );
49  		}
50  		else
51  		{
52  			super.setProperty( name, value );
53  		}
54  	}
55  
56  }