中的图查看器的原始实现是Reactome的Diagram GWT小部件GWT.它是为了被第三方资源重用,以便在他们的网页中直接显示Reactome路径图,使用户能够与他们进行交互。

更多信息

GWT是一个开发工具包,用于构建和优化复杂的基于浏览器的应用程序。它的目标是实现高性能web应用程序的高效开发,而无需开发人员精通浏览器怪才、XMLHttpRequest和JavaScript。谷歌的许多产品都使用了GWT,包括AdWords、AdSense、Flights、Hotel Finder、Offers、Wallet、Blogger。它是开源的,完全免费的,被世界各地成千上万的开发人员使用。

开始

我们假设你已经有了GWT项目启动和运行配置MAVEN原型.因此,第一步是在pomo .xml文件中添加EBI Nexus存储库:

<库>…<!——EBI repo——>  nexus-ebi-repo  EBI内部存储库 http://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-repo/  true   false     nexus-ebi-snapshot-repo  EBI内部快照存储库 http://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-snapshots/  false   true   

一旦存储库就位,接下来要做的就是添加Reactome的路径概述依赖项:

< >的依赖…<依赖> < groupId > org.reactome。web diagram 3.2.1  

在编写使用路径概述的代码之前,在您的gwt.xml文件,因此编译器将找到路径概述:

<继承name = " org.reactome.web.diagram。DiagramViewer " / >

最后,假设小部件现在将由它自己显示,你的代码入口点类看起来像:

/** *为了测试目的,我们假设图表加载为网页中的单个项目。* *入口点类定义onModuleLoad()。*/ public class Main implements EntryPoint {private final DiagramViewer diagram;public Main(){//创建图表。请注意,不同的路径图可以在同一个实例中加载(图使用LRU管理先前加载的图的缓存)diagram = DiagramFactory.createDiagramViewer();} @Override public void onModuleLoad() {Scheduler.get()。scheduleDeferred(new scheduler . schedulecommand () {@Override public void execute() {DiagramFactory. schedulecommand ();CONSOLE_VERBOSE = true;//这是可选的(为开发目的)DiagramFactory。EVENT_BUS_VERBOSE = true;RootLayoutPanel.get().add(diagram);//这将异步运行loadDiagram方法,确保DOM已更新Scheduler.get()。scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { diagram.loadDiagram("R-HSA-111804"); } }); } }); } }

API

中定义了可用的方法DiagramViewer接口的org.reactome.web.diagram.client包中。这些都是:

//订阅这个事件,当用户关闭分析覆盖HandlerRegistration addAnalysisResetHandler(AnalysisResetHandler handler);//如果浏览器不支持canvas,那么订阅这个事件将被通知,因此图表无法显示;//订阅这个事件,当用户在图表中选择一个对象时通知HandlerRegistration addDatabaseObjectSelectedHandler(graphhobjectselectedhandler handler);//订阅这个事件,当用户将鼠标悬停在图中的对象上时,将被通知HandlerRegistration addDatabaseObjectHoveredHandler(graphhobjecthoveredhandler handler);HandlerRegistration addDiagramLoadedHandler(DiagramLoadedHandler handler); //订阅这个事件,当一个新图在视图中显示时通知HandlerRegistration;HandlerRegistration addDiagramObjectsFlaggedHandler(DiagramObjectsFlaggedHandler handler);HandlerRegistration addDiagramObjectsFlagResetHandler(DiagramObjectsFlagResetHandler handler); //订阅这个事件,当图表中标记的元素不再可见时,将被通知。//订阅这个事件,当用户选择“Go to overview”按钮时被通知HandlerRegistration addFireworksOpenedHandler(FireworksOpenedHandler handler);void flagItems(String identifier); //将标识符匹配的图中的元素标记为"identifier";void highlightItem(String stableIdentifier); //用"stableIdentifier"突出图表中的元素 //Highlights the element(s) in the diagram with the "dbIdentifier" void highlightItem(Long dbIdentifier); //Loads the diagram with the "stableIdentifier" void loadDiagram(String stId); //Loads the diagram with the "dbId" void loadDiagram(Long dbId); //Resets the analysis overlay void resetAnalysis(); //Resets the flagged items void resetFlaggedItems(); //Resets the highlighted items void resetHighlight(); //Resets the selected items void resetSelection(); //Selects the element(s) in the diagram with the "stableIdentifier" void selectItem(String stableIdentifier); //Selects the element(s) in the diagram with the "stableIdentifier" void selectItem(Long dbIdentifier); //Sets the analysis overlay for a given "token" and "resource" (this will query the Analysis Service) void setAnalysisToken(String token, String resource); //Set the widget visibility void setVisible(boolean visible);

资源