You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Appify was developed mainly for Java Web developers. If you have skills on HTML5
33
33
<inheritsname="it.appify.App" />
34
34
```
35
35
36
-
####@WebApp
36
+
####@WebApp
37
37
Now your are ready to use all Appify features. First of all you have to declare your web app inteface. Appify offers some annotations to make the development of your web app fast and easy. Infact the webapp interface can be annotated with some web app capabilities and inject them in your webapp such as: Geolocation, Storage, Application Cache, Notification, Offline support, and many others.
38
38
39
39
```java
@@ -56,9 +56,9 @@ In this first example we have declared a webapp with no particular features but
56
56
myApp.startApp(newAppModel());
57
57
```
58
58
59
-
##Controller annotations:
59
+
##Controller annotations:
60
60
61
-
####@Controller
61
+
####@Controller
62
62
Developing a controller with Appify is very simple. Controller is a class annotated with @Controller annotation. The controller can be bound to a View (in Appify a view is a page) by its name. So if you want to bind a MenuController to your main page you have yo annotate your MainPage class with a @Controller and pass the page name to page parameter.
63
63
64
64
```java
@@ -88,7 +88,7 @@ Now suppose we have this HTML code for our menu view, controller can intercept a
88
88
</div>
89
89
</div>
90
90
```
91
-
####@ViewHandler
91
+
####@ViewHandler
92
92
So if you want to intercept the click event on the button with id "checkInBtn" contained in the "mainPage" page you have to write this simple code in your controller class:
93
93
94
94
```java
@@ -99,7 +99,7 @@ So if you want to intercept the click event on the button with id "checkInBtn" c
99
99
```
100
100
Classes annotated with @Controller annotation MUST have a constructor with a WebApp type parameter. This constructor will enables the framework to inject the WebApp skeleton. Webapp skeleton enable you to develop your controllers to trigger a page transition, obtain your current app state, get current visualized page reference, change some view behavior like CSS toggles, show modals, show tooltips and popovers, and to read and write the persistent storage. For all WebApp API skeleton you can see at the WebApp API.
101
101
102
-
####@ViewElement
102
+
####@ViewElement
103
103
Appify can inject the desired view element in your controller. If you have the need to get a reference to an input text element you can declare it as a field of your controller class:
104
104
105
105
```java
@@ -108,7 +108,7 @@ Appify can inject the desired view element in your controller. If you have the n
108
108
```
109
109
Note that you have to provide at least some getters and setters of your private fields. Getters and Setters will enable Appify to correctly inject your view element in your controller. Alternatively you can use the public modifier for your UI fields. Note that all ViewElement (ui fields) are simply DOM elements. GWT offers its Element class and a great mechanism that wraps an HTML DOM Element in a Java Object.
110
110
111
-
####@ViewModelHandler
111
+
####@ViewModelHandler
112
112
If you need to intercpet the data behind the user interaction with a view you have to use the @ViewModelHandler annotation. @ViewModelHandler is a special @ViewHandler for intercept events from a @ViewElement and its related model data. This annotation is useful for List, Combo or Radio Button HTML elements. In general all user interactions with a UI field bound with a model can be intercepted trough a @ViewModelHandler. The example above shows how you can get the described behavior in a few lines of code:
113
113
114
114
```java
@@ -121,10 +121,10 @@ If you need to intercpet the data behind the user interaction with a view you ha
121
121
```
122
122
The onItemReceived method will receive the data behind a list of items when the user will click on an item in the list. The viewId MUST correspond simply to the id of our HTML list. Note that ViewModelHandler need to know the model type in terms of fields bound to our views, in this case the HTML list and the "code" and "name" fields wrapped in the Item class. The declaration of the binding between View and Model is made trough special attributes that can be used in your HTML page. We will call this attributes directives. For all supported directives see the relative Appendix 'Appify supported Directives'.
123
123
124
-
##Service annotations:
124
+
##Service annotations:
125
125
Services are simple classes delegated to some kind of background logic execution with singleton scope. To make a class an Appify Service you need to use the related annotations set.
126
126
127
-
####@Service
127
+
####@Service
128
128
Service annotation is the main annotation for service discovering. Appify will inject your app in a Service class and will start your service calling the method annotated with the Start annotation.
129
129
So if you want to create a service you just need to do this:
130
130
@@ -140,7 +140,7 @@ public class MyService {
140
140
}
141
141
```
142
142
143
-
####@Start
143
+
####@Start
144
144
@Service annotation is strictly related with #Start annotation. A service class will be started by Appify if there is at least one public method annotated with the @Start annotation.
145
145
146
146
```java
@@ -160,8 +160,8 @@ public class MyService {
160
160
}
161
161
```
162
162
163
-
##Appify WebApp annotations:
164
-
####@Geolocation
163
+
##Appify WebApp annotations:
164
+
####@Geolocation
165
165
You can enable Geolocation support by adding this simple annotation. You can use annotation parameter to configure your geolocation behavior.
Offline annotation makes your app offline-first enabling your app to access the HTML5 Application Cache receive events and get connection status informations:
If you need to persist application state in the storage you can annotate your web app with this annotation. Using Storage annotation will enable you to get a Storage Service and to obtain a great Appify behavior. Once Storage was activated your application state will be persisted every time you call the updateAppState method of your app. Without the Storage feature the updateAppState method will affect only the view but changes will not be persisted so a simple refresh of your page will reset all your application state.
If you prefer, you can use the Javascript Api version of Appify:
276
276
```javascript
277
277
//construct your appify object
@@ -290,7 +290,7 @@ myapp.moveTo('childPage');
290
290
mymodel.title='New Title';
291
291
myapp.updateAppState(mymodel);
292
292
```
293
-
#Updates:
293
+
#Updates:
294
294
Actually Appify rely on these modules:
295
295
- App.Js for the View and the Page transition.
296
296
- VueJs for the MVVM pattern.
@@ -301,10 +301,10 @@ Actually Appify rely on these modules:
301
301
302
302
These modules (except of GWT) are not mandatory and you can use what you prefer, for example for the MVVM instead of VueJs you can use AngularJs. This is not a priority requirement, but it's planned in the road-map and will be provided in the next future.
0 commit comments