(ATS6-DEV07) Building widgets for ELN home page


Published on

From a developer’s perspective, the Accelrys ELN 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.

This session will show several custom widgets examples 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.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

(ATS6-DEV07) Building widgets for ELN home page

  1. 1. (ATS6-DEV07) Building Widgets forthe Accelrys ELN Home PageBill BuoteCTO ADQMADQM Business UnitBill.Buote@accelrys.com
  2. 2. • The information on the roadmap and future softwaredevelopment efforts are intended to outline generalproduct direction and should not be relied on in making apurchasing decision.
  3. 3. Home Page• The Home Page is a container of widgets• Handles widget layout and persistence of widget settings
  4. 4. Home Page
  5. 5. Demo• A quick overview of the home page and out-of-the-boxwidgets
  6. 6. HomePageWidget• To start developing a custom widget, extendHomePageWidget (Widget SDK)• Subclass is responsible for returning factory classes thatcreate:– widget view– widget settings view• Subclass must also manage widget settings
  7. 7. • Primary Namespaces– Symyx.Notebook.HomePage– Symyx.Notebook.Applications.HomePage• New widget– Main class derives from• Symyx.Notebook.Applications.HomePage.HomePageWidget– View class derives from• Symyx.Notebook.HomePage.UserControlWidgetView– Factory class derives from• Symyx.Notebook.HomePage.WidgetViewBuilder– Custom configuration? Derive from• Symyx.Notebook.HomePage.UserControlConfigurationView• Symyx.Notebook.HomePage.ConfigurationViewBuilder– Custom configuration storage• Symyx.Notebook.HomePage.Widget.WidgetMementoWidget Development
  8. 8. Demo• First example: RSS Feed Widget– Display
  9. 9. RSS Feed Widget
  10. 10. Widget View• The widget view is the user control that appears on thehome page• Create your view by extending UserControlWidgetView
  11. 11. 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
  12. 12. Refreshing the Widget View• View may need to periodically refresh (ex., inbox widget)• Manual refresh supported by refresh button in widgettitle bar• Refresh button triggers call to RefreshView• If you want auto-refresh, your view must handle this• Use ShowBusySpinner and HideBusySpinner while view isupdating
  13. 13. Widget View• Use DisplayMessage for messages such as errors• Override Dispose to dispose of resources
  14. 14. Demo• Second example: RSS Feed Widget– Settings
  15. 15. RSS Feed Widget
  16. 16. Adding Widget Settings - Overview• Extend WidgetMemento to persist settings• Extend UserControlConfigurationView for settings UI• Extend ConfigurationViewBuilder as a factory for thesettings UI• Modify the widget view to respond to settings
  17. 17. 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 overridingSaveToMemento and RestoreFromMemento• Implement properties for settings in the main widget• Also override ResetDefaultValues so the Reset button worksOK
  18. 18. Settings UI• Extend UserControlConfigurationView• Override OnWidgetSet or use Widget property to access themain widget and its state• Override SetConfigurationView, and update the UI based onthe state of the main widget• Add event handlers to set the state of the main widget as UI ismanipulated• Widget view subscribes to ConfigurationChanged event of themain widget in its override of OnWidgetSet
  19. 19. ConfigurationViewBuilder• ConfigurationViewBuilder is a factory that creates thesettings UI• Extend ConfigurationViewBuilder, overridingCreateConfigurationView and CreateConfigurationView• Override ConfigurationViewBuilders in the main widgetto return this new class
  20. 20. Demo• Third example: Structure Search Widget
  21. 21. Structure Search Widget
  22. 22. Widgets that Search• Work in Progress widget is an example of a widget that presentssearch results• Extend QueryWidget to implement the main widget class for aquery-based widget• QueryWidgetViewBuilder can be used as is to create widget viewsthat execute a query and present the results in a grid• Auto-refresh also handled for you• Extend QueryWidgetConfigurationView to implement the settingsUI• The configuration view sets the main widget’s Query property,when the settings UI is changed
  23. 23. Demo• Fourth example: Pipeline Pilot Protocol Widget
  24. 24. Pipeline Protocol Widget
  25. 25. ProtocolWidget• ProtocolWidget can be configured to run a Pipeline Pilotprotocol that produces HTML• Views the result in the WebBrowser control• Modify the PipelinePilot | RunProtocol application permissionto add a new configuration key that specifies the location inthe 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 theGenerateProtocolParameters method
  26. 26. Performance Considerations• Performance and memory profiling are critical• Widgets that refresh periodically can have a significant negativeimpact on performance• Consider adding random amount to refresh interval to avoidsimultaneous refreshes (QueryWidgetView will handle this for you)• Notebook has 2 connections to Vault, so Widgets that refresh andtalk to Vault have the biggest potential to degrade systemperformance• QueryWidgetView handles connection limitation for you(VaultObjectGrid.GridLoader set to aKeyedAsynchronousGridLoadStrategy that uses "share" as a key)
  27. 27. Summary• Learned how to build custom widgets– Extend base classes in Symyx.Notebook.Applications.HomePageand Symyx.Notebook.HomePage– QueryWidget base classes can be extended for widgets thatsearch– Performance and memory considerations• Sample widgets and documentation in the Notebook SDK
  28. 28. 28Thank you.Accelrys, Inc.9 Industrial RoadMilford, MA 01757