fiveapples 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/bin/fiveapples +7 -0
  3. data/lib/config5.ru +31 -0
  4. data/lib/fiveapples.db3 +0 -0
  5. data/lib/fiveapples.rb +46 -0
  6. data/lib/model.rb +58 -0
  7. data/lib/ui5/Component.js +41 -0
  8. data/lib/ui5/controller/BreederList.controller.js +68 -0
  9. data/lib/ui5/controller/Breeder_Create.controller.js +82 -0
  10. data/lib/ui5/controller/Breeder_Detail.controller.js +89 -0
  11. data/lib/ui5/controller/CultivarList.controller.js +46 -0
  12. data/lib/ui5/controller/Cultivar_Create.controller.js +100 -0
  13. data/lib/ui5/controller/Cultivar_Detail.controller.js +204 -0
  14. data/lib/ui5/controller/FiveApplesApp.controller.js +62 -0
  15. data/lib/ui5/controller/MCultivarList.controller.js +96 -0
  16. data/lib/ui5/controller/MenuList.controller.js +28 -0
  17. data/lib/ui5/controller/NotFound.controller.js +9 -0
  18. data/lib/ui5/controller/ParentageList.controller.js +71 -0
  19. data/lib/ui5/controller/Parentage_Create.controller.js +134 -0
  20. data/lib/ui5/controller/Parentage_Detail.controller.js +116 -0
  21. data/lib/ui5/controller/VibertBaseController.js +40 -0
  22. data/lib/ui5/i18n/i18n.properties +7 -0
  23. data/lib/ui5/index.html +33 -0
  24. data/lib/ui5/manifest.json +194 -0
  25. data/lib/ui5/model/formatter.js +1 -0
  26. data/lib/ui5/model/models.js +19 -0
  27. data/lib/ui5/view/BreederList.view.xml +50 -0
  28. data/lib/ui5/view/BreederOptio.fragment.xml +21 -0
  29. data/lib/ui5/view/Breeder_Create.view.xml +26 -0
  30. data/lib/ui5/view/Breeder_Detail.view.xml +53 -0
  31. data/lib/ui5/view/CultivarList.view.xml +58 -0
  32. data/lib/ui5/view/CultivarOptio.fragment.xml +23 -0
  33. data/lib/ui5/view/Cultivar_Create.view.xml +33 -0
  34. data/lib/ui5/view/Cultivar_Detail.view.xml +93 -0
  35. data/lib/ui5/view/FiveApplesApp.view.xml +9 -0
  36. data/lib/ui5/view/MCultivarList.view.xml +43 -0
  37. data/lib/ui5/view/MenuList.view.xml +18 -0
  38. data/lib/ui5/view/NotFound.view.xml +9 -0
  39. data/lib/ui5/view/ParentageList.view.xml +64 -0
  40. data/lib/ui5/view/Parentage_Create.view.xml +26 -0
  41. data/lib/ui5/view/Parentage_Detail.view.xml +51 -0
  42. metadata +128 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 799660a5ae3948a0f6f645cf361f1a810f2dc18dab1529f8871ee0e4846d63cc
