matrix.jelly 1.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<!--
  Generate configuration matrix and invoke body with 'p' as the instance of T
  (of Layouter<T>)

  Used by Matrix* classes
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
  <j:set var="o" value="${it.layouter}"/>
  <j:choose>
    <!-- Optimized case when there's only dimention to the axis (or zero dimension) -->
    <j:when test="${empty(o.x) and empty(o.y)}">
      <h2>Configurations</h2>
      <j:forEach var="p" items="${o.rows[0][0]}">
        <d:invokeBody />
        <st:nbsp />
      </j:forEach>
    </j:when>
    <j:otherwise>
      <h2>Configuration Matrix</h2>
20
      <table border="1" class="middle-align center-align">
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
        <!-- X-axis -->
        <j:forEach var="x" items="${o.x}">
          <tr>
            <!-- space for Y-axis -->
            <j:if test="${!empty(o.y)}">
              <td colspan="${size(o.y)}" />
            </j:if>
            <j:forEach var="v" items="${x.values}" varStatus="loop">
              <td colspan="${o.width(loop.index)}">${v}</td>
            </j:forEach>
          </tr>
        </j:forEach>

        <!-- Y-axis -->
        <j:forEach var="r" items="${o.rows}">
          <tr>
            <j:forEach var="y" items="${o.y}" varStatus="loop">
              <j:if test="${r.drawYHeader(loop.index)!=null}">
                <td rowspan="${o.height(loop.index)}">${r.drawYHeader(loop.index)}</td>
              </j:if>
            </j:forEach>

            <j:forEach var="c" items="${r}">
              <td>
                <j:choose>
                  <j:forEach var="p" items="${c}">
                    <div>
                      <d:invokeBody />
                    </div>
                  </j:forEach>
                </j:choose>
              </td>
            </j:forEach>
          </tr>
        </j:forEach>

      </table>

    </j:otherwise>
  </j:choose>
</j:jelly>