resty-generators 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/features/generators.feature +67 -0
  2. data/features/step_definitions/simple_steps.rb +1 -0
  3. data/lib/generators/resty/base.rb +15 -3
  4. data/lib/generators/resty/model/model_generator.rb +33 -3
  5. data/lib/generators/resty/scaffold/scaffold_generator.rb +30 -15
  6. data/lib/generators/resty/setup/setup_generator.rb +2 -2
  7. data/lib/generators/resty/setup/setup_generator.rb~ +31 -0
  8. data/lib/generators/resty/setup/templates/ActivityFactory.java~ +7 -0
  9. data/lib/generators/resty/setup/templates/ActivityPlace.java +5 -0
  10. data/lib/generators/resty/setup/templates/ActivityPlace.java~ +8 -0
  11. data/lib/generators/resty/setup/templates/BreadCrumbsPanel.java +3 -2
  12. data/lib/generators/resty/setup/templates/BreadCrumbsPanel.java~ +79 -0
  13. data/lib/generators/resty/setup/templates/GinModule.java~ +7 -0
  14. data/lib/generators/resty/setup/templates/LoginActivity.java~ +58 -0
  15. data/lib/generators/resty/setup/templates/LoginPlace.java~ +20 -0
  16. data/lib/generators/resty/setup/templates/LoginViewImpl.java~ +21 -0
  17. data/lib/generators/resty/setup/templates/Mavenfile +5 -5
  18. data/lib/generators/resty/setup/templates/Mavenfile~ +15 -0
  19. data/lib/generators/resty/setup/templates/MenuPanel.java~ +12 -0
  20. data/lib/generators/resty/setup/templates/PLaceHistoryMapper.java~ +7 -0
  21. data/lib/generators/resty/setup/templates/RestfulPlace.java~ +22 -0
  22. data/lib/generators/resty/setup/templates/SessionActivityPlaceActivityMapper.java~ +71 -0
  23. data/lib/generators/resty/setup/templates/SessionRestService.java~ +23 -0
  24. data/lib/generators/resty/setup/templates/User.java +34 -4
  25. data/lib/generators/resty/setup/templates/authentication.rb +2 -1
  26. data/lib/generators/resty/setup/templates/authentication.rb~ +4 -0
  27. data/lib/generators/resty/setup/templates/empty.css~ +1 -0
  28. data/lib/generators/resty/setup/templates/gwt.css +45 -0
  29. data/lib/generators/resty/setup/templates/initializer.rb~ +1 -0
  30. data/lib/generators/resty/setup/templates/monkey_patch.rb~ +27 -0
  31. data/lib/generators/resty/setup/templates/page.html~ +0 -0
  32. data/lib/generators/resty/setup/templates/session.rb +18 -36
  33. data/lib/generators/resty/setup/templates/session.rb~ +45 -0
  34. data/lib/generators/resty/setup/templates/sessions_controller.rb +27 -8
  35. data/lib/generators/resty/setup/templates/sessions_controller.rb~ +27 -0
  36. data/lib/generators/resty/setup/templates/user.rb +38 -6
  37. data/lib/generators/resty/setup/templates/user.rb~ +27 -0
  38. data/lib/generators/resty/templates/Activity.java +78 -39
  39. data/lib/generators/resty/templates/Activity.java~ +67 -0
  40. data/lib/generators/resty/templates/ActivityPlace.java~ +11 -0
  41. data/lib/generators/resty/templates/ColumnDefinitionsImpl.java~ +24 -0
  42. data/lib/generators/resty/templates/ColumnDefintionsImpl.java~ +34 -0
  43. data/lib/generators/resty/templates/Controller.java~ +49 -0
  44. data/lib/generators/resty/templates/Editor.java +123 -0
  45. data/lib/generators/resty/templates/Editor.java~ +84 -0
  46. data/lib/generators/resty/templates/Editor.ui.xml +41 -0
  47. data/lib/generators/resty/templates/Editor.ui.xml~ +37 -0
  48. data/lib/generators/resty/templates/Event.java +30 -0
  49. data/lib/generators/resty/templates/Event.java~ +31 -0
  50. data/lib/generators/resty/templates/EventHandler.java +8 -0
  51. data/lib/generators/resty/templates/EventHandler.java~ +30 -0
  52. data/lib/generators/resty/templates/Model.java +144 -15
  53. data/lib/generators/resty/templates/Model.java~ +23 -0
  54. data/lib/generators/resty/templates/Place.java +1 -1
  55. data/lib/generators/resty/templates/Place.java~ +21 -0
  56. data/lib/generators/resty/templates/PlaceTokenizer.java +1 -1
  57. data/lib/generators/resty/templates/PlaceTokenizer.java~ +19 -0
  58. data/lib/generators/resty/templates/RestService.java~ +51 -0
  59. data/lib/generators/resty/templates/View.java +15 -4
  60. data/lib/generators/resty/templates/View.java~ +23 -0
  61. data/lib/generators/resty/templates/View.ui.xml +22 -38
  62. data/lib/generators/resty/templates/View.ui.xml~ +17 -0
  63. data/lib/generators/resty/templates/ViewImpl.java +88 -103
  64. data/lib/generators/resty/templates/ViewImpl.java~ +153 -0
  65. data/lib/resty/abstract_session.rb~ +59 -0
  66. data/lib/resty/child_path.rb~ +18 -0
  67. data/lib/resty/session.rb~ +6 -0
  68. metadata +56 -11
