You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wookie.apache.org by Gonzalo Aguilar Delgado <ga...@aguilardelgado.com> on 2013/03/05 13:04:38 UTC

Does preferences are working?

Hello, 

I've just built a widget but it seems that cannot get preferences no
matter what I do.

<widget xmlns="http://www.w3.org/ns/widgets"
 		id="http://clt.level2crm.com/widgets/lead"
 		version="0.1"
        width="300"
        height="200"
        >
  <name>lead</name>
<!--     <feature name="http://jquerymobile.com" required="true"/> -->
<!--     <access origin="*"/>   -->
  
  <description>Access Lead Details</description>
  <content src="index.html"/>
  <icon src="images/icon.png"/>
  <access network="false"/>
  <author>Apache Wookie (Incubating) Team</author>
  <preference name="servicesURL"
value="http://localhost:8080/lead-services-war/services/rest/"/>
</widget>


/// JAVASCRIPT

url = url || widget.preferences.getItem("servicesURL");

is null I examined preferences, and there is not such key.

Any help on this?

Re: Does preferences are working?

Posted by Scott Wilson <sc...@gmail.com>.
On 5 Mar 2013, at 19:42, Gonzalo Aguilar Delgado wrote:

> 
>> 
>> I can replicate this one.
>> 
>> 
>> Its an interesting case, as I can also see where, for example, a widget package contains a default value for a preference, and then a user overrides it with their choice, and then you update the package - in that instance, you don't necessarily want to overwrite the user-set preference.
>> 
>> 
>> So I think this requires some thought as to what the expected behaviour should be.
>> 
>> 
>> S
> 
> Hello Scott, 
> 
> Mmmm. You are right. I this case I will not want to override the value. 
> Centaintly some thought must be put on this issue.
> 
> But in the case proposed the setting is not even there I think it's a case clear to be considered. It should not harm anyone since it was not there... In the same way if I remove one setting I will not want to remove from instances. 
> 
> But there is some thing I don't get it. Instances. 
> 
> Because it will instanciate one widget when a user request it, I suppose. Okay. 
> But when it's removed? 

Instances are only removed if the application that originally requested it demands it, or if the widget itself is deleted.

> 
> I'm asking because there may be one time when the server must put the preferences as is. If no instance is on the server for a particular widget then it must push every preference as it comes in the config. 
> 
> Do I explain myself? I really don't catch instances... Mainly because I didn't get a look over widget live cycle... <face-smile-big.png>

Yes I think I get it.

Each time a widget is requested for a user, an instance is created. That instance takes a clone of the default preferences for the widget it instantiates. 

So, if the widget gets  updated, and the default preferences are modified, then new instances should get the updated default preferences. However existing instances are not affected.

For example:

I upload "MyWidget" which has a <preference name="pref1" value="test"/>

An instance is created for Alice. In her widget instance, widget,preferences.getItem("pref1") will return "test".

I upload a modified version of "MyWidget" which has <preference name="pref1" value="updated"/><preference name="pref2" value="test2"/>

An instance is created for Bob. In his widget instance, pref1 = "updated" and pref2 = "test2". 

However, Alice's widget instance still has pref1 = "test", and no value for pref2.

This is the current default behaviour.


> 
> Just one question. 
> How can I push the preference into the server. Maybe deleting instances by hand in mysql? So the server will instanciate a new widget...
> 
> 
> Thank you scott.


Re: Does preferences are working?

Posted by Gonzalo Aguilar Delgado <ga...@aguilardelgado.com>.
> 
> I can replicate this one.
> 
> 
> Its an interesting case, as I can also see where, for example, a
> widget package contains a default value for a preference, and then a
> user overrides it with their choice, and then you update the package -
> in that instance, you don't necessarily want to overwrite the user-set
> preference.
> 
> 
> So I think this requires some thought as to what the expected
> behaviour should be.
> 
> 
> S

Hello Scott, 

Mmmm. You are right. I this case I will not want to override the value. 
Centaintly some thought must be put on this issue.

