For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 4 replies, 3 voices, and was last updated 16 years, 4 months ago by
sijiafin.
-
AuthorPosts
-
AlastairMemberI am currently evaluating MyEclipse from the perspective of using it for developing simple GUI components using the embedded Matisse designer, and have a particular question relating to data binding in tables.
We will create a lot of components containing tables which will display information relating to a single type and so the creation and mapping of these tables needs to be as simple and quick as possible.
To aid clarity, here are two sample classes along with a Converter implementation:
public abstract class BaseDataObject { private final Map<String, Object> mapAttributeNamesToValues; public BaseDataObject() { // This map is populated somewhere automatically this.mapAttributeNamesToValues = new HashMap<String, Object>(); } public Set<String> getAttributeNames() { final Set<String> attributeNames = Collections.unmodifiableSet( this.mapAttributeNamesToValues.keySet() ); return attributeNames; } public BaseDataObject getModel() { return this; } } public class SimpleDataObject extends BaseDataObject { public BaseDataObject() { } } public class BaseDataObjectToTableColumnModelConverter extends Converter<BaseDataObject, TableColumnModel> { BaseDataObjectToTableColumnModelConverter() { } @Override public TableColumnModel convertForward( BaseDataObject value ) { final TableColumnModel model = new DefaultTableColumnModel(); for ( final String nthAttribute : value.getAttributeNames() ) { final TableColumn nthColumn = new TableColumn( 100 ); nthColumn.setHeaderValue( nthAttribute ); model.addColumn( nthColumn ); } return model; } @Override public BaseDataObject convertReverse( TableColumnModel value ) { return null; } }
The plan is to have a converter which will be able to construct a TableColumnModel instance given a BaseDataObject instance and this is working ok, using the sample code shown below.
org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings .createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_ONCE, testDataObject, org.jdesktop.beansbinding.ELProperty .create("${model}"), jTable1, org.jdesktop.beansbinding.BeanProperty .create("columnModel")); binding.setConverter( new BaseDataObjectToTableColumnModelConverter() );
However, what I am unable to achieve is the setting up of the converter visually in the ‘Advanced’ tab of the properties editor as it always appears to be disabled. Can you tell me why that would be please?
Also, is there a way of obviating the need for the BaseDataObject.getModel method so that the framework automatically passes the BaseDataObject to the converter?
Any help would be much appreciated.
Alastair.
July 25, 2008 at 11:33 pm #287584
Loyal WaterMemberAlastair,
I have asked the dev team to look into this issue. I’ll get back to you with an update asap.July 30, 2008 at 2:25 am #287744
AlastairMemberHi Nipun,
Is there any feedback on this yet?
Thanks,
Alastair.
July 30, 2008 at 12:07 pm #287771
Loyal WaterMemberAlastair,
This seems like a bug that needs to be fixed. The 7.0 release M1 is being tested by the team at the moment so this can’t go in the 7.0 release. This would be addressed in the release after 7.0.May 20, 2009 at 1:07 pm #298585
sijiafinMemberYou might also want to try this synchronization tool as an outside tool of reference.
-
AuthorPosts