pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gk_br...@verizon.net>
Subject Re: [pivot] are there any tools to convert bxml to Java?
Date Tue, 04 Jan 2011 19:55:54 GMT
Incidentally, I think this discussion may actually argue in favor of adopting a "table column
model" approach. Right now, the "columns" property is read only. If we make it writable, you
could simply provide a custom Sequence wrapper around your bean Class<?>. It would also
facilitate column model sharing. We currently support that via the "columnSource" property,
but maybe the model approach would be better.

On Jan 4, 2011, at 2:45 PM, Greg Brown wrote:

>> > Since these class info is used to initialize the internal attributes and elements
of TableView instance, if this class info was set after the generic class instance is created,
we need to call some initialization method at the timing.
>> 
>> Can you elaborate on your concern here?
>> 
>> My concern is rather purity of implementation. If we don't call setBeanType(cls),
the created object don't have any specific GUI info since it has no info to create it.
> 
> It will still have a GUI - by default, TableView contains an empty column sequence, which
is perfectly valid. Calling setColumns(Class<?>) would simply create a new (non-empty)
sequence.
> 
>> So the initialization must be taken place at the setter setBeanType(cls), 
>> for instance it will be :
>> 
>> void setBeanType(Class<?> cls) {
>>     this.cls = cls;
>>     initialize();
>> }
>> 
>> void initialize() {
>>     for (final Field field: cls.getFields()) {
>>             	final String fname = field.getName();
>>             	getColumns().add(new TableView.Column() {{
>>             		setName(fname);
>>                     setWidth(3, true);                            
>>                     ....
>> }
> 
> Why not just put the initialize() code in the setter? Nothing else needs to call it.
> 
>> If setter is invoked twice, i will initialize twice (although we can use some flag
to avoid this, but I think it is ugly)
> 
> Why would the setter be invoked twice?
> 
>> So conceptually, it is better to pass class object at the time of instance creation.
> 
> That isn't supported in BXML. Anything instantiated in BXML needs a default no-arg constructor
- all properties are specified via setters.
> 
> G
> 
> 


Mime
View raw message