But in the case proposed the setting is not even there I think it's a
case clear to be considered. It should not harm anyone since it was not
there... In the same way if I remove one setting I will not want to
remove from instances. 

But there is some thing I don't get it. Instances. 

Because it will instanciate one widget when a user request it, I
suppose. Okay. 
But when it's removed? 

I'm asking because there may be one time when the server must put the
preferences as is. If no instance is on the server for a particular
widget then it must push every preference as it comes in the config. 

Do I explain myself? I really don't catch instances... Mainly because I
didn't get a look over widget live cycle... :D

Just one question. 
How can I push the preference into the server. Maybe deleting instances
by hand in mysql? So the server will instanciate a new widget...


Thank you scott. 

Re: Does preferences are working?

Posted by Scott Wilson <sc...@gmail.com>.
On 5 Mar 2013, at 18:35, Gonzalo Aguilar Delgado wrote:

> Hi Paul, 
> 
> I think I hit another bug. The preferences for me does not got updated. 
> 
> This is case use, could you try to see if this reproduces in your environment, please?
> 
> 
> 1.- Deploy a widget with id set in config without any preference.
> 2.- Update the wgt package with a set preference. 
> 
> The preference set in step 2 will never show. 

I can replicate this one.

Its an interesting case, as I can also see where, for example, a widget package contains a default value for a preference, and then a user overrides it with their choice, and then you update the package - in that instance, you don't necessarily want to overwrite the user-set preference.

So I think this requires some thought as to what the expected behaviour should be.

S

> 
> 
> 
> 
> 
> El mar, 05-03-2013 a las 13:32 +0000, Paul Sharples escribió:
>> 
>> On 05/03/2013 13:04, Gonzalo Aguilar Delgado wrote:
>> 
>>> 
>>> I just tried this but could not reproduce it, the preferences worked okay for me.
>>> 
>>> Do you mean that can put settings in config and you can get them in javascript?
>>> 
>> 
>> See the attached widget package.  On page load it gets the "servciesURL" that was defined in the config.xml.
>> Also you can set/get any preference using the web form.
>> 
>> Paul
>> 
>>> 
>>>   <preference name="servicesURL" value="http://localhost:8080/lead-services-war/services/rest/"/>
>>>     url = url || widget.preferences.getItem("servicesURL");
>>> 
>>> Are you running this against a specific version/build of wookie or are you using the current svn trunk?
>>> 
>>> It's just trunk...
>>> 
>>> Also If you want to send me your test .wgt package I can take a look.
>>> 
>>> It has lot's of dependencies on dojo and jquery so it will surely not work. 
>>> But if this works for you it should work for everyone.  I will take another look.
>>> 
>>> When I clean up the code I will put it online anyway.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> No virus found in this message.
>>> Checked by AVG - www.avg.com
>>> Version: 2013.0.2899 / Virus Database: 2641/6149 - Release Date: 03/04/13
>>> 
>> 


Re: Does preferences are working?

Posted by Gonzalo Aguilar Delgado <ga...@aguilardelgado.com>.
Hi Paul, 

I think I hit another bug. The preferences for me does not got updated. 

This is case use, could you try to see if this reproduces in your
environment, please?


1.- Deploy a widget with id set in config without any preference.
2.- Update the wgt package with a set preference. 

The preference set in step 2 will never show. 





El mar, 05-03-2013 a las 13:32 +0000, Paul Sharples escribió:
> On 05/03/2013 13:04, Gonzalo Aguilar Delgado wrote:
> 
> > 
> > 
> > I just tried this but could not reproduce it, the preferences worked
> > okay for me.
> > 
> > Do you mean that can put settings in config and you can get them in
> > javascript?
> > 
> 
> 
> See the attached widget package.  On page load it gets the
> "servciesURL" that was defined in the config.xml.
> Also you can set/get any preference using the web form.
> 
> Paul
> 
> 
> > 
> >   <preference name="servicesURL"
> > value="http://localhost:8080/lead-services-war/services/rest/"/>
> >     url = url || widget.preferences.getItem("servicesURL");
> > 
> > Are you running this against a specific version/build of wookie or
> > are you using the current svn trunk?
> > 
> > It's just trunk...
> > 
> > Also If you want to send me your test .wgt package I can take a
> > look.
> > 
> > It has lot's of dependencies on dojo and jquery so it will surely
> > not work. 
> > But if this works for you it should work for everyone.  I will take
> > another look.
> > 
> > When I clean up the code I will put it online anyway.
> > 
> > 
> > 
> > 
> > 
> > No virus found in this message.
> > Checked by AVG - www.avg.com
> > Version: 2013.0.2899 / Virus Database: 2641/6149 - Release Date:
> > 03/04/13
> > 
> 
> 

