Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Setting GridRow height and GridColumn width in code. (Read 3121 times)
Jonathan Terrell
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: May 19th, 2015
Setting GridRow height and GridColumn width in code.
Jul 1st, 2015 at 11:26am
Print Post  
Hi,

Our testing indicates that it may be faster to build a CompositeNode in code rather than load it from an XML file each time.

However we are unable to set the height and width of the grid row and  grid column elements. The setWidth() and setHeight() methods expect an argument of the type "com.mindfusion.diagramming.components.a" which is not accessible from outside the package.

Would it be possible to change these two methods to accept arguments of type float?

Any assistance appreciated, Jonathan

P.S. Documentation appears to be missing for the GridRow and GridColumn elements.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Setting GridRow height and GridColumn width in code.
Reply #1 - Jul 1st, 2015 at 12:10pm
Print Post  
Hi,

Try loading the XML just once into a prototype node and calling CompositeNode(prototype) copy constructor when you need to create new instances.

These methods take a Length parameter that also allows specifying relative or auto-calculated lengths. Apparently the compiler does not complain if using package classes in public methods signatures (http://stackoverflow.com/questions/5265062/publicly-declare-a-package-private-ty...) so we haven't noticed that, we'll make it public for next release.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Jonathan Terrell
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: May 19th, 2015
Re: Setting GridRow height and GridColumn width in code.
Reply #2 - Jul 1st, 2015 at 6:07pm
Print Post  
Thankyou
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Setting GridRow height and GridColumn width in code.
Reply #3 - Jul 14th, 2015 at 1:27pm
Print Post  
This build makes Length and LengthType classes public:
https://mindfusion.eu/_temp/droiddiag122.zip

Now you can set up a grid panel from code like this:
Code
Select All
GridPanel gp = new GridPanel();

GridRow row = new GridRow();
row.setHeight(new Length(0, LengthType.Auto)); // fit height of child components
gp.getRows().add(row);

GridColumn col0 = new GridColumn();
col0.setWidth(new Length(20));
gp.getColumns().add(col0);

GridColumn col1 = new GridColumn();
col1.setWidth(new Length(1, LengthType.Relative)); // fill remaining space
gp.getColumns().add(col1);

TextComponent text = new TextComponent();
text.setText("test");
text.setGridColumn(0);
text.setBackground(new SolidBrush(Color.white));
gp.addChild(text);

TextComponent text2 = new TextComponent();
text2.setText("test 2");
text2.setGridColumn(1);
text2.setBackground(new SolidBrush(Color.white));
gp.addChild(text2);

CompositeNode mn = new CompositeNode();
mn.getComponents().add(gp);
mn.setBounds(10, 10, 90, 90);
diagram.getNodes().add(mn); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint