Revize b93c563b
Přidáno uživatelem Pavel Fidranský před více než 6 roky(ů)
sources/src/main/webapp/css/main.css | ||
---|---|---|
199 | 199 |
height: 38px; |
200 | 200 |
} |
201 | 201 |
|
202 |
.navbar .btn.toggle-filters { |
|
203 |
background-color: #cfeafe; |
|
204 |
border: 1px solid gray; |
|
205 |
padding: 0.5em; |
|
206 |
outline: 0; |
|
207 |
} |
|
208 |
|
|
209 | 202 |
.navbar .btn.back-to-upload { |
210 | 203 |
background: url("./../images/icon_back.png") no-repeat scroll 0px 2px transparent; |
211 | 204 |
} |
sources/src/main/webapp/js/app.js | ||
---|---|---|
21 | 21 |
this.cookies = new Cookies; |
22 | 22 |
/** @prop {MarkSymbol} markSymbol */ |
23 | 23 |
this.markSymbol = new MarkSymbol; |
24 |
/** @prop {Filter} filter */ |
|
25 |
this.filter = new Filter; |
|
26 | 24 |
|
27 | 25 |
/** @prop {string} NAME Application name. */ |
28 | 26 |
this.NAME = document.title; |
... | ... | |
94 | 92 |
this.reset = function() { |
95 | 93 |
app.viewportComponent.reset(); |
96 | 94 |
app.sidebarComponent.reset(); |
97 |
app.filter.resetSelectors(); |
|
98 | 95 |
|
99 | 96 |
app.edgeList = []; |
100 | 97 |
app.nodeList = []; |
... | ... | |
165 | 162 |
document.getElementById('zoomValue').innerText = Math.round(self.zoom.scale * 100) + '%'; |
166 | 163 |
document.getElementById('graph').setAttribute('transform', 'scale(' + self.zoom.scale + ')'); |
167 | 164 |
|
168 |
// filters |
|
169 |
document.getElementById('toggleFilters').addEventListener('click', function(e) { |
|
170 |
document.getElementById('filters').classList.toggle('hidden'); |
|
171 |
}); |
|
172 |
|
|
173 |
|
|
174 |
document.getElementById('filterTypeSelection').addEventListener('change', function (e) { |
|
175 |
var selected = this.value; |
|
176 |
if(selected === 'Archetype') { |
|
177 |
document.getElementById('vertexArchetypeSelection').classList.remove('hidden'); |
|
178 |
document.getElementById('logicOperationSelection').classList.add('hidden'); |
|
179 |
document.getElementById('attributeTypeSelection').classList.add('hidden'); |
|
180 |
document.getElementById('matchTypeSelection').classList.remove('hidden'); |
|
181 |
|
|
182 |
} else if (selected === 'Attribute') { |
|
183 |
document.getElementById('vertexArchetypeSelection').classList.add('hidden'); |
|
184 |
document.getElementById('logicOperationSelection').classList.add('hidden'); |
|
185 |
document.getElementById('attributeTypeSelection').classList.remove('hidden'); |
|
186 |
document.getElementById('matchTypeSelection').classList.remove('hidden'); |
|
187 |
|
|
188 |
} else if (selected === 'Logical') { |
|
189 |
document.getElementById('vertexArchetypeSelection').classList.add('hidden'); |
|
190 |
document.getElementById('logicOperationSelection').classList.remove('hidden'); |
|
191 |
document.getElementById('attributeTypeSelection').classList.add('hidden'); |
|
192 |
document.getElementById('matchTypeSelection').classList.add('hidden'); |
|
193 |
} |
|
194 |
}); |
|
195 |
|
|
196 | 165 |
// search |
197 | 166 |
document.getElementById('searchText').addEventListener('keyup', function(e) { |
198 | 167 |
// enter key |
... | ... | |
361 | 330 |
|
362 | 331 |
self.loader.disable(); |
363 | 332 |
|
364 |
self.filter.initializeSelectors(self.archetype.vertex); |
|
365 |
|
|
366 | 333 |
}, function(xhr) { |
367 | 334 |
switch (xhr.status) { |
368 | 335 |
case 401: |
sources/src/main/webapp/js/filter.js | ||
---|---|---|
1 |
/** |
|
2 |
* Class is used for manipulation with filters |
|
3 |
* @constructor |
|
4 |
*/ |
|
5 |
function Filter() { |
|
6 |
|
|
7 |
/** |
|
8 |
* Function add values from input list to archetype selector. |
|
9 |
* @param vertexArchetypes list of vertex archetypes |
|
10 |
*/ |
|
11 |
this.initializeSelectors = function(vertexArchetypes) { |
|
12 |
|
|
13 |
let vertexArchetypeSelection = document.getElementById('vertexArchetypeSelection'); |
|
14 |
|
|
15 |
vertexArchetypes.forEach(function(archetype) { |
|
16 |
let option = document.createElement("option"); |
|
17 |
option.text = archetype.name; |
|
18 |
option.value = archetype.name; |
|
19 |
vertexArchetypeSelection.add(option); |
|
20 |
}); |
|
21 |
}; |
|
22 |
|
|
23 |
/** |
|
24 |
* Function remove all options from archetype selector. |
|
25 |
*/ |
|
26 |
this.resetSelectors = function () { |
|
27 |
let vertexArchetypeSelection = document.getElementById('vertexArchetypeSelection'); |
|
28 |
|
|
29 |
while (vertexArchetypeSelection.length > 0){ |
|
30 |
vertexArchetypeSelection.remove(0); |
|
31 |
} |
|
32 |
} |
|
33 |
|
|
34 |
} |
sources/src/main/webapp/showGraph.jsp | ||
---|---|---|
44 | 44 |
<script src="js/constants.js"></script> |
45 | 45 |
<script src="js/coordinates.js"></script> |
46 | 46 |
<script src="js/diagram.js"></script> |
47 |
<script src="js/filter.js"></script> |
|
48 | 47 |
<script src="js/forceDirected.js"></script> |
49 | 48 |
<script src="js/graphLoader.js"></script> |
50 | 49 |
<script src="js/graphExporter.js"></script> |
... | ... | |
79 | 78 |
<li> |
80 | 79 |
<hr class="navbar-separator"> |
81 | 80 |
</li> |
82 |
<li> |
|
83 |
<button class="btn toggle-filters" id="toggleFilters">Filters</button> |
|
84 |
</li> |
|
85 |
<li> |
|
86 |
<hr class="navbar-separator"> |
|
87 |
</li> |
|
88 | 81 |
<li> |
89 | 82 |
<input class="search-text" id="searchText" type="text" placeholder="Search components..."> |
90 | 83 |
<button class="btn search" id="search"><img src="images/search.png" title="search" alt="search"></button> |
... | ... | |
169 | 162 |
</nav> |
170 | 163 |
</header> |
171 | 164 |
|
172 |
<div class="filterBar hidden" id="filters"> |
|
173 |
<div class="filterbar-nav"> |
|
174 |
<button class="button buttonClassic" id="addFilter">Add filter</button> |
|
175 |
<button class="button buttonClassic" id="deleteFilter">Delete filter</button> |
|
176 |
<select id="filterTypeSelection"> |
|
177 |
<option value="Archetype"> Archetype </option> |
|
178 |
<option value="Attribute"> Attribute </option> |
|
179 |
<option value="Logical"> Logical </option> |
|
180 |
</select> |
|
181 |
<select id="vertexArchetypeSelection"></select> |
|
182 |
<select class="hidden" id="attributeTypeSelection"> |
|
183 |
<option value="Enum"> Enum </option> |
|
184 |
<option value="String"> String </option> |
|
185 |
<option value="Number"> Number </option> |
|
186 |
<option value="Date"> Date </option> |
|
187 |
</select> |
|
188 |
<select class="hidden" id="logicOperationSelection"> |
|
189 |
<option value="And"> And </option> |
|
190 |
<option value="Or"> Or </option> |
|
191 |
<option value="Xor"> Xor </option> |
|
192 |
</select> |
|
193 |
<select id="matchTypeSelection"> |
|
194 |
<option value="Match"> Match </option> |
|
195 |
<option value="NotMatch"> Not Match </option> |
|
196 |
</select> |
|
197 |
</div> |
|
198 |
|
|
199 |
<div class="vertex-tree" id="vertexTree"> |
|
200 |
<ul class="vertexTreeList"> |
|
201 |
<li class="vertexTreeItem" id="1"> |
|
202 |
<span> |
|
203 |
Vertex Filters |
|
204 |
</span> |
|
205 |
</li> |
|
206 |
</ul> |
|
207 |
</div> |
|
208 |
</div> |
|
209 |
|
|
210 | 165 |
<main class="graph-content" id="content"></main> |
211 | 166 |
</div> |
212 | 167 |
|
Také k dispozici: Unified diff
dropped Filter (it is not ready for merging into master, revert this commit in a separate feature branch)