Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Transform a formData to text(A pretty-print utility for formData?)
Transform a formData to text [message #1384913] Tue, 03 June 2014 05:50 Go to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
For a reason I do not know, there is no toString() method on the formData.

In my project, we would like to transform the content of a formData to a String (debugging, logging, ...). Has someone already written such a utility?
Re: Transform a formData to text [message #1385217 is a reply to message #1384913] Thu, 05 June 2014 04:07 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I received a proposal from Beat Schwarzentrub.
Here the code (I let you deduce the corresponding form. It contains TableFields, use Templates...):
formData.setExampleNr(99L);

formData.getAge().setValue(34);
formData.getName().setValue("Peter Johnson");
formData.getValidity().setValue(new Date());
formData.getInfo().setValue(null);

int rowNum;
ProductsTable table = formData.getProductsTable();
table.clearRows();
rowNum = table.addRow();
table.setId(rowNum, 9837);
table.setProduct(rowNum, "Computer");
table.setAvailable(rowNum, true);

rowNum = table.addRow();
table.setId(rowNum, 3710);
table.setProduct(rowNum, "Keyboard");
table.setAvailable(rowNum, false);

PersonsTableRowData rowData;
PersonsTable table2 = formData.getPersonsTable();
rowData = table2.addRow();
rowData.setPersonId(364L);
rowData.setFirstName("Bob");
rowData.setLastName("Queen");

rowData = table2.addRow();
rowData.setPersonId(364L);
rowData.setFirstName("William");
rowData.setLastName("Peterson");

formData.getExtraGroupBox().getInfo1().setValue("Lorem");
formData.getExtraGroupBox().getInfo3().setValue("Lorem Ipsum\nDolore"); 


Here the output:
 ExampleFormData
	age:                 34
	exampleNrProperty:   99
	name:                Peter Johnson
	validity:            Wed Jun 04 18:53:27 CEST 2014 


It is a good thing that the output is sorted.

Several problems:
- No TableField support
- No Template support

There is a possibility to display null values if needed:
 ExampleFormData
	age:                 34
	exampleNrProperty:   99
	info:                null
	keyProperty:         null
	name:                Peter Johnson
	validity:            Wed Jun 04 18:54:01 CEST 2014 


I think the null handling should look at AbstractFormFieldData.isValueSet() [resp AbstractPropertyData.isValueSet()]. This way it is possible to distinguish between a value that is set to null and that is not set at all.
Previous Topic:Bold FontSpec
Next Topic:Error : "Can not find the URL of the proxy auto-configuration"
Goto Forum:
  


Current Time: Tue Mar 19 07:38:07 GMT 2024

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

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

Back to the top