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.
(ATS6-DEV01) What’s new for Protocol and Component Developers in AEP 9.0
(ATS4-DEV08) Building Widgets for the Symyx Notebook Home Page
1. (ATS04-PLAT00) Building Widgets for
the Accelrys ELN Home Page
David Pirkle
Principal Software Engineer, R & D
david.pirkle@accelrys.com
2. The information on the roadmap and future software development efforts are
intended to outline general product direction and should not be relied on in making
a purchasing decision.
3. Demo
• A quick overview of the home page and
out-of-the-box widgets
4. Home Page
• The Home Page is a container of widgets
• Handles widget layout and persistence of widget settings
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
7. Widget View
• The widget view is the user control that appears on the
home page
• Create your view by extending UserControlWidgetView
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
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. Widget View
• Use DisplayMessage for messages such as errors
• Override Dispose to dispose of resources
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. 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. 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. 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
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. Demo
• Fifth example: Pipeline Pilot Protocol
Widget
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. 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. 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