Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Adding tables programmatically (Adding tables programmatically )
Adding tables programmatically [message #1165604] Fri, 01 November 2013 11:57 Go to next message
Dominic Hanlan is currently offline Dominic Hanlan
Messages: 98
Registered: July 2009
Member
Hi,

I have an AbstractGroupBox as my MainBox and need to programmatically add AbstractTableField's to it based on a data base result.

Any ideas on how to approach this or any useful pointers.

Thanks in advance
Re: Adding tables programmatically [message #1165610 is a reply to message #1165604] Fri, 01 November 2013 12:01 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan Motsch
Messages: 100
Registered: March 2010
Senior Member
Do you mean adding multiple dynamic table fields to the Group box or just filling a pre-definied tablefield with data?
Re: Adding tables programmatically [message #1165621 is a reply to message #1165610] Fri, 01 November 2013 12:11 Go to previous messageGo to next message
Dominic Hanlan is currently offline Dominic Hanlan
Messages: 98
Registered: July 2009
Member
I need to add the tables dynamically.
Re: Adding tables programmatically [message #1165699 is a reply to message #1165621] Fri, 01 November 2013 13:27 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan Motsch
Messages: 100
Registered: March 2010
Senior Member
In this case implement in your Group box:

  @Override
  protected void injectFieldsInternal(List<IFormField> fieldList) {
    super.injectFieldsInternal(fieldList);
    //add your fields
    fieldList.add(new MyDynamicTableField(....));
  }


Does this help?

[Updated on: Fri, 01 November 2013 13:28]

Report message to a moderator

Re: Adding tables programmatically [message #1165751 is a reply to message #1165699] Fri, 01 November 2013 14:11 Go to previous messageGo to next message
Dominic Hanlan is currently offline Dominic Hanlan
Messages: 98
Registered: July 2009
Member
That's exactly what was needed.

Many thanks

My next question is how to get the table to expand to fill the group box its sitting in and to set the column space by percentage rather than absolutely. Is it possible to get the table width to resize if the enclosing box is changed??

Regards

Re: Adding tables programmatically [message #1169035 is a reply to message #1165751] Sun, 03 November 2013 19:16 Go to previous message
Ivan Motsch is currently offline Ivan Motsch
Messages: 100
Registered: March 2010
Senior Member
yes, you can configure as follows

public class MyTableField extends AbstractTableField{
  protected boolean getConfiguredAutoResizeColumns{
    return true;
  }
}


or of course call runtime code as
table.setAutoResizeColumns(true);


Also check out the javadoc of that property.
Previous Topic:Login identity
Next Topic:Maven - version numbers
Goto Forum:
  


Current Time: Sat Sep 20 10:13:27 GMT 2014

Powered by FUDForum. Page generated in 0.04394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software