Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WebGUI
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kieker
WebGUI
Commits
53d6af75
Commit
53d6af75
authored
11 years ago
by
Nils Christian Ehmke
Browse files
Options
Downloads
Patches
Plain Diff
Improved the handling of new edges.
parent
71f0195f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java
+41
-27
41 additions, 27 deletions
...webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java
with
41 additions
and
27 deletions
Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java
+
41
−
27
View file @
53d6af75
...
...
@@ -36,6 +36,7 @@ import kieker.webgui.web.beans.session.UserBean;
import
org.primefaces.context.RequestContext
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.emf.ecore.EObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
...
...
@@ -114,8 +115,10 @@ public class CurrentAnalysisEditorGraphBean {
private
static
final
String
JS_CMD_LOAD_FROM_LAYOUT
=
"graph.loadPositions('%s')"
;
private
static
final
String
JS_CMD_RENAME_NODE
=
"graph.setNodeData('%s', {'name' : '%s'})"
;
private
final
Registry
<
MIRepositoryConnector
>
repositoryPortMap
=
new
Registry
<
MIRepositoryConnector
>();
private
final
Registry
<
MIPort
>
filterPortMap
=
new
Registry
<
MIPort
>();
/**
* We store both instance of MIRepositoryConnector and MIPort in this map. This is necessary as we have to find the correct port when an edge has been created.
*/
private
final
Registry
<
EObject
>
portMap
=
new
Registry
<
EObject
>();
private
final
Registry
<
MIAnalysisComponent
>
componentMap
=
new
Registry
<
MIAnalysisComponent
>();
private
CurrentAnalysisEditorBean
currentAnalysisEditorBean
;
...
...
@@ -330,26 +333,37 @@ public class CurrentAnalysisEditorGraphBean {
public
void
edgeCreated
()
{
// Get the parameters
final
Object
[]
parameters
=
GlobalPropertiesBean
.
convertObjectsFromParameterMap
(
PARAMETER_NAMES_ADD_AND_REMOVE_EDGES
,
PARAMETER_TYPES_ADD_AND_REMOVE_EDGES
);
final
String
sourcePortID
=
((
String
)
parameters
[
0
]).
split
(
"\\."
)[
1
];
final
String
targetPortID
=
((
String
)
parameters
[
1
]).
split
(
"\\."
)[
1
];
final
String
sourceIDAsStr
=
((
String
)
parameters
[
0
]).
split
(
"\\."
)[
0
];
final
String
sourcePortIDAsStr
=
((
String
)
parameters
[
0
]).
split
(
"\\."
)[
1
];
final
String
targetIDAsStr
=
((
String
)
parameters
[
1
]).
split
(
"\\."
)[
0
];
final
String
targetPortIDAsStr
=
((
String
)
parameters
[
1
]).
split
(
"\\."
)[
1
];
// Now search the correct components
try
{
if
(
REPOSITORY_INPUT_PORT
.
equals
(
targetPortID
))
{
// This is a special case: An edge between a filter and a repository
final
MIRepositoryConnector
sourcePort
=
this
.
repositoryPortMap
.
get
(
Integer
.
parseInt
(
sourcePortID
));
final
String
targetID
=
((
String
)
parameters
[
1
]).
split
(
"\\."
)[
0
];
final
MIAnalysisComponent
targetRepo
=
this
.
componentMap
.
get
(
Integer
.
parseInt
(
targetID
.
substring
(
2
)));
if
((
sourcePort
!=
null
)
&&
(
targetRepo
instanceof
MIRepository
)
&&
(
this
.
currentAnalysisEditorBean
!=
null
))
{
this
.
currentAnalysisEditorBean
.
edgeCreated
(
sourcePort
,
(
MIRepository
)
targetRepo
);
}
}
else
{
// This is the normal case: An edge between two filters
final
MIPort
sourcePort
=
this
.
filterPortMap
.
get
(
Integer
.
parseInt
(
sourcePortID
));
final
MIPort
targetPort
=
this
.
filterPortMap
.
get
(
Integer
.
parseInt
(
targetPortID
));
if
((
sourcePort
!=
null
)
&&
(
targetPort
!=
null
)
&&
(
this
.
currentAnalysisEditorBean
!=
null
))
{
this
.
currentAnalysisEditorBean
.
edgeCreated
((
MIOutputPort
)
sourcePort
,
(
MIInputPort
)
targetPort
);
// Convert the IDs
final
int
sourceID
=
Integer
.
parseInt
(
sourceIDAsStr
.
substring
(
2
));
final
int
sourcePortID
=
Integer
.
parseInt
(
sourcePortIDAsStr
);
final
int
targetID
=
Integer
.
parseInt
(
targetIDAsStr
.
substring
(
2
));
this
.
componentMap
.
get
(
sourceID
);
final
MIAnalysisComponent
target
=
this
.
componentMap
.
get
(
targetID
);
// There are only two allowed cases: A connection between two filters with regular ports and a connection between a filter and a repository using the
// repository ports.
if
(!
REPOSITORY_INPUT_PORT
.
equals
(
sourcePortIDAsStr
))
{
// Source is not the special port of a repository
final
EObject
sourcePort
=
this
.
portMap
.
get
(
sourcePortID
);
if
(
REPOSITORY_INPUT_PORT
.
equals
(
targetPortIDAsStr
))
{
// Target is the special port of a repository
if
(
sourcePort
instanceof
MIRepositoryConnector
)
{
this
.
currentAnalysisEditorBean
.
edgeCreated
((
MIRepositoryConnector
)
sourcePort
,
(
MIRepository
)
target
);
}
}
else
{
// Target is not the special port of a repository
final
int
targetPortID
=
Integer
.
parseInt
(
targetPortIDAsStr
);
final
EObject
targetPort
=
this
.
portMap
.
get
(
targetPortID
);
if
((
sourcePort
instanceof
MIOutputPort
)
&&
(
targetPort
instanceof
MIInputPort
))
{
this
.
currentAnalysisEditorBean
.
edgeCreated
((
MIOutputPort
)
sourcePort
,
(
MIInputPort
)
targetPort
);
}
}
}
}
catch
(
final
NumberFormatException
ex
)
{
...
...
@@ -372,7 +386,7 @@ public class CurrentAnalysisEditorGraphBean {
try
{
if
(
CurrentAnalysisEditorGraphBean
.
REPOSITORY_INPUT_PORT
.
equals
(
targetPortID
))
{
// This is a special case: An edge between a filter and a repository
final
MIRepositoryConnector
sourcePort
=
this
.
r
epository
P
ortMap
.
get
(
Integer
.
parseInt
(
sourcePortID
));
final
MIRepositoryConnector
sourcePort
=
(
MIR
epository
Connector
)
this
.
p
ortMap
.
get
(
Integer
.
parseInt
(
sourcePortID
));
final
String
targetID
=
((
String
)
parameters
[
1
]).
split
(
"\\."
)[
0
];
final
MIAnalysisComponent
targetRepo
=
this
.
componentMap
.
get
(
Integer
.
parseInt
(
targetID
.
substring
(
2
)));
if
((
sourcePort
!=
null
)
&&
(
targetRepo
instanceof
MIRepository
)
&&
(
this
.
currentAnalysisEditorBean
!=
null
))
{
...
...
@@ -380,8 +394,8 @@ public class CurrentAnalysisEditorGraphBean {
}
}
else
{
// This is the normal case: An edge between two filters
final
MIPort
sourcePort
=
this
.
filterP
ortMap
.
get
(
Integer
.
parseInt
(
sourcePortID
));
final
MIPort
targetPort
=
this
.
filterP
ortMap
.
get
(
Integer
.
parseInt
(
targetPortID
));
final
MIPort
sourcePort
=
(
MIPort
)
this
.
p
ortMap
.
get
(
Integer
.
parseInt
(
sourcePortID
));
final
MIPort
targetPort
=
(
MIPort
)
this
.
p
ortMap
.
get
(
Integer
.
parseInt
(
targetPortID
));
if
((
sourcePort
!=
null
)
&&
(
targetPort
!=
null
)
&&
(
this
.
currentAnalysisEditorBean
!=
null
))
{
this
.
currentAnalysisEditorBean
.
edgeRemoved
((
MIOutputPort
)
sourcePort
,
(
MIInputPort
)
targetPort
);
...
...
@@ -511,7 +525,7 @@ public class CurrentAnalysisEditorGraphBean {
builder
.
append
(
','
);
}
builder
.
append
(
String
.
format
(
JS_TEMPLATE_PORT
,
CurrentAnalysisEditorGraphBean
.
simpleEscape
(
port
.
getName
()),
this
.
filterP
ortMap
.
get
(
port
),
builder
.
append
(
String
.
format
(
JS_TEMPLATE_PORT
,
CurrentAnalysisEditorGraphBean
.
simpleEscape
(
port
.
getName
()),
this
.
p
ortMap
.
get
(
port
),
CurrentAnalysisEditorGraphBean
.
simpleEscape
(
port
.
getName
())));
}
...
...
@@ -537,7 +551,7 @@ public class CurrentAnalysisEditorGraphBean {
builder
.
append
(
','
);
}
builder
.
append
(
String
.
format
(
JS_TEMPLATE_PORT
,
CurrentAnalysisEditorGraphBean
.
simpleEscape
(
port
.
getName
()),
this
.
repositoryP
ortMap
.
get
(
port
),
builder
.
append
(
String
.
format
(
JS_TEMPLATE_PORT
,
CurrentAnalysisEditorGraphBean
.
simpleEscape
(
port
.
getName
()),
this
.
p
ortMap
.
get
(
port
),
CurrentAnalysisEditorGraphBean
.
simpleEscape
(
port
.
getName
())));
}
...
...
@@ -576,7 +590,7 @@ public class CurrentAnalysisEditorGraphBean {
* @return The ID for the port within the graph
*/
private
String
assembleGraphPortID
(
final
MIPlugin
plugin
,
final
MIPort
port
)
{
return
"id"
+
this
.
componentMap
.
get
(
plugin
)
+
"."
+
this
.
filterP
ortMap
.
get
(
port
);
return
"id"
+
this
.
componentMap
.
get
(
plugin
)
+
"."
+
this
.
p
ortMap
.
get
(
port
);
}
/**
...
...
@@ -589,7 +603,7 @@ public class CurrentAnalysisEditorGraphBean {
* @return The ID for the port within the graph
*/
private
Object
assembleGraphPortID
(
final
MIPlugin
plugin
,
final
MIRepositoryConnector
port
)
{
return
"id"
+
this
.
componentMap
.
get
(
plugin
)
+
"."
+
this
.
repositoryP
ortMap
.
get
(
port
);
return
"id"
+
this
.
componentMap
.
get
(
plugin
)
+
"."
+
this
.
p
ortMap
.
get
(
port
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment