JList doesn't support MVC!!

J

Jeach!

What does work:

For years my application ran by using my own MVC framework (amoungst
others). I have a couple of hundred different model objects each with
their own couple of views.

Thus far I've been limited to popping up a few windows (dialogs and
frames) which contained one or more views bound to a model. Whenever a
model was updated from a remote entity, all other registered views on
such model would successfully updat themselves.

What doesn't work:

My requirements lately have changed and I must make use of a JList to
display my views instead of JDialogs and JFrames. But at my first wack
at this, I was EXTREMLY disapointed to learn about the limitations of
the JList component...

1. When you use a ListCellRenderer implementation to pass the view to
be rendered, which in my case is a simple JPanel with a JCheckBox,
JTextField, JRadio or any combination thereof, the damn thing doesn't
actually render as 'itself' (the actual component), but rather it is
rendered as a 'rubber stamp'! Ouch!!!!

2. Now when my models get modified from a remote entity and request for
all views to update... well, they don't because there is no way for the
parent component (the JList) to know that its child (one of the JPanel)
needs updating? Of course I could invoke a validate() and repaint() on
the list, but what kind of object relationship will I have to create
here? It wouldn't be proper for each view (each JPanel) to be aware of
its parent (the JList). Or the model to be aware of the JList.

Has anyone encountered this problem before? Or one of these problems?
I know that some of you will tell me to fix issue #1 by implementing a
JTable to look like a JList and use a cell editor, but this is NOT
acceptable in my opinion!
 
A

Andrew Thompson

Jeach! said:
What does work:

X-posting to a limited set of well chosen groups.

What does *not* work:

Multi-posting.

...please refrain from multi-posting in future.

(X-post to c.l.j.p./h., w/ f-u to c.l.j.h. only)

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top