Commit 405ecbf7 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Move Event.form.field.Property to plugin_dbui (0.9.8).

parent 0c660788
......@@ -47,7 +47,6 @@ Ext.onReady(function(){
Ext.direct.Manager.addProvider(Dbui.REMOTE_API);
// Register dedicated fields
Dbui.registerExtraTypesForField(["xpropertyfield"]);
Dbui.registerFieldsToJSON(["xsummaryfield"]);
Dbui.registerFieldsToJSON(["xgraphfield"]);
......
......@@ -10,7 +10,7 @@
*/
Ext.define("Event.form.field.Graph", {
extend: "Event.form.field.Property",
extend: "Dbui.form.field.Property",
alias: "widget.xgraphfield",
uses: "Ext.form.field.ComboBox",
......
/**
* Form field encapsulating an {@link Ext.grid.property.Property}.
*
* It is a basic widget which can be used to interact a json field
* containing a dictionary.
*
* It is possible to configure the editor assoiated to each (key, pair) value
* via the configuration parameter sourceConfig.
*
* @since 0.7.0
*
*/
Ext.define("Event.form.field.Property", {
extend: "Ext.form.FieldContainer",
mixins: {
field: "Ext.form.field.Field"
},
alias: "widget.xpropertyfield",
uses: "Ext.grid.property.Grid",
/**
* @cfg {Object} sourceConfig
* This option allows various configurations to be set for each field
* in the property grid. None of these configurations are required.
*
* For more details {@link Ext.grid.property.Property#sourceConfig}
*
*/
/**
* @event change
* Fires when a value has changed.
* @param {Dbui.form.field.Dict} this This field
*/
// Predefined configuration options
layout: "anchor",
defaults: {
anchor: "100%"
},
// private short cuts
grid: null,
// jshint strict: false
// private method requests by the component model of ExtJS
initComponent: function () {
var me = this,
source = me.value || {};
// configure the property grid embedded in the container
me.items = [{
xtype: "propertygrid",
hideHeaders: true,
source: source,
sourceConfig: me.sourceConfig
}];
// instantiate the base class
me.callParent(arguments);
// short cut to the grid
me.grid = me.child("propertygrid");
// event change
me.grid.on("propertychange", me.onPropertyChange, me);
// initialize the mixin Field
me.initField();
},
// private method requests by the component model of ExtJS
beforeDestroy: function () {
var me = this;
me.grid.un("propertychange", me.onPropertyChange, me);
Ext.destroyMembers(me, "grid");
me.callParent(arguments);
},
// jshint strict: true
/**
* Return the value of me field.
*
* @return {Object} the content of the dictionary.
*
*/
getValue: function () {
"use strict";
var me = this,
source = me.grid.getSource();
return source;
},
/**
* Grid property has change
* Trigger the change event
*/
onPropertyChange: function () {
"use strict";
var me = this;
me.fireEvent("change", me);
},
/**
* Set the value for the dictionary.
* Load the default dictionary when the value is null.
*
* @param {Object} value
* A key, value object which is loaded in the configuration grid.
*
*/
setValue: function (value) {
"use strict";
var me = this,
source = value || me.originalValue;
me.grid.setSource(source);
// the standard way to set the value for a field
// extract from Ext.form.field.Base
return me.mixins.field.setValue.call(me, source);
}
});
\ No newline at end of file
......@@ -10,7 +10,7 @@
*/
Ext.define("Event.form.field.Summary", {
extend: "Event.form.field.Property",
extend: "Dbui.form.field.Property",
alias: "widget.xsummaryfield",
uses: "Ext.form.field.Tag",
......@@ -57,7 +57,6 @@ Ext.define("Event.form.field.Summary", {
displayName: me.textLabels,
type: "string"
}
};
// instantiate the base class
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment