Adding/Removing pzl-Component to the Pzl-Container

Материал из wikiru.visual-prolog.com

Автор: Виктор Юхтенко

It is recommended to make the adding the plz-component to the pzl-Container using the Elementary PzlStudio. The manual performing this operation using the IDE may lead to the non-correspondence of some necessary links in the projects.

You may also make a conversion of the status of the pzl-components, which was included to the pzl-container before. The status "original" may be converted to the status "proxy". The back operation is available also.

After the operation performing is complete you may come back to the Visual Prolog IDE and work with the modified project.

Invoking the Operation

All operations with the pzl-component in teh pzl-container such as adding , removein and changing the status must be done using the same form. You may invoke the form via menu item Tools/Add/Component To Container'. The project of the pzl-container must be saved in VIDE (Ctrl-S) before performing the operation. It is not necessary to close the project in the IDE if it is opened.

PzlStudio AddComponentDialog.png

To prepare to the performing the operation you must set the Pzl-container (Container Project) project (a file of the .prj6 type) and the pzl-component (Component Package) package (a file of the .pack type).

Any entity may be a pzl-container - an executable application or it may be a dll-container. To make the adding operation you choose the Visual Prolog project, which is a pzl-container. If it is the main application, then the pzlPort must be added to it before. If it is the DLL, then it must be actually the pzl-container based on DLL and created using the by the Elemntary PzlStudio.

The further actions depend on the goal of the operation.

Performing the Operation

The performing the operation is doing by the pressing one of buttons on the pane:

  • Add As Original
  • Add As Proxy
  • Remove
  • Convert To Proxy

The report regarding the result of the operation will be shown in the Message Window.

After the completion of the operation you should go to the IDE of the Visual Prolog system, open project (if it is not opened) and build it. Some details of the performing the operation are described below.

Adding

It dowsn’t matter whether the pzl-container is empty, or it has the pzl-components already. The main condition is that the component to be embedded must not be in the pzl-container already.

The pzl-component may be added as an original component or it may be added as a component delegate (proxy).

If you add the component as an original component, then all other classes may use it creating objects and performing all actions defined by the component’s interfaces. To add the pzl-component as the original one press the button Add As Original.

If you add the component delegate, then all classes of the given container communicate in the creation of the component object using the component delegate. To add the pzl-component as the component delegate press the button Add As Proxy.

The Message Window will show the report regarding the result of the operation.

PzlStudio ComponentAddedAsOriginalMSG.png

Open the project (if it is not opened) using the IDE and compile (build) it.

While the performing the operation the following situations may happen:

  1. If the original component added:
    1. 'If the new pzl-component added to the pzl-container doesn’t use other pzl-components,
      then you should accept all proposals from the IDE to add new packages to the project.
    2. If the new pzl-component added to the pzl-container uses some other pzl-components, which are not currently included to the pzl-container project, then you should refuse the adding such a new pzl-component to the project by the IDE.
      The inclusion of these pzl-components must be done using the Elementary PzlStudio only.
  2. If you add the pzl-component delegate (proxy) there should not be any problems, because of it is the particular case of the rule 1.1 described above.

Removing

It is recommended to perform the removing the pzl-component from the pzl-container using the Elementary PzlStudio. The manual performing this operation using the IDE may lead to braking some links in the project.

After the completion of the operation you will see the report regarding the results of the operation in the Message Window.

PzlStudio ComponentRemovedSuccessfulyMSG.png

Now you must come back to the IDE and open the pzl-container project (if it was not opened before).

It is recommended to make “Rebuild All” after the removing a pzl-component from the pzl-container.

The removing of the pzl-component may break some links in the project. It may happen if there are some invocations of the removed component from other classes of the given pzl-container. Strongly say you should not remove the pzl-component from the pzl-project. You should convert the status of the pzl-component to the Proxy status.

The conversion of the status will not be needed of you are making the synchronous removing of the pzl-components together will all classes (packages), which use it.

If there is no use of the removed component by the classes and packages of the given pzl-container project, then there should be no problems.

Changing the Status of the Pzl-Component

The pzl-component may have the status “Original” or it may be “Proxy”.

While adding the pzl-component to the pzl-project the status of the pzl-component is defined by the type of the operation performed (‘’’Add As Original’’’ or ‘’’Add As Proxy’’’).

Using the Elementary PzlStudio, you may change the status of the pzl-component from the “original” to “proxy” and back.

Converting to Proxy

Converting the status from the “original” to “proxy” may be done by pressing the button Convert To Proxy (Преобразовать в Proxy). You will see the report regarding the performing the operation.

PzlStudio ConvertOriginalToProxyMSG.png

Now you should go to the IDE and compile the project.

Converting to the Original

There is no special operation to convert the status of the pzl-component from the ‘proxy’ to the ‘original’. Performing the operation Add As Original, despite on the existence of the pzl-component in the project will change the status of the pzl-component to the “original” status. There will be the report in the Message Window:

PzlStudio ConvertProxyToOriginalMSG.png

Now you should go to the IDE and build the project.

References