サポートと今すぐチャット
サポートとのチャット

Foglight 5.9.3 - Web Component Tutorial

Using the Web Component Tutorial Tutorial 1: Drag and Drop Tutorial 2: Creating a Dashboard Tutorial 3: Adding a Drilldown Page Tutorial 4: Adding Views Tutorial 5: Using a Grid Tutorial 6: Reports Tutorial 7: Creating a Form Tutorial 8: Renderers Tutorial 9: Adding Questions and Answers Tutorial 10: Sending Messages to Other Users

Creating Script Functions

Script Functions execute scripts and return desired results. In this we will create two Script Functions: Send Warning Message and Send Error Message. These functions call the sendMessage() function and that uses a Message Association as input. This function is defined in the FunctionHelper interface available in the WCF API.

For the purpose of this example, we are making a call to the sendMessage() function when a label is selected in order to display a message in the browser interface and illustrate the usage of Message Associations. However, in a typical scenario, you will likely use messages in your code, for example, to inform the users that a background process has finished. This can be done by calling the sendMessage() function from the code instead of creating a Script Function and invoking it from a view.

For complete information about the sendMessage() function and the WCF API, see the WCF API Reference in the online help, accessible from the Getting Started page under Developing Foglight Cartridges.

To create Script Functions that call the sendMessage() function:
d
In the Module Contents pane, click Associations and select Functions from the list that appears.
f
In the Add Function dialog box that appears, on the Blank Function tab, select Script and click OK.
A New Function tab appears in the Definition/Edit pane.
g
Specify the name for this Script Function. In the Name box, type Send Warning Message.
2
In the Script Text box, type the following text:
The second line calls the sendMessage() function. The first argument shown in the above example, "system:wcf_tutorials_tutotial2010.7", should contain the reference ID of the Warning Association. Edit that value to reflect the reference ID.
For more information about this function, see the WCF API Reference in the online help, accessible from the Getting Started page under Developing Foglight Cartridges.
3
Observe the Output Data Type property.

The Script Functions are created. Next, create Label views that invoke these Script Functions in their flow.

Creating Label Views

In this you will create two Label views: Warning Label and Error Label. Each of these Labels will invoke the appropriate Script Function in their flow.

h
In the Module Contents pane, click Functions and select Views from the list that appears.
j
In the Add View dialog box that appears, on the Create a Blank View tab, choose Common > Label and click OK.
A New View tab appears in the Definition/Edit pane.
k
Specify the name for this Label. In the Name box, type Send Warning Label.
a
Open the Configuration tab.
b
In the row containing the Label property, in the Value column, click Edit , and choose Set to Value > String.
c
In the Edit - Label dialog box that appears, in the String name box, type Send a Warning Message.
d
Click Set.
3
Enable the triggering of the Send Warning Message function when the Label is selected.
The Send Warning Message returns an Object. This object contains the message that will be passed as an input key to the flow. For that reason, we need to add an input key to receive this Object instance.
a
Open the Flow tab.
b
Click Selection in the list.
c
In the Edit - Selection dialog box that appears, clear the Leave unspecified check box.
d
Click Flow type and select Update from the list that appears.
e
In the Context table, click to add a new context key.
f
In the Key column, type the key name. For example, message.
g
In the Value column, click Edit , and choose Set to Binding > Function.
h
In the Edit dialog box that appears, click the selector button (). In the Available Functions dialog box that appears, navigate to the Send Warning Message function.
5
Follow Step 1 through Step 4 to create another Label view with the following definitions:
Name: Error Label
Label: Send an Error Message
Update Flow: Configure it to include a context key pointing to the Send Error Message function.

The Label views are created. Next, add these labels to a dashboard and send test messages.

Testing Messages

In this you will create a simple dashboard, Send Messages, and add the Label views to the layout. You will then test the messaging actions by invoking Warning and Error messages and observe the resulting flow.

k
In the Add View dialog box that appears, on the Create a Blank View tab, choose Common > Grid Layout. Click OK.
A New View tab appears in the Definition/Edit pane.
l
a
Open the Layout tab.
b
Click Add.
c
In the Add View dialog box that appears, ensure that Selecting existing view is selected and click Next.
f
Follow Step b through Step e to add the Error Label to the layout and save your changes.
g
In the Definition Editor, navigate to the Send Messages definitions. Click Test.
The dashboard contains two links: Send a Warning Message and Send an Error Message.
h
Click Send a Warning Message.
Figure 4. Warning Message
i
Click Send an Error Message.
Figure 5. Error Message
k
Optional. Clear all or individual messages, or close the list.

Summary

In this tutorial you have learned to create Message Associations, Script Functions, Label, and Grid Layout views, and now to send messages to active Foglight® users.

関連ドキュメント

The document was helpful.

評価を選択

I easily found the information I needed.

評価を選択