diff --git a/core/src/main/java/hudson/matrix/Layouter.java b/core/src/main/java/hudson/matrix/Layouter.java
new file mode 100644
index 0000000000..79b313e6d2
--- /dev/null
+++ b/core/src/main/java/hudson/matrix/Layouter.java
@@ -0,0 +1,90 @@
+package hudson.matrix;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Used to assist thegeneration of config table.
+ *
+ *
+ * {@link Axis Axes} are split into four groups.
+ * {@link #x Ones that are displayed as columns},
+ * {@link #x Ones that are displayed as rows},
+ * {@link #z Ones that are listed as bullet items inside table cell},
+ * and those which only have one value, and therefore doesn't show up
+ * in the table.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public final class Layouter {
+ public final List x,y,z;
+
+ public Layouter(List x, List y, List z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /**
+ * Automatically split axes to x,y, and z.
+ */
+ public Layouter(AxisList axisList) {
+ x = new ArrayList();
+ y = new ArrayList();
+ z = new ArrayList();
+
+ List nonTrivialAxes = new ArrayList();
+ for (Axis a : axisList) {
+ if(a.size()>1)
+ nonTrivialAxes.add(a);
+ }
+
+ switch(nonTrivialAxes.size()) {
+ case 0:
+ return;
+ case 1:
+ z.add(nonTrivialAxes.get(0));
+ return;
+ case 2:
+ x.add(nonTrivialAxes.get(0));
+ y.add(nonTrivialAxes.get(1));
+ break;
+ }
+
+ // for size > 3,
+ int i;
+ for( i=0; i l, int n) {
+ int w = 1;
+ for( n++ ; n
return (MatrixProject)super.getParent();
}
+ /**
+ * Get the actual combination of the axes values for this {@link MatrixConfiguration}
+ */
+ public Combination getCombination() {
+ return combination;
+ }
+
@Override
public FilePath getWorkspace() {
Node node = getLastBuiltOn();
diff --git a/core/src/main/java/hudson/matrix/MatrixProject.java b/core/src/main/java/hudson/matrix/MatrixProject.java
index d5df3a98aa..cdc481a161 100644
--- a/core/src/main/java/hudson/matrix/MatrixProject.java
+++ b/core/src/main/java/hudson/matrix/MatrixProject.java
@@ -1,6 +1,7 @@
package hudson.matrix;
import hudson.FilePath;
+import hudson.maven.ModuleName;
import hudson.tasks.Builder;
import hudson.tasks.Publisher;
import hudson.tasks.BuildWrapper;
@@ -77,6 +78,14 @@ public class MatrixProject extends AbstractProject im
super(Hudson.getInstance(), name);
}
+ public AxisList getAxes() {
+ return axes;
+ }
+
+ public Layouter getLayouter() {
+ return new Layouter(axes);
+ }
+
public void onLoad(ItemGroup extends Item> parent, String name) throws IOException {
super.onLoad(parent,name);
Collections.sort(axes); // perhaps the file was edited on disk and the sort order might have been broken
@@ -219,6 +228,12 @@ public class MatrixProject extends AbstractProject im
return this;
}
+ public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
+ MatrixConfiguration item = getItem(token);
+ if(item!=null)
+ return item;
+ return super.getDynamic(token,req,rsp);
+ }
protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
super.submit(req, rsp);
diff --git a/core/src/main/resources/hudson/matrix/MatrixProject/index.jelly b/core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
index e843d958a9..5d360fa085 100644
--- a/core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
+++ b/core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
@@ -4,6 +4,32 @@
Project ${it.name}
+
+
+
+
+
+ Configurations
+
+
+
+
+
+
+