(ATS4-DEV08) Building Widgets for the Symyx Notebook Home Page

864 views
729 views

Published on

From a developer’s perspective, the Symyx Notebook Home Page is a container of widgets. It manages the layout of widgets, and handles the persistence of their settings. Several widgets are provided with the application: one for creating new experiments, another for tracking work in progress, and an inbox widget for messages sent through the notebook. This out-of-the-box set can be supplemented by building custom widgets.

Several examples of custom widgets will be covered to demonstrate the basic concepts of widget development and the API they implement. We will also discuss best practices, and how to make your widget a good citizen of the Home Page.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
864
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

(ATS4-DEV08) Building Widgets for the Symyx Notebook Home Page

  1. 1. (ATS04-PLAT00) Building Widgets for the Accelrys ELN Home Page David Pirkle Principal Software Engineer, R & D david.pirkle@accelrys.com
  2. 2. The information on the roadmap and future software development efforts areintended to outline general product direction and should not be relied on in makinga purchasing decision.
  3. 3. Demo • A quick overview of the home page and out-of-the-box widgets
  4. 4. Home Page• The Home Page is a container of widgets• Handles widget layout and persistence of widget settings
  5. 5. HomePageWidget• To start developing a custom widget, extend HomePageWidget• Subclass is responsible for returning factory classes that create: – widget view – widget settings view• Subclass must also manage widget settings
  6. 6. Demo • First example: RSS Feed Widget, Part 1
  7. 7. Widget View• The widget view is the user control that appears on the home page• Create your view by extending UserControlWidgetView
  8. 8. Publishing a Widget• See the sample code in the PublishWidgetToVault project• Command line utility takes 6 parameters: – Server – Username – Password – Vault path of widget folder – Widget title – Assembly-qualified name of the main widget class
  9. 9. Demo • Second example: RSS Feed Widget, Part 2
  10. 10. Refreshing the Widget View• View may need to periodically refresh (ex., inbox widget)• Manual refresh supported by refresh button in widget title bar• Refresh button triggers call to RefreshView• If you want auto-refresh, your view must handle this• Use ShowBusySpinner and HideBusySpinner while view is updating
  11. 11. Widget View• Use DisplayMessage for messages such as errors• Override Dispose to dispose of resources
  12. 12. Demo • Third example: RSS Feed Widget, Part 3
  13. 13. Adding Widget Settings - Overview• Extend WidgetMemento to persist settings• Extend UserControlConfigurationView for settings UI• Extend ConfigurationViewBuilder as a factory for the settings UI• Modify the widget view to respond to settings
  14. 14. Settings Persistence• Extend Widget.WidgetMemento• Implement properties for settings in the memento• Add serialization decorators (DataContract and DataMember)• Use your memento in the main widget class by overriding SaveToMemento and RestoreFromMemento• Implement properties for settings in the main widget• Also override ResetDefaultValues so the Reset button works OK
  15. 15. Settings UI• Extend UserControlConfigurationView• Override OnWidgetSet or use Widget property to access the main widget and its state• Override SetConfigurationView, and update the UI based on the state of the main widget• Add event handlers to set the state of the main widget as UI is manipulated• Widget view subscribes to ConfigurationChanged event of the main widget in its override of OnWidgetSet
  16. 16. ConfigurationViewBuilder• ConfigurationViewBuilder is a factory that creates the settings UI• Extend ConfigurationViewBuilder, overriding CreateConfigurationView and CreateConfigurationView• Override ConfigurationViewBuilders in the main widget to return this new class
  17. 17. Demo • Fourth example: Structure Search Widget
  18. 18. Widgets that Search• Work in Progress widget is an example of a widget that presents search results• Extend QueryWidget to implement the main widget class for a query-based widget• QueryWidgetViewBuilder can be used as is to create widget views that execute a query and present the results in a grid• Auto-refresh also handled for you• Extend QueryWidgetConfigurationView to implement the settings UI• The configuration view sets the main widget’s Query property, when the settings UI is changed
  19. 19. Demo • Fifth example: Pipeline Pilot Protocol Widget
  20. 20. ProtocolWidget• ProtocolWidget can be configured to run a Pipeline Pilot protocol that produces HTML• Views the result in the WebBrowser control• Modify the PipelinePilot | RunProtocol application permission to add a new configuration key that specifies the location in the protocol tree where you will publish widget protocols – Name: WidgetProtocolRoot – Value: Protocols/Web Services/Accelrys/Notebook Widgets• If you need to pass parameters to a protocol, override the GenerateProtocolParameters method
  21. 21. Performance Considerations• Performance and memory profiling are critical• Widgets that refresh periodically can have a significant negative impact on performance• Consider adding random amount to refresh interval to avoid simultaneous refreshes (QueryWidgetView will handle this for you)• Notebook has 2 connections to Vault, so Widgets that refresh and talk to Vault have the biggest potential to degrade system performance• QueryWidgetView handles connection limitation for you (VaultObjectGrid.GridLoader set to a KeyedAsynchronousGridLoadStrategy that uses "share" as a key)
  22. 22. Summary• Learned how to build custom widgets – Extend base classes in Symyx.Notebook.Applications.HomePage and Symyx.Notebook.HomePage – QueryWidget base classes can be extended for widgets that search – Performance and memory considerations• Sample widgets and documentation in the Notebook SDK• Administration of widgets covered in session ATS4-APP02

×