Author: kono Date: 2011-08-11 18:21:43 -0700 (Thu, 11 Aug 2011) New Revision: 26535
Added: core3/api/trunk/application-api/ core3/api/trunk/application-api/osgi.bnd core3/api/trunk/application-api/pom.xml core3/api/trunk/application-api/src/ core3/api/trunk/application-api/src/main/ core3/api/trunk/application-api/src/main/java/ core3/api/trunk/application-api/src/main/java/org/ core3/api/trunk/application-api/src/main/java/org/cytoscape/ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeShutdown.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeVersion.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownListener.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartListener.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkListener.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewListener.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineListener.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsListener.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksEvent.java core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksListener.java core3/api/trunk/application-api/src/test/ core3/api/trunk/application-api/src/test/java/ core3/api/trunk/application-api/src/test/java/org/ core3/api/trunk/application-api/src/test/java/org/cytoscape/ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkEventTest.java core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkViewEventTest.java core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentRenderingEngineEventTest.java core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNetworksEventTest.java core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNteworkViewsEventTest.java Log: Application-API had been added. Added: core3/api/trunk/application-api/osgi.bnd =================================================================== --- core3/api/trunk/application-api/osgi.bnd (rev 0) +++ core3/api/trunk/application-api/osgi.bnd 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,5 @@ +#----------------------------------------------------------------- +# Use this file to add customized Bnd instructions for the bundle +#----------------------------------------------------------------- + +Export-Package: org.cytoscape.application, org.cytoscape.application.events \ No newline at end of file Added: core3/api/trunk/application-api/pom.xml =================================================================== --- core3/api/trunk/application-api/pom.xml (rev 0) +++ core3/api/trunk/application-api/pom.xml 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <parent> + <artifactId>api-parent</artifactId> + <groupId>org.cytoscape</groupId> + <version>3.0.0-alpha6-SNAPSHOT</version> + </parent> + + <properties> + <bundle.symbolicName>org.cytoscape.application-api</bundle.symbolicName> + <bundle.namespace>org.cytoscape.application</bundle.namespace> + </properties> + + <modelVersion>4.0.0</modelVersion> + <artifactId>application-api</artifactId> + + <name>${bundle.symbolicName} [${bundle.namespace}]</name> + + <packaging>bundle</packaging> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <!-- | example additional resource entries, useful when building Eclipse + RCP applications --> + <resource> + <directory>.</directory> + <includes> + <include>plugin.xml</include> + <include>plugin.properties</include> + <include>icons/**</include> + </includes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${maven-bundle-plugin.version}</version> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName> + <Bundle-Version>${project.version}</Bundle-Version> + <Export-Package>!${bundle.namespace}.internal.*,${bundle.namespace}.*;version="${project.version}"</Export-Package> + <Private-Package>${bundle.namespace}.internal.*</Private-Package> + <_include>-osgi.bnd</_include> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>${maven-jar-plugin.version}</version> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <repositories> + <!-- bootstrap for cytoscape dependencies, namely the parent POM snapshots --> + <repository> + <id>cytoscape_snapshots</id> + <snapshots> + <enabled>true</enabled> + </snapshots> + <releases> + <enabled>false</enabled> + </releases> + <name>Cytoscape Snapshots</name> + <url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url> + </repository> + <!-- bootstrap for cytoscape dependencies, namely the parent POM releases --> + <repository> + <id>cytoscape_releases</id> + <snapshots> + <enabled>false</enabled> + </snapshots> + <releases> + <enabled>true</enabled> + </releases> + <name>Cytoscape Releases</name> + <url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url> + </repository> + </repositories> + + <dependencies> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>model-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>viewmodel-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>presentation-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,120 @@ +/* + File: CyApplicationManager.java + + Copyright (c) 2006, 2010, The Cytoscape Consortium (www.cytoscape.org) + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and + documentation provided hereunder is on an "as is" basis, and the + Institute for Systems Biology and the Whitehead Institute + have no obligations to provide maintenance, support, + updates, enhancements or modifications. In no event shall the + Institute for Systems Biology and the Whitehead Institute + be liable to any party for direct, indirect, special, + incidental or consequential damages, including lost profits, arising + out of the use of this software and its documentation, even if the + Institute for Systems Biology and the Whitehead Institute + have been advised of the possibility of such damage. See + the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +package org.cytoscape.application; + + +import java.util.List; + +import org.cytoscape.model.CyNetwork; +import org.cytoscape.model.CyTable; +import org.cytoscape.view.model.CyNetworkView; +import org.cytoscape.view.presentation.RenderingEngine; + + +/** + * Basic access to current and/or currently selected networks, + * views and rendering engines in an instance of Cytoscape. + */ +public interface CyApplicationManager { + /** + * Provides access to the current network. + * @return the current network or null if there is no current network + */ + public CyNetwork getCurrentNetwork(); + + /** + * Sets the current network to the one with the provided network SUID. + * @param network_id must be the SUID of a network + */ + public void setCurrentNetwork(final long network_id); + + /** + * Returns the current network view. + * @return the current network view or null if no network + * is currently being visualised + */ + public CyNetworkView getCurrentNetworkView(); + + /** + * Sets the current network view based on the specified id. + * @param view_id The <i>network</i> SUID of the network view to + * be made current. + */ + public void setCurrentNetworkView(final long view_id); + + /** + * Returns the list of selected networks. + * @return The list of selected networks. + */ + public List<CyNetwork> getSelectedNetworks(); + + /** + * Returns the list of selected network views. + * @return The list of selected network views. + */ + public List<CyNetworkView> getSelectedNetworkViews(); + + /** + * Sets the network views associated with the specified network + * ids as selected. + * @param modelIDs The <i>model</i> SUIDs of the networks that have + * been selected. + */ + public void setSelectedNetworkViews(final List<Long> modelIDs); + + /** + * Sets the networks associated with the specified ids as selected. + * @param ids The SUIDs of the networks that have been selected. + */ + public void setSelectedNetworks(final List<Long> ids); + + /** + * Returns the rendering engine associated with the current network view. + * @return The rendering engine associated with the current network view. + */ + public RenderingEngine<CyNetwork> getCurrentRenderingEngine(); + + /** + * Sets the current rendering engine. + * @param engine The rendering engine that should be made current. + */ + public void setCurrentRenderingEngine(final RenderingEngine<CyNetwork> engine); + + /** + * Returns the currently active table. + */ + public CyTable getCurrentTable(); + + /** + * Sets the currently active table. + * @param table The table that should be made current. + */ + public void setCurrentTable(CyTable table); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeShutdown.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeShutdown.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeShutdown.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,52 @@ + +/* + File: CytoscapeShutdown.java + + Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org) + + The Cytoscape Consortium is: + - Institute for Systems Biology + - University of California San Diego + - Memorial Sloan-Kettering Cancer Center + - Institut Pasteur + - Agilent Technologies + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and + documentation provided hereunder is on an "as is" basis, and the + Institute for Systems Biology and the Whitehead Institute + have no obligations to provide maintenance, support, + updates, enhancements or modifications. In no event shall the + Institute for Systems Biology and the Whitehead Institute + be liable to any party for direct, indirect, special, + incidental or consequential damages, including lost profits, arising + out of the use of this software and its documentation, even if the + Institute for Systems Biology and the Whitehead Institute + have been advised of the possibility of such damage. See + the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +package org.cytoscape.application; + +/** + * A service that will shutdown Cytoscape cleanly. Will fire a + * CytoscapeShutdownEvent such that all CytoscapeShutdownListener will be + * notified before actually shutting down. + */ +public interface CytoscapeShutdown { + /** + * Calling this method indicates that the application should shutdown. + * @param retVal The return value with which to (eventually) + * call {@link System#exit} with. + */ + void exit(int retVal); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeVersion.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeVersion.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CytoscapeVersion.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,107 @@ +/* + File: CytoscapeVersion.java + + Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org) + + The Cytoscape Consortium is: + - Institute for Systems Biology + - University of California San Diego + - Memorial Sloan-Kettering Cancer Center + - Institut Pasteur + - Agilent Technologies + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and + documentation provided hereunder is on an "as is" basis, and the + Institute for Systems Biology and the Whitehead Institute + have no obligations to provide maintenance, support, + updates, enhancements or modifications. In no event shall the + Institute for Systems Biology and the Whitehead Institute + be liable to any party for direct, indirect, special, + incidental or consequential damages, including lost profits, arising + out of the use of this software and its documentation, even if the + Institute for Systems Biology and the Whitehead Institute + have been advised of the possibility of such damage. See + the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +package org.cytoscape.application; + +/** + * An interface providing access to version information about this + * version of the Cytoscape application. Cytoscape strives to follow + * the <a href="http://semver.org">Semantic Versioning</a> standard + * to ensure comprehensible backwards compatibility versioning. + */ +public interface CytoscapeVersion { + + /** + * The string used to identify the Property containing the version number. + */ + public static final String VERSION_PROPERTY_NAME = "cytoscape.version.number"; + + /** + * The regular expression used to test the property version string. + */ + public static final String VERSION_REGEX = "^(\\d+)\\.(\\d+)\\.(\\d+)([\\-\\.\\w]*)$"; + + /** + * The full version as a string, for example "3.2.5-alpha". + */ + public String getVersion(); + + /** + * The first of the three numbers defining the version of the + * software, meaning "3" if the version is "3.2.5". This number + * changes only for comprehensive software changes and while APIs + * may be similar between versions, they are not guaranteed to be + * compatible. + * @return The integer describing the major version of this application. + */ + public int getMajorVersion(); + + + /** + * The second of the three numbers defining the version of the + * software, meaning "2" if the version is "3.2.5". This number + * changes as new functionality or a new API is added to the software. + * Minor version APIs are guaranteed to be backwards compatibile for + * all previous versions within the major version (i.e. version 3.2 + * will be completely compatible with all 3.1.x, and 3.0.x code). + * @return The integer describing the minor version of this application. + */ + public int getMinorVersion(); + + + /** + * The third of the three numbers defining the version of the + * software, meaning "5" if the version is "3.2.5". This number + * changes as bug fixes are made but no new features or APIs are + * added. Bug fix versions contain NO NEW FEATRURES! + * Bug fix version APIs are guaranteed to be backwards + * compatibile for all previous versions within the major version + * (i.e. version 3.2.5 will be completely compatible with all 3.x + * versions of the code). + * @return The integer describing the bug fix version of this application. + */ + public int getBugFixVersion(); + + /** + * Any text following the last digit of the bug fix version. If + * the version is 3.0.2-beta1 then the qualifier will be "-beta1". + * Final (stable) versions of the application should not include any + * qualifying information. All qualifying text indicates a pre-release, + * an unstable release, or unfinished release. + * @return Any text following the last digit of the bug fix version. + */ + public String getQualifier(); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,55 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.AbstractCyEvent; + +/** + * An event fired immediately before Cytoscape will be shutdown. This + * event provides methods for listeners processing this event to + * abort the shutdown. This event should only be fired synchronously + * to allow all listeners time to clean up. + */ +public final class CytoscapeShutdownEvent extends AbstractCyEvent<Object> { + + private String reason; + + /** + * Constructor. + * @param source The object firing this event. + */ + public CytoscapeShutdownEvent(final Object source) { + super(source, CytoscapeShutdownListener.class); + reason = null; + } + + /** + * A callback to the firing class that allows a listener to + * abort the shutdown. This can cause conflicts if abused. + * @param why A user comprehensible message describing why the shutdown + * was aborted. + */ + public void abortShutdown(final String why) { + if ( why == null || why.equals("") ) + return; + + reason = why; + } + + /** + * Returns the reason that the application should not be shut down. + * @return The reason that the application should not be shut down. + */ + public String whyNot() { + return reason; + } + + /** + * Returns true if no reason is provided to abort the shutdown and false + * if anyone processing this event wants to prevent shutdown. + * @return true if no reason is provided to abort the shutdown and false + * if anyone processing this event wants to prevent shutdown. + */ + public boolean actuallyShutdown() { + return (reason == null || reason.length() <= 0); + } +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeShutdownListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,16 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +/** + * The listener for the CytoscapeShutdownEvent. + */ +public interface CytoscapeShutdownListener extends CyListener { + + /** + * Process the specified event. + * @param e The event being processed. + */ + public void handleEvent(CytoscapeShutdownEvent e); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,20 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.AbstractCyEvent; + +/** + * An event fired after Cytoscape startup mostly complete (but not necessarily 100 percent). + * This event is fired in the plugin-impl bundle, which depends on many Cytoscape bundles. + * Warning: There is no guarantee that this event is fired after all bundles are start-up. + */ +public final class CytoscapeStartEvent extends AbstractCyEvent<Object> { + + /** + * Constructor. + * @param source The object firing this event. + */ + public CytoscapeStartEvent(final Object source) { + super(source, CytoscapeStartListener.class); + } +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/CytoscapeStartListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,16 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +/** + * The listener for the CytoscapeStartEvent. + */ +public interface CytoscapeStartListener extends CyListener { + + /** + * Process the specified event. + * @param e The event being processed. + */ + public void handleEvent(CytoscapeStartEvent e); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,34 @@ +package org.cytoscape.application.events; + + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.event.AbstractCyEvent; +import org.cytoscape.model.CyNetwork; + + +/** + * An event signaling that the a network has been set to current. + */ +public final class SetCurrentNetworkEvent extends AbstractCyEvent<CyApplicationManager> { + + + private final CyNetwork net; + + /** + * Returns the network associated with this event. The network returned may be null! + * @return the network associated with this event. + */ + public final CyNetwork getNetwork() { + return net; + } + + /** + * Constructor. + * @param source The application manager that is the source of the event. + * @param net The network that has been set to the current network. + */ + public SetCurrentNetworkEvent(final CyApplicationManager source, final CyNetwork net) { + super(source, SetCurrentNetworkListener.class); + this.net = net; + } +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,15 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +/** + * A listener for {@link SetCurrentNetworkEvent}s. + */ +public interface SetCurrentNetworkListener extends CyListener { + /** + * Processes the specified event when fired. + * @param e The event that the listener is listening for. + */ + public void handleEvent(SetCurrentNetworkEvent e); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,35 @@ +package org.cytoscape.application.events; + + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.event.AbstractCyEvent; +import org.cytoscape.view.model.CyNetworkView; + + +/** + * An event indicating that a network view has been set to current. + */ +public final class SetCurrentNetworkViewEvent extends AbstractCyEvent<CyApplicationManager> { + + + private final CyNetworkView view; + + /** + * Returns the network view associated with this event. The view returned may be null! + * @return the network view associated with this event. + */ + final public CyNetworkView getNetworkView() { + return view; + } + + + /** + * Constructor. + * @param source The application manager firing this event. + * @param view The network view that has been set as current. + */ + public SetCurrentNetworkViewEvent(final CyApplicationManager source, final CyNetworkView view) { + super(source, SetCurrentNetworkViewListener.class); + this.view = view; + } +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentNetworkViewListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,15 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +/** + * A listener for {@link SetCurrentNetworkViewEvent}s. + */ +public interface SetCurrentNetworkViewListener extends CyListener { + /** + * Processes the specified event when fired. + * @param e The event that the listener is listening for. + */ + public void handleEvent(SetCurrentNetworkViewEvent e); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,29 @@ +package org.cytoscape.application.events; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.event.AbstractCyEvent; +import org.cytoscape.model.CyNetwork; +import org.cytoscape.view.presentation.RenderingEngine; + +public final class SetCurrentRenderingEngineEvent extends + AbstractCyEvent<CyApplicationManager>{ + + private final RenderingEngine<CyNetwork> engine; + + /** + * Constructor. + * + * @param source + * The application manager firing this event. + * @param engine + * The rendering engine (presentation) that has been set as current. + */ + public SetCurrentRenderingEngineEvent(final CyApplicationManager source, final RenderingEngine<CyNetwork> engine) { + super(source, SetCurrentRenderingEngineListener.class); + this.engine = engine; + } + + public RenderingEngine<CyNetwork> getRenderingEngine() { + return this.engine; + } +} \ No newline at end of file Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetCurrentRenderingEngineListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,13 @@ +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +public interface SetCurrentRenderingEngineListener extends CyListener { + /** + * Processes the specified event when fired. + * + * @param e + * The event that the listener is listening for. + */ + public void handleEvent(final SetCurrentRenderingEngineEvent e); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,34 @@ +package org.cytoscape.application.events; + + +import java.util.List; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.event.AbstractCyEvent; +import org.cytoscape.view.model.CyNetworkView; + + +/** + * An event that indicates that a collection of network views has been selected. + */ +public final class SetSelectedNetworkViewsEvent extends AbstractCyEvent<CyApplicationManager> { + private final List<CyNetworkView> views; + + /** + * Constructor. + * @param source The application manager firing the event. + * @param views A list of CyNetworkViews that have been selected. + */ + public SetSelectedNetworkViewsEvent(final CyApplicationManager source, final List<CyNetworkView> views) { + super(source, SetSelectedNetworkViewsListener.class); + this.views = views; + } + + /** + * Returns the list of network views that have been selected. + * @return The list of network views that have been selected. + */ + public List<CyNetworkView> getNetworkViews() { + return views; + } +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworkViewsListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,15 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +/** + * A listener for {@link SetSelectedNetworkViewsEvent}s. + */ +public interface SetSelectedNetworkViewsListener extends CyListener { + /** + * Processes the specified event when fired. + * @param e The event that the listener is listening for. + */ + public void handleEvent(SetSelectedNetworkViewsEvent e); +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksEvent.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksEvent.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksEvent.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,33 @@ +package org.cytoscape.application.events; + + +import java.util.List; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.event.AbstractCyEvent; +import org.cytoscape.model.CyNetwork; + +/** + * An event indicating the a collection of networks has been selected. + */ +public final class SetSelectedNetworksEvent extends AbstractCyEvent<CyApplicationManager> { + private final List<CyNetwork> networks; + + /** + * Constructor. + * @param source the application manager firing the event. + * @param networks the collection of networks that has been selected. + */ + public SetSelectedNetworksEvent(final CyApplicationManager source, final List<CyNetwork> networks) { + super(source,SetSelectedNetworksListener.class); + this.networks = networks; + } + + /** + * Returns the list of networks selected. + * @return The list of networks selected. + */ + public List<CyNetwork> getNetworks() { + return networks; + } +} Added: core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksListener.java =================================================================== --- core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksListener.java (rev 0) +++ core3/api/trunk/application-api/src/main/java/org/cytoscape/application/events/SetSelectedNetworksListener.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,15 @@ + +package org.cytoscape.application.events; + +import org.cytoscape.event.CyListener; + +/** + * A listener for {@link SetSelectedNetworksEvent}s. + */ +public interface SetSelectedNetworksListener extends CyListener { + /** + * Processes the specified event when fired. + * @param e The event that the listener is listening for. + */ + public void handleEvent(SetSelectedNetworksEvent e); +} Added: core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkEventTest.java =================================================================== --- core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkEventTest.java (rev 0) +++ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkEventTest.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,31 @@ +package org.cytoscape.application.events; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.application.events.SetCurrentNetworkEvent; +import org.cytoscape.model.CyNetwork; +import org.junit.Test; + +public class SetCurrentNetworkEventTest { + + @Test + public void testGoodGetNetwork() { + CyApplicationManager source = mock(CyApplicationManager.class); + CyNetwork n = mock(CyNetwork.class); + SetCurrentNetworkEvent e = new SetCurrentNetworkEvent(source,n); + assertNotNull( e.getNetwork() ); + assertEquals( n,e.getNetwork() ); + } + + @Test + public void testNullGetNetwork() { + CyApplicationManager source = mock(CyApplicationManager.class); + SetCurrentNetworkEvent e = new SetCurrentNetworkEvent(source,null); + assertNull( e.getNetwork() ); + } + +} Added: core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkViewEventTest.java =================================================================== --- core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkViewEventTest.java (rev 0) +++ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentNetworkViewEventTest.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,31 @@ +package org.cytoscape.application.events; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.application.events.SetCurrentNetworkViewEvent; +import org.cytoscape.view.model.CyNetworkView; +import org.junit.Test; + +public class SetCurrentNetworkViewEventTest { + + @Test + public void testGoodGetNetworkView() { + CyApplicationManager source = mock(CyApplicationManager.class); + CyNetworkView n = mock(CyNetworkView.class); + SetCurrentNetworkViewEvent e = new SetCurrentNetworkViewEvent(source,n); + assertNotNull( e.getNetworkView() ); + assertEquals( n,e.getNetworkView() ); + } + + @Test + public void testNullGetNetworkView() { + CyApplicationManager source = mock(CyApplicationManager.class); + SetCurrentNetworkViewEvent e = new SetCurrentNetworkViewEvent(source,null); + assertNull( e.getNetworkView() ); + } + +} Added: core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentRenderingEngineEventTest.java =================================================================== --- core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentRenderingEngineEventTest.java (rev 0) +++ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetCurrentRenderingEngineEventTest.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,40 @@ +package org.cytoscape.application.events; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.application.events.SetCurrentRenderingEngineEvent; +import org.cytoscape.model.CyNetwork; +import org.cytoscape.view.presentation.RenderingEngine; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class SetCurrentRenderingEngineEventTest { + + @Mock + private RenderingEngine<CyNetwork> engine; + @Mock + private CyApplicationManager source; + + @Before + public void initMocks() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGoodGetRenderingEngine() { + final SetCurrentRenderingEngineEvent e = new SetCurrentRenderingEngineEvent(source, engine); + assertNotNull(e.getRenderingEngine()); + assertEquals(engine, e.getRenderingEngine()); + } + + @Test + public void testNullGetRenderingEngine() { + final SetCurrentRenderingEngineEvent e = new SetCurrentRenderingEngineEvent(source, null); + assertNull(e.getRenderingEngine()); + } +} Added: core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNetworksEventTest.java =================================================================== --- core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNetworksEventTest.java (rev 0) +++ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNetworksEventTest.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,40 @@ +package org.cytoscape.application.events; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.application.events.SetSelectedNetworksEvent; +import org.cytoscape.model.CyNetwork; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class SetSelectedNetworksEventTest { + + @Mock + private CyApplicationManager source; + + @Before + public void initMocks() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGoodGetSelectedNetworksEvent() { + final List<CyNetwork> networks = new ArrayList<CyNetwork>(); + final SetSelectedNetworksEvent e = new SetSelectedNetworksEvent(source, networks); + assertNotNull(e.getNetworks()); + assertEquals(networks, e.getNetworks()); + } + + @Test + public void testNullGetSelectedNetworksEvent() { + final SetSelectedNetworksEvent e = new SetSelectedNetworksEvent(source, null); + assertNull(e.getNetworks()); + } + +} Added: core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNteworkViewsEventTest.java =================================================================== --- core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNteworkViewsEventTest.java (rev 0) +++ core3/api/trunk/application-api/src/test/java/org/cytoscape/application/events/SetSelectedNteworkViewsEventTest.java 2011-08-12 01:21:43 UTC (rev 26535) @@ -0,0 +1,41 @@ +package org.cytoscape.application.events; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.cytoscape.application.CyApplicationManager; +import org.cytoscape.application.events.SetSelectedNetworkViewsEvent; +import org.cytoscape.model.CyNetwork; +import org.cytoscape.view.model.CyNetworkView; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class SetSelectedNteworkViewsEventTest { + + @Mock + private CyApplicationManager source; + + @Before + public void initMocks() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGoodGetSelectedNetworkViewsEvent() { + final List<CyNetworkView> views = new ArrayList<CyNetworkView>(); + final SetSelectedNetworkViewsEvent e = new SetSelectedNetworkViewsEvent(source, views); + assertNotNull(e.getNetworkViews()); + assertEquals(views, e.getNetworkViews()); + } + + @Test + public void testNullGetSelectedNetworkViewsEvent() { + final SetSelectedNetworkViewsEvent e = new SetSelectedNetworkViewsEvent(source, null); + assertNull(e.getNetworkViews()); + } + +} -- You received this message because you are subscribed to the Google Groups "cytoscape-cvs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cytoscape-cvs?hl=en.
