TheCodersCorner.com items tagged with groovy.
In this article I show an example of creating a bar chart with a fixed colour. This was missing from the groovychart example set, and will get included into the next build. If you are unfamiliar with groovy chart then here is an introduction to Groovychart We simply tell the plot's renderer to use the StandardBarPainter. This turns off the gradient...
Groovy supports the concept of builders, which provide an abstraction between the required output content and the representation of it. Groovy supports this by providing a tree like structure in groovy code that represents the required HTML or XML: So what have we done? We generated some HTML, in this case we just printed it to the console, but we could...
Groovy has great inbuilt xml support, and allows you to treat xml paths like objects. Reading elements and attributes is so straightforward that it was one of the factors that got me started with Groovy. So to build an object tree from xml, we just use the class. To dereference an element we use normal dot syntax, for an attribute,...
Lastly, we look at building an ATOM document using the same principles. ATOM provides a means for site owners to provide updates to site users. It works by providing an XML document showing recent changes to the site. Browsers that support RSS and RSS readers can then highlight these changes to users. An atom formatted document contains two main sections, the...
In this article I cover working with SQL from Groovy using the GSQL support built into the language. This is not a complete guide, rather a getting started guide, that shows you a few of the concepts. Firstly, GSQL is built on top of JDBC; which you are probably already familiar with. If not there are many good web guides and...
Groovychart is a library hosted on Java.net that wraps the functionality available in JFreeChart for use as a groovy builder. Currently it is available in snapshot form but hopefully time permitting, a full build will follow soon. I really like groovy as a scripting language, it's great for writing simple UI's for displaying graphical data from many sources including XML and...