| API specifications of NAB framework June 21, 2006 |
Contents
![]()
|
Chapter 4 Explanations of Implementation Examples (Sample Tools)
These implementation examples (sample tools) in NAB Framework use the NAB plug-in for MWT (MWT Application Builder) for editing MWT.
MWT:
Similar to WIN32, Xt, GTK, and other toolkits, MWT has different types (classes) of components, and each component can create an entity, referred to as an instance, whose native value distinguishes it from other entities.
Deployed components in a parent-child relationship configure a tree and implement a GUI. A deployed instance has multiple variables, each retaining information on a status, and they are referred to as properties. The behavior of the instance can be specified or changed by setting values for these properties. An event is generated from the deployed instance when the instance is deployed again or when a property of the instance is changed. Callback processing for the event is defined as necessary, and if it is defined, the processing can be executed when the event occurs.
4.1 Implementing of Low-level Toolkit Handling Modules
This section outlines each module.
- Toolkit Initializer
- Toolkit initialization process
This module in the NAB plug-in for MWT is implemented to call WSGFwsInitialize() for MWT initialization. For Xt, the module is implemented to call a function such as XtAppInitialize().
- Toolkit initialization process
- Toolkit Instance Manager
- Instance creation process
This module in the NAB plug-in for MWT creates an instance of the specified type by calling WSCbase::getNewInsntace().
- Instance information management (instance ID)
This module in the NAB plug-in for MWT manages the pointer value of an instance as an instance ID and delivers it to a view through a high-level API.
- Instance information management (related to a property)
This module in the NAB plug-in for MWT is implemented to call WSDappDev::lock()/unlock() to return a property value of an instance, and it returns this value in the form of String type or Long type.
The module is also implemented to call the WSCbase::setProperty() function and set a value for the specified property.
- Instance information management (related to a procedure)
This module in the NAB plug-in for MWT is implemented to call a function such as WSCbase::addProcedure() that makes settings related to the event procedure of an instance, in order to incorporate required settings into the instance to call a high-level interface.
- Instance creation process
- Toolkit Context Manager
- Toolkit status control process
The module implements exclusive processing for an operation that must be performed in linkage with SWT.
This module in the NAB plug-in for MWT is implemented to call WSDappDev::lock()/unlock() to lock and stop an MWT-side thread during an MWT operation performed by an SWT-side thread.
- Toolkit status control process
- Project Manager
- Application configuration-related information management process
This module in the NAB plug-in for MWT is implemented to manage the compile flags, libraries, build environment settings, target information, and other information required for building an MWT application.
- Application source code creation-related process
This module in the NAB plug-in for MWT is implemented to create the source code required for building an MWT application according to application configuration information.
- Application configuration-related information management process
4.2 Procedure for Calling the NAB Interface from a High-level View
The NAB interface can be called from an Eclipse view (high-level) in a certain operational sequence depending on the toolkit used in NAB Framework. This section explains cases of calling the NAB interface in samples using processing involving the NAB plug-in for MWT.
- Case 1. Creating a window
After processing by NAB Framework begins, toolkit instances such as the window creation process must be created first. NtkManager as shown in this sample must be accessed first by the singleton interface to access the NTK application. Properties belonging to the NTK instance are accessed through the instance management module INtkInstanceManager acquired by NtkManager.getNtkInstanceManager().
//The NTK in the model used by another thread can be locked //by using INtkContext through the context handling module. NtkManager.getNtkContext().lock(); //Instance management module INtkInstanceManager iman = NtkManager.getNtkInstanceManager(); //Creates an instance with the class name specified for the instance and the specified instance name. long inst = iman.getNewInstance(className,windowName,0); if (inst == 0){ //Cannot be created return; } //Sets properties of the created instance. iman.setProperty(inst,"x",0); iman.setProperty(inst,"y",0); iman.setProperty(inst,"width",400); iman.setProperty(inst,"height",400); iman.setupInstance(inst); //Registers the top window instance (as the root parent). NtkManager.getNtkInstanceManager().setInstanceId(Ntk.NTK_SET_ROOT_INSTANCE,inst); //Releases the lock. NtkManager.getNtkContext().unlock(); - Case 2. Acquiring a list of property values belonging to the currently selected instance
The following process is used for access to acquire property values of the selected instance among instances arranged in a window, such as when instances in a window are being arranged visually using the editor view after the window is created:
//The NTK in the model used by another thread can be locked //by using INtkContext through the context handling module. INtkContext context = NtkManager.getNtkContext(); context.lock(); //Starts with ROOT_ID at the start of retrieval of the selected instance. long selectedId = Ntk.NTK_ROOT_INSTANCE_ID; INtkInstanceManager iman = NtkManager.getNtkInstanceManager(); while(true){ //Acquires the ID of the next selected instance. long selectedNext = iman.getInstanceId(selectedId, Ntk.NTK_NEXT_SELECTED_INSTANCE_ID, 0); if (selectedNext == 0){ //0 if it does not exist break; } //Starts with ROOT_PROPERTY_ID at the start of acquisition of properties belonging to the instance. long propId = Ntk.NTK_ROOT_PROPERTY_ID; //Acquires the property ID by looping. while(true){ //Acquires the next property ID. long propNextId = iman.getInstanceId(selectedId, Ntk.NTK_NEXT_PROPERTY_ID, propId); if (propNextId == 0){ //0 if it does not exist break; } //Acquires the property name String propName = iman.getInstanceData(propNextId, Ntk.NTK_PROPERTY_NAME, 0,Ntk.NTK_EN_UTF8); //Acquires the property value. String value = iman.getInstanceData(propNextId, Ntk.NTK_PROPERTY_TITLE, 0,Ntk.NTK_EN_UTF8); //Acquires the property type. String propType = iman.getInstanceData(propNextId, Ntk.NTK_PROPERTY_TYPE, 0, Ntk.NTK_EN_UTF8); //Acquires the next property. propId = propNextId; } //Acquires the next instance. selectedId = selectedNext; } context.unlock(); - Case 3. Acquiring a list of event processing that is set in an instance
//The NTK in the model used by another thread can be locked //by using INtkContext through the context handling module. INtkContext context = NtkManager.getNtkContext(); context.lock(); //Starts with ROOT_ID at the start of retrieval of the selected instance. long selectedId = Ntk.NTK_ROOT_INSTANCE_ID; INtkInstanceManager iman = NtkManager.getNtkInstanceManager(); while(true){ //Acquires the ID of the next selected instance long selectedNext = iman.getInstanceId(selectedId, Ntk.NTK_NEXT_SELECTED_INSTANCE_ID, 0); if (selectedNext == 0){ //0 if it does not exist break; } //Starts with ROOT_PROCEDURE_ID at the start of acquisition of the procedure belonging to the instance. long procId = Ntk.NTK_ROOT_PROCEDURE_ID; while(true){ long procNext = iman.getInstanceId(targetInstId, Ntk.NTK_NEXT_PROCEDURE_ID, procId); if (procNext == 0){ break; } //Acquires the event (trigger) number. long triggerNumber = iman.getTrigger(procNext); //Acquires the event name (trigger). String triggerName = triggerTable.getTriggerName(procNumber); //Acquires the procedure name. String procName = iman.getProcedureName(procNext); //Acquires the next procedure. procId = procNext; } //Acquires the next instance. selectedId = selectedNext; } context.unlock(); - Case 4. Creating the source code to build a toolkit
The following process saves an edited toolkit to a file and creates and builds the source code:
//Acquires INtkProjectManager through NtkManager. INtkProjectManager pman = NtkManager.getNtkProjectManager(); //Creates the source code required for building an application. pman.createCurrentNtkProjectSources(); //Builds the source code. pman.createCurrentNtkProjectSources();
Settings and changes can also be made through INtkProjectManager, of course, and this includes editing NTK project data and setting the save destination for this data.
Contents
![]()
|