@@ -0,0 +1,8 @@
1
+ package <%= events_package %>;
2
+
3
+ import <%= models_package %>.<%= class_name %>;
4
+
5
+ import <%= gwt_rails_package %>.events.ModelEventHandler;
6
+
7
+ public interface <%= class_name %>EventHandler extends ModelEventHandler<<%= class_name %>> {
8
+ }
@@ -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
+ }
@@ -4,39 +4,168 @@ package <%= models_package %>;
4
4
  import java.util.Date;
5
5
  <% end -%>
6
6
 
7
+ <% if !options[:singleton] || options[:timestamps] || options[:modified_by] -%>
8
+ import org.codehaus.jackson.annotate.JsonCreator;
9
+ import org.codehaus.jackson.annotate.JsonProperty;
10
+ <% end -%>
7
11
  import org.fusesource.restygwt.client.Json;
8
12
  import org.fusesource.restygwt.client.Json.Style;
9
13
 
14
+ import de.mkristian.gwt.rails.models.HasToDisplay;
15
+ <% unless options[:singleton] -%>
16
+ import de.mkristian.gwt.rails.models.Identifyable;
17
+ <% end -%>
18
+
10
19
  @Json(style = Style.RAILS<% if class_name.downcase == class_name.underscore -%>)<% else -%>, name = "<%= class_name.underscore %>")<% end %>
