Une image contenant texte, signe

Description générée automatiquement

HTML Link Generator

 

Overview

This helper generates a clickable HTML link that invokes helpers or navigates into Rhapsody.

 

Applicable To

Project

Menu Entry

Power Pack HTML Link Generator

Applicable To

All

Menu Entry

Power Pack Generate Web Link

Demonstration

Watch the Video

 

Operation

When launched the helper presents a UI with three tabs:

·       Helper Link: Generates a link that invokes a plugin.

·       Navigation Link: Generates a link that navigates to a model element.

·       Import a Link: Reads a previously generated link into fields for modification.

A screenshot of a computer

AI-generated content may be incorrect.

Common Link Generation Fields

The Display Text field defines the text to display in the generated html link/button

The Style Classes field defines the style(s) to apply to any generated styled button (see below).

Common Link Generation Buttons

The Generate buttons can be used to generate various types of HTML link:

·       Generate Link:  A basic textual link.

·       Generate Button: A basic HTML button using native html (no styles).

·       Generate Styled Button: A button styled using the CSS styles from the Style Classes field.

Clicking any of the create buttons shows the generated link in the Output panel but also places it onto the Windows clipboard. If you have inadvertently copied something else onto the clipboard, you can use the Copy to Clipboard button to re-copy the generated link.

Generated links send requests to the Power Pack Web Link Listener.

Styles

If the Generate Styled Button is used then the generated html code contains CSS styles, for example:

 

<button class="btn btn-primary" onclick="fetch(&#x27;http://localhost:7777/?navigate=GUID 997e8169-eb98-40f4-9c4b-27f708897f30&#x27;).then(r =&gt; r.text()).then(d =&gt; console.log(&#x27;Navigate Response: &#x27;+d)).catch(e =&gt; console.error(&#x27;Error sending navigate request:&#x27;, e));">Locate a Model Element in Rhapsody</button>

 

The HTML file you paste this code into must then define those style(s). A sample may be generated by clicking Generate Button Style which generates the following:

 

<style>

  .btn {

    display: inline-block;

    padding: 0.375rem 0.75rem;

    font-size: 1rem;

    line-height: 1.5;

    border: 1px solid transparent;

    border-radius: 0.25rem;

    text-align: center;

    cursor: pointer;

  }

  .btn-primary {

    color: #fff;

    background-color: #007bff;

    border-color: #007bff;

  }

    .btn-bad {

    color: #fff;

    background-color: #ff5733;

    border-color: #007bff;

  }

</style>

 

Navigate Links

The Navigate tab has a single field where you can enter either the GUID or Full Path of a model element. These may be easily obtained using Get GUID or Get Full Path *

A white box with black text

AI-generated content may be incorrect.

The resulting generated link will navigate to the model element in Rhapsody.

 

*If the Generate Web Link menu was used to launch the helper, then the UI automatically switches to the Navigate tab and pre-fills the GUID and Display name fields with the selected model element data.

Helper Links

The Helper tab has two fields:

·       Helper Name

·       Parameters

Helper Name

This field must contain the name of the plugin from the HEP file (not the menu entry name), for example:

A black and green text

AI-generated content may be incorrect.

Parameters

The Parameters field may be used to supply additional data to the helper being invoked (see below).

Implementing an Invocable helper

The generated html links call an embedded web link listener in the Power Pack which in turn will ask Rhapsody to invoke the specified helper through an API function call. Rhapsody only allows such helpers to be invoked if the class that extends RPUserPlugin overrides the RhpPluginInvokeItem(String args) and/or RhpPluginInvokeItem() methods, for example:

A screenshot of a computer code

AI-generated content may be incorrect. 

Invokable Power Pack Helpers

The following helpers in the Power Pack implement the above methods and may therefore be invoked from a generated html link:

Model Checker

Invokes the Model Checker with the (optional) specified parameters.

Helper Name: RPModelChecker

Parameters (optional): autorun=true, runOnGUID=GUID

(Replace GUID with the GUID of the desired starting element. GUIDs may be easily obtained using Get GUID)

Generate as HTML

Invoked the Generate as HTML helper on the specified model element.

Helper Name: GenerateAsHTML

Parameters (mandatory): Full Path to starting model element

Model Visualizer

Launches the Model Visualizer in structure mode.

Helper Name: PPModelVisualizer

Parameters (mandatory): GUID of starting element

Importing Links

Previously generated links may be imported for modification by pasting the generated link into the Paste Link Text field and clicking Import:

 

A screenshot of a computer

AI-generated content may be incorrect.

The helper parses the link and populates the correct fields before switching to the appropriate tab.