swing - How do we actually implement the entity boundary control pattern in java? -
I am trying to create a library management system. Now, I know that the border can not interact directly with the unit. Control class acts as an intermediary between the boundary and unit classes. However, when the objects of these classes have been made?
First of all, talk about login. A limit login user will be created using the Java swing. The controller class will be PersonController which contains a function called "validateUser ()" contains the information used in the unit class of the user name and access to the database.
Now, I need to create UI, bring usernames; Using the action listeners, create a user contact with the username and password, followed by the user and create the user. Password, and then check the valid (user) method of the user controller for verification that the login is correct and the user is valid.
How do I do this? Where can I create these objects?
So far my code is:
public class main class {Main menu} Static [] ElGs {Person controller login session = new person Controller (); // UNSURE}} Public Category Controller {Public User Controller () {Login UI Login = New Login UI // Unforced loginForm.setVisible (true); // UNSURE} // validateUser implementation () function} public class user {personal string user name; Private string password; Private string role; The name of the private string; Private string phone; Private string email; // Get & amp; Public Code Login UI for the UI in Java Swing created using
The process in my mind should do something like this ...
You have three elements, UI, model and controller.
The UI presents the user's choice ...
The model will be required to create an user object (as your UI does not know How it has actually been achieved) The controller will be responsible for responding to events from the UI and deciding what to do for it.
When the user types there and "accept" (this can happen anytime), the controller captures that incident and requests the UI user from the UI user Takes information given by and asks the model to create an user object with these values. Administrator users object At any point you can choose to throw an exception to any part of the process. Since UI is the only part of the system that can actually talk back to the user, the UI's responsibility to show these errors is the responsibility.
The basic workflow can look something like this ...
Create Models, Forms and Controllers.
Add the model to the form, add the form to the controller.
The interaction between these specific elements should be the interface. Where ever possible any part should not have more information about the second part, then it needs to be completely - IMHO.
My first step will be to make it clear in your mind that what you want to accomplish is to work for who is responsible for and design the bridges that you need to connect them all together.
Comments
Post a Comment