11
- public class <%= class_name %> {
20
+ public class <%= class_name %> implements HasToDisplay<% unless options[:singleton] %>, Identifyable<% end -%> {
12
21
 
13
22
  <% unless options[:singleton] -%>
14
- public int id;
23
+ public final int id;
24
+ <% end -%>
25
+ <% if options[:timestamps] -%>
26
+
27
+ @Json(name = "created_at")
28
+ private final Date createdAt;
29
+
30
+ @Json(name = "updated_at")
31
+ private final Date updatedAt;
32
+ <% end -%>
33
+ <% if options[:modified_by] -%>
34
+
35
+ @Json(name = "modified_by")
36
+ private final User modifiedBy;
15
37
  <% end -%>
16
38
  <% for attribute in attributes -%>
17
39
  <% name = attribute.name.camelcase.sub(/^(.)/) {$1.downcase} -%>
18
40
 
41
+ <% if attribute.type == :belongs_to -%>
42
+ @Json(name = "<%= name.underscore %>_id")
43
+ private int <%= name %>Id;
44
+ <% end -%>
19
45
  <% if name != name.underscore -%> @Json(name = "<%= name.underscore %>")
20
46
  <% end -%>
21
- <% if attribute.type == :has_one -%>
22
- public <%= attribute.name.camelcase %> <%= name %>;
47
+ <% if attribute.type == :has_one || attribute.type == :belongs_to -%>
48
+ private <%= attribute.name.classify %> <%= name %>;
23
49
  <% elsif attribute.type == :has_many -%>
24
- public java.util.List<<%= attribute.name.classify %>> <%= name %>;
50
+ private java.util.List<<%= attribute.name.classify %>> <%= name %>;
25
51
  <% else -%>
26
- public <%= type_map[attribute.type] || attribute.type.to_s.classify %> <%= name %>;
52
+ private <%= type_map[attribute.type] || attribute.type.to_s.classify %> <%= name %>;
27
53
  <% end -%>
28
54
  <% end -%>
29
- <% if options[:timestamps] %>
55
+ <% if !options[:singleton] || options[:timestamps] || options[:modified_by] -%>
30
56
 
31
- @Json(name = "created_at")
32
- public Date createdAt;
57
+ public <%= class_name %>(){
58
+ this(<% unless options[:singleton] -%>0<% if options[:timestamps] -%>, null, null<% if options[:modified_by] -%>, null<% end -%><% end -%><% else -%><% if options[:timestamps] -%>null, null<% if options[:modified_by] -%>, null<% end -%><% else -%><% if options[:modified_by] -%>null<% end -%><% end -%><% end -%><% for attribute in attributes -%><% if attribute.type == :belongs_to -%>, 0<% end -%><% end -%>);
59
+ }
60
+
61
+ @JsonCreator
62
+ public <%= class_name %>(<% unless options[:singleton] -%>@JsonProperty("id") int id<% if options[:timestamps] -%>,
63
+ @JsonProperty("createdAt") Date createdAt,
64
+ @JsonProperty("updatedAt") Date updatedAt<% if options[:modified_by] -%>,
65
+ @JsonProperty("modifiedBy") User modifiedBy<% end -%><% end -%><% else -%><% if options[:timestamps] -%>@JsonProperty("createdAt") Date createdAt,
66
+ @JsonProperty("updatedAt") Date updatedAt<% if options[:modified_by] -%>,
67
+ @JsonProperty("modifiedBy") User modifiedBy<% end -%><% else -%><% if options[:modified_by] -%>@JsonProperty("modifiedBy") Date modifiedBy<% end -%><% end -%><% end -%><% for attribute in attributes -%><% if attribute.type == :belongs_to -%>,
68
+ <% name = attribute.name.camelcase.sub(/^(.)/) {$1.downcase} -%>
69
+ @JsonProperty("<%= name %>Id") int <%= name %>Id<% end -%><% end -%>){
70
+ <% unless options[:singleton] -%>
71
+ this.id = id;
72
+ <% end -%>
73
+ <% if options[:timestamps] -%>
74
+ this.createdAt = createdAt;
75
+ this.updatedAt = updatedAt;
76
+ <% end -%>
77
+ <% if options[:modified_by] -%>
78
+ this.modifiedBy = modifiedBy;
79
+ <% end -%>
80
+ <% for attribute in attributes -%>
81
+ <% if attribute.type == :belongs_to -%>
82
+ <% name = attribute.name.camelcase.sub(/^(.)/) {$1.downcase} -%>
83
+ this.<%= name %>Id = <%= name %>Id;
84
+ <% end -%>
85
+ <% end -%>
86
+ }
87
+ <% end -%>
88
+ <% unless options[:singleton] -%>
33
89
 
34
- @Json(name = "updated_at")
35
- public Date updatedAt;
90
+ public int getId(){
91
+ return id;
92
+ }
36
93
  <% end -%>
37
- <% if options[:modified_by] %>
94
+ <% if options[:timestamps] -%>
38
95
 
39
- @Json(name = "modified_by")
40
- public options[:modified_by].classify.underscore modifiedBy
96
+ public Date getCreatedAt(){
97
+ return createdAt;
98
+ }
99
+
100
+ public Date getUpdatedAt(){
101
+ return updatedAt;
102
+ }
103
+ <% end -%>
104
+ <% if options[:modified_by] -%>
105
+
106
+ public User getModifiedBy(){
107
+ return modifiedBy;
108
+ }
109
+ <% end -%>
110
+ <% for attribute in attributes -%>
111
+ <% name = attribute.name.camelcase.sub(/^(.)/) {$1.downcase} -%>
112
+
113
+ <% if attribute.type == :has_one || attribute.type == :belongs_to -%>
114
+ public <%= attribute.name.classify %> get<%= attribute.name.camelcase %>(){
115
+ return <%= name %>;
116
+ }
117
+
118
+ public void set<%= attribute.name.camelcase %>(<%= attribute.name.classify %> value){
119
+ <%= name %> = value;
120
+ <% if attribute.type == :belongs_to -%>
121
+ <%= name %>Id = value == null ? 0 : value.getId();
122
+ <% end -%>
123
+ }
124
+ <% if attribute.type == :belongs_to -%>
125
+
126
+ public int get<%= attribute.name.camelcase %>Id(){
127
+ return <%= name %>Id;
128
+ }
129
+ <% end -%>
130
+ <% elsif attribute.type == :has_many -%>
131
+ //TODO private java.util.List<<%= attribute.name.classify %>> <%= name %>;
132
+ <% else -%>
133
+ public <%= type_map[attribute.type] || attribute.type.to_s.classify %> get<%= name.camelcase %>(){
134
+ return <%= name %>;
135
+ }
136
+
137
+ public void set<%= attribute.name.camelcase %>(<%= type_map[attribute.type] || attribute.type.to_s.classify %> value){
138
+ <%= name %> = value;
139
+ }
140
+ <% end -%>
141
+ <% end -%>
142
+ <% if attributes.detect {|a| a.type == :belongs_to } -%>
143
+
144
+ public <%= class_name %> minimalClone() {
145
+ <%= class_name %> clone = new <%= class_name %>(<% unless options[:singleton] -%>id, <% end -%><% if options[:timestamps] -%>null, updatedAt, <% end -%><% if options[:modified_by] -%>null, <% end -%><%= attributes.select {|a| a.type == :belongs_to }.collect do |attribute|
146
+ name = attribute.name.camelcase.sub(/^(.)/) {$1.downcase}
147
+ "#{name}Id"
148
+ end.join ',' -%>);
149
+ <% attributes.select {|attr| ![:belongs_to, :has_one, :has_many].include?(attr.type) }.each do |attribute| -%>
150
+ <% name = attribute.name.camelcase.sub(/^(.)/) {$1.downcase} -%>
151
+ clone.set<%= attribute.name.camelcase %>(this.<%= name %>);
41
152
  <% end -%>
42
- }
153
+ return clone;
154
+ }
155
+ <% end -%>
156
+ <% unless options[:singleton] -%>
157
+
158
+ public int hashCode(){
159
+ return id;
160
+ }
161
+
162
+ public boolean equals(Object other){
163
+ return (other instanceof <%= class_name %>) &&
164
+ ((<%= class_name %>)other).id == id;
165
+ }
166
+ <% end -%>
167
+
168
+ public String toDisplay() {
169
+ return <%= attributes.first.name.camelcase.sub(/^(.)/) {$1.downcase} %><% unless attributes.first.type == :string %> + ""<% end -%>;
170
+ }
171
+ }
@@ -0,0 +1,23 @@
1
+ package <%= models_base_package %>;
2
+
3
+ public class <%= class_name %> {
4
+
5
+ <% for attribute in attributes -%>
6
+ <% if attribute.type == :has_one -%>
7
+ <%= attribute.name.classify %> <%= attribute.name %>;
8
+ <% elsif attribute.type == :has_many -%>
9
+ java.util.List<<%= attribute.name.classify %>> <%= attribute.name %>;
10
+ <% else -%>
11
+ <%= type_map[attribute.type] || attribute.type.to_s.classify %> <%= attribute.name %>;
12
+ <% end -%>
13
+
14
+ <% end -%>
15
+ <% if options[:timestamps] %>
16
+ //TODO timestamps
17
+
18
+ <% end -%>
19
+ <% if options[:timestamps] %>
20
+ //TODO modified_by
21
+
22
+ <% end -%>
23
+ }
@@ -19,7 +19,7 @@ public class <%= class_name %>Place extends ActivityPlace<<%= class_name %>> {
19
19
  }
