Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package coolmapplugin.impl; import coolmap.application.CoolMapMaster; import coolmap.application.plugin.CoolMapPlugin; import coolmapplugin.actions.MapSelectedFromCytoscape; import coolmapplugin.actions.MapSelectedToCytoscape; import coolmapplugin.actions.MapSelectedToCytoscapeWithAggregatedValue; import java.awt.MenuItem; import org.json.JSONObject; import net.xeoh.plugins.base.annotations.PluginImplementation; /** * * @author Keqiang Li */ @PluginImplementation public class CMCyCommunicationPlugin implements CoolMapPlugin { @Override public void initialize(JSONObject pluginConfig) { initMenuItems(); } @Override public String getName() { return "CoolMap-Cytoscape-Data-Sync-Plugin"; } private void initMenuItems() { CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); MenuItem item = new MenuItem("Without aggregated values"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape/Map nodes/", item, false, false); item.addActionListener(new MapSelectedToCytoscape()); CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); item = new MenuItem("Find Cytoscape selection in CoolMap"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape", item, false, false); item.addActionListener(new MapSelectedFromCytoscape()); CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); item = new MenuItem("Mean"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape/Map nodes/With aggregated values", item, false, false); item.addActionListener(new MapSelectedToCytoscapeWithAggregatedValue( MapSelectedToCytoscapeWithAggregatedValue.AggregationType.MEAN)); CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); item = new MenuItem("Sum"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape/Map nodes/With aggregated values", item, false, false); item.addActionListener(new MapSelectedToCytoscapeWithAggregatedValue( MapSelectedToCytoscapeWithAggregatedValue.AggregationType.SUM)); CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); item = new MenuItem("Max"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape/Map nodes/With aggregated values", item, false, false); item.addActionListener(new MapSelectedToCytoscapeWithAggregatedValue( MapSelectedToCytoscapeWithAggregatedValue.AggregationType.MAX)); CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); item = new MenuItem("Min"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape/Map nodes/With aggregated values", item, false, false); item.addActionListener(new MapSelectedToCytoscapeWithAggregatedValue( MapSelectedToCytoscapeWithAggregatedValue.AggregationType.MIN)); CoolMapMaster.getCMainFrame().addMenuSeparator("Plugin"); item = new MenuItem("Median"); CoolMapMaster.getCMainFrame().addMenuItem("Plugin/Cytoscape/Map nodes/With aggregated values", item, false, false); item.addActionListener(new MapSelectedToCytoscapeWithAggregatedValue( MapSelectedToCytoscapeWithAggregatedValue.AggregationType.MEDIAN)); } }