index > Visual Studio Team System - Domain-Specific Language Tools > "Static" Swimlanes

"Static" Swimlanes


Hi,

What's the appropriate way to specify a DSL so it has some "fixed" swimlanes, just like the DSL designer has the "Classes and Relationships" and "Diagram Elements" swimlanes?

I know I could accomplish this by having the required swimlanes in the DSL item template and not providing a toolbox item for the swimlane classes, but this seems kind of hackish and the "Add After"/"Add Before"/"Delete" items in the swimlane's context menu would still be available to break the model (although a few rules could bring the model back to a healthy state).

Fernando

Fernando Simonazzi

It has nothing to do with the toolbox item.

To have the default swimlanes created the only thing you need is to don't have a diagram map between your swimlane and any model element.

By this the swimlanes will be part of your design surface only, but not your model.

Hope this helps,

Attila




Attila
Attila Hajdrik

Hi Attila,

Thanks for your suggestion. Unfortunately, I don't think it will work in my case. I do want the swimlanes to be integrated with the model, instead of just being graphical decorations. I want to be able to drop certain shapes on certain swimlanes (as allowed by the embedding relationships between the domain classes represented by the swimlanes and the shapes), but I want swimlanes to be fixed (one of each kind, in fact).

Fernando

Fernando Simonazzi

Hi Fernando,

I have some static swimlines in my DSL - I think it is working in just the way you describe.

I didn't have to do anything special to make it work like this, though. I think it must be the default behaviour for swimlanes that are mapped to domain classes.

My swimlanes are mapped to different Domain Classes, each of which is embedded in the root class. I specified the cardinality to be 1..1 in each relationship, but I'm pretty sure this is not a crucial step.

The other types of Domain Classes in my DSL are embedded in the various "swimlane" classes, as required.

I did not create any tools to correspond to the "swimlane" classes.

Now when I create a new instance of the designer, the swimlanes are always added when it first opens, and instances of their classes appear in the DSL explorer under the root.

I'm not sure where the code that does this is. If you look in the generated code, there is a method called InitializeSwimlanes in Diagram.cs, but it appears to only create them if they are not mapped, as Attila was describing.

There is also a getter in there called CreatableSwimLaneSubjects that looks like it might be used for this, but I can't see where it is called. Anyway, the main thing is that it will create the swimlanes for you automatically. Understanding how it does so is not so important, from my perspective at least.

One minor point - you can control the order of the swimlanes, but in order to do this, you have to open the DslDefinition.dsl file in the XmlEditor (right click on SolutionExplorer and select Open With.. -> XML Editor). Then you must find the SwimLaneMap tags and cut and paste them until the order in the file matches the order you want, left to right, in your designer.

Chris

chris_nelson

Hi Chris,

Have you done anything to get rid of the delete and add actions for swimlanes in the context menus for the shapes and the nodes in the model explorer? That's what really concerns me.

Thanks,

Fernando

Fernando Simonazzi

No - I hadn't thought of that issue, I must admit.

You can delete them at present.

I don't know if there's a way to turn this behaviour off.

If you created a tool for the swimlane class, you would be able to add a new swimlane after deleting.

Also, I notice that Ctrl-Z works OK if you delete accidentally!

I am thinking that my DSL will only be used by people who know what they are doing to a fair extent e.g. Senior developers and business analysts, so it doesn't need to be quite so bullet-proof as some more general-use software.

Chris

chris_nelson

So for static swimlanes, the idea is to have them unmapped. We'll then generate a single one of each type defined automatically.

To make child shapes then be parented on the right swimlane you'll need to override the following method on your diagram:

///

GarethJ - MSFT

Chris, Fernando,

I've posted some notes on how you might customise the Add / Delete behaviour of the context menus at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=780425&SiteID=1. It's not perfect, but it's a start.

You could create rules that throw an exception if someone tries to add/ delete static swimlanes to the model (there have been other postings in the forum on this topic). This will stop the model element from being added/removed, and the user will get an error message in a message box. The downside with this approach is that you can't then load model files that have been edited manually to contain multiple swimlanes, unless you check in the rule and don't throw an exception when the model is being deserialized. This in turn creates the further problem that the user has no way of removing the offending model elements without manually editing the file, since you have remove all of the "delete" options from the designer!

Another approach is to allow the user create "invalid" models with multiple swimlanes, but warn them using validation rules.

Duncan

DuncanP
reply 8

You can use google to search for other answers

 

More Articles

Replacing a null value....
How to find the parent of a relationship link? WAS Re: What can ...
New version of DMD -> DD is available (for DSL Tools May 2005 ...
Designer code templates - where are they?
Adding items to compartment
Getting Validation State
How to set the connector decorator position to middle of the link...
IE7 Beta 2 and DSL Tools
Enterprise Library
Unable to Replace Old Files by New ones
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Dynamically determining link type
Nested Shapes
new connectors
How to set the connector decorator posit…
How to set custom properties at runtime?
How to make Multiple Views
How to intercept shape double-click event
How can i force the placement of a port …
DSL Tools May 2005 with VSTS July CTP?
Popup dialog in DSL
Question on roadmap to DSL features
Shape Icon and Shape Tool Minor Bug
Fatal error CTC2114 when compiling wizar…
Business Case
Using domain specific language

Hot Articles

Model Query Capabilities
Code Generation Samples Other than HTML?…
November release Designers compile errors
Adding files generated with text templat…
Catch On Properties Change Event
Problem starting generated DSL
Bug in Edit Attributes editor
How To Navigate over Links
diagram.AutoLayoutChildShapes(???)
where can ? find info about DSL?
Reference from one DSL metamodel to anot…
When will a release be made available fo…
Can I make two DSL models interact ?
How to control order of transformation s…
cannot drag & drop shape from toolbox

Recommend Articles

How to Add context menu to shapes
How to Limit Number of Connectors Betwee…
End-to-end samples and updated customiza…
Interacting with Server Explorer
Embedding Relationships and Inheritence
New version of DMD -> DD is available…
Can I make two DSL models interact ?
DSL for existing descriptive language
Catch On Properties Change Event
Re: Have problem for the DSL walk-throug…
UIPChart problem
CTC Problem
XML editor starts DSL model, but I want …
Save instance of model in menu command
"DSL DM -> DD" for November…