View Javadoc

1   /*
2    * Copyright (c) 2003-2008 by Cosylab d. d.
3    *
4    * This file is part of CosyBeans-Common.
5    *
6    * CosyBeans-Common is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * CosyBeans-Common is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with CosyBeans-Common.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package com.cosylab.gui.components.customizer;
21  
22  import java.beans.Customizer;
23  import java.beans.PropertyDescriptor;
24  
25  import com.cosylab.gui.components.introspection.PropertiesTable;
26  
27  
28  /**
29   * <code>PropertiesTableCustomizer</code> is a Customizer which lists 
30   * all properties in a two column table. One column represents the names
31   * of the properties and the other one hold the settable values. 
32   * 
33   * @author Igor Kriznar (igor.kriznarATcosylab.com)
34   *
35   */
36  public class PropertiesTableCustomizer extends PropertiesTable implements
37  		Customizer {
38  
39  	private static final long serialVersionUID = 1L;
40  
41  	/**
42  	 * Creates new instance of PropertiesTableCustomizer.
43  	 */
44  	public PropertiesTableCustomizer() {
45  		super();
46  		initialize();
47  	}
48  	
49  	/**
50  	 * Creates new instance of PropertiesTableCustomizer.
51  	 */
52  	public PropertiesTableCustomizer(Object bean) {
53  		super();
54  		setObject(bean);
55  		initialize();
56  	}
57  	
58  	/**
59  	 * Creates new instance of PropertiesTableCustomizer.
60  	 */
61  	public PropertiesTableCustomizer(String[] properties) {
62  		super(properties);
63  		initialize();
64  	}
65  
66  	/**
67  	 * Creates new instance of PropertiesTableCustomizer.
68  	 */
69  	public PropertiesTableCustomizer(PropertyDescriptor[] properties) {
70  		super(properties);
71  		initialize();
72  	}
73  
74  	/* (non-Javadoc)
75  	 * @see java.beans.Customizer#setObject(java.lang.Object)
76  	 */
77  	public void setObject(Object bean) {
78  		try {
79  			setBean(bean);
80  		} catch (Exception e) {
81  			e.printStackTrace();
82  		}
83  	}
84  	
85  	private void initialize() {
86  		
87  /*		setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
88  		setPreferredSize(new Dimension(100,100));
89  		setMinimumSize(new Dimension(100,100));
90  */	}
91  
92  }