Sorry again, I double checked the code and you should use the full
class name for
your bootstrap class in the include="". The code is as follows,
protected String getWidgetBootstrapClassFullName(String name){
if(name == null || name.trim().length() == 0)
return null
String trimed = name.trim()
//package name provided, assume it is the full class name
if(trimed.contains(PACKAGE_DELIMITER)){
return trimed
}else{
//use the name conversion org.tellurium.widget.MODULE.Init
//where Bootstrape should implement the interface
WidgetBootstrap
return "org.tellurium.widget.${trimed}.Init"
}
}
It has been a while since I touched the widget. Sorry for any
confusion.
Thanks,
Jian
On Feb 25, 10:03 am, John <[email protected]> wrote:
> Sorry, the include="xxx" wired in package name, please see the widget
> wiki page description as follows,
>
> If you use your own package name for the bootstrap class, for example,
> com.mycompay.widget.Boot, then you should specify the full name there
> like
>
> widget{
> module{
> //define your widget modules here, for example Dojo or
> ExtJs
> included="com.mycompay.widget.Boot"
> }
> }
>
> On Feb 25, 9:56 am, John <[email protected]> wrote:
>
> > Hi Hari,
>
> > There are two things here,
>
> > First, the included="XXX" in TelluriumConfig.groovy should include
> > your bootstrap class name,
> > not the widget name
>
> > Second, for widgets, you better to define a module to include all
> > widgets you want
> > to define. That is to say, you should define a base class like,
>
> > abstract class ExtJSWidget extends Widget {
> > public static final String NAMESPACE = "ExtJS"
>
> > }
>
> > The namespace is used to avoid widget name collision. Then your
> > widgets should extend
> > this base class so that they come with the same namespace.
>
> > Actually, the extjs-widget project is an empty template project,
> > please check it out
> > and play around and you will see how widget works.
>
> > Please let me know if you have any further questions.
>
> > Thanks,
>
> > Jian
>
> > On Feb 25, 8:40 am, Harihara Vinayakaram <[email protected]> wrote:
>
> > > Hi
> > > When I try to define my own widget I am getting the following problem
> > > when I try to run my test case . Can somebody point out what am I missing
>
> > > Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException:
> > > Cannot cast object 'com.yostech.yoscare.widget.richcalen...@856c134' with
> > > class 'com.yostech.yoscare.widget.RichCalendar' to class
> > > 'org.tellurium.widget.WidgetBootstrap'
>
> > > I have the following definitions all the 3 are defined in the same
> > > package
> > > com.yostech.yoscare.widget;
>
> > > ########
> > > class RichCalendar extends Widget {
> > > public void defineWidget() { ..... }}
>
> > > ################
> > > class RichCalendarBuilder extends UiObjectBuilder {
>
> > > public build(Map map, Closure c) {
> > > //add default parameters so that the builder can use them if not
> > > specified
> > > def df = [:]
> > > RichCalendar richcalendar = this.internBuild(new RichCalendar(),
> > > map, df)
> > > richcalendar.defineWidget()
>
> > > return richcalendar
> > > }
>
> > > }
>
> > > ##############
> > > class Init implements WidgetBootstrap{
>
> > > public void loadWidget(UiObjectBuilderRegistry
> > > uiObjectBuilderRegistry)
> > > {
> > > if(uiObjectBuilderRegistry != null){
>
> > > uiObjectBuilderRegistry.registerBuilder("com.yostech.yoscare.widget.RichCalendar",
> > > new RichCalendarBuilder())
>
> > > }
> > > }
>
> > > and the TelluriumConfig has
> > > widget{
> > > module{
> > > //define your widget modules here, for example Dojo or ExtJs
> > > // included="dojo, extjs"
> > > included="com.yostech.yoscare.widget.RichCalendar"
> > > }
> > > }
>
> > > Regards
> > > Hari
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---