Code covered by the BSD License  

Highlights from
Property grid using JIDE implementation

4.66667

4.7 | 3 ratings Rate this file 32 Downloads (last 30 days) File Size: 40.4 KB File ID: #28732
image thumbnail

Property grid using JIDE implementation

by

 

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

| 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.

CONTACT INFORMATION

Levente Hunyadi
http://hunyadi.info.hu/

Acknowledgements

Property Sheet inspired this file.

This file inspired Properties Gui Display Properties In An Editable Context Aware Table.

MATLAB release MATLAB 7.10 (R2010a)
Other requirements This software has been developed originally for MatLab 2008a and should be compatible with MatLab 2008a or a later version with little or no modification.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
19 Oct 2013 Shalin Mehta

Hi Levente,
Just what I was looking for! I have written a MATLAB handle class to manage custom image analysis pipeline. I would like to use your utility to display the properties - mostly analysis parameters that user sets or are estimated from images. Is it possible to embed the property grid within a GUI with buttons and text fields? Or conversely, is it possible to add controls with callbacks to the property grid?

Thanks for this excellent submission
Shalin

10 Apr 2012 Bernd Bleymehl

Thank for very much for this excellent submission.
Unfortunately I was not able to integrate enumerations, like Dean Mark suggested.
Could someone please explain, what is necessary to select different enumeration options in a pop-up menu style?

26 Oct 2010 Andrew Stamps

I had to modify a few things to suit my purposes, but the concept is great, and the result is aesthetically pleasing.

My suggestions for improvement:
1) As I mentioned in my previous post, some sort of minimal handling of N-D arrays without causing errors would be appreciated.

2) The tool allows you to specify a structure at the top level, but fails if any field (or property of an object) is a structure. Support for nested (tree) structures would be good.

3) The tool should probably expand arrays of structures or objects into the constituent scalar structures/objects before allowing you to inspect the fields/properties.

4) In the declarative mode, the tool uses the help system to populate the description information about an object's properties. Since help is not available for deployed application (i.e. when using the MATLAB compiler), the PropertyGrid throws errors under these conditions. The 'isdeployed' function can be used to trap around this. The descriptions won't be displayed, but it will otherwise work.

Thanks,
Andy

20 Oct 2010 Andrew Stamps

First, I am very impressed with this submission. I think it will prove to be very useful in my work. Two points I would like to mention:

1) In R2010B, I get an error when running the property editor demo and toggling the 'Logical' property checkbox. The error occurs in findobjuser() at line 34:

f = arrayfun(@(handle) fcn(get(handle, 'UserData')), h);

It complains about a non-scalar (empty) value in the output. The following code modifications appear to work for me:

f = arrayfun(@(handle) fcn(get(handle, 'UserData')), h,'UniformOutput', false);
h = h(~cellfun(@isempty, f));

2) Support for properties that are N-D arrays would be quite helpful, even if editing were disallowed and the property was listed with the dimensions and the type.

I will hold off on rating until I have used this package more.

19 Sep 2010 Dean Mark

If you are looking for a property editor, look no further.

This piece of nifty code allows you to edit the fields of a struct in a visual manner. No more manually building different gui's for every single struct you have. Just bind an instance of the struct/object you have into this editor and it'll do the job. It even allows you to manually correct the types of the fields that weren't correctly identified. The code even allows for enums (after manually entering the different options).

Plus, the author was also very quick to fix numerous bugs that I have submitted to him.

All in all, I recommend this widget wholeheartedly.
(Works perfectly on 2009a/b)

Contact us