Application properties  Working with data-capable elements

Chapter 5: Advanced Portlet Creation

Creating application portlets

The examples in this section guide you through creating a small application that uses three portlets. The portlets created in this tutorial include:

The sample application that you build will use “portlet flow,” meaning all of the portlets are on the same page. See “Portlet flow”.

You will use the Application Builder to define click-across events and listeners in the portlets so data can be sent between them. You will define two click-across events on the 25 most active stocks portlet. The first event will send the stock symbol to the listening stock quote portlet and the second event will send the company name to the listening Google.com search portlet, which searches Google.com for the name of the company.

StepsCreating the Most Actives portlet

  1. Log in to Web Studio and select Build | Portlets from the menu in the left pane.

  2. Click New on the Portlet Manager toolbar. You see the Portlet Builder.

  3. Click the down arrow beside the Add button and select Web Element from the pop-up.

  4. When the Web Studio – New Web Element window displays, enter http://finance.yahoo.com/ in the Location field and click Find. The Yahoo Finance Web site displays in the window.

  5. Click the link in the middle of the page titled “Most Actives.” The Web site changes to display NASDAQ Volume Leaders.

  6. Click Next. When the page reloads, move the mouse around until the cursor is positioned over some text in the stock table and click once to perform a one-click capture. You see a preview with several selections. Each selection contains more data from the captured table.

  7. Click Select next to the capture option you want to use, then click Next.

  8. In the Split window, click Next.

  9. In the Define window, click Next.

  10. In the Filter window under Add Filter Rule, set a filter rule to remove extraneous columns from the table.

    1. In the first drop-down list, select “Include field(s)”.

    2. In the second drop-down list, select “number”.

    3. In the text box, enter:

      1-2,4-6
      

      This tells the filter to include columns where the column number is in the ranges of 1 through 2 and 4 through 6.

    4. Click Add and the grid should highlight the selected columns.

  11. Click Next.

  12. On the CGI parameter override screen, click Next.

  13. On the final screen, give the Web element the name “Most Actives” and click Finish to close the window.

    Back in Portlet Builder, you see a preview of the Most Actives element.

  14. Click Save to save the portlet.

  15. In the Finish window, complete these options:

  16. Click Finish. When you see the confirmation that the portlet was saved successfully, click OK.

  17. Click Close to exit the Portlet Builder.

  18. On the Portlet Manager Status menu, click New to display the new portlet in the right pane detail window.

    NoteBy default, a portlet has the “New” status until you right-click the portlet in the detail pane, select Approval Status from the pop-up and select a different status.

  19. Right-click the Most Actives portlet and select Approval Status | Approved, then click Approved on the Status menu and verify that the Most Actives portlet displays in the Approved list.

StepsCreating the Stock Quote portlet

  1. Log in to Web Studio and select Build | Portlets from the menu in the left pane.

  2. Click New on the Portlet Manager toolbar. You see the Portlet Builder.

  3. Click the down arrow beside the Add button and select Web Element from the pop-up.

  4. When the Web Studio – New Web Element window displays, enter http://finance.yahoo.com/ in the Location field and click Find. The Yahoo Finance Web site displays in the window.

  5. In the text box with the title “Enter symbol(s)” enter “SY”, select Detailed from the drop-down list to the right of the text box, then click Get.

    NoteThis screen may vary depending on your browser’s version. On some browsers, the drop-down list may not display and the Get button is labeled Go. The most important thing is to enter the SY symbol and click the button that means “go get it.”

    You see the detailed stock quote for the stock symbol SY at Yahoo Finance.

  6. Click Next. When the page reloads, move the mouse around until the cursor is positioned over some text in the stock table and click once to perform a one-click capture. You see a preview with several selections. Each selection contains more data from the captured table.

  7. On the capture selection page, select the capture that displays the stock table, then click Next.

  8. On the CGI parameter override window:

    1. Select the Variable option next to the variable named “s”.

    2. Change the Display Name to “Symbol”.

    3. Enter “SY” for the Default Value.

    4. Leave Type as “Text Field”.

    5. Verify that the Required option is selected.

    6. Click Next.

  9. In the final window, enter “Yahoo Stock Quote” and click Finish.

    Back in Portlet Builder, you see a preview of the Yahoo Stock Quote element.

  10. Click Save to save the portlet.

  11. In the Finish window, complete these options:

  12. Click Finish. When you see the confirmation that the portlet was saved successfully, click OK.

  13. Click Close to exit the Portlet Builder.

  14. On the Portlet Manager Status menu, click New to display the new portlet in the right pane detail window.

    NoteBy default, a portlet has the “New” status until you right-click the portlet in the detail pane, select Approval Status from the pop-up and select a different status.

  15. Right-click the Yahoo Stock Quote portlet and select Approval Status | Approved, then click Approved on the Status menu and verify that the portlet displays in the Approved list.

