mvpc | Model View Presenter Controller sample app | Architecture library
kandi X-RAY | mvpc Summary
kandi X-RAY | mvpc Summary
Based on Android Studio login flow template. Demonstrates MVPC architecture pattern with tests.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize login form
- On login button click on login button
- Starts validation thread
- Register the login controller
- Inflates the UI
- Validates a password
- On login button click on a login button
- Validate an email
- Display the login error message
- Displays the login error message
- Shows the progress UI
- Shows the login form
- Connect to the remote server
- Show error message
- Initialize component
- Show the error field
- Set up the Snackbar
- Runs the validation process
- Clear all errors
mvpc Key Features
mvpc Examples and Code Snippets
Community Discussions
Trending Discussions on mvpc
QUESTION
I would like to create an application in JavaFX which imlements an MVPC pattern. My idea is the following:
- VIEW: simple FXML file
- CONTROLLER: contains the event handler functions defined in VIEW, updates the PRESENTATION MODEL
- PRESENTATION MODEL:simple data, contains observable objects (ObjectProperty, ObservableList etc.)
- PRESENTER: contains the JavaFX nodes defined by fx:id in the FXML file, binds these nodes to the observable objects in the PRESENTATION MODEL and handles other presentation functions like popup windows. This would be the JavaFX Application.
As you could notice my aim is to separate FXML object (like @FXML Label label) to PRESENTER and FXML event handler methods (like @FXML submit(Action event e){}) TO CONTROLLER.
In short: I have ONE FXML file with elements like fx:id="passwordField" and event handlers like onAction="#browseSbx". I would like to have TWO separate .java controllers, one to contain objects for fx:ids and one to handle event methods.
My question: is there any "clean" way to do this? Or is there any conceptual error in my plan?
Thanks!
...ANSWER
Answered 2017-Dec-22 at 16:57Just a note on usability: if you completely separate out the "actions" from the "view" (i.e. if your controller truly knows nothing about the UI components) things may get a little convoluted. For example, much of the time button actions will want to look at the state of text fields, etc. You certainly can do this by using your presenter to bind, say, the text in the text fields to data in the presentation model, and then letting the controller invoke a method on the model that references that state. The issue then is that the controller methods basically do nothing other than invoke equivalent methods on the presentation model; you end up with a layer that really is too thin and isn't pulling its weight, and the architecture looks over-engineered.
That said, if you do want to experiment with this, here's an approach that will work.
The main stumbling block here is that the FXMLLoader
has a single controller
instance associated with it. When it loads the FXML, it both injects elements with fx:id
attributes into the controller, and associates "handler" methods in the controller with event handlers specified via onXXX
attributes in the FXML.
The way you can make this work is to use the FXMLLoader
's namespace
, which is a map from fx:id
values to the corresponding elements. So the approach I think will work is to use the default load process to associate the handlers with your controller, and then to use a bunch of reflection to initialize @FXML
-annotated fields in your presenter from the values in the namespace.
The latter part of that looks like:
QUESTION
I'm in the middle of adding Dagger dependency injection to my Android project. Although Android Studio gives shows me no errors before trying to compile, I cannot get my code to build successfully for some reason.
I use the MVPC strcture for my app and I have implemented it as follows:
...ANSWER
Answered 2017-Jan-18 at 17:39There is no information about AboutActivityController providing in your @Module, but AboutActivityPresenter needs it for initialization.
Try to edit your module class like the following:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mvpc
You can use mvpc like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the mvpc component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page