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 HanlanFriend
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 MotschFriend
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 HanlanFriend
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 MotschFriend
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 HanlanFriend
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 messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
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.
Re: Adding tables programmatically [message #1611781 is a reply to message #1165610] Wed, 11 February 2015 16:07 Go to previous messageGo to next message
Justin B is currently offline Justin BFriend
Messages: 19
Registered: January 2015
Location: New Jersey, USA
Junior Member
Are tablefields that are subclassed in a TabBox unaccessable by FormData?? I have a beanTableField inside a TabBox and I keep getting nullPointerException error saying that one of the column properties is not found in the TableRowDataMapper but the field is there. Does it matter if the field is hidden? Not sure what is going on here.
Errors log posted below.

!ENTRY org.eclipse.scout.rt.client 2 0 2015-02-11 11:00:00.682
!MESSAGE org.eclipse.scout.rt.client.ui.basic.table.TableRowDataMapper.<init>(TableRowDataMapper.java:61) No column found for property [fabricator.shared.core.ui.forms.ItemFormData$PriceList$PriceListRowData#priceNr]

!ENTRY org.eclipse.scout.rt.client 4 0 2015-02-11 11:00:00.692
!MESSAGE org.eclipse.scout.rt.client.services.common.exceptionhandler.internal.InternalClientExceptionHandlerService.differentiatedLog(InternalClientExceptionHandlerService.java:116) ProcessingException: ProcessingStatus[ERROR code=0 ItemForm / Unexpected java.lang.NullPointerException]
Unexpected
!STACK 0
ProcessingException[ProcessingStatus[ERROR code=0 ItemForm / Unexpected java.lang.NullPointerException]]
	at org.eclipse.scout.rt.client.ui.form.AbstractFormHandler.onLoad(AbstractFormHandler.java:184)
	at org.eclipse.scout.rt.client.ui.form.AbstractForm.loadStateInternal(AbstractForm.java:1293)
	at org.eclipse.scout.rt.client.ui.form.AbstractForm.startInternal(AbstractForm.java:756)
	at fabricator.client.core.ui.forms.ItemForm.startModify(ItemForm.java:92)
	at fabricator.client.core.ui.desktop.outlines.pages.FinishedGoodsTablePage$Table$EditItemMenu.execAction(FinishedGoodsTablePage.java:293)
	at org.eclipse.scout.rt.client.ui.action.AbstractAction.doActionInternal(AbstractAction.java:271)
	at org.eclipse.scout.rt.client.ui.action.AbstractAction.doAction(AbstractAction.java:253)
	at org.eclipse.scout.rt.client.ui.action.AbstractAction$P_UIFacade.fireActionFromUI(AbstractAction.java:604)
	at org.eclipse.scout.rt.ui.swing.action.SwingScoutAction$1.run(SwingScoutAction.java:148)
	at org.eclipse.scout.rt.ui.swing.concurrency.SwingScoutSynchronizer$1.runVoid(SwingScoutSynchronizer.java:71)
	at org.eclipse.scout.rt.client.ClientJob.runStatus(ClientJob.java:189)
	at org.eclipse.scout.rt.client.ClientJob.runTransactionWrapper(ClientJob.java:172)
	at org.eclipse.scout.rt.client.ClientJob.run(ClientJob.java:159)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.NullPointerException
	at fabricator.client.core.ui.forms.ItemForm$ModifyHandler.execLoad(ItemForm.java:717)
	at org.eclipse.scout.rt.client.ui.form.AbstractFormHandler.onLoad(AbstractFormHandler.java:178)
	... 13 more
Re: Adding tables programmatically [message #1611832 is a reply to message #1611781] Wed, 11 February 2015 16:43 Go to previous messageGo to next message
Justin B is currently offline Justin BFriend
Messages: 19
Registered: January 2015
Location: New Jersey, USA
Junior Member
I found the first error. My syntax on the class was incorrect for the column PriceNr. I needed a capital letter. Ooops. But I still get a nullpointerexception when I call execLoad. Not sure what I am missing?
Re: Adding tables programmatically [message #1611926 is a reply to message #1611832] Wed, 11 February 2015 18:03 Go to previous message
Justin B is currently offline Justin BFriend
Messages: 19
Registered: January 2015
Location: New Jersey, USA
Junior Member
Nevermind, I figured that one out too. Sorry for being so hasty in my post. The problem was in the plugin.xml. I had moved a service into another package and forgot to update the location in the xml so the registry found no service. I updated that and everything works fine.
Previous Topic:Help with RAP error!
Next Topic:Who know scout Component Spy and Layout Debugger?
Goto Forum:
  


Current Time: Mon Apr 27 12:09:35 GMT 2015

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

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