summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-05-02 11:20:41 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-05-02 11:20:41 +0200
commitc841e16f2d2e4465940767d30b128bbb76a747a0 (patch)
treee091e91663d24656cee112858826dca51123f9ff /addons/web/static/src
parente9273066a954fb14223f452110897b15b324d235 (diff)
parent83934ec4a6a93f26227349869089d156447c6df4 (diff)
[merge] modifications to interfaces defined in form view to fit new standards related to interfaces
bzr revid: nicolas.vanhoren@openerp.com-20120502092041-e6yjsksd27ie2n39
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js72
-rw-r--r--addons/web/static/src/js/view_list_editable.js2
2 files changed, 37 insertions, 37 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 3c15e845f56..5b0b13f3567 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -6,8 +6,34 @@ var QWeb = instance.web.qweb;
/** @namespace */
instance.web.form = {};
+/**
+ * Interface implemented by the form view or any other object
+ * able to provide the features necessary for the fields to work.
+ *
+ * Properties:
+ * - display_invalid_fields : if true, all fields where is_valid() return true should
+ * be displayed as invalid.
+ * Events:
+ * - view_content_has_changed : when the values of the fields have changed. When
+ * this event is triggered all fields should reprocess their modifiers.
+ */
+instance.web.form.FieldManagerMixin = {
+ /**
+ * Must return the asked field as in fields_get.
+ */
+ get_field: function(field_name) {},
+ /**
+ * Called by the field when the translate button is clicked.
+ */
+ open_translate_dialog: function(field) {},
+ /**
+ * Returns true when the view is in create mode.
+ */
+ is_create_mode: function() {},
+};
+
instance.web.views.add('form', 'instance.web.FormView');
-instance.web.FormView = instance.web.View.extend({
+instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form.FieldManagerMixin, {
/**
* Indicates that this view is not searchable, and thus that no search
* view should be displayed (if there is one active).
@@ -863,23 +889,23 @@ instance.web.FormView = instance.web.View.extend({
is_create_mode: function() {
return !this.datarecord.id;
},
-});
+}));
/**
* Interface to be implemented by rendering engines for the form view.
*/
-instance.web.form.FormRenderingEngineInterface = {
+instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({
set_fields_view: function(fields_view) {},
set_fields_registry: function(fields_registry) {},
render_to: function($element) {},
-};
+});
/**
* Default rendering engine for the form view.
*
* It is necessary to set the view using set_view() before usage.
*/
-instance.web.form.FormRenderingEngine = instance.web.Class.extend({
+instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInterface.extend({
init: function(view) {
this.view = view;
},
@@ -1568,32 +1594,6 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({
});
/**
- * Interface implemented by the form view or any other object
- * able to provide the features necessary for the fields to work.
- *
- * Properties:
- * - display_invalid_fields : if true, all fields where is_valid() return true should
- * be displayed as invalid.
- * Events:
- * - view_content_has_changed : when the values of the fields have changed. When
- * this event is triggered all fields should reprocess their modifiers.
- */
-instance.web.form.FieldManagerInterface = {
- /**
- * Must return the asked field as in fields_get.
- */
- get_field: function(field_name) {},
- /**
- * Called by the field when the translate button is clicked.
- */
- open_translate_dialog: function(field) {},
- /**
- * Returns true when the view is in create mode.
- */
- is_create_mode: function() {},
-};
-
-/**
* Interface to be implemented by fields.
*
* Properties:
@@ -1604,10 +1604,10 @@ instance.web.form.FieldManagerInterface = {
* - changed_value: triggered to inform the view to check on_changes
*
*/
-instance.web.form.FieldInterface = {
+instance.web.form.FieldMixin = {
/**
* Constructor takes 2 arguments:
- * - field_manager: Implements FieldManagerInterface
+ * - field_manager: Implements FieldManagerMixin
* - node: the "<field>" node in json form
*/
init: function(field_manager, node) {},
@@ -1668,7 +1668,7 @@ instance.web.form.FieldInterface = {
};
/**
- * Abstract class for classes implementing FieldInterface.
+ * Abstract class for classes implementing FieldMixin.
*
* Properties:
* - effective_readonly: when it is true, the widget is displayed as readonly. Vary depending
@@ -1678,7 +1678,7 @@ instance.web.form.FieldInterface = {
* a 'changed_value' event that inform the view to trigger on_changes.
*
*/
-instance.web.form.AbstractField = instance.web.form.FormWidget.extend(/** @lends instance.web.form.AbstractField# */{
+instance.web.form.AbstractField = instance.web.form.FormWidget.extend(_.extend({}, instance.web.form.FieldMixin, {
/**
* @constructs instance.web.form.AbstractField
* @extends instance.web.form.FormWidget
@@ -1783,7 +1783,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(/** @lends
set_input_id: function(id) {
this.id_for_label = id;
},
-});
+}));
/**
* A mixin to apply on any field that has to completely re-render when its readonly state
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index 816143afa5d..ff76f333ea9 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -377,7 +377,7 @@ openerp.web.list_editable = function (instance) {
renderElement: function() {}
});
- instance.web.ListEditableRenderingEngine = instance.web.Class.extend({
+ instance.web.ListEditableRenderingEngine = instance.web.form.FormRenderingEngineInterface.extend({
init: function(view) {
this.view = view;
},