Revision: 4211
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 7, 2007 08:02 by cfrias
Initial Code
// no jfreechart imports required (we'll find them programmatically) import groovy.swing.SwingBuilder import static javax.swing.WindowConstants.EXIT_ON_CLOSE class MavenDependencyTest extends GroovyTestCase { void testSomething() { def classLoader = Thread.currentThread().contextClassLoader // load jars and add to classpath def maven = MavenDependency.using(classLoader) maven.require(groupId:'jfree', artifactId:'jfreechart', version:'1.0.5') maven.require(groupId:'jfree', artifactId:'jcommon', version:'1.0.9') // define used classes/instances programmatically def factoryClass = classLoader.loadClass('org.jfree.chart.ChartFactory') def orientationClass = classLoader.loadClass('org.jfree.chart.plot.PlotOrientation') def dataset = classLoader.loadClass('org.jfree.data.category.DefaultCategoryDataset').newInstance() // normal code below here dataset.addValue 150, "no.1", "Jan" dataset.addValue 210, "no.1", "Feb" dataset.addValue 390, "no.1", "Mar" dataset.addValue 300, "no.2", "Jan" dataset.addValue 400, "no.2", "Feb" dataset.addValue 200, "no.2", "Mar" def labels = ["Bugs", "Month", "Count"] def options = [true, true, true] def chart = factoryClass.createLineChart(*labels, dataset, orientationClass.VERTICAL, *options) def swing = new SwingBuilder() def frame = swing.frame(title:'Groovy LineChart', defaultCloseOperation:EXIT_ON_CLOSE) { panel(id:'canvas') { rigidArea(width:400, height:400) } } frame.pack() frame.show() chart.draw(swing.canvas.graphics, swing.canvas.bounds) } }
Initial URL
Initial Description
Initial Title
Maven 2 Ant Task - MavenDependencyTest Script
Initial Tags
Initial Language
Groovy