Hide Classmembers for Datasource-Container

Hello,

is it possible, to hide members of a class to use it for container datasource? My class for a Form datasource:


public class Counter{
	
	private String Countername="";
	private String Counternumber="";
	
	private Vector<myValue> vec = new Vector<myValue>();

}

public class myValue{
	
	private Date _date= new Date();
	private double _value = 0;

}

i want that the form only shows 2 textfields for Countername and Counternumber and no field for the vector.

do i have to create manually a form with 2 textfield and set for every textfield a property?

now i use :

form.setItemDatasource(mydatasource.addItem(myCounter));

but this shows a form with 2 textfields and a label for the vector

If you know which fields you do want to display (and in which order), the best way is to use form.setItemDataSource(Item newDataSource, Collection propertyIds) . You can also call Item.getItemPropertyIds() and make a modified copy of the returned list.

Other alternatives, as far as I can remember, include

  • telling the item not to add the field (some item classes have an API similar to that above)
  • removing the property from the data source once the data source has been constructed (Item.removeItemProperty()) but before it is set for the form - not supported by some item classes
  • removing the property from the form after the form has been constructed (Form.removeItemProperty())
  • returning null for the field in your FormFieldFactory