pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From calathus <calat...@gmail.com>
Subject Re: [pivot] are there any tools to convert bxml to Java?
Date Mon, 03 Jan 2011 17:18:03 GMT
On Mon, Jan 3, 2011 at 8:38 AM, Greg Brown <gk_brown@verizon.net> wrote:

> If the attribute was processed in the opening tag, we'd get an
>> IndexOutOfBoundsException, since the Labels would not have been added yet.
>>
>
> This is the problem I faced. But most of other attribute seems OK to set at
> the opening tag.
>
>
> Correct - many attributes can be set in the opening tag, but any that have
> dependencies on child elements cannot. Since there is no harm in setting all
> attributes in the closing tag, that is what we do.
>
> If Pivot is used only through BXML, these order are hidden from user, it
> may not matter.
> But if it is directly used in Java codes, this makes code hard to read.
>
>
> Agreed, but if you are hand-coding using your builder style, you can put
> the setters wherever you like. If you are using a BXML to Java converter, it
> doesn't really matter where they go because the generated code isn't really
> meant to be human-readable (that's what BXML is for).
>

This is quite opposite for my purpose. I would want to have human readable
Java code. In fact, If we do start using this builder style, we will not
need BXML file nor this converter. This tools is useful for migration or to
understand how to write Java code using existing Pivot sample bxml files.
(Since there are not much such direct Java source codes samples in Pivot
project)

One of my main objective for using Java was to develop generic class library
for basic CRUD feature.
So it is important, these Java code is human readable.
I have already changed the code generation so that it generate attribute
setters at the closing tag. But it is not acceptable for readability point
of view.
 It is equivalent asking to write bxml file with some attribute after
element declaration.




>
> Also this cases, I wonder why it just can't set the initial index value.
> The Pivot code may select element after tabs tag is closed if selectedIndex
> is defined.
>
>
> Not sure what you mean. TabPane has a default value for selectedIndex.
> However, TabPane doesn't know anything about a closing tag - only
> BXMLSerializer knows about that.
>

I have not looked at the current codes for  selectedIndex, but if it creates
a selectedIndex function and register in a list of post evaluation function
 associated with the corresponding element, when the tag is closed, it can
start evaluation these functions. This approach will allow to set
 selectedIndex just after the opening tag.
Essentially it is hard for user to remember which attributes must be set
after elements declaration, and even if it is done so, the code is not easy
to read. So these things should be handled by the Pivot core level.



>
> G
>
>


-- 
Cheers,
calathus

Mime
View raw message