0

I have third-party property class, which has it's contents implemented arbitrary. Some properties are implemented bean-like, others -- as key value pairs.

I need to implement property editor like this

enter image description here

What is the simplest way to do that?

I emphasize that model class is out of any requirements.

UPDATE

I mean is there anything more powerfull than just TableViewer? May be some classes which support Properties, or annotation library that helps to mark editor type etc...

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

2 Answers2

1

If I understand your question correctly:

  • You have a number of third-party classes. Each of these classes are bean-like, but are not full java beans.
  • You want a GUI to edit the properties of those classes. Preferably with as little effort as possible.

The easiest way (in terms of coding) is the following:

However: think of the following two potential bugs and how you would go about fixing them.

  • Some other action (outside of the Properties view) changes values in your third-party class. Since there is no notification framework, the GUI will still be displaying the old values.
  • Do you need to be able to support UNDO/REDO ?

Both of the above problems are difficult to solve when you use third-party classes. Therefore, I would seriously advise you to learn EMF and use an EMF model as your 'primary data source'. Only modify that central data source, and synchronize with the third-party object structure at specific moments (after a model transaction, for example).

parasietje
  • 1,529
  • 8
  • 36
0

You'll just have to use reflection. Get all the methods of the class which look like getters/setters, use the standard editors for known types (String, Color, etc.), and recurse on other types.

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487