File tree Expand file tree Collapse file tree 6 files changed +24
-34
lines changed
model-view-presenter/src/main/java/com/iluwatar/model/view/presenter Expand file tree Collapse file tree 6 files changed +24
-34
lines changed Original file line number Diff line number Diff line change 44 *
55 * The Model-View-Presenter(MVP) architectural pattern, helps us achieve what is
66 * called "The separation of concerns" principle. This is accomplished
7- * by separating the application's logic(Model), GUIs(View), and finally
8- * the way that the user's actions update the application's logic(Presenter).
9- *
10- * In the following example, The FileLoader class represents the app's logic,
11- * the FileSelectorJFrame is the GUI and the FileSelectorPresenter is
7+ * by separating the application's logic (Model), GUIs (View), and finally
8+ * the way that the user's actions update the application's logic (Presenter).
9+ * <p>
10+ * In the following example, The {@link FileLoader} class represents the app's logic,
11+ * the {@link FileSelectorJFrame} is the GUI and the {@link FileSelectorPresenter} is
1212 * responsible to respond to users' actions.
13- *
13+ * <p>
1414 * Finally, please notice the wiring between the Presenter and the View
1515 * and between the Presenter and the Model.
1616 *
1717 */
18- public class MainApp {
18+ public class App {
1919
20+ /**
21+ * Program entry point
22+ * @param args command line args
23+ */
2024 public static void main (String [] args ) {
2125 FileLoader loader = new FileLoader ();
2226 FileSelectorJFrame jFrame = new FileSelectorJFrame ();
Original file line number Diff line number Diff line change 77/**
88 * Every instance of this class represents the Model component in the
99 * Model-View-Presenter architectural pattern.
10- *
10+ * <p>
1111 * It is responsible for reading and loading the contents of a given file.
1212 */
1313public class FileLoader {
@@ -51,9 +51,7 @@ public String loadData() {
5151
5252 /**
5353 * Sets the path of the file to be loaded, to the given value.
54- *
55- * @param fileName
56- * The path of the file to be loaded.
54+ * @param fileName The path of the file to be loaded.
5755 */
5856 public void setFileName (String fileName ) {
5957 this .fileName = fileName ;
Original file line number Diff line number Diff line change 1414import javax .swing .JTextField ;
1515
1616/**
17- * This class is the GUI implementation of the View component In the
17+ * This class is the GUI implementation of the View component in the
1818 * Model-View-Presenter pattern.
1919 */
2020public class FileSelectorJFrame extends JFrame implements FileSelectorView ,
Original file line number Diff line number Diff line change 33/**
44 * Every instance of this class represents the Presenter component in the
55 * Model-View-Presenter architectural pattern.
6- *
6+ * <p>
77 * It is responsible for reacting to the user's actions and update the View
88 * component.
99 */
@@ -21,19 +21,15 @@ public class FileSelectorPresenter {
2121
2222 /**
2323 * Constructor
24- *
25- * @param view
26- * The view component that the presenter will interact with.
24+ * @param view The view component that the presenter will interact with.
2725 */
2826 public FileSelectorPresenter (FileSelectorView view ) {
2927 this .view = view ;
3028 }
3129
3230 /**
33- * Sets the FileLoader object, to the value given as parameter.
34- *
35- * @param loader
36- * The new FileLoader object(the Model component).
31+ * Sets the {@link FileLoader} object, to the value given as parameter.
32+ * @param loader The new {@link FileLoader} object(the Model component).
3733 */
3834 public void setLoader (FileLoader loader ) {
3935 this .loader = loader ;
Original file line number Diff line number Diff line change 33/**
44 * Every instance of this class represents the Stub component in the
55 * Model-View-Presenter architectural pattern.
6- *
6+ * <p>
77 * The stub implements the View interface and it is useful when we want the test
88 * the reaction to user events, such as mouse clicks.
9- *
9+ * <p>
1010 * Since we can not test the GUI directly, the MVP pattern provides this
1111 * functionality through the View's dummy implementation, the Stub.
1212 */
Original file line number Diff line number Diff line change @@ -23,9 +23,7 @@ public interface FileSelectorView {
2323
2424 /**
2525 * Sets the presenter component, to the one given as parameter.
26- *
27- * @param presenter
28- * The new presenter component.
26+ * @param presenter The new presenter component.
2927 */
3028 public void setPresenter (FileSelectorPresenter presenter );
3129
@@ -36,9 +34,7 @@ public interface FileSelectorView {
3634
3735 /**
3836 * Sets the file's name, to the value given as parameter.
39- *
40- * @param name
41- * The new name of the file.
37+ * @param name The new name of the file.
4238 */
4339 public void setFileName (String name );
4440
@@ -49,17 +45,13 @@ public interface FileSelectorView {
4945
5046 /**
5147 * Displays a message to the users.
52- *
53- * @param message
54- * The message to be displayed.
48+ * @param message The message to be displayed.
5549 */
5650 public void showMessage (String message );
5751
5852 /**
5953 * Displays the data to the view.
60- *
61- * @param data
62- * The data to be written.
54+ * @param data The data to be written.
6355 */
6456 public void displayData (String data );
6557}
You can’t perform that action at this time.
0 commit comments