Hi,
We've been evaluating SmartGWT EE for a few weeks now and have been very impressed. We have run into a situation where we can't figure out an easy automated way to populate a record object from a very simple dynamicform (attached below) whose datasrouce was built against an EJB (ie whose server type is "generic" and which does NOT have any server side logic / persistence). Here are the details:
Problem #1
=================
I have a very simple datasource (attached below) which was built using Visual Builder. I pointed Visual Builder to an EJB. This datasource will NOT be communicationg the server side, i.e it's client only. I then built a dynamicform which is associated with this datasource and then display the fields automatically (source attached). Everything displays fine in the dynamic form.
However, I now need to get the values that the user keyed into the dynaform into a record object. I accomplished this by writing out the set statements each field explicitly, as follows:
rcSelWrkfl = new Record();
rcSelWrkfl.setAttribute("workflowID", -1);
rcSelWrkfl.setAttribute("workflowName", (String) frmNewWorkflow.getValue("workflowName"));
rcSelWrkfl.setAttribute("briefDescription", (String) frmNewWorkflow.getValue("briefDescription"));
rcSelWrkfl.setAttribute("version", -1);
But, this will be a problem when I have dozens of fields (e.g, 50) and dozens of datasources corresponding to dozens of different EJBs. I would think that there is a way for a record object (that is based on a datasource whose server type is "generic" and was created against an EJB) to **automatically** get populated from the form. But, I couldn't figure out any method in either the dynamicform or datasoruce classes that would accomplish this. I would think that there is some method like
Record rcSelWrkfl = dynamicForm.getRecord();
Any help would be appreciated.
Problem #2
=================================
My second question is this:
For the same example above, I would also need to populate a CLIENT-SIDE object that is an instantiated verion of the original EJB with the values from the dynamicform. Since the datasource that we used was built directly from this EJB, and since the object based off this EJB exists on the client-side, I would think that there is an *automated* way to populate it, just as there is if the object needed to be populated on the server side, e.g
WorkflowEJB workflow;
dynamicForm.populate(workflow);
or perhaps it could use (again on the client side) logic that I saw in the *server* side samples, such as:
Map newValues = rcSelWrkfl.getValues(); // where rcSelWrkfl gets populated using the solution for the problem #1 above
DataTools.setProperties(newValues, workflow);
(I'm assuming that DataTools will work on the client side.)
Minor Problem #3
================================
Using the same datasource, I tried to do this:
dataSource.setClientOnly(true);
But it returned an error as follows:
Error :Cannot change configuration property 'clientOnly' to true after the component has been created.
So my guess is that when the datasource says that the servertype is "generic", that the datasource effectively becomes client-only. Is that correct? If not, how can I set the datasoruce to be client-only, as I'm assuming that I ought to do that.
==============
Other general details for this entire email thread are below:
OS: Windows XP Pro
IDE: MyEclipse 9.0 with Google Plugin for Eclipse (2.3.1)
SmartGWT EE 2.4
Broswer: Mozilla Firefox 4.0.1
GWT SDK: 2.2
Sun JDK 1.6.0_13
We've been evaluating SmartGWT EE for a few weeks now and have been very impressed. We have run into a situation where we can't figure out an easy automated way to populate a record object from a very simple dynamicform (attached below) whose datasrouce was built against an EJB (ie whose server type is "generic" and which does NOT have any server side logic / persistence). Here are the details:
Problem #1
=================
I have a very simple datasource (attached below) which was built using Visual Builder. I pointed Visual Builder to an EJB. This datasource will NOT be communicationg the server side, i.e it's client only. I then built a dynamicform which is associated with this datasource and then display the fields automatically (source attached). Everything displays fine in the dynamic form.
However, I now need to get the values that the user keyed into the dynaform into a record object. I accomplished this by writing out the set statements each field explicitly, as follows:
rcSelWrkfl = new Record();
rcSelWrkfl.setAttribute("workflowID", -1);
rcSelWrkfl.setAttribute("workflowName", (String) frmNewWorkflow.getValue("workflowName"));
rcSelWrkfl.setAttribute("briefDescription", (String) frmNewWorkflow.getValue("briefDescription"));
rcSelWrkfl.setAttribute("version", -1);
But, this will be a problem when I have dozens of fields (e.g, 50) and dozens of datasources corresponding to dozens of different EJBs. I would think that there is a way for a record object (that is based on a datasource whose server type is "generic" and was created against an EJB) to **automatically** get populated from the form. But, I couldn't figure out any method in either the dynamicform or datasoruce classes that would accomplish this. I would think that there is some method like
Record rcSelWrkfl = dynamicForm.getRecord();
Any help would be appreciated.
Problem #2
=================================
My second question is this:
For the same example above, I would also need to populate a CLIENT-SIDE object that is an instantiated verion of the original EJB with the values from the dynamicform. Since the datasource that we used was built directly from this EJB, and since the object based off this EJB exists on the client-side, I would think that there is an *automated* way to populate it, just as there is if the object needed to be populated on the server side, e.g
WorkflowEJB workflow;
dynamicForm.populate(workflow);
or perhaps it could use (again on the client side) logic that I saw in the *server* side samples, such as:
Map newValues = rcSelWrkfl.getValues(); // where rcSelWrkfl gets populated using the solution for the problem #1 above
DataTools.setProperties(newValues, workflow);
(I'm assuming that DataTools will work on the client side.)
Minor Problem #3
================================
Using the same datasource, I tried to do this:
dataSource.setClientOnly(true);
But it returned an error as follows:
Error :Cannot change configuration property 'clientOnly' to true after the component has been created.
So my guess is that when the datasource says that the servertype is "generic", that the datasource effectively becomes client-only. Is that correct? If not, how can I set the datasoruce to be client-only, as I'm assuming that I ought to do that.
==============
Other general details for this entire email thread are below:
OS: Windows XP Pro
IDE: MyEclipse 9.0 with Google Plugin for Eclipse (2.3.1)
SmartGWT EE 2.4
Broswer: Mozilla Firefox 4.0.1
GWT SDK: 2.2
Sun JDK 1.6.0_13
Comment