Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
c86abaf5
Commit
c86abaf5
authored
Jan 20, 2010
by
Matt Strum
Browse files
Nightly build for supporting exporting a DOT file for component managers
parent
74ff2478
Changes
3
Show whitespace changes
Inline
Side-by-side
protogeni/demo/map/src/pgmap/ChooseComponentManagerWindow.mxml
View file @
c86abaf5
...
@@ -191,6 +191,19 @@
...
@@ -191,6 +191,19 @@
main
.
rspecView
.
loadXml
(
cm
.
Rspec
)
;
main
.
rspecView
.
loadXml
(
cm
.
Rspec
)
;
})
;
})
;
cmHbox
.
addChild
(
rspecButton
)
;
cmHbox
.
addChild
(
rspecButton
)
;
var
dotButton
:
Button
=
new
Button
()
;
dotButton
.
label
=
"."
;
dotButton
.
addEventListener
(
MouseEvent
.
CLICK
,
function
openDot
()
:
void
{
var
cw
:
ConsoleWindow
=
new
ConsoleWindow
()
;
PopUpManager
.
addPopUp
(
cw
,
main
,
false
)
;
PopUpManager
.
centerPopUp
(
cw
)
;
cw
.
title
=
"dot format from "
+
cm
.
Hrn
;
cw
.
txt
.
text
=
cm
.
getDotGraph
()
;
})
;
cmHbox
.
addChild
(
dotButton
)
;
}
}
if
(
cm
.
Message
.
length
>
0
)
if
(
cm
.
Message
.
length
>
0
)
...
...
protogeni/demo/map/src/pgmap/Common.as
View file @
c86abaf5
...
@@ -125,6 +125,14 @@
...
@@ -125,6 +125,14 @@
return
phrase
.
substring
(
1
,
0
).
toUpperCase
()
+
phrase
.
substring
(
1
)
;
return
phrase
.
substring
(
1
,
0
).
toUpperCase
()
+
phrase
.
substring
(
1
)
;
}
}
public
static
function
replaceString
(
original
:
String
,
find
:
String
,
replace
:
String
)
:
String
{
return
original
.
split
(
find
).
join
(
replace
)
;
}
public
static
function
getDotString
(
name
:
String
)
:
String
{
return
replaceString
(
replaceString
(
name
,
"."
,
""
),
"-"
,
""
)
;
}
// Shortens the given string to a length, taking out from the middle
// Shortens the given string to a length, taking out from the middle
public
static
function
shortenString
(
phrase
:
String
,
size
:
int
)
:
String
{
public
static
function
shortenString
(
phrase
:
String
,
size
:
int
)
:
String
{
if
(
phrase
.
length
<
size
)
if
(
phrase
.
length
<
size
)
...
...
protogeni/demo/map/src/pgmap/ComponentManager.as
View file @
c86abaf5
...
@@ -282,5 +282,35 @@
...
@@ -282,5 +282,35 @@
myIndex
+=
idx
;
myIndex
+=
idx
;
}
}
public
function
getDotGraph
()
:
String
{
var
added
:
Dictionary
=
new
Dictionary
()
;
var
dot
:
String
=
"graph "
+
Common
.
getDotString
(
Hrn
)
+
" {\n"
+
"\toverlap=scale;\n"
;
for
each
(
var
currentNodeGroup
:
PhysicalNodeGroup
in
Nodes
.
collection
)
{
for
each
(
var
currentNode
:
PhysicalNode
in
currentNodeGroup
.
collection
)
{
// Give any special node characteristics
for
each
(
var
d
:
NodeType
in
currentNode
.
types
)
{
if
(
d
.
name
==
"switch"
)
dot
+=
"\t"
+
Common
.
getDotString
(
currentNode
.
name
)
+
" [shape=box, style=bold];\n"
;
}
// Add connections
for
each
(
var
connectedNode
:
PhysicalNode
in
currentNode
.
GetNodes
())
{
if
(
added
[
connectedNode
.
urn
]
!=
null
)
continue
;
dot
+=
"\t"
+
Common
.
getDotString
(
currentNode
.
name
)
+
" -- "
+
Common
.
getDotString
(
connectedNode
.
name
)
+
";\n"
;
}
if
(
currentNode
.
subNodes
!=
null
&&
currentNode
.
subNodes
.
length
>
0
)
{
for
each
(
var
subNode
:
PhysicalNode
in
currentNode
.
subNodes
)
{
dot
+=
"\t"
+
Common
.
getDotString
(
currentNode
.
name
)
+
" -- "
+
Common
.
getDotString
(
subNode
.
name
)
+
";\n"
;
}
}
added
[
currentNode
.
urn
]
=
currentNode
;
}
}
return
dot
+
"}"
;
}
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment