[Laszlo-dev] Replication example

P T Withington ptw at pobox.com
Mon Dec 1 09:47:25 PST 2008


Looks fine to me.  Perhaps should be 3 separate examples?

On 2008-12-01, at 02:03EST, J Crowley wrote:

> So how about something like:
>
> <canvas>
> <dataset name="dset">
>   <cars>
>     <car>Corvette</car>
>     <car>Miata</car>
>     <car>Lotus 7</car>
>     <car>Lumina</car>
>     <car>Carmen Ghia</car>
>     <car>Corolla</car>
>     <car>Prius</car>
>     <car>Delorean</car>
>   </cars>
> </dataset>
> <dataset name="remotedset" src="phonebook.xml"/>
>
> <view width="140" height="160" bgcolor="0x666699">
>   <simplelayout axis="y"/>
>   <attribute name="sauces" value="['chocolate', 'lavender', 'olive',  
> 'orange', 'plum', 'snow', 'thistle', 'violet']" />
>   <text fgcolor="white" fontstyle="bold" text="Without Dataset"/>
>     <replicator nodes="$once{parent.sauces}">
>     <text fgcolor="white" text="${this.presentValue()}"/>
>   </replicator>
> </view>
>
> <view width="140" height="160" y="170" bgcolor="0x666699">
>   <simplelayout axis="y"/>
>   <text fgcolor="white" fontstyle="bold" text="Local Dataset"/>
>     <replicator dataset="dset" xpath="cars/car">
>     <text fgcolor="white" datapath="text()"/>
>   </replicator>
> </view>
>
> <view width="140" height="190" x="150" bgcolor="0x666699">
>   <simplelayout axis="y"/>
>   <text fgcolor="white" fontstyle="bold" text="Remote Dataset"/>
>     <replicator dataset="remotedset" xpath="phonebook/employee/ 
> firstName">
>     <text fgcolor="white" datapath="text()"/>
>   </replicator>
> </view>
> </canvas>
>
> Is there anything else I should add to the example that you think  
> should be demonstrated here?
>
> P T Withington wrote:
>> [Adding laszlo-dev]
>>
>> I think you should start with the simplest possible example, which  
>> is explicit replication, without even having a dataset.  Then add a  
>> local dataset, and if possible, a remote dataset.  We would really  
>> like implicit replication to go away, so I would not even give an  
>> example of that.  Please cc Lou on any discussions, so he is aware  
>> of what L-in-10 has and can make sure the main documentation  
>> doesn't conflict.
>>
>> Here is a (pretty simple) explicit replication example without a  
>> dataset:
>>
>>   <attribute name="sauces" value="['chocolate', 'lavender',  
>> 'olive', 'orange', 'plum', 'snow', 'thistle', 'violet']" />
>>   <combobox name="sauce" editable="false">
>>     <replicator nodes="$once{canvas.sauces}">
>>       <textlistitem text="${this.presentValue()}" type="color" />
>>     </replicator>
>>   </combobox>
>>
>> But, maybe you can come up with something even simpler, no need to  
>> actually drag in combobox...
>>
>> On 2008-11-26, at 23:30EST, J Crowley wrote:
>>
>>> So, I'm trying to come up with a replication example that's simple  
>>> enough to fit in with the other L-in-10 stuff yet demonstrates the  
>>> two primary ways of doing data replication (explicit and  
>>> implicit).  Do you think I should also get into lazy replication  
>>> and stuff like that as well?  Or does this look good?
>>>
>>> Here's what I have so far... I just wanted to get some idea as to  
>>> how simple/complex I should make this:
>>>
>>> <canvas>
>>> <dataset name="dset">
>>> <phonebook>
>>>   <employee>
>>>     <firstName>John</firstName>
>>>     <lastName>Smith</lastName>
>>>     <phone>617-536-7855</phone>
>>>   </employee>
>>>   <employee>
>>>     <firstName>Lisa</firstName>
>>>     <lastName>Jones</lastName>
>>>     <phone>617-536-5216</phone>
>>>   </employee>
>>>   <employee>
>>>     <firstName>Erika</firstName>
>>>     <lastName>Nelson</lastName>
>>>     <phone>617-536-8188</phone>
>>>   </employee>
>>> </phonebook>
>>> </dataset>
>>> <view width="200" height="70" bgcolor="0x666699">
>>> <simplelayout axis="y"/>
>>> <text fgcolor="white" fontstyle="bold" text="Implicit Replication"/>
>>>   <view datapath="dset:/phonebook/employee"
>>>       layout="axis: x" fgcolor="white">
>>>   <text datapath="firstName/text()"/>
>>>   <text datapath="lastName/text()"/>
>>>   <text datapath="phone/text()"/>
>>> </view>
>>> </view>
>>> <view width="200" height="70" y="80" bgcolor="0x666699">
>>> <simplelayout axis="y"/>
>>> <text fgcolor="white" fontstyle="bold" text="Explicit Replication"/>
>>>   <replicator dataset="dset" xpath="phonebook/employee">
>>>     <view layout="axis: x" fgcolor="white">
>>>       <text datapath="firstName/text()"/>
>>>       <text datapath="lastName/text()"/>
>>>       <text datapath="phone/text()"/>
>>>     </view>
>>> </replicator>
>>> </view>
>>> </canvas>
>>>
>>> Thanks!
>>>
>>
>>
>
>



More information about the Laszlo-dev mailing list