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 javax.swing.JComponent;
16  import javax.swing.JScrollPane;
17  import javax.swing.JTextArea;
18  
19  import com.eviware.soapui.support.UISupport;
20  import com.eviware.x.form.XFormTextField;
21  
22  public class JMultilineLabelTextField extends AbstractSwingXFormField<JComponent> implements XFormTextField
23  {
24  	private JScrollPane scrollPane;
25  
26  	public JMultilineLabelTextField()
27  	{
28  		super( new JTextArea() );
29  
30  		getTextArea().setEditable( false );
31  		getTextArea().setEnabled( false );
32  
33  		scrollPane = new JScrollPane( getTextArea() );
34  		UISupport.setFixedSize( scrollPane, 300, 100 );
35  	}
36  
37  	public JTextArea getTextArea()
38  	{
39  		return ( JTextArea )super.getComponent();
40  	}
41  
42  	public JComponent getComponent()
43  	{
44  		return scrollPane;
45  	}
46  
47  	public void setValue( String value )
48  	{
49  		getTextArea().setText( value );
50  	}
51  
52  	public String getValue()
53  	{
54  		return getTextArea().getText();
55  	}
56  
57  	public void setWidth( int columns )
58  	{
59  		getTextArea().setColumns( columns );
60  	}
61  
62  	@Override
63  	public boolean isMultiRow()
64  	{
65  		return true;
66  	}
67  }