Isn't it worth the extra ease of use to teach WKTXSerializer that an onXXX attribute indicates a listener method addition and it should search through the available listener interfaces to find a matching method?
I realise that it's not as clean from a parsing standpoint, but it would be a really easy to use and easy to explain syntax. Especially given that Pivot plays in the web space. I suppose how much effort goes into making this easy is dependent on how often people code WKTX files by hand. -- Noel. On Wed, Sep 2, 2009 at 19:56, Greg Brown<[email protected]> wrote: > Also, the arguments passed to the handler function would be accessible via > an implicit "arguments" variable (similar to the implicit "event" variable > in HTML/JS). > > > On Wednesday, September 02, 2009, at 01:23PM, "Todd Volkert" > <[email protected]> wrote: >> > > Note that WTKXSerializer is generic and knows nothing of specific classes - > it works all on policy and introspection. Given that fact, here are the > issues that need solving: > > We need to communicate what property of the button we're accessing (in this > case, buttonPressListeners:ListenerList<ButtonPressListener>). > We need to communicate what method of the interface we've implemented. > > The onButtonPressed="" solution doesn't address #1 above. With an eye > towards solving these two problems, I just went to a whiteboard and > brainstormed, and I think I have a workable solution. How about this > syntax: > > <Sheet wtkx:id="sheet" ...> > ... > <PushButton buttonData="OK" > ButtonPressListener.buttonPressed="sheet.close(true);" /> > ... > </Sheet> > > By policy, WTKXSerializer would see "ButtonPressListener.[*]", recognize > ButtonPressListener as an interface, and know to look for a > getButtonPressListeners():ListenerList<?> method on PushButton. The > "buttonPressed" tells us what method of the interface we're implementing. > > Thoughts? > -T > > On Wed, Sep 2, 2009 at 11:30 AM, Noel Grandin <[email protected]> wrote: >> >> Hi >> >> Maybe this is a place we can steal a page from HTML-style coding? >> >> Define a short-hand syntax something like: >> >> <PushButton buttonData="OK" >> onButtonPressed="javascript:application.doAction()"> >> </PushButton> >> >> -- Noel. >> >> Todd Volkert wrote: >> >> Unfortunately, there's not really any more that can be trimmed off of >> this. Technically, in your case, you don't need the CDATA tag, but it's not >> recommended to remove this, as you could then accidentally create invalid >> XML. >> >> -T >> >> On Wed, Sep 2, 2009 at 11:05 AM, Vicente de Rivera III >> <[email protected]> wrote: >>> >>> Hi, >>> >>> Looking at the itunes demo, I've managed this >>> >>> <PushButton buttonData="OK"> >>> <buttonPressListeners> >>> <wtkx:script> >>> <![CDATA[ >>> function buttonPressed(button) { >>> application.doAction(); >>> } >>> ]]> >>> </wtkx:script> >>> </buttonPressListeners> >>> </PushButton> >>> >>> where application is a reference to the Java class which would be my >>> Controller. Although I'm really grateful that I got a cleaner Java code, I'd >>> like to ask if there a more clever way to reduce this code :D >>> >>> thanks you so much! >>> - >>> thirdy >>> >>> On Tue, Sep 1, 2009 at 7:34 PM, Greg Brown <[email protected]> wrote: >>>> >>>> You might try defining your event handlers in WTKX. That helps associate >>>> them with the components to which they apply, and forces you to define a >>>> clear public API in your main class (or classes). >>>> Re: CRUD apps - I would suggest returning your result sets as JSON and >>>> using data binding to populate your forms. >>>> G >>>> >>>> On Aug 31, 2009, at 10:32 PM, Vicente de Rivera III wrote: >>>> >>>> Hi, >>>> >>>> I've recently finished my first Pivot app, >>>> http://lazychick-4ita.appspot.com/ >>>> But my code is really unmaintainable specially with handling exceptions >>>> from web queries. And I got all >>>> event handling in one Main class, actually I got everything in the Main >>>> class and 3 wtkx files. >>>> >>>> Now that I'm ready to start my new app. How can I solve this? What >>>> Design patterns do you recommend when developing with Pivot? Let's say for >>>> example, a Pivot desktop CRUD app with a JDBC backend >>>> >>>> Thanks!!! >>>> - >>>> thirdy >>>> >>> >> >> > >
