MobilityDesigner2QuickGuide

Mobility Designer 2 - Quick Guide

Contents


Abstract

This document describes classes, terms and algorithms used in Designer2.

Description

TypeID

  • identifies each type in the design-time
  • 3 kind - component (Class, Displayable, ...), primitive (boolean, int, String), enum (AlertType)
  • see: MidpTypes, GamesTypes for primitive declaration; or each CD

ComponentRegistry

  • holds component descriptors, accessible from DesignDocument.getComponentRegistry
  • one per each projectType

ComponentDescriptor (CD)

  • registered in layer.xml
  • describes components
  • getTypeDescriptor - describes inheritance
  • getDeclaredPropertyDescriptors - describes declared properties using PropertyDescriptor
  • createPresenters/gatherPresenters - gathers all presenters
  • use gatherPresenter for removing presenters from previous CDs (using DocumentSupport.removePresneterOfClass)
  • postInitilialize - allows single-time execute post initialization when a component is created using DD.createComponent

PropertyDescriptor

  • identified by property name, has: its type, default value, allowsNull, allowsUserCode, version

ComponentProducer

  • registered in layer.xml
  • is the one should in palette
  • has createComponent method for executing it
  • one component is main - that is used during Drag&Drop for resolving its acceptability by a target
  • producer can create multiple components and change properties

PrimitiveDescriptorFactory

  • registered as a service in global lookup
  • resolves a primitive descriptor for each primitive type using TypeID.getString as indentifier
  • PrimitiveDescriptor describes a (de)serialization of a property value and validity of an instances (values passed to PropertyValue)

DesignDocument (DD)

  • represents the design
  • DD.getRootComponent returns a top-most component
  • DD.createComponent
  • DD.getTransactionManager
  • DD.getListenerManager

TransactionManager (TM)

  • DD.getTransactionManager().readAccess (Runnable) - execute in read access
  • DD.getTransactionManager().writeAccess (Runnable) - execute in write access

ListenerManager (TM)

  • allows to add/remove design/presenter change listener - addDesignListener (listener, DesignEventFilter)
  • DesignEventFilter specifies the range of changes that you are interested in

DesignComponent (DC)

  • DC.readProperty, DC.writeProperty - read/write uses PropertyValue as a wrapper around real value

PropertyValue

  • created by PropertyValue.create*
  • see: MidpTypes for creating/handling values of primitive types
  • is immutable object
  • use immitable objects (like String, int, long) for representing a primitive types to prevent property modification outside of the write access

Presenter

  • presenter cannot be shared
  • various templates are available in midp module
  • TBD

DataObjectContext (DOC)

  • 1-2-1 mapped with a DesignDataObject
  • single DataObject may have various DesignDocument but only one is active/loaded
  • DOC.addDocumentAwareness method registers listener on changes of active document in context.

The listener is represented by DesignDocumentAwareness - setDesigDocument is called. The method is called automatically after the listener registration is done.

DataEditorViewFactory

  • register as a service in global lookup
  • creates a view for a particular context (usually based on DataObjectContext.getProjectType)
  • view is represented by DataEditorView which is similar to TopComponent
  • since you have a context, then you can register a document-awareness listener, then you have a document, then you can work with its data

DataEditorView

  • see vmd.game.integration package
  • since the document changes can be invokes even outside of AWT thread then you have to keep a track of changes (e.g.: dirty presenter pattern) and then invoke SwingUtilities.invokeLater where you lock a document for read access and do the update of all dirty presenters

threads

  • Do not even do "SwingUtilities.invokeAndWait" within the read/write access on document/registry/...
  • Acquire locks of all other frameworks before.

AcessController (AC)

  • registered as a service in global lookup
  • Allows global control of the design
  • AC.notifyEventFired is called after all DesignListener and PresenterListener has been called
  • AC.notifyEventFiring is called before
  • runInWriteAccess - called to wrap the write access - allows to put your locking mechanism in to the document locks - prevents deadlocks

undo/redo

  • works automatically
  • if you need to add an external (non-model specific) UndoableEdit - then it has to be "not-significant" and has to be added using DD.getTransactionManager.addUndoableEdit

(de)serialization

  • works automatically
  • using DataSerializer (in global lookup) you can plug-in additional data serialization

file template

  • to see a first design you have to have a file template registered in layer
  • template consists of: .java and .vmd file - see: vmd.game.integration.res.emptygame_*.template files
  • there is a one of two hack here - the component used as a root component of a document has to have new TypeID (Kind.COMPONENT, "#Root") as a TypeID. Otherwise it will not be possible to created a empty document as a fallback in case of error during deserialization

component descriptors

  • see: vmd.game.integration.components.* (especially)

support classes

  • DocumentSupport - support methods for generic manipulation with document structure
  • ArraySupport - support methods for PropertyValues of an array type
  • MidpDocumentSupport - support methods for MIDP document

InfoPresenter

  • adds an ability of a displayName and icon to a component
  • created by: InfoPresenter.create* methods
  • used by various presenter (which depends on it) - FlowInfoNodePresneter, InspectorFolderPresenter.create, ...

Inspector

  • InspectorFolderPresenter.create
  • TBD

Properties

  • two kinds - basic and advanced
  • see: Displayable.createPropertiesPresenter method
  • TBD

Flow*Presenter

  • TBD

Actions

  • visibility definition - see: MidpActionsSupport.addCommonActionsPresenters
  • New/Add - defined AddActionPresenter.create("New", 10, CommandCD.TYPEID), //NOI18N //TODO Localization
  • Delete - DeleteDependencyPresenter: dependency on parent or a reference in a property, autonullable properties; DeletePresenter: setting custom deletion and user/general indelible
  • TBD

CodeGenerator

  • parameter represents a method parameters
  • setters represents setter and constructor
  • CodeWriter - code writer with auto-indentation
  • MultiGuardedSection - represents a multiguarded section (MGS.create, MGS.getWriter ().write().commit(), MGS.switchToEditable (), MGS.switchToGuarded, MGS.close
  • see: DisplayableCD.createSetterPresenter
  • TBD

Back to MobilityDesignerHome

contact: Karol Harazlak

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