Re: Does preferences are working?

Posted by Paul Sharples <p....@bolton.ac.uk>.
On 05/03/2013 13:04, Gonzalo Aguilar Delgado wrote:
>
> I just tried this but could not reproduce it, the preferences worked 
> okay for me.
>
> Do you mean that can put settings in config and you can get them in 
> javascript?
>

See the attached widget package.  On page load it gets the "servciesURL" 
that was defined in the config.xml.
Also you can set/get any preference using the web form.

Paul

>
>   <preference name="servicesURL" 
> value="http://localhost:8080/lead-services-war/services/rest/"/>
>     url = url || widget.preferences.getItem("servicesURL");
>
> Are you running this against a specific version/build of wookie or are 
> you using the current svn trunk?
>
> It's just trunk...
>
> Also If you want to send me your test .wgt package I can take a look.
>
> It has lot's of dependencies on dojo and jquery so it will surely not 
> work.
> But if this works for you it should work for everyone.  I will take 
> another look.
>
> When I clean up the code I will put it online anyway.
>
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2013.0.2899 / Virus Database: 2641/6149 - Release Date: 03/04/13
>


Re: Does preferences are working?

Posted by Gonzalo Aguilar Delgado <ga...@aguilardelgado.com>.
I just tried this but could not reproduce it, the preferences worked
okay for me.

Do you mean that can put settings in config and you can get them in
javascript?


  <preference name="servicesURL"
value="http://localhost:8080/lead-services-war/services/rest/"/>
    url = url || widget.preferences.getItem("servicesURL");

Are you running this against a specific version/build of wookie or are
you using the current svn trunk?

It's just trunk...

Also If you want to send me your test .wgt package I can take a look.

It has lot's of dependencies on dojo and jquery so it will surely not
work. 
But if this works for you it should work for everyone.  I will take
another look.

When I clean up the code I will put it online anyway.




Re: Does preferences are working?

Posted by Paul Sharples <p....@bolton.ac.uk>.
On 05/03/2013 12:04, Gonzalo Aguilar Delgado wrote:
> Hello,
>
> I've just built a widget but it seems that cannot get preferences no 
> matter what I do.
>
> <widget xmlns="http://www.w3.org/ns/widgets"
> id="http://clt.level2crm.com/widgets/lead"
> version="0.1"
>         width="300"
>         height="200"
>         >
>   <name>lead</name>
> <!--     <feature name="http://jquerymobile.com" required="true"/> -->
> <!--     <access origin="*"/>   -->
>
>   <description>Access Lead Details</description>
>   <content src="index.html"/>
>   <icon src="images/icon.png"/>
>   <access network="false"/>
>   <author>Apache Wookie (Incubating) Team</author>
>   <preference name="servicesURL" 
> value="http://localhost:8080/lead-services-war/services/rest/"/>
> </widget>
>
>

I just tried this but could not reproduce it, the preferences worked 
okay for me.
Are you running this against a specific version/build of wookie or are 
you using the current svn trunk?
Also If you want to send me your test .wgt package I can take a look.

Paul

> /// JAVASCRIPT
>
> url = url || widget.preferences.getItem("servicesURL");
>
> is null I examined preferences, and there is not such key.
>
> Any help on this?
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2013.0.2899 / Virus Database: 2641/6149 - Release Date: 03/04/13
>