diff options
Diffstat (limited to 'winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes')
17 files changed, 1098 insertions, 0 deletions
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/artifacttypes/artifacttype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/artifacttypes/artifacttype.jsp new file mode 100644 index 0000000..c51630a --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/artifacttypes/artifacttype.jsp @@ -0,0 +1,26 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<%-- +TODO: implement update / subresource "file extension" +<div class="center">Associated File Extension</div> + + <div class="middle" id="ccontainer"> + <input name="fileextension" type="text" onblur="updateValue('fileextension', this.value)" <c:if test="${not empty it.associatedFileExtension}"> value="${it.associatedFileExtension}" </c:if> /> + </div> +--%> + +<t:entitytype cssClass="artifactType" selected="ArtifactType"> +</t:entitytype> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/capabilitytypes/capabilitytype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/capabilitytypes/capabilitytype.jsp new file mode 100644 index 0000000..2e2b2f0 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/capabilitytypes/capabilitytype.jsp @@ -0,0 +1,17 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<t:entitytype cssClass="capabilityType" selected="CapabilityType"> +</t:entitytype> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/implementations.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/implementations.jsp new file mode 100644 index 0000000..46ef5a8 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/implementations.jsp @@ -0,0 +1,63 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + * Yves Schubert - switch to bootstrap 3 + *******************************************************************************/ +--%> +<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> + +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<t:addComponentInstance + label="${it.typeStr} Implementation" + URL="${pageContext.request.contextPath}/${it.type}implementations/" + onSuccess="implementationsTableInfo.table.fnAddData([$(\"#addComponentInstanceForm :input[name='namespace']\").val(), $(\"#addComponentInstanceForm :input[name='name']\").val()]);" + type="${it.typeId.QName}" + openinnewwindow="false" + /> + +<script> +var implementationsTableInfo = { + id: '#implementationsTable' +}; + +require(["winery-support"], function(ws) { + ws.initTable(implementationsTableInfo, { + "aoColumns": [ + { "sTitle": "namespace" }, + { "sTitle": "name" } + ], + "aaData" : ${it.implementationsTableData} + }); +}); + + function openImplementationEditor() { + var namespace = implementationsTableInfo.table.fnGetData(implementationsTableInfo.selectedRow,0); + var id = implementationsTableInfo.table.fnGetData(implementationsTableInfo.selectedRow,1); + window.open("${pageContext.request.contextPath}/${it.type}implementations/" + encodeID(namespace) + "/" + encodeID(id), "_self"); + } + +</script> + +<p> +This page shows implementations available for this type. +Go to <a href="${pageContext.request.contextPath}/other/">Other Elements</a> to get an overview on all implementations stored in this repository. +</p> + + <div id="implementations"> + + <button class="rightbutton btn btn-danger btn-xs" type="button" onclick="deleteOnServerAndInTable(implementationsTableInfo, '${it.typeStr} Implementation', '${pageContext.request.contextPath}/${it.type}implementations/', 1, 1, 0);">Remove</button> + <button class="rightbutton btn btn-primary btn-xs" type="button" onclick="openNewCIdiag();">Add</button> + <button class="rightbutton btn btn-default btn-xs" type="button" onclick="openImplementationEditor();">Edit</button> + + <table cellpadding="0" cellspacing="0" border="0" class="display" id="implementationsTable"></table> + </div> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/instancestates.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/instancestates.jsp new file mode 100644 index 0000000..059ae55 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/instancestates.jsp @@ -0,0 +1,86 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + * Yves Schubert - switch to bootstrap 3 + *******************************************************************************/ +--%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + +<div class="modal fade" id="addStateDiag"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title">Add State</h4> + </div> + <div class="modal-body"> + <form id="addPropertyForm" enctype="multipart/form-data" method="post"> + <div class="row"> + <label> + State: <input name="state" id="state" type="text" /> + </label> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> + <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="createState();">Add</button> + </div> + </div> + </div> +</div> + +<div id="Properties"> + <button class="rightbutton btn btn-danger btn-xs" type="button" onclick="deleteOnServerAndInTable(propertiesTableInfo, 'InstanceState', 'instancestates/');">Remove</button> + <button class="rightbutton btn btn-primary btn-xs" type="button" onclick="$('#addStateDiag').modal('show');">Add</button> + + <table cellpadding="0" cellspacing="0" border="0" class="display" id="propertiesTable"> + <thead> + <tr> + <th>State</th> + </tr> + </thead> + <tbody> + <c:forEach var="t" items="${it.instanceStates}"> + <tr> + <td>${t}</td> + </tr> + </c:forEach> + </tbody> + </table> +</div> + +<script> +var propertiesTableInfo = { + id: '#propertiesTable' +}; + +require(["winery-support"], function(ws) { + ws.initTable(propertiesTableInfo); +}); + +function createState() { + $.ajax({ + url: "instancestates/", + type: "POST", + async: false, + data: $('#addPropertyForm').serialize(), + error: function(jqXHR, textStatus, errorThrown) { + vShowError("Could not add instancestate: " + errorThrown + "<br/>" + jqXHR.responseText); + }, + success: function(data, textStatus, jqXHR) { + var dataToAdd = [$('#state').val()]; + propertiesTableInfo.table.fnAddData(dataToAdd); + $('#addStateDiag').modal('hide'); + } + }); +} +</script> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/nodetype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/nodetype.jsp new file mode 100644 index 0000000..f9d52d7 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/nodetype.jsp @@ -0,0 +1,44 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<%@page import="org.eclipse.winery.repository.resources.SubMenuData"%> + +<% +java.util.List<SubMenuData> subMenus = new java.util.ArrayList<SubMenuData>(); + +SubMenuData data; + +data = new SubMenuData("#visualappearance", "Visual Appearance"); +subMenus.add(data); + +data = new SubMenuData("#instancestates", "Instance States"); +subMenus.add(data); + +data = new SubMenuData("#interfaces", "Interfaces"); +subMenus.add(data); + +data = new SubMenuData("#implementations", "Implementations"); +subMenus.add(data); + +data = new SubMenuData("#requirementdefinitions", "Requirement Definitions"); +subMenus.add(data); + +data = new SubMenuData("#capabilitydefinitions", "Capability Definitions"); +subMenus.add(data); + +%> + +<t:entitytype cssClass="nodeType" selected="NodeType" subMenus="<%=subMenus%>" image="true" twolines="true"> +</t:entitytype> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/reqandcapdefs/capdefs.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/reqandcapdefs/capdefs.jsp new file mode 100644 index 0000000..7f2cc7d --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/reqandcapdefs/capdefs.jsp @@ -0,0 +1,17 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2014 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags/entitytypes/nodetypes/reqandcapdefs" %> + +<t:reqandcapdefs allTypes="${it.allTypes}" allSubResources="${it.allEntityResources}" url="capabilitydefinitions/" labelForSingleItem="Capability Definition" typeClass="<%=org.eclipse.winery.model.tosca.TCapabilityType.class%>"/> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/reqandcapdefs/reqdefs.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/reqandcapdefs/reqdefs.jsp new file mode 100644 index 0000000..08657a1 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/reqandcapdefs/reqdefs.jsp @@ -0,0 +1,17 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2014 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags/entitytypes/nodetypes/reqandcapdefs" %> + +<t:reqandcapdefs allTypes="${it.allTypes}" allSubResources="${it.allEntityResources}" url="requirementdefinitions/" labelForSingleItem="Requirement Definition" typeClass="<%=org.eclipse.winery.model.tosca.TRequirementType.class%>"/> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/visualappearance.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/visualappearance.jsp new file mode 100644 index 0000000..b432be6 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/nodetypes/visualappearance.jsp @@ -0,0 +1,68 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + * Yves Schubert - switch to bootstrap 3 + *******************************************************************************/ +--%> +<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<script type='text/javascript' src='${pageContext.request.contextPath}/components/raphael/raphael.js'></script> +<script type='text/javascript' src='${pageContext.request.contextPath}/components/colorwheel/javascripts/colorwheel.js'></script> + +<script> +<%-- Required for multiple upload dialogs + see https://github.com/blueimp/jQuery-File-Upload/wiki/Options --%> +$(document).bind('drop dragover', function (e) { + e.preventDefault(); +}); +</script> + +<ul class="nav nav-tabs" id="myTab"> + <li class="active"><a href="#icons">Icons</a></li> + <li><a href="#color">Color</a></li> +</ul> + +<div class="tab-content"> + <div class="tab-pane active" id="icons"> + <br /> + <t:imageUpload + label="Icon (16x16) used in palette" + URL="visualappearance/16x16" + id="upSmall" + width="16px" + resize="16" + accept="image/*"/> + + <t:imageUpload + label="Icon (50x50) used in the node template shapes" + URL="visualappearance/50x50" + id="upBig" + width="50px" + resize="50" + accept="image/*"/> + </div> + <div class="tab-pane" id="color"> + <br /> + <form> + <fieldset> + <t:colorwheel label="Border Color" color="${it.borderColor}" id="bordercolor" url="bordercolor" /> + </fieldset> + </form> + </div> +</div> + +<script> +$('#myTab a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); +}); +</script> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/appliesto.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/appliesto.jsp new file mode 100644 index 0000000..ff15a39 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/appliesto.jsp @@ -0,0 +1,25 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + +<c:if test="${empty it.policyType.appliesTo.nodeTypeReference}">–</c:if> + +<ul> +<c:forEach items="${it.policyType.appliesTo.nodeTypeReference}" var="nodeTypeReference"> +<li>${nodeTypeReference.typeRef}</li> +</c:forEach> +</ul> + + +Update not yet implemented. diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/language.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/language.jsp new file mode 100644 index 0000000..c1815bd --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/language.jsp @@ -0,0 +1,21 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + +<c:choose> + <c:when test="${empty it.language}">–</c:when> + <c:otherwise>${it.language}</c:otherwise> +</c:choose> + +Update not yet implemented. diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/policytype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/policytype.jsp new file mode 100644 index 0000000..694abad --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/policytypes/policytype.jsp @@ -0,0 +1,32 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<%@page import="org.eclipse.winery.repository.resources.SubMenuData"%> + +<% +java.util.List<SubMenuData> subMenus = new java.util.ArrayList<SubMenuData>(); + +SubMenuData data; + +data = new SubMenuData("#language", "Language"); +subMenus.add(data); + +data = new SubMenuData("#appliesto", "Applies To"); +subMenus.add(data); + +%> + +<t:entitytype cssClass="policyType" selected="PolicyType" subMenus="<%=subMenus%>"> +</t:entitytype> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/properties/propertiesDefinition.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/properties/propertiesDefinition.jsp new file mode 100644 index 0000000..a0e22df --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/properties/propertiesDefinition.jsp @@ -0,0 +1,320 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + * Yves Schubert - switch to bootstrap 3 + *******************************************************************************/ +--%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags"%> +<%@taglib prefix="ct" tagdir="/WEB-INF/tags/common"%> +<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%> + +<%-- createResource of winery-support.js could be used. However, currently selects are not supported --%> +<div class="modal fade" id="addPropertyDiag"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title">Add Property</h4> + </div> + <div class="modal-body"> + <form id="addPropertyForm"> + <div class="form-group"> + <label class="control-label" for="propName">Name</label> + <input name="key" class="form-control" id="propName" type="text" /> + </div> + + <div class="form-group"> + <label class="control-label" for="propType">Type</label> + <select name="type" class="form-control" id="propType"> + <c:forEach var="t" items="${it.availablePropertyTypes}"> + <option value="${t}">${t}</option> + </c:forEach> + </select> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> + <button type="button" class="btn btn-primary" onclick="createProperty();">Add</button> + </div> + </div> + </div> +</div> + +<script> +function noneClicked() { + disableKVproperties(); + clearXSDElementSelection(); + clearXSDTypeSelection(); + $.ajax({ + url: "propertiesdefinition/", + type: 'DELETE', + async: true, + error: function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could not remove properties definition", jqXHR, errorThrown); + } + }); +} + +function clearXSDElementSelection() { + $("#xsdelement").editable('setValue', "", true); +} + +function clearXSDTypeSelection() { + $("#xsdtype").editable('setValue', "", true); +} + +$(function(){ + $("#xsdelement").editable({ + type: "select", + url: "post/", + pk: 1, + source: ${w:allXSDElementDefinitionsForTypeAheadSelection()} + }); + $("#xsdelement").on("click", function(e){ + $("#xsdelementradio").prop("checked", true); + }); + + $("#xsdtype").editable({ + type: "select", + source: ${w:allXSDTypeDefinitionsForTypeAheadSelection()} + }); + $("#xsdtype").on("click", function(e){ + $("#xsdtyperadio").prop("checked", true); + }); + + /* make UI more nice: enable click on label */ + $("#textnone").on("click", function(e){ + $("#nopropdef").prop("checked", true); + noneClicked(); + }); + $("#textxmlelement").on("click", function(e){ + $("#xsdelementradio").prop("checked", true); + disableKVproperties(); + clearXSDTypeSelection(); + }); + $("#textxmltype").on("click", function(e){ + $("#xsdtyperadio").prop("checked", true); + disableKVproperties(); + clearXSDElementSelection(); + }); + $("#textcustomkv").on("click", function(e){ + $("#customkv").prop("checked", true); + updateKVpropertiesVisibility(); + setKVPropertiesOnServer(); + clearXSDElementSelection(); + clearXSDTypeSelection(); + }); + + $('#kvPropsTabs a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + }); + + $("#addPropertyDiag").on("shown.bs.modal", function() { + $("#propName").focus(); + }); +}); +</script> + +<p> + <%-- TODO: if clicked on the "label" of the input field (i.e., the content of the input tag), the input should be selected. This is not the default at HTML5 - see http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_radio --%> + + <input id="nopropdef" type="radio" name="kind" value="none" <c:if test="${not it.isWineryKeyValueProperties and empty it.entityType.propertiesDefinition.element and empty t.entityType.propertiesDefinition.type}">checked="checked"</c:if>><span class="cursorpointer" id="textnone">(none)</span></input> + <br/> + + <input id="xsdelementradio" type="radio" name="kind" value="element" <c:if test="${not empty it.entityType.propertiesDefinition.element}">checked="checked"</c:if>><span class="cursorpointer" id="textxmlelement">XML element</span></input> + <a href="#" id="xsdelement" data-url="propertiesdefinition/" data-send="always" data-title="Select XSD Element" data-value="${it.entityType.propertiesDefinition.element}"><c:if test="${not empty it.entityType.propertiesDefinition.element}">${it.entityType.propertiesDefinition.element.localPart}</c:if></a> + <br/> + + <input id="xsdtyperadio" type="radio" name="kind" value="type" <c:if test="${not empty it.entityType.propertiesDefinition.type}">checked="checked"</c:if>><span class="cursorpointer" id="textxmltype">XML type</span></input> + <a href="#" id="xsdtype" data-url="propertiesdefinition/" data-send="always" data-title="Select XSD Type" data-value="${it.entityType.propertiesDefinition.type}"><c:if test="${not empty it.entityType.propertiesDefinition.type}">${it.entityType.propertiesDefinition.type.localPart}</c:if></a> + <br/> + + + <input id="customkv" type="radio" name="kind" value="KV" <c:if test="${it.isWineryKeyValueProperties and not it.isWineryKeyValuePropertiesDerivedFromXSD}">checked="checked"</c:if>><span class="cursorpointer" id="textcustomkv">Custom key/value pairs</span></input> +</p> + +<div id="Properties" style="display:none; margin-left:20px;"> + <ul class="nav nav-tabs" id="kvPropsTabs"> + <li class="active"><a href="#kvProps">Properties</a></li> + <li><a href="#wrapper">Wrapping</a></li> + </ul> + + <div class="tab-content"> + <div class="tab-pane active" id="kvProps"> + + <button class="rightbutton btn btn-danger btn-xs" type="button" onclick="deleteOnServerAndInTable(propertiesTableInfo, 'Property', 'propertiesdefinition/winery/list/');">Remove</button> + <button class="rightbutton btn btn-primary btn-xs" type="button" onclick="$('#addPropertyDiag').modal('show');">Add</button> + + <table cellpadding="0" cellspacing="0" border="0" class="display" id="propertiesTable"> + <thead> + <tr> + <th>Name</th> + <th>Type</th> + </tr> + </thead> + <tbody> + <c:if test="${it.isWineryKeyValueProperties}"> + <c:forEach var="t" items="${it.propertyDefinitionKVList}"> + <tr> + <td>${t.key}</td> + <%-- FIXME: t.type is the short type, but we need the full type. Currently, there is no way to get the full type for a short type --%> + <td>${t.type}</td> + </tr> + </c:forEach> + </c:if> + </tbody> + </table> + </div> + + <div class="tab-pane" id="wrapper"> + <form id="wrapperelementform" enctype="multipart/form-data"> + <fieldset> + <div style="width:400px;"> + <div class="form-group"> + <label for="wrapperelement_name">Name of Wrapper Element</label> + <a href="#" class="form-control" id="wrapperelement_name" data-url="propertiesdefinition/winery/elementname" data-send="always" data-title="Local Name" data-type="text" data-value="${it.elementName}"></a> + </div> + <t:namespaceChooser idOfInput="wrapperelement_ns" selected="${it.namespace}" allNamespaces="${w:allNamespaces()}"></t:namespaceChooser> + </div> + </fieldset> + </form> + </div> + </div> +</div> + +<script> +function disableKVproperties() { + $("#Properties").hide(); +} + +function enableKVproperties() { + $("#Properties").show(); +} + +function updateKVpropertiesVisibility() { + if ($("input[name='kind']:checked").val() == "KV") { + enableKVproperties(); + } else { + disableKVproperties(); + } +} + +function setKVPropertiesOnServer() { + $.ajax({ + url: "propertiesdefinition/winery/", + type: "POST", + async: true, + error: function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could change to custom key/value pairs", jqXHR, errorThrown); + } + }); +} + +$(function() { + // put change function on all inputs to get notified of any change by the user + $("input[name='kind']").on("change", function(e) { + // we do not POST something to the server as only concrete values really trigger a change on server side + var target = e.currentTarget.value; + if (target == "none") { + noneClicked(); + } else if (target == "element") { + disableKVproperties(); + clearXSDTypeSelection(); + } else if (target == "type") { + disableKVproperties(); + clearXSDElementSelection(); + enableKVproperties(); + } else if (target == "KV") { + <c:if test="${not it.isWineryKeyValuePropertiesDerivedFromXSD}"> + <%-- only empty the k/v properties if not derived from XSD--%> + setKVPropertiesOnServer(); + </c:if> + clearXSDElementSelection(); + clearXSDTypeSelection(); + } else { + vShowError("UI not consistent to code"); + } + }); + + // initialization - display the custom box to enter k/vs only if KV is selected + updateKVpropertiesVisibility(); + + $("#wrapperelement_name").editable({ + ajaxOptions: { + type: 'put' + }, + params: function(params) { + // adjust params according to Winery's expectations + delete params.pk; + params.name = params.value; + delete params.value; + return params; + } + }).on("save", function(e, params) { + vShowSuccess("Successfully updated local name of wrapper element"); + }); + + $("#wrapperelement_ns").on("change", function(e) { + $.ajax({ + url: "propertiesdefinition/winery/namespace", + type: "PUT", + async: true, + contentType: "text/plain", + processData: false, + data: e.val, + error: function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could not update namespace", jqXHR, errorThrown); + }, + success: function(data, textStatus, jqXHR) { + vShowSuccess("Successfully updated namespace"); + } + }); + }); +}); + +var propertiesTableInfo = { + id: '#propertiesTable' +}; + +require(["winery-support"], function(ws) { + ws.initTable(propertiesTableInfo); +}); + +function createProperty() { + var data = { + key: $("#propName").val(), + type: $('#propType :selected').text() + } + $.ajax({ + url: "propertiesdefinition/winery/list/", + type: "POST", + async: true, + contentType: "application/json", + processData: false, + data: JSON.stringify(data), + error: function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could not add property", jqXHR, errorThrown); + }, + success: function(data, textStatus, jqXHR) { + var name = $('#propName').val(); + var type = $('#propType :selected').text(); + var dataToAdd = [name, type]; + propertiesTableInfo.table.fnAddData(dataToAdd); + vShowSuccess("Property successfully added"); + $('#addPropertyDiag').modal('hide'); + } + }); +} +</script> + diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/relationshiptype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/relationshiptype.jsp new file mode 100644 index 0000000..ba2e6cc --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/relationshiptype.jsp @@ -0,0 +1,44 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<%@page import="org.eclipse.winery.repository.resources.SubMenuData"%> + +<% +java.util.List<SubMenuData> subMenus = new java.util.ArrayList<SubMenuData>(); + +SubMenuData data; + +data = new SubMenuData("#visualappearance", "Visual Appearance"); +subMenus.add(data); + +data = new SubMenuData("#instancestates", "Instance States"); +subMenus.add(data); + +data = new SubMenuData("#sourceinterfaces", "Source Interfaces"); +subMenus.add(data); + +data = new SubMenuData("#targetinterfaces", "Target Interfaces"); +subMenus.add(data); + +data = new SubMenuData("#validendings", "Valid Sources and Targets"); +subMenus.add(data); + +data = new SubMenuData("#implementations", "Implementations"); +subMenus.add(data); + +%> + +<t:entitytype cssClass="relationshipType" selected="RelationshipType" subMenus="<%=subMenus%>" twolines="true"> +</t:entitytype> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/validendings.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/validendings.jsp new file mode 100644 index 0000000..4bf2145 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/validendings.jsp @@ -0,0 +1,39 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + * Yves Schubert - switch to bootstrap 3 + *******************************************************************************/ +--%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="rt" tagdir="/WEB-INF/tags/relationshiptype" %> + +<h4>Valid Source</h4> +<input type="radio" name="SourceKind">Node Type:</input> +<rt:validnodetypeendingsselect shortName="source" currentSelection="${it.validSource}" possibleValidEndings="${it.possibleValidEndings}"> +</rt:validnodetypeendingsselect> +<br/> +<input type="radio" name="SourceKind">Requirement Type:</input> +<select> + <option>Not yet implemented. Please edit in the XML view</option> +</select> + + +<br/> +<br/> +<h4>Valid Target</h4> +<input type="radio" name="TargetKind">Node Type:</input> +<rt:validnodetypeendingsselect shortName="target" currentSelection="${it.validTarget}" possibleValidEndings="${it.possibleValidEndings}"> +</rt:validnodetypeendingsselect> +<br/> +<input type="radio" name="TargetKind">Capability Type:</input> +<select> + <option>Not yet implemented. Please edit in the XML view</option> +</select> diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/visualappearance.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/visualappearance.jsp new file mode 100644 index 0000000..d30ea01 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/relationshiptypes/visualappearance.jsp @@ -0,0 +1,193 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + * Yves Schubert - switch to bootstrap 3 + *******************************************************************************/ +--%> +<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<script type='text/javascript' src='${pageContext.request.contextPath}/components/raphael/raphael.js'></script> +<script type='text/javascript' src='${pageContext.request.contextPath}/components/colorwheel/javascripts/colorwheel.js'></script> + +<ul class="nav nav-tabs" id="myTab"> + <li class="active"><a href="#icon">Icon</a></li> + <li><a href="#colors">Colors</a></li> + <li><a href="#arrow">Arrow</a></li> +</ul> + +<div class="tab-content"> + <div class="tab-pane active" id="icon"> + <br /> + <t:imageUpload + label="Icon (16x16) used in palette" + URL="visualappearance/16x16" + id="upSmall" + width="16px" + resize="16" + accept="image/*"/> + </div> + + <div class="tab-pane" id="colors"> + <br /> + <form> + <fieldset> + <t:colorwheel label="Line Color" color="${it.color}" id="color" url="color" /> + <t:colorwheel label="Hover Color" color="${it.hoverColor}" id="hovercolor" url="hovercolor" /> + </fieldset> + </form> + </div> + + <div class="tab-pane" id="arrow"> + <br /> + <form> + <fieldset> + <div class="form-group"> + <label for="arrow">Arrow appearance</label> + <div style="width:100%" id="arrow"> + <div style="float:left; width:50px;"> + <!-- Same values as the beginning of the file names in src\main\webapp\images\relationshiptype --> + <select id="dropDownSourceHead"> + <option value="none"></option> + <option value="PlainArrow"></option> + <option value="Diamond"></option> + <!-- not yet supported + <option value="simpleArrow"></option> + <option value="doubleArrow"></option> + <option value="circle"></option> + <option value="square"></option> --> + </select> + </div> + <div style="float:left; width:80px;"> + <select id="lineSelect"> + <option value="plain"></option> + <option value="dotted"></option> + <option value="dotted2"></option> + </select> + </div> + <div style="float:left; width:50px;"> + <select id="dropDownTargetHead"> + <option value="none"></option> + <option value="PlainArrow"></option> + <option value="Diamond"></option> + <!-- not yet supported + <option value="simpleArrow"></option> + <option value="doubleArrow"></option> + <option value="circle"></option> + <option value="square"></option> --> + </select> + </div> + </div> + </div> + </fieldset> + </form> + </div> +</div> + +<script> +$('#myTab a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); +}); + +/** + * @param sourceOrTarget "Source" or "Target" + */ +function formatArrow(config, sourceOrTarget) { + var path = "${pageContext.request.contextPath}/images/relationshiptype/" + config.id + sourceOrTarget + ".png"; + return "<img src='" + path +"' />"; +} + +var globalAJAXParamsForSelect2VisualAppearance = { + type : "PUT", + contentType : "text/plain", + success : function() { + vShowSuccess("Successfully updated arrow appearance"); + }, + error : function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could not supdate arrow appearance", jqXHR, errorThrown); + } +} + +/* source arrow head */ + +function formatArrowSource(config) { + return formatArrow(config, "Source"); +} + +// set stored value +$("#dropDownSourceHead").val("${it.sourceArrowHead}") +// enable storage on change of element +.on("change", function(e) { + params = globalAJAXParamsForSelect2VisualAppearance; + params.url = "visualappearance/sourcearrowhead"; + params.data = e.val; + $.ajax(params); +}) +// make the selection box show arrows +.select2({ + formatResult: formatArrowSource, + formatSelection: formatArrowSource, + escapeMarkup: function(m) { return m; }, + minimumResultsForSearch: -1 +}); + + +/* line */ +function formatLine(config) { + var path = "${pageContext.request.contextPath}/images/relationshiptype/" + config.id + "Line.png"; + return "<img src='" + path +"' />"; +} + +//set stored value +$("#lineSelect").val("${it.dash}") +//enable storage on change of element +.on("change", function(e) { + params = globalAJAXParamsForSelect2VisualAppearance; + params.url = "visualappearance/dash"; + params.data = e.val; + $.ajax(params); +}) +//make the selection box show arrows +.select2({ + formatResult: formatLine, + formatSelection: formatLine, + escapeMarkup: function(m) { return m; }, + minimumResultsForSearch: -1 +}); + + + +/* target arrow head */ + +function formatArrowTarget(config) { + return formatArrow(config, "Target"); +} + +//set stored value +$("#dropDownTargetHead").val("${it.targetArrowHead}") +//enable storage on change of element +.on("change", function(e) { + params = globalAJAXParamsForSelect2VisualAppearance; + params.url = "visualappearance/targetarrowhead"; + params.data = e.val; + $.ajax(params); +}) +//make the selection box show arrows +.select2({ + formatResult: formatArrowTarget, + formatSelection: formatArrowTarget, + escapeMarkup: function(m) { return m; }, + minimumResultsForSearch: -1 +}); + +</script> + diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/requirementtypes/requiredcapabilitytype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/requirementtypes/requiredcapabilitytype.jsp new file mode 100644 index 0000000..0b10277 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/requirementtypes/requiredcapabilitytype.jsp @@ -0,0 +1,56 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> + +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@taglib prefix="ct" tagdir="/WEB-INF/tags/common" %> + +<c:choose> + <c:when test="${empty it.requirementType.requiredCapabilityType}"> + <c:set var="selected" value="(none)" /> + </c:when> + <c:otherwise> + <c:set var="selected" value="${it.requirementType.requiredCapabilityType}" /> + </c:otherwise> +</c:choose> + +<ct:QNameChooser allQNames="${it.allCapabilityTypes}" idOfSelectField="requiredCapabilityType" labelOfSelectField="" includeNONE="true" selected="${selected}"/> + +<script> +$("#requiredCapabilityType").on("change", function(e) { + var val = $("#requiredCapabilityType").val(); + if (val == "(none)") { + // remove required capability type assignment + $.ajax({ + url: 'requiredcapabilitytype', + type: "DELETE" + }).fail(function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could not remove required capability type assignment.", jqXHR, errorThrown); + }).done(function(data, textStatus, jqXHR) { + vShowSuccess("Successfully updated required capability type assignment."); + }); + } else { + // put new capability type + $.ajax({ + url: 'requiredcapabilitytype', + data: val, + contentType: "text/plain", + type: "PUT" + }).fail(function(jqXHR, textStatus, errorThrown) { + vShowAJAXError("Could not update required capability type assignment.", jqXHR, errorThrown); + }).done(function(data, textStatus, jqXHR) { + vShowSuccess("Successfully updated required capability type assignment."); + }); + } +}); +</script>
\ No newline at end of file diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/requirementtypes/requirementtype.jsp b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/requirementtypes/requirementtype.jsp new file mode 100644 index 0000000..a8b6f43 --- /dev/null +++ b/winery/org.eclipse.winery.repository/src/main/webapp/jsp/entitytypes/requirementtypes/requirementtype.jsp @@ -0,0 +1,30 @@ +<%-- +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * Oliver Kopp - initial API and implementation and/or initial documentation + *******************************************************************************/ +--%> +<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> + +<%@page import="org.eclipse.winery.repository.resources.SubMenuData"%> + +<% +java.util.List<SubMenuData> subMenus = new java.util.ArrayList<SubMenuData>(); + +SubMenuData data; + +data = new SubMenuData("#requiredcapabilitytype", "Required Capability Type"); +subMenus.add(data); + +%> + + +<t:entitytype cssClass="requirementType" selected="RequirementType" subMenus="<%=subMenus%>"> +</t:entitytype> |