my dog learned polymorphism*
The moose likes OO, Patterns, UML and Refactoring and the fly likes A (couple) quick question(s) on MVC DAO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply locked New topic
Author

A (couple) quick question(s) on MVC DAO

Geoff Berl
Greenhorn

Joined: Apr 13, 2011
Posts: 24

Thanks for the clarification, now that I think of it I'm not sure why I asked if the Model set the view's data. The intent behind MVC is to be able to reuse the model for any view which obviously wouldn't work if I programmed it to set component values in any particular view.

Yeah, the reason I say I've been working on understanding it for the past few days is because there are so many different variations, every time I tried to implement one, I would run into an issue and google it only to end up finding something somewhere that contradicted the original paradigm I was going with. I ended up figuring out that no one in particular was right but I chose to go with one where the model and view can only communicate via the controller, there is no path from view to model directly in either direction. To me this seems the easiest to start with, then I may venture into the ones that have the view call to the model for updates as I've seen in some implementations.

I do have one more question if you don't mind...

During the initial start up of the application I want my controller to populate the combobox in my view. Normally my controller get's the combobox component via the listener. How "should" my controller access this component when it isn't event driven? Currently I have created a method in the view like this

I didn't copy that directly so it may not be syntactically correct but you get the picture.

Is this a typical way to perform an action like this? I've also seen something like this
in which case the controller would get the JComboBox and work with it in the controller but that doesn't seem right.

In that case why wouldn't you just make jcbEmployees public, which also doesn't seem right?
Geoff Berl
Greenhorn

Joined: Apr 13, 2011
Posts: 24

My apologies, this was supposed to be a reply to my original thread "A quick question on MVC (DAO)" Somehow it ended up as a completely new topic. Can this be joined or is it completely messed up now?
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
or is it completely messed up now?

It's all gotten really messed up. You can remove your shoes now and stand in line to wait for your turn to be defenestrated.
Don't forget to fill in the forms indicating clearly where you want your kidneys and other internal organs to be donated.

P.S I think if you hit the "report" button the moderators will see your request quicker and they might be able to merge the threads (and delete my post)
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30965
    
158

While we don't have an automated way of merging threads, I copied your post into the other thread. And am closing this one.

And yes, either of you clicking "report to moderator" will get someone to see if faster.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A (couple) quick question(s) on MVC DAO