Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Table shows an extra row? (Read 2284 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
Table shows an extra row?
Dec 25th, 2009 at 7:54pm
Print Post  
I want to create a table node with a single row and a single column. Something like the following.

TableNode mynode = diagram.getFactory().createTableNode(10, 10, 200, 60, 1, 1);
       mynode.setStyle(TableStyle.RoundedRectangle);
       Cell mycell = mynode.getCell(0, 0);
       mycell.setBrush(new GradientBrush(Color.WHITE, Color.GREEN, 90));
       mycell.setText("Single cell text string");
diagram.add(mynode);

TableNode is created, showing the caption "Table" on top, the green row showing the my text string below the caption, but then below this green row, there is an extra row that I don't want. I just need the table caption and on single-column row.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Table shows an extra row?
Reply #1 - Dec 26th, 2009 at 7:55am
Print Post  
It might be showing a part of the table not occupied by cells at the bottom. To hide it, set the height of the first and only row to table.getHeight() - table.getCaptionHeight(). Otherwise the row is as high as diagram.getTableRowHeight().

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


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
Re: Table shows an extra row?
Reply #2 - Dec 28th, 2009 at 3:19pm
Print Post  
Thanks. Yes, that does it. But there is another strange behavior. The cell text is not shown when I set the cell height exactly as (tableHeight - captionHeight). If I take 1 unit off, then I see the text but there is an extra area at the bottom that I want to remove.

final int TABLE_WIDTH = 100;
final int TABLE_HEIGHT = 30;

TableNode mynode = diagram.getFactory().createTableNode(0, 0, TABLE_WIDTH, TABLE_HEIGHT, 1, 1);
mynode.setBrush(new GradientBrush(Color.WHITE, Color.GREEN, 90));
mynode.setCaption("Parent Node");
mynode.getRows().get(0).setHeight(TABLE_HEIGHT - mynode.getCaptionHeight());
mynode.getCell(0,0).setText("Parent Node Text");
diagram.add(mynode);
      
TableNode mynode2 = diagram.getFactory().createTableNode(0, 0, TABLE_WIDTH, TABLE_HEIGHT, 1, 1);
mynode2.setBrush(new GradientBrush(Color.WHITE, Color.RED, 90));
mynode2.setCaption("Child Node #1");
mynode2.getRows().get(0).setHeight(TABLE_HEIGHT - mynode.getCaptionHeight()-1);
mynode2.getCell(0,0).setText("Child Node #1 Text");
diagram.add(mynode2);

diagram.getFactory().createDiagramLink(mynode, mynode2);
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Table shows an extra row?
Reply #3 - Dec 29th, 2009 at 7:10am
Print Post  
Hi,

You could call table.setCellFrameStyle(CellFrameStyle.None) to hide the border line. Otherwise try to subtract two pixels from the height instead of one millimeter. The pixel size in millimeters is 25.4 / Toolkit.getDefaultToolkit().getScreenResolution().

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