2 /*******************************************************************************
3 * Copyright (c) 2012-2013 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
11 * Oliver Kopp - initial API and implementation and/or initial documentation
12 * Yves Schubert - switch to bootstrap 3
13 *******************************************************************************/
15 <%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
16 <%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
18 <script type='text/javascript' src='${pageContext.request.contextPath}/components/raphael/raphael.js'></script>
19 <script type='text/javascript' src='${pageContext.request.contextPath}/components/colorwheel/javascripts/colorwheel.js'></script>
21 <ul class="nav nav-tabs" id="myTab">
22 <li class="active"><a href="#icon">Icon</a></li>
23 <li><a href="#colors">Colors</a></li>
24 <li><a href="#arrow">Arrow</a></li>
27 <div class="tab-content">
28 <div class="tab-pane active" id="icon">
31 label="Icon (16x16) used in palette"
32 URL="visualappearance/16x16"
39 <div class="tab-pane" id="colors">
43 <t:colorwheel label="Line Color" color="${it.color}" id="color" url="color" />
44 <t:colorwheel label="Hover Color" color="${it.hoverColor}" id="hovercolor" url="hovercolor" />
49 <div class="tab-pane" id="arrow">
53 <div class="form-group">
54 <label for="arrow">Arrow appearance</label>
55 <div style="width:100%" id="arrow">
56 <div style="float:left; width:50px;">
57 <!-- Same values as the beginning of the file names in src\main\webapp\images\relationshiptype -->
58 <select id="dropDownSourceHead">
59 <option value="none"></option>
60 <option value="PlainArrow"></option>
61 <option value="Diamond"></option>
62 <!-- not yet supported
63 <option value="simpleArrow"></option>
64 <option value="doubleArrow"></option>
65 <option value="circle"></option>
66 <option value="square"></option> -->
69 <div style="float:left; width:80px;">
70 <select id="lineSelect">
71 <option value="plain"></option>
72 <option value="dotted"></option>
73 <option value="dotted2"></option>
76 <div style="float:left; width:50px;">
77 <select id="dropDownTargetHead">
78 <option value="none"></option>
79 <option value="PlainArrow"></option>
80 <option value="Diamond"></option>
81 <!-- not yet supported
82 <option value="simpleArrow"></option>
83 <option value="doubleArrow"></option>
84 <option value="circle"></option>
85 <option value="square"></option> -->
96 $('#myTab a').click(function (e) {
102 * @param sourceOrTarget "Source" or "Target"
104 function formatArrow(config, sourceOrTarget) {
105 var path = "${pageContext.request.contextPath}/images/relationshiptype/" + config.id + sourceOrTarget + ".png";
106 return "<img src='" + path +"' />";
109 var globalAJAXParamsForSelect2VisualAppearance = {
111 contentType : "text/plain",
112 success : function() {
113 vShowSuccess("Successfully updated arrow appearance");
115 error : function(jqXHR, textStatus, errorThrown) {
116 vShowAJAXError("Could not supdate arrow appearance", jqXHR, errorThrown);
120 /* source arrow head */
122 function formatArrowSource(config) {
123 return formatArrow(config, "Source");
127 $("#dropDownSourceHead").val("${it.sourceArrowHead}")
128 // enable storage on change of element
129 .on("change", function(e) {
130 params = globalAJAXParamsForSelect2VisualAppearance;
131 params.url = "visualappearance/sourcearrowhead";
135 // make the selection box show arrows
137 formatResult: formatArrowSource,
138 formatSelection: formatArrowSource,
139 escapeMarkup: function(m) { return m; },
140 minimumResultsForSearch: -1
145 function formatLine(config) {
146 var path = "${pageContext.request.contextPath}/images/relationshiptype/" + config.id + "Line.png";
147 return "<img src='" + path +"' />";
151 $("#lineSelect").val("${it.dash}")
152 //enable storage on change of element
153 .on("change", function(e) {
154 params = globalAJAXParamsForSelect2VisualAppearance;
155 params.url = "visualappearance/dash";
159 //make the selection box show arrows
161 formatResult: formatLine,
162 formatSelection: formatLine,
163 escapeMarkup: function(m) { return m; },
164 minimumResultsForSearch: -1
169 /* target arrow head */
171 function formatArrowTarget(config) {
172 return formatArrow(config, "Target");
176 $("#dropDownTargetHead").val("${it.targetArrowHead}")
177 //enable storage on change of element
178 .on("change", function(e) {
179 params = globalAJAXParamsForSelect2VisualAppearance;
180 params.url = "visualappearance/targetarrowhead";
184 //make the selection box show arrows
186 formatResult: formatArrowTarget,
187 formatSelection: formatArrowTarget,
188 escapeMarkup: function(m) { return m; },
189 minimumResultsForSearch: -1