Hi Rudy, You are right, I double checked and the widget in 0.7.0 has problem. The jQuery UI widget was created for 0.8.0, not for 0.7.0. I do apologize for the wrong information. Please change to 0.8.0 snapshot, which is almost the same as 0.7.0.
Please let us know if 0.8.0 snapshot works for you. Thanks, Jian On Mon, Aug 23, 2010 at 9:48 AM, Jian Fang <[email protected]> wrote: > Hi Rudy, > > You are right about the delegate annotation. But I defined a locator > attribute in the WidgetDslContent class > and set its locator as the parent locator. > > public Widget(){ > i18nBundle = Environment.instance.myResourceBundle(); > dsl = new WidgetDslContext(); > dsl.locator = this.locator; > ui = dsl.ui; > } > > As far as I understand, Groovy comes with default setters and getters, > shouldn't > dsl.locator = this.locator > > is actually a setter? > > dsl.setLocator(this.locator) > > I will double check the jQuery example from the release package and let you > know about the result soon. > > But something was wrong there since you got the error. > > Thanks, > > Jian > > > On Sun, Aug 22, 2010 at 11:53 PM, Rudy Bonefas <[email protected]> wrote: > >> Jian, >> >> Heres my problem. >> >> I build my ExtJS Widget following your jquery example. However when I >> run my app using tellurium 0.7 >> i get the following stack trace >> groovy.lang.MissingPropertyException: No such property: locator for >> class: org.telluriumsource.ui.widget.WidgetDslContext >> at >> >> org.telluriumsource.ui.widget.WidgetDslContext.locatorMappingWithOption(WidgetDslContext.groovy: >> 31) >> at >> >> org.telluriumsource.ui.widget.WidgetDslContext.locatorMapping(WidgetDslContext.groovy: >> 23) >> ... at org.telluriumsource.dsl.BaseDslContext >> $_type_closure9.doCall(BaseDslContext.groovy:208) >> ... at org.telluriumsource.ui.object.InputBox.type(InputBox.groovy:22) >> at org.telluriumsource.ui.object.InputBox$type.call(Unknown Source) >> at >> org.telluriumsource.dsl.BaseDslContext.type(BaseDslContext.groovy: >> 207) >> at org.telluriumsource.dsl.BaseDslContext$type.call(Unknown Source) >> at org.telluriumsource.ui.widget.Widget.type(Widget.groovy) >> at org.telluriumsource.ui.widget.Widget$type.callCurrent(Unknown >> Source) >> at >> >> org.telluriumsource.ui.widget.extjs.object.ComboBox.setType(ComboBox.groovy: >> 32) >> at >> org.telluriumsource.ui.object.UiObject.invokeMethod(UiObject.groovy) >> at >> org.telluriumsource.dsl.DslContext.onWidget(DslContext.groovy:56) >> at uimodule.ListingFormModule.setType(ListingFormModule.groovy:24) >> at uimodule.ListingFormModule$setType.call(Unknown Source) >> at test.TestCase1.testAddListing(TestCase1.groovy:39) >> >> I believe the problem is your use of the @Delagate annotation in the >> Widget class in respect to WidgetDSLContext >> >> The WidgetDSLContext method locationMappingWithOption references >> this.locator under the mistaken belief that the delegate class has >> access to the members of its >> outer containing class (in this case Widgets parent UIObject which >> does indeed have its locator member set). This is not how delegates >> work. Designating a member as a delegate allows >> you to invoke all of the delegates methods on the container class but >> these invocations are merely DELEGATED to the delegate member, they do >> not occur in the context of the outer class. Therefore the this in >> this.locator >> in locationMappingWithOption is the WidgetDSLContext member 'dsl' in >> the Widget class and it has no locator. If you don't believe me try >> running the following 2 small classes: >> >> class B { >> >> public showMeTheLocator() >> { >> println locator; >> } >> } >> class A { >> >> @Delegate >> B b = new B(); >> >> def locator = "I AM THIS CLASSES LOCATOR" >> >> public static void main(String[] args) >> { >> A a = new A(); >> a.showMeTheLocator() >> } >> } >> >> B simply cannot access A's locator member. we're delegating not >> inheriting. >> >> >> I believe the jquery example was built under 0.6; in the >> DateTimePickerBuilder it calls datepicker.dsl.locator = >> datepicker.locator, This does not work in 0.7 for 2 reasons, 1) the >> dsl member is private and 2) even if it were'nt, it has no locator >> member. >> >> Rudy >> >> >> On Aug 21, 10:31 pm, Jian Fang <[email protected]> wrote: >> > Widget object extends UiObject and thus, it has a locator attribute. >> Please >> > see the jquery-ui project >> > as a reference. >> > >> > But I want to remove the locator in the widget object in the future >> because >> > a widget should be an encapsulation of >> > a set of UIs and it only needs options to define itself. To further >> define >> > the location of a widget, you can specify the >> > locator of the UI object that references the widget. >> > >> > Could you tell me your use case that you need a locator for the widget? >> > >> > Thanks, >> > >> > Jian >> > >> > >> > >> > On Sat, Aug 21, 2010 at 8:05 PM, Rudy Bonefas <[email protected]> >> wrote: >> > > Is it possible to use a clocator in a widget class definition? I >> > > tried this but at run time I get >> > >> > > groovy.lang.MissingPropertyException: No such property: locator for >> > > class: org.telluriumsource.ui.widget.WidgetDslContext >> > > at >> > >> > > >> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdap >> ter.java: >> > > 49) >> > >> > > Seems a shame if this is true since the composite locator allows me >> > > to not have to write a full XPath query. >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "tellurium-users" group. >> > > To post to this group, send email to [email protected] >> . >> > > To unsubscribe from this group, send email to >> > > [email protected]<tellurium-users%[email protected]> >> <tellurium-users%2Bunsubscribe@ googlegroups.com> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/tellurium-users?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en.
