Nevron Forum

Using ExpandCollapse decorator

https://www.nevron.com/Forum/Topic2934.aspx

By Gauri Srinivas - Friday, January 22, 2010

Hi,

I am currently using the expand collapse decorator on NGroups with a frame header that contain NShapes. I Have a couple of questions

1) how do I initially collapse the groups/ toggle the state of expand decorator so that the NShapes dont show. I tried calling expandCollapseDecorator.ToggleState - (attached image toggledState.png). This works, but when I expand the group after(afterexpand.png), it doesnt resize correctly and the group looks odd.

I would like it to initially look like attachedimage collapsed.png and have the same expand collapse functionality.

2) I would like to apply other layouts (like compact depth tree etc) to these collapsed groups. How can I do this?

Thanks,
Gauri
By Gauri Srinivas - Wednesday, January 27, 2010

Hi,

I solved this by calling toggle state after initializing padding etc of the group. However, I have another question:

How do I apply layouts to the groups used in the expand collapse decorator once it is toggled?

The example provided in the sample applies the table layout. I tried changing it to NCompactDepthTree but it does nothing and each toggled group just appears one below the other(see attached).  

 

Please let me know how to accomplish this.

Thanks,

Gauri

By Ivo Milanov - Thursday, January 28, 2010

Hi Gauri,

It is difficult to see what the problem is only by looking at the screenshots - please provide a sample application which demonstrates it so that we can check it out.

Is each expand/collapse group of shape a single tree region, or there are links that span outside the group to other shapes? What is it that you want to actually achieve -> please provide a sample.

Best regards,
Ivo
By Gauri Srinivas - Wednesday, February 3, 2010

Hi,

I create Nshape's for nodes  and then perform the following snippet of code:

batchGroup.Build(groupNodes);

batchGroup.Group(DrawingDocument.ActiveLayer, false, out grnooups[parentCounter]);

if (groups[parentCounter] != null)

{

groups[parentCounter].CreateShapeElements(ShapeElementsMask.Decorators);

NFrameDecorator frameDecorator = new NFrameDecorator();

frameDecorator.ShapeHitTestable = true;

frameDecorator.Header.Style = new NStyle {FillStyle = new NGradientFillStyle(GradientStyle.Horizontal,GradientVariant.Variant1,Color.White,Color.White)};

frameDecorator.Background.Style = new NStyle { FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightGray, Color.LightGray) };

NAbilities headerProtection = frameDecorator.Header.Protection;

headerProtection.Delete = true;

headerProtection.InplaceEdit = true;

headerProtection.Select = true;

frameDecorator.Header.Protection = headerProtection;

frameDecorator.Background.Style = new NStyle();

groups[parentCounter].Decorators.AddChild(frameDecorator);

NExpandCollapseDecorator expandCollapseDecorator = new NExpandCollapseDecorator();

groups[parentCounter].Decorators.AddChild(expandCollapseDecorator);

groups[parentCounter].Padding = new NMargins(5);

groups[parentCounter].Padding = new NMargins(5, 5, 30, 5);

groups[parentCounter].UpdateModelBounds();

groups[parentCounter].AutoUpdateModelBounds = true;

Abilities protection = groups[parentCounter].Protection;

protection.Delete = true;

groups[parentCounter].Protection = protection;

expandCollapseDecorator.ToggleState();

}

I then draw appropriate NLineShapes connecting nodes and then applied the table layout.. to layout the groups properly. I followed the examples in the documentation for the expand collapse decorator. It works perfectly for table layout. But when i apply any other, the nodes are just stacked on top of each other. For example :

 

I instantiate the NCompactDepthTreeLayout and then call the layout method

_nLayout.Layout(shapes, layoutContext);

This doesnt seem to work. Please let me know what i'm doing wrong.

Thanks,

Gauri

By Nevron Support - Thursday, February 4, 2010

Hi,

Can you send us an .ndx save file of the drawing so that we can check it out.

Best regards,
Nevron Support
By Gauri Srinivas - Wednesday, February 10, 2010

I tried attaching the file. However it gave me the error "One of the files you have attempted to attach to this post is not a permitted MIME type". I sent it to support@nevron.com instead.