netzke-core 0.6.7 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +36 -1
- data/{README.markdown → README.md} +17 -15
- data/Rakefile +1 -1
- data/TODO +4 -4
- data/app/controllers/netzke_controller.rb +8 -3
- data/javascripts/base.js +71 -68
- data/javascripts/ext.js +182 -111
- data/lib/netzke/actions.rb +2 -1
- data/lib/netzke/base.rb +5 -1
- data/lib/netzke/composition.rb +2 -2
- data/lib/netzke/configuration.rb +1 -1
- data/lib/netzke/core/dynamic_assets.rb +7 -7
- data/lib/netzke/core/session.rb +4 -0
- data/lib/netzke/core/version.rb +2 -2
- data/lib/netzke/core.rb +23 -30
- data/lib/netzke/core_ext/symbol.rb +1 -1
- data/lib/netzke/embedding.rb +1 -1
- data/lib/netzke/ext_component.rb +2 -2
- data/lib/netzke/javascript.rb +70 -39
- data/lib/netzke/plugin.rb +15 -0
- data/lib/netzke/plugins.rb +29 -0
- data/lib/netzke/railz/action_view_ext/ext.rb +13 -16
- data/lib/netzke/railz/action_view_ext/touch.rb +3 -3
- data/lib/netzke/railz/action_view_ext.rb +0 -3
- data/lib/netzke/railz/engine.rb +34 -29
- data/lib/netzke/services.rb +1 -1
- data/lib/netzke/state.rb +2 -2
- data/lib/netzke-core.rb +1 -0
- data/netzke-core.gemspec +108 -9
- data/stylesheets/core.css +25 -5
- data/test/rails_app/Gemfile +1 -1
- data/test/rails_app/Gemfile.lock +37 -36
- data/test/rails_app/app/components/component_loader.rb +36 -24
- data/test/rails_app/app/components/component_with_js_mixin/javascripts/component_with_js_mixin.js +5 -0
- data/test/rails_app/app/components/component_with_js_mixin.rb +3 -1
- data/test/rails_app/app/components/component_with_nested_through.rb +28 -0
- data/test/rails_app/app/components/component_with_session_persistence.rb +7 -5
- data/test/rails_app/app/components/dynamic_tab_panel/javascripts/dynamic_tab_panel.js +9 -0
- data/test/rails_app/app/components/dynamic_tab_panel.rb +19 -0
- data/test/rails_app/app/components/extended_server_caller.rb +6 -5
- data/test/rails_app/app/components/loader_of_component_with_custom_css.rb +7 -8
- data/test/rails_app/app/components/localized_panel.rb +10 -1
- data/test/rails_app/app/components/nested_component.rb +18 -0
- data/test/rails_app/app/components/panel_with_plugin.rb +4 -0
- data/test/rails_app/app/components/panel_with_tools.rb +19 -0
- data/test/rails_app/app/components/plugin_with_components.rb +14 -0
- data/test/rails_app/app/components/server_caller.rb +1 -1
- data/test/rails_app/app/components/server_counter.rb +1 -1
- data/test/rails_app/app/components/simple_component.rb +2 -0
- data/test/rails_app/app/components/simple_tab_panel.rb +21 -21
- data/test/rails_app/app/components/simple_window.rb +1 -1
- data/test/rails_app/app/components/some_composite.rb +3 -2
- data/test/rails_app/app/components/some_plugin.rb +39 -0
- data/test/rails_app/app/controllers/application_controller.rb +1 -1
- data/test/rails_app/app/controllers/components_controller.rb +1 -1
- data/test/rails_app/app/views/layouts/touch.html.erb +1 -1
- data/test/rails_app/config/application.rb +0 -2
- data/test/rails_app/config/initializers/netzke.rb +2 -1
- data/test/rails_app/config/locales/es.yml +1 -0
- data/test/rails_app/features/{actions.feature → actions_and_tools.feature} +8 -0
- data/test/rails_app/features/client-server.feature +0 -1
- data/test/rails_app/features/complex_component.feature +1 -1
- data/test/rails_app/features/component_loader.feature +7 -0
- data/test/rails_app/features/composition.feature +2 -2
- data/test/rails_app/features/custom_css.feature +1 -1
- data/test/rails_app/features/i18n.feature +3 -0
- data/test/rails_app/features/js_include.feature +2 -0
- data/test/rails_app/features/nested_views.feature +5 -4
- data/test/rails_app/features/plugin.feature +16 -0
- data/test/rails_app/features/step_definitions/generic_steps.rb +21 -2
- data/test/rails_app/features/touch.feature +10 -10
- data/test/rails_app/spec/component/component_spec.rb +20 -0
- metadata +106 -10
- data/app/models/netzke_preference.rb +0 -170
data/CHANGELOG.rdoc
CHANGED
@@ -1,9 +1,44 @@
|
|
1
|
-
= v0.
|
1
|
+
= v0.7.0 - 2011-08-09
|
2
|
+
* Ext JS 4 compatibility
|
3
|
+
|
4
|
+
* API changes
|
5
|
+
* New +ext_uri+ config option (defaults to "extjs") - relative URI to the Ext JS library on the server.
|
6
|
+
* New +ext3_compat_uri+ config option (defaults to +nil+) - relative URI to the Ext 3 compatibility layer. When nil, no compatibility layer is loaded.
|
7
|
+
* New +current_user_method+ config option (defaults to :current_user) to let Netzke::Core know which method to call on Rails controller to retrieve the current user.
|
8
|
+
* New +Netzke::Core.current_user+ method to retrieve the current user.
|
9
|
+
* Passing instructions from server back to the client now is only meant for single-argument methods on client; arrays are not expanded into arguments any longer.
|
10
|
+
* New +instantiateChildNetzkeComponent+ method to instantiate a Netzke component by name.
|
11
|
+
* Default component height (400) and border (false) are no longer set.
|
12
|
+
|
13
|
+
* broken API
|
14
|
+
* The +ext_location+ config option renamed to +ext_path+
|
15
|
+
* loadNetzkeComponent (ex loadComponent) won't automatically show a component with xtype 'window' any longer; use the callback to do that manually
|
16
|
+
|
17
|
+
* enhancements
|
18
|
+
* +js_mixin+ without parameters will assume :component_class_name_underscored
|
19
|
+
* Ext locale file is automatically included when I18n.locale is not :en
|
20
|
+
* Child components now have +itemId+ set to component's name, so that +getComponent(component_name)+ can be used to retrieve immediate child components
|
21
|
+
* +loadNetzkeComponent+ that should be used instead of loadComponent won't render the loaded component unless the container is specified (which can be an id or an instance)
|
22
|
+
* JS: +componentDeliveryFailed+ method added that is called by the +deliver_component+ endpoint
|
23
|
+
|
24
|
+
* bug fix
|
25
|
+
* Tolerate relative_url_root when calculating the URI to icons in actions
|
26
|
+
|
27
|
+
* deprecations
|
28
|
+
* instantiateAndRenderComponent
|
29
|
+
* getParent in favor of getParentNetzkeComponent
|
30
|
+
* getChildComponent in favor of getChildNetzkeComponent
|
31
|
+
* loadComponent in favor of loadNetzkeComponent
|
32
|
+
* feedback in favor of netzkeFeedback
|
33
|
+
* Ext.container.Container#instantiateChild should not be used
|
34
|
+
|
35
|
+
= v0.6.7 - to be released
|
2
36
|
* enhancements
|
3
37
|
* No more using +method_missing+ for invoking endpoints.
|
4
38
|
* New "cache" option for `netzke_init` which gets passed to `javascript_include_tag` (no support for css caching of this type yet)
|
5
39
|
* Netzke dynamic js and css-files such as ext.js, touch.css, now get generated at the application start, and put into "public/netzke". Solves a long standing problem with serving those files by HTTP servers in some cases. Enables caching naturally.
|
6
40
|
* Moved features and specs to test/rails_app (tests should be run from that folder from now on)
|
41
|
+
* Introduced plugin functionality. We can create Netzke components that are pluggable into other components as Ext JS plugins.
|
7
42
|
|
8
43
|
= v0.6.6 - 2011-02-26
|
9
44
|
* enhancements
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# Netzke Core
|
2
2
|
|
3
3
|
Netzke Core is the bare bones of the [Netzke framework](https://github.com/skozlov/netzke). For pre-built full-featured components (like grids, forms, tab/accordion panels, applications, etc), see [netzke-basepack](http://github.com/skozlov/netzke-basepack) (Ext JS).
|
4
4
|
|
@@ -15,29 +15,31 @@ Netzke Core takes the burden of implementing the following key aspects of the fr
|
|
15
15
|
|
16
16
|
All this provides for fast, low-traffic, robust, highly maintainable applications.
|
17
17
|
|
18
|
-
|
18
|
+
## Getting started
|
19
19
|
|
20
20
|
* Follow the simple [installation](https://github.com/skozlov/netzke-core/wiki/Installation) steps.
|
21
21
|
* Learn how to build the [Hello World!](https://github.com/skozlov/netzke-core/wiki/Hello-world-extjs) component.
|
22
22
|
* Dive into the [documentation](https://github.com/skozlov/netzke/wiki).
|
23
23
|
* Get help on the [Google Groups](http://groups.google.com/group/netzke).
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
Netzke Core has support for Sencha Touch, so you can create components for mobile web apps as easily.
|
28
|
-
|
29
|
-
* Learn how to build the [Hello World!](https://github.com/skozlov/netzke-core/wiki/Hello-world-touch) Sencha Touch component.
|
30
|
-
|
31
|
-
### Testing and playing with Netzke Core
|
25
|
+
## Testing and playing with Netzke Core
|
32
26
|
|
33
27
|
Netzke Core is bundled with Cucumber and RSpec tests. If you would like to contribute to the project, you may want to learn how to [run the tests](https://github.com/skozlov/netzke-core/wiki/Automated-testing).
|
34
28
|
|
35
29
|
Besides, the bundled test application is a convenient [playground](https://github.com/skozlov/netzke-core/wiki/Playground) for those who search to experiment with the framework.
|
36
30
|
|
37
|
-
|
38
|
-
* [Project website](http://netzke.org)
|
39
|
-
* [Documentation](https://github.com/skozlov/netzke/wiki)
|
40
|
-
* [Live-demo](http://demo.netzke.org) (with sample code)
|
41
|
-
* [Twitter](http://twitter.com/
|
31
|
+
## Useful links
|
32
|
+
* [Project website](http://netzke.org)
|
33
|
+
* [Documentation](https://github.com/skozlov/netzke/wiki)
|
34
|
+
* [Live-demo](http://demo.netzke.org) (features [Netzke Basepack](https://github.com/skozlov/netzke-basepack), with sample code)
|
35
|
+
* [Twitter](http://twitter.com/netzke) - latest news about the framework
|
36
|
+
* [Author's twitter](http://twitter.com/nomadcoder) - author's rambling about OS X, productivity, lifestyle, and what not
|
37
|
+
|
38
|
+
## Ext 3 support
|
39
|
+
Versions 0.6.x are for you if you're using Ext 3 (*hardly maintained*)
|
40
|
+
|
41
|
+
## Rails 2 support
|
42
|
+
With Rails 2 (and Ext 3 only), use versions 0.5.x (*not maintained*)
|
42
43
|
|
43
|
-
|
44
|
+
---
|
45
|
+
Copyright (c) 2008-2011 NomadCoder, released under the MIT license
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gemspec.email = "sergei@playcode.nl"
|
10
10
|
gemspec.homepage = "http://netzke.org"
|
11
11
|
gemspec.authors = ["Sergei Kozlov"]
|
12
|
-
gemspec.add_dependency("activesupport", "
|
12
|
+
gemspec.add_dependency("activesupport", "~>3.0.0")
|
13
13
|
gemspec.post_install_message = <<-MESSAGE
|
14
14
|
|
15
15
|
========================================================================
|
data/TODO
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
1
|
+
= ToDo
|
2
|
+
Make it possible to pass a constant (not a string) to the `class_name` option
|
3
|
+
Make :lazy_loading "true" by default when defining a child component
|
4
|
+
Make :items option also accept a hash.
|
2
5
|
Caching for netzke_controller-provided JS and CSS.
|
3
6
|
Caching - investigate reusing (fragment?) caching of Rails.
|
4
|
-
Use Ext.Direct in the Netzke controller.
|
5
|
-
Let specify per API point if it will use a GET or a POST request.
|
6
|
-
|
7
7
|
|
8
8
|
|
9
9
|
= Ideas that didn't work out
|
@@ -33,7 +33,7 @@ class NetzkeController < ApplicationController
|
|
33
33
|
def ext
|
34
34
|
respond_to do |format|
|
35
35
|
format.js {
|
36
|
-
render :text => Netzke::Core::DynamicAssets.ext_js
|
36
|
+
render :text => Netzke::Core::DynamicAssets.ext_js(form_authenticity_token)
|
37
37
|
}
|
38
38
|
|
39
39
|
format.css {
|
@@ -58,9 +58,14 @@ class NetzkeController < ApplicationController
|
|
58
58
|
protected
|
59
59
|
def invoke_endpoint(endpoint_path, action, params, tid) #:nodoc:
|
60
60
|
component_name, *sub_components = endpoint_path.split('__')
|
61
|
-
|
61
|
+
components_in_session = Netzke::Core.session[:netzke_components]
|
62
62
|
|
63
|
-
|
63
|
+
if components_in_session
|
64
|
+
component_instance = Netzke::Base.instance_by_config(components_in_session[component_name.to_sym])
|
65
|
+
result = component_instance.invoke_endpoint((sub_components + [action]).join("__"), params)
|
66
|
+
else
|
67
|
+
result = {:component_not_in_session => true}.to_nifty_json
|
68
|
+
end
|
64
69
|
|
65
70
|
{
|
66
71
|
:type => "rpc",
|
data/javascripts/base.js
CHANGED
@@ -7,9 +7,8 @@ At this time the following constants have been set by Rails:
|
|
7
7
|
*/
|
8
8
|
|
9
9
|
// Initial stuff
|
10
|
-
Ext.BLANK_IMAGE_URL = Netzke.RelativeExtUrl + "/resources/images/default/s.gif";
|
11
10
|
Ext.ns('Ext.netzke'); // namespace for extensions that depend on Ext
|
12
|
-
Ext.ns('Netzke.page'); // namespace for all component
|
11
|
+
Ext.ns('Netzke.page'); // namespace for all component instances on the page
|
13
12
|
Ext.ns('Netzke.classes'); // namespace for all component classes
|
14
13
|
Ext.ns('Netzke.classes.Core'); // namespace for Core mixins
|
15
14
|
|
@@ -21,7 +20,22 @@ Netzke.deprecationWarning = function(msg){
|
|
21
20
|
}
|
22
21
|
};
|
23
22
|
|
23
|
+
Netzke.warning = Netzke.deprecationWarning;
|
24
|
+
|
25
|
+
Netzke.exception = function(msg) {
|
26
|
+
throw("Netzke: " + msg);
|
27
|
+
};
|
28
|
+
|
24
29
|
// Used in testing
|
30
|
+
if( Netzke.nLoadingFixRequests == undefined ){
|
31
|
+
Netzke.nLoadingFixRequests=0;
|
32
|
+
Ext.Ajax.on('beforerequest', function(conn,opt) { Netzke.nLoadingFixRequests+=1; });
|
33
|
+
Ext.Ajax.on('requestcomplete', function(conn,opt) { Netzke.nLoadingFixRequests-=1; });
|
34
|
+
Ext.Ajax.on('requestexception', function(conn,opt) { Netzke.nLoadingFixRequests-=1; });
|
35
|
+
Netzke.ajaxIsLoading = function() { return Netzke.nLoadingFixRequests > 0; };
|
36
|
+
}
|
37
|
+
|
38
|
+
// Used in testing, too
|
25
39
|
Netzke.runningRequests = 0;
|
26
40
|
Netzke.isLoading=function () {
|
27
41
|
return Netzke.runningRequests != 0;
|
@@ -52,12 +66,8 @@ Netzke.aliasMethodChain = function(klass, method, feature) {
|
|
52
66
|
// xtypes of cached Netzke classes
|
53
67
|
Netzke.cache = [];
|
54
68
|
|
55
|
-
|
56
|
-
Netzke.
|
57
|
-
if (!Ext.ComponentMgr.types[xtype]) {
|
58
|
-
Ext.reg(xtype, klass);
|
59
|
-
Netzke.cache.push(xtype);
|
60
|
-
}
|
69
|
+
Netzke.componentNotInSessionHandler = function() {
|
70
|
+
throw "Netzke: component not in Rails session. Define Netzke.componentNotInSessionHandler to handle this.";
|
61
71
|
};
|
62
72
|
|
63
73
|
Netzke.classes.Core.Mixin = {};
|
@@ -68,7 +78,7 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
68
78
|
|
69
79
|
/*
|
70
80
|
Detects component placeholders in the passed object (typically, "items"),
|
71
|
-
and merges them with the corresponding config from this.
|
81
|
+
and merges them with the corresponding config from this.netzkeComponents.
|
72
82
|
This way it becomes ready to be instantiated properly by Ext.
|
73
83
|
*/
|
74
84
|
detectComponents: function(o){
|
@@ -76,11 +86,11 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
76
86
|
if (o.items) this.detectComponents(o.items);
|
77
87
|
} else if (Ext.isArray(o)) {
|
78
88
|
var a = o;
|
79
|
-
Ext.each(a, function(
|
80
|
-
if (
|
81
|
-
a[i] = Ext.apply(this.
|
89
|
+
Ext.each(a, function(c, i){
|
90
|
+
if (c.netzkeComponent) {
|
91
|
+
a[i] = Ext.apply(this.netzkeComponents[c.netzkeComponent.camelize(true)], c);
|
82
92
|
delete a[i].component;
|
83
|
-
} else if (
|
93
|
+
} else if (c.items) this.detectComponents(c.items);
|
84
94
|
}, this);
|
85
95
|
}
|
86
96
|
},
|
@@ -90,7 +100,7 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
90
100
|
*/
|
91
101
|
evalCss : function(code){
|
92
102
|
var head = Ext.fly(document.getElementsByTagName('head')[0]);
|
93
|
-
Ext.DomHelper.append(head, {
|
103
|
+
Ext.core.DomHelper.append(head, {
|
94
104
|
tag: 'style',
|
95
105
|
type: 'text/css',
|
96
106
|
html: code
|
@@ -118,25 +128,21 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
118
128
|
Executes a bunch of methods. This method is called almost every time a communication to the server takes place.
|
119
129
|
Thus the server side of a component can provide any set of commands to its client side.
|
120
130
|
Args:
|
121
|
-
- instructions:
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
{setColums:[{},{}]},
|
137
|
-
{setMenus:[{},{}]},
|
138
|
-
...
|
139
|
-
]
|
131
|
+
- instructions: can be
|
132
|
+
1) a hash of instructions, where the key is the method name, and value - the argument that method will be called with (thus, these methods are expected to *only* receive 1 argument). In this case, the methods will be executed in no particular order.
|
133
|
+
2) an array of hashes of instructions. They will be executed in order.
|
134
|
+
Arrays and hashes may be nested at will.
|
135
|
+
If the key in the instructions hash refers to a child Netzke component, bulkExecute will be called on that component with the value passed as the argument.
|
136
|
+
|
137
|
+
Examples of the arguments:
|
138
|
+
// same as this.feedback("Your order is accepted");
|
139
|
+
{feedback: "You order is accepted"}
|
140
|
+
|
141
|
+
// same as: this.setTitle('Suprise!'); this.setDisabled(true);
|
142
|
+
[{setTitle:'Suprise!'}, {setDisabled:true}]
|
143
|
+
|
144
|
+
// the same as this.getChildNetzkeComponent('users').bulkExecute([{setTitle:'Suprise!'}, {setDisabled:true}]);
|
145
|
+
{users: [{setTitle:'Suprise!'}, {setDisabled:true}] }
|
140
146
|
*/
|
141
147
|
bulkExecute : function(instructions){
|
142
148
|
if (Ext.isArray(instructions)) {
|
@@ -144,10 +150,10 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
144
150
|
} else {
|
145
151
|
for (var instr in instructions) {
|
146
152
|
if (Ext.isFunction(this[instr])) {
|
147
|
-
// Executing the method.
|
148
|
-
this[instr].apply(this,
|
153
|
+
// Executing the method.
|
154
|
+
this[instr].apply(this, [instructions[instr]]);
|
149
155
|
} else {
|
150
|
-
var childComponent = this.
|
156
|
+
var childComponent = this.getChildNetzkeComponent(instr);
|
151
157
|
if (childComponent) {
|
152
158
|
childComponent.bulkExecute(instructions[instr]);
|
153
159
|
} else {
|
@@ -158,17 +164,6 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
158
164
|
}
|
159
165
|
},
|
160
166
|
|
161
|
-
// Returns API url based on provided API point
|
162
|
-
buildApiUrl: function(endpoint){
|
163
|
-
Netzke.deprecationWarning("buildApiUrl() is deprecated. Use endpointUrl() instead.");
|
164
|
-
return this.endpointUrl(endpoint);
|
165
|
-
},
|
166
|
-
|
167
|
-
// endpointUrl: function(endpoint){
|
168
|
-
// Netzke.deprecationWarning("endpointUrl() is deprecated. Use Ext.direct counterparts instead.\nFor example, specify a DirectProxy instead of HttpProxy ( proxy: new Ext.data.DirectProxy({directFn: Netzke.providers[this.id].endPoint}) ),\nor specify api instead of url config option for BasicForm ( api: { load: Netzke.providers[this.id].loadEndPoint, submit: Netzke.providers[this.id].submitEndPoint} )");
|
169
|
-
// return Netzke.RelativeUrlRoot + "/netzke/" + this.id + "__" + endpoint;
|
170
|
-
// },
|
171
|
-
|
172
167
|
// Used by Touch components
|
173
168
|
endpointUrl: function(endpoint){
|
174
169
|
return Netzke.RelativeUrlRoot + "/netzke/dispatcher?address=" + this.id + "__" + endpoint;
|
@@ -200,31 +195,35 @@ Netzke.componentMixin = Ext.applyIf(Netzke.classes.Core.Mixin, {
|
|
200
195
|
|
201
196
|
setResult: function(result) {
|
202
197
|
this.latestResult = result;
|
198
|
+
},
|
199
|
+
|
200
|
+
// When an endpoint call is issued while the session has expired, this method is called. Override it to do whatever is appropriate.
|
201
|
+
componentNotInSession: function() {
|
202
|
+
Netzke.componentNotInSessionHandler();
|
203
203
|
}
|
204
204
|
});
|
205
205
|
|
206
206
|
|
207
|
-
// Netzke extensions for Ext.Container
|
207
|
+
// DEPRECATED as whole. Netzke extensions for Ext.Container.
|
208
208
|
Ext.override(Ext.Container, {
|
209
209
|
// Instantiates an component by its config. If it appears to be a window, shows it instead of adding as item.
|
210
|
-
|
211
|
-
|
212
|
-
var instance = Ext.
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
this.remove(this.getNetzkeComponent()); // first delete previous component
|
217
|
-
this.add(instance);
|
210
|
+
instantiateChild: function(config){
|
211
|
+
Netzke.deprecationWarning("instantiateChild is deprecated");
|
212
|
+
var instance = Ext.createByAlias( config.alias, config );
|
213
|
+
this.insertNetzkeComponent(instance);
|
214
|
+
return instance;
|
215
|
+
},
|
218
216
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
} else {
|
223
|
-
this.on('show', function(cmp){cmp.doLayout();}, {single: true});
|
224
|
-
}
|
217
|
+
insertNetzkeComponent: function(cmp) {
|
218
|
+
this.removeChild(); // first delete previous component
|
219
|
+
this.add(cmp);
|
225
220
|
|
221
|
+
// Sometimes a child is getting loaded into a hidden container...
|
222
|
+
if (this.isVisible()) {
|
223
|
+
this.doLayout();
|
224
|
+
} else {
|
225
|
+
this.on('show', function(cmp){cmp.doLayout();}, {single: true});
|
226
226
|
}
|
227
|
-
return instance;
|
228
227
|
},
|
229
228
|
|
230
229
|
/**
|
@@ -232,25 +231,29 @@ Ext.override(Ext.Container, {
|
|
232
231
|
It searches up the Ext.Container hierarchy until it finds a Container that has isNetzke property set to true
|
233
232
|
(or until it reaches the top).
|
234
233
|
*/
|
235
|
-
getOwnerComponent
|
234
|
+
getOwnerComponent: function(){
|
235
|
+
Netzke.deprecationWarning("getOwnerComponent is deprecated");
|
236
236
|
if (this.initialConfig.isNetzke) {
|
237
237
|
return this;
|
238
238
|
} else {
|
239
239
|
if (this.ownerCt){
|
240
|
-
return this.ownerCt.getOwnerComponent()
|
240
|
+
return this.ownerCt.getOwnerComponent();
|
241
241
|
} else {
|
242
|
-
return null
|
242
|
+
return null;
|
243
243
|
}
|
244
244
|
}
|
245
245
|
},
|
246
246
|
|
247
247
|
// Get the component that we are hosting
|
248
248
|
getNetzkeComponent: function(){
|
249
|
+
Netzke.deprecationWarning("getNetzkeComponent is deprecated");
|
249
250
|
return this.items ? this.items.first() : null; // need this check in case when the container is not yet rendered, like an inactive tab in the TabPanel
|
250
251
|
},
|
251
252
|
|
252
253
|
// Remove the child
|
253
|
-
removeChild
|
254
|
-
|
254
|
+
removeChild: function(){
|
255
|
+
Netzke.deprecationWarning("removeChild is deprecated");
|
256
|
+
var currentChild = this.getNetzkeComponent();
|
257
|
+
if (currentChild) {this.remove(currentChild);}
|
255
258
|
}
|
256
259
|
});
|