resty-generators 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/features/generators.feature +67 -0
- data/features/step_definitions/simple_steps.rb +1 -0
- data/lib/generators/resty/base.rb +15 -3
- data/lib/generators/resty/model/model_generator.rb +33 -3
- data/lib/generators/resty/scaffold/scaffold_generator.rb +30 -15
- data/lib/generators/resty/setup/setup_generator.rb +2 -2
- data/lib/generators/resty/setup/setup_generator.rb~ +31 -0
- data/lib/generators/resty/setup/templates/ActivityFactory.java~ +7 -0
- data/lib/generators/resty/setup/templates/ActivityPlace.java +5 -0
- data/lib/generators/resty/setup/templates/ActivityPlace.java~ +8 -0
- data/lib/generators/resty/setup/templates/BreadCrumbsPanel.java +3 -2
- data/lib/generators/resty/setup/templates/BreadCrumbsPanel.java~ +79 -0
- data/lib/generators/resty/setup/templates/GinModule.java~ +7 -0
- data/lib/generators/resty/setup/templates/LoginActivity.java~ +58 -0
- data/lib/generators/resty/setup/templates/LoginPlace.java~ +20 -0
- data/lib/generators/resty/setup/templates/LoginViewImpl.java~ +21 -0
- data/lib/generators/resty/setup/templates/Mavenfile +5 -5
- data/lib/generators/resty/setup/templates/Mavenfile~ +15 -0
- data/lib/generators/resty/setup/templates/MenuPanel.java~ +12 -0
- data/lib/generators/resty/setup/templates/PLaceHistoryMapper.java~ +7 -0
- data/lib/generators/resty/setup/templates/RestfulPlace.java~ +22 -0
- data/lib/generators/resty/setup/templates/SessionActivityPlaceActivityMapper.java~ +71 -0
- data/lib/generators/resty/setup/templates/SessionRestService.java~ +23 -0
- data/lib/generators/resty/setup/templates/User.java +34 -4
- data/lib/generators/resty/setup/templates/authentication.rb +2 -1
- data/lib/generators/resty/setup/templates/authentication.rb~ +4 -0
- data/lib/generators/resty/setup/templates/empty.css~ +1 -0
- data/lib/generators/resty/setup/templates/gwt.css +45 -0
- data/lib/generators/resty/setup/templates/initializer.rb~ +1 -0
- data/lib/generators/resty/setup/templates/monkey_patch.rb~ +27 -0
- data/lib/generators/resty/setup/templates/page.html~ +0 -0
- data/lib/generators/resty/setup/templates/session.rb +18 -36
- data/lib/generators/resty/setup/templates/session.rb~ +45 -0
- data/lib/generators/resty/setup/templates/sessions_controller.rb +27 -8
- data/lib/generators/resty/setup/templates/sessions_controller.rb~ +27 -0
- data/lib/generators/resty/setup/templates/user.rb +38 -6
- data/lib/generators/resty/setup/templates/user.rb~ +27 -0
- data/lib/generators/resty/templates/Activity.java +78 -39
- data/lib/generators/resty/templates/Activity.java~ +67 -0
- data/lib/generators/resty/templates/ActivityPlace.java~ +11 -0
- data/lib/generators/resty/templates/ColumnDefinitionsImpl.java~ +24 -0
- data/lib/generators/resty/templates/ColumnDefintionsImpl.java~ +34 -0
- data/lib/generators/resty/templates/Controller.java~ +49 -0
- data/lib/generators/resty/templates/Editor.java +123 -0
- data/lib/generators/resty/templates/Editor.java~ +84 -0
- data/lib/generators/resty/templates/Editor.ui.xml +41 -0
- data/lib/generators/resty/templates/Editor.ui.xml~ +37 -0
- data/lib/generators/resty/templates/Event.java +30 -0
- data/lib/generators/resty/templates/Event.java~ +31 -0
- data/lib/generators/resty/templates/EventHandler.java +8 -0
- data/lib/generators/resty/templates/EventHandler.java~ +30 -0
- data/lib/generators/resty/templates/Model.java +144 -15
- data/lib/generators/resty/templates/Model.java~ +23 -0
- data/lib/generators/resty/templates/Place.java +1 -1
- data/lib/generators/resty/templates/Place.java~ +21 -0
- data/lib/generators/resty/templates/PlaceTokenizer.java +1 -1
- data/lib/generators/resty/templates/PlaceTokenizer.java~ +19 -0
- data/lib/generators/resty/templates/RestService.java~ +51 -0
- data/lib/generators/resty/templates/View.java +15 -4
- data/lib/generators/resty/templates/View.java~ +23 -0
- data/lib/generators/resty/templates/View.ui.xml +22 -38
- data/lib/generators/resty/templates/View.ui.xml~ +17 -0
- data/lib/generators/resty/templates/ViewImpl.java +88 -103
- data/lib/generators/resty/templates/ViewImpl.java~ +153 -0
- data/lib/resty/abstract_session.rb~ +59 -0
- data/lib/resty/child_path.rb~ +18 -0
- data/lib/resty/session.rb~ +6 -0
- metadata +56 -11
@@ -0,0 +1,24 @@
|
|
1
|
+
package <%= views_base_package %>;
|
2
|
+
|
3
|
+
import java.util.ArrayList;
|
4
|
+
|
5
|
+
import <% gwt_rails_package %>.ColumnDefinition;
|
6
|
+
import <%= views_base_package %>.<%= class_name %>;
|
7
|
+
|
8
|
+
@SuppressWarnings("serial")
|
9
|
+
public class <%= plural_class_name %>ColumnDefinitionsImpl extends
|
10
|
+
ArrayList<ColumnDefinition<<%= class_name %>>> {
|
11
|
+
|
12
|
+
protected <%= plural_class_name %>ColumnDefinitionsImpl() {
|
13
|
+
|
14
|
+
this.add(new ColumnDefinition<<%= class_name %>>() {
|
15
|
+
public void render(<%= class_name %> c, StringBuilder sb) {
|
16
|
+
sb.append("<div id='" + c.id + "'>" + "TODO" + "</div>");
|
17
|
+
}
|
18
|
+
|
19
|
+
public boolean isClickable() {
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
});
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
package <%= views_base_package %>;
|
2
|
+
|
3
|
+
import java.util.ArrayList;
|
4
|
+
|
5
|
+
import <% gwt_rails_package %>.ColumnDefinition;
|
6
|
+
import <%= views_base_package %>.<%= class_name %>;
|
7
|
+
|
8
|
+
@SuppressWarnings("serial")
|
9
|
+
public class AuditsColumnDefinitionsImpl extends
|
10
|
+
ArrayList<ColumnDefinition<Audit>> {
|
11
|
+
|
12
|
+
private static AuditsColumnDefinitionsImpl instance = null;
|
13
|
+
|
14
|
+
public static AuditsColumnDefinitionsImpl getInstance() {
|
15
|
+
if (instance == null) {
|
16
|
+
instance = new AuditsColumnDefinitionsImpl();
|
17
|
+
}
|
18
|
+
|
19
|
+
return instance;
|
20
|
+
}
|
21
|
+
|
22
|
+
protected AuditsColumnDefinitionsImpl() {
|
23
|
+
|
24
|
+
this.add(new ColumnDefinition<Audit>() {
|
25
|
+
public void render(Audit c, StringBuilder sb) {
|
26
|
+
sb.append("<div id='" + c.id + "'>" + c.created_at + " [" + c.login + "] " + c.message + "</div>");
|
27
|
+
}
|
28
|
+
|
29
|
+
public boolean isClickable() {
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
package <%= controllers_base_package %>;
|
2
|
+
|
3
|
+
<% if action_map.values.member? :get_all -%>
|
4
|
+
import java.util.List;
|
5
|
+
<% end -%>
|
6
|
+
|
7
|
+
import javax.ws.rs.*;
|
8
|
+
|
9
|
+
import org.fusesource.restygwt.client.*;
|
10
|
+
|
11
|
+
<% if name -%>
|
12
|
+
import <%= models_base_package %>.<%= class_name %>;
|
13
|
+
<% end -%>
|
14
|
+
|
15
|
+
@Path("/<%= table_name %>")
|
16
|
+
public interface <%= controller_class_name %>Controller extends RestService {
|
17
|
+
|
18
|
+
<% actions.each do |action|
|
19
|
+
case action_map[action]
|
20
|
+
when :get_all -%>
|
21
|
+
@GET
|
22
|
+
void <%= action %>(MethodCallback<List<<%= class_name %>>> callback);
|
23
|
+
|
24
|
+
// @GET
|
25
|
+
// void <%= action %>(MethodCallback<List<<%= class_name %>>> callback, @QueryParam("limit") int limit, @QueryParam("offset") int offset);
|
26
|
+
//
|
27
|
+
<% when :get_single -%>
|
28
|
+
@GET<% unless options[:singleton] -%> @Path("/{id}")<% end %>
|
29
|
+
void <%= action %>(<% unless options[:singleton] -%>@PathParam("id") int id, <% end -%>MethodCallback<<%= class_name %>> callback);
|
30
|
+
|
31
|
+
<% when :post -%>
|
32
|
+
@POST
|
33
|
+
void <%= action %>(<%= class_name %> value, MethodCallback<<%= class_name %>> callback);
|
34
|
+
|
35
|
+
<% when :put -%>
|
36
|
+
@PUT<% unless options[:singleton] -%> @Path("/{id}")<% end %>
|
37
|
+
void <%= action %>(<% unless options[:singleton] -%>@PathParam("id") @Attribute("id") <% end -%><%= class_name %> value, MethodCallback<<%= class_name %>> callback);
|
38
|
+
|
39
|
+
<% when :delete -%>
|
40
|
+
@DELETE @Path("/{id}")
|
41
|
+
void <%= action %>(@PathParam("id") @Attribute("id") <%= class_name %> value, MethodCallback<Void> callback);
|
42
|
+
|
43
|
+
<% else -%>
|
44
|
+
@GET
|
45
|
+
void <%= action %>(MethodCallback<Void> callback);
|
46
|
+
|
47
|
+
<% end
|
48
|
+
end -%>
|
49
|
+
}
|
@@ -0,0 +1,123 @@
|
|
1
|
+
package <%= editors_package %>;
|
2
|
+
|
3
|
+
<% if attributes.detect {|a| a.type == :belongs_to } -%>
|
4
|
+
import java.util.ArrayList;
|
5
|
+
import java.util.Arrays;
|
6
|
+
import java.util.List;
|
7
|
+
|
8
|
+
<% end -%>
|
9
|
+
<% for attribute in attributes -%>
|
10
|
+
<% if attribute.type == :belongs_to -%>
|
11
|
+
import <%= models_package %>.<%= attribute.name.classify %>;
|
12
|
+
<% end -%>
|
13
|
+
<% end -%>
|
14
|
+
import <%= models_package %>.<%= class_name %>;
|
15
|
+
<% if options[:modified_by] -%>
|
16
|
+
import <%= models_package %>.User;
|
17
|
+
<% end -%>
|
18
|
+
|
19
|
+
import com.google.gwt.core.client.GWT;
|
20
|
+
import com.google.gwt.editor.client.Editor;
|
21
|
+
import com.google.gwt.uibinder.client.UiBinder;
|
22
|
+
import com.google.gwt.uibinder.client.UiField;
|
23
|
+
import com.google.gwt.user.client.ui.Composite;
|
24
|
+
<% if options[:timestamps] -%>
|
25
|
+
import com.google.gwt.user.client.ui.DateLabel;
|
26
|
+
<% end -%>
|
27
|
+
<% if !options[:singleton] || options[:timestamps] || options[:modified_by] -%>
|
28
|
+
import com.google.gwt.user.client.ui.FlowPanel;
|
29
|
+
<% end -%>
|
30
|
+
<% unless options[:singleton] -%>
|
31
|
+
import com.google.gwt.user.client.ui.NumberLabel;
|
32
|
+
<% end -%>
|
33
|
+
import com.google.gwt.user.client.ui.*;
|
34
|
+
import com.google.gwt.user.client.ui.Widget;
|
35
|
+
import com.google.gwt.user.datepicker.client.DateBox;
|
36
|
+
|
37
|
+
import de.mkristian.gwt.rails.editors.UserLabel;
|
38
|
+
import de.mkristian.gwt.rails.editors.DoubleBox;
|
39
|
+
import de.mkristian.gwt.rails.editors.IntegerBox;
|
40
|
+
import de.mkristian.gwt.rails.editors.LongBox;
|
41
|
+
import de.mkristian.gwt.rails.editors.IdentifyableListBox;
|
42
|
+
|
43
|
+
public class <%= class_name %>Editor extends Composite implements Editor<<%= class_name %>>{
|
44
|
+
|
45
|
+
interface Binder extends UiBinder<Widget, <%= class_name %>Editor> {}
|
46
|
+
|
47
|
+
private static final Binder BINDER = GWT.create(Binder.class);
|
48
|
+
|
49
|
+
<% if !options[:singleton] || options[:timestamps] || options[:modified_by] -%>
|
50
|
+
@Ignore @UiField FlowPanel signature;
|
51
|
+
|
52
|
+
<% end -%>
|
53
|
+
<% unless options[:singleton] -%>
|
54
|
+
@UiField public NumberLabel<Integer> id;
|
55
|
+
<% end -%>
|
56
|
+
<% if options[:timestamps] -%>
|
57
|
+
@UiField DateLabel createdAt;
|
58
|
+
@UiField DateLabel updatedAt;
|
59
|
+
<% end -%>
|
60
|
+
<% if options[:modified_by] -%>
|
61
|
+
@UiField UserLabel<User> modifiedBy;
|
62
|
+
<% end -%>
|
63
|
+
|
64
|
+
<% for attribute in attributes -%>
|
65
|
+
<% if attribute.type == :has_one -%>
|
66
|
+
// just display them
|
67
|
+
// TODO <%= attribute.name.camelcase %> <%= attribute.name %>;
|
68
|
+
<% elsif attribute.type == :has_many -%>
|
69
|
+
// just display them
|
70
|
+
// TODO public java.util.List<<%= attribute.name.camelcase %>> <%= attribute.name %>;
|
71
|
+
<% elsif attribute.type == :belongs_to -%>
|
72
|
+
@UiField IdentifyableListBox<<%= attribute.name.classify %>> <%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>;
|
73
|
+
<% else -%>
|
74
|
+
@UiField <%= type_widget_map[attribute.type][2..-1] %> <%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>;
|
75
|
+
<% end -%>
|
76
|
+
|
77
|
+
<% end -%>
|
78
|
+
public <%= class_name %>Editor() {
|
79
|
+
initWidget(BINDER.createAndBindUi(this));
|
80
|
+
}
|
81
|
+
|
82
|
+
<% for attribute in attributes -%>
|
83
|
+
<% if attribute.type == :belongs_to -%>
|
84
|
+
<% clazz = attribute.name.classify -%>
|
85
|
+
public void reset<%= clazz.to_s.pluralize %>(List<<%= clazz %>> models){
|
86
|
+
if(models == null){
|
87
|
+
<%= clazz %> model = new <%= clazz %>() {
|
88
|
+
public String toDisplay() { return "loading..."; }
|
89
|
+
};
|
90
|
+
<%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>.setAcceptableValues(Arrays.asList(model));
|
91
|
+
}
|
92
|
+
else{
|
93
|
+
<%= clazz %> model = new <%= clazz %>() {
|
94
|
+
public String toDisplay() { return "please select..."; }
|
95
|
+
};
|
96
|
+
List<<%= clazz %>> list = new ArrayList<<%= clazz %>>();
|
97
|
+
list.add(model);
|
98
|
+
list.addAll(models);
|
99
|
+
<%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>.setAcceptableValues(list);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
<% end -%>
|
104
|
+
<% end -%>
|
105
|
+
public void setEnabled(boolean enabled) {
|
106
|
+
<% if !options[:singleton] -%>
|
107
|
+
this.signature.setVisible(id.getValue() != null && id.getValue() > 0);
|
108
|
+
<% elsif options[:timestamps] -%>
|
109
|
+
this.signature.setVisible(createdAt.getValue() != null);
|
110
|
+
<% elsif options[:modified_by] -%>
|
111
|
+
this.signature.setVisible(modifiedBy.getValue() != null);
|
112
|
+
<% end -%>
|
113
|
+
<% for attribute in attributes -%>
|
114
|
+
<% if attribute.type == :has_one -%>
|
115
|
+
// TODO <%= attribute.name.camelcase %> <%= attribute.name %>;
|
116
|
+
<% elsif attribute.type == :has_many -%>
|
117
|
+
// TODO public java.util.List<<%= attribute.name.camelcase %>> <%= attribute.name %>;
|
118
|
+
<% else -%>
|
119
|
+
this.<%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>.setEnabled(enabled);
|
120
|
+
<% end -%>
|
121
|
+
<% end -%>
|
122
|
+
}
|
123
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
package <%= editors_package %>;
|
2
|
+
|
3
|
+
import <%= models_package %>.<%= class_name %>;
|
4
|
+
|
5
|
+
import com.google.gwt.core.client.GWT;
|
6
|
+
import com.google.gwt.editor.client.Editor;
|
7
|
+
import com.google.gwt.uibinder.client.UiBinder;
|
8
|
+
import com.google.gwt.uibinder.client.UiField;
|
9
|
+
import com.google.gwt.user.client.ui.Composite;
|
10
|
+
<% if options[:timestamps] -%>
|
11
|
+
import com.google.gwt.user.client.ui.DateLabel;
|
12
|
+
<% end -%>
|
13
|
+
<% if !options[:singleton] || options[:timestamps] || options[:modified_by] -%>
|
14
|
+
import com.google.gwt.user.client.ui.FlowPanel;
|
15
|
+
<% end -%>
|
16
|
+
<% unless options[:singleton] -%>
|
17
|
+
import com.google.gwt.user.client.ui.NumberLabel;
|
18
|
+
<% end -%>
|
19
|
+
import com.google.gwt.user.client.ui.*;
|
20
|
+
import com.google.gwt.user.client.ui.Widget;
|
21
|
+
import com.google.gwt.user.datepicker.client.DateBox;
|
22
|
+
|
23
|
+
import de.mkristian.gwt.rails.editors.DoubleBox;
|
24
|
+
import de.mkristian.gwt.rails.editors.IntegerBox;
|
25
|
+
import de.mkristian.gwt.rails.editors.LongBox;
|
26
|
+
|
27
|
+
public class <%= class_name %>Editor extends Composite implements Editor<<%= class_name %>>{
|
28
|
+
|
29
|
+
interface Binder extends UiBinder<Widget, <%= class_name %>Editor> {}
|
30
|
+
|
31
|
+
private static final Binder BINDER = GWT.create(Binder.class);
|
32
|
+
|
33
|
+
<% if !options[:singleton] || options[:timestamps] || options[:modified_by] -%>
|
34
|
+
@Ignore @UiField FlowPanel signature;
|
35
|
+
|
36
|
+
<% end -%>
|
37
|
+
<% unless options[:singleton] -%>
|
38
|
+
@UiField public NumberLabel<Integer> id;
|
39
|
+
<% end -%>
|
40
|
+
<% if options[:timestamps] -%>
|
41
|
+
@UiField DateLabel createdAt;
|
42
|
+
@UiField DateLabel updatedAt;
|
43
|
+
<% end -%>
|
44
|
+
<% if options[:modified_by] -%>
|
45
|
+
@UiField options[:modified_by].classify modifiedBy;
|
46
|
+
<% end -%>
|
47
|
+
|
48
|
+
<% for attribute in attributes -%>
|
49
|
+
<% if attribute.type == :has_one -%>
|
50
|
+
// TODO <%= attribute.name.camelcase %> <%= attribute.name %>;
|
51
|
+
<% elsif attribute.type == :has_many -%>
|
52
|
+
// TODO public java.util.List<<%= attribute.name.camelcase %>> <%= attribute.name %>;
|
53
|
+
<% elsif attribute.type == :belongs_to -%>
|
54
|
+
// TODO
|
55
|
+
<% else -%>
|
56
|
+
@UiField <%= type_widget_map[attribute.type][2..-1] %> <%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>;
|
57
|
+
<% end -%>
|
58
|
+
|
59
|
+
<% end -%>
|
60
|
+
public <%= class_name %>Editor() {
|
61
|
+
initWidget(BINDER.createAndBindUi(this));
|
62
|
+
}
|
63
|
+
|
64
|
+
public void setEnabled(boolean enabled) {
|
65
|
+
<% if !options[:singleton] -%>
|
66
|
+
this.signature.setVisible(id.getValue() != null && id.getValue() > 0);
|
67
|
+
<% elsif options[:timestamps] -%>
|
68
|
+
this.signature.setVisible(createdAt.getValue() != null);
|
69
|
+
<% elsif options[:modified_by] -%>
|
70
|
+
this.signature.setVisible(modifiedBy.getValue() != null);
|
71
|
+
<% end -%>
|
72
|
+
<% for attribute in attributes -%>
|
73
|
+
<% if attribute.type == :has_one -%>
|
74
|
+
// TODO <%= attribute.name.camelcase %> <%= attribute.name %>;
|
75
|
+
<% elsif attribute.type == :has_many -%>
|
76
|
+
// TODO public java.util.List<<%= attribute.name.camelcase %>> <%= attribute.name %>;
|
77
|
+
<% elsif attribute.type == :belongs_to -%>
|
78
|
+
// TODO
|
79
|
+
<% else -%>
|
80
|
+
this.<%= attribute.name.camelcase.sub(/^(.)/){ $1.downcase } %>.setEnabled(enabled);
|
81
|
+
<% end -%>
|
82
|
+
<% end -%>
|
83
|
+
}
|
84
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
2
|
+
<ui:UiBinder
|
3
|
+
xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
4
|
+
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
5
|
+
xmlns:d="urn:import:com.google.gwt.user.datepicker.client"
|
6
|
+
xmlns:r="urn:import:de.mkristian.gwt.rails.editors">
|
7
|
+
|
8
|
+
<g:FlowPanel>
|
9
|
+
|
10
|
+
<g:FlowPanel ui:field="signature" styleName="gwt-rails-model-signature">
|
11
|
+
<% unless options[:singleton] -%>
|
12
|
+
<g:Label>id: </g:Label>
|
13
|
+
<g:NumberLabel ui:field="id" />
|
14
|
+
<% end -%>
|
15
|
+
<% if options[:timestamps] -%>
|
16
|
+
<g:Label>created at: </g:Label>
|
17
|
+
<g:DateLabel ui:field="createdAt" predefinedFormat="DATE_TIME_MEDIUM"/>
|
18
|
+
<g:Label>updated at: </g:Label>
|
19
|
+
<g:DateLabel ui:field="updatedAt" predefinedFormat="DATE_TIME_MEDIUM" />
|
20
|
+
<% end -%>
|
21
|
+
<% if options[:modified_by] -%>
|
22
|
+
<g:Label>modified by: </g:Label>
|
23
|
+
<r:UserLabel ui:field="modifiedBy" />
|
24
|
+
<% end -%>
|
25
|
+
</g:FlowPanel>
|
26
|
+
|
27
|
+
<g:FlowPanel styleName="gwt-rails-model-fields">
|
28
|
+
<% for attribute in attributes -%>
|
29
|
+
<% if attribute.type != :has_one && attribute.type != :has_many -%>
|
30
|
+
<% name = attribute.name.camelcase.sub(/^(.)/){ $1.downcase } -%>
|
31
|
+
<g:HTMLPanel>
|
32
|
+
<label name="<%= name %>"><%= name.underscore.humanize %></label>
|
33
|
+
<<%= type_widget_map[attribute.type] || 'r:IdentifyableListBox' %> ui:field="<%= name %>"/>
|
34
|
+
</g:HTMLPanel>
|
35
|
+
<% end -%>
|
36
|
+
<% end -%>
|
37
|
+
</g:FlowPanel>
|
38
|
+
|
39
|
+
</g:FlowPanel>
|
40
|
+
|
41
|
+
</ui:UiBinder>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
2
|
+
<ui:UiBinder
|
3
|
+
xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
4
|
+
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
5
|
+
xmlns:d="urn:import:com.google.gwt.user.datepicker.client"
|
6
|
+
xmlns:r="urn:import:de.mkristian.gwt.rails.editors">
|
7
|
+
|
8
|
+
<g:FlowPanel>
|
9
|
+
|
10
|
+
<g:FlowPanel ui:field="signature" styleName="gwt-rails-model-signature">
|
11
|
+
<% unless options[:singleton] -%>
|
12
|
+
<g:Label>id: </g:Label>
|
13
|
+
<g:NumberLabel ui:field="id" />
|
14
|
+
<% end -%>
|
15
|
+
<% if options[:timestamps] -%>
|
16
|
+
<g:Label>created at: </g:Label>
|
17
|
+
<g:DateLabel ui:field="createdAt" predefinedFormat="DATE_TIME_MEDIUM"/>
|
18
|
+
<g:Label>updated at: </g:Label>
|
19
|
+
<g:DateLabel ui:field="updatedAt" predefinedFormat="DATE_TIME_MEDIUM" />
|
20
|
+
<% end -%>
|
21
|
+
</g:FlowPanel>
|
22
|
+
|
23
|
+
<g:FlowPanel styleName="gwt-rails-model-fields">
|
24
|
+
<% for attribute in attributes -%>
|
25
|
+
<% if attribute.type != :has_one && attribute.type != :has_many -%>
|
26
|
+
<% name = attribute.name.camelcase.sub(/^(.)/){ $1.downcase } -%>
|
27
|
+
<g:HTMLPanel>
|
28
|
+
<label name="<%= name %>"><%= name.underscore.humanize %></label>
|
29
|
+
<<%= type_widget_map[attribute.type] %> ui:field="<%= name %>"/>
|
30
|
+
</g:HTMLPanel>
|
31
|
+
<% end -%>
|
32
|
+
<% end -%>
|
33
|
+
</g:FlowPanel>
|
34
|
+
|
35
|
+
</g:FlowPanel>
|
36
|
+
|
37
|
+
</ui:UiBinder>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
package <%= events_package %>;
|
2
|
+
<% unless options[:singleton] -%>
|
3
|
+
|
4
|
+
import java.util.List;
|
5
|
+
<% end -%>
|
6
|
+
|
7
|
+
import <%= models_package %>.<%= class_name %>;
|
8
|
+
|
9
|
+
import <%= gwt_rails_package %>.events.ModelEvent;
|
10
|
+
import <%= gwt_rails_package %>.events.ModelEventHandler;
|
11
|
+
|
12
|
+
public class <%= class_name %>Event extends ModelEvent<<%= class_name %>> {
|
13
|
+
|
14
|
+
public static final Type<ModelEventHandler<<%= class_name %>>> TYPE = new Type<ModelEventHandler<<%= class_name %>>>();
|
15
|
+
|
16
|
+
public <%= class_name %>Event(<%= class_name %> model, ModelEvent.Action action) {
|
17
|
+
super(model, action);
|
18
|
+
}
|
19
|
+
<% unless options[:singleton] -%>
|
20
|
+
|
21
|
+
public <%= class_name %>Event(List<<%= class_name %>> models, ModelEvent.Action action) {
|
22
|
+
super(models, action);
|
23
|
+
}
|
24
|
+
<% end -%>
|
25
|
+
|
26
|
+
@Override
|
27
|
+
public Type<ModelEventHandler<<%= class_name %>>> getAssociatedType() {
|
28
|
+
return TYPE;
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
package <%= events_package %>;
|
2
|
+
<% unless options[:singleton] -%>
|
3
|
+
|
4
|
+
import java.util.List;
|
5
|
+
<% end -%>
|
6
|
+
|
7
|
+
import <%= models_package %>.<%= class_name %>;
|
8
|
+
|
9
|
+
import <%= gwt_rails_package %>.events.ModelEvent;
|
10
|
+
import <%= gwt_rails_package %>.events.ModelEventHandler;
|
11
|
+
|
12
|
+
public class <%= class_name %>Event extends ModelEvent<<%= class_name %>> {
|
13
|
+
|
14
|
+
public static final Type<ModelEventHandler<<%= class_name %>>> TYPE = new Type<ModelEventHandler<<%= class_name %>>>();
|
15
|
+
|
16
|
+
public <%= class_name %>Event(<%= class_name %> model, ModelEvent.Action action) {
|
17
|
+
super(model, action);
|
18
|
+
}
|
19
|
+
<% unless options[:singleton] -%>
|
20
|
+
|
21
|
+
public <%= class_name %>Event(List<<%= class_name %>> models, ModelEvent.Action action) {
|
22
|
+
super(models, action);
|
23
|
+
}
|
24
|
+
<% end -%>
|
25
|
+
|
26
|
+
@Override
|
27
|
+
public Type<ModelEventHandler<<%= class_name %>>> getAssociatedType() {
|
28
|
+
return TYPE;
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|