Author: scooter
Date: 2010-09-25 16:45:04 -0700 (Sat, 25 Sep 2010)
New Revision: 22061

Modified:
   csplugins/trunk/ucsf/scooter/clusterMaker/build.xml
   csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ClusterMaker.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/ClusterCommandHandler.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterSettingsDialog.java
Log:
Add clustermaker showDialog command and switch to maven-ized ant



Modified: csplugins/trunk/ucsf/scooter/clusterMaker/build.xml
===================================================================
--- csplugins/trunk/ucsf/scooter/clusterMaker/build.xml 2010-09-25 13:24:26 UTC 
(rev 22060)
+++ csplugins/trunk/ucsf/scooter/clusterMaker/build.xml 2010-09-25 23:45:04 UTC 
(rev 22061)
@@ -1,69 +1,258 @@
-<?xml version = "1.0"?>
-<project name = "clusterMaker" default = "jar" basedir = ".">
+
+<project name="MyPlugin" 
+         default="all" 
+         basedir="." 
+         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+  <!-- =================================================================== -->
+  <!-- Project Settings                                                    -->
+  <!--                                                                     -->
+  <!-- Adjust each property listed in this target with the appropriate     -->
+  <!-- information for this project.                                       -->
+  <!-- =================================================================== -->
+  <target name="settings">
+
+    <!-- The name of your plugin and resulting jar file -->
+    <property name="name" value="clusterMaker"/>
+
+    <!-- The package that contains your plugin class. -->
+    <property name="plugin.class.package" value="clusterMaker"/>
+
+    <!-- The name of your plugin class, i.e. the one that extends Cytoscape 
plugin. -->
+    <property name="plugin.class.name" 
value="${plugin.class.package}.ClusterMaker"/>
+
+    <!-- The version of your plugin. To support plugin.props, make sure the 
+         version is expressed in decimal notation, e.g. 3.0, 3.1, 3.14, etc. 
-->
+    <property name="version" value="1.7"/>
+
+    <!-- The version of Cytoscape that you depend on. -->
+    <property name="cytoscape.version" value="2.8.0-beta2-SNAPSHOT"/>
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Project initialization settings                                     -->
+  <!-- Most developers shouldn't *need* to adjust any settings here.       -->
+  <!-- =================================================================== -->
+  <target name="init"
+          depends="settings" >
+    <tstamp/>
+    <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="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="lib.dir" value="${root.dir}/lib"/>
+    <property name="javadoc.dir" value="${build.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}-${version}.jar"/>
+    <property name="test.jar" value="${name}-${version}-tests.jar"/>
+
+    <!-- Define external dependencies -->
+    <artifact:remoteRepository 
+       id="cytoscape_releases" 
+       
url="http://cytoscape.wodaklab.org/nexus/content/repositories/releases/"; />
+    <artifact:remoteRepository 
+       id="cytoscape_snapshots" 
+       
url="http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/"; />
+    <artifact:dependencies pathId="dependency.classpath">
+      <dependency groupId="cytoscape" 
+                  artifactId="application" 
+                  version="${cytoscape.version}"/>
+      <dependency groupId="junit" 
+                  artifactId="junit" 
+                  version="3.8.1"/>
+    </artifact:dependencies>
+
+    <!-- Define the class path -->
+    <path id="project.class.path">
+      <fileset dir="${lib.dir}">
+        <include name="*.jar"/>
+      </fileset>
+      <path refid="dependency.classpath"/>
+    </path>
    
-   <property name = "src" location = "src"/>
-   <property name = "build" location = "build"/>
-   <property name = "build.compiler" value = "modern"/>
-   <!-- path to Cytoscape under development (CVS) -->
-   <property name = "lib" location = "../../../../cytoscape"/>
-   <property name = "jar"  location = "jar"/>
-   <property name = "doc" location = "doc"/>
+    <!-- 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="${lib.dir}">
+        <include name="*.jar"/>
+      </fileset>
+      <path refid="dependency.classpath"/>
+    </path>
 
-   <property name="cytoscape.plugin" value="${lib}/plugins"/>
+    <!-- Make sure tests is in the right place -->
+    <condition property="tests.ok">
+      <and>
+        <available file="${tests.dir}" />
+      </and>
+    </condition>
 
-   <path id = "classpath">
-       <fileset dir = "${lib}">
-          <include name = "**/*.jar"/>
-       </fileset>
-   </path>
+  </target>
 
-   <target name="prepare">
-      <mkdir dir="${build}"/>
-   </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>
 
-   <target name="compile" depends = "prepare" description="Compile with 
Cytoscape under development">
-   <!-- Compile the java code from ${src} into ${build} -->
-   <javac source = "1.5" debug="true" deprecation="true" srcdir = "${src}" 
destdir="${build}" encoding="ISO-8859-1">
-      <classpath refid = "classpath"/>
-   </javac>
-   </target>
 
-   <target name="clean" description="clean up" >
-      <!-- Delete the ${build} and ${src} directory trees -->
-      <delete dir="${build}"/>
-      <delete dir="${jar}"/>
-   </target>
+  <!-- =================================================================== -->
+  <!-- Creates the project jar file                                        -->
+  <!-- =================================================================== -->
+  <target name="jar" 
+          depends="compile" >
+    <filter token="version" value="${version}"/>
+    <copy file="${resources.dir}/plugin.props" 
+          todir="${build.dir}/${plugin.class.package}"
+          filtering="true"
+          overwrite="true"/>
+    <unjar dest="${build.dir}">
+      <fileset dir="${lib.dir}">
+        <include name="*.jar" />
+      </fileset>
+    </unjar>
 
