Revize 7e9b3050
Přidáno uživatelem Patrik Harag před téměř 6 roky(ů)
sources/imiger-core/src/main/java/cz/zcu/kiv/offscreen/servlets/UploadFiles.java | ||
---|---|---|
65 | 65 |
Map<String, String> formFields = fileLoader.loadFormFields(); |
66 | 66 |
String fileType = formFields.get("fileFormat"); |
67 | 67 |
String fileName = formFields.get("filename"); |
68 |
String initialElimination = formFields.get("enableInitialElimination"); |
|
68 | 69 |
|
69 | 70 |
if (fileType == null || fileName == null) { |
70 | 71 |
throw new IllegalArgumentException("Missing parameter"); |
... | ... | |
85 | 86 |
request.getSession().setAttribute("diagram_string", fileContent); |
86 | 87 |
request.getSession().setAttribute("diagram_type", fileType); |
87 | 88 |
request.getSession().setAttribute("diagram_filename", fileName); |
89 |
request.getSession().setAttribute("diagram_initial_elimination", |
|
90 |
initialElimination != null ? initialElimination : "false"); |
|
88 | 91 |
response.sendRedirect(getServletContext().getInitParameter("APP_HOME_URL") + "graph"); |
89 | 92 |
logger.debug("send redirect to /graph"); |
90 | 93 |
|
sources/imiger-core/src/main/java/cz/zcu/kiv/offscreen/servlets/api/GetSessionDiagram.java | ||
---|---|---|
40 | 40 |
String diagramToDisplay = (String) request.getSession().getAttribute("diagram_string"); |
41 | 41 |
String diagramType = (String) request.getSession().getAttribute("diagram_type"); |
42 | 42 |
String filename = (String) request.getSession().getAttribute("diagram_filename"); |
43 |
String initialElimination = (String) request.getSession().getAttribute("diagram_initial_elimination"); |
|
43 | 44 |
|
44 | 45 |
if (StringUtils.isNotBlank(diagramToDisplay) && diagramType != null) { |
45 | 46 |
|
... | ... | |
61 | 62 |
JsonObject jsonObject = new JsonObject(); |
62 | 63 |
jsonObject.addProperty("graph_json", rawJson); |
63 | 64 |
jsonObject.addProperty("name", filename); |
65 |
jsonObject.addProperty("initial_elimination", initialElimination); |
|
64 | 66 |
|
65 | 67 |
response.setStatus(HttpServletResponse.SC_OK); |
66 | 68 |
response.getWriter().write(jsonObject.toString()); |
sources/imiger-core/src/main/webapp/js/services/graphLoader.js | ||
---|---|---|
9 | 9 |
/** |
10 | 10 |
* Loads a new graph using graph data passed as parameters. |
11 | 11 |
* @param {object} data Data of the graph. |
12 |
* @param {boolean} enableInitialElimination Enable initial elimination |
|
12 | 13 |
* @throws {AJVValidationError} Thrown when graph data are incomplete. |
13 | 14 |
*/ |
14 |
run(data) { |
|
15 |
run(data, enableInitialElimination) {
|
|
15 | 16 |
let isValid = this._ajv.validate(GraphLoader.rawInputSchema, data); |
16 | 17 |
if (isValid === false) { |
17 | 18 |
throw new AJVValidationError(this._ajv.errorsText(), this._ajv.errors); |
... | ... | |
183 | 184 |
}); |
184 | 185 |
} |
185 | 186 |
|
187 |
if (enableInitialElimination) { |
|
188 |
let MAX_VISIBLE_COMPONENTS = 20; |
|
189 |
new InitialElimination(MAX_VISIBLE_COMPONENTS).run(); |
|
190 |
} |
|
191 |
|
|
186 | 192 |
// center viewport |
187 | 193 |
app.viewportComponent.center(); |
188 | 194 |
|
... | ... | |
198 | 204 |
if (Utils.isDefined(highlightedNode)) { |
199 | 205 |
highlightedNode.highlightWithNeighbours(true); |
200 | 206 |
} |
201 |
|
|
202 |
let MAX_VISIBLE_COMPONENTS = 20; |
|
203 |
new InitialElimination(MAX_VISIBLE_COMPONENTS).run(); |
|
204 | 207 |
} |
205 | 208 |
} |
206 | 209 |
|
sources/imiger-core/src/main/webapp/js/showGraphApp.js | ||
---|---|---|
253 | 253 |
document.dispatchEvent(new DiagramUpdatedEvent(graphData)); |
254 | 254 |
|
255 | 255 |
// construct graph |
256 |
this.graphLoader.run(JSON.parse(graphData.graph_json)); |
|
256 |
let initialElimination = (graphData.initial_elimination === undefined) |
|
257 |
? true : graphData.initial_elimination == 'true'; |
|
258 |
this.graphLoader.run(JSON.parse(graphData.graph_json), initialElimination); |
|
257 | 259 |
|
258 | 260 |
this.spinLoaderComponent.disable(); |
259 | 261 |
|
sources/imiger-core/src/main/webapp/uploadFiles.jsp | ||
---|---|---|
78 | 78 |
</c:forEach> |
79 | 79 |
</div> |
80 | 80 |
|
81 |
<div class="form-field"> |
|
82 |
<input type="checkbox" id="enableInitialElimination" name="enableInitialElimination" value="true" checked> |
|
83 |
<label for="enableInitialElimination">Initial elimination</label><br> |
|
84 |
</div> |
|
85 |
|
|
81 | 86 |
<button id="btnLoad" type="submit">Start visualization</button> |
82 | 87 |
</form> |
83 | 88 |
</section> |
Také k dispozici: Unified diff
Make initial elimination optional (refs #7518)