To start, I have a FBNClient class that asks for the location of the database or the URL and port of the server.
The main window creates the model, three views and one controller.
The model extends DatabaseFacade
and the table view that implements my FBNViewInterface that has only one method in it that is updateView(Object[][] data).
The controller extends ActionListener and ListSelectionListener and all the actions are registered to it.
and registers the views to it (for now only table view is registered).
I can guess it is to update the JTable, so that says to me that you are not using the DefaultTableModel and customizing it to the assignement. Am I correct in this assumption?updateView(Object[][] data).
So, you are not specifying the database name for networked mode? That is, the only database that you can connect to in networked mode is db.db?
The View should not create the Model. Create your model, controller, and views in a separate class, something like StartClient.java.
So, your Model IS DatabaseFacade? Are you sure?. Perhaps, the relationship "Model USES DatabaseFacade" is more intuitive?
why does it need to extend these two classes, and how do you overcome the Java rule that you can't extend two classes.
How about using anonymous inner classes instead?
I also don't see an Observer-Observable case here.
I can guess it is to update the JTable, so that says to me that you are not using the DefaultTableModel and customizing it to the assignement. Am I correct in this assumption?
This one I don't understand . Do you mean to have anonymous inner classes in the main window that creates the 3 views and these anonymous inner classes will call methods on the controller? Can you clarify this?
In network mode, it's hardcoded that it must use db.db. Why should I ask for the name of the database for a network connection to the user?
This part I don't understand! The main window that I mention it's a class that creates the main JFrame and add the three views to it!
And I haven't used it [Observer-Observable, -- my insert]. I have a FBNViewInterface as follows:
public interface FBNViewInterface {public void refreshView(Object[][] data);}
<hr></blockquote>
My JTable is created using a FBNTableModel that extends AbstractTableModel.
Although not in the requirements explicitely, it is implied that your server should be designed for reuse. Since it is almost obvious that in addition to db.db some other tables will be added in the future, your server could be designed so that it doesn't require any change when it happens. And I mean, not a single line of code need to be changed. It's easier to implement than you may think, so I suggest you consider it.
That means that your window (View) knows about other views. What I suggest is that you use a completely separate class that acts as a driver for your application, something like this
Well, you may not realize it, but it is your implementation of Observer-Observable. The model calls the refreshView() method on the registered views, right?
What makes it a bit confusing is that in addition to JTable (which is a view for the table), you also have another table view. If you rename that other view, everything will fall in place.
FlightsModel flightsModel = new FlightsModel(tableDataModel);
With this, do you mean that we pass the table model to the database model?
It has already been done! In this link i discuss my server implementation and as you can read the server can open a unlimited number of databases.
So, if your server can open multiple databases, how does a client requests a specific one without specifying its name in the networked mode?
Originally posted by Miguel Roque:
Hello again.
and then in the controller I will have something in his constructor like
Correct Mark?
Miguel