Visual Mobility Designer - Introduction to the Mobility Properties API



A Properties Window is a place in which users can display or change values of one or more custom component properties. Idea of this module to provide easy to use API for custom components developers and separate them from relatively complicated Netbeans Properties API. Properties API can be found in module Developer who is planning to use this API should be familiar with idea of property editors and custom property editor (read more).

properties window

Screenshoot of the Netbeans Mobility Property Window

Mobility Properties API

Core of the Properties API is PropertiesPresenter class. This class provides information about properties of DesignComponent to display them (visualize) in the Netbeans Properties Window Properties. Based on this informations provided by presenter Properties module is able to create properties sheet and custom property editors. Second very important class is DesignPropertyEditor which defines custom property editor for given Custom Property Editor. Single property is represents by the DesignPropertyDescriptor. It store basic information about property like property name, property category, property editor and much more. In most cases developers don't have to create it's own implementation of the PropertiesPresenter but rather use one available in Properties API (DefaultPropertyEditor) also there is a wide range of custom property editors available in modules vmd.midp and vmd.midpnb.

Properties Presenter

Major function of this class is to provide information about properties of DesignComponent to display them (visualize) in the Properties Window Properties. Based on this informations provided by this presenter Properties module is able to create properties sheet and custom property editors for Netbeans Propertues Window. Default implementation of the Properties Presenter is DefaultPropertiedPresenter and this class should be used in most of the cases. Set of properties defined for PropertiesPresenter usually does not match number of properties defined for particular DesignComponent. It means that some of the DesignComponent may not be available for editing in the Properties Window. It is also possible to create "virtual properties" which represents more then one DesignComponent property as one property in the Properties Window. To show defined Properties Window for DefaultPropertyPresenter it's necessary to place this presenter in the descriptor (CustomComponentDescriptor) in the list of the presenter in method createPresenters ().

Common properties presenter pattern:

public static String PROPERTY_NAME = "title"; // name of the property
public static String PROPERTY_DISPLAY_NAME = "Title"; // display name of the property shown in Properties Window 

public static String PROPERTY_CATEGORY = "Properties"; // properties category  

    PropertiesPresenter = new DefaultPropertiesPresenter() // new instance of PropertiesPresenter
                                 .addPropertiesCategory(PROPERTY_CATEGORY) // category for Title property
                                                  PropertyEditorString.create("Title:"), // String custom property editor 

properties window Description of PRoperties Window

Custom Property Editor

In most of the cases component developer should reuse custom property editors available in modules vmd.midp and vmd.midpnb. When it's not possible and custom property editor requires different functionality then developer should consider to provide it's own implementation of custom property editor.

property editor

Custom property editor

List of the available Custom Property Editors in vmd.midp:

  • PropertyEditorAlertIndicator - Property Editor dedicated to Alert indicator
  • PropertyEditorArrayInteger - This Property Editor helps to maintain set of properties when it's necessary to edit more then one value in one property. Good example is Size value which merges two values height and Width or Position with X and Y.
  • PropertyEditorBooleanUC -Property Editor is dedicated to take care of Boolean values.
  • PropertyEditorColorChooser - Property Editor Color Chooser.
  • PropertyEditorComboBox - This property editor could be usfull when it's necessary to chose one element from given list of some values, for example font size in MIDP could be small, medium or big.
  • PropertyEditorConstraints - Allows editing constrains of the TextBox MIDP component.
  • PropertyEditorDefaultCommand - Helps to maintain Default Command of the MIDP components.
  • PropertyEditorGaugeMaxValue - Allows to edit max value of the progress bar.
  • PropertyEditorGoToSource - This property editor switch view from Flow/Screen to the Source.
  • PropertyEditorImage - Helps manage Image resources.
  • PropertyEditorInputMode - Property Editor for TextField initial input.
  • PropertyEditorInstanceName - Component instance name Property Editor.
  • PropertyEditorJavaString - Allows to edit properties which are represented as String.
  • PropertyEditorLayout - Item layout property editor.
  • PropertyEditorListSelectCommand - List of available commands to set as List Select Command.
  • PropertyEditorNumber - Provides Property editor for all kinds of number properties.
  • PropertyEditorPreferredSize - Size Property Editor. For example width and height.
  • PropertyEditorString - Allows to edit properties which are represented as String.
  • PropertyEditorTimeout - Alert's Time Out property editor.
  • PropertyEditorUserCode - Used almost in all properties. Allows to replace property value with custom code in the source code.
  • PropertyEditorDate - Date property editor.
  • PropertyEditorEventHandler - Event Handler property editor.
  • PropertyEditorTimeZone - Time Zone property editor.
  • PropertyEditorResource - Property Editor helps edit resources available in the VMD MIDP module like : Fonts, Tickers, Images and more.


  • PropertyEditorPhoneNumber - Similar to the PropertyEditorString but comes with phone editor validatio.
  • PropertyEditorSVGImage - Similar to PropertyEditorImage.
  • PropertyEditorTableModel - Advanced editor to create TableItem model.

Properties Inplace Editor

DesignPropertyEditor class also supports custom InplaceEditors. To create inplace editor it is necessary to implement org.openide.explorer.propertysheet.InplaceEditor. DesignPropertyEditor has a method which needs to be overridden getInplaceEditor which returns instance of InplaceEditor for particular property. Good example of implementation of Inplace Editor is property editor PropertyEditorAlertIndicator in module vmd.midp and inplace editor BooleanInplaceEditor also in module vmd.midp.

contact: Karol Harezlak

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo