i would like to know if im on the right track...
i have a Main class that contains my main(), that starts my application by loading my ApplicationConfig class passing the mode("server" or "" or "alone").
in the ApplicationConfig i have all three fields databaseLocation, Address and portNumber each one is in its own JPanel, depending on the mode specified the JPanel's are set to visible.
after the user configures the application the user presses a "start" button and..
the databaseLocation variable for creating the "new Bookings object is set in the applicationConfig constructor (if that isn't clear by now);
I am halfway through coding this solution if your wondering why the serverMode() is empty.
So depending on the mode that is specified either the guiFrame is created(client and alone mode) or serverFrame will be created, the server frame will be visible to let user know the application is running and the application is still connected.
Also i have a class Bookings that when constructed, creates an instance of my DatabaseReader class(which reads the bytes from the file). my Bookings class then uses the instance to set all its variables, such as int magicCookie, int numberOfFields, ArrayList<
String[]> bookings...
so now an instance of the ArrayList<String[]> bookings (line 2) exists in my ApplicationConfig class, so in short;
*alone mode example*
1) user makes request via gui class
2) gui class calls ie; find() from my Data class
3) data class performs the operation on the ApplicationConfig.bookings variable
4) data class returns the result to gui class
1st Question, should i have another class, lets say "BookingsOperations" that takes method calls from my gui class and creates a
thread that calls my Data class methods, OR should i just create the threads in my gui class?
2nd Question, my approach of having two septerate classes, one for client(to send requests and display them in the gui) and one for server(to recieve request, perform operation and send it back to the client), is it a good/okay/terrible approach?
thanks if you sat through that and read my question, i look forward to your respones.
matt