Consultor Eletrônico



Kbase 15728: How to add a new link type to the ADM
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
How to add a new link type to the ADM

INTRODUCTION:
=============
This KnowledgeBase entry outlines the steps required to extend the
Application Development Model (ADM) to include a new link type.


WHY YOU NEED TO KNOW THIS:
=========================
There are certain limited situations which might require the 4GL
developer to extend the ADM and create a new SmartObject link type.
For example, you might want to optionally enable or disable certain
existing functionality within an object, without modifying
the actual object itself. There are several steps required to
implement a new link type, outlined below.

PROCEDURAL APPROACH:
====================
Once you determine a name for the new link type, the potential
link sources and targets must be configured to support this new link.

If you want to be prompted to create this link by the Advisor:
Add the link to the list of Advisor-supported links
(adm-supported-links) through the Advanced Procedure Settings
dialog (see related KnowledgeBase entry 15670 "How to enter adv.
procedure settings for smart obj. instance"). This will add the
new link to the selection list of supported links in your
future design dialogs.

If you want to just add the new link type and you don't need Advisor
support for future design-time dialogs, you can simply add a new
link type through the SmartLinks dialog off the Property Sheet of
the SmartObject. Choose "Add", highlight the source and select
"New" off the supported links selection list. Just supply the
name of your new link type at the fill-in prompt.

Write any necessary procedures in the source or target procedures
(whatever you need to modify to support the desired behavior for
this new link type). This may involve passing parameters to and
from new procedures, or conditionally executing existing procedure
code. Let's say you create a new procedure called "add-across"
which you want to execute when there is an existing "tabulate" link.
You might code this procedure in an include module which you would
then add to your tabulate-source or tabulate-target objects.

At this point, you need to decide whether you want the link
to be supported in only a specific object master, or at the
template level, or at the broker level. This will determine where
you must define the new link.

If you use a template for the definition, pull up the
Advanced Procedure Settings dialog for the template in the UIB.
Choose Add and enter your new link name. This will automatically
update the pre-processor variable &adm-supported-links for you.
For example adding "tabulate-target" would allow the masters generated
from the template to be targets of the link called "tabulate".
Adding "tabulate-source" would allow masters to be sources for the
"tabulate" link. The ADM advisor will pick up the new "tabulate"
link type from this variable definition and add it to the list of
possible links that can suggested at design-time.

If using a master, all of the potential link sources and targets
will have to be configured to support the new link as follows:
In the MAIN block of each source or target, add the new link name
to the adm-supported-links variable:
adm-supported-links = adm-supported-links +
"<your-link-source|target>".
For example:
adm-supported-links = adm-supported-links + ",tabulate-target"
or adm-supported-links = adm-supported-links + ",tabulate-source"

The above steps will allow you to use the syntax:
run notify('<your-procedure>','<your-link-source|target>').
i.e., run notify ('add-across,tabulate-source')

If you want to be able to run notify without the link-source|target
parameter, you can add the link type to the ADM broker. Remember
that this will affect *all* applications. You need to add your new
link type to two variables in brokattr.i:
&adm-notify-methods and &adm-notify-links.
These are comma-delimited lists which must be maintained in parallel
sequence. Add your new link type by defining &adm-user-notify-methods
and &adm-user-notify-links, respectively. This should be done in
a structured include file (not in brokattr.i itself). Copy broker.p
into your development environment and add your structured include
file to the Method Library Include References before brokattr.i
This is done from the UIB in the Procedure -> Method Libraries
dialog. Recompile broker.p and copy the .r into the proper directory
(default is dlc\gui\adm\objects).

ONLINE PROCEDURES OR UTILITIES:
===============================


REFERENCES TO WRITTEN DOCUMENTATION:
====================================
UIB Developer's Guide,
chapters entitled "SmartLinks" and "SmartObject Interaction" and
section "Customizing ADM Broker Preprocessor Values" in the
"Advanced ADM Topics" chapter.

Progress Software Technical Support Note # 15728