always glad to help. javafx is a fun technology.
On Sep 16, 2009, at 3:22 PM, Dan Haywood wrote:

>
> Cool.  I hoped that'd be the case, excellent to know so.
>
> Thanks for your time and the prompt answer!
>
> Cheers
> Dan
>
>
> On Sep 16, 11:13 pm, Joshua Marinacci <jos...@marinacci.org> wrote:
>> JavaFX can call any Java apis, so if you can do it in Java you can do
>> it in JavaFX. Yes, you can create any GUI widgets at runtime. The  
>> code
>> below creates a column of rows, where each row has a label with the
>> name of the field and a text box to edit the value. I've ignored the
>> Java reflection code required, but I assume you can already do that
>> part.
>>
>> - j
>>
>> class PojoField {
>>         var name:String;
>>         var value:String;
>>         var ref:Object;
>>
>> }
>>
>> class PojoInspector {
>>         public function getFields(cls:Class):PojoField[] {
>>                 // some code which inspects the class and returns a  
>> sequence of
>> PojoField objects
>>         }
>>
>> }
>>
>> var ins = PojoInspector{};
>>
>> VBox {
>>         content: for(field in ins.getFields(pogo.getClass())) {
>>                 HBox { content: [
>>                         Label { text: field.name }
>>                         TextBox { text: field.value  action:  
>> function() {
>>                                 //some reflection code to call the  
>> setter on field.ref
>>                         }}
>>                 ] }
>>         }
>>
>> }
>>
>> On Sep 16, 2009, at 3:06 PM, Dan Haywood wrote:
>>
>>
>>
>>> Sure... that was a rather vague question (and I think I probably
>>> abused the term 'metaprogramming' horribly).
>>
>>> Anyhoo, my project builds a metamodel from the pojo domain model
>>> (equivalent to a Hibernate .hbm model), and then we use this to
>>> programmatically create widgets on the UI corresponding to the
>>> properties, collections and public operations exposed by the pojo.
>>
>>> I think my question really is: is there to write something like:
>>
>>> for(Field field: pojo.getClass().getFields()) {
>>>    JavaFXWidgetThingy widget = new JavaFXWidgetThingy();  //
>>> simplified: would actually want to create a widget of the correct  
>>> sort
>>> based on the field type
>>
>>>    ... wire up listeners and bindings on the widget for the field of
>>> the pojo ...
>>
>>>    addToForm( widget );
>>> }
>>
>>> The fact that the loop is driven from a metamodel is I suppose
>>> irrelevant to the question.
>>
>>> Am I off base? does this make sense as a question?
>>
>>> Thx!
>>> Dan
>>
>>> --------
>>
>>> On Sep 16, 10:52 pm, Joshua Marinacci <jos...@marinacci.org> wrote:
>>>> can you define what you mean by 'metaprogramming' in this context?
>>>> On Sep 16, 2009, at 2:31 PM, Dan Haywood wrote:
>>
>>>>> Hi all, first post!
>>
>>>>> Since we have knowledgeable people responding on another thread
>>>>> about
>>>>> JavaFX, I have another question, namely, is there any way to do
>>>>> metaprogramming in JavaFX.  I currently work on an open source
>>>>> framework (below) that builds a generic OO UI from a metamodel,
>>>>> built
>>>>> up programmatically.
>>
>>>>> I'm thinking that JavaFX is an obvious technology for a new UI,  
>>>>> but
>>>>> what I need to know is ... does JavaFX provide similar  
>>>>> programmatic
>>>>> APIs for assembling the layout?
>>
>>>>> Thx
>>>>> Dan
>>>>> http://danhaywood.com
>>>>> "Domain Driven Design using Naked 
>>>>> Objects",http://pragprog.com/titles/dhnako
>>
>>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javaposse@googlegroups.com
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to