Author: mes
Date: 2010-02-04 12:24:12 -0800 (Thu, 04 Feb 2010)
New Revision: 19181
Added:
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/build.xml
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/resources/
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/resources/plugin.props
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemo.java
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemoAction.java
Log:
added custom graphic demo for testing purposes
Added: csplugins/trunk/ucsd/mes/CustomGraphicsDemo/build.xml
===================================================================
--- csplugins/trunk/ucsd/mes/CustomGraphicsDemo/build.xml
(rev 0)
+++ csplugins/trunk/ucsd/mes/CustomGraphicsDemo/build.xml 2010-02-04
20:24:12 UTC (rev 19181)
@@ -0,0 +1,214 @@
+
+<project name="CustomGraphicsDemo" default="all" basedir=".">
+
+ <!-- =================================================================== -->
+ <!-- Initialization target -->
+ <!-- =================================================================== -->
+ <target name="init">
+ <tstamp/>
+ <property name="name" value="CustomGraphicsDemo"/>
+ <property name="version" value="1.0.1"/>
+
+ <echo message="Building ${name} version ${version} ..."/>
+
+ <!-- Inheritable properties -->
+ <property name="debug" value="on"/>
+ <property name="optimize" value="off"/>
+ <property name="deprecation" value="on"/>
+ <property name="fork" value="false"/>
+
+ <!-- Define the directories -->
+ <property name="root.dir" value="."/>
+ <property name="cytoscape.dir" value="${root.dir}/../../../../cytoscape"/>
+ <property name="cytoscape.lib.dir" value="${cytoscape.dir}/lib"/>
+ <property name="resources.dir" value="${root.dir}/resources"/>
+ <property name="src.dir" value="${root.dir}/src"/>
+ <property name="tests.dir" value="${root.dir}/tests"/>
+ <property name="build.dir" value="${root.dir}/build"/>
+ <property name="javadoc.dir" value="${root.dir}/API"/>
+ <property name="log.dir" value="${build.dir}/logs" />
+ <property name="junit.report.dir" value="${log.dir}/junit-reports" />
+
+ <!-- Define the relevant files -->
+ <property name="project.jar" value="${name}.jar"/>
+ <property name="test.jar" value="${name}-tests.jar"/>
+
+ <!-- Define the class path -->
+ <path id="project.class.path">
+ <fileset dir="${cytoscape.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${cytoscape.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <!-- Define the junit class path - It needs to find what we just built -->
+ <path id="junit.class.path" >
+ <fileset dir="${root.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${cytoscape.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${cytoscape.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <!-- Make sure tests is in the right place -->
+ <condition property="tests.ok">
+ <and>
+ <available file="${tests.dir}" />
+ </and>
+ </condition>
+
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the project -->
+ <!-- =================================================================== -->
+ <target name="compile"
+ depends="init" >
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${log.dir}"/>
+ <javac srcdir="${src.dir}"
+ classpathref="project.class.path"
+ destdir="${build.dir}"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ fork="${fork}">
+<!--
+ <compilerarg line="-Xlint:all -Xlint:-path"/>
+-->
+ </javac>
+ <echo message="Successfully ran compile task!"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- Creates the project jar file -->
+ <!-- =================================================================== -->
+ <target name="jar"
+ depends="compile" >
+ <copy file="${resources.dir}/plugin.props"
todir="${build.dir}/example"/>
+ <jar destfile="${project.jar}" >
+ <fileset dir="${build.dir}"
+ includes="**"/>
+ <manifest>
+ <attribute name="Cytoscape-Plugin"
+ value="example.CustomGraphicsDemo"/>
+ </manifest>
+ </jar>
+ <echo message="Successfully ran jar task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the tests -->
+ <!-- Note that this compilation occurs AFTER the distribution jar has -->
+ <!-- been created, so that the tests aren't distributed. -->
+ <!-- =================================================================== -->
+ <target name="compile-tests"
+ depends="jar"
+ if="tests.ok">
+ <javac srcdir="${tests.dir}"
+ classpathref="project.class.path"
+ destdir="${build.dir}"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ fork="${fork}">
+ <compilerarg line="-Xlint:all -Xlint:-path"/>
+ </javac>
+ <echo message="Successfully ran compile-tests task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Creates the project-tests.jar file -->
+ <!-- =================================================================== -->
+ <target name="jar-tests"
+ depends="compile-tests"
+ if="tests.ok">
+ <jar jarfile="${test.jar}"
+ basedir="${build.dir}" >
+ </jar>
+ <echo message="Successfully ran jar-tests task!"/>
+ </target>
+
+
+
+ <!-- =================================================================== -->
+ <!-- Runs the unit tests. -->
+ <!-- =================================================================== -->
+ <target name="test"
+ depends="jar-tests"
+ if="tests.ok">
+ <junit printsummary="yes"
+ haltonfailure="no"
+ maxmemory="256m" >
+ <classpath refid="junit.class.path"/>
+ <formatter type="plain"
+ usefile="true" />
+ <formatter type="xml"
+ usefile="true" />
+ <batchtest fork="yes"
+ todir="${log.dir}"
+ failureProperty="junit.test.failure"
+ errorProperty="junit.test.failure">
+ <fileset dir="${tests.dir}"
+ includes="**/*Test.java"
+ excludes="**/AllTests.java" />
+ </batchtest>
+ </junit>
+ <mkdir dir="${junit.report.dir}"/>
+ <junitreport todir="${junit.report.dir}">
+ <fileset dir="${log.dir}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${junit.report.dir}"/>
+ </junitreport>
+ <fail message="TEST FAILURE!!! Details: ${junit.report.dir}/index.html"
+ if="junit.test.failure"/>
+ <echo message="Successfully ran test task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Creates the API documentation -->
+ <!-- =================================================================== -->
+ <target name="docs"
+ depends="init" >
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc sourcepath="${src.dir}"
+ destdir="${javadoc.dir}"
+ packagenames="*"
+ classpathref="project.class.path"
+ author="true"
+ version="true"
+ use="true"
+ splitindex="true"
+ noindex="false"
+ windowtitle="${name} API"
+ doctitle="${name}" />
+ <echo message="Successfully ran docs task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Do everything -->
+ <!-- =================================================================== -->
+ <target name="all" depends="jar,docs,test" />
+
+ <!-- =================================================================== -->
+ <!-- Clean up, get back to original state -->
+ <!-- =================================================================== -->
+ <target name="clean"
+ depends="init">
+ <delete dir="${build.dir}"/>
+ <delete dir="${javadoc.dir}"/>
+ <delete file="${project.jar}"/>
+ <delete file="${test.jar}"/>
+ <echo message="Successfully ran clean task!"/>
+ </target>
+
+</project>
+
Added: csplugins/trunk/ucsd/mes/CustomGraphicsDemo/resources/plugin.props
===================================================================
--- csplugins/trunk/ucsd/mes/CustomGraphicsDemo/resources/plugin.props
(rev 0)
+++ csplugins/trunk/ucsd/mes/CustomGraphicsDemo/resources/plugin.props
2010-02-04 20:24:12 UTC (rev 19181)
@@ -0,0 +1,30 @@
+# This props file would be filled out and included in the plugin jar file.
This props file will be used
+# to put information into the Plugin Manager about the plugin
+
+# -- The following properties are REQUIRED -- #
+
+# The plugin name that will be displayed to users
+pluginName=Example Custom Graphics
+
+# Description used to give users information about the plugin such as what it
does.
+# Html tags are encouraged for formatting purposes.
+pluginDescription=Example code that applies a vizmap.
+
+# Plugin version number, this must be two numbers separated by a decimlal.
Ex. 0.2, 14.03
+pluginVersion=0.1
+
+# Compatible Cytoscape version
+cytoscapeVersion=2.5,2.6,2.7
+
+# Category, use one of the categories listed on the website or create your own
+pluginCategory=Core
+
+
+# List of authors. Note each author and institution pair are separated by a :
(colon)
+# each additional author institution pair must be separated from other pairs
bye a ; (semicolon)
+pluginAuthorsIntsitutions=Mike Smoot:UC San Diego
+
+# -- The following properties should be set ONLY BY CORE PLUGINS -- #
+downloadURL=http://cytoscape.org/plugins/plugins.xml
+uniqueID=1123453341
+
Added:
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemo.java
===================================================================
---
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemo.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemo.java
2010-02-04 20:24:12 UTC (rev 19181)
@@ -0,0 +1,49 @@
+
+/*
+ Copyright (c) 2006, 2007, 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 example;
+
+import cytoscape.Cytoscape;
+import cytoscape.plugin.CytoscapePlugin;
+import cytoscape.view.CytoscapeDesktop;
+import cytoscape.view.CyMenus;
+
+public class CustomGraphicsDemo extends CytoscapePlugin {
+
+ public CustomGraphicsDemo() {
+ Cytoscape.getDesktop().getCyMenus().addAction( new
CustomGraphicsDemoAction() );
+ }
+}
Added:
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemoAction.java
===================================================================
---
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemoAction.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/CustomGraphicsDemo/src/example/CustomGraphicsDemoAction.java
2010-02-04 20:24:12 UTC (rev 19181)
@@ -0,0 +1,79 @@
+
+/*
+ Copyright (c) 2006, 2007, 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 example;
+
+import cytoscape.util.CytoscapeAction;
+import java.awt.event.ActionEvent;
+import java.awt.geom.Rectangle2D;
+import java.awt.Paint;
+import java.awt.Color;
+import java.awt.TexturePaint;
+import javax.imageio.ImageIO;
+import java.net.URL;
+import java.util.Iterator;
+
+import ding.view.DNodeView;
+import cytoscape.Cytoscape;
+import cytoscape.view.CyNetworkView;
+import cytoscape.render.stateful.NodeDetails;
+
+public class CustomGraphicsDemoAction extends CytoscapeAction {
+
+ public CustomGraphicsDemoAction() {
+ super("Custom Graphics Demo");
+ setPreferredMenu("Plugins");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Rectangle2D rect = new Rectangle2D.Double(-11.0, -15.0, 22.0,
30.0);
+ Paint paint = null;
+ try {
+ paint = new TexturePaint(
+ ImageIO.read(new
URL("http://cytoscape.org/people_photos/mike.jpg")), rect);
+ } catch (Exception exc) {
+ paint = Color.black;
+ }
+
+ CyNetworkView view = Cytoscape.getCurrentNetworkView();
+ Iterator it = view.getNodeViewsIterator();
+ while (it.hasNext()) {
+ DNodeView dnv = (DNodeView) it.next();
+ dnv.addCustomGraphic(rect, paint,
NodeDetails.ANCHOR_WEST);
+ }
+ view.redrawGraph(true,false);
+ }
+}
--
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.