The Property Inspector is a essential part of modern IDE and application builder tools becoming a common unit of professional user interfaces. Such an approach significantly (if not completely) reduces the number of dialogs in an application, making the application user interface modern and consistent. From the development perspective the usage of the Property Inspector greatly minimizes the time of development and code size. All you need to do is write the beans responsible for the application logic and possibly some custom editors. Basic concepts Property Inspector is a component designed for displaying and editing of properties of the bean. "Classic" Property Inspector consists of 2 columns: The first column displays the property names ; The second column displays the property values. |  | Property Inspector exploring BarChart bean. By type of its value properties are divided into three groups: Simple properties - as a rule value type of simple property is the String or simple Java type: boolean, byte, char, short, int, long, float or double. In the picture above title, orientation and autoLayout are examples of simple properties. Array properties - value of such property is an array. The simple or composite property is associated with each array item value. In the picture above columns are array property, and the composite property is associated with each array item. Composite properties. The value of the composite property is another bean, characterized by its own set of properties.

| Hierarchy of the properties Bean properties can form a hierarchy, represented in Property Inspector as a tree. In the example above BarChart bean has array property columns. Array items presented by composite properties consisting from 4 simple properties: label, value, color and visible.
Property editors Property editor is used to display and edit the value of the property. For each value type a specialized editor is required. BeanExplorer comes pre-equipped with editors for all simple Java types (boolean, byte, char, short, int, long, float and double), as well as for more frequently used types like String, Dimension, Color and Font (see the picture above).

| Embedding Property Inspector into your application Property Inspector itself is a bean that can be easily embedded in any Java application. The example below demonstrates a sample application (see the complete code given below). The left pane contains a bean (BarChart), the right pane contains Property Inspector that manipulates properties of the bean.
| In simple scenarios to embed Property Inspector into your application you need only four lines of code:
- Specify a class to import
import com.beanexplorer.swing.PropertyInspector; - Create instance of Property Inspector
PropertyInspector propertyInspector = new PropertyInspector(); - Set up the bean to be explored in Property Inspector
propertyInspector.explore(bean); - Insert PropertyInspector into application frame or panel
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bean, propertyInspector); To compile and run the application add beanhelpers.jar and beanexplorer.jar into application classpath java -classpath .;beanhelpers.jar;beanexplorer.jar SampleApplication | 
Sample application code
| import com.beanexplorer.swing.PropertyInspector;
import barchart.*;
import java.awt.* import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSplitPane;
public class SampleApplication extends JFrame { public SampleApplication() { super("Bean Explorer Sample Application");
// initialise the bean Column[] columns = {new Column("Q1", 5, Color.blue), new Column("Q2", 8, Color.red), new Column("Q3", 10, Color.magenta), new Column("Q4", 7, Color.pink)}; BarChart bean = new BarChart("Quarter report", columns);
// initialize property inspector PropertyInspector propertyInspector = new PropertyInspector();
// explore the bean propertyInspector.explore(bean);
// insert bean and PropertyInspector into application frame JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bean, propertyInspector); getContentPane().add(splitPane, BorderLayout.CENTER); }
static public void main(String[] args) { SimpleApplication app = new SimpleApplication(); app.setSize(new Dimension(400, 300)); app.pack(); } }
|
[What is BeanExplorer?] [Competition ?] [Tour] [White Paper] [Installation Instructions] [Support Center] [BeanExplorer News]
[ BeanInfoEditor ] [ Property Inspector ]
|
|
|