Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 270429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:59:58+00:00 2026-05-11T23:59:58+00:00

OK, so things have progressed significantly with my DSL since I asked this question

  • 0

OK, so things have progressed significantly with my DSL since I asked this question a few days ago.

As soon as I’ve refactored my code, I’ll post my own answer to that one, but for now, I’m having another problem.

I’m dynamically generating sub-diagrams from a DSL-created model, saving those diagrams as images and then generating a Word document with those images embedded. So far, so good.

But where my shapes have compartments (for examples, Operations on a Service Contract – can you guess what it is, yet?), the compartment header is displayed but none of the items.

If I examine my shape object, it has a single nested child – an ElementListCompartment which in turn, has a number of items that I’m expecting to be displayed. The ElementListCompartment.IsExpanded property is set to true (and the compartment header has a little ‘collapse’ icon on it) but where, oh where, are my items?

The shape was added to the diagram using

parentShape.FixupChildShapes(modelElement);

So, can anyone guide me on my merry way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:59:58+00:00Added an answer on May 11, 2026 at 11:59 pm

    I’ve recently faced a related problem, and managed to make it work, so here’s the story.

    The task I was implementing was to load and display a domain model and an associated diagram generated by ActiveWriter’s DSL package.

    Here’s how I’ve implemented the required functionality (all the methods below belong to the Form1 class I’ve created to play around):

    private Store LoadStore()
    {
        var store = new Store();
        store.LoadDomainModels(typeof(CoreDesignSurfaceDomainModel), typeof(ActiveWriterDomainModel));
        return store;
    }
    
    private void LoadDiagram(Store store)
    {
        using (var tx = store.TransactionManager.BeginTransaction("tx", true))
        {
            var validator = new ValidationController();
            var deserializer = ActiveWriterSerializationHelper.Instance;
            deserializer.LoadModelAndDiagram(store,
                @"..\..\ActiveWriter1.actiw", @"..\..\ActiveWriter1.actiw.diagram", null, validator);
            tx.Commit();
        }
    }
    
    private DiagramView CreateDiagramView()
    {
        var store = LoadStore();
        LoadDiagram(store);
    
        using (var tx = store.TransactionManager.BeginTransaction("tx2", true))
        {
            var dir = store.DefaultPartition.ElementDirectory;
            var diag = dir.FindElements<ActiveRecordMapping>().SingleOrDefault();
            var view = new DiagramView(){Diagram = diag};
            diag.Associate(view);
            tx.Commit();
    
            view.Dock = DockStyle.Fill;
            return view;
        }
    }
    
    protected override void OnLoad(EventArgs e)
    {
        var view = CreateDiagramView();
        this.Controls.Add(view);
    }
    

    This stuff worked mostly finely: it correctly loaded the diagram from files created with Visual Studio, drew the diagram within my custom windows form, supported scrolling the canvas and even allowed me to drag shapes here. However, one thing was bugging me – the compartments were empty and had default name, i.e. “Compartment”.

    Google didn’t help at all, so I had to dig in by myself. It wasn’t very easy but with the help of Reflector and after spending a couple of hours I’ve managed to make this scenario work as expected!

    The problem was as follows. To my surprise DSL libraries do not correctly draw certain diagram elements immediately after they are added to the diagram. Sometimes, only stubs of certain shapes are drawn (as it’s displayed in the first picture). Thus, sometimes we need to manually ask the library to redraw diagram shapes.

    This functionality can be implemented with so called “rules” that in fact are event handlers that get triggered by certain diagram events. Basically what we have to do is attach certain handler to an element-added event of the diagram and ensure shape initialization.

    Luckily we don’t even have to write any code since DSL designer autogenerates both fixup rules and an utility method that attaches those rules to the diagram (see the EnableDiagramRules below). All we have to do is to call this method right after the store has been created (prior to loading model and diagram).

    private Store LoadStore()
    {
        var store = new Store();
        store.LoadDomainModels(typeof(CoreDesignSurfaceDomainModel), typeof(ActiveWriterDomainModel));
        ActiveWriterDomainModel.EnableDiagramRules(store);
        return store;
    }
    
    /// <summary>
    /// Enables rules in this domain model related to diagram fixup for the given store.
    /// If diagram data will be loaded into the store, this method should be called first to ensure
    /// that the diagram behaves properly.
    /// </summary>
    public static void EnableDiagramRules(DslModeling::Store store)
    {
        if(store == null) throw new global::System.ArgumentNullException("store");
    
        DslModeling::RuleManager ruleManager = store.RuleManager;
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.FixUpDiagram));
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.ConnectorRolePlayerChanged));
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.CompartmentItemAddRule));
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.CompartmentItemDeleteRule));
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.CompartmentItemRolePlayerChangeRule));
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.CompartmentItemRolePlayerPositionChangeRule));
        ruleManager.EnableRule(typeof(global::Altinoren.ActiveWriter.CompartmentItemChangeRule));
    }
    

    The code above works as follows:

    1. Upon new element being added to the diagram (e.g. during deserialization of diagram) the rule “FixUpDiagram” gets triggered.

    2. The rule then calls Diagram.FixUpDiagram(parentElement, childElement), where childElement stands for an element being added and parentElement stands for its logical parent (determined using tricky conditional logic, so I didn’t try to reproduce it by myself).

    3. Down the stack trace FixUpDiagram method calls EnsureCompartments methods of all class shapes in the diagram.

    4. The EnsureCompartments method redraws class’ compartments turning the stub “[-] Compartment” graphic into full-blown “Properties” shape as displayed in the picture linked above.

    P.S. Steve, I’ve noticed that you did call the fixup but it still didn’t work. Well, I’m not a pro in DSL SDK (just started using it a couple of days ago), so cannot explain why you might have troubles.

    Maybe, you’ve called the fixup with wrong arguments. Or maybe Diagram.FixupDiagram(parent, newChild) does something differently from what parent.FixupChildShapes(newChild) does. However here’s my variant that just works. Hope this also helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm running through a list of things and have code that creates an
I have two things I need this for, these should explain what I mean:
I would like to code the progress of events that have changed since someone
I have a form that calls a success message with this code: // Form
To keep things simple, we have a few aspx pages... Page1.aspx - resets Session
What things have to be done before I can honestly tell myself my web
I've switched over to a Mac recently and, although things have been going quite
We already have things like static analysis that tells us what's wrong with our
When implementing Quicksort, one of the things you have to do is to choose
For instance, let's say I have a User model. Users have things like logins,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.