Author: mes
Date: 2012-05-16 16:03:26 -0700 (Wed, 16 May 2012)
New Revision: 29280

Added:
   core3/samples/trunk/sample28/
   core3/samples/trunk/sample28/app/
   core3/samples/trunk/sample28/app/pom.xml
   core3/samples/trunk/sample28/app/src/
   core3/samples/trunk/sample28/app/src/main/
   core3/samples/trunk/sample28/app/src/main/java/
   core3/samples/trunk/sample28/app/src/main/java/org/
   core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/
   core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/
   core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/
   
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/CyActivator.java
   
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/MyCytoPanel.java
   
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/Sample28.java
   core3/samples/trunk/sample28/feature/
   core3/samples/trunk/sample28/feature/pom.xml
   core3/samples/trunk/sample28/pom.xml
Modified:
   core3/samples/trunk/pom.xml
Log:
added sample28, which creates a kar (karaf archive) file that demonstrates a 
bundle plugin with third party libraries

Modified: core3/samples/trunk/pom.xml
===================================================================
--- core3/samples/trunk/pom.xml 2012-05-16 23:01:51 UTC (rev 29279)
+++ core3/samples/trunk/pom.xml 2012-05-16 23:03:26 UTC (rev 29280)
@@ -47,5 +47,6 @@
        <module>sample23</module>
        <module>sample25</module>
        <module>sample27a</module>
+       <module>sample28</module>
   </modules>
 </project> 

Added: core3/samples/trunk/sample28/app/pom.xml
===================================================================
--- core3/samples/trunk/sample28/app/pom.xml                            (rev 0)
+++ core3/samples/trunk/sample28/app/pom.xml    2012-05-16 23:03:26 UTC (rev 
29280)
@@ -0,0 +1,36 @@
+<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/xsd/maven-4.0.0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+               <artifactId>sample28-parent</artifactId>
+        <groupId>org.cytoscape</groupId>
+        <version>3.0.0-alpha9-SNAPSHOT</version>
+    </parent>
+
+
+       <groupId>org.cytoscape</groupId>
+       <artifactId>sample28-app</artifactId>
+       <packaging>bundle</packaging>
+       <name>Cytoscape Sample 28 App (${artifactId})</name>
+
+       <build>
+               <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}.*</Export-Package>
+                                               
<Private-Package>${bundle.namespace}.*</Private-Package>
+                                               
<Bundle-Activator>${bundle.namespace}.CyActivator</Bundle-Activator>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+</project>

Added: 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/CyActivator.java
===================================================================
--- 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/CyActivator.java
                               (rev 0)
+++ 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/CyActivator.java
       2012-05-16 23:03:26 UTC (rev 29280)
