Sub Main 'Starting at the Use Case Root Category (Use Case View), color all 'Activity Diagram elements according to the defined color scheme, 'recursively descend through all enclosing categories (e.g. packages). Call ColorUseCaseActivityDiagrams (RoseApp.CurrentModel.RootUseCaseCategory) End Sub Sub ColorUseCaseActivityDiagrams (aCategory As Category) Dim theStateMachine As StateMachine Dim theStateMachineOwner As StateMachineOwner Dim theStateMachineCollection As StateMachineCollection Dim theDiagramCollection As StateDiagramCollection Dim theDiagram As StateDiagram Dim theActivityViewCollection As ActivityViewCollection Dim theActivityView As ActivityView Dim theNoteViews As NoteViewCollection Dim aNoteView As NoteView 'Activity Diagrams at the package level(outside a use case) Set theStateMachineOwner = aCategory.StateMachineOwner If theStateMachineOwner Is Not Nothing Then 'Get the StateMachine from the Owner object 'and colorize all activity elments Set theStateMachineCollection = theStateMachineOwner.StateMachines For i% = 1 To theStateMachineCollection.count Set theStateMachine = theStateMachineCollection.GetAt(i%) Set theDiagramCollection = theStateMachine.GetAllDiagrams() For t% = 1 To theDiagramCollection.count Set theDiagram = theDiagramCollection.GetAt(t%) Set theActivityViewCollection = theDiagram.GetDiagramActivityViews() 'colorize notes in activity/state diagrams Set theNoteViews = theDiagram.GetNoteViews() For x% = 1 To theNoteViews.Count Set aNoteView = theNoteViews.GetAt(x%) '...note = R255, G255, B55 (yellow) aNoteView.FillColor.Red = 255 aNoteView.FillColor.Green = 255 aNoteView.FillColor.Blue = 55 Next x% 'NoteViewCollection 'For each ActivityView assign a color 'based on the activity stereotype For j% = 1 To theActivityViewCollection.count Set theActivityView = theActivityViewCollection.GetAt(j%) Call ColorActivityView(theActivityView) Next j% 'ActivityViewCollection Next t% 'StateDiagramCollection Next i% 'StateMachineCollection End If 'Activity Diagrams at the use case level (contained within a use case) For i% = 1 To aCategory.UseCases.count Set theStateMachine = aCategory.UseCases.GetAt(i%).StateMachine Set theDiagramCollection = theStateMachine.GetAllDiagrams() For t% = 1 To theDiagramCollection.count Set theDiagram = theDiagramCollection.GetAt(t%) Set theActivityViewCollection = theDiagram.GetDiagramActivityViews() 'colorize notes in activity/state diagrams Set theNoteViews = theDiagram.GetNoteViews() For x% = 1 To theNoteViews.Count Set aNoteView = theNoteViews.GetAt(x%) '...note = R255, G255, B55 (yellow) aNoteView.FillColor.Red = 255 aNoteView.FillColor.Green = 255 aNoteView.FillColor.Blue = 55 Next x% 'NoteViewCollection 'For each ActivityView assign a color 'based on the activity stereotype For j% = 1 To theActivityViewCollection.count Set theActivityView = theActivityViewCollection.GetAt(j%) Call ColorActivityView(theActivityView) Next j% 'ActivityViewCollection Next t% 'StateDiagramCollection Next i% 'CategoryCollection 'descend through all packages (categories) recursively For s% = 1 To aCategory.Categories.Count Call ColorUseCaseActivityDiagrams (aCategory.Categories.GetAt(s%)) Next s% End Sub Sub ColorActivityView(theActivityView As ActivityView) Dim theActivity As Activity Set theActivity = theActivityView.GetActivity() '...presentation = R125, G255, B255 (lt blue) If ( theActivity.Stereotype = "presentation" ) Then theActivityView.FillColor.Red = 125 theActivityView.FillColor.Green = 255 theActivityView.FillColor.Blue = 255 GoTo DONE End If '...exception = R255, G255, B125 (lt yellow) If ( theActivity.Stereotype = "exception" ) Then theActivityView.FillColor.Red = 255 theActivityView.FillColor.Green = 255 theActivityView.FillColor.Blue = 125 GoTo DONE End If '...data entry = R255, G215, B185 (lt orange) If ( theActivity.Stereotype = "data entry" ) Then theActivityView.FillColor.Red = 255 theActivityView.FillColor.Green = 215 theActivityView.FillColor.Blue = 185 GoTo DONE End If '...connector = R255, G175, B175 (lt red) If ( theActivity.Stereotype = "connector" ) Then theActivityView.FillColor.Red = 255 theActivityView.FillColor.Green = 175 theActivityView.FillColor.Blue = 175 GoTo DONE End If 'default '...activity = R245, G245, B245 (lt grey) theActivityView.FillColor.Red = 245 theActivityView.FillColor.Green = 245 theActivityView.FillColor.Blue = 245 DONE: End Sub