Skip to content
GitLab
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-devel
Commits
e22a18cd
Commit
e22a18cd
authored
Dec 15, 2009
by
Matt Strum
Browse files
Updated documentation and removed some of the GEC6 specific code
parent
65c74860
Changes
27
Hide whitespace changes
Inline
Side-by-side
protogeni/demo/map/src/Main.as
View file @
e22a18cd
package
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2009 University of Utah and the Flux Group.
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation.
*
* THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
// Handles some tasks that hide implimentation between the flash and map client
package
{
import
mx
.
controls
.
Alert
;
...
...
protogeni/demo/map/src/pgmap/Common.as
View file @
e22a18cd
package
pgmap
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2009 University of Utah and the Flux Group.
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation.
*
* THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
/* Common.as
Functions used all around the project
*/
package
pgmap
{
import
flash
.
events
.
MouseEvent
;
...
...
@@ -21,6 +40,7 @@ package pgmap
public
static
var
nodeColor
:
Object
=
0x092B9F
;
public
static
var
nodeBorderColor
:
Object
=
0xD2E1F0
;
// Embedded images used around the application
[
Bindable
]
[
Embed
(
source
=
"../../images/tick.png"
)]
public
static
var
availableIcon
:
Class
;
...
...
@@ -53,6 +73,7 @@ package pgmap
[
Embed
(
source
=
"../../images/error.png"
)]
public
static
var
errorIcon
:
Class
;
// Gets an icon for a boolean value
public
static
function
assignIcon
(
val
:
Boolean
)
:
Class
{
if
(
val
)
return
availableIcon
;
...
...
@@ -60,6 +81,7 @@ package pgmap
return
notAvailableIcon
;
}
// Gets the icon for the given node
public
static
function
assignAvailabilityIcon
(
val
:
PhysicalNode
)
:
Class
{
if
(
val
.
virtualNodes
!=
null
&&
val
.
virtualNodes
.
length
>
0
)
return
ownedIcon
;
...
...
@@ -72,6 +94,7 @@ package pgmap
}
}
// Get's the CM icon
public
static
function
assignIconForComponentManager
(
val
:
ComponentManager
)
:
Class
{
if
(
val
.
Status
==
ComponentManager
.
VALID
)
return
availableIcon
;
...
...
@@ -79,6 +102,7 @@ package pgmap
return
notAvailableIcon
;
}
// Takes the given bandwidth and creates a human readable string
public
static
function
kbsToString
(
bandwidth
:
Number
)
:
String
{
var
bw
:
String
=
""
;
if
(
bandwidth
<
1000
)
{
...
...
@@ -91,14 +115,17 @@ package pgmap
return
bw
;
}
// Returns the main class
public
static
function
Main
()
:
pgmap
{
return
mx
.
core
.
Application
.
application
as
pgmap
;
}
// Makes the first letter uppercase
public
static
function
firstToUpper
(
phrase
:
String
)
:
String
{
return
phrase
.
substring
(
1
,
0
).
toUpperCase
()
+
phrase
.
substring
(
1
)
;
}
// Shortens the given string to a length, taking out from the middle
public
static
function
shortenString
(
phrase
:
String
,
size
:
int
)
:
String
{
if
(
phrase
.
length
<
size
)
return
phrase
;
...
...
@@ -108,6 +135,7 @@ package pgmap
return
phrase
.
substring
(
0
,
upTo
)
+
"..."
+
phrase
.
substring
(
upTo
+
removeChars
)
;
}
// Gets a button for the component manager
public
static
function
getComponentManagerButton
(
cm
:
ComponentManager
)
:
Button
{
var
cmButton
:
Button
=
new
Button
()
;
cmButton
.
label
=
cm
.
Hrn
;
...
...
@@ -120,6 +148,7 @@ package pgmap
return
cmButton
;
}
// Gets a button for the physical node
public
static
function
getNodeButton
(
n
:
PhysicalNode
)
:
Button
{
var
nodeButton
:
Button
=
new
Button
()
;
nodeButton
.
label
=
n
.
name
;
...
...
@@ -132,6 +161,7 @@ package pgmap
return
nodeButton
;
}
// Gets a button for a physical link
public
static
function
getLinkButton
(
ni
:
PhysicalNodeInterface
,
nl
:
PhysicalLink
)
:
Button
{
var
linkButton
:
Button
=
new
Button
()
;
linkButton
.
label
=
ni
.
id
;
...
...
@@ -144,6 +174,7 @@ package pgmap
return
linkButton
;
}
// Gets a button for the virtual link
public
static
function
getVirtualLinkButton
(
pl
:
VirtualLink
)
:
Button
{
var
linkButton
:
Button
=
new
Button
()
;
linkButton
.
label
=
pl
.
virtualId
;
...
...
@@ -156,6 +187,7 @@ package pgmap
return
linkButton
;
}
// Opens a virtual link window
public
static
function
viewVirtualLink
(
pl
:
VirtualLink
)
:
void
{
var
plWindow
:
VirtualLinkAdvancedWindow
=
new
VirtualLinkAdvancedWindow
()
;
plWindow
.
main
=
Main
()
;
...
...
@@ -164,6 +196,7 @@ package pgmap
plWindow
.
loadPointLink
(
pl
)
;
}
// Opens a physical link window
public
static
function
viewPhysicalLink
(
l
:
PhysicalLink
)
:
void
{
var
lgWindow
:
PhysicalLinkAdvancedWindow
=
new
PhysicalLinkAdvancedWindow
()
;
lgWindow
.
main
=
Main
()
;
...
...
@@ -172,6 +205,7 @@ package pgmap
lgWindow
.
loadLink
(
l
)
;
}
// Opens a group of physical links
public
static
function
viewPhysicalLinkCollection
(
lc
:
ArrayCollection
)
:
void
{
if
(
lc
.
length
==
1
)
viewPhysicalLink
(
lc
[
0
])
;
...
...
@@ -184,6 +218,7 @@ package pgmap
}
}
// Opens a group of physical links
public
static
function
viewPhysicalLinkGroup
(
lg
:
PhysicalLinkGroup
)
:
void
{
var
lgWindow
:
PhysicalLinkGroupAdvancedWindow
=
new
PhysicalLinkGroupAdvancedWindow
()
;
lgWindow
.
main
=
Main
()
;
...
...
@@ -192,6 +227,7 @@ package pgmap
lgWindow
.
loadGroup
(
lg
)
;
}
// Opens a component manager in a window
public
static
function
viewComponentManager
(
cm
:
ComponentManager
)
:
void
{
var
cmWindow
:
ComponentManagerAdvancedWindow
=
new
ComponentManagerAdvancedWindow
()
;
cmWindow
.
main
=
Main
()
;
...
...
@@ -200,6 +236,7 @@ package pgmap
cmWindow
.
loadCm
(
cm
)
;
}
// Opens a physical node in a window
public
static
function
viewNode
(
n
:
PhysicalNode
)
:
void
{
var
ngWindow
:
PhysicalNodeAdvancedWindow
=
new
PhysicalNodeAdvancedWindow
()
;
ngWindow
.
main
=
Main
()
;
...
...
@@ -208,6 +245,7 @@ package pgmap
ngWindow
.
loadNode
(
n
)
;
}
// Opens a group of physical nodes in a window
public
static
function
viewNodeGroup
(
ng
:
PhysicalNodeGroup
)
:
void
{
var
ngWindow
:
PhysicalNodeGroupAdvancedWindow
=
new
PhysicalNodeGroupAdvancedWindow
()
;
ngWindow
.
main
=
Main
()
;
...
...
@@ -216,6 +254,7 @@ package pgmap
ngWindow
.
loadGroup
(
ng
)
;
}
// Opens a group of physical nodes in a window
public
static
function
viewNodeCollection
(
nc
:
ArrayCollection
)
:
void
{
if
(
nc
.
length
==
1
)
viewNode
(
nc
[
0
])
;
...
...
protogeni/demo/map/src/pgmap/ComponentManager.as
View file @
e22a18cd
package
pgmap
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2009 University of Utah and the Flux Group.
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation.
*
* THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
package
pgmap
{
import
flash
.
utils
.
Dictionary
;
import
mx
.
collections
.
ArrayCollection
;
import
mx
.
controls
.
Alert
;
// Acts as the component manager for physical nodes and links and slivers
public
class
ComponentManager
{
public
static
var
UNKOWN
:
int
=
0
;
...
...
protogeni/demo/map/src/pgmap/NodeType.as
View file @
e22a18cd
...
...
@@ -14,6 +14,7 @@
package
pgmap
{
// Holds the type of a node
public
class
NodeType
{
public
function
NodeType
()
...
...
protogeni/demo/map/src/pgmap/PhysicalLink.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Physical link between nodes
public
class
PhysicalLink
{
public
function
PhysicalLink
(
own
:
PhysicalLinkGroup
)
...
...
protogeni/demo/map/src/pgmap/PhysicalLinkGroup.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Group of physical links
public
class
PhysicalLinkGroup
{
public
var
latitude1
:
Number
=
-1
;
...
...
protogeni/demo/map/src/pgmap/PhysicalLinkGroupCollection.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Collection of all physical link groups
public
class
PhysicalLinkGroupCollection
{
public
function
PhysicalLinkGroupCollection
()
...
...
protogeni/demo/map/src/pgmap/PhysicalNode.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Physical node
public
class
PhysicalNode
{
public
function
PhysicalNode
(
own
:
PhysicalNodeGroup
)
...
...
protogeni/demo/map/src/pgmap/PhysicalNodeGroup.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Group of physical nodes located in one area
public
class
PhysicalNodeGroup
{
public
var
latitude
:
Number
=
-1
;
...
...
protogeni/demo/map/src/pgmap/PhysicalNodeGroupCollection.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Collection of all physical node groups
public
class
PhysicalNodeGroupCollection
{
public
function
PhysicalNodeGroupCollection
()
...
...
protogeni/demo/map/src/pgmap/PhysicalNodeInterface.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Interface on a physical node
public
class
PhysicalNodeInterface
{
public
function
PhysicalNodeInterface
(
own
:
PhysicalNode
)
...
...
protogeni/demo/map/src/pgmap/PhysicalNodeInterfaceCollection.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Collection of interfaces from a physical node
public
class
PhysicalNodeInterfaceCollection
{
public
function
PhysicalNodeInterfaceCollection
()
...
...
protogeni/demo/map/src/pgmap/ProtoGeniHandler.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Holds and handles all information regarding ProtoGENI
public
class
ProtoGeniHandler
{
public
var
main
:
pgmap
;
...
...
protogeni/demo/map/src/pgmap/ProtoGeniMapHandler.as
View file @
e22a18cd
...
...
@@ -22,12 +22,11 @@ package pgmap
import
mx
.
collections
.
ArrayCollection
;
import
mx
.
events
.
FlexEvent
;
// Handles adding all the ProtoGENI info to the Google Map component
public
class
ProtoGeniMapHandler
{
public
var
main
:
pgmap
;
public
function
ProtoGeniMapHandler
()
{
}
...
...
protogeni/demo/map/src/pgmap/ProtoGeniRpcHandler.as
View file @
e22a18cd
...
...
@@ -20,16 +20,10 @@
import
flash
.
utils
.
ByteArray
;
import
mx
.
utils
.
Base64Decoder
;
// Handles all the XML-RPC calls
public
class
ProtoGeniRpcHandler
{
[
Embed
(
source
=
"demo-rspec-full.xml"
,
mimeType
=
"application/octet-stream"
)]
public
static
const
DemoSliceEmbeddedXml
:
Class
;
[
Embed
(
source
=
"delegatedcredential.xml"
,
mimeType
=
"application/octet-stream"
)]
public
static
const
DelegatedCredentialXml
:
Class
;
public
var
op
:
Operation
;
public
var
opName
:
String
;
...
...
@@ -418,20 +412,6 @@
{
if
(
currentIndex
==
main
.
pgHandler
.
CurrentUser
.
slices
.
length
)
{
//
if
(
main
.
pgHandler
.
CurrentUser
.
hrn
.
search
(
"mstrum"
)
>
-1
)
{
currentSlice
=
new
Slice
()
;
currentSlice
.
hrn
=
"gec6"
;
currentSlice
.
creator
=
main
.
pgHandler
.
CurrentUser
;
currentSlice
.
status
=
"Ready"
;
var
ba
:
ByteArray
=
new
DelegatedCredentialXml
()
as
ByteArray
;
currentSlice
.
credential
=
ba
.
readUTFBytes
(
ba
.
length
)
;
main
.
pgHandler
.
CurrentUser
.
slices
.
addItem
(
currentSlice
)
;
totalCalls
++;
}
//
for
each
(
var
s
:
Slice
in
main
.
pgHandler
.
CurrentUser
.
slices
)
{
if
(
s
.
credential
.
length
>
0
)
...
...
protogeni/demo/map/src/pgmap/ResizeWindow.as
View file @
e22a18cd
/**
http://flexdevtips.blogspot.com/2009/03/resizable-containers.html
*/
package
pgmap
{
import
flash
.
display
.
DisplayObject
;
...
...
protogeni/demo/map/src/pgmap/Slice.as
View file @
e22a18cd
...
...
@@ -16,6 +16,7 @@
{
import
mx
.
collections
.
ArrayCollection
;
// Slice that a user created in ProtoGENI
public
class
Slice
{
public
static
var
READY
:
String
=
"ready"
;
...
...
@@ -116,6 +117,7 @@
return
returnString
;
}
// Used to push more important slices to the top of lists
public
function
CompareValue
()
:
int
{
if
(
hrn
==
null
&&
uuid
==
null
)
{
...
...
protogeni/demo/map/src/pgmap/Sliver.as
View file @
e22a18cd
...
...
@@ -18,6 +18,7 @@
import
mx
.
collections
.
ArrayCollection
;
// Sliver from a slice containing all resources from the CM
public
class
Sliver
{
public
static
var
READY
:
String
=
"ready"
;
...
...
protogeni/demo/map/src/pgmap/TooltipOverlay.as
View file @
e22a18cd
/*
/* ORIGINAL LICENSE
* Licensed under the Apache License, Version 2.0 (the "License"):
* http://www.apache.org/licenses/LICENSE-2.0
Code provided in the official examples for Google Maps API for Flash
*/
package
pgmap
{
import
com
.
google
.
maps
.
LatLng
;
...
...
@@ -18,6 +23,7 @@ import flash.text.TextField;
import
flash
.
text
.
TextFieldAutoSize
;
import
flash
.
text
.
TextFormat
;
// Box with text to show as an overlay on Google Maps API for Flash
public
class
TooltipOverlay
extends
OverlayBase
{
private
var
latLng
:
LatLng
;
private
var
label
:
String
;
...
...
protogeni/demo/map/src/pgmap/User.as
View file @
e22a18cd
...
...
@@ -19,6 +19,7 @@
import
mx
.
collections
.
SortField
;
import
mx
.
utils
.
ObjectUtil
;
// ProtoGENI user information
public
class
User
{
[
Bindable
]
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment