4.0

4.0 | 1 rating Rate this file 28 downloads (last 30 days) File Size: 38.9 KB File ID: #26873

Property grid using JIDE implementation

by Levente Hunyadi

 

06 Mar 2010 (Updated 17 Mar 2010)

Code covered by the BSD License  

A graphical user control based on the JIDE PropertyGrid that mimics MatLab's property inspector.

Download Now | Watch this File

File Information
Description

The property grid (also known as property browser, inspector, pane and sheet) displays a list of (object) properties with values editable in-place. Each property has an associated semantics (or type) that restricts the possible values the property can take and helps visualize the property value in a natural manner, e.g.
* a character array is displayed as a string and can be edited in-place;
* a scalar logical is mapped to a checkbox;
* an integer value that has a limited range is manipulated with a spinner;
* a selection from a set of values is presented as a drop-down list;
* a cell array of strings (either row or column vector) can be edited as multi-line text in a pop-up text box;
* a logical vector that is an indicator for a set (e.g. [false false true] for 'C' from the universe {'A','B','C'}]) is visualized as a checkbox list;
* numeric vectors and matrices can be edited element-wise in a pop-up window (use F2 to activate);
* parent-child relationships are presented with the help of expandable properties.

Supported types include all shapes (scalar, vector and matrix) of all primitive types (logicals, integers, real/complex double/single) as well as cell arrays of strings, structures, and MatLab objects with both value and handle semantics with arbitrary level of nesting.

JIDE is a feature-rich collection of Java Swing components by JIDE Software, see http://www.jidesoft.com/products/index.htm for details. Functions and classes in this package use the JIDE PropertyGrid and related controls. These set of controls are an integrated part of MatLab, no installation of external dependencies is required.

USAGE

The property grid has a procedural and a declarative interface.

When using the procedural interface, the programmer is expected to explicitly assemble a list of PropertyGridField instances, which store metadata information on the property to visualize. This means at minimum property name and initial value, and optionally type information, property category, displayed name, description and whether the property is read only. This allows maximum control over how properties are presented to the user. In this approach, the GetPropertyValues() method is used to fetch updated properties as a structure.

The declarative interface uses the concept of object binding. The programmer passes a MatLab structure or object to the property grid, and the grid reads property values and automatically discovers name, type, description and other metadata. Any changes made in the grid are reflected in the bound object.

EXAMPLE

The file example_propertygrid.m contains a basic example on manual procedural setup and declarative usage (with object binding).

DISCLAIMER

This component is provided in the hope that it will be useful, but no claims are made as to the fitness for any purpose. In particular, the component relies on undocumented MatLab features that might have a low risk of breaking in future MatLab versions. You are welcome to submit bug reports directly to the author; comments made at the MathWorks File Exchange site might be ignored.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
UIINSPECT - display methods/properties/callbacks of an object, Property sheet

MATLAB release MATLAB 7.6 (R2008a)
Zip File Content  
Other Files
arrayfilter.m,
constructor.m,
Contents.m,
example_matrixeditor.m,
example_propertyeditor.m,
example_propertygrid.m,
findobjuser.m,
getclassfield.m,
getdependentproperties.m,
helpdialog.m,
helptext.m,
javaArrayList.m,
javaclass.m,
javaStringArray.m,
JidePropertyGridField.m,
license.txt,
MatrixEditor.m,
nestedassign.m,
nestedfetch.m,
PropertyEditor.m,
PropertyGrid.m,
PropertyGridField.m,
PropertyType.m,
README,
SampleNestedObject.m,
SampleObject.m,
strjoin.m,
strsetmatch.m,
strsplit.m,
UIControl.m,
var2str.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
26 May 2010 Ramiro Massol

hi
really nice implementation. I only found one bug, basically that after changing the value of any of the parameters of the property table (after running your example code), there is an error stating that ''Cannot access method 'OnPropertyChange' in class 'PropertyGrid'.''
Do you know a fix for this bug? BTW, does propertygrid compile well?
thanks,
ramiro

08 Jun 2010 Levente Hunyadi

The sample code in example_propertygrid.m runs without error with MatLab releases 2008a and 2010a. The method inaccessibility issue seems to be specific to one or more MatLab versions in between 2008a and 2010a, and can be easily addressed by changing the method block qualifier

methods (Access = private, Static)

in PropertyGrid.m to

methods (Static)

essentially exposing the private event hook that has triggered the error message (and some of the service) methods to the public interface.

Please login to add a comment or rating.
Updates
08 Mar 2010

Removed anonymous callback function that caused memory leak.

10 Mar 2010

Added object binding and automatic property discovery.

12 Mar 2010

Added new features including object nesting, expandable properties, checkbox list and spinner control, on-line help, complex numbers, in-place editing for vectors and matrices.

15 Mar 2010

Added property editor (grid with object selection) and matrix editor window; increased grid start-up performance.

17 Mar 2010

Added matrix editor hooks; consolidated existing features.

Tag Activity for this File
Tag Applied By Date/Time
property inspector Levente Hunyadi 08 Mar 2010 12:37:03
property grid Levente Hunyadi 08 Mar 2010 12:37:03
gui Levente Hunyadi 08 Mar 2010 12:37:03
java Levente Hunyadi 08 Mar 2010 12:37:03
swing Levente Hunyadi 08 Mar 2010 12:37:03
undocumented Levente Hunyadi 08 Mar 2010 12:37:03

Contact us at files@mathworks.com