Class WebViewPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javafx.embed.swing.JFXPanel
org.cy3sbml.gui.WebViewPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, InfoPanel, org.cytoscape.application.events.SetCurrentNetworkListener, org.cytoscape.application.swing.CytoPanelComponent, org.cytoscape.application.swing.CytoPanelComponent2, org.cytoscape.event.CyListener, org.cytoscape.model.events.RowsSetListener, org.cytoscape.view.model.events.NetworkViewAboutToBeDestroyedListener, org.cytoscape.view.model.events.NetworkViewAddedListener

public final class WebViewPanel extends javafx.embed.swing.JFXPanel implements org.cytoscape.application.swing.CytoPanelComponent2, InfoPanel, org.cytoscape.model.events.RowsSetListener, org.cytoscape.application.events.SetCurrentNetworkListener, org.cytoscape.view.model.events.NetworkViewAddedListener, org.cytoscape.view.model.events.NetworkViewAboutToBeDestroyedListener
The cy3sbml panel in the Cytoscape results panel (east): a JavaFX Browser that shows the SBML information of the current network and the selected node, or the help and examples pages.

The HTML is rendered on the LatestTaskExecutor (it may wait for web services) and published to the browser through the PageLoader.

See Also:
  • Constructor Details

  • Method Details

    • getHtml

      public String getHtml()
      The HTML text shown last, or null if no rendered text has been shown yet.
    • getCytoPanelName

      public org.cytoscape.application.swing.CytoPanelName getCytoPanelName()
      Specified by:
      getCytoPanelName in interface org.cytoscape.application.swing.CytoPanelComponent
    • getComponent

      public Component getComponent()
      Specified by:
      getComponent in interface org.cytoscape.application.swing.CytoPanelComponent
    • getIcon

      public Icon getIcon()
      Specified by:
      getIcon in interface org.cytoscape.application.swing.CytoPanelComponent
    • getIdentifier

      public String getIdentifier()
      Specified by:
      getIdentifier in interface org.cytoscape.application.swing.CytoPanelComponent2
    • getTitle

      public String getTitle()
      Specified by:
      getTitle in interface org.cytoscape.application.swing.CytoPanelComponent
    • isActive

      public boolean isActive()
      Whether the results panel is shown, so the information is updated.
    • activate

      public void activate()
      Shows the results panel with this panel selected, and the information of the current selection, which was not updated while the panel was hidden.
    • deactivate

      public void deactivate()
      Hides the results panel, unless it has other components.
    • changeState

      public void changeState()
      Hides the panel if it is shown, else shows it.
    • select

      public void select()
      Selects this panel in the results panel.
    • setHelp

      public void setHelp()
      Shows the static help page.

      Submitted on the renderExecutor under a fresh key (never equal to any other key, including a previous call's), so it is never coalesced away and always cancels whatever render is still pending or running (e.g. a slow web-service lookup for a previous selection): that render can no longer overwrite the help page once it is requested, and the two run in the order they were requested. The page is loaded via publish(java.util.function.Consumer<org.cy3sbml.gui.PageLoader>), the same publication path the SBase renders use.

    • setExamples

      public void setExamples()
      Shows the static examples page. Submitted on the renderExecutor under a fresh key, same as setHelp(), so an in-flight render cannot overwrite it.
    • setText

      public void setText(String text)
      Shows the given HTML text.

      Must be called from a render task running on the renderExecutor; the text is only shown if that task is still the current render (see publish(java.util.function.Consumer<org.cy3sbml.gui.PageLoader>)).

      Specified by:
      setText in interface InfoPanel
    • showSBaseInfo

      public void showSBaseInfo(Object obj)
      Shows the information of the SBase, see showSBaseInfo(Set).
      Specified by:
      showSBaseInfo in interface InfoPanel
    • showSBaseInfo

      public void showSBaseInfo(Set<Object> objSet)
      Display information for set of nodes.

      Runs the HTML generation (the OLS/UniProt/ChEBI web-service lookups) inline, on whatever thread is calling this. The only caller is PanelUpdater, itself running as the single task updateInformation() submits to the renderExecutor for the current selection. This must stay a plain call and never become a nested renderExecutor.submit(...): the executor cancels whatever task it is currently running when a new one is submitted, so a nested submit from inside a task that is itself about to be cancelled would race with, and could cancel, a newer selection's already-submitted task instead of its own. Keeping exactly one submit per selection is what makes that cancellation correct.

      Specified by:
      showSBaseInfo in interface InfoPanel
    • handleEvent

      public void handleEvent(org.cytoscape.model.events.RowsSetEvent event)
      Shows the information of the selected node when the selection in the node table of the current network changes. Rows are set very often, e.g. while a network is created or laid out, so all other row changes are ignored right away.
      Specified by:
      handleEvent in interface org.cytoscape.model.events.RowsSetListener
    • handleEvent

      public void handleEvent(org.cytoscape.application.events.SetCurrentNetworkEvent event)
      Makes the SBML document of the new current network the current document and shows its information.
      Specified by:
      handleEvent in interface org.cytoscape.application.events.SetCurrentNetworkListener
    • handleEvent

      public void handleEvent(org.cytoscape.view.model.events.NetworkViewAddedEvent event)
      Shows the information of the current network once it has a view.
      Specified by:
      handleEvent in interface org.cytoscape.view.model.events.NetworkViewAddedListener
    • handleEvent

      public void handleEvent(org.cytoscape.view.model.events.NetworkViewAboutToBeDestroyedEvent event)
      Shows the help page when the view of the current network is closed; the view of another network leaves the information of the current network.
      Specified by:
      handleEvent in interface org.cytoscape.view.model.events.NetworkViewAboutToBeDestroyedListener
    • updateInformation

      public void updateInformation()
      Updates the panel information on the render executor.

      Resolves the render target (see PanelUpdater.resolveTarget(org.cytoscape.model.CyNetwork, org.cy3sbml.SBMLManager)) and submits it as the render executor's key: several Cytoscape events fired while loading one model can resolve to the same target (e.g. a model's subnetworks, taken current in turn, share one SBMLDocument), and LatestTaskExecutor coalesces a resubmission of the target it is already rendering rather than cancelling and restarting it, so one load renders once.

    • close

      public void close()
      Stops the render executor. Called from CyActivator.shutDown so the daemon render thread and any in-flight web-service call are stopped on app shutdown.