Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » How to handle a TableField efficiently?
How to handle a TableField efficiently? [message #1783259] Fri, 09 March 2018 22:01 Go to next message
Source Deposit is currently offline Source DepositFriend
Messages: 13
Registered: March 2017
Junior Member

Scout: 6.0.200

Eclipse for Scout Developers: 
Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600

<< see image >>

Use case:
I would like to record the persons from a party (person table is in database available // Mapping table between persons and party is in the database available)

Description of the previous implementation:
I have a party form (A). In this form there are different elements (title, begin, etc.). Likewise a ParticipantsTableField (B) - with the columns "Firstname", "Lastname", "Mail", etc.
If I want to add a new person to the ParticipantsTableField (NewPersonMenu), an AddPersonForm (C) will be opened with a smartfield "PersonLookupCall". This field (PersonLookupCall) is also a master field for other invisible fields - just these additional fields like "Firstname", "Lastname", "Mail", etc.
The action of the NewPersonMenu is checked for an "if - isFormStored ()". If this is true, I create a new line in ParticipantsTableField (createRow) and set this to "Inserted" (setStatusInserted ()).

if (personForm.isFormStored()) {
	Table table = getTable();
	ITableRow r;

	r = table.addRow(getTable().createRow());
	table.getParticipantsIDColumn().setValue(r, UUID.randomUUID().toString());
	table.getPersonIDColumn().setValue(r, personForm.getPersonSmartField().getValue());
	table.getFirstNameColumn().setValue(r, personForm.getFirstNameField().getDisplayText());
	table.getLastNameColumn().setValue(r, personForm.getLastnameField().getDisplayText());
	table.getEmailColumn().setValue(r, personForm.getEmailField().getDisplayText());

Everything works great! Now to my two questions:

  1. State of the art
    Is that "state of the art" <or> can I improve? If yes how?

  2. Peoplegroup
    Since often the same people come to a party, there is also a "group of people". Adopted in group "BSI-Core" are 10 persons. These should then be added to the table "ParticipantsTableField" when selecting this group (new menu in the ParticipantsTableField: AddPersonGroup). For this I can not use the AddPersonForm (C) - because there is only one person with hidden single fields and therefore not more people can be selected.

    * How can I select a group of people and then access the database in the ParticipantsTableField menu?
    * Or am I mentally in the wrong place?

Cheers and many Thanks
Re: How to handle a TableField efficiently? [message #1783436 is a reply to message #1783259] Tue, 13 March 2018 07:29 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 91
Registered: September 2011
Your solution looks quite good and resembles the "Event-Form" of the Demo application, so you can consider it close to state of the art :)

Two notes:

You can add a new row more compact: table.addRow(). Since the default implementation will set the row state to inserted, you can remove the last line in your snippet.

Since you already have a smartfield with a lookup call for the person in your "chooser form", you could use the "editable column" feature. Instead of opening a form to choose the person, the user could add rows to the table and edit it inline. As long as it is a AbstractSmartColumn with the lookup call set, it will create the proposal list you're used from smartfields. Check out "getConfiguredEditable" and "getConfiguredMandatory" on the columns. (For reference, check out the widgets demo app).
This could also make your "add people group" functionality easier.
The disadvantage of this solution is that if combined with a smartfield, you have to restrict yourself to a single column, or load the values of additional "display-only" columns manually.
Re: How to handle a TableField efficiently? [message #1783793 is a reply to message #1783436] Sat, 17 March 2018 18:03 Go to previous message
Source Deposit is currently offline Source DepositFriend
Messages: 13
Registered: March 2017
Junior Member

Hello Patrick,
many thanks for the nice words and the tip.

I'll give it a try ...
Previous Topic:After deploying - where to put the database?
Next Topic:How to install Eclipse Oxygen Scout behind a proxy
Goto Forum:

Current Time: Tue Feb 18 16:05:56 GMT 2020

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

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

Back to the top