>-----Original Message----- >From: Jasha Joachimsthal [mailto:[email protected]] >Sent: Tuesday, August 23, 2011 11:39 AM >To: [email protected] >Subject: Re: Widget type attribute > >On 23 August 2011 16:55, Franklin, Matthew B. <[email protected]> wrote: > >> >-----Original Message----- >> >From: Carlucci, Tony [mailto:[email protected]] >> >Sent: Tuesday, August 23, 2011 10:36 AM >> >To: [email protected] >> >Subject: RE: Widget type attribute >> > >> >-----Original Message----- >> >From: Jasha Joachimsthal [mailto:[email protected]] >> >Sent: Tuesday, August 23, 2011 8:36 AM >> >To: [email protected] >> >Subject: Widget type attribute >> > >> >> The type attribute for a Widget object is now a String. Shouldn't we >> change >> >> this into an enum to be sure that its value only contains known values? >> > >> >+1 >> >> I disagree. If we change it to an enum, then we lose the ability to add >> providers easily. Currently, to add a provider, you only need to create >> beans that implement the correct interfaces and add javascript to handle >> the client-side rendering pieces. So long as the beans are in the >> application context at runtime and the script is included in the JSP, the >> new provider will be automatically enabled. By constraining widget types to >> an enum, the enum will need to have all potential widget types, which may >> not be the case. If I am Joe Widget Writer with my own proprietary widget >> type, I don't want to modify core rave code to make my provider work. >> > >Good point. Enum is too strict for that. I'm working on the "Add widget" >form and it would be nice if there is a way to be sure that the type of >widget to be added is known. What about looking up the possible values in a >WidgetType table (bean)?
We can work on the provider SPIs so that everything is a little more explicit, but for now you could just auto-wire in the RenderService and get the collection of supported widgets. That way you can be sure that there is a currently configured provider for the widget you are adding. >You can add your proprietary WidgetType. We can also build a feature that >certain (supported) widget types are made unavailable by Mike Website >Administrator (if he only wants W3C widgets but no OpenSocial gadgets). > I think we will want to support the ability to turn on or off widget providers, but I would wait on that until we decide how we really want to manage widget providers... >Jasha
