Embed Components
- Last UpdatedJan 31, 2024
- 3 minute read
The following sections explain the endpoints and client handlers to get information from the AIM Dashboard.
Endpoints
The following are the endpoints:
-
Accessing the API for FileViewer
-
Referencing ItemView API Path and Parameters
Accessing the API for FileViewer
To access the API for FileViewer:
-
Go to the following relative path:
viewer?documentId={Document full Id}&tagId={Tag full Id}
Note: The sample application hosting the FileViewer is located in the following location:
INSTALLDIR\Dashboard\Samples\DashboardViewerSample.zip
-
Substitute the parameter elements with the required values.
The following table describes the parameters, and provide example values to substituting the parameters:
Parameter
Is Mandatory?
Description
Value (Example)
documentId
Yes
The complete ID of the document to be rendered.
IPE|905675
tagId
No
The complete ID of the Tag to be highlighted in the document.
IPE|E-9002
To view an example, go to the following location:
http://{HostName:Port Number}/viewer?documentId=IPE|VPD|Area-15A&tagId=IPE|E-9001
Referencing ItemView API Path and Parameters
To reference the ItemView API path and parameters:
-
Using the following path, access the ItemView API:
itemview?itemId={item full Id}&view={relative path of the view HTML}&tagId={Id of the tag}
-
Substitute the parameter elements with the required values.
The following table describes the parameters, and provide example values to substituting the parameters:
Parameter
Description
Value (Example)
itemId
The complete ID of the item, for which you want the details to be displayed.
IPE|905675
view
An HTML page that displays an object's details view in Dashboard.
If a view is mentioned in a path, it is a relative path in the AIM Dashboard’s "App/custom" folder. The views in this path will be defined within the AIM Dashboard.
itemviewsamples/documentView.html
tagId
The ID of tag that can be used to highlight/isolate the tag, when the document is opened with a view using file viewer display.
IPE|E-9002
Note: For examples, see:
http://{HostName:Port Number}/ItemView?itemId=IPE%7C905675&view=itemviewsamples/documentView.html
http://{HostName:Port Number}/ItemView?itemId=IPE%7CCIVI-15AFW&view=itemviewsamples/tagView.html
Event Handling
The following are the event handlers:
-
Handling Selection Events in the Viewer
-
Handling Events in Awesomium Web Control
Handling Selection Events in the Viewer
The WebBrowser control enables you to navigate through the web pages inside your form. While using the System.Windows.Forms.WebBrowser control, you must follow this procedure to handle selection events in the viewer.
To handle selection events in the viewer:
-
To enable the Javascript to call the c# application, hosting the WebBrowser:
-
Set ObjectForScripting to a COM visible object, before the URL is set on the control.
-
The following method is called on the viewer selection:
OnViewerSelection
The resultant syntax appears as follows:
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public class ScriptInterface
{
public void OnViewerSelection(String message)
{
}
}Note: The element highlighted in yellow indicates the argument passed, identifying the tag that is selected.
-
The Viewer and ItemView component calls the following methods, when the items are selected. These components are integrated using a .NET Web Control or an Awesomium control that handles the methods distinctively, to enable selection of the items.
|
Method |
Called when |
|---|---|
|
onViewerSelection |
An item is selected in the viewer. |
|
onSelection |
A link to an item is selected. |
The following table describes the arguments in the command syntax:
|
Argument |
Provide the selected item's |
|---|---|
|
itemId |
Complete ID |
|
classPath |
Class hierarchy information |
To handle events in . NET Web Control:
-
Define the OnViewerSelection method:
OnViewerSelection (string itemId, string classPath)
{
// Custom Code goes here
}
-
Define the OnSelection method:
OnSelection (string itemId, string classPath)
{
// Custom Code goes here
}
Handling Events in Awesomium Web Control
When the Awesomium Web control loads the OnSelection and OnViewerSelection, events can be attached by doing the following:
using (JSObject external = this.webControl1.CreateGlobalJavascriptObject("external"))
{
external.Bind("onSelection", false, this.OnSelection);
external.Bind("onViewerSelection", false, this.OnViewerSelection);
}
To handle events in Awesomium Web control:
-
Define the OnViewerSelection event:
OnViewerSelection (object sender, JavascriptMethodEventArgs event)
{
// Access arguments using event.Arguments property
// Custom Code goes here
}
-
Define the OnSelection event:
OnSelection (object sender, JavascriptMethodEventArgs event)
{
// Access arguments using event.Arguments property
// Custom Code goes here
}
The following arguments can be accessed using the event.Arguments property:
Argument
Description
Can be accessed using
Example
ItemFullId
Full ID of the item selected.
event.Arguments[0]
IPE|905675
ClassPath
Full class hierarchy of the item.
event.Arguments[1]
OBJECT|LOGICAL (& OTHER PHYSICAL) OBJECT|FACILITY|FUNCTIONAL ARTIFACT|ELECTRICAL|ELECTRIC MOTOR
-
Register events:
-
When the Awesomium Web Control is ready, bind the onSelection and onViewerSelection methods, defined in the viewer and itemView component with the Events written in Awesomium.
Awesomium_Windows_Forms_WebControl_DocumentReady (object sender, UrlEventArgs e)
{
using (JSObject external = this.webControl1.CreateGlobalJavascriptObject("external"))
{
external.Bind("onSelection", false, this.OnSelection);
external.Bind("onViewerSelection", false, this.OnViewerSelection);
}
}
-