V
VisionSet
I have a bunch of related view classes, each displaying a database table.
Each has a generic controller (interface type) with a generic search method.
Each view class has a search function that takes text field contents and
forwards them to their respective controller's search method.
Since the nature of the search criteria changes between these classes I'm
thinking of having the controllers search method like so:
public void search(Object[] criteria);
Now the controllers are the most throwaway part of the code and are written
to serve view and model, so I can make assumptions about the exact types of
criteria...
I should have constants for the criteria array indices; is their logical
home the view classes? Certainly not the controller interface.
Is there a better way?
One option I realise is to access all the swing models from the controller
and never have to pass the actual data explicitly via the view code. I do
this for substantial models like TableModels, but for trivial textfields
this always seems to end up real clunky.
TIA
Each has a generic controller (interface type) with a generic search method.
Each view class has a search function that takes text field contents and
forwards them to their respective controller's search method.
Since the nature of the search criteria changes between these classes I'm
thinking of having the controllers search method like so:
public void search(Object[] criteria);
Now the controllers are the most throwaway part of the code and are written
to serve view and model, so I can make assumptions about the exact types of
criteria...
I should have constants for the criteria array indices; is their logical
home the view classes? Certainly not the controller interface.
Is there a better way?
One option I realise is to access all the swing models from the controller
and never have to pass the actual data explicitly via the view code. I do
this for substantial models like TableModels, but for trivial textfields
this always seems to end up real clunky.
TIA