-   <target name="jar" depends="compile" description="makes a jar for Cytoscape 
under development">
-   <mkdir dir = "${jar}"/>
-   <copy todir="build/clusterMaker" file="resources/plugin.props"/>
-   <jar jarfile="${jar}/clusterMaker.jar">
+    <jar destfile="${project.jar}" >
+      <fileset dir="${build.dir}" includes="**"/>
       <manifest>
-          <attribute name="Cytoscape-Plugin" value="clusterMaker.ClusterMaker" 
/>
+        <attribute name="Cytoscape-Plugin" value="${plugin.class.name}"/>
       </manifest>
-      <fileset dir="${build}"/>
-   </jar>
-   </target>
+    </jar>
+    <echo message="Successfully ran jar task!"/>
+  </target>
 
-   <target name = "run" depends="jar" description = "Run under development">
-      <java classname = "cytoscape.CyMain" classpathref = "classpath"
-          fork = "true" maxmemory = "1g">
-         <arg line = "--JLD"/>
-         <arg line = "${jar}/clusterMaker.jar"/>
-         <arg line = "-vt"/>
-         <arg line = "5000"/>
-      </java>
-    </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}"
+           source="1.5"
+           target="1.5"
+           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>
 
-   <!-- Target to Run JavaDoc -->
-    <target name="doc" description="Runs JavaDoc.">
-        <javadoc packagenames="clusterMaker.*" sourcepath="src" source="1.5" 
destdir="doc"
-                        classpathref="classpath_release" >
-        <link href = "http://java.sun.com/j2se/1.5.0/docs/api/"/>
-        <link href = "http://csbi.sourceforge.net/API/"/>
-               <link href = "http://chianti.ucsd.edu/Cyto-2_6_0/javadoc/"; />
-       </javadoc>
-    </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,test,docs" /> 
+
+  <!-- =================================================================== -->
+  <!-- Clean up, get back to original state                                -->
+  <!-- =================================================================== -->
+  <target name="clean" 
+          depends="init">
+    <delete dir="${build.dir}"/>
+    <delete file="${project.jar}"/>
+    <delete file="${test.jar}"/>
+    <echo message="Successfully ran clean task!"/>
+  </target>
+
 </project>
+

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ClusterMaker.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ClusterMaker.java    
    2010-09-25 13:24:26 UTC (rev 22060)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ClusterMaker.java    
    2010-09-25 23:45:04 UTC (rev 22061)
@@ -229,7 +229,7 @@
                                // Create the dialog
                                ClusterSettingsDialog settingsDialog = new 
ClusterSettingsDialog(alg);
                                // Pop it up
-                               settingsDialog.actionPerformed(e);
+                               settingsDialog.showDialog();
                        } else if (viz != null) {
                                viz.startViz();
                        }

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/ClusterCommandHandler.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/ClusterCommandHandler.java
      2010-09-25 13:24:26 UTC (rev 22060)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/ClusterCommandHandler.java
      2010-09-25 23:45:04 UTC (rev 22061)
@@ -54,6 +54,7 @@
 
 // clusterMaker imports
 import clusterMaker.ClusterMaker;
+import clusterMaker.ui.ClusterSettingsDialog;
 import clusterMaker.ui.ClusterTask;
 import clusterMaker.algorithms.AbstractNetworkClusterer;
 import clusterMaker.algorithms.ClusterAlgorithm;
@@ -63,7 +64,8 @@
        HASCLUSTER("hasCluster", "Test to see if this network has a cluster of 
the requested type", "type"),
        GETNETCLUSTER("getNetworkCluster", "Get a cluster of the requested type 
and the requested clustertype (node or attribute)",
              "type"),
-       GETEISENCLUSTER("getCluster", "Get a cluster of the requested 
clustertype (node or attribute)", "type=hierarchical|clustertype=node");
+       GETEISENCLUSTER("getCluster", "Get a cluster of the requested 
clustertype (node or attribute)", "type=hierarchical|clustertype=node"),
+       SHOWDIALOG("showDialog", "Show the clusterMaker dialog","type");
 
        private String command = null;
        private String argList = null;
@@ -142,6 +144,13 @@
                                throw new RuntimeException("clustertype must be 
'node' or 'attribute'");
                        }
 
+               } else if (BuiltIn.SHOWDIALOG.equals(command)) {
+                       // Get the algorithm
+                       ClusterAlgorithm alg = getAlgorithm(args, command);
+                       // Show it
+                       ClusterSettingsDialog settingsDialog = new 
ClusterSettingsDialog(alg);
+                       settingsDialog.showDialog();
+                       result.addMessage("done");
                } else if (algMap.containsKey(command)) {
                        // Get the algorithm
                        ClusterAlgorithm alg = algMap.get(command);

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterSettingsDialog.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterSettingsDialog.java
    2010-09-25 13:24:26 UTC (rev 22060)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterSettingsDialog.java
    2010-09-25 23:45:04 UTC (rev 22061)
@@ -107,6 +107,13 @@
                setResizable(false);
        }
 
+       public void showDialog() {
+               initialize();
+               pack();
+               setLocationRelativeTo(Cytoscape.getDesktop());
+               setVisible(true);
+       }
+
        /**
         *  DOCUMENT ME!
         *

-- 
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.

Reply via email to