Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0356f5a9

Přidáno uživatelem Tomáš Šimandl před asi 6 roky(ů)

Added vertex archetype initialization + hide of unused selectors

Zobrazit rozdíly:

sources/src/main/webapp/js/app.js
23 23
	this.cookies = new Cookies;
24 24
	/** @prop {MarkSymbol} markSymbol */
25 25
	this.markSymbol = new MarkSymbol;
26
	/** @prop {Filter} filter */
27
	this.filter = new Filter;
26 28

  
27 29
	/** @prop {string} HOME_URL Application home URL. */
28 30
	this.HOME_URL = null;
......
87 89
	this.reset = function() {
88 90
		app.viewportComponent.reset();
89 91
		app.sidebarComponent.reset();
92
        app.filter.resetSelectors();
90 93

  
91 94
		app.edgeList = [];
92 95
		app.nodeList = [];
......
159 162
			document.getElementById('filters').classList.toggle('hidden');
160 163
		});
161 164

  
165

  
166
		document.getElementById('filterTypeSelection').addEventListener('change', function (e) {
167
			var selected = this.value;
168
			if(selected === 'Archetype') {
169
                document.getElementById('vertexArchetypeSelection').classList.remove('hidden');
170
                document.getElementById('logicOperationSelection').classList.add('hidden');
171
                document.getElementById('attributeTypeSelection').classList.add('hidden');
172
                document.getElementById('matchTypeSelection').classList.remove('hidden');
173

  
174
            } else if (selected === 'Attribute') {
175
                document.getElementById('vertexArchetypeSelection').classList.add('hidden');
176
                document.getElementById('logicOperationSelection').classList.add('hidden');
177
                document.getElementById('attributeTypeSelection').classList.remove('hidden');
178
                document.getElementById('matchTypeSelection').classList.remove('hidden');
179

  
180
			} else if (selected === 'Logical') {
181
                document.getElementById('vertexArchetypeSelection').classList.add('hidden');
182
				document.getElementById('logicOperationSelection').classList.remove('hidden');
183
                document.getElementById('attributeTypeSelection').classList.add('hidden');
184
                document.getElementById('matchTypeSelection').classList.add('hidden');
185
            }
186
        });
187

  
162 188
		// search
163 189
		document.getElementById('searchText').addEventListener('keyup', function(e) {
164 190
			// enter key
......
344 370

  
345 371
			self.loader.disable();
346 372

  
373
			self.filter.initializeSelectors(self.archetype.vertex);
374

  
347 375
		}, function() {
348 376
			// go to the upload page
349 377
			window.location.replace('./');
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
38 38

  
39 39
		<script src="js/constants.js"></script>
40 40
		<script src="js/coordinates.js"></script>
41
		<script src="js/filter.js"></script>
41 42
		<script src="js/forceDirected.js"></script>
42 43
		<script src="js/graphLoader.js"></script>
43 44
		<script src="js/graphExporter.js"></script>
......
163 164
							<hr class="navbar-separator">
164 165
						</li>
165 166
						<li>
166
							<button class="btn btn-block view-refresh-reset-diagram" id="view_refresh_reset_diagram" title="Refresh diagram - reset position"></a>
167
							<button class="btn btn-block view-refresh-reset-diagram" id="view_refresh_reset_diagram" title="Refresh diagram - reset position"></button>
167 168
						</li>
168 169
					</ul>
169 170
				</nav>
......
175 176
					<button class="button buttonClassic" id="deleteFilter">Delete filter</button>
176 177
					<select id="filterTypeSelection">
177 178
						<option value="Archetype"> Archetype </option>
178
						<option value="Atribute"> Atribute </option>
179
						<option value="Attribute"> Attribute </option>
179 180
						<option value="Logical"> Logical </option>
180 181
					</select>
181
					<select id="logicOperationSelection" disabled="disabled">
182
						<option value="And"> And </option>
183
						<option value="Or"> Or </option>
184
						<option value="Xor"> Xor </option>
185
					</select>
186
					<select id="attributeTypeSelection" disabled="disabled">
182
					<select id="vertexArchetypeSelection"></select>
183
					<select class="hidden" id="attributeTypeSelection">
187 184
						<option value="Enum"> Enum </option>
188 185
						<option value="String"> String </option>
189 186
						<option value="Number"> Number </option>
190 187
						<option value="Date"> Date </option>
191 188
					</select>
189
					<select class="hidden" id="logicOperationSelection">
190
						<option value="And"> And </option>
191
						<option value="Or"> Or </option>
192
						<option value="Xor"> Xor </option>
193
					</select>
194
					<select id="matchTypeSelection">
195
						<option value="Match"> Match </option>
196
						<option value="NotMatch"> Not Match </option>
197
					</select>
192 198
				</div>
193 199

  
194 200
				<div class="vertex-tree" id="vertexTree">

Také k dispozici: Unified diff