StepsCreating the Google Stock Search portlet

  1. Log in to Web Studio and select Build | Portlets from the menu in the left pane.

  2. Click New on the Portlet Manager toolbar. You see the Portlet Builder.

  3. Click the down arrow beside the Add button and select Web Element from the pop-up.

  4. When the Web Studio – New Web Element window displays, enter http://www.google.com/ in the Location field and click Find. The Google search Web site displays in the window.

  5. Click Google Search. Google.com accepts the empty search string to create the required CGI request. The subsequent window shows the empty Google search result.

  6. Select Page from the Format drop-down list and click Next. This option allows you to capture the entire results page instead of just a portion of it.

  7. On the capture selection page, there should be only one option. Select the capture, then click Next.

  8. On the CGI parameter override window:

    1. Select the Variable option next to the variable named “q”.

    2. Change the Display Name to “Search for”.

    3. Select a Type of “Text”.

    4. Verify that the Required option is not selected.

    5. Click Next.

  9. In the final window, enter “Google Stock Search” and click Finish.

    Back in Portlet Builder, you see a preview of the Google Stock Search element.

  10. Click Save to save the portlet.

  11. In the Finish window, complete these options:

  12. Click Finish. When you see the confirmation that the portlet was saved successfully, click OK.

  13. Click Close to exit the Portlet Builder.

  14. On the Portlet Manager Status menu, click New to display the new portlet in the right pane detail window.

    NoteBy default, a portlet has the “New” status until you right-click the portlet in the detail pane, select Approval Status from the pop-up and select a different status.

  15. Right-click on the Google Stock Search portlet and select Approval Status | Approved, then click Approved on the Status menu and verify that the portlet displays in the Approved list.

StepsCreating the application

  1. Log in to Web Studio and select Build | Applications from the menu in the left pane.

  2. Click New on the Portlet Manager toolbar. You see the Application Builder.

  3. Click Add to add existing portlets to the application using the Search dialog box.

  4. In the Search dialog box, click Search to retrieve a list of all approved portlets.

  5. In the Results pane, hold down the Ctrl key and click the Google Stock Search, Most Actives, and Yahoo Stock Quote portlets that you created, then click Add to add them to the Application.

  6. To adjust the portlet placement, drag and drop the portlets around the right side of the Application Builder window.

StepsMost Actives portlet post processing

The Most Actives portlet will be used to publish click-across events. You can either define an event on the portlet outside of the Application Builder or within the Application Builder.

NoteAny post processing added to a portlet in the Application Builder also effects the portlet outside of the Application Builder. See the notes at the end of this tutorial for more details.

  1. Right-click the Most Actives portlet in the Application Builder’s Portlets pane and select Define Events. This starts the Define Event wizard.

    Defining events is a three-step process. The first step shows you all grid, table, or list (structured) objects contained in the current portlet. You can define events only on structured (tables and lists) content. The first screen shows you a list of tables in the selected portlet.

  2. In the first wizard window, click Select to choose table of stock quotes and click Next. The next window allows you to define or edit an event.

    You can define an event for a row, a column, or any subset of rows and columns. You can also use the row and column number to identify a specific cell to define an event.

  3. In the Assign Event section, complete these fields:

  4. Click Add to add the event. After a few moments, the first column turns blue. This means the event has been defined for the column.

  5. Define an event on the second column:

  6. Click Add to add the event. After a few moments, the second column turns blue. This means the event has been defined for the second column.

    For more details on click-across and defining events, see “Building click-across messaging portlets”.

  7. Click Next to continue and see a preview of the table with the defined events.

  8. Click Finish to close the Define Events wizard. The Application Builder displays the two defined events beneath the Most Actives portlet in the Portlets list.

StepsGoogle Stock Search portlet post processing

The Google Stock Search portlet will be used to listen for certain click-across events and perform a search for the data it receives with the event. You can define a listener for the portlet outside of the Application Builder or within the Application Builder.

NoteAny post processing added to a portlet in the Application Builder also effects the portlet outside of the Application Builder. See the notes at the end of this tutorial for more details.

  1. In the Application Builder, right-click the Google Stock Search portlet and select Define Listeners to open the Listener Editor.

  2. Select these options:

  3. Click OK to save the settings. The listener you defined displays beneath the Google Stock Search portlet in the Application Builder Portlets list.

    NoteTo remove a listener from the portlet, click the associated X in the Action column.

StepsYahoo Stock Quote portlet post processing

The Yahoo Stock Quote portlet will be used to listen for certain click-across events and performs a stock symbol search at http://finance.yahoo.com for the data it receives with the event. You can define a listener on the portlet outside of the Application Builder or within the Application Builder.

NoteAny post processing added to a portlet in the Application Builder also effects the portlet outside of the Application Builder. See the notes at the end of this tutorial for more details.

  1. In the Application Builder, right-click the Yahoo Stock Quote portlet and select Define Listeners to open the Listener Editor.

  2. Select these options:

  3. Click OK to save the settings. The listener you defined displays beneath the Google Stock Search portlet in the Application Builder Portlets list.

    NoteTo remove a listener from the portlet, click the associated X in the Action column.

StepsSaving the application

  1. In the Application Builder, click Save to save the application you built. This opens the Application Properties window.

  2. Complete these fields:

  3. Click OK to save your entries.

StepsPreviewing the application

  1. To preview your new application, click Preview in the Application Builder. This opens the application in a new window that lets you test-drive a preview of your application.

StepsEditing and deleting applications

  1. To edit an application, select Build | Applications.

  2. Select the status of the application you want to edit.

  3. In the detail view, select the application and click Edit.

  4. To disable or inactivate an application:

  5. Select the application in the detail view and click Edit.

    1. When the Application Builder displays, select Properties, change the Status to Deleted, then click OK.

    2. Click Save to implement your change, then click Close to exit the Application Builder.

    3. Select Build | Page Groups and change the status of the Page Group associated with the application to Deleted or mark the Page Group as Inactive.

    4. Click Update on the Page Group Manager toolbar to update Portal Interface with the changes.





Copyright © 2004. Sybase Inc. All rights reserved. Working with data-capable elements

View this book as PDF