20
20
 
21
21
  public <%= class_name %>Place(<%= class_name %> model, RestfulAction restfulAction) {
22
- super(model, restfulAction, "<%= table_name %>");
22
+ super(<% unless options[:singleton] -%>model.getId(), <% end -%>model, restfulAction, "<%= table_name %>");
23
23
  }
24
24
 
25
25
  public <%= class_name %>Place(int id, RestfulAction restfulAction) {
@@ -0,0 +1,21 @@
1
+ package <%= places_package %>;
2
+
3
+ import <%= gwt_rails_package %>.RestfulAction;
4
+
5
+ import <%= managed_package %>.RestfulPlace;
6
+ import <%= managed_package %>.ActivityFactory;
7
+
8
+ import <%= models_package %>.<%= class_name %>;
9
+
10
+ import com.google.gwt.activity.shared.Activity;
11
+
12
+ public class <%= class_name %>Place extends RestfulPlace<<%= class_name %>>{
13
+
14
+ public Activity create(ActivityFactory factory){
15
+ return factory.create(this);
16
+ }
17
+
18
+ public <%= class_name %>Place(RestfulAction restfulAction) {
19
+ super(restfulAction);
20
+ }
21
+ }
@@ -13,7 +13,7 @@ public class <%= class_name %>PlaceTokenizer extends RestfulPlaceTokenizer<<%= c
13
13
  return new <%= class_name %>Place(t.action);
14
14
  }
