Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Adding tables programmatically (Adding tables programmatically )
Adding tables programmatically [message #1165604] Fri, 01 November 2013 07:57 Go to next message
Eclipse UserFriend
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 08:01 Go to previous messageGo to next message
Eclipse UserFriend
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 08:11 Go to previous messageGo to next message
Eclipse UserFriend
I need to add the tables dynamically.
Re: Adding tables programmatically [message #1165699 is a reply to message #1165621] Fri, 01 November 2013 09:27 Go to previous messageGo to next message
Eclipse UserFriend
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 09:28] by Moderator

Re: Adding tables programmatically [message #1165751 is a reply to message #1165699] Fri, 01 November 2013 10:11 Go to previous messageGo to next message
Eclipse UserFriend
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 14:16 Go to previous messageGo to next message
Eclipse UserFriend
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 11:07 Go to previous messageGo to next message
Eclipse UserFriend
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 11:43 Go to previous messageGo to next message
Eclipse UserFriend
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 13:03 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 08:02:36 EDT 2025

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

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

Back to the top