Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Although it is not uncommon to have "nested" design patterns it is not necessary in your case. Drawing on the other answers:</p> <p><b>Model</b><br> &nbsp;- Contains all the real data, variables, objects<br> &nbsp;- knows how to set its stored data values to the new values<br> &nbsp;- responds to orders (method calls)<br> &nbsp;- has method setPreferences(value1,value2,value3...);<br></p> <p><strong>View</strong><br> &nbsp;- is the IO for the application, just output and input<br> &nbsp;- it can only work on its self, on its state<br> &nbsp;- it maintains local variables and objects, eg. it has JButtons, JMenus, int counters ...<br> &nbsp;- it is knows how to inform the Presenter of State Change<br> &nbsp;- its state is visible to the Presenter, or revealed by method call<br> &nbsp;- responds to orders (method calls)<br> &nbsp;- knows how to get preferences from the user<br> &nbsp;- has method askForPrefs();<br> &nbsp;- has method getPrefState();<br></p> <p><strong>Presenter</strong><br> &nbsp;- Responds to state changes<br> &nbsp;- does all the deciding, it tells the other objects what to do (not how to do it)<br> &nbsp;- knows when preferences are needed<br> &nbsp;- knows where to get new preferences and where to put them<br> &nbsp;- has method newPrefsAvailable();<br></p> <blockquote> <p>... to obtain further information from the user. In the case of these events, I believe it is appropriate for the Swing view to spawn a new JDialog window.</p> </blockquote> <p>Presenter - checks the Model, determines new preferences are required<br> Presenter - this.myView.askForPrefs(); //tells view to ask user for pref values<br> View.askForPrefs - pops up a JDialog box, retVals stored in the view as a state change<br> View - this.myPresenter.newPrefsAvailable();<br> Presenter - responds with this.myModel.setPreferences (this.myView.getPrefState());<br> Model.setPreferences - changes the stored values to View.getPrefState() <br> Presenter - checks the Model - determines preferences are good<br> Presenter - continues on <br></p> <p>The JDialog is treated as just an extension of the View,it is a member of the View just like a JButton would be. The model has the authoritative actual preference values, and the view has local variables that represent the state of the JDialog.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload