60467302feb7977de313e0d0451c74759beb1f37
[vfc/nfvo/wfengine.git] /
1 <%--
2 /*******************************************************************************
3  * Copyright (c) 2012-2014 University of Stuttgart.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and the Apache License 2.0 which both accompany this distribution,
7  * and are available at http://www.eclipse.org/legal/epl-v10.html
8  * and http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Contributors:
11  *    Oliver Kopp - initial API and implementation and/or initial documentation
12  *******************************************************************************/
13 --%>
14 <%@tag description="Renders the list of requirements or capabilties" pageEncoding="UTF-8"%>
15
16 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
17 <%@taglib prefix="wc" uri="http://www.eclipse.org/winery/functions"%>
18 <%@taglib prefix="nt" tagdir="/WEB-INF/tags/common/templates/nodetemplates/reqscaps" %>
19 <%@taglib prefix="props" tagdir="/WEB-INF/tags/common/templates" %>
20
21 <%@attribute name="list" required="false" type="java.util.List" %>
22 <%@attribute name="headerLabel" required="true" description="Used for the heading" %>
23 <%@attribute name="cssClassPrefix" required="true" %>
24 <%@attribute name="TReqOrCapTypeClass" required="true" type="java.lang.Class" %>
25 <%@attribute name="repositoryURL" required="true" %>
26 <%@attribute name="typeURLFragment" required="true" description="requirementtypes|capabilitytypes"%>
27 <%@attribute name="shortName" required="true" description="Used for diag id, function name suffix, Req|Cap"%>
28 <%@attribute name="client" required="true" description="IWineryRepository" type="org.eclipse.winery.common.interfaces.IWineryRepository"%>
29 <%@attribute name="pathToImages" required="true" description="The path (URI path) to the image/ url, where xml.png is available. Has to end with '/'"%>
30
31 <%@tag import="org.eclipse.winery.common.ModelUtilities"%>
32
33 <div class="${cssClassPrefix}Container">
34         <div class="header">${headerLabel}</div>
35         <div class="content">
36                 <c:forEach var="item" items="${list}">
37                         <div class="reqorcap ${cssClassPrefix} row" id="${item.id}">
38                                 <div class="col-xs-4 id reqorcap">${item.id}</div>
39                                 <div class="col-xs-4 name reqorcap">${item.name}</div>
40                                 <div class="col-xs-4 type reqorcap">${wc:qname2href(repositoryURL, TReqOrCapTypeClass, item.type)}</div>
41                                 <c:set var="type" value="${wc:getType(client, item.type, TReqOrCapTypeClass)}" />
42                                 <props:properties
43                                         template="${item}"
44                                         propertiesDefinition="${type.propertiesDefinition}"
45                                         wpd="${wc:winerysPropertiesDefinition(type)}"
46                                         pathToImages="${pathToImages}" />
47                         </div>
48                 </c:forEach>
49                 <div class="addnewreqorcap row" style="display:none;">
50                         <button class="btn btn-default btn-xs center-block" onclick="showAddOrUpdateDiagFor${shortName}($(this).parent().parent().parent().parent().attr('id'));">Add new</button>
51                 </div>
52         </div>
53 </div>
54
55 <%-- parameters: o.id, o.name, o.type, o.xml. Has to be consistent with above HTML --%>
56 <script type="text/x-tmpl" id="tmpl-${shortName}">
57         <div class="reqorcap ${cssClassPrefix}" id="{%=o.id%}">
58                 <div class="col-xs-4 id reqorcap">{%=o.id%}</div>
59                 <div class="col-xs-4 name reqorcap">{%=o.name%}</div>
60                 <div class="col-xs-4 type reqorcap">{%#require("winery-support-common").qname2href("${repositoryURL}", "${typeURLFragment}", o.type)%}</div>
61                 <div id="toBeReplacedByProperties"></div>
62         </div>
63 </script>