I am trying to sort out how to organize a problem. I am constrained by the specifications I've been asked to implement.
The goal is to have a table where the user enters data. That data is used to generate a second set of data some of which is displayed in the table and some of which is graphed. The initial conditions for generating the second set of data are to be retrieved from the graph (through getting the position of the cross hairs).
I have a class that implements my table and allows the user to enter data. I was going to have a listener that reran the data generation whenever a cell value changed in this class. Except for the initial conditions, everything needed to generate the data is in the table.
I have a class that implements my graph. It has a scroll bar to modify the initial conditions.
At first I thought I would have a main class that built the panels that the table and graph will sit in. I was going to add an action listener to my graph class that would listen for changes in the table. If it saw the table change, it would re-graph itself. That was before I was told the initial conditions would be set in the graph. I've now gotten rather concerned that everything will get done in the right order. And that my initial idea would even work.
It seems to me I need a class that is responsible for holding the initial conditions and the generated data. I can create a table instance and a graph instance. I can listen for changes to the table entries. I'm not quite sure how to listen to the change in the initial conditions, as currently I make the change by adding a special listener to a JSlider that is defined in the plot code and does all the translation from slider to graph coordinates, which is something I'm using, but did not write. But hopefully, I can have some sort of listener that gets that information. Then this class, when it sees that there is a change, does all the calculations to generate the data and updates the table then tells the graph to redraw.
Since I need to add the table and graph to the gui, I think I need to have all this stuff happen in the class that builds the overall gui. Which seems to put me pretty close to having one great big file that implements the whole gui. I've lost any benefit of encapsulation or having a number of small classes to make maintenance and
testing easier.
Am I thinking about this right or could someone suggest a better way to put this all together?
Thanks.