MobilityDesigner2Navigator

Revision as of 13:31, 5 November 2009 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

Visual Mobility Designer - Introduction to the Inspector API

Contents


Abstract

The Navigator windows in Visual Mobile Designer shows tree structure of components used in Visual Midlet. The Custom Component developers through this API has control over the Mobility Navigator as well as structure of components displayed in the Mobile Navigator. The Mobile Navigator is presentation layer for Custom Components in Visual Midlet and virtual navigator folders defined in Presenters. Tree structure components shown in navigator is independent from structure of components in DesignDocument. Some of the components shown in the navigator do not have real representation as DesignComponent in DesignDocument (for example folder "Items" in "Form" component).


Image:navigator_MobilityDesigner2Navigator.jpg

Screenshoot of the Netbeans Mobility Navigator Window

Mobility Inspector API

Most of the Inspector API is placed in module VMD Inspector (vmd.inspector) also in VMD MIDP (vmd.midp) and VMD MIDPNB (vmd.midpnb). Most important class of this API:

  • InspectorFolder - This class creates visual representation of DesignComponent in the Mobility Visual Designer Navigator. Most popular implementation of inspector folder is the DesignComponentInspectorFolder. This class suits as a descriptor for the Mobility Navigator nodes. InspectorFolder in this class is created based on DesignComponent passed in the class constructor.
  • InspectorFolderPresenter - This class connects DesignComponent and particular InspectorFolder. It has only one method which returns InspectorFolder when needed. It's possible to attach more that one the InpsectorFolderPresenter to the DesignComponent in this case DesignComponent would have more that one representation in the tree structure of the Mobility Navigator.
  • InspectorPositioningControllerPresener and InspectorPositionController - Those two classes are responsible for position of folder (node) in navigator. The InspectorPositioningController has only one method "isInside" which during the creation/change of the navigator tree is called against every possible position (folder) in the tree. Logic inside of the InspectorPositionController based on the provided parameters like InspectorFolderPath, InspectorFolder, DesignComponent component should decide if particular folder (node) belongs to the current position in the tree. Main role of the InspectorPositioningControllerPresenter is to provide access to the position controllers through flexible Presenters mechanism also the InspectorPositioningControllerPresener.

To enable this functionality it's necessary to add both presenters ( InspectorPositioningControllerPresener and InspectorFolderPresenter) to the ComponentDescriptor class in the presenter section.

Example implementation of Inspector API

Common inspector presenter pattern in ComponentDescriptor:

1) Example of the DesignComponent shown in the Mobile Navigator tree.


Part of the ComponentDescriptorClass 

protected List<? extends Presenter> createPresenters () {
        return Arrays.asList (
           ....
            // inspector
            new InspectorFolderComponentPresenter(true), //Creates InspectorFolder based on the DesignComponent and creates new InspectorFolderComponentPresenter
            InspectorPositionPresenter.create(new DisplayablePC()), //Creates InspectorPositionPresenter and InspectorPositionController
           ....
        );
    }


2) Example of the virtual folder(node) shown in the Mobile Navigator tree which does not represent any DesignComponent


Part of the ComponentDescriptorClass 

protected List<? extends Presenter> createPresenters () {
        return Arrays.asList (
           ....
           // inspector
           //This factor method creates category folder for Items (shown above on the screen shot as "Items")
           MidpInspectorSupport.createComponentElementsCategory(NbBundle.getMessage(FormCD.class, "DISP_InspectorCategory_Items"), createOrderingArrayController() , ItemCD.TYPEID), 
           ....
        );
    }


In most of the cases component developer should reuse implementation of this classes available in modules vmd.inspector, vmd.midp and vmd.midpnb. When it's not possible and InspectorFolder requires different functionality then developer should consider to provide it's own implementation of thees classes. VMD MIDP as well VMD MIDPNB contain many examples of implementation of this classes.


Exists many examples of usage this API mostly in VMD MIDP and VMD MIDPNB

some of them: VMD MIDP:

  • DisplayableCD
  • FormCD
  • ItemsCD
  • CommandsCD
  • and many more

VMD MIDPNB

  • TableModelCD
  • SVGImageCD
  • and many more


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