pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: Design Patterns
Date Wed, 02 Sep 2009 17:23:06 GMT
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:

   1. We need to communicate what property of the button we're accessing (in
   this case, buttonPressListeners:ListenerList<ButtonPressListener>).
   2. 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 <noelgrandin@gmail.com> 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 <
> thirdy.derivera@gmail.com> 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 <gkbrown@mac.com> 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
>>>
>>>
>>>
>>
>
>

Mime
View raw message