15
15
  else {
16
- return new <%= class_name %>Place(t.identifier, t.action);
16
+ return new <%= class_name %>Place(t.id, t.action);
17
17
  }
18
18
  <% end -%>
19
19
  }
@@ -0,0 +1,19 @@
1
+ package <%= places_package %>;
2
+
3
+ import <%= gwt_rails_package %>.RestfulActionEnum;
4
+
5
+ import com.google.gwt.place.shared.PlaceTokenizer;
6
+ import com.google.gwt.place.shared.Prefix;
7
+
8
+ @Prefix("<%= table_name %>")
9
+ public class <%= class_name %>PlaceTokenizer implements PlaceTokenizer<<%= class_name %>Place> {
10
+
11
+ public <%= class_name %>Place getPlace(String token) {
12
+ return new <%= class_name %>Place(RestfulActionEnum.toRestfulAction(token));
13
+ }
14
+
15
+ public String getToken(<%= class_name %>Place place) {
16
+ return place.action.token();
17
+ }
18
+
19
+ }
@@ -0,0 +1,51 @@
1
+ package <%= restservices_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_package %>.*;
13
+ <% end -%>
14
+
15
+ @Path("/<%= table_name %><%= options[:singleton] ? '.json' : '' %>")
16
+ //@Options(dispatcher = RestfulRetryingDispatcher.class)
17
+ public interface <%= controller_class_name %>RestService extends RestService {
18
+
19
+ <% actions.each do |action|
20
+ case action_map[action]
21
+ when :get_all -%>
22
+ @GET @Path("/<%= table_name %>.json")
23
+ //@Options(dispatcher = RetryingDispatcher.class)
24
+ void <%= action %>(MethodCallback<List<<%= class_name %>>> callback);
25
+
26
+ // @GET @Path("/<%= table_name %>.json")
27
+ // void <%= action %>(MethodCallback<List<<%= class_name %>>> callback, @QueryParam("limit") int limit, @QueryParam("offset") int offset);
28
+ //
29
+ <% when :get_single -%>
30
+ @GET<% unless options[:singleton] -%> @Path("/<%= table_name %>/{id}.json")<% end %>
31
+ void <%= action %>(<% unless options[:singleton] -%>@PathParam("id") int id, <% end -%>MethodCallback<<%= class_name %>> callback);
32
+
33
+ <% when :post -%>
34
+ @POST @Path("/<%= table_name %>.json")
35
+ void <%= action %>(<%= class_name %> value, MethodCallback<<%= class_name %>> callback);
36
+
37
+ <% when :put -%>
38
+ @PUT<% unless options[:singleton] -%> @Path("/<%= table_name %>/{id}.json")<% end %>
39
+ void <%= action %>(<% unless options[:singleton] -%>@PathParam("id") @Attribute("id") <% end -%><%= class_name %> value, MethodCallback<<%= class_name %>> callback);
40
+
41
+ <% when :delete -%>
42
+ @DELETE @Path("/<%= table_name %>/{id}.json")
43
+ void <%= action %>(@PathParam("id") @Attribute("id") <%= class_name %> value, MethodCallback<Void> callback);
44
+
45
+ <% else -%>
46
+ @GET @Path("/<%= table_name %>/<%= action %>.json")
47
+ void <%= action %>(MethodCallback<Void> callback);
48
+
49
+ <% end
50
+ end -%>
51
+ }
@@ -1,8 +1,13 @@
1
1
  package <%= views_package %>;
