Norbert Lebenthal wrote:...can the controller directly act on the TableModel?
Indeed I've in mine such a method:
public void searchVacancy(final VacancyTableModel vacancyTableModel,
final String nameSearch, final String locationSearch)
which ends up by doing
vacancyTableModel.setVacancies(vacancyService.search(criterions));
(my setVacancies in turn triggers fireTableDataChanged();).
Is it ok to do so ?
OCMJD 6, OCPJP8, CISSP Baroque Potion, G+
David Byron wrote:On an event, the listener grabs the controller reference from the parent, uses the controller reference to acquire results, grabs a reference to the table model from the table via the parent, and sets those results on that model (using a method that then fires the change notification).
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Roberto Perillo wrote:(and important: the TableModel is different from the Model of the MVC, since this model is in the View and the Model of the MVC is the layer that contains the intelligence of your system)
OCMJD 6, OCPJP8, CISSP Baroque Potion, G+
Roberto Perillo wrote:
David Byron wrote:On an event, the listener grabs the controller reference from the parent, uses the controller reference to acquire results, grabs a reference to the table model from the table via the parent, and sets those results on that model (using a method that then fires the change notification).
Hum... a listener that grabs a reference to the controller? How is this controller of yours?
Also, the listener then gets a reference to the TableModel? Well, it would be better to ask the main window to update the TableModel's data. I'd say that this would lead to a more cohesive design.
OCMJD 6, OCPJP8, CISSP Baroque Potion, G+
Norbert Lebenthal wrote:and how do you handle exceptions in the controller ?
Norbert Lebenthal wrote:and how do you handle exceptions in the controller ?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Norbert Lebenthal wrote:Well, in the end you tackle them view side...
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Roberto Perillo wrote:The controller is part of the presentation layer.
OCMJD 6, OCPJP8, CISSP Baroque Potion, G+
David Byron wrote:I'd say that when we're discussing MVC, and we say that the C is part of the V, we're definitely veering away from pure MVC and toward a variant (namely, the Model-Delegate pattern).
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD