>
> If you create a class Foo that extends Component, you can use it in BXML
> just like any other component
>

True, if Foo is defined solely in Java. But that's not what I'm talking
about.  I want to create components using bxml with Java behind them.
 Which, if one reads the various tutorials and your replies to other
messages, seems to be what you think, too.  And you can only use that kind
of component in someone else's BXML via the include construct.  It would be
cool if that weren't so.  Suppose there were another entry into the
bxmlserializer that I could call from my constructor to say "make my content
be the stuff you find in the following bxml file" (which at least
conceptually is what happens in the InitializeComponent call in every
xaml-based class in WPF).  Then I could even do new Foo() from other Java
code that's constructing some UI on the fly.

I'm puzzled that you're not following me.  I must really be thinking of UI
construction very differently than you.  So I'll take a stab at the concrete
example you ask for.

Here's an example of the "making it manageable" situation that comes up
periodically for me.  An app has a settings dialog, with a bunch of tabs
devoted to different categories of settings.  You could create a monster
bxml file whose main portion looks like this:

<TabPane ...>
  <TablePane bxml:id="tabGeneral" TabPane.tabData="General">
        ... lots of stuff ...
  </TablePane>
  <Form bxml:id="tabContact" TabPane.tabData="Contact Info">
        ... other stuff  ...
  </Form>
  <Panel bxml:id="tabCreative" TabPane.tabData="Go Wild">
        ... silly stuff ...
  </Panel>
  ... more tabs ...
</TabPane>

and have a huge pile of code in the settings dialog class to initialize the
fields and later process them when the user clicks OK.

But to make it manageable, especially if different people are responsible
for each category, I'd much rather have the main dialog look like

<TabPane ...>
  <my:TabSettingsGeneral />
  <my:TabSettingsContact  />
  <my:TabSettingsCreative />
  ...
</TabPane>

Then I'd take that big blob of bxml from the first tab and put it
into TabSettingsGeneral.bxml, and put the code responsible for initializing
it and processing it into TabSettingsGeneral.java.  And similarly for the
other tabs.

Of course, I can't quite do it that way, for the reasons described in my
first paragraph, so in the current Pivot I settle for

<TabPane ...>
  <bxml:include src="TabSettingsGeneral.bxml" />
  <bxml:include src="TabSettingsContact.bxml" />
  <bxml:include src="TabSettingsCreative.bxml" />
  ...
</TabPane>

And, of course TabSettingsGeneral.bxml has to be wrapped in my new Java
class so that it will create the class:

<my:TabSettingsGeneral ...>
   ... the actual blob from above ...
</my:TabSettingsGeneral>

Am I being any clearer yet?

By the way, in the reorganization I described above I left out the setting
of TabPane.tabData for each component.  I can't put it
in TabSettingsGeneral.bxml, because the serializer apparently doesn't know
it's inside a TabPane at that point.  So I was pleased but rather surprised
to find that the following works:

<bxml:include src="TabSettingsGeneral.bxml" TabPane.tabData="General"/>

What else can you put in an include element?

Reply via email to