4
+ data.tar.gz: 52a6c2e5888e898f2fb70438ddb3432f3eadf464371f588baf8990d09e7cebb5
5
+ SHA512:
6
+ metadata.gz: f7d7c2ed27c49f23e868bcec4dc7d46c8e8d657eb96cb66f38518a9cfc0cd479d43c7044d90c3f633ee6726516ef60b31b8aaaa7d405fe179b3a98fc9c1ef76d
7
+ data.tar.gz: 858254ff9e2d60c7e40958abbeda204d273e7520aacd2b8ee42cecf7dd2f2d58d36aff4c67c23286d981700f381ba6170323a8ac3ab139cd5c74cf1d3fc67180
data/bin/fiveapples ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/fiveapples.rb'
4
+
5
+ FiveA.serve
6
+
7
+
data/lib/config5.ru ADDED
@@ -0,0 +1,31 @@
1
+
2
+ ###########
3
+ # config5.ru
4
+ #
5
+ require_relative './model.rb'
6
+
7
+ require 'rack/logger'
8
+
9
+ fiveapples = Rack::OData::Builder.new do
10
+
11
+ use Rack::Cors do
12
+ allow do
13
+ origins 'localhost:9494', '127.0.0.1:9494'
14
+ resource '*',
15
+ methods: [:get, :post, :delete, :put, :patch, :options, :head],
16
+ headers: :any,
17
+ expose: ['Some-Custom-Response-Header']
18
+ end
19
+ end
20
+ use Rack::CommonLogger
21
+ use Rack::ShowExceptions
22
+
23
+ # Serve the ui5 app
24
+ use Rack::Static, :urls => ["/ui5"]
25
+
26
+ # Serve the OData
27
+ run ODataFiveApples.new
28
+
29
+ end
30
+
31
+ Rack::Handler::Thin.run fiveapples, :Port => 9494
Binary file
data/lib/fiveapples.rb ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'safrano.rb'
4
+ require 'sequel'
5
+ require 'fileutils'
6
+
7
+ class FiveApples
8
+ CONFIGDIRNAME = 'fiveapples'.freeze
9
+ DBFILENAME = 'fiveapples.db3'.freeze
10
+ CONFIGRU = 'config5.ru'
11
+
12
+ attr_reader :db
13
+
14
+ def initialize
15
+ gconfigdir = File.expand_path('.config', Dir.home)
16
+ @apphome = File.expand_path(CONFIGDIRNAME, gconfigdir)
17
+ @libdir = __dir__.dup
18
+ @systemdbname = File.join(@libdir, DBFILENAME)
19
+ @homedbname = File.expand_path(DBFILENAME, @apphome)
20
+ @configru = File.expand_path(CONFIGRU, @libdir)
21
+ end
22
+
23
+ def setup_db_in_homedir
24
+ FileUtils.mkdir_p(@apphome) unless Dir.exist?(@apphome)
25
+ FileUtils.cp(@systemdbname, @homedbname) unless File.exist?(@homedbname)
26
+ end
27
+
28
+ def startdb
29
+ setup_db_in_homedir
30
+
31
+ @db = Sequel::Model.db = Sequel.sqlite(@homedbname)
32
+
33
+ Kernel.at_exit { Sequel::Model.db.disconnect if Sequel::Model.db }
34
+
35
+ end
36
+
37
+ def serve
38
+
39
+ Dir.chdir @libdir
40
+ exec "rackup -I#{@libdir} #{@configru}"
41
+
42
+ end
43
+
44
+ end
45
+
46
+ FiveA = FiveApples.new
data/lib/model.rb ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative './fiveapples.rb'
4
+
5
+ FiveA.startdb
6
+
7
+ class Cultivar < Sequel::Model(:cultivar)
8
+
9
+ # Navigation attributes
10
+ one_to_many :parent, :class => :Parentage, :key => :cultivar_id
11
+ one_to_many :child, :class => :Parentage, :key => :parent_id
12
+
13
+ many_to_one :breeder, :key => :breeder_id
14
+
15
+ end
16
+
17
+ class ParentageType < Sequel::Model(:par_type)
18
+ end
19
+
20
+ class Breeder < Sequel::Model(:breeder)
21
+ one_to_many :cultivar, :key => :breeder_id
22
+ end
23
+
24
+ class Parentage < Sequel::Model(:parentage)
25
+ # A parentage is for a given cultivar; there can be multiple parentage records
26
+ # (type: father or mother), or one (type seedling) or none
27
+ #
28
+ many_to_one :cultivar, :class => :Cultivar, :key=>:cultivar_id
29
+ many_to_one :parent, :class=> :Cultivar, :key=>:parent_id
30
+ many_to_one :par_type, :class=>:ParentageType, :key => :ptype_id
31
+
32
+ end
33
+
34
+ ### SERVER Part #############################
35
+
36
+ class ODataFiveApples < OData::ServerApp
37
+ publish_service do
38
+
39
+ title 'Five apples OData API'
40
+ name 'FiveApplesService'
41
+ namespace 'ODataFiveApples'
42
+ path_prefix '/odata'
43
+
44
+ publish_model Cultivar, :cultivar do
45
+ add_nav_prop_single :breeder
46
+ add_nav_prop_collection :parent
47
+ add_nav_prop_collection :child
48
+ end
49
+ publish_model Breeder, :breeder do add_nav_prop_collection :cultivar end
50
+ publish_model ParentageType, :par_type
51
+ publish_model Parentage, :parentage do
52
+ add_nav_prop_single :parent
53
+ add_nav_prop_single :cultivar
54
+ add_nav_prop_single :par_type
55
+ end
56
+ end
57
+ end
58
+
@@ -0,0 +1,41 @@
1
+ sap.ui.define([
2
+ "sap/ui/core/UIComponent",
3
+ "sap/ui/model/odata/ODataModel",
4
+ "sap/ui/model/resource/ResourceModel"
5
+ ], function (UIComponent, ODataModel, ResourceModel) {
6
+ "use strict";
7
+ return UIComponent.extend("vibert.Component", {
8
+ metadata : { manifest: "json" },
9
+ id : "vibert.Component",
10
+ name : "vibert.Component",
11
+ parenstypusDescriptioMap : {},
12
+ init : function () {
13
+ // call the init function of the parent
14
+ UIComponent.prototype.init.apply(this, arguments);
15
+
16
+
17
+ // set OData model
18
+
19
+ var mParameters = new Map();
20
+ mParameters.json = true;
21
+ mParameters.tokenHandling = true;
22
+ // mParameters.disableHeadRequestForToken = true;
23
+ mParameters.useBatch = false; //not yet supported it says
24
+ mParameters.defaultBindingMode = "OneWay" ;
25
+
26
+ var oModel = new sap.ui.model.odata.v2.ODataModel("http://localhost:9494/odata", mParameters);
27
+ oModel.setTokenHandlingEnabled(true);
28
+
29
+ this.setModel(oModel);
30
+
31
+ // set i18n model
32
+ var i18nModel = new ResourceModel({ bundleName : "vibert.i18n.i18n" });
33
+
34
+ this.setModel(i18nModel, "i18n");
35
+
36
+ // create the views based on the url/hash
37
+ this.getRouter().initialize();
38
+ }
39
+
40
+ });
41
+ });
@@ -0,0 +1,68 @@
1
+ sap.ui.define(["sap/ui/core/mvc/Controller",
2
+ "sap/m/MessageToast",
3
+ "sap/ui/model/odata/ODataModel",
4
+ "sap/ui/commons/Dialog",
5
+ "sap/ui/model/resource/ResourceModel"],
6
+ function (Controller, MessageToast, ODataModel, Dialog, ResourceModel) {
7
+ "use strict";
8
+ return Controller.extend("vibert.controller.BreederList", {
9
+
10
+
11
+ onCreatePress: function (evt) {
12
+
13
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
14
+ oRouter.navTo( "breeder_create" );
15
+
16
+ },
17
+
18
+ onDeletePress: function (evt) {
19
+ var oTable = this.getView().byId("breeder_table");
20
+ var oModel = this.getView().getModel();
21
+ var iIndex = oTable.getSelectedIndex();
22
+ var mParms = {};
23
+
24
+ var oDeleteDialog = new sap.ui.commons.Dialog();
25
+ oDeleteDialog.setTitle("Delete breeder");
26
+ var oText = new sap.ui.commons.TextView({text: "Are you sure to delete this Breeder?"});
27
+ oDeleteDialog.addContent(oText);
28
+ oDeleteDialog.addButton(
29
+ new sap.ui.commons.Button({
30
+ text: "Confirm",
31
+ press:function(){
32
+ var mParms = {};
33
+ mParms.merge = true;
34
+
35
+ mParms.success = function(data, response){
36
+ oModel.refresh(); oDeleteDialog.close(); };
37
+ mParms.error = function(error){
38
+ oDeleteDialog.close();
39
+ MessageToast.show("Delete failed"); } ;
40
+ var sMsg;
41
+ if (iIndex < 0) {
42
+ sMsg = "no item selected";
43
+ } else {
44
+
45
+ sMsg = oTable.getContextByIndex(iIndex);
46
+ mParms.context = sMsg;
47
+ oModel.remove("",mParms); }
48
+ }
49
+ })
50
+
51
+ );
52
+ oDeleteDialog.open();
53
+ },
54
+ onSelectionChange: function (evt) {
55
+ var oTable = this.getView().byId("breeder_table");
56
+ var iIndex = oTable.getSelectedIndex();
57
+
58
+ var oCtxt = oTable.getContextByIndex(iIndex);
59
+ var sToPageId = oCtxt.getProperty("id") ;
60
+
61
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
62
+ // MessageToast.show(" navTo cultivar_detail -->"+sToPageId);
63
+ oRouter.navTo( "breeder_detail", {id: sToPageId} );
64
+ }
65
+ });
66
+ });
67
+
68
+
@@ -0,0 +1,82 @@
1
+ sap.ui.define([
2
+ "sap/ui/core/mvc/Controller",
3
+ "sap/m/MessageToast",
4
+ "sap/ui/core/routing/History"
5
+ ], function (Controller, MessageToast, History) {
6
+ "use strict";
7
+ return Controller.extend("vibert.controller.Breeder_Create", {
8
+ onInit: function () {
9
+ this._oRouter = sap.ui.core.UIComponent.getRouterFor(this);
10
+ this._oRouter.getRoute("breeder_detail").attachPatternMatched(this._onDetailMatched, this);
11
+ this.byId('last_name').setValue("");
12
+ this.byId('first_name').setValue("");
13
+
14
+ },
15
+ onBeforeRendering : function (){
16
+ this.byId('last_name').setValue("");
17
+ this.byId('first_name').setValue("");
18
+ },
19
+ _onDetailMatched : function (oEvent) {
20
+
21
+
22
+ // twoway bindingmode has to be set from start on creation of the Model,
23
+ // otherwise it does not wotk apparently
24
+ // BindingMode: "TwoWay"});
25
+
26
+ },
27
+ _onBindingChange : function (oEvent) {
28
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
29
+ // No data for the binding
30
+ //if (!this.getView().getBindingContext()) {
31
+ // oRouter.navTo("notFound");
32
+ //}
33
+ },
34
+ onNavPress: function() {
35
+ var oHistory = History.getInstance();
36
+ var sPreviousHash = oHistory.getPreviousHash();
37
+
38
+
39
+ if (sPreviousHash !== undefined) {
40
+ // history contains a previous entry
41
+ window.history.go(-1);
42
+ } else { this._oRouter.navTo("breederList"); }
43
+ },
44
+ onCreate: function() {
45
+
46
+ var myForm = sap.ui.getCore().byId("breeder_create_form");
47
+ var sObjectPath = "/breeder" ;
48
+ var oView = this.getView() ;
49
+ var oModel = oView.getModel();
50
+
51
+ var oEntry = {};
52
+
53
+ oEntry.last_name = this.byId('last_name').getValue();
54
+ oEntry.first_name = this.byId('first_name').getValue();
55
+
56
+
57
+ function onSuccessHandler(){
58
+ oModel.refresh();
59
+ MessageToast.show("Create success");
60
+ }
61
+ function onErrorHandler(){
62
+ MessageToast.show("Create failed"); }
63
+
64
+ oModel.create( sObjectPath, oEntry, {success: onSuccessHandler, error: onErrorHandler } );
65
+
66
+ },
67
+
68
+
69
+ onNavBack: function () {
70
+ var oHistory = History.getInstance();
71
+ var sPreviousHash = oHistory.getPreviousHash();
72
+
73
+
74
+ if (sPreviousHash !== undefined) {
75
+ window.history.go(-1);
76
+ } else {
77
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
78
+ oRouter.navTo("breederList", true);
79
+ }
80
+ }
81
+ });
82
+ });
@@ -0,0 +1,89 @@
1
+ sap.ui.define([
2
+ "sap/ui/core/mvc/Controller",
3
+ "sap/m/MessageToast",
4
+ "sap/ui/core/routing/History"
5
+ ], function (Controller, MessageToast, History) {
6
+ "use strict";
7
+ return Controller.extend("vibert.controller.Breeder_Detail", {
8
+ onInit: function () {
9
+ this._oRouter = sap.ui.core.UIComponent.getRouterFor(this);
10
+ this._oRouter.getRoute("breeder_detail").attachPatternMatched(this._onDetailMatched, this);
11
+ },
12
+ _onDetailMatched : function (oEvent) {
13
+ this._sObjectID = oEvent.getParameter("arguments").id ;
14
+ var sObjectPath = "/breeder(" + this._sObjectID + ")" ;
15
+ this._sObjectPath = sObjectPath;
16
+ var oView = this.getView();
17
+ var oModel = sap.ui.getCore().getModel();
18
+ oView.setModel(oModel);
19
+ oView.bindElement({ path: sObjectPath});
20
+
21
+ },
22
+ _onBindingChange : function (oEvent) { },
23
+ onCultivarSelectionChange: function() {
24
+ var oTable = this.byId("breeder_cultivar_table");
25
+ var iIndex = oTable.getSelectedIndex();
26
+
27
+ var oCtxt = oTable.getContextByIndex(iIndex);
28
+ var sToPageParID = oCtxt.getProperty("id") ;
29
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
30
+ oRouter.navTo( "cultivar_detail", {id: sToPageParID } );
31
+
32
+ },
33
+
34
+ onSave: function() {
35
+ var oView = this.getView();
36
+ var oModel = oView.getModel();
37
+ var sPath = this._sObjectPath;
38
+ var mParms = {};
39
+ var oEntry = {};
40
+
41
+ var oData = oModel.getData(sPath);
42
+
43
+ oEntry.last_name = this.byId('last_name').getValue();
44
+ oEntry.first_name = this.byId('first_name').getValue();
45
+
46
+ function onSuccessHandler(){
47
+ oModel.refresh();
48
+ oModel.updateBindings();
49
+ MessageToast.show("Update success");
50
+ }
51
+ function onErrorHandler(){ MessageToast.show("Update failed"); }
52
+ console.log("Model data:", oData);
53
+ console.log("View data:", oEntry);
54
+ console.log("Model has pending changes:", oModel.hasPendingChanges());
55
+ console.log("Pending changes:", oModel.getPendingChanges());
56
+
57
+ mParms.success = onSuccessHandler;
58
+ mParms.error = onErrorHandler;
59
+ mParms.merge = false;
60
+ oModel.setTokenHandlingEnabled(true);
61
+ oModel.updateSecurityToken();
62
+ oModel.update( this._sObjectPath, oEntry, mParms );
63
+
64
+ },
65
+
66
+ onCheck: function() {
67
+ var oView = this.getView();
68
+ var oModel = oView.getModel();
69
+ var sPath = this._sObjectPath;
70
+ var oData = oModel.getData(sPath);
71
+ console.log("Model data:", oData);
72
+ console.log("Model has pending changes:", oModel.hasPendingChanges());
73
+ console.log("Pending changes:",
74
+ oModel.getPendingChanges()); },
75
+
76
+ onNavBack: function () {
77
+ var oHistory = History.getInstance();
78
+ var sPreviousHash = oHistory.getPreviousHash();
79
+
80
+
81
+ if (sPreviousHash !== undefined) {
82
+ window.history.go(-1);
83
+ } else {
84
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
85
+ oRouter.navTo("breederList", true);
86
+ }
87
+ }
88
+ });
89
+ });
@@ -0,0 +1,46 @@
1
+ sap.ui.define(["sap/ui/core/mvc/Controller",
2
+ "sap/m/MessageToast",
3
+ "sap/ui/model/odata/ODataModel",
4
+ "sap/ui/model/resource/ResourceModel"],
5
+ function (Controller, MessageToast, ODataModel, ResourceModel) {
6
+ "use strict";
7
+ return Controller.extend("vibert.controller.CultivarList", {
8
+
9
+
10
+ onInit : function() {
11
+
12
+ },
13
+ onCreatePress: function (evt) {
14
+
15
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
16
+ oRouter.navTo( "cultivar_create" );
17
+
18
+ },
19
+
20
+
21
+ onSelectionChange: function (evt) {
22
+ var oTable = this.getView().byId("cultivar_table");
23
+ var iIndex = oTable.getSelectedIndex();
24
+
25
+ var oCtxt = oTable.getContextByIndex(iIndex);
26
+ var sToPageId = oCtxt.getProperty("id") ;
27
+
28
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
29
+ // MessageToast.show(" navTo cultivar_detail -->"+sToPageId);
30
+ oRouter.navTo( "cultivar_detail", {id: sToPageId} );
31
+ },
32
+ //onDisplayPress: function (evt) {
33
+ //var oTable = this.getView().byId("cultivar_table");
34
+ //var iIndex = oTable.getSelectedIndex();
35
+
36
+ //var oCtxt = oTable.getContextByIndex(iIndex);
37
+ //var sToPageId = oCtxt.getProperty("ID") ;
38
+
39
+ //var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
40
+ //// MessageToast.show(" navTo cultivar_detail -->"+sToPageId);
41
+ //oRouter.navTo( "cultivar_detail", {ID: sToPageId} );
42
+ //}
43
+ });
44
+ });
45
+
46
+
@@ -0,0 +1,100 @@
1
+ sap.ui.define([
2
+ "sap/ui/core/mvc/Controller",
3
+ "sap/m/MessageToast",
4
+ "sap/ui/core/routing/History"
5
+ ], function (Controller, MessageToast, History) {
6
+ "use strict";
7
+ return Controller.extend("vibert.controller.Cultivar_Create", {
8
+ onInit: function () {
9
+
10
+ var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
11
+ this._oRouter = oRouter;
12
+ },
13
+
14
+ onCreatePress: function() {
15
+
16
+ var myForm = sap.ui.getCore().byId("cultivar_create_form");
17
+ var sObjectPath = "/cultivar" ;
18
+ var oView = this.getView() ;
19
+ var oModel = oView.getModel();
20
+
21
+ var oEntry = {};
22
+
23
+ oEntry.name = this.byId('name').getValue();
24
+ oEntry.common_name = this.byId('common_name').getValue();
25
+ oEntry.year = this.byId('year').getValue();
26
+ oEntry.breeder_ID = this.byId('breeder_ID').getValue();
27
+ var _that = this;
28
+
29
+ function onSuccessHandler(data){
30
+ oModel.refresh();
31
+ _that.byId('name').setValue("");
32
+ _that.byId('common_name').setValue("");
33
+ _that.byId('year').setValue("");
34
+ _that.byId('breeder_ID').setValue("");
35
+ MessageToast.show("Create success");
36
+ _that._oRouter.navTo( "cultivar_detail", {ID: data.ID} );
37
+ }
38
+ function onErrorHandler(){
39
+ MessageToast.show("Create failed"); }
40
+
41
+ oModel.create( sObjectPath, oEntry,
42
+ {success: onSuccessHandler, error: onErrorHandler } );
43
+
44
+ },
45
+
46
+
47
+ onNavBack: function () {
48
+ var oHistory = History.getInstance();
49
+ var sPreviousHash = oHistory.getPreviousHash();
50
+
51
+ if (sPreviousHash !== undefined) {
52
+ window.history.go(-1);
53
+ } else {
54
+ this._oRouter.navTo("cultivarList", true);
55
+ }
56
+ },
57
+
58
+ inputId : "",
59
+ inputDescrId: "",
60
+
61
+ onBreederIDValueHelp : function (oEvent) {
62
+
63
+ this.inputId = oEvent.getSource().getId();
64
+ this.inputDescrId = this.inputId + "_descr";
65
+
66
+ // create value help dialog
67
+ if (!this._valueHelpDialog) {
68
+ this._valueHelpDialog = sap.ui.xmlfragment(
69
+ "vibert.view.BreederOptio", this );
70
+
71
+ this.getView().addDependent(this._valueHelpDialog);
72
+ }
73
+
74
+ this._valueHelpDialog.open( '' );
75
+ },
76
+
77
+ _handleValueHelpSearch : function (evt) {
78
+ var sValue = evt.getParameter("value");
79
+ var oFilter = new Filter( "name",
80
+ sap.ui.model.FilterOperator.Contains, sValue
81
+ );
82
+ evt.getSource().getBinding("items").filter([oFilter]);
83
+ },
84
+
85
+ _handleValueHelpClose : function (evt) {
86
+ var oSelectedItem = evt.getParameter("selectedItem");
87
+ if (oSelectedItem) {
88
+ var IDInput = this.getView().byId(this.inputId);
89
+ IDInput.setValue(oSelectedItem.getDescription());
90
+
91
+ var oText = this.getView().byId(this.inputDescrId);
92
+ oText.setText(oSelectedItem.getTitle());
93
+
94
+ }
95
+ evt.getSource().getBinding("items").filter([]);
96
+
97
+ }
98
+
99
+ });
100
+ });