brain fog with building a jface tree viewer [message #460294] |
Tue, 23 August 2005 14:31  |
Eclipse User |
|
|
|
Hi,
I'm having a tough time mapping my domain model to a jface tree viewer.
Best way to describe it is with an example.
I have a house and my house has a collection of doors and rooms, these two
collections are implemented as object arrays. In my tree I want the user
to be able to expand the house node and see two child nodes one for the
rooms and one for the doors.
I'm stuck at trying to implement this when my collections are represnted
as object arrays instead of a single objects that wrap the underlying
collection. For example, if changed my domain model so that the house
collection and door collection are each represented by thier own class (eg
HouseCollection and DoorCollection) then I could this because in the
getChildren[] method of JfaceContent Provider I'd return the two
collection objects.
But if the collections are arrays then I can't define the two collections
as two child nodes as I'd be returning a joined object array containing
both the doors and the rooms (atleast thats what I think I would do)
I can live with having to create an object to wrap all my collections but
the pain of changing my hibernate domain model seems to be a real pain.
There has to be a way, can anyone help clear the fog? - Duncan
|
|
|
|
|
Re: brain fog with building a jface tree viewer [message #460773 is a reply to message #460294] |
Tue, 06 September 2005 22:49  |
Eclipse User |
|
|
|
I would probably create two 'dummy' classes (Doors, Rooms) to do the
behavior you describe (they could just take in the object[] in their
constructor, these could also even be private classes defined in the
model class)...
Duncan Krebs wrote:
> Hi,
> I'm having a tough time mapping my domain model to a jface tree viewer.
> Best way to describe it is with an example.
> I have a house and my house has a collection of doors and rooms, these
> two collections are implemented as object arrays. In my tree I want the
> user to be able to expand the house node and see two child nodes one for
> the rooms and one for the doors.
>
> I'm stuck at trying to implement this when my collections are represnted
> as object arrays instead of a single objects that wrap the underlying
> collection. For example, if changed my domain model so that the house
> collection and door collection are each represented by thier own class
> (eg HouseCollection and DoorCollection) then I could this because in the
> getChildren[] method of JfaceContent Provider I'd return the two
> collection objects.
> But if the collections are arrays then I can't define the two
> collections as two child nodes as I'd be returning a joined object array
> containing both the doors and the rooms (atleast thats what I think I
> would do)
>
> I can live with having to create an object to wrap all my collections
> but the pain of changing my hibernate domain model seems to be a real
> pain. There has to be a way, can anyone help clear the fog? - Duncan
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.47253 seconds