Revize fc56d1b6
Přidáno uživatelem Tomáš Šimandl před asi 6 roky(ů)
documents/backend2frontend.json | ||
---|---|---|
39 | 39 |
], |
40 | 40 |
... |
41 | 41 |
], |
42 |
"id": <int>, //identifikátor vrcholu - použito např. při definici odkud kam vede hrana |
|
43 |
"originalId": <int>, //identifikátor vrcholu, který byl použit před zpracováním(filtrací) v backendu |
|
42 |
"id": <int>, //identifikátor vrcholu, který byl použit před zpracováním(filtrací) v backendu |
|
44 | 43 |
"text": <string>, //text pro případné dodatečné info mimo atributy - nemusí být použito, může sloužit jako popisek vrcholu, např. když si uživatel zobrazí jeho detaily, nejdříve se zobrazí tento popisek a až pak hodnoty atributů, může sloužit i jen jako nosič informace, která nebude uživateli přístupná |
45 | 44 |
"title": <string>, //jméno vrcholu |
46 | 45 |
"position": { //obsahuje relativní pozici uzlu v grafu |
... | ... | |
55 | 54 |
{ |
56 | 55 |
"subedgeInfo": [ |
57 | 56 |
{ |
58 |
"originalId": <int>, //identifikátor hrany, který byl použit před zpracováním(filtrací) v backendu
|
|
57 |
"id": <int>, //identifikátor hrany, který byl použit před zpracováním(filtrací) v backendu
|
|
59 | 58 |
"archetype": <int>, //typ hrany (index v poli edgeArchetypes) |
60 | 59 |
"attributes": [ //struktura atributu je vzdy klic - hodnota |
61 | 60 |
[ |
... | ... | |
86 | 85 |
|
87 | 86 |
"groups": [ //obsahuje jednotlivé skupiny uzlů |
88 | 87 |
{ |
89 |
"groupId": <int>, //identifikátor skupiny |
|
90 |
"id": <int>, //identifikátor, který je jedinečný v rámci skupin i všech uzlů |
|
88 |
"id": <int>, //identifikátor skupiny |
|
91 | 89 |
"name": <string>, //název skupiny |
92 | 90 |
"verticesId": [<int>, <int>, ...], //original id uzlu, které jsou ve skupině |
93 | 91 |
"verticesEdgeFromId": [<int>, <int>, ...], //identifikátory uzlů, jejichž odchozí hrany jsou viditelné v grafu |
sources/src/main/java/cz/zcu/kiv/offscreen/api/Graph.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
private List<Group> groups; |
23 | 23 |
private List<SideBar> sideBar; |
24 |
private int selectedVertex;
|
|
25 |
private int selectedEdge;
|
|
24 |
private int highlightedVertex;
|
|
25 |
private int highlightedEdge;
|
|
26 | 26 |
|
27 | 27 |
private Logger logger = Logger.getLogger(Graph.class); |
28 | 28 |
|
... | ... | |
36 | 36 |
this.possibleEnumValues = graph.getPossibleEnumValues(); |
37 | 37 |
this.groups = graph.getGraphState().getGroups(); |
38 | 38 |
this.sideBar = graph.getGraphState().getSideBar(); |
39 |
this.selectedVertex = graph.getGraphState().getSelectedVertex();
|
|
40 |
this.selectedEdge = graph.getGraphState().getSelectedEdge();
|
|
39 |
this.highlightedVertex = graph.getGraphState().getHighlightedVertex();
|
|
40 |
this.highlightedEdge = graph.getGraphState().getHighlightedEdge();
|
|
41 | 41 |
logger.trace("EXIT"); |
42 | 42 |
} |
43 | 43 |
|
... | ... | |
77 | 77 |
return sideBar; |
78 | 78 |
} |
79 | 79 |
|
80 |
public int getSelectedVertex() {
|
|
81 |
return selectedVertex;
|
|
80 |
public int getHighlightedVertex() {
|
|
81 |
return highlightedVertex;
|
|
82 | 82 |
} |
83 | 83 |
|
84 |
public int getSelectedEdge() {
|
|
85 |
return selectedEdge;
|
|
84 |
public int getHighlightedEdge() {
|
|
85 |
return highlightedEdge;
|
|
86 | 86 |
} |
87 | 87 |
} |
sources/src/main/java/cz/zcu/kiv/offscreen/api/SideBar.java | ||
---|---|---|
8 | 8 |
/** Identification number of vertex or group which was generated in application. */ |
9 | 9 |
private int vertexId; |
10 | 10 |
/** Indicates if related vertexes of this item have visible icon which shows relation with this item. */ |
11 |
private boolean highlighted;
|
|
11 |
private boolean isIconsDisplayed;
|
|
12 | 12 |
|
13 |
public SideBar(int vertexId, boolean highlighted) {
|
|
13 |
public SideBar(int vertexId, boolean isIconsDisplayed) {
|
|
14 | 14 |
this.vertexId = vertexId; |
15 |
this.highlighted = highlighted;
|
|
15 |
this.isIconsDisplayed = isIconsDisplayed;
|
|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
public int getVertexId() { |
... | ... | |
23 | 23 |
this.vertexId = vertexId; |
24 | 24 |
} |
25 | 25 |
|
26 |
public boolean isHighlighted() {
|
|
27 |
return highlighted;
|
|
26 |
public boolean isIconsDisplayed() {
|
|
27 |
return isIconsDisplayed;
|
|
28 | 28 |
} |
29 | 29 |
|
30 |
public void setHighlighted(boolean highlighted) {
|
|
31 |
this.highlighted = highlighted;
|
|
30 |
public void setIconsDisplayed(boolean iconsDisplayed) {
|
|
31 |
this.isIconsDisplayed = iconsDisplayed;
|
|
32 | 32 |
} |
33 | 33 |
} |
sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphState.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
private List<Group> groups = new ArrayList<>(); |
13 | 13 |
private List<SideBar> sideBar = new ArrayList<>(); |
14 |
private int selectedVertex;
|
|
15 |
private int selectedEdge;
|
|
14 |
private int highlightedVertex;
|
|
15 |
private int highlightedEdge;
|
|
16 | 16 |
|
17 | 17 |
|
18 | 18 |
public List<Group> getGroups() { |
... | ... | |
23 | 23 |
return sideBar; |
24 | 24 |
} |
25 | 25 |
|
26 |
public int getSelectedVertex() {
|
|
27 |
return selectedVertex;
|
|
26 |
public int getHighlightedVertex() {
|
|
27 |
return highlightedVertex;
|
|
28 | 28 |
} |
29 | 29 |
|
30 |
public int getSelectedEdge() {
|
|
31 |
return selectedEdge;
|
|
30 |
public int getHighlightedEdge() {
|
|
31 |
return highlightedEdge;
|
|
32 | 32 |
} |
33 | 33 |
|
34 | 34 |
public void addGroup(Group group){ |
... | ... | |
47 | 47 |
this.sideBar.addAll(collection); |
48 | 48 |
} |
49 | 49 |
|
50 |
public void setSelectedVertex(int selectedVertex) {
|
|
51 |
this.selectedVertex = selectedVertex;
|
|
50 |
public void setHighlightedVertex(int highlightedVertex) {
|
|
51 |
this.highlightedVertex = highlightedVertex;
|
|
52 | 52 |
} |
53 | 53 |
|
54 |
public void setSelectedEdge(int selectedEdge) {
|
|
55 |
this.selectedEdge = selectedEdge;
|
|
54 |
public void setHighlightedEdge(int highlightedEdge) {
|
|
55 |
this.highlightedEdge = highlightedEdge;
|
|
56 | 56 |
} |
57 | 57 |
} |
sources/src/main/webapp/js/graphExporter.js | ||
---|---|---|
27 | 27 |
var sideBar = excludedNodeList.map(function(node) { |
28 | 28 |
return { |
29 | 29 |
id: app.utils.getUniqueId(node), |
30 |
isHighlighted: node.isIconsDisplayed(),
|
|
30 |
isIconsDisplayed: node.isIconsDisplayed(),
|
|
31 | 31 |
}; |
32 | 32 |
}); |
33 | 33 |
|
... | ... | |
51 | 51 |
possibleEnumValues: app.possibleEnumValues, |
52 | 52 |
groups: groups, |
53 | 53 |
sideBar: sideBar, |
54 |
selectedVertex: app.utils.getUniqueId(highlightedVertex), // selected = highlighted
|
|
55 |
selectedEdge: app.utils.isUndefined(highlightedEdge) ? '' : highlightedEdge.id, // selected = highlighted
|
|
54 |
highlightedVertex: app.utils.getUniqueId(highlightedVertex),
|
|
55 |
highlightedEdge: app.utils.isUndefined(highlightedEdge) ? '' : highlightedEdge.id,
|
|
56 | 56 |
}; |
57 | 57 |
} |
58 | 58 |
|
sources/src/main/webapp/js/graphLoader.js | ||
---|---|---|
22 | 22 |
app.attributeTypeList = data.attributeTypes; |
23 | 23 |
app.possibleEnumValues = data.possibleEnumValues; |
24 | 24 |
|
25 |
var selectedNodeId;
|
|
26 |
var selectedNodeType;
|
|
27 |
if (app.utils.isDefined(data.selectedVertex)) {
|
|
28 |
var selectedNodeAttr = data.selectedVertex.split("-");
|
|
29 |
if (selectedNodeAttr.length === 2) {
|
|
30 |
selectedNodeType = selectedNodeAttr[0];
|
|
31 |
selectedNodeId = parseInt(selectedNodeAttr[1], 10);
|
|
25 |
var highlightedNodeId;
|
|
26 |
var highlightedNodeType;
|
|
27 |
if (app.utils.isDefined(data.highlightedVertex)) {
|
|
28 |
var highlightedNodeAttr = data.highlightedVertex.split("-");
|
|
29 |
if (highlightedNodeAttr.length === 2) {
|
|
30 |
highlightedNodeType = highlightedNodeAttr[0];
|
|
31 |
highlightedNodeId = parseInt(highlightedNodeAttr[1], 10);
|
|
32 | 32 |
} |
33 | 33 |
} |
34 |
var selectedEdgeId = parseInt(data.selectedEdge, 10);
|
|
34 |
var highlightedEdgeId = parseInt(data.highlightedEdge, 10);
|
|
35 | 35 |
|
36 |
var selectedNode = undefined;
|
|
37 |
var selectedEdge = undefined;
|
|
36 |
var highlightedNode = undefined;
|
|
37 |
var highlightedEdge = undefined;
|
|
38 | 38 |
|
39 | 39 |
// construct vertices |
40 | 40 |
var vertexMap = {}; |
41 | 41 |
data.vertices.forEach(function(component) { |
42 | 42 |
var vertex = new Vertex(component); |
43 | 43 |
|
44 |
if (selectedNodeType === 'vertex' && selectedNodeId === vertex.id ){
|
|
45 |
selectedNode = vertex;
|
|
44 |
if (highlightedNodeType === 'vertex' && highlightedNodeId === vertex.id ){
|
|
45 |
highlightedNode = vertex;
|
|
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
var position = component.position; |
... | ... | |
68 | 68 |
data.edges.forEach(function(component) { |
69 | 69 |
var edge = new Edge(component); |
70 | 70 |
|
71 |
if (selectedEdgeId === edge.id ){
|
|
72 |
selectedEdge = edge;
|
|
71 |
if (highlightedEdgeId === edge.id ){
|
|
72 |
highlightedEdge = edge;
|
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
var fromNode = vertexMap[component.from]; |
... | ... | |
113 | 113 |
data.groups.forEach(function(component) { |
114 | 114 |
var group = new Group(component); |
115 | 115 |
|
116 |
if (selectedNodeType === 'group' && selectedNodeId === group.id ){
|
|
117 |
selectedNode = group;
|
|
116 |
if (highlightedNodeType === 'group' && highlightedNodeId === group.id ){
|
|
117 |
highlightedNode = group;
|
|
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
// vertices |
... | ... | |
165 | 165 |
}); |
166 | 166 |
|
167 | 167 |
if (app.utils.isDefined(node)) { |
168 |
node.exclude(excludedNode.isHighlighted);
|
|
168 |
node.exclude(excludedNode.isIconsDisplayed);
|
|
169 | 169 |
|
170 | 170 |
app.sidebarComponent.excludedNodeListComponent.add(node); |
171 | 171 |
} |
... | ... | |
177 | 177 |
// update status bar |
178 | 178 |
app.sidebarComponent.statusBarComponent.setComponentCount(data.vertices.length); |
179 | 179 |
|
180 |
if (app.utils.isDefined(selectedEdge)) {
|
|
181 |
selectedEdge.setHighlighted(true);
|
|
182 |
selectedEdge.getFrom().setHighlighted(true);
|
|
183 |
selectedEdge.getTo().setHighlighted(true);
|
|
180 |
if (app.utils.isDefined(highlightedEdge)) {
|
|
181 |
highlightedEdge.setHighlighted(true);
|
|
182 |
highlightedEdge.getFrom().setHighlighted(true);
|
|
183 |
highlightedEdge.getTo().setHighlighted(true);
|
|
184 | 184 |
} |
185 |
if (app.utils.isDefined(selectedNode)) selectedNode.setHighlightedWithNeighbours(true);
|
|
185 |
if (app.utils.isDefined(highlightedNode)) highlightedNode.setHighlightedWithNeighbours(true);
|
|
186 | 186 |
}; |
187 | 187 |
|
188 | 188 |
} |
Také k dispozici: Unified diff
rename attributes in b2f JSON to correspond with frontend