@@ -0,0 +1,38 @@
+package org.cytoscape.sample.internal;
+
+import org.cytoscape.application.swing.CySwingApplication;
+
+import org.cytoscape.sample.internal.MyCytoPanel;
+import org.cytoscape.sample.internal.Sample28;
+
+import org.cytoscape.application.swing.CytoPanelComponent;
+import org.cytoscape.application.swing.CyAction;
+
+import org.osgi.framework.BundleContext;
+
+import org.cytoscape.service.util.AbstractCyActivator;
+
+import java.util.Properties;
+
+
+public class CyActivator extends AbstractCyActivator {
+       public CyActivator() {
+               super();
+       }
+
+
+       public void start(BundleContext bc) {
+
+               CySwingApplication cytoscapeDesktopService = 
getService(bc,CySwingApplication.class);
+               
+               MyCytoPanel myCytoPanel = new MyCytoPanel("Chart Test","This is 
my Chart");
+               Sample28 sample28Action = new 
Sample28(cytoscapeDesktopService,myCytoPanel);
+               
+               registerService(bc,myCytoPanel,CytoPanelComponent.class, new 
Properties());
+               registerService(bc,sample28Action,CyAction.class, new 
Properties());
+
+               
+
+       }
+}
+

Added: 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/MyCytoPanel.java
===================================================================
--- 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/MyCytoPanel.java
                               (rev 0)
+++ 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/MyCytoPanel.java
       2012-05-16 23:03:26 UTC (rev 29280)
@@ -0,0 +1,95 @@
+package org.cytoscape.sample.internal;
+
+import java.awt.Component;
+
+import javax.swing.Icon;
+import javax.swing.JPanel;
+import org.cytoscape.application.swing.CytoPanelComponent;
+import org.cytoscape.application.swing.CytoPanelName;
+import javax.swing.JLabel;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.ChartPanel;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PiePlot3D;
+import org.jfree.data.general.DefaultPieDataset;
+import org.jfree.data.general.PieDataset;
+import org.jfree.util.Rotation;
+
+public class MyCytoPanel extends JPanel implements CytoPanelComponent {
+       
+       private static final long serialVersionUID = 8292806967891823933L;
+
+
+       public MyCytoPanel(String applicationTitle, String chartTitle) {
+        super();
+        // This will create the dataset 
+        PieDataset dataset = createDataset();
+        // based on the dataset we create the chart
+        JFreeChart chart = createChart(dataset, chartTitle);
+        // we put the chart into a panel
+        ChartPanel chartPanel = new ChartPanel(chart);
+        // default size
+        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
+        // add it to our application
+        add(chartPanel);
+
+               this.setVisible(true);
+       }
+
+
+       public Component getComponent() {
+               return this;
+       }
+
+
+       public CytoPanelName getCytoPanelName() {
+               return CytoPanelName.WEST;
+       }
+
+
+       public String getTitle() {
+               return "MyPanel";
+       }
+
+
+       public Icon getIcon() {
+               return null;
+       }
+
+
+/**
+     * Creates a sample dataset 
+     */
+
+    private  PieDataset createDataset() {
+        DefaultPieDataset result = new DefaultPieDataset();
+        result.setValue("Linux", 29);
+        result.setValue("Mac", 20);
+        result.setValue("Windows", 51);
+        return result;
+        
+    }
+    
+    
+/**
+     * Creates a chart
+     */
+
+    private JFreeChart createChart(PieDataset dataset, String title) {
+        
+        JFreeChart chart = ChartFactory.createPieChart3D(
+            title,                             // chart title
+            dataset,                // data
+            true,                   // include legend
+            true,
+            false
+        );
+
+        PiePlot3D plot = (PiePlot3D) chart.getPlot();
+        plot.setStartAngle(290);
+        plot.setDirection(Rotation.CLOCKWISE);
+        plot.setForegroundAlpha(0.5f);
+        return chart;
+        
+    }
+}

Added: 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/Sample28.java
===================================================================
--- 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/Sample28.java
                          (rev 0)
+++ 
core3/samples/trunk/sample28/app/src/main/java/org/cytoscape/sample/internal/Sample28.java
  2012-05-16 23:03:26 UTC (rev 29280)
@@ -0,0 +1,50 @@
+package org.cytoscape.sample.internal;
+
+import java.awt.event.ActionEvent;
+
+import org.cytoscape.application.swing.AbstractCyAction;
+import org.cytoscape.application.swing.CySwingApplication;
+import org.cytoscape.application.swing.CytoPanel;
+import org.cytoscape.application.swing.CytoPanelName;
+import org.cytoscape.application.swing.CytoPanelState;
+
+
+public class Sample28 extends AbstractCyAction {
+
+       private CySwingApplication desktopApp;
+       private final CytoPanel cytoPanelWest;
+       private MyCytoPanel myCytoPanel;
+       
+       public Sample28(CySwingApplication desktopApp,
+                       MyCytoPanel myCytoPanel){
+               // Add a menu item -- Apps->sample28
+               super("sample28");
+               setPreferredMenu("Apps");
+
+               this.desktopApp = desktopApp;
+               
+               //Note: myCytoPanel is bean we defined and registered as a 
service
+               this.cytoPanelWest = 
this.desktopApp.getCytoPanel(CytoPanelName.WEST);
+               this.myCytoPanel = myCytoPanel;
+       }
+       
+       /**
+        *  DOCUMENT ME!
+        *
+        * @param e DOCUMENT ME!
+        */
+       public void actionPerformed(ActionEvent e) {
+               // If the state of the cytoPanelWest is HIDE, show it
+               if (cytoPanelWest.getState() == CytoPanelState.HIDE) {
+                       cytoPanelWest.setState(CytoPanelState.DOCK);
+               }       
+
+               // Select my panel
+               int index = cytoPanelWest.indexOfComponent(myCytoPanel);
+               if (index == -1) {
+                       return;
+               }
+               cytoPanelWest.setSelectedIndex(index);
+       }
+
+}

Added: core3/samples/trunk/sample28/feature/pom.xml
===================================================================
--- core3/samples/trunk/sample28/feature/pom.xml                                
(rev 0)
+++ core3/samples/trunk/sample28/feature/pom.xml        2012-05-16 23:03:26 UTC 
(rev 29280)
@@ -0,0 +1,54 @@
+<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/xsd/maven-4.0.0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+               <artifactId>sample28-parent</artifactId>
+        <groupId>org.cytoscape</groupId>
+        <version>3.0.0-alpha9-SNAPSHOT</version>
+    </parent>
+
+       <groupId>org.cytoscape</groupId>
+       <artifactId>sample28-feature</artifactId>
+       <packaging>jar</packaging>
+       <name>Cytoscape Sample 28 Feature (${artifactId})</name>
+
+       <build>
+         <plugins>
+        <plugin>
+          <groupId>org.apache.karaf.tooling</groupId>
+          <artifactId>karaf-maven-plugin</artifactId>
+          <version>3.0.0-SNAPSHOT</version>
+            <executions>
+              <execution>
+                <id>generate</id>
+                <goals>
+                  <goal>features-generate-descriptor</goal>
+                </goals>
+                <configuration>
+                  <outputFile>target/features.xml</outputFile>
+                </configuration>
+              </execution>
+              <execution>
+                <id>create-kar</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>features-create-kar</goal>
+                </goals>
+                <configuration>
+                  <featuresFile>target/features.xml</featuresFile>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+               </plugins>
+       </build>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>sample28-app</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+       </dependencies>
+  
+</project>

Added: core3/samples/trunk/sample28/pom.xml
===================================================================
--- core3/samples/trunk/sample28/pom.xml                                (rev 0)
+++ core3/samples/trunk/sample28/pom.xml        2012-05-16 23:03:26 UTC (rev 
29280)
@@ -0,0 +1,116 @@
+<?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";>
+
+       <modelVersion>4.0.0</modelVersion>
+
+       <groupId>org.cytoscape</groupId>
+       <artifactId>sample28-parent</artifactId>
+       <version>3.0.0-alpha9-SNAPSHOT</version>
+       <name>Cytoscape Sample 28 Parent POM</name>
+       <packaging>pom</packaging>
+
+       <properties>
+               <bundle.symbolicName>sample28</bundle.symbolicName>
+               
<bundle.namespace>org.cytoscape.sample.internal</bundle.namespace>
+               
<cytoscape.api.version>3.0.0-beta2-SNAPSHOT</cytoscape.api.version>
+               <maven-bundle-plugin.version>2.3.4</maven-bundle-plugin.version>
+               <osgi.api.version>4.2.0</osgi.api.version>
+       </properties>
+
+       <modules>
+               <module>app</module>
+               <module>feature</module>
+       </modules>
+
+               <dependencies>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>swing-application-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+            <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>work-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+            <scope>provided</scope>
+               </dependency>
+               <dependency>
+                   <groupId>org.jfree.chart</groupId>
+                   <artifactId>com.springsource.org.jfree.chart</artifactId>
+                   <version>1.0.9</version>
+               </dependency>
+               <dependency>
+                   <groupId>org.jfree</groupId>
+                   <artifactId>com.springsource.org.jfree</artifactId>
+                   <version>1.0.12</version>
+               </dependency>
+               <dependency>
+                   <groupId>javax.servlet</groupId>
+                   <artifactId>com.springsource.javax.servlet</artifactId>
+                   <version>2.5.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>service-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+            <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>${osgi.api.version}</version>
+            <scope>provided</scope>
+               </dependency>
+               </dependencies>
+
+       <pluginRepositories>
+           <pluginRepository>
+                       <id>apache_snapshots</id>
+                       <snapshots>
+                               <enabled>true</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Apache Snapshots</name>
+                       
<url>https://repository.apache.org/content/groups/snapshots/</url>
+           </pluginRepository>
+       </pluginRepositories>
+       <!-- Links to the Cytoscape Maven repositories. -->
+       <repositories>
+               <repository>
+                       <id>cytoscape_snapshots</id>
+                       <snapshots>
+                               <enabled>true</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Cytoscape Snapshots</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/snapshots/</url>
+               </repository>
+               <repository>
+                       <id>cytoscape_releases</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>true</enabled>
+                       </releases>
+                       <name>Cytoscape Releases</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/releases/</url>
+               </repository>
+               <repository>
+                   <id>com.springsource.repository.bundles.release</id>
+                   <name>SpringSource Enterprise Bundle Repository - 
SpringSource Bundle Releases</name>
+                   
<url>http://repository.springsource.com/maven/bundles/release</url>
+               </repository>
+
+               <repository>
+                   <id>com.springsource.repository.bundles.external</id>
+                   <name>SpringSource Enterprise Bundle Repository - External 
Bundle Releases</name>
+                   
<url>http://repository.springsource.com/maven/bundles/external</url>
+               </repository>
+       </repositories>
+</project>

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