2
2
 
3
- <% unless options[:singleton] -%>
3
+ <% if !options[:singleton] || attributes.detect { |a| a.type == :belongs_to} -%>
4
4
  import java.util.List;
5
5
 
6
+ <% end -%>
7
+ <% for attribute in attributes -%>
8
+ <% if attribute.type == :belongs_to -%>
9
+ import <%= models_package %>.<%= attribute.name.classify %>;
10
+ <% end -%>
6
11
  <% end -%>
7
12
  import <%= models_package %>.<%= class_name %>;
8
13
 
@@ -27,7 +32,9 @@ public interface <%= class_name %>View extends IsWidget {
27
32
  }
28
33
  void setPresenter(Presenter presenter);
29
34
 
30
- void reset(<%= class_name %> model);
35
+ void edit(<%= class_name %> model);
36
+
37
+ <%= class_name %> flush();
31
38
  <% unless options[:singleton] -%>
32
39
 
33
40
  void reset(List<<%= class_name %>> models);
@@ -36,8 +43,6 @@ public interface <%= class_name %>View extends IsWidget {
36
43
  void reset(RestfulAction action);
37
44
 
38
45
  void setEnabled(boolean enabled);
39
-
40
- <%= class_name %> retrieve<%= class_name %>();
41
46
  <% unless options[:singleton] -%>
42
47
 
43
48
  void updateInList(<%= class_name %> model);
@@ -46,4 +51,10 @@ public interface <%= class_name %>View extends IsWidget {
46
51
 
47
52
  void addToList(<%= class_name %> model);
48
53
  <% end -%>
54
+ <% for attribute in attributes -%>
55
+ <% if attribute.type == :belongs_to -%>
56
+
57
+ void reset<%= attribute.name.classify.to_s.pluralize %>(List<<%= attribute.name.classify %>> list);
58
+ <% end -%>
59
+ <% end -%>
49
60
  }
@@ -0,0 +1,23 @@
1
+ package <%= views_package %>;
2
+
3
+ import java.util.List;
4
+
5
+ import <%= models_package %>.<%= class_name %>;
6
+
7
+ import com.google.gwt.place.shared.Place;
8
+ import com.google.gwt.user.client.ui.IsWidget;
9
+ import com.google.inject.ImplementedBy;
10
+
11
+ @ImplementedBy(<%= class_name %>ViewImpl.class)
12
+ public interface <%= class_name %>View extends IsWidget {
13
+ void setPresenter(Presenter presenter);
14
+
15
+ public interface Presenter {
16
+
17
+ void goTo(Place place);
18
+
19
+ void onItemClicked(<%= class_name %> model);
20
+ }
21
+ void reset(<%= class_name %> model);
22
+ void reset(List<<%= class_name %>> models);
23
+ }
@@ -1,48 +1,26 @@
1
1
  <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
2
2
  <ui:UiBinder
3
3
  xmlns:ui="urn:ui:com.google.gwt.uibinder"
4
- xmlns:g="urn:import:com.google.gwt.user.client.ui">
5
-
6
- <ui:style>
7
- .buttons {}
8
- .signature { float: left; }
9
- .signature * { display: inline; margin-right: 1em; font-size: 0.8em;}
10
- .fields { clear: both;}
11
- .field { }
12
- </ui:style>
13
-
14
- <g:FlowPanel styleName="display">
15
- <g:FlowPanel styleName="{style.buttons}">
4
+ xmlns:g="urn:import:com.google.gwt.user.client.ui"
5
+ xmlns:t="urn:import:<%= editors_package %>">
6
+
7
+ <g:FlowPanel styleName="gwt-rails-display">
8
+
9
+ <g:Label><%if options[:singleton] -%><%= class_name.underscore.singularize.humanize %><% else -%><%= class_name.underscore.pluralize.humanize %><% end -%></g:Label>
10
+
11
+ <g:FlowPanel styleName="gwt-rails-buttons">
16
12
  <% unless options[:singleton] -%>
17
13
  <g:Button ui:field="newButton">New</g:Button>
18
14
  <% end -%>
19
15
  <g:Button ui:field="editButton">Edit</g:Button>
16
+ <g:Button ui:field="showButton">Show</g:Button>
20
17
  </g:FlowPanel>
21
- <g:FlowPanel ui:field="form" styleName="form">
22
- <g:FlowPanel styleName="{style.signature}" ui:field="signature">
23
- <% unless options[:singleton] -%>
24
- <g:Label>id: </g:Label>
25
- <g:NumberLabel ui:field="id" />
26
- <% end -%>
27
- <% if options[:timestamps] %>
28
- <g:Label>created at: </g:Label>
29
- <g:DateLabel ui:field="createdAt" predefinedFormat="DATE_TIME_MEDIUM"/>
30
- <g:Label>updated at: </g:Label>
31
- <g:DateLabel ui:field="updatedAt" predefinedFormat="DATE_TIME_MEDIUM" />
32
- <% end -%>
33
- </g:FlowPanel>
34
- <g:FlowPanel styleName="{style.fields}">
35
- <% for attribute in attributes -%>
36
- <% if attribute.type != :has_one && attribute.type != :has_many -%>
37
- <% name = attribute.name.camelcase.sub(/^(.)/){ $1.downcase } -%>
38
- <g:FlowPanel styleName="{style.field}">
39
- <g:HTML><label name="<%= name %>"><%= name.underscore.humanize %></label></g:HTML>
40
- <g:TextBox ui:field="<%= name %>" name="<%= name %>"/>
41
- </g:FlowPanel>
42
- <% end -%>
43
- <% end -%>
44
- </g:FlowPanel>
45
- <g:FlowPanel styleName="{style.buttons}">
18
+
19
+ <g:FlowPanel ui:field="model" styleName="gwt-rails-model">
20
+
21
+ <t:<%= class_name %>Editor ui:field="editor" styleName="gwt-rails-model-editor" />
22
+
23
+ <g:FlowPanel styleName="gwt-rails-buttons">
46
24
  <% unless options[:singleton] -%>
47
25
  <g:Button ui:field="createButton">Create</g:Button>
48
26
  <% end -%>
@@ -51,9 +29,15 @@
51
29
  <g:Button ui:field="deleteButton">Delete</g:Button>
52
30
  <% end -%>
53
31
  </g:FlowPanel>
32
+
54
33
  </g:FlowPanel>
55
34
  <% unless options[:singleton] -%>
56
- <g:FlexTable ui:field="list" styleName="list"/>
35
+
36
+ <g:FlowPanel styleName="gwt-rails-model-list">
37
+ <g:FlexTable ui:field="list"/>
38
+ </g:FlowPanel>
57
39
  <% end -%>
40
+
58
41
  </g:FlowPanel>
42
+
59
43
  </ui:UiBinder>