On Feb 15, 2008, at 10:24 AM, Adrian Crum wrote:
Thanks David! I'll try your suggestion.
Regarding the Dojo support strategy I had in mind: it has been
mentioned in the past that something like that could be implemented
by extending the existing HTML rendering classes. I agree with that
view, since these libraries simply add attributes and such to
regular HTML. Hence the factory method - a properties file specifies
which rendering classes to use. It works the same way as the
FreeMarkerWorker loading transforms thing.
Maybe we should step back then and discuss it in terms of possible
usage rather than what is possible on the technology level.
I hadn't gotten to the widget XML side of things yet. The ideas I've
had so far try to keep within the constraint that the widget XML
files should be rendering-platform independent. I don't have any
specifics yet, but the general idea I had in mind was to keep the
existing widget elements, but have an additional element attribute
that allows developers to pass library-specific data to the
rendering classes.
Wouldn't that right there break the whole idea of being rendering
platform independent?
Anyways, I was planning on submitting my current work to Jira for
review and comment. Let me work out this one problem, submit the
patch to Jira, and then we can work out how to support Dojo, Ajax,
etc. Does that sound okay?
I'm sure something good will come of it, but in general a bit more
planning and design might result in something more effective and long-
term applicable.
-David
David E Jones wrote:
You should be able to cast the ones you pass in, but I'm still not
totally sure how you're doing this.
Could you send a code snippet or just commit the code you're
working on in an inactive state (ie not called by anything)?
BTW, in general for the AJAX stuff my thought was to add new widget
elements to the screen definition for new types of UI elements,
like an AJAX combo-box that does server-side lookups as the user is
typing things in. I think we already have another combobox that is
pre-populated when the page is loaded, but I'd rather have these be
different in the screen definition XML so that both could be used
and it would be easy to switch between them.
In other words, I don't know if there is any place where we would
override the default functionality, I'd rather add these as new
features with new XML elements (or attributes to extend existing
ones) and make them otherwise independent of the existing stuff.
-David
On Feb 15, 2008, at 8:50 AM, Adrian Crum wrote:
I'm working on modifying the screen widgets to support Dojo (or
any other third party library). I set up the widgets to get their
rendering classes from a factory method instead of using the new
operator. The factory method uses the ObjectType.getInstance(...)
methods to create the class instances.
Everything works great except for one thing. Some of the rendering
classes have constructors that take
javax.servlet.http.HttpServletRequest
javax.servlet.http.HttpServletResponse
arguments. When I use the request and response objects found in
the screen widget context as arguments for the
ObjectType.getInstance(...) method, an exception is thrown -
because the objects don't implement the correct interfaces:
java.lang.NoSuchMethodException:
org
.ofbiz
.widget
.html
.HtmlFormRenderer
.<init>(org.apache.catalina.connector.RequestFacade,
org.apache.catalina.connector.ResponseFacade).
Those classes implement the javax.servlet.ServletRequest and
javax.servlet.ServletResponse interfaces - which are the super
interfaces of the ones needed for the constructor.
I'm stuck. I don't know where to go from here.
Any ideas?
-Adrian