Hello John,
Many questions in the same thread. I will try to reply to all of them.
Hi All,
I am new to using AppBuilder and as such I have a few questions. Please excuse me if they seem simple or trivial.
Any question is trivial! :-)
Implementing MVC in App Builder.
1. I use MVC in my Java Applications. How can I take the approach I use for MVC in Java (as demonstrated by this example http://www.austintek.com/mvc/) and implement it in AppBuilder ?
The App Builder apps follows the MVC pattern, since it's implemented by certain Javascript core component (Angular JS) used by App Builder. In fact, you can think in your app's variables and other source of data (like HTTP Clients, etc.) as the model. The view part is the app's view, which automatically reflect possible changes in the model and viceversa.
Every view have also an controller, which is composed by the view's events, view's controls events, etc. With this the controller you can control the model, and, the app's view reflect automatically the possible changes on the model by the controller.
The above basically means that you no need to do anything special, since the App Builder produces apps are based in an MVC pattern.
Using Custom JavaScript
1. I know I can use custom JavaScript by using the StartJS and EndJS Markers. However, how do I access the properties of UI Components using Javascript?
Maybe you want to take a look at the External Javascript tutorial of the App Builder's help.
2. If I create an external Javascript File where should I store the file to ensure ease of deployment when the app is finished ?
Probably the best is that every app have at least one root folder, for example, "MyApp". Inside this folder you can place more folders like "Javascript", then you can place inside your JS files and include it by the app's files manager. Doing that App Builder play with the Javascript files as "local files", that is, you can, for example, move your "MyApp" to another computer, and everything continue working.
Views and the App
1. Can I treat views as Classes (as I would in Java) ?
The app's views have certainly an variable in the app's scope and that variable is an Javascript object variable, with some possible useful properties. But you must explain a little more what you means by "treat views as classes" John.
2. Can I add Variables that are Global to the view ?
3. Can I add Variables that are Global for the whole App ?
All App Builder's apps variables are globals, in the sense that you can, for example, change the text of a button that is not in the current app's view. You can change the text... but the button's text is not shown... until the view who contain it is shown.
4. Can I create Custom Functions for a View?
Using pure Javascript, certainly you can do it, for example, in the app's view's Show event. You can place some functions inside the app's view's variable or in other place in the view's controller. However, commonly what you do is to create app's functions, using both App Builder actions and / or Javascript code, and then use that functions from one view or another.
Please, John, go ahead if you have any further questions.