Until now I've developed in PHP and JavaScript. I'm currently learning groovy, but unfortunately there aren't many tutorials about this language and the book, I'm currently reading (Groovy Recipes), doesn't contain anything about using groovy's swingbuilder.
As a project at work, I'd like to create a table like the schema bellow:
Instancename
groupId artifactId DEV TEST PROD
firstgroup firstartifact 1.00 1.05 1.05
secondgroup secondartifact 2.02 2.00 2.00
That's my current code:
import groovy.swing.SwingBuilder
import java.awt.BorderLayout
public class Gui {
public void createGui(String instanceTitle, ArrayList<Artifact> columnData){
def bldr = new groovy.swing.SwingBuilder();
def frame = bldr.frame(
title: "Overview",
size: [600,150],
defaultCloseOperation:javax.swing.WindowConstants.EXIT_ON_CLOSE
){
def tab = table(constraints:BorderLayout.CENTER) {
tableModel(list:columnData) {
propertyColumn(header:'GroupId', propertyName:'groupId')
propertyColumn(header:'ArtifactId', propertyName:'artifactId')
propertyColumn(header:'Dev', propertyName:'devVersion')
propertyColumn(header:'Test', propertyName:'testVersion')
propertyColumn(header:'Prod', propertyName:'prodVersion')
}
}
widget(constraints:BorderLayout.NORTH, tab.tableHeader)
}
frame.pack()
frame.show();
}
}
When I run this, I get the table filled with my data. My question is, how can I subordinate "DEV", "TEST" and "PROD" to "Instancename"? I don't know how to add a header above the others. In html it would look like this:
<table>
<tr>
<td colspan="2"></td>
<td colspan="3">Instancename</td>
</tr>
<tr>
<td>groupId</td>
<td>artifactId</td>
<td>DEV</td>
<td>TEST</td>
<td>PROD</td>
</tr>
<tr>
<td>firstgroupid</td>
<td>firstartifactid</td>
<td>firstdevversion</td>
<td>firsttestversion</td>
<td>firstprodversion</td>
</tr>
...
</table>
PS: If you know some good groovy tutorials, let me know :)