This document shows hot how to listen on the DesignDocument changes. It describes hot to get notification about events like switching between DesignDocuments, closing Designdocument. Knowledge of this part of Mobility API is needed in designing additional Visual Mobile Designer modules and it's not require to create Custom Components for VMD.
The DesignDocumentAwareness is responsible for notifying application that state of DesignDocument has been changed. Interface has only one method "setDesignDocument" which is called every time when new DocumentDesign is set or DesignDocument references are set to null.
The DesignDocumentAwareness interface:
public interface DesignDocumentAwareness {
public void setDesignDocument (DesignDocument designDocument);
}
In practice there is only two state to handle.
1) The DesignDocument object passed through setDesignDocument IS NOT NULL. It basically means that received DesignDocument object IS ACTIVE.
2) The DesignDocument object passed through setDesignDocument IS NULL. It basically means that received DesignDocument object IS NOT ACTIVE any more.
Based on the combination of this information developer can make a decision and take action in VMD Module. To receive notification about state of the DesignDocument from DesignDocumentAwareness listener user has to register instance of DesignDocumentAwreness in the DataObjectContext using method "addDesignDocumentAwareness" and from this moment module should be aware of DesignDocument changes.
This part shows how to implement DesignDocumentAwareness in example module.
There is a lot of example of usage of the DesignDocumentAwareness almost every module of VMD uses this functionality. This interface is used in case when developer needs to do some tasks when Visual Midlet is activated or deactivated. Particular examples:
Combination of this component helps inform developer about what is going on with DesignDocument and take action like initialization of modules, loading cash, flushing cache, cleaning references and many other tasks.
Places in the Visual Mobile Designer with DesignDocumentAwarness implemented:
contact: Karol Harezlak