Hi everyone,
>From previous royale (flex) docs. I can see that it is possible to bind ui 
>forms to action script objects (DTO's). i.e actionscirpt classes with public 
>getter and setter methods.
The ORM we are using accepts and returns data as custom generic data transfer 
objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's 
(by pojo I mean a java class with public getter and setter methods))
See the example java code snippet below:


public class GenericDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private Map<String, Attribute> attributes = null;
    private String name = null;
    public GenericDTO(String name) {
        notNull(name, "The name of the DTO cannot be null...");
        this.attributes = new HashMap<String, Attribute>();
        this.name = name;
    }
    public GenericDTO add(String name, Attribute attribute) {
        notNull(name, "Attribute name cannot be null");
        notNull(attribute, "Attribute with name: " + name + " is null!");
        this.attributes.put(name, attribute);
        return this;
    }
........
   // there are getter/setter method to return the HashMap of Attributes and 
name field.   
   The attribute class is the base class of all data types. So we have 
StringType (for String), IntegerType (for Integer) that extend Attribute. Class 
Attribute
public Object getInputValue();
public void setInputValue(final Object object);    
Is it possible to bind the generic dto to royale ui controls ? e.g. for example 
I was able to bind an arrayList of ContactDTO successfully. This contactDTO had 
name and email as fields with public getter and setter methods as follows
 <j:DataGrid localId="dg1" dataProvider="{contacts}">            <j:columns>    
                            <j:DataGridColumn label="Name" dataField="name" 
columnWidth="200"/>                <j:DataGridColumn label="Email" 
dataField="email" columnWidth="200"/>                     </j:columns>        
</j:DataGrid>   

Assuming it is possible to create ActionScript (as3) versions of GenericDTO, 
Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the 
appropriate get and set functions.
Is it possible to bind an arrayList of GenericDTO to a royale data grid as 
follows ?
 <j:DataGrid localId="dg1" dataProvider="{records}">            <j:columns>     
                          <j:DataGridColumn label="Name" 
dataField="{attributes.name.inputValue}" columnWidth="200"/>                
<j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" 
columnWidth="200"/>                     </j:columns>        </j:DataGrid>   

i.e. use databinding expressions in the dataField of the data grid ?
How about other royale UI controls ? e.g textFields and numberFields in a UI 
form.

Regards,
Roman,

Reply via email to