MVC model confusion...

I don't know if this is an mvc model:
I have an HTML pages for viewing and input of data....
a JSP file to get the request from the HTML page....
and Java beans that has functions that is called by the JSP file...
The beans also gets the data to the database......
Im really confused on how I would make this an MVC model or is this already an MVC model?

You are right...
MVC(Model-View-Controller) is used to separate the presentation from the business logic.
Your jsp page has nothing to do with business logic.
Model includes Beans & EJBsThis is something you have to correct...
view is your databaseview .. its nothing to do with database instead its the jsp's html's
and controllers can be your servlets..

Similar Messages

  • Is there a way to specify MVC model in a Wizard?

    I am fairly new to JDeveloper so forgive me if I ask a stupid question....
    In a past web project I used IBM Websphere and Visual Age developing environments. For an upcoming project I am going to be using JDeveloper but with the same basic MVC architecture with the Servlets being the Controllers and JSP as the View. In Websphere there was a wizard that we could use to create a Java Bean based on our SQL statement. Within this wizard we could also select what 'model' we wanted to use and if we chose 'Servlet model' it would not only create the Java Bean but it would also crate the corresponding Servlet, XML file and JSP. All we had to do after that was bring up the JSP in the test environment and everything was hooked together already. If it was a simple select statement then the JSP displayed the results in a table. The JSP could then be facncied up or whatever. What I want to know is if there is something similar to that in JDeveloper. I know there are wizards to create Servlets and JSPs but is there any way to specifiy a 'model' and have everything to connected up without manually going into the code and doing it? I know this is kinda cheating and being lazy but I just wanted to ask if this type of feature existed before going ahead and doing unneccessary work. So if anyone can follow what I am saying and has an answer or perhaps can direct me to some documentation, that would be much appreciated. Thanks in advance for your help!
    Janis

    Janis,
    JDeveloper ships with a handy, built-in J2EE application framework called Business Components for Java that provides a full-functionality J2EE MVC model layer for you.
    You can get a nice overview of the framework's functionality from this whitepaper:
    Simplify J2EE Applications with the Oracle BC4J Framework
    For a quick overview of how the BC4J framework components implement the familiar collections of value objects design pattern for you, see:
    Implement Collections of Value Objects for MVC Apps with BC4J
    To answer your question about the wizards, you can (in no time flat)
    [list]
    [*]Create a new connection in the System Navigator
    [*]Create a new package of BC4J framework components ("New Business Components Package...")
    [*]On the last panel of the BC4J package wizard, you can select existing tables to reverse-engineer into framework data-access and business logic components (view objects and entity objects, respectively)
    [*]Then, you can use one of our other wizards to produce, for example, a BC4J+Struts application, a BC4J+JSP application, or a BC4J+JClient/Swing (rich client) application
    [list]
    Hope this helps.

  • MVC model in Web systems and applications

    MVC model in Web systems and applications
    Object-oriented design model is experience, MVC idea is a user interface for the original. This article discusses how the major application areas in the new Web design patterns and the use of MVC framework. The article first introduced the concept of design patterns and characteristics, and MVC architecture design concepts and analysis of the MVC framework contains several key models. Based on the characteristics of Web applications on how to use patterns and MVC framework made some design ideas.??
    1. Introduction
    1.1 design model
    Object-oriented technology and the emergence of software applications has greatly enhanced the trusted and software quality. Object-oriented programming than previous models to various programming simple and efficient, but the object-oriented design methodology than the previous design methods to complex and much more skill, a good design should be both on the issue of gender, but also to take full account of the problems and needs sufficient interoperability. In the past 10 years, people in the object-oriented technology and the practical application of research to explore certain issues in relation to the creation of a number of good solutions, the so-called object-oriented design patterns. Object-oriented technology is one of the purposes of enhancing the software trusted, and to design model, design programmes in important positions from a deeper sense of meaning and essence embodies trusted. There are many people in the design model definition, which cited Christopher Alexander is the largest design model definition : Each design model is a tripartite rule, which expresses a contextual environment (Context), a problem and a solution. Design models generally following basic elements : model name, the purpose solution effect 1995-1998 code and related design models. There are several classifications design patterns can be divided into a model based on the purpose (Creational), structural type (Structural) and the type of behaviour (Behavioral) three. It is mainly used in the creation of a model-based object model-based structure to deal primarily with the category or combination of objects, used to describe behavior-based model is the main target for the category or how stress and how to allocate responsibilities. Design patterns can be divided into categories based on the scope and target mode model type model dealing with the relationship between the categories and sub-categories, these relations through the establishment of succession in Translation moment to be finalized, are static. Model is targeted at addressing the relationship between the moment of change these relations in the operation, more dynamic. Model features : through the experience acquired in a structured format to write down, avoid encountering the same problems on the first design, exist in different abstract level, in continuous improvement, can be trusted artificial product for the design and best practice in the world to be combined to address larger issues.
    1.2 MVC framework
    MVC was first used in a user interface Smalltalk-80 China. M representative models Model, representatives maps View V, C representatives controller Controller. MVC trusted code with the aim of increasing the rate of data reduction expressed, the data describing the operation and application coupled degrees. Also makes software Keweihuxing, restorative, expansionary, flexibility and packaging of greatly enhanced. Single-user applications are usually incident-driven user interface to the organizational structure. Staff development tool with an interface painting of a user interface interface code based on user input and then prepare to implement the corresponding moves, many interactive development environment encouraged to do so, because it emphasizes first and then a functional interface. Some software design model is the strategy that will be fixed before the code into the regular system of the final. Result is that the procedures and organizations around the user interface elements in the user interface elements of those moves, data storage, applications and functions of the code is used to indicate the way intertwined. In single-user system code structure can be so, because the system will not demand frequent changes. But for a large system such as large Web systems, or e-commerce systems to be applied. Model by incorporating data from a variety of access and control data can be separated to improve distributed system design. MVC design pattern is composed of three parts. Model is the application object, no user interface. Type in the screen showing that it represents the flow of data users. Controller user interface definition response to user input, the users responsible for the action against the Model into operation. Model View data updated to reflect the adoption of data changes.
    2. MVC design pattern,
    An MVC framework for the design of the system includes many models, but with MVC is most closely related to the following three models : Observer, Cambridge and Strategy.
    2.1 Observer models
    MVC through the use of purchase / notification form and the separation of the Model View. View to ensure that their content accurately reflected Model and state. Once Model content changes, there must be a mechanism to allow notification to the relevant Model View, View can be made relevant at the appropriate time updating of data. This design is also more general problems can be solved, the target separation, making a change to the target audience affect others, which targets those who do not know the details of the object being affected. This is described as Observer in the design model. Model type : Observer model is the object-oriented model, it is behaviour-based model. Model purposes : definition of hierarchical dependence relations between objects, or when a target value of the state change, all its dependent relationship with the object are notified and automatically updated. There are a variety of data may show a way, in different ways and may also show. When a way through a changed data, then the other should be able to show immediately that the data change and do accordingly.
    Effect :
    1. Abstract coupling. I only know that it has a target audience of some observers, the observers met each abstract Observer category simple interface, does not know their specific affiliation categories. This makes the coupling between goals and observers smallest and abstract.
    2. Support radio communications. Needless to notify designated observers goals, how to deal with the observer informed decisions.
    3. Possible accidents updated. We update logic, avoiding mistakes updated.
    2.2 Faculty model
    MVC is an important feature of View can nest. Nest can be used for any type of combination of local maps available, but also management of type nest. This thinking reflects the type and mix of components will be equal treatment design. This object-oriented design ideas in the area of Cambridge has been described as a design model. Model types : Cambridge model is the object-oriented model, it is also the structure type model. Model purpose : to target portfolio into tree structures to express "part-whole" level structure. Prepared for the use and combination of individual target audiences with the use of consistency.
    Effect :
    1. Definition of a target portfolio includes simple objects and the structure of the category level. Simple objects may be complex combinations of objects, and can be targeted portfolio mix. This customer-code used in the target areas can use simple combinations target.
    2. Simplify customer-code. Needless to know their customers - a mix of target audiences is a simple target or can use these items in a consistent manner.
    3. Easier to add new types of components. New components can easily be changed to a combination of customer-targeted codes.
    2.3 Strategy model
    Another important characteristic is the MVC can not change the View of changes View response to user input. This often requires a change in response to the logic of the system is very important. MVC to respond to the logic involved in the Controller. Controller of a category level structure could easily change to the original Controller appropriate, a new Controller. View Controller son used to achieve a specific example of such a response strategy. To achieve different response strategy, as long as examples of the use of different types of replacement will Controller. Also in the running time by changing the View Controller for users to change View of response strategies. This View-Controller relationship was described as an example of Strategy design pattern. Model types : Strategy model is the object-oriented model, it is behaviour-based model. Model purposes : definition of a series of algorithms, and their packaging, and ensure that they can replace each other, making algorithms can independently use its customer-change.
    Effect :
    1. Strategy category levels for Context definition of the relevant algorithms can be trusted or behaviour.
    2. Alternative methods of succession. If the direct successor Context, with different acts will be added Context act, the realization of which would algorithm mixed up with Context, Context hard to preserve and expand, but can not dynamically changing algorithms. Will be enclosed in a separate Strategy category algorithms to enable algorithm independent Context change easily cut over expansion.
    3. Can provide the same acts different date.
    4. Strategy-must understand what customers between different.
    5. Context and Strategy communications between costs.
    6. An increase in the number of targets.
    3. MVC in Web application system
    Now some of the distributed systems such as Web-based B2B e-commerce system, suitable for use MVC framework. Through analysis from the perspective of high-level applications can be a target divided into three categories. Category is shown for the target audience consists of a group of commercial rules and data, there is a category that is receiving requests to control commercial target to complete the request. These applications often need to change is shown, such as web style, color, but also need to demonstrate the contents of the display. And the business rules and data to be relatively stable. Therefore, said that the frequent need to change the View objects that the business rules and data model to be relatively stable target, and that the control of the Controller is the most stable. When the system is usually issued after the View objects by artists, designers or HTML/JSP system managers to manage. Controller target applications development personnel from the development and implementation of rules for commercial and business development personnel from the target data, database managers and experts in the field of common completed. Show in Web?? or customers - control logic can be Servlet or JSP, dynamically generated Html. Generally used Servlet better than using JSP. JSP will be better with the Html code of separate codes for page designers and developers of separation efficiency. Servlet and JSP can complete all complete functions, actually JSP eventually converted into a Servlet. And control of the target system exists in every level, the coordination of cross-layer moves. Contain business rules and data objects exist in the EJB layer (EJB-centred model) or Web?? (Web-centred model).
    3.1 View in the Web application system
    View of the system shows that it fully exist in Web??. General by JSP, Java Bean and Custom Tag. JSP can generate dynamic web content using Java Custom Tag easier Bean, but it can show the logic of packaging, and more conducive to modular trusted. Some well-designed in a number of JSP Custom Tag can even be used in different system duplication. Model for control of JSP and Java Bean objects. JSP through Java Bean objects to retrieve the data model, the Model and Controller object is responsible for updating the data on Java Bean. In general, can we devise all possible screen that users can see all the elements of the system. Based on these elements, to identify the public part of passive components and dynamics. Can consider the use of templates means to separate the content generated JSP public, also need to change their generation Html or JSP from a JSP templates to dynamically introduce these different parts (include methods). Another issue to consider is screen option, when dealing with End users request template automatically available to show that the concern that users must know what is the screen components. So can consider all screens on the definition of a centralized document, such as a document or text document java. Taking into account the possibility of changes in future document definition screens, the best use of text documents such as a XML document, so future changes to the recompilation. According to the URL and user input parameters to shine upon the results of a screen, of course, likely to be made on the basis of the outcome of the implementation of actions to choose different results screen. Therefore, the need for a request for matching resources with document (XML), if a URL request several different results, it must specify in the document need to control the flow (a controller object), as well as the corresponding screen different flows.
    3.2 Model in the Web application system
    Model objects represent business rules and business data exist in EJB layer and Web??. In J2EE norms, the system needs some data stored in the database, such as user account information (account model), the company's data (company model), some not recorded in the database. If a user browsing the current catalogue (catalog model), the contents of his shopping (shopping cart model). Which one of these models exist in the data according to their life cycle and scope to decide. In Web?? a HttpSession and ServletContext and Java Bean objects to store data in the EJB layer is a data storage and logic EJB to. Web?? the Java Bean objects stored in the model layer model of the EJB object data copy. Because there are many different EJB tier model targets, so Web?? through a ModelManager to control the EJB layer object model in ModelManger background model can be used for packaging methods. In the EJB layer and the rules have all the data into EJB model is inappropriate. If the database can visit the Dao object model into objects. Dao can be encapsulated and the specific details of the database in the world, if we can write a different table, a number of databases, or even multiple databases. If the orders can be a model for OrderDAO, it may have to deal with Order table, table and OrderItemLines OrderStatus table. Value can also consider the use of targets. Value can be a target of securing long-range targets, because every time the remote object attributes could be a long-range redeployment process will consume network resources. EJB objects in the distance can be used instead target. In the distance, one-time items to be targeted instead of the value of all attributes.
    3.3 Controller in Web application system
    Coordination with the Model View Controller object to the request of users into the system to identify incidents. In Web?? generally a MainServlet (or Main.jsp), and receiving all requests, it can use screen flow management devices (ScreenFlowManger) decided next screen. There is a general request processors RequestProcessor contains all requests are needed to be done to deal with logic, such as the request translated into system events (RequestToEvent). Acting processors usually also includes a request for ClientControlWebImpl, it is logical to deal with the EJB layer in Web?? Acting. In EJB layer, a layer for EJB tier Web ClientController provide the CD visit. Another StateMachine used to create and delete ejb handle Web?? sent to the incident. Controller Another important function is synchronous View and Model data. ModelManger contained in a ModelUpdateManger, it puts events into a Model System assembly that all the needs of synchronous Model, and then notify Listeners do synchronous operation.
    4. Concluding remarks
    In recent years, with the Internet technology development and the emergence of new business models, the Web is based on a large number of applications. On how to design these systems architecture, and gradually there has been some convergence of opinion, the most important point is that its structure should be rational in the open. Demand than ever faster development of technology and design concepts, systems for the future, the cost of upgrading the smallest, research software systems architecture still very useful and necessary.

    Bravo. And your point is?

  • How to implement MVC model?

    Hi, I have a question on how to implement MVC model, that is, how will the GUI be informed that the data from the Model has been changed?
    Suppose that I have two simple classes, Model and GUI. Model creates 10 integers each time, and then GUI draws some bars whose height is the integers. then after each time the integers has been created, how could GUI know?
    Thanks!!!!

    There is an Observer pattern specific to Google?I so implement the Google Observer pattern. ;o)Isn't that the (G)oogling Observer pattern? ;)

  • MVC model / page with flow logic

    Hi all,
    I have started using MVC model in BSP application. Can anyone tell me the name of the controller methods corresponding to the following event handler methods(in case of page with flow logic):
    onCreate
    onRequest
    onInitialization
    onManipulation
    onInputProcessing
    onDestroy
    Thanks and Regards
    Shilpa

    Hi Shilpa,
    onRequest          -
    > DO_REQUEST
    onInitialization      -
    >  DO_INIT
    onInputProcessing  -
    > DO_HANDLE_EVENT
    onDestroy             ---> DO_DESTROY
    Thanks.

  • BI Beans, Struts and MVC Model 2

    Hi,
    Is there documentation or samples about how to use BI Beans with Struts, in a MVC Model 2 design? I.e. Struts Actions acting as controller, instantiating and initializing the BI Beans presentations (Model), passing them on to JSP's to build the view layer (by rendering the presentations).
    I saw such a sample in the BI Beans 9.0.4 samples, but it seems to have been removed in the BI Beans 10.1.2 samples. There are only samples showing either exclusive use of servlets, or exclusive use of JSP's. Is there a reason why the struts sample is no longer offered with BIB 10.1.2? Is this approach actually supported by BI Beans 10.1.2?
    Can I still make use of most of the "orabi" JSP tags, if I build up my presentations in an action, prior to forwarding it to the JSP?
    Kind regards,
    Johan

    Suppose you've created biTest.uix which contains bi beans
    Now just add struts-config.xml to your bi beans project (right click on Project in Navigator -> New -> Struts -> Struts Controller Page Flow)
    add example action
    <action path="/biTest" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataForwardAction" name="DataForm" parameter="biTest.uix">
    <set-property property="modelReference" value="biTestUIModel"/>
    <forward name="biTest" path="/biTest.do"/>
    </action>
    to your struts-config.xml
    where
    biTest.uix - your bi beans page
    biTestUIModel - empty model (you can create it by clicking on your bi beans page (here it's biTest.uix)
    and selecting UI Model tab Structure tool-window, where you have to right click on
    "<No Bindings>" node and select Create UI Model in appeared popup menu)
    Now you can run biTest.do action and you bi beans page will be displayed.

  • What's the advantage of using JSF than other MVC model

    What's the advantage of using JSF than other MVC model ?
    eg, Any advantage of using JSF than struts? What's their main difference?

    There is a good picture that shows that JSF brings new. You can find this picture on the page #9 of the "All about JavaServer Faces" by Kito Mann.
    URL:  http://www.cppsig.org/nycjava/All%20about%20Faces%20-%20NYPCUG%20-%2004-2004.pdfActually, you can search for "jsf vs struts" on this forum and find a lot of interesting material regarding to this topic.

  • How to implement mvc model in designing game architecture

    I have a problem in implementing the mvc architecture in my game designing. I want you to suggest me how should I do it ?
    I have created 3 packages viz : model , view , and controller
    I am confused in which package should include canvas ? which should implement Runnable ? and what actually the model package must include ?
    Also i would like to know that whatever dynamic active background is generated in my game play must it be treated as model or not ?

    Hi
    Here is a good article about this: http://www-128.ibm.com/developerworks/library/wi-arch6/?ca=drs-wi3704
    Mihai

  • MVC Variations Confusing Me

    I've read this in one article:
    # a model consisting of the application with no external interface;
    # a view consisting of one or more graphical frames that interact with the user and the application; and
    # a controller consisting of the ``main'' program that constructs the model and the view and links them together.Additionally,
    When a program with a graphical interface starts, the controller
       1. creates the model (application),
       2. creates the view consisting of one or more graphical frames and attaches commands to the graphical input controls (buttons, text boxes, etc.) of the view,
       3. activates the graphical components in the view, and
       4. terminates.Here's what I understand: anything that can be seen or has a graphical component is automatically a view. This includes Swing, AWT, even a JFrame with all the buttons and stuff in it. I've also read somewhere that Views can opt to register to a Model to automatically update itself when the Model changes, but that the Controller would handle the registration process. Models only store state, or data. They DO NOT have to do any special formatting or know how to present themselves. They don't know about any Views. Controllers contain the application-specific logic. They just tie the two together then terminate. They don't have a user interface. Hence, the following code...
    class Model
         // misc. code.
         private String name;
         public void setName(String name)
              this.name = name;
         public String getName()
              return name;
    class Controller
         // misc. code.
         private Model model;
         private View view;
         public Controller()
              model = new Model();
              model.setName("I am Sam");
              view = new View();
              view.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              view.addOkButtonListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        view.setNameTextFieldText(model.getName());
         public static void main(String[] args)
              new Controller();
    class View extends JFrame
         // misc. code.
         private JButton okButton;
         private JTextField nameTextField;
         public void addOkButtonListener(ActionListener l)
              okButton.addActionListener(l);
         public void removeOkButtonListener(ActionListener l)
              okButton.removeActionListener(l);
         public void setNameTextFieldText(String text)
              nameTextField.setText(text);
    }is an example of MVC, or at least that is my understanding of it. I was just beginning to appreciate the above pattern when all of a sudden, I encounter this(http://www.cs.tufts.edu/~jacob/106/lecture/25_MVC.html), again putting me in a state of confusion.
    If I stick to the definition of a controller given earlier in this post, I would say that the second example's controller is...."wrong". The Controller class has a view of its own. Additionally, the Controller uses a common callback for handling button events. I've read in the same article that this is bad design. The author presents some reasons, but in short, a common callback could turn into one long MONSTER IF statement mayhem.
    Since the focus of MVC is on improved object reuse, model and view objects should be loosely coupled. Controller objects get reused the least. In the second example, all Views have a Model object inside of them, lessening their reusability. If in the first example, the Controller object acts as the glue that magically binds the model and view objects together, in the second example, glue is all over the place.
    In the first example, if one removes the Controller class, the Model and View objects remain intact. If the Model is removed, the Controller is surely affected but the View still remains intact. We can even change the Model's API, and all that would need to be changed is the Controller.
    In the second example, if one removes the Model object, the Controller and View objects are compromised. If we completely change the Model's API, the Controller and View objects would need to be changed too.
    The second example has gotten me so confused I feel I need to ask these questions:
    1.) Why does the second example maintain a tight coupling between the Model and the View?
    2.) Why does the Controller have it's own View?
    3.) Does the second example have any strengths over the first example? Or does the first example have any weaknesses too? In short, what can the first example do that the other can't and vice versa?
    3.) In what types of problems is one more suitable than the other?
    4.) Which is better in the long run or in larger projects (in terms of modularity, ease of coding, maintainability, etc.)?
    I really need to clear this up. :)

    MVC is a great design goal, but more often than not, you end up with model-delegate. The delegate contains controller and view, more tightly coupled than one would like in full-blown MVC.
    You should avoid coupling the model and view in any way. If you have to, write the controller closely coupled to the view, and then have the controller invoke model classes. That way, you can at least keep your domain model classes if you ever switch views or add a view.
    Conceptually:
    View - Displays the model to the user
    Model - Application data and business objects
    Controller - Parses user requests and mediates between view and model
    You can also check out the following URL that may explain the concepts differently (and better) than I could:
    http://java.sun.com/blueprints/patterns/MVC-detailed.html
    It's very difficult to totally separate the view and controller. The closest I've ever come is to implement the Command pattern and then use dynamic method invocation.
    - Saish
    "My karma ran over your dogma." - Anon

  • Can U help me change "Paint.java" to MVC model

    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollBar;
    import javax.swing.JTextField;
    import javax.swing.ImageIcon;
    public class Paint extends Applet implements ActionListener, AdjustmentListener, MouseListener, MouseMotionListener
    private static final long serialVersionUID = 1L;
    private final int NO_OP = 0;
    private final int PEN_OP = 1;
    private final int LINE_OP = 2;
    private final int ERASER_OP = 3;
    private final int CLEAR_OP = 4;
    private final int RECT_OP = 5;
    private final int OVAL_OP = 6;
    private final int FRECT_OP = 7;
    private final int FOVAL_OP = 8;
    private final int SPLINE_OP = 9;
    private final int POLY_OP = 10;
    private int mousex = 0;
    private int mousey = 0;
    private int prevx = 0;
    private int prevy = 0;
    private boolean initialPen = true;
    private boolean initialLine = true;
    private boolean initialEraser = true;
    private boolean initialRect = true;
    private boolean initialOval = true;
    private boolean initialFRect = true;
    private boolean initialFOval = true;
    private boolean initialPolygon = true;
    private boolean initialSpline = true;
    private int Orx = 0;
    private int Ory = 0;
    private int OrWidth = 0;
    private int OrHeight = 0;
    private int drawX = 0;
    private int drawY = 0;
    private int eraserLength = 5;
    private int udefRedValue = 255;
    private int udefGreenValue = 255;
    private int udefBlueValue = 255;
    private int opStatus = PEN_OP;
    private int colorStatus = 1;
    private Color mainColor = new Color(0,0,0);
    private Color xorColor = new Color(255,255,255);
    private Color statusBarColor = new Color(166,166,255);
    private Color userDefinedColor = new Color(udefRedValue,udefGreenValue,udefBlueValue);
    private JButton penButton           = new JButton(new ImageIcon(getClass().getResource("pen.gif")));
    private JButton lineButton           = new JButton(new ImageIcon(getClass().getResource("line.gif")));
    private JButton eraserButton           = new JButton(new ImageIcon(getClass().getResource("eraser.gif")));
    private JButton clearButton = new JButton("Clear");
    private JButton rectButton           = new JButton(new ImageIcon(getClass().getResource("rec.gif")));
    private JButton ovalButton           = new JButton(new ImageIcon(getClass().getResource("oval.gif")));
    private JButton fillRectButton      = new JButton(new ImageIcon(getClass().getResource("fillrec.gif")));
    private JButton fillOvalButton      = new JButton(new ImageIcon(getClass().getResource("filloval.gif")));
    private JButton splineButton = new JButton("Spline");
    private JButton polygonButton = new JButton("Polygon");
    private JButton blackButton = new JButton("Black");
    private JButton blueButton = new JButton("Blue");
    private JButton redButton = new JButton("Red");
    private JButton greenButton = new JButton("Green");
    private JButton purpleButton = new JButton("Purple");
    private JButton orangeButton = new JButton("Orange");
    private JButton pinkButton = new JButton("Pink");
    private JButton grayButton = new JButton("Gray");
    private JButton yellowButton = new JButton("Yellow");
    private JButton userDefButton = new JButton("User-Def");
    private JScrollBar redSlider = new JScrollBar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
    private JScrollBar blueSlider = new JScrollBar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
    private JScrollBar greenSlider = new JScrollBar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
    private JTextField colorStatusBar = new JTextField(20);
    private JTextField opStatusBar = new JTextField(20);
    private JTextField mouseStatusBar = new JTextField(10);
    private JTextField redValue = new JTextField(3);
    private JTextField greenValue = new JTextField(3);
    private JTextField blueValue = new JTextField(3);
    private JLabel operationLabel = new JLabel(" Tool mode:");
    private JLabel colorLabel = new JLabel(" Color mode:");
    private JLabel cursorLabel = new JLabel(" Cursor:");
    private JPanel ToolbarPanel = new JPanel(new GridLayout(11,2,0,0));
    private JPanel drawPanel = new JPanel();
    private JPanel statusPanel = new JPanel();
    private JPanel udefcolPanel = new JPanel(new GridLayout(3,3,0,0));
    private JPanel udefdemcolPanel = new JPanel();
    private JPanel PicPanel               = new JPanel();
    public void init()
    setLayout(new BorderLayout());
    ToolbarPanel.add(blackButton);
    ToolbarPanel.add(blueButton);
    ToolbarPanel.add(redButton);
    ToolbarPanel.add(greenButton);
    ToolbarPanel.add(purpleButton);
    ToolbarPanel.add(orangeButton);
    ToolbarPanel.add(pinkButton);
    ToolbarPanel.add(grayButton);
    ToolbarPanel.add(yellowButton);
    ToolbarPanel.add(userDefButton);
    blueButton.setBackground(Color.blue);
    redButton.setBackground(Color.red);
    greenButton.setBackground(Color.green);
    purpleButton.setBackground(Color.magenta);
    orangeButton.setBackground(Color.orange);
    pinkButton.setBackground(Color.pink);
    grayButton.setBackground(Color.gray);
    yellowButton.setBackground(Color.yellow);
    userDefButton.setBackground(userDefinedColor);
    ToolbarPanel.add(penButton);
    ToolbarPanel.add(lineButton);
    ToolbarPanel.add(eraserButton);
    ToolbarPanel.add(clearButton);
    ToolbarPanel.add(rectButton);
    ToolbarPanel.add(ovalButton);
    ToolbarPanel.add(fillRectButton);
    ToolbarPanel.add(fillOvalButton);
    ToolbarPanel.add(splineButton);
    ToolbarPanel.add(polygonButton);
    ToolbarPanel.setBounds(0,0,100,300);
    ToolbarPanel.add(udefcolPanel);
    ToolbarPanel.add(udefdemcolPanel);
    udefcolPanel.add(redValue);
    udefcolPanel.add(redSlider);
    udefcolPanel.add(greenValue);
    udefcolPanel.add(greenSlider);
    udefcolPanel.add(blueValue);
    udefcolPanel.add(blueSlider);
    statusPanel.add(colorLabel);
    statusPanel.add(colorStatusBar);
    statusPanel.add(operationLabel);
    statusPanel.add(opStatusBar);
    statusPanel.add(cursorLabel);
    statusPanel.add(mouseStatusBar);
    colorStatusBar.setEditable(false);
    opStatusBar.setEditable(false);
    mouseStatusBar.setEditable(false);
    statusPanel.setBackground(statusBarColor);
    ToolbarPanel.setBackground(Color.white);
    drawPanel.setBackground(Color.white);
    add(statusPanel, "North");
    add(ToolbarPanel, "West");
    add(drawPanel, "Center");
    penButton.addActionListener(this);
    lineButton.addActionListener(this);
    eraserButton.addActionListener(this);
    clearButton.addActionListener(this);
    rectButton.addActionListener(this);
    ovalButton.addActionListener(this);
    fillRectButton.addActionListener(this);
    fillOvalButton.addActionListener(this);
    splineButton.addActionListener(this);
    polygonButton.addActionListener(this);
    blackButton.addActionListener(this);
    blueButton.addActionListener(this);
    redButton.addActionListener(this);
    greenButton.addActionListener(this);
    purpleButton.addActionListener(this);
    orangeButton.addActionListener(this);
    pinkButton.addActionListener(this);
    grayButton.addActionListener(this);
    yellowButton.addActionListener(this);
    userDefButton.addActionListener(this);
    redSlider.addAdjustmentListener(this);
    blueSlider.addAdjustmentListener(this);
    greenSlider.addAdjustmentListener(this);
    drawPanel.addMouseMotionListener(this);
    drawPanel.addMouseListener(this);
    // this.addMouseListener(this);
    // this.addMouseMotionListener(this);
    updateRGBValues();
    opStatusBar.setText("Pen");
    colorStatusBar.setText("Black");
    public void actionPerformed(ActionEvent e)
         penButton.setActionCommand("Pen");
         lineButton.setActionCommand("Line");
         eraserButton.setActionCommand("Eraser");
         rectButton.setActionCommand("Rectangle");
         ovalButton.setActionCommand("Oval");
         fillRectButton.setActionCommand("Filled Rectangle");
         fillOvalButton.setActionCommand("Filled Oval");
         if (e.getActionCommand() == "Pen")
         opStatus = PEN_OP;
         else if (e.getActionCommand() == "Line")
         opStatus = LINE_OP;
         else if (e.getActionCommand() == "Eraser")
         opStatus = ERASER_OP;
         else if (e.getActionCommand() == "Clear")
         opStatus = CLEAR_OP;
         else if (e.getActionCommand() == "Rectangle")
         opStatus = RECT_OP;
         else if (e.getActionCommand() == "Oval")
         opStatus = OVAL_OP;
         else if (e.getActionCommand() == "Filled Rectangle")
         opStatus = FRECT_OP;
         else if (e.getActionCommand() == "Filled Oval")
         opStatus = FOVAL_OP;
         else if (e.getActionCommand() == "Polygon")
         opStatus = POLY_OP;
         else if (e.getActionCommand() == "Spline")
         opStatus = SPLINE_OP;
         else if (e.getActionCommand() == "Black")
         colorStatus = 1;
         else if (e.getActionCommand() == "Blue")
         colorStatus = 2;
         else if (e.getActionCommand() == "Green")
         colorStatus = 3;
         else if (e.getActionCommand() == "Red")
         colorStatus = 4;
         else if (e.getActionCommand() == "Purple")
         colorStatus = 5;
         else if (e.getActionCommand() == "Orange")
         colorStatus = 6;
         else if (e.getActionCommand() == "Pink")
         colorStatus = 7;
         else if (e.getActionCommand() == "Gray")
         colorStatus = 8;
         else if (e.getActionCommand() == "Yellow")
         colorStatus = 9;
         else if (e.getActionCommand() == "User-Def")
         colorStatus = 10;
    initialPolygon = true;
    initialSpline = true;
    switch (opStatus)
    case PEN_OP : opStatusBar.setText("Pen");
    break;
    case LINE_OP : opStatusBar.setText("Line");
    break;
    case ERASER_OP: opStatusBar.setText("Eraser");
    break;
    case CLEAR_OP : clearPanel(drawPanel);
    break;
    case RECT_OP : opStatusBar.setText("Rectangle");
    break;
    case OVAL_OP : opStatusBar.setText("Oval");
    break;
    case FRECT_OP : opStatusBar.setText("Fill-Rectangle");
    break;
    case FOVAL_OP : opStatusBar.setText("Fill-Oval");
    break;
    case POLY_OP : opStatusBar.setText("Polygon");
    break;
    case SPLINE_OP: opStatusBar.setText("Spline");
    break;
    switch (colorStatus)
    case 1: colorStatusBar.setText("Black");
    break;
    case 2: colorStatusBar.setText("Blue");
    break;
    case 3: colorStatusBar.setText("Green");
    break;
    case 4: colorStatusBar.setText("Red");
    break;
    case 5: colorStatusBar.setText("Purple");
    break;
    case 6: colorStatusBar.setText("Orange");
    break;
    case 7: colorStatusBar.setText("Pink");
    break;
    case 8: colorStatusBar.setText("Gray");
    break;
    case 9: colorStatusBar.setText("Yellow");
    break;
    case 10: colorStatusBar.setText("User Defined Color");
    break;
    setMainColor();
    updateRGBValues();
    public void adjustmentValueChanged(AdjustmentEvent e)
    updateRGBValues();
    public void clearPanel(JPanel drawPanel2)
    opStatusBar.setText("Clear");
    Graphics g = drawPanel2.getGraphics();
    g.setColor(drawPanel2.getBackground());
    g.fillRect(0,0,drawPanel2.getBounds().width,drawPanel2.getBounds().height);
    public void penOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialPen)
    setGraphicalDefaults(e);
    initialPen = false;
    g.drawLine(prevx,prevy,mousex,mousey);
    if (mouseHasMoved(e))
    mousex = e.getX();
    mousey = e.getY();
    g.drawLine(prevx,prevy,mousex,mousey);
    prevx = mousex;
    prevy = mousey;
    public void lineOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialLine)
    setGraphicalDefaults(e);
    g.setXORMode(xorColor);
    g.drawLine(Orx,Ory,mousex,mousey);
    initialLine=false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawLine(Orx,Ory,mousex,mousey);
    mousex = e.getX();
    mousey = e.getY();
    g.drawLine(Orx,Ory,mousex,mousey);
    public void rectOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialRect)
    setGraphicalDefaults(e);
    initialRect = false;
    if (mouseHasMoved(e))
    g.setXORMode(drawPanel.getBackground());
    g.drawRect(drawX,drawY,OrWidth,OrHeight);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawRect(drawX,drawY,OrWidth,OrHeight);
    public void ovalOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialOval)
    setGraphicalDefaults(e);
    initialOval=false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    public void frectOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialFRect)
    setGraphicalDefaults(e);
    initialFRect=false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawRect(drawX,drawY,OrWidth-1,OrHeight-1);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawRect(drawX,drawY,OrWidth-1,OrHeight-1);
    public void fovalOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialFOval)
    setGraphicalDefaults(e);
    initialFOval = false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    public void eraserOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    if (initialEraser)
    setGraphicalDefaults(e);
    initialEraser = false;
    g.setColor(mainColor.white);
    g.fillRect(mousex-eraserLength, mousey-eraserLength,eraserLength*2,eraserLength*2);
    g.setColor(Color.black);
    g.drawRect(mousex-eraserLength,mousey-eraserLength,eraserLength*2,eraserLength*2);
    prevx = mousex;
    prevy = mousey;
    if (mouseHasMoved(e))
    g.setColor(mainColor.white);
    g.drawRect(prevx-eraserLength, prevy-eraserLength,eraserLength*2,eraserLength*2);
    mousex = e.getX();
    mousey = e.getY();
    g.setColor(mainColor.white);
    g.fillRect(mousex-eraserLength, mousey-eraserLength,eraserLength*2,eraserLength*2);
    g.setColor(Color.black);
    g.drawRect(mousex-eraserLength,mousey-eraserLength,eraserLength*2,eraserLength*2);
    prevx = mousex;
    prevy = mousey;
    public void polygonOperation(MouseEvent e)
    if (initialPolygon)
    prevx = e.getX();
    prevy = e.getY();
    initialPolygon = false;
    else
    mousex = e.getX();
    mousey = e.getY();
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawLine(prevx,prevy,mousex,mousey);
    prevx = mousex;
    prevy = mousey;
    public void splineOperation(MouseEvent e)
    if(initialSpline)
    initialSpline = false;
    public boolean mouseHasMoved(MouseEvent e)
    return (mousex != e.getX() || mousey != e.getY());
    public void setActualBoundry()
    if (mousex < Orx || mousey < Ory)
    if (mousex < Orx)
    OrWidth = Orx - mousex;
    drawX = Orx - OrWidth;
    else
    drawX = Orx;
    OrWidth = mousex - Orx;
    if (mousey < Ory)
    OrHeight = Ory - mousey;
    drawY = Ory - OrHeight;
    else
    drawY = Ory;
    OrHeight = mousey - Ory;
    else
    drawX = Orx;
    drawY = Ory;
    OrWidth = mousex - Orx;
    OrHeight = mousey - Ory;
    public void setGraphicalDefaults(MouseEvent e)
    mousex = e.getX();
    mousey = e.getY();
    prevx = e.getX();
    prevy = e.getY();
    Orx = e.getX();
    Ory = e.getY();
    drawX = e.getX();
    drawY = e.getY();
    OrWidth = 0;
    OrHeight = 0;
    public void mouseDragged(MouseEvent e)
    updateMouseCoordinates(e);
    switch (opStatus)
    case PEN_OP : penOperation(e);
    break;
    case LINE_OP : lineOperation(e);
    break;
    case RECT_OP : rectOperation(e);
    break;
    case OVAL_OP : ovalOperation(e);
    break;
    case FRECT_OP : frectOperation(e);
    break;
    case FOVAL_OP : fovalOperation(e);
    break;
    case ERASER_OP: eraserOperation(e);
    break;
    public void mouseReleased(MouseEvent e)
    updateMouseCoordinates(e);
    switch (opStatus)
    case PEN_OP : releasedPen();
    break;
    case LINE_OP : releasedLine();
    break;
    case RECT_OP : releasedRect();
    break;
    case OVAL_OP : releasedOval();
    break;
    case FRECT_OP : releasedFRect();
    break;
    case FOVAL_OP : releasedFOval();
    break;
    case ERASER_OP : releasedEraser();
    break;
    public void mouseEntered(MouseEvent e)
    updateMouseCoordinates(e);
    public void setMainColor()
    switch (colorStatus)
    case 1 : mainColor = Color.black;
    break;
    case 2: mainColor = Color.blue;
    break;
    case 3: mainColor = Color.green;
    break;
    case 4: mainColor = Color.red;
    break;
    case 5: mainColor = Color.magenta;
    break;
    case 6: mainColor = Color.orange;
    break;
    case 7: mainColor = Color.pink;
    break;
    case 8: mainColor = Color.gray;
    break;
    case 9: mainColor = Color.yellow;
    break;
    case 10: mainColor = userDefinedColor;
    break;
    public void releasedPen()
    initialPen = true;
    public void releasedLine()
    if ((Math.abs(Orx-mousex)+Math.abs(Ory-mousey)) != 0)
    // System.out.println("Line has been released....");
    initialLine = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawLine(Orx,Ory,mousex,mousey);
    public void releasedEraser()
    initialEraser = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor.white);
    g.drawRect(mousex-eraserLength,mousey-eraserLength,eraserLength*2,eraserLength*2);
    public void releasedRect()
    initialRect = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawRect(drawX,drawY,OrWidth,OrHeight);
    public void releasedOval()
    initialOval = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    public void releasedFRect()
    initialFRect = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.fillRect(drawX,drawY,OrWidth,OrHeight);
    public void releasedFOval()
    initialFOval = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.fillOval(drawX,drawY,OrWidth,OrHeight);
    public void updateMouseCoordinates(MouseEvent e)
    String xCoor ="";
    String yCoor ="";
    if (e.getX() < 0) xCoor = "0";
    else
    xCoor = String.valueOf(e.getX());
    if (e.getY() < 0) xCoor = "0";
    else
    yCoor = String.valueOf(e.getY());
    mouseStatusBar.setText("x:"+xCoor+" y:"+yCoor);
    public void updateRGBValues()
    udefRedValue = redSlider.getValue();
    udefGreenValue = greenSlider.getValue();
    udefBlueValue = blueSlider.getValue();
    if (udefRedValue > 255)
    udefRedValue = 255;
    if (udefRedValue < 0 )
    udefRedValue =0;
    if (udefGreenValue > 255)
    udefGreenValue = 255;
    if (udefGreenValue < 0 )
    udefGreenValue =0;
    if (udefBlueValue > 255)
    udefBlueValue = 255;
    if (udefBlueValue < 0 )
    udefBlueValue =0;
    redValue.setText(String.valueOf(udefRedValue));
    greenValue.setText(String.valueOf(udefGreenValue));
    blueValue.setText(String.valueOf(udefBlueValue));
    userDefinedColor = new Color(udefRedValue,udefGreenValue,udefBlueValue);
    userDefButton.setBackground(userDefinedColor);
    Graphics g = udefdemcolPanel.getGraphics();
    g.setColor(userDefinedColor);
    g.fillRect(0,0,800,800);
    public void mouseClicked(MouseEvent e)
    updateMouseCoordinates(e);
    switch (opStatus)
    case 9 : splineOperation(e);
    break;
    case 10 : polygonOperation(e);
    break;
    public void mouseExited(MouseEvent e)
    updateMouseCoordinates(e);
    public void mouseMoved(MouseEvent e)
    updateMouseCoordinates(e);
    public void mousePressed(MouseEvent e)
    updateMouseCoordinates(e);
    Edited by: eclipse on Feb 19, 2008 6:29 AM

    If you can't divide the class then you can't implement an MVC design methodology.
    This class is a giant mess and can be EASILY broken down into smaller classes. Seperate the visual components into their own classes. Create Model objects that contain the data behind your visual components.
    Split up your giant ActionListener into several smaller more specialized actionlisteners and create a Controller object that you can assign these listeners and models to. Allow the event handling to be done by the controller so it can propogate necessary data changes to the models, thus altering the Views.
    Thats it in a nutshell. It is not an easy answer.

  • MVC Model debugging...?

    Hi, I have enhanced the standard BSP application
    known as "cProjects BSP Application".
    This application has a lot of views, controllers and models.
    How can I know current view is what?
    As you know, the broswer URL is fiexed for all views.
    http://xxxx/bsp/xxx/cProjects/default.html.

    You aso can set the breakpont in the any HTMLB control which is currently visible within the desired view and when debugger appears - look in the call stack - from which view this control was called.
    You can set the breakpoint in the mehod DO_AT_BEGINNING in the appropriate HTMLB control class.

  • Working with mvc model and cs5

    Hi all,
    Does anyone have some usefull suggestions on how Dreamweaver cs5 could benefit me in the development proces with a mvc website structure.
    Right now everything get's passed by the frontcontroller wich is initiated on the main index page.
    At least on the real server.
    I try to get the same page with a testserver, I installed xampp, but I don't get the same page result as I would get from the internetserver.
    Some off the css is messed up, etc.
    Any pointers on how to work with mvc would be helpfull.
    For example: To what extend is live view with xampp a helpfull tool to preview the pages that I want to make.
    Or should I preview the pages out off the context off mvc?
    thanks, Richard

    Some more information regarding my problem:
    It seems that the loadXML and saveXML does not like the data binding.
    When I don't use a data connection (and no binding), navigation works perfect and the data on the different pages is stored.
    When I use a data connection, the navigation still works, but the data is not stored anymore.
    When I use a data connection and a data binding, navigation does not work and also the data is not stored.
    By the way: I am using Lifecycle Designer 7.

  • MVC model to display DB on webpage

    I want to use struts(MVC) to display my data(Access) from jsp page, and I have create my bean(hotelbean) which contain only get and set method, the code below is the jsp page code, I would like to know how to change to display existing data in my webpage!!!
    [%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    String initial = session.getParameter("initial");
    String lastName = session.getParameter("name");
    String check_in_date = session.getParameter("check_in_date");
    String check_out_date = session.getParameter("check_out_date");
    Integer parseInt(string) telephone= session.getParameter("telephone");
    double rate = session.getParameter("rate");
    <jsp:useBean id="convert" class="hotel.HotelBean">
    <jsp:setProperty name="convert" property="initial" value="initial"/>
    <jsp:setProperty name="convert" property="name" value="name"/>
    <jsp:setProperty name="convert" property="check_in_date" value="check_in_date"/>
    <jsp:setProperty name="convert" property="check_out_date" value="check_out_date"/>
    <jsp:setProperty name="convert" property="telephone" value="telephone"/>
    <jsp:setProperty name="convert" property="rate" value="rate"/>
    </jsp:useBean>
    <html:html locale="true">
    Message was edited by:
    ritchie_lin

    Reminder, if you are going to post please keep them up to date and add your solution for other to use and then close them if you no longer require assistance.

  • What is the advantage of usning Single Servlet MVC model in Web Sites developed in JSP's ?

     

    I don't think that a Connection Pool class would be an ideal candidate for becoming a JavaBean. One of the most prevalent use of a JavaBean class it to use it as a data object to collect data from your presentation layer (viz. HTML form) and transfer it to your business layer. If the request parameter names match the Bean's property names, a bean can automatically get these values and initialize itself even though it has a zero argument ctor. Then a Bean could call methods in the business layer to do some processing, to persist itself etc.

  • MVC - Organizing models and managing GUI windows

    I'm having difficulty organizing my MVC models and basically controlling the whole application in general. My application works, but all the controlling logic is being dumped into the main class (Main.java). Here's a simple example of the problem I'm having:
    Objectives
    1) Display a list of Companies; i.e. Sun, Microsoft, Adobe, etc. (JFrame with a JList)
    2) The user select a Company and it pops up a new dialog with a list of Employees. (JDialog with a JList)
    Here are the classes I came up with:
    Models:
    1) CompanyListModel
    2) EmployeeListModel
    Listeners:
    1) CompanyListener
    Views:
    1) CompanyListFrame
    2) EmployeeListDialog
    Domain Objects:
    1) Company
    2) Employee
    And then there's the main application class. To implement the above objective, I've been using my main class to control the GUI.
    Here's an example of how I've implemented it.
    public class Main implements CompanyListener {
        /** Creates a new instance of Main */
        public Main() {
            CompanyListModel companyModel = new CompanyListModel();
            companyModel.addCompanyListener(this);
            CompanyListFrame gui = new CompanyListFrame(companyModel);
        // A company was selected.  Open a new dialog and display the employees
        public void companySelected(CompanyModel companyModel) {
            Company company = companyModel.getCompany();
            EmployeeListModel employeeModel = new EmployeeListModel(company));
            EmployeeListDialog = new EmployeeListDialog(employeeModel);
        public static void main(String[] args) {
            new Main();
    }My program is similiar design wise to the above, but contains many more classes. I'm still using my main class to control GUI logic (popping up new windows and creating models, etc). Thus, my main class implements like 5 different listeners. I'm sure this is a really poor design choice, I just don't know how else to implement it.
    I should not nest models... correct? I was thinking about nesting the models, i.e. CompanyListModel contains an EmployeeListModel, but then the CompanyListModel will need to spawn the EmployeeListDialog when a Company is selected, right? Thus, I'd be mixing the view with the model.
    Please provide some advice! :( Thanks!

    I'm sorry, I read your reply about 3 times and I've
    spent the last 20 minutes trying to implement it.
    I'm just not sure how the controllers are involved.
    Could you possibly provide source code for the
    controllers (and any part of the models / views that
    communicate with the controller)?No source code. Read about the MVC pattern.
    I feel like this is a wasted effort. I'm the sole
    entry level programmer at my company and I have only
    one year real wold experience . I work with about 10
    other senior level (microsoft) programmers and none
    of them code in this fashion. All of our
    applications are desktop applications using C#,
    C/C++, or scripting languages.What's a wasted effort? You posting a question? Me posting a response? You writing Java? You trying to think about how to do this properly?
    So why are you using Java if you're in a Microsoft shop? How's this working out with your co-workers?
    I feel like if I worked on a project with one of
    them, they would criticize me for using MVC and
    "complicating" such a simple issue.That's usually because Microsoft likes tying a particular text box to a column in a table. If you change the textbox value you change the database. Nice and easy, right?
    In trying to implement this solution, my workspace
    now has a huge load of classes for something so
    simple:
    Company
    CompanyFrame
    CompanyListController
    CompanyListListener
    CompanyListModel
    CompanyListPanel
    Employee
    EmployeeListDialog
    EmployeeListModel
    EmployeeListPanel
    Main
    11 classes and I left out the Emp Controller and
    Listener to simplify the example. The more classes
    that you have, the slower the application startup
    time. Moving the Views to JPanels as you suggested
    seemed smart but it wound up making it more
    difficult. I'm using NetBeans and Matisse and I
    don't believe you can use another JPanel class in the
    GUI editor unless you make it a bean.
    Traditionally, I would have implemented as follows.
    I would have completed it in 5 minutes and it would
    be much easier to understand what's going on:
    Company
    CompanyFrame - contains a list of companies
    Employee
    EmployeeListDialog - contains a list of employees
    Main
    Of course doing it this way I'd be mixing data with
    the view, but is that always a bad thing or is it
    only bad for large scale applications? Should MVC
    not be used for small modules like this?For small modules that are nothing more the CRUD operations, it might be that a simpler approach is fine. (PS - CRUD stands for Create/Read/Update/Delete, standard relational operations on tables. I'm not commenting on you or your code.)
    It only becomes a problem when that "simple" CRUD application decides to branch into something bigger. The approach of mingling view and data can become problematic then.
    It's still possible to have a clean application for small apps. I think most Microsoft programmers do it that way because the wizards and stuff they're used only allow it to be done that way.
    The reasons why I'm going away from my old "academic"
    programming practices is:
    1) I want to become a better programmer of course!Kudos to you. At least you're still thinking about it.
    2) There's alot of database queries in this
    application so I wanted to separate that from the GUI
    as much as possible. Thus, each model knows how to
    query the database and it's all done on separate
    threads.That's good motivation, too.
    I'd really like to do this right. If you could
    provide source that would be great. Also, are there
    any good books on desktop GUI development geared
    towards Java (or even C#)?I don't write for the desktop, so I'm not much help.
    I already purchased the e-book Desktop Java Live,
    which is great but they don't go into detail about
    MVC and instead use Model-Presenter which has been
    retired (according to Fowlers website). I found that
    section fairly confusing so I figured I'd start with
    MVC since it's more widespread (?).If you're reading Martin Fowler you're doing well.
    Thank you.I'm sorry that I'm not more helpful.
    %

Maybe you are looking for

  • ACH format through FDTA

    Hi, We are executing the program RFFOUS_T and after the file is generated, we are downloading it through FDTA transaction in ACH format and We have implemented user exit  for populating some of the hard coded values in ACH format The downloaded file

  • How do I get my security questions answers

    I forgot my security questions

  • Populate tree from a datablock

    Hi, I'm using forms6i I want to know whether it is possible to create a hierarchical tree from a database block. Like if the datablock contains 2 columns(2 items) One column (1st column) will be the root nodes of the tree and the 2nd column becomes t

  • Saving logo for web – What's an Illy thread doing here?

    This thread: http://forums.adobe.com/thread/470690?tstart=0 Is in the Illustrator forum... so, why is it here? Are the threads now starting to bridge the continuum?

  • Safari won't work since Mt Lion upgrade

    Running 10.8.2 on a 24" early 2008 imac 2.8 Ghz Intel 2 duo Since the mountain lion upgrade, Safari and App Store can't connect to the internet.  Chrome browser works just fine, so I know it's not the connectivity.  HELP!  -GREG