extjs-rails 4.1.0.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +36 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/extjs-rails/extjs-rails.js +1 -0
- data/app/assets/javascripts/extjs-rails/index.js.erb +9 -0
- data/app/assets/javascripts/extjs-rails/sdk.jsb3 +2017 -0
- data/app/assets/javascripts/extjs-rails/src/AbstractComponent.js +3290 -0
- data/app/assets/javascripts/extjs-rails/src/AbstractManager.js +144 -0
- data/app/assets/javascripts/extjs-rails/src/AbstractPlugin.js +72 -0
- data/app/assets/javascripts/extjs-rails/src/Action.js +276 -0
- data/app/assets/javascripts/extjs-rails/src/Ajax.js +99 -0
- data/app/assets/javascripts/extjs-rails/src/Component.js +1344 -0
- data/app/assets/javascripts/extjs-rails/src/ComponentLoader.js +202 -0
- data/app/assets/javascripts/extjs-rails/src/ComponentManager.js +47 -0
- data/app/assets/javascripts/extjs-rails/src/ComponentQuery.js +521 -0
- data/app/assets/javascripts/extjs-rails/src/Editor.js +494 -0
- data/app/assets/javascripts/extjs-rails/src/ElementLoader.js +404 -0
- data/app/assets/javascripts/extjs-rails/src/FocusManager.js +712 -0
- data/app/assets/javascripts/extjs-rails/src/Img.js +111 -0
- data/app/assets/javascripts/extjs-rails/src/Layer.js +543 -0
- data/app/assets/javascripts/extjs-rails/src/LoadMask.js +432 -0
- data/app/assets/javascripts/extjs-rails/src/ModelManager.js +186 -0
- data/app/assets/javascripts/extjs-rails/src/PluginManager.js +110 -0
- data/app/assets/javascripts/extjs-rails/src/ProgressBar.js +336 -0
- data/app/assets/javascripts/extjs-rails/src/Shadow.js +233 -0
- data/app/assets/javascripts/extjs-rails/src/ShadowPool.js +43 -0
- data/app/assets/javascripts/extjs-rails/src/Template.js +331 -0
- data/app/assets/javascripts/extjs-rails/src/XTemplate.js +365 -0
- data/app/assets/javascripts/extjs-rails/src/XTemplateCompiler.js +450 -0
- data/app/assets/javascripts/extjs-rails/src/XTemplateParser.js +249 -0
- data/app/assets/javascripts/extjs-rails/src/ZIndexManager.js +519 -0
- data/app/assets/javascripts/extjs-rails/src/app/Application.js +271 -0
- data/app/assets/javascripts/extjs-rails/src/app/Controller.js +458 -0
- data/app/assets/javascripts/extjs-rails/src/app/EventBus.js +112 -0
- data/app/assets/javascripts/extjs-rails/src/button/Button.js +1483 -0
- data/app/assets/javascripts/extjs-rails/src/button/Cycle.js +215 -0
- data/app/assets/javascripts/extjs-rails/src/button/Split.js +99 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Callout.js +140 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Chart.js +966 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Highlight.js +172 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Label.js +241 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Legend.js +474 -0
- data/app/assets/javascripts/extjs-rails/src/chart/LegendItem.js +217 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Mask.js +230 -0
- data/app/assets/javascripts/extjs-rails/src/chart/MaskLayer.js +48 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Navigation.js +79 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Shape.js +106 -0
- data/app/assets/javascripts/extjs-rails/src/chart/Tip.js +98 -0
- data/app/assets/javascripts/extjs-rails/src/chart/TipSurface.js +42 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Abstract.js +73 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Axis.js +961 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Category.js +130 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Gauge.js +203 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Numeric.js +235 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Radial.js +204 -0
- data/app/assets/javascripts/extjs-rails/src/chart/axis/Time.js +135 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Area.js +803 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Bar.js +853 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Cartesian.js +328 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Column.js +104 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Gauge.js +490 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Line.js +1104 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Pie.js +1072 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Radar.js +440 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Scatter.js +668 -0
- data/app/assets/javascripts/extjs-rails/src/chart/series/Series.js +443 -0
- data/app/assets/javascripts/extjs-rails/src/chart/theme/Base.js +175 -0
- data/app/assets/javascripts/extjs-rails/src/chart/theme/Theme.js +253 -0
- data/app/assets/javascripts/extjs-rails/src/container/AbstractContainer.js +1062 -0
- data/app/assets/javascripts/extjs-rails/src/container/ButtonGroup.js +143 -0
- data/app/assets/javascripts/extjs-rails/src/container/Container.js +212 -0
- data/app/assets/javascripts/extjs-rails/src/container/DockingContainer.js +265 -0
- data/app/assets/javascripts/extjs-rails/src/container/Viewport.js +184 -0
- data/app/assets/javascripts/extjs-rails/src/core/dom/Element.form.js +50 -0
- data/app/assets/javascripts/extjs-rails/src/core/dom/Element.static-more.js +159 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/index.html +321 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/index.js +6 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/CTO.js +25 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/CoolGuy.js +20 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/Developer.js +43 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/Gun.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/HumanResource.js +23 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/Musician.js +20 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/Person.js +50 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/ability/CanComposeSongs.js +9 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/ability/CanPlayGuitar.js +9 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/ability/CanSing.js +18 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/deadlock/A.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/deadlock/B.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/deadlock/C.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/deadlock/D.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/deadlock/E.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/notdeadlock/A.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/notdeadlock/B.js +4 -0
- data/app/assets/javascripts/extjs-rails/src/core/examples/src/Sample/notdeadlock/C.js +3 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/EventManager.js +1167 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/EventObject.js +883 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/Ext-more.js +1283 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/Ext.js +736 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/Support.js +662 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/class/Base.js +1085 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/class/Class.js +676 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/class/ClassManager.js +1591 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/class/Loader.js +1423 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.alignment.js +173 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.insertion.js +193 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.js +681 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.position.js +356 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.static.js +474 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.style.js +851 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractElement.traversal.js +180 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractHelper.js +291 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/AbstractQuery.js +72 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/CompositeElement.js +75 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/CompositeElementLite.js +436 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/dom/DomQuery-aria.js +1049 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/env/Browser.js +186 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/env/FeatureDetector.js +274 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/env/OS.js +141 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/Array.js +1205 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/Date.js +1463 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/Error.js +326 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/Function.js +485 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/Number.js +175 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/Object.js +606 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/lang/String.js +333 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/misc/JSON.js +236 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/perf/Accumulator.js +244 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/perf/Monitor.js +197 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/util/DelayedTask.js +71 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/util/Event.js +215 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/util/Format.js +551 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/util/TaskManager.js +417 -0
- data/app/assets/javascripts/extjs-rails/src/core/src/version/Version.js +364 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/README.MD +91 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/bootstrap.js +39 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/build/build-data.js +34 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/build/build.sh +2 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/data.js +27 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/index.html +15 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/dom.html +40 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/dom/extjs-api.js +12 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/dom/platform-api.js +134 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/dom/sanity.js +4 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/dom/touch-api-out.js +128 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/dom/touch-api.js +89 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/other_specs/env/Environment.js +357 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/resources/APITest.js +37 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/resources/jsb3.js +14 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/resources/test-setup.js +137 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/EventManager.js +629 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/Ext-mess.backup +198 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/Ext-more.js +520 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/Ext.js +1550 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/Support.js +250 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/class/Base.js +47 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/class/Class.js +561 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/class/ClassManager.js +555 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/CompositeElementLite.js +409 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/DomHelper.js +444 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/Element.insertion.js +342 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/Element.js +731 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/Element.static.js +201 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/Element.style.js +118 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/dom/Element.traversal.js +336 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/Array.js +1229 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/Date.js +697 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/Error.js +277 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/Function.js +536 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/Number.js +323 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/Object.js +591 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/lang/String.js +451 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/misc/JSON.js +252 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/util/Format.js +521 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/spec/version/Version.js +148 -0
- data/app/assets/javascripts/extjs-rails/src/core/test/unit/specs.html +19 -0
- data/app/assets/javascripts/extjs-rails/src/data/AbstractStore.js +887 -0
- data/app/assets/javascripts/extjs-rails/src/data/ArrayStore.js +74 -0
- data/app/assets/javascripts/extjs-rails/src/data/Batch.js +236 -0
- data/app/assets/javascripts/extjs-rails/src/data/BufferStore.js +13 -0
- data/app/assets/javascripts/extjs-rails/src/data/Connection.js +969 -0
- data/app/assets/javascripts/extjs-rails/src/data/DirectStore.js +50 -0
- data/app/assets/javascripts/extjs-rails/src/data/Errors.js +52 -0
- data/app/assets/javascripts/extjs-rails/src/data/Field.js +341 -0
- data/app/assets/javascripts/extjs-rails/src/data/IdGenerator.js +198 -0
- data/app/assets/javascripts/extjs-rails/src/data/JsonP.js +253 -0
- data/app/assets/javascripts/extjs-rails/src/data/JsonPStore.js +51 -0
- data/app/assets/javascripts/extjs-rails/src/data/JsonStore.js +60 -0
- data/app/assets/javascripts/extjs-rails/src/data/Model.js +1673 -0
- data/app/assets/javascripts/extjs-rails/src/data/NodeInterface.js +1294 -0
- data/app/assets/javascripts/extjs-rails/src/data/NodeStore.js +254 -0
- data/app/assets/javascripts/extjs-rails/src/data/Operation.js +331 -0
- data/app/assets/javascripts/extjs-rails/src/data/Request.js +40 -0
- data/app/assets/javascripts/extjs-rails/src/data/ResultSet.js +56 -0
- data/app/assets/javascripts/extjs-rails/src/data/SequentialIdGenerator.js +61 -0
- data/app/assets/javascripts/extjs-rails/src/data/SortTypes.js +125 -0
- data/app/assets/javascripts/extjs-rails/src/data/Store.js +2609 -0
- data/app/assets/javascripts/extjs-rails/src/data/StoreManager.js +156 -0
- data/app/assets/javascripts/extjs-rails/src/data/Tree.js +290 -0
- data/app/assets/javascripts/extjs-rails/src/data/TreeStore.js +655 -0
- data/app/assets/javascripts/extjs-rails/src/data/Types.js +190 -0
- data/app/assets/javascripts/extjs-rails/src/data/UuidGenerator.js +215 -0
- data/app/assets/javascripts/extjs-rails/src/data/XmlStore.js +76 -0
- data/app/assets/javascripts/extjs-rails/src/data/association/Association.js +243 -0
- data/app/assets/javascripts/extjs-rails/src/data/association/BelongsTo.js +291 -0
- data/app/assets/javascripts/extjs-rails/src/data/association/HasMany.js +289 -0
- data/app/assets/javascripts/extjs-rails/src/data/association/HasOne.js +304 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Ajax.js +282 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Client.js +21 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Direct.js +181 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/JsonP.js +313 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/LocalStorage.js +69 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Memory.js +156 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Proxy.js +433 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Rest.js +173 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/Server.js +460 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/SessionStorage.js +39 -0
- data/app/assets/javascripts/extjs-rails/src/data/proxy/WebStorage.js +546 -0
- data/app/assets/javascripts/extjs-rails/src/data/reader/Array.js +68 -0
- data/app/assets/javascripts/extjs-rails/src/data/reader/Json.js +383 -0
- data/app/assets/javascripts/extjs-rails/src/data/reader/Reader.js +735 -0
- data/app/assets/javascripts/extjs-rails/src/data/reader/Xml.js +292 -0
- data/app/assets/javascripts/extjs-rails/src/data/validations.js +149 -0
- data/app/assets/javascripts/extjs-rails/src/data/writer/Json.js +81 -0
- data/app/assets/javascripts/extjs-rails/src/data/writer/Writer.js +147 -0
- data/app/assets/javascripts/extjs-rails/src/data/writer/Xml.js +88 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DD.js +300 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DDProxy.js +204 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DDTarget.js +171 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DragDrop.js +1101 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DragDropManager.js +1264 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DragSource.js +392 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DragTracker.js +562 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DragZone.js +137 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DropTarget.js +118 -0
- data/app/assets/javascripts/extjs-rails/src/dd/DropZone.js +254 -0
- data/app/assets/javascripts/extjs-rails/src/dd/Registry.js +117 -0
- data/app/assets/javascripts/extjs-rails/src/dd/ScrollManager.js +218 -0
- data/app/assets/javascripts/extjs-rails/src/dd/StatusProxy.js +179 -0
- data/app/assets/javascripts/extjs-rails/src/diag/layout/Context.js +523 -0
- data/app/assets/javascripts/extjs-rails/src/diag/layout/ContextItem.js +179 -0
- data/app/assets/javascripts/extjs-rails/src/direct/Event.js +35 -0
- data/app/assets/javascripts/extjs-rails/src/direct/ExceptionEvent.js +16 -0
- data/app/assets/javascripts/extjs-rails/src/direct/JsonProvider.js +82 -0
- data/app/assets/javascripts/extjs-rails/src/direct/Manager.js +263 -0
- data/app/assets/javascripts/extjs-rails/src/direct/PollingProvider.js +156 -0
- data/app/assets/javascripts/extjs-rails/src/direct/Provider.js +96 -0
- data/app/assets/javascripts/extjs-rails/src/direct/RemotingEvent.js +24 -0
- data/app/assets/javascripts/extjs-rails/src/direct/RemotingMethod.js +100 -0
- data/app/assets/javascripts/extjs-rails/src/direct/RemotingProvider.js +510 -0
- data/app/assets/javascripts/extjs-rails/src/direct/Transaction.js +41 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.alignment.js +378 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.anim.js +962 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.dd.js +40 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.fx.js +194 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.js +1407 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.position.js +501 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.scroll.js +214 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.style.js +792 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Element.traversal.js +8 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Helper.js +466 -0
- data/app/assets/javascripts/extjs-rails/src/dom/Query.js +1067 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Color.js +303 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Component.js +245 -0
- data/app/assets/javascripts/extjs-rails/src/draw/CompositeSprite.js +299 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Draw.js +1217 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Matrix.js +183 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Sprite.js +554 -0
- data/app/assets/javascripts/extjs-rails/src/draw/SpriteDD.js +87 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Surface.js +1001 -0
- data/app/assets/javascripts/extjs-rails/src/draw/Text.js +175 -0
- data/app/assets/javascripts/extjs-rails/src/draw/engine/ImageExporter.js +106 -0
- data/app/assets/javascripts/extjs-rails/src/draw/engine/Svg.js +734 -0
- data/app/assets/javascripts/extjs-rails/src/draw/engine/SvgExporter.js +280 -0
- data/app/assets/javascripts/extjs-rails/src/draw/engine/Vml.js +916 -0
- data/app/assets/javascripts/extjs-rails/src/flash/Component.js +248 -0
- data/app/assets/javascripts/extjs-rails/src/form/Basic.js +1018 -0
- data/app/assets/javascripts/extjs-rails/src/form/CheckboxGroup.js +441 -0
- data/app/assets/javascripts/extjs-rails/src/form/CheckboxManager.js +26 -0
- data/app/assets/javascripts/extjs-rails/src/form/FieldAncestor.js +210 -0
- data/app/assets/javascripts/extjs-rails/src/form/FieldContainer.js +290 -0
- data/app/assets/javascripts/extjs-rails/src/form/FieldSet.js +506 -0
- data/app/assets/javascripts/extjs-rails/src/form/Label.js +110 -0
- data/app/assets/javascripts/extjs-rails/src/form/Labelable.js +764 -0
- data/app/assets/javascripts/extjs-rails/src/form/Panel.js +335 -0
- data/app/assets/javascripts/extjs-rails/src/form/RadioGroup.js +124 -0
- data/app/assets/javascripts/extjs-rails/src/form/RadioManager.js +26 -0
- data/app/assets/javascripts/extjs-rails/src/form/action/Action.js +307 -0
- data/app/assets/javascripts/extjs-rails/src/form/action/DirectLoad.js +107 -0
- data/app/assets/javascripts/extjs-rails/src/form/action/DirectSubmit.js +119 -0
- data/app/assets/javascripts/extjs-rails/src/form/action/Load.js +120 -0
- data/app/assets/javascripts/extjs-rails/src/form/action/StandardSubmit.js +34 -0
- data/app/assets/javascripts/extjs-rails/src/form/action/Submit.js +257 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Base.js +813 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Checkbox.js +505 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/ComboBox.js +1427 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Date.js +578 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Display.js +155 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Field.js +430 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/File.js +265 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Hidden.js +75 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/HtmlEditor.js +1439 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Number.js +380 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Picker.js +321 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Radio.js +279 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Spinner.js +321 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Text.js +727 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/TextArea.js +228 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Time.js +459 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/Trigger.js +469 -0
- data/app/assets/javascripts/extjs-rails/src/form/field/VTypes.js +172 -0
- data/app/assets/javascripts/extjs-rails/src/fx/Anim.js +472 -0
- data/app/assets/javascripts/extjs-rails/src/fx/Animator.js +410 -0
- data/app/assets/javascripts/extjs-rails/src/fx/CubicBezier.js +77 -0
- data/app/assets/javascripts/extjs-rails/src/fx/Easing.js +136 -0
- data/app/assets/javascripts/extjs-rails/src/fx/Manager.js +353 -0
- data/app/assets/javascripts/extjs-rails/src/fx/PropertyHandler.js +381 -0
- data/app/assets/javascripts/extjs-rails/src/fx/Queue.js +123 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/Component.js +118 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/CompositeElement.js +46 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/CompositeElementCSS.js +22 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/CompositeSprite.js +34 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/Element.js +83 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/ElementCSS.js +77 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/Sprite.js +128 -0
- data/app/assets/javascripts/extjs-rails/src/fx/target/Target.js +36 -0
- data/app/assets/javascripts/extjs-rails/src/grid/CellEditor.js +172 -0
- data/app/assets/javascripts/extjs-rails/src/grid/ColumnComponentLayout.js +34 -0
- data/app/assets/javascripts/extjs-rails/src/grid/ColumnLayout.js +201 -0
- data/app/assets/javascripts/extjs-rails/src/grid/Lockable.js +863 -0
- data/app/assets/javascripts/extjs-rails/src/grid/LockingView.js +169 -0
- data/app/assets/javascripts/extjs-rails/src/grid/PagingScroller.js +539 -0
- data/app/assets/javascripts/extjs-rails/src/grid/Panel.js +393 -0
- data/app/assets/javascripts/extjs-rails/src/grid/RowEditor.js +731 -0
- data/app/assets/javascripts/extjs-rails/src/grid/RowNumberer.js +76 -0
- data/app/assets/javascripts/extjs-rails/src/grid/Scroller.js +5 -0
- data/app/assets/javascripts/extjs-rails/src/grid/View.js +44 -0
- data/app/assets/javascripts/extjs-rails/src/grid/ViewDropZone.js +41 -0
- data/app/assets/javascripts/extjs-rails/src/grid/column/Action.js +318 -0
- data/app/assets/javascripts/extjs-rails/src/grid/column/Boolean.js +82 -0
- data/app/assets/javascripts/extjs-rails/src/grid/column/Column.js +835 -0
- data/app/assets/javascripts/extjs-rails/src/grid/column/Date.js +63 -0
- data/app/assets/javascripts/extjs-rails/src/grid/column/Number.js +52 -0
- data/app/assets/javascripts/extjs-rails/src/grid/column/Template.js +58 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/AbstractSummary.js +154 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/Chunking.js +77 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/Feature.js +158 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/Grouping.js +822 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/GroupingSummary.js +243 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/RowBody.js +116 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/RowWrap.js +120 -0
- data/app/assets/javascripts/extjs-rails/src/grid/feature/Summary.js +167 -0
- data/app/assets/javascripts/extjs-rails/src/grid/header/Container.js +965 -0
- data/app/assets/javascripts/extjs-rails/src/grid/header/DragZone.js +69 -0
- data/app/assets/javascripts/extjs-rails/src/grid/header/DropZone.js +265 -0
- data/app/assets/javascripts/extjs-rails/src/grid/plugin/CellEditing.js +453 -0
- data/app/assets/javascripts/extjs-rails/src/grid/plugin/DragDrop.js +254 -0
- data/app/assets/javascripts/extjs-rails/src/grid/plugin/Editing.js +561 -0
- data/app/assets/javascripts/extjs-rails/src/grid/plugin/HeaderReorderer.js +49 -0
- data/app/assets/javascripts/extjs-rails/src/grid/plugin/HeaderResizer.js +292 -0
- data/app/assets/javascripts/extjs-rails/src/grid/plugin/RowEditing.js +339 -0
- data/app/assets/javascripts/extjs-rails/src/grid/property/Grid.js +351 -0
- data/app/assets/javascripts/extjs-rails/src/grid/property/HeaderContainer.js +109 -0
- data/app/assets/javascripts/extjs-rails/src/grid/property/Property.js +36 -0
- data/app/assets/javascripts/extjs-rails/src/grid/property/Store.js +141 -0
- data/app/assets/javascripts/extjs-rails/src/layout/ClassList.js +90 -0
- data/app/assets/javascripts/extjs-rails/src/layout/Context.js +1232 -0
- data/app/assets/javascripts/extjs-rails/src/layout/ContextItem.js +1470 -0
- data/app/assets/javascripts/extjs-rails/src/layout/Layout.js +761 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Auto.js +220 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Body.js +80 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/BoundList.js +95 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Button.js +261 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Component.js +427 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Dock.js +1132 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Draw.js +79 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/FieldSet.js +62 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/ProgressBar.js +54 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/Tab.js +23 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/ComboBox.js +52 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/Field.js +372 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/FieldContainer.js +48 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/HtmlEditor.js +54 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/Slider.js +58 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/Text.js +75 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/TextArea.js +51 -0
- data/app/assets/javascripts/extjs-rails/src/layout/component/field/Trigger.js +132 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Absolute.js +121 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Accordion.js +308 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Anchor.js +403 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Auto.js +70 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Border-old-js +1079 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Border.js +816 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Box.js +929 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Card.js +361 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/CheckboxGroup.js +376 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Column.js +234 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Container.js +961 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Editor.js +74 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Fit.js +287 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Form.js +157 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/HBox.js +134 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/Table.js +412 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/VBox.js +139 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/boxOverflow/Menu.js +365 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/boxOverflow/None.js +83 -0
- data/app/assets/javascripts/extjs-rails/src/layout/container/boxOverflow/Scroller.js +475 -0
- data/app/assets/javascripts/extjs-rails/src/menu/CheckItem.js +169 -0
- data/app/assets/javascripts/extjs-rails/src/menu/ColorPicker.js +110 -0
- data/app/assets/javascripts/extjs-rails/src/menu/DatePicker.js +100 -0
- data/app/assets/javascripts/extjs-rails/src/menu/Item.js +553 -0
- data/app/assets/javascripts/extjs-rails/src/menu/KeyNav.js +134 -0
- data/app/assets/javascripts/extjs-rails/src/menu/Manager.js +219 -0
- data/app/assets/javascripts/extjs-rails/src/menu/Menu.js +579 -0
- data/app/assets/javascripts/extjs-rails/src/menu/Separator.js +126 -0
- data/app/assets/javascripts/extjs-rails/src/panel/AbstractPanel.js +323 -0
- data/app/assets/javascripts/extjs-rails/src/panel/DD.js +99 -0
- data/app/assets/javascripts/extjs-rails/src/panel/Header.js +518 -0
- data/app/assets/javascripts/extjs-rails/src/panel/Panel.js +2150 -0
- data/app/assets/javascripts/extjs-rails/src/panel/Proxy.js +131 -0
- data/app/assets/javascripts/extjs-rails/src/panel/Table.js +1018 -0
- data/app/assets/javascripts/extjs-rails/src/panel/Tool.js +304 -0
- data/app/assets/javascripts/extjs-rails/src/picker/Color.js +219 -0
- data/app/assets/javascripts/extjs-rails/src/picker/Date.js +1140 -0
- data/app/assets/javascripts/extjs-rails/src/picker/Month.js +490 -0
- data/app/assets/javascripts/extjs-rails/src/picker/Time.js +165 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/BorderSplitter.js +22 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/BorderSplitterTracker.js +210 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/Handle.js +29 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/ResizeTracker.js +346 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/Resizer.js +477 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/Splitter.js +242 -0
- data/app/assets/javascripts/extjs-rails/src/resizer/SplitterTracker.js +230 -0
- data/app/assets/javascripts/extjs-rails/src/selection/CellModel.js +395 -0
- data/app/assets/javascripts/extjs-rails/src/selection/CheckboxModel.js +234 -0
- data/app/assets/javascripts/extjs-rails/src/selection/DataViewModel.js +160 -0
- data/app/assets/javascripts/extjs-rails/src/selection/Model.js +646 -0
- data/app/assets/javascripts/extjs-rails/src/selection/RowModel.js +499 -0
- data/app/assets/javascripts/extjs-rails/src/selection/TreeModel.js +78 -0
- data/app/assets/javascripts/extjs-rails/src/slider/Multi.js +835 -0
- data/app/assets/javascripts/extjs-rails/src/slider/Single.js +56 -0
- data/app/assets/javascripts/extjs-rails/src/slider/Thumb.js +259 -0
- data/app/assets/javascripts/extjs-rails/src/slider/Tip.js +130 -0
- data/app/assets/javascripts/extjs-rails/src/state/CookieProvider.js +120 -0
- data/app/assets/javascripts/extjs-rails/src/state/LocalStorageProvider.js +72 -0
- data/app/assets/javascripts/extjs-rails/src/state/Manager.js +70 -0
- data/app/assets/javascripts/extjs-rails/src/state/Provider.js +182 -0
- data/app/assets/javascripts/extjs-rails/src/state/Stateful.js +364 -0
- data/app/assets/javascripts/extjs-rails/src/tab/Bar.js +258 -0
- data/app/assets/javascripts/extjs-rails/src/tab/Panel.js +654 -0
- data/app/assets/javascripts/extjs-rails/src/tab/Tab.js +358 -0
- data/app/assets/javascripts/extjs-rails/src/tail.js +10 -0
- data/app/assets/javascripts/extjs-rails/src/tip/QuickTip.js +335 -0
- data/app/assets/javascripts/extjs-rails/src/tip/QuickTipManager.js +239 -0
- data/app/assets/javascripts/extjs-rails/src/tip/Tip.js +160 -0
- data/app/assets/javascripts/extjs-rails/src/tip/ToolTip.js +691 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Fill.js +28 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Item.js +16 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Paging.js +600 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Separator.js +23 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Spacer.js +33 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/TextItem.js +57 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Toolbar-legacy.js +123 -0
- data/app/assets/javascripts/extjs-rails/src/toolbar/Toolbar.js +447 -0
- data/app/assets/javascripts/extjs-rails/src/tree/Column.js +90 -0
- data/app/assets/javascripts/extjs-rails/src/tree/Panel.js +505 -0
- data/app/assets/javascripts/extjs-rails/src/tree/View.js +658 -0
- data/app/assets/javascripts/extjs-rails/src/tree/ViewDragZone.js +49 -0
- data/app/assets/javascripts/extjs-rails/src/tree/ViewDropZone.js +287 -0
- data/app/assets/javascripts/extjs-rails/src/tree/plugin/TreeViewDragDrop.js +244 -0
- data/app/assets/javascripts/extjs-rails/src/util/AbstractMixedCollection.js +772 -0
- data/app/assets/javascripts/extjs-rails/src/util/Animate.js +426 -0
- data/app/assets/javascripts/extjs-rails/src/util/Bindable.js +102 -0
- data/app/assets/javascripts/extjs-rails/src/util/CSS.js +185 -0
- data/app/assets/javascripts/extjs-rails/src/util/ClickRepeater.js +238 -0
- data/app/assets/javascripts/extjs-rails/src/util/ComponentDragger.js +126 -0
- data/app/assets/javascripts/extjs-rails/src/util/Cookies.js +91 -0
- data/app/assets/javascripts/extjs-rails/src/util/ElementContainer.js +293 -0
- data/app/assets/javascripts/extjs-rails/src/util/Filter.js +159 -0
- data/app/assets/javascripts/extjs-rails/src/util/Floating.js +321 -0
- data/app/assets/javascripts/extjs-rails/src/util/Grouper.js +26 -0
- data/app/assets/javascripts/extjs-rails/src/util/HashMap.js +356 -0
- data/app/assets/javascripts/extjs-rails/src/util/History.js +285 -0
- data/app/assets/javascripts/extjs-rails/src/util/Inflector.js +297 -0
- data/app/assets/javascripts/extjs-rails/src/util/KeyMap.js +427 -0
- data/app/assets/javascripts/extjs-rails/src/util/KeyNav.js +239 -0
- data/app/assets/javascripts/extjs-rails/src/util/LruCache.js +257 -0
- data/app/assets/javascripts/extjs-rails/src/util/Memento.js +131 -0
- data/app/assets/javascripts/extjs-rails/src/util/MixedCollection.js +239 -0
- data/app/assets/javascripts/extjs-rails/src/util/Observable.js +1003 -0
- data/app/assets/javascripts/extjs-rails/src/util/Offset.js +60 -0
- data/app/assets/javascripts/extjs-rails/src/util/Point.js +93 -0
- data/app/assets/javascripts/extjs-rails/src/util/ProtoElement.js +205 -0
- data/app/assets/javascripts/extjs-rails/src/util/Queue.js +76 -0
- data/app/assets/javascripts/extjs-rails/src/util/Region.js +388 -0
- data/app/assets/javascripts/extjs-rails/src/util/Renderable.js +1079 -0
- data/app/assets/javascripts/extjs-rails/src/util/Sortable.js +248 -0
- data/app/assets/javascripts/extjs-rails/src/util/Sorter.js +179 -0
- data/app/assets/javascripts/extjs-rails/src/util/TextMetrics.js +148 -0
- data/app/assets/javascripts/extjs-rails/src/view/AbstractView.js +1103 -0
- data/app/assets/javascripts/extjs-rails/src/view/BoundList.js +207 -0
- data/app/assets/javascripts/extjs-rails/src/view/BoundListKeyNav.js +92 -0
- data/app/assets/javascripts/extjs-rails/src/view/DragZone.js +106 -0
- data/app/assets/javascripts/extjs-rails/src/view/DropZone.js +240 -0
- data/app/assets/javascripts/extjs-rails/src/view/Table.js +1229 -0
- data/app/assets/javascripts/extjs-rails/src/view/TableChunker.js +139 -0
- data/app/assets/javascripts/extjs-rails/src/view/View.js +636 -0
- data/app/assets/javascripts/extjs-rails/src/window/MessageBox.js +880 -0
- data/app/assets/javascripts/extjs-rails/src/window/Window-legacy.js +56 -0
- data/app/assets/javascripts/extjs-rails/src/window/Window.js +793 -0
- data/extjs-rails.gemspec +24 -0
- data/lib/extjs-rails.rb +7 -0
- data/lib/extjs-rails/engine.rb +7 -0
- data/lib/extjs-rails/version.rb +5 -0
- metadata +660 -0
|
@@ -0,0 +1,3290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An abstract base class which provides shared methods for Components across the Sencha product line.
|
|
3
|
+
*
|
|
4
|
+
* Please refer to sub class's documentation
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
Ext.define('Ext.AbstractComponent', {
|
|
8
|
+
|
|
9
|
+
/* Begin Definitions */
|
|
10
|
+
requires: [
|
|
11
|
+
'Ext.ComponentQuery',
|
|
12
|
+
'Ext.ComponentManager',
|
|
13
|
+
'Ext.util.ProtoElement'
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
mixins: {
|
|
17
|
+
observable: 'Ext.util.Observable',
|
|
18
|
+
animate: 'Ext.util.Animate',
|
|
19
|
+
elementCt: 'Ext.util.ElementContainer',
|
|
20
|
+
renderable: 'Ext.util.Renderable',
|
|
21
|
+
state: 'Ext.state.Stateful'
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// The "uses" property specifies class which are used in an instantiated AbstractComponent.
|
|
25
|
+
// They do *not* have to be loaded before this class may be defined - that is what "requires" is for.
|
|
26
|
+
uses: [
|
|
27
|
+
'Ext.PluginManager',
|
|
28
|
+
'Ext.Element',
|
|
29
|
+
'Ext.DomHelper',
|
|
30
|
+
'Ext.XTemplate',
|
|
31
|
+
'Ext.ComponentQuery',
|
|
32
|
+
'Ext.ComponentLoader',
|
|
33
|
+
'Ext.EventManager',
|
|
34
|
+
'Ext.layout.Context',
|
|
35
|
+
'Ext.layout.Layout',
|
|
36
|
+
'Ext.layout.component.Auto',
|
|
37
|
+
'Ext.LoadMask',
|
|
38
|
+
'Ext.ZIndexManager'
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
statics: {
|
|
42
|
+
AUTO_ID: 1000,
|
|
43
|
+
|
|
44
|
+
pendingLayouts: null,
|
|
45
|
+
|
|
46
|
+
layoutSuspendCount: 0,
|
|
47
|
+
|
|
48
|
+
cancelLayout: function(comp) {
|
|
49
|
+
var context = this.runningLayoutContext || this.pendingLayouts;
|
|
50
|
+
|
|
51
|
+
if (context) {
|
|
52
|
+
context.cancelComponent(comp);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
flushLayouts: function () {
|
|
57
|
+
var me = this,
|
|
58
|
+
context = me.pendingLayouts;
|
|
59
|
+
|
|
60
|
+
if (context && context.invalidQueue.length) {
|
|
61
|
+
me.pendingLayouts = null;
|
|
62
|
+
me.runningLayoutContext = context;
|
|
63
|
+
|
|
64
|
+
Ext.override(context, {
|
|
65
|
+
runComplete: function () {
|
|
66
|
+
// we need to release the layout queue before running any of the
|
|
67
|
+
// finishedLayout calls because they call afterComponentLayout
|
|
68
|
+
// which can re-enter by calling doLayout/doComponentLayout.
|
|
69
|
+
me.runningLayoutContext = null;
|
|
70
|
+
|
|
71
|
+
return this.callParent(); // not "me" here!
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
context.run();
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
resumeLayouts: function (flush) {
|
|
80
|
+
if (this.layoutSuspendCount && ! --this.layoutSuspendCount) {
|
|
81
|
+
if (flush) {
|
|
82
|
+
this.flushLayouts();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
suspendLayouts: function () {
|
|
88
|
+
++this.layoutSuspendCount;
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
updateLayout: function (comp, defer) {
|
|
92
|
+
var me = this,
|
|
93
|
+
running = me.runningLayoutContext,
|
|
94
|
+
pending;
|
|
95
|
+
|
|
96
|
+
if (running) {
|
|
97
|
+
running.queueInvalidate(comp);
|
|
98
|
+
} else {
|
|
99
|
+
pending = me.pendingLayouts || (me.pendingLayouts = new Ext.layout.Context());
|
|
100
|
+
pending.queueInvalidate(comp);
|
|
101
|
+
|
|
102
|
+
if (!defer && !me.layoutSuspendCount && !comp.isLayoutSuspended()) {
|
|
103
|
+
me.flushLayouts();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/* End Definitions */
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @property {Boolean} isComponent
|
|
113
|
+
* `true` in this class to identify an object as an instantiated Component, or subclass thereof.
|
|
114
|
+
*/
|
|
115
|
+
isComponent: true,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
getAutoId: function() {
|
|
121
|
+
this.autoGenId = true;
|
|
122
|
+
return ++Ext.AbstractComponent.AUTO_ID;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
deferLayouts: false,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @cfg {String} id
|
|
129
|
+
* The **unique id of this component instance.**
|
|
130
|
+
*
|
|
131
|
+
* It should not be necessary to use this configuration except for singleton objects in your application. Components
|
|
132
|
+
* created with an id may be accessed globally using {@link Ext#getCmp Ext.getCmp}.
|
|
133
|
+
*
|
|
134
|
+
* Instead of using assigned ids, use the {@link #itemId} config, and {@link Ext.ComponentQuery ComponentQuery}
|
|
135
|
+
* which provides selector-based searching for Sencha Components analogous to DOM querying. The {@link
|
|
136
|
+
* Ext.container.Container Container} class contains {@link Ext.container.Container#down shortcut methods} to query
|
|
137
|
+
* its descendant Components by selector.
|
|
138
|
+
*
|
|
139
|
+
* Note that this id will also be used as the element id for the containing HTML element that is rendered to the
|
|
140
|
+
* page for this component. This allows you to write id-based CSS rules to style the specific instance of this
|
|
141
|
+
* component uniquely, and also to select sub-elements using this component's id as the parent.
|
|
142
|
+
*
|
|
143
|
+
* **Note**: to avoid complications imposed by a unique id also see `{@link #itemId}`.
|
|
144
|
+
*
|
|
145
|
+
* **Note**: to access the container of a Component see `{@link #ownerCt}`.
|
|
146
|
+
*
|
|
147
|
+
* Defaults to an {@link #getId auto-assigned id}.
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @property {Boolean} autoGenId
|
|
152
|
+
* `true` indicates an id was auto-generated rather than provided by configuration.
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
autoGenId: false,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @cfg {String} itemId
|
|
159
|
+
* An itemId can be used as an alternative way to get a reference to a component when no object reference is
|
|
160
|
+
* available. Instead of using an `{@link #id}` with {@link Ext}.{@link Ext#getCmp getCmp}, use `itemId` with
|
|
161
|
+
* {@link Ext.container.Container}.{@link Ext.container.Container#getComponent getComponent} which will retrieve
|
|
162
|
+
* `itemId`'s or {@link #id}'s. Since `itemId`'s are an index to the container's internal MixedCollection, the
|
|
163
|
+
* `itemId` is scoped locally to the container -- avoiding potential conflicts with {@link Ext.ComponentManager}
|
|
164
|
+
* which requires a **unique** `{@link #id}`.
|
|
165
|
+
*
|
|
166
|
+
* var c = new Ext.panel.Panel({ //
|
|
167
|
+
* {@link Ext.Component#height height}: 300,
|
|
168
|
+
* {@link #renderTo}: document.body,
|
|
169
|
+
* {@link Ext.container.Container#layout layout}: 'auto',
|
|
170
|
+
* {@link Ext.container.Container#cfg-items items}: [
|
|
171
|
+
* {
|
|
172
|
+
* itemId: 'p1',
|
|
173
|
+
* {@link Ext.panel.Panel#title title}: 'Panel 1',
|
|
174
|
+
* {@link Ext.Component#height height}: 150
|
|
175
|
+
* },
|
|
176
|
+
* {
|
|
177
|
+
* itemId: 'p2',
|
|
178
|
+
* {@link Ext.panel.Panel#title title}: 'Panel 2',
|
|
179
|
+
* {@link Ext.Component#height height}: 150
|
|
180
|
+
* }
|
|
181
|
+
* ]
|
|
182
|
+
* })
|
|
183
|
+
* p1 = c.{@link Ext.container.Container#getComponent getComponent}('p1'); // not the same as {@link Ext#getCmp Ext.getCmp()}
|
|
184
|
+
* p2 = p1.{@link #ownerCt}.{@link Ext.container.Container#getComponent getComponent}('p2'); // reference via a sibling
|
|
185
|
+
*
|
|
186
|
+
* Also see {@link #id}, `{@link Ext.container.Container#query}`, `{@link Ext.container.Container#down}` and
|
|
187
|
+
* `{@link Ext.container.Container#child}`.
|
|
188
|
+
*
|
|
189
|
+
* **Note**: to access the container of an item see {@link #ownerCt}.
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @property {Ext.Container} ownerCt
|
|
194
|
+
* This Component's owner {@link Ext.container.Container Container} (is set automatically
|
|
195
|
+
* when this Component is added to a Container).
|
|
196
|
+
*
|
|
197
|
+
* **Note**: to access items within the Container see {@link #itemId}.
|
|
198
|
+
* @readonly
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @cfg {String/Object} autoEl
|
|
203
|
+
* A tag name or {@link Ext.DomHelper DomHelper} spec used to create the {@link #getEl Element} which will
|
|
204
|
+
* encapsulate this Component.
|
|
205
|
+
*
|
|
206
|
+
* You do not normally need to specify this. For the base classes {@link Ext.Component} and
|
|
207
|
+
* {@link Ext.container.Container}, this defaults to **'div'**. The more complex Sencha classes use a more
|
|
208
|
+
* complex DOM structure specified by their own {@link #renderTpl}s.
|
|
209
|
+
*
|
|
210
|
+
* This is intended to allow the developer to create application-specific utility Components encapsulated by
|
|
211
|
+
* different DOM elements. Example usage:
|
|
212
|
+
*
|
|
213
|
+
* {
|
|
214
|
+
* xtype: 'component',
|
|
215
|
+
* autoEl: {
|
|
216
|
+
* tag: 'img',
|
|
217
|
+
* src: 'http://www.example.com/example.jpg'
|
|
218
|
+
* }
|
|
219
|
+
* }, {
|
|
220
|
+
* xtype: 'component',
|
|
221
|
+
* autoEl: {
|
|
222
|
+
* tag: 'blockquote',
|
|
223
|
+
* html: 'autoEl is cool!'
|
|
224
|
+
* }
|
|
225
|
+
* }, {
|
|
226
|
+
* xtype: 'container',
|
|
227
|
+
* autoEl: 'ul',
|
|
228
|
+
* cls: 'ux-unordered-list',
|
|
229
|
+
* items: {
|
|
230
|
+
* xtype: 'component',
|
|
231
|
+
* autoEl: 'li',
|
|
232
|
+
* html: 'First list item'
|
|
233
|
+
* }
|
|
234
|
+
* }
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @cfg {Ext.XTemplate/String/String[]} renderTpl
|
|
239
|
+
* An {@link Ext.XTemplate XTemplate} used to create the internal structure inside this Component's encapsulating
|
|
240
|
+
* {@link #getEl Element}.
|
|
241
|
+
*
|
|
242
|
+
* You do not normally need to specify this. For the base classes {@link Ext.Component} and
|
|
243
|
+
* {@link Ext.container.Container}, this defaults to **`null`** which means that they will be initially rendered
|
|
244
|
+
* with no internal structure; they render their {@link #getEl Element} empty. The more specialized ExtJS and Touch
|
|
245
|
+
* classes which use a more complex DOM structure, provide their own template definitions.
|
|
246
|
+
*
|
|
247
|
+
* This is intended to allow the developer to create application-specific utility Components with customized
|
|
248
|
+
* internal structure.
|
|
249
|
+
*
|
|
250
|
+
* Upon rendering, any created child elements may be automatically imported into object properties using the
|
|
251
|
+
* {@link #renderSelectors} and {@link #childEls} options.
|
|
252
|
+
* @protected
|
|
253
|
+
*/
|
|
254
|
+
renderTpl: '{%this.renderContent(out,values)%}',
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @cfg {Object} renderData
|
|
258
|
+
*
|
|
259
|
+
* The data used by {@link #renderTpl} in addition to the following property values of the component:
|
|
260
|
+
*
|
|
261
|
+
* - id
|
|
262
|
+
* - ui
|
|
263
|
+
* - uiCls
|
|
264
|
+
* - baseCls
|
|
265
|
+
* - componentCls
|
|
266
|
+
* - frame
|
|
267
|
+
*
|
|
268
|
+
* See {@link #renderSelectors} and {@link #childEls} for usage examples.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @cfg {Object} renderSelectors
|
|
273
|
+
* An object containing properties specifying {@link Ext.DomQuery DomQuery} selectors which identify child elements
|
|
274
|
+
* created by the render process.
|
|
275
|
+
*
|
|
276
|
+
* After the Component's internal structure is rendered according to the {@link #renderTpl}, this object is iterated through,
|
|
277
|
+
* and the found Elements are added as properties to the Component using the `renderSelector` property name.
|
|
278
|
+
*
|
|
279
|
+
* For example, a Component which renderes a title and description into its element:
|
|
280
|
+
*
|
|
281
|
+
* Ext.create('Ext.Component', {
|
|
282
|
+
* renderTo: Ext.getBody(),
|
|
283
|
+
* renderTpl: [
|
|
284
|
+
* '<h1 class="title">{title}</h1>',
|
|
285
|
+
* '<p>{desc}</p>'
|
|
286
|
+
* ],
|
|
287
|
+
* renderData: {
|
|
288
|
+
* title: "Error",
|
|
289
|
+
* desc: "Something went wrong"
|
|
290
|
+
* },
|
|
291
|
+
* renderSelectors: {
|
|
292
|
+
* titleEl: 'h1.title',
|
|
293
|
+
* descEl: 'p'
|
|
294
|
+
* },
|
|
295
|
+
* listeners: {
|
|
296
|
+
* afterrender: function(cmp){
|
|
297
|
+
* // After rendering the component will have a titleEl and descEl properties
|
|
298
|
+
* cmp.titleEl.setStyle({color: "red"});
|
|
299
|
+
* }
|
|
300
|
+
* }
|
|
301
|
+
* });
|
|
302
|
+
*
|
|
303
|
+
* For a faster, but less flexible, alternative that achieves the same end result (properties for child elements on the
|
|
304
|
+
* Component after render), see {@link #childEls} and {@link #addChildEls}.
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @cfg {Object[]} childEls
|
|
309
|
+
* An array describing the child elements of the Component. Each member of the array
|
|
310
|
+
* is an object with these properties:
|
|
311
|
+
*
|
|
312
|
+
* - `name` - The property name on the Component for the child element.
|
|
313
|
+
* - `itemId` - The id to combine with the Component's id that is the id of the child element.
|
|
314
|
+
* - `id` - The id of the child element.
|
|
315
|
+
*
|
|
316
|
+
* If the array member is a string, it is equivalent to `{ name: m, itemId: m }`.
|
|
317
|
+
*
|
|
318
|
+
* For example, a Component which renders a title and body text:
|
|
319
|
+
*
|
|
320
|
+
* Ext.create('Ext.Component', {
|
|
321
|
+
* renderTo: Ext.getBody(),
|
|
322
|
+
* renderTpl: [
|
|
323
|
+
* '<h1 id="{id}-title">{title}</h1>',
|
|
324
|
+
* '<p>{msg}</p>',
|
|
325
|
+
* ],
|
|
326
|
+
* renderData: {
|
|
327
|
+
* title: "Error",
|
|
328
|
+
* msg: "Something went wrong"
|
|
329
|
+
* },
|
|
330
|
+
* childEls: ["title"],
|
|
331
|
+
* listeners: {
|
|
332
|
+
* afterrender: function(cmp){
|
|
333
|
+
* // After rendering the component will have a title property
|
|
334
|
+
* cmp.title.setStyle({color: "red"});
|
|
335
|
+
* }
|
|
336
|
+
* }
|
|
337
|
+
* });
|
|
338
|
+
*
|
|
339
|
+
* A more flexible, but somewhat slower, approach is {@link #renderSelectors}.
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @cfg {String/HTMLElement/Ext.Element} renderTo
|
|
344
|
+
* Specify the id of the element, a DOM element or an existing Element that this component will be rendered into.
|
|
345
|
+
*
|
|
346
|
+
* **Notes:**
|
|
347
|
+
*
|
|
348
|
+
* Do *not* use this option if the Component is to be a child item of a {@link Ext.container.Container Container}.
|
|
349
|
+
* It is the responsibility of the {@link Ext.container.Container Container}'s
|
|
350
|
+
* {@link Ext.container.Container#layout layout manager} to render and manage its child items.
|
|
351
|
+
*
|
|
352
|
+
* When using this config, a call to render() is not required.
|
|
353
|
+
*
|
|
354
|
+
* See `{@link #render}` also.
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @cfg {Boolean} frame
|
|
359
|
+
* Specify as `true` to have the Component inject framing elements within the Component at render time to provide a
|
|
360
|
+
* graphical rounded frame around the Component content.
|
|
361
|
+
*
|
|
362
|
+
* This is only necessary when running on outdated, or non standard-compliant browsers such as Microsoft's Internet
|
|
363
|
+
* Explorer prior to version 9 which do not support rounded corners natively.
|
|
364
|
+
*
|
|
365
|
+
* The extra space taken up by this framing is available from the read only property {@link #frameSize}.
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @property {Object} frameSize
|
|
370
|
+
* @readonly
|
|
371
|
+
* Indicates the width of any framing elements which were added within the encapsulating element
|
|
372
|
+
* to provide graphical, rounded borders. See the {@link #frame} config.
|
|
373
|
+
*
|
|
374
|
+
* This is an object containing the frame width in pixels for all four sides of the Component containing the
|
|
375
|
+
* following properties:
|
|
376
|
+
*
|
|
377
|
+
* @property {Number} [frameSize.top=0] The width of the top framing element in pixels.
|
|
378
|
+
* @property {Number} [frameSize.right=0] The width of the right framing element in pixels.
|
|
379
|
+
* @property {Number} [frameSize.bottom=0] The width of the bottom framing element in pixels.
|
|
380
|
+
* @property {Number} [frameSize.left=0] The width of the left framing element in pixels.
|
|
381
|
+
* @property {Number} [frameSize.width=0] The total width of the left and right framing elements in pixels.
|
|
382
|
+
* @property {Number} [frameSize.height=0] The total height of the top and right bottom elements in pixels.
|
|
383
|
+
*/
|
|
384
|
+
frameSize: { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0 },
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @cfg {String/Object} componentLayout
|
|
388
|
+
* The sizing and positioning of a Component's internal Elements is the responsibility of the Component's layout
|
|
389
|
+
* manager which sizes a Component's internal structure in response to the Component being sized.
|
|
390
|
+
*
|
|
391
|
+
* Generally, developers will not use this configuration as all provided Components which need their internal
|
|
392
|
+
* elements sizing (Such as {@link Ext.form.field.Base input fields}) come with their own componentLayout managers.
|
|
393
|
+
*
|
|
394
|
+
* The {@link Ext.layout.container.Auto default layout manager} will be used on instances of the base Ext.Component
|
|
395
|
+
* class which simply sizes the Component's encapsulating element to the height and width specified in the
|
|
396
|
+
* {@link #setSize} method.
|
|
397
|
+
*/
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* @cfg {Ext.XTemplate/Ext.Template/String/String[]} tpl
|
|
401
|
+
* An {@link Ext.Template}, {@link Ext.XTemplate} or an array of strings to form an Ext.XTemplate. Used in
|
|
402
|
+
* conjunction with the `{@link #data}` and `{@link #tplWriteMode}` configurations.
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* @cfg {Object} data
|
|
407
|
+
* The initial set of data to apply to the `{@link #tpl}` to update the content area of the Component.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* @cfg {String} xtype
|
|
412
|
+
* This property provides a shorter alternative to creating objects than using a full
|
|
413
|
+
* class name. Using `xtype` is the most common way to define component instances,
|
|
414
|
+
* especially in a container. For example, the items in a form containing text fields
|
|
415
|
+
* could be created explicitly like so:
|
|
416
|
+
*
|
|
417
|
+
* items: [
|
|
418
|
+
* Ext.create('Ext.form.field.Text', {
|
|
419
|
+
* fieldLabel: 'Foo'
|
|
420
|
+
* }),
|
|
421
|
+
* Ext.create('Ext.form.field.Text', {
|
|
422
|
+
* fieldLabel: 'Bar'
|
|
423
|
+
* }),
|
|
424
|
+
* Ext.create('Ext.form.field.Number', {
|
|
425
|
+
* fieldLabel: 'Num'
|
|
426
|
+
* })
|
|
427
|
+
* ]
|
|
428
|
+
*
|
|
429
|
+
* But by using `xtype`, the above becomes:
|
|
430
|
+
*
|
|
431
|
+
* items: [
|
|
432
|
+
* {
|
|
433
|
+
* xtype: 'textfield',
|
|
434
|
+
* fieldLabel: 'Foo'
|
|
435
|
+
* },
|
|
436
|
+
* {
|
|
437
|
+
* xtype: 'textfield',
|
|
438
|
+
* fieldLabel: 'Bar'
|
|
439
|
+
* },
|
|
440
|
+
* {
|
|
441
|
+
* xtype: 'numberfield',
|
|
442
|
+
* fieldLabel: 'Num'
|
|
443
|
+
* }
|
|
444
|
+
* ]
|
|
445
|
+
*
|
|
446
|
+
* When the `xtype` is common to many items, {@link Ext.container.AbstractContainer#defaultType}
|
|
447
|
+
* is another way to specify the `xtype` for all items that don't have an explicit `xtype`:
|
|
448
|
+
*
|
|
449
|
+
* defaultType: 'textfield',
|
|
450
|
+
* items: [
|
|
451
|
+
* { fieldLabel: 'Foo' },
|
|
452
|
+
* { fieldLabel: 'Bar' },
|
|
453
|
+
* { fieldLabel: 'Num', xtype: 'numberfield' }
|
|
454
|
+
* ]
|
|
455
|
+
*
|
|
456
|
+
* Each member of the `items` array is now just a "configuration object". These objects
|
|
457
|
+
* are used to create and configure component instances. A configuration object can be
|
|
458
|
+
* manually used to instantiate a component using {@link Ext#widget}:
|
|
459
|
+
*
|
|
460
|
+
* var text1 = Ext.create('Ext.form.field.Text', {
|
|
461
|
+
* fieldLabel: 'Foo'
|
|
462
|
+
* });
|
|
463
|
+
*
|
|
464
|
+
* // or alternatively:
|
|
465
|
+
*
|
|
466
|
+
* var text1 = Ext.widget({
|
|
467
|
+
* xtype: 'textfield',
|
|
468
|
+
* fieldLabel: 'Foo'
|
|
469
|
+
* });
|
|
470
|
+
*
|
|
471
|
+
* This conversion of configuration objects into instantiated components is done when
|
|
472
|
+
* a container is created as part of its {Ext.container.AbstractContainer#initComponent}
|
|
473
|
+
* process. As part of the same process, the `items` array is converted from its raw
|
|
474
|
+
* array form into a {@link Ext.util.MixedCollection} instance.
|
|
475
|
+
*
|
|
476
|
+
* You can define your own `xtype` on a custom {@link Ext.Component component} by specifying
|
|
477
|
+
* the `xtype` property in {@link Ext#define}. For example:
|
|
478
|
+
*
|
|
479
|
+
* Ext.define('MyApp.PressMeButton', {
|
|
480
|
+
* extend: 'Ext.button.Button',
|
|
481
|
+
* xtype: 'pressmebutton',
|
|
482
|
+
* text: 'Press Me'
|
|
483
|
+
* });
|
|
484
|
+
*
|
|
485
|
+
* Care should be taken when naming an `xtype` in a custom component because there is
|
|
486
|
+
* a single, shared scope for all xtypes. Third part components should consider using
|
|
487
|
+
* a prefix to avoid collisions.
|
|
488
|
+
*
|
|
489
|
+
* Ext.define('Foo.form.CoolButton', {
|
|
490
|
+
* extend: 'Ext.button.Button',
|
|
491
|
+
* xtype: 'ux-coolbutton',
|
|
492
|
+
* text: 'Cool!'
|
|
493
|
+
* });
|
|
494
|
+
*/
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* @cfg {String} tplWriteMode
|
|
498
|
+
* The Ext.(X)Template method to use when updating the content area of the Component.
|
|
499
|
+
* See `{@link Ext.XTemplate#overwrite}` for information on default mode.
|
|
500
|
+
*/
|
|
501
|
+
tplWriteMode: 'overwrite',
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* @cfg {String} [baseCls='x-component']
|
|
505
|
+
* The base CSS class to apply to this components's element. This will also be prepended to elements within this
|
|
506
|
+
* component like Panel's body will get a class x-panel-body. This means that if you create a subclass of Panel, and
|
|
507
|
+
* you want it to get all the Panels styling for the element and the body, you leave the baseCls x-panel and use
|
|
508
|
+
* componentCls to add specific styling for this component.
|
|
509
|
+
*/
|
|
510
|
+
baseCls: Ext.baseCSSPrefix + 'component',
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @cfg {String} componentCls
|
|
514
|
+
* CSS Class to be added to a components root level element to give distinction to it via styling.
|
|
515
|
+
*/
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @cfg {String} [cls='']
|
|
519
|
+
* An optional extra CSS class that will be added to this component's Element. This can be useful
|
|
520
|
+
* for adding customized styles to the component or any of its children using standard CSS rules.
|
|
521
|
+
*/
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* @cfg {String} [overCls='']
|
|
525
|
+
* An optional extra CSS class that will be added to this component's Element when the mouse moves over the Element,
|
|
526
|
+
* and removed when the mouse moves out. This can be useful for adding customized 'active' or 'hover' styles to the
|
|
527
|
+
* component or any of its children using standard CSS rules.
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @cfg {String} [disabledCls='x-item-disabled']
|
|
532
|
+
* CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'.
|
|
533
|
+
*/
|
|
534
|
+
disabledCls: Ext.baseCSSPrefix + 'item-disabled',
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @cfg {String/String[]} ui
|
|
538
|
+
* A set style for a component. Can be a string or an Array of multiple strings (UIs)
|
|
539
|
+
*/
|
|
540
|
+
ui: 'default',
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* @cfg {String[]} uiCls
|
|
544
|
+
* An array of of classNames which are currently applied to this component
|
|
545
|
+
* @private
|
|
546
|
+
*/
|
|
547
|
+
uiCls: [],
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @cfg {String/Object} style
|
|
551
|
+
* A custom style specification to be applied to this component's Element. Should be a valid argument to
|
|
552
|
+
* {@link Ext.Element#applyStyles}.
|
|
553
|
+
*
|
|
554
|
+
* new Ext.panel.Panel({
|
|
555
|
+
* title: 'Some Title',
|
|
556
|
+
* renderTo: Ext.getBody(),
|
|
557
|
+
* width: 400, height: 300,
|
|
558
|
+
* layout: 'form',
|
|
559
|
+
* items: [{
|
|
560
|
+
* xtype: 'textarea',
|
|
561
|
+
* style: {
|
|
562
|
+
* width: '95%',
|
|
563
|
+
* marginBottom: '10px'
|
|
564
|
+
* }
|
|
565
|
+
* },
|
|
566
|
+
* new Ext.button.Button({
|
|
567
|
+
* text: 'Send',
|
|
568
|
+
* minWidth: '100',
|
|
569
|
+
* style: {
|
|
570
|
+
* marginBottom: '10px'
|
|
571
|
+
* }
|
|
572
|
+
* })
|
|
573
|
+
* ]
|
|
574
|
+
* });
|
|
575
|
+
*/
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @cfg {Number} width
|
|
579
|
+
* The width of this component in pixels.
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* @cfg {Number} height
|
|
584
|
+
* The height of this component in pixels.
|
|
585
|
+
*/
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* @cfg {Number/String} border
|
|
589
|
+
* Specifies the border for this component. The border can be a single numeric value to apply to all sides or it can
|
|
590
|
+
* be a CSS style specification for each style, for example: '10 5 3 10'.
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* @cfg {Number/String} padding
|
|
595
|
+
* Specifies the padding for this component. The padding can be a single numeric value to apply to all sides or it
|
|
596
|
+
* can be a CSS style specification for each style, for example: '10 5 3 10'.
|
|
597
|
+
*/
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* @cfg {Number/String} margin
|
|
601
|
+
* Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or it can
|
|
602
|
+
* be a CSS style specification for each style, for example: '10 5 3 10'.
|
|
603
|
+
*/
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* @cfg {Boolean} hidden
|
|
607
|
+
* True to hide the component.
|
|
608
|
+
*/
|
|
609
|
+
hidden: false,
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @cfg {Boolean} disabled
|
|
613
|
+
* True to disable the component.
|
|
614
|
+
*/
|
|
615
|
+
disabled: false,
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* @cfg {Boolean} [draggable=false]
|
|
619
|
+
* Allows the component to be dragged.
|
|
620
|
+
*/
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* @property {Boolean} draggable
|
|
624
|
+
* Indicates whether or not the component can be dragged.
|
|
625
|
+
* @readonly
|
|
626
|
+
*/
|
|
627
|
+
draggable: false,
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* @cfg {Boolean} floating
|
|
631
|
+
* Create the Component as a floating and use absolute positioning.
|
|
632
|
+
*
|
|
633
|
+
* The z-index of floating Components is handled by a ZIndexManager. If you simply render a floating Component into the DOM, it will be managed
|
|
634
|
+
* by the global {@link Ext.WindowManager WindowManager}.
|
|
635
|
+
*
|
|
636
|
+
* If you include a floating Component as a child item of a Container, then upon render, ExtJS will seek an ancestor floating Component to house a new
|
|
637
|
+
* ZIndexManager instance to manage its descendant floaters. If no floating ancestor can be found, the global WindowManager will be used.
|
|
638
|
+
*
|
|
639
|
+
* When a floating Component which has a ZindexManager managing descendant floaters is destroyed, those descendant floaters will also be destroyed.
|
|
640
|
+
*/
|
|
641
|
+
floating: false,
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* @cfg {String} hideMode
|
|
645
|
+
* A String which specifies how this Component's encapsulating DOM element will be hidden. Values may be:
|
|
646
|
+
*
|
|
647
|
+
* - `'display'` : The Component will be hidden using the `display: none` style.
|
|
648
|
+
* - `'visibility'` : The Component will be hidden using the `visibility: hidden` style.
|
|
649
|
+
* - `'offsets'` : The Component will be hidden by absolutely positioning it out of the visible area of the document.
|
|
650
|
+
* This is useful when a hidden Component must maintain measurable dimensions. Hiding using `display` results in a
|
|
651
|
+
* Component having zero dimensions.
|
|
652
|
+
*/
|
|
653
|
+
hideMode: 'display',
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* @cfg {String} contentEl
|
|
657
|
+
* Specify an existing HTML element, or the `id` of an existing HTML element to use as the content for this component.
|
|
658
|
+
*
|
|
659
|
+
* This config option is used to take an existing HTML element and place it in the layout element of a new component
|
|
660
|
+
* (it simply moves the specified DOM element _after the Component is rendered_ to use as the content.
|
|
661
|
+
*
|
|
662
|
+
* **Notes:**
|
|
663
|
+
*
|
|
664
|
+
* The specified HTML element is appended to the layout element of the component _after any configured
|
|
665
|
+
* {@link #html HTML} has been inserted_, and so the document will not contain this element at the time
|
|
666
|
+
* the {@link #render} event is fired.
|
|
667
|
+
*
|
|
668
|
+
* The specified HTML element used will not participate in any **`{@link Ext.container.Container#layout layout}`**
|
|
669
|
+
* scheme that the Component may use. It is just HTML. Layouts operate on child
|
|
670
|
+
* **`{@link Ext.container.Container#cfg-items items}`**.
|
|
671
|
+
*
|
|
672
|
+
* Add either the `x-hidden` or the `x-hide-display` CSS class to prevent a brief flicker of the content before it
|
|
673
|
+
* is rendered to the panel.
|
|
674
|
+
*/
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* @cfg {String/Object} [html='']
|
|
678
|
+
* An HTML fragment, or a {@link Ext.DomHelper DomHelper} specification to use as the layout element content.
|
|
679
|
+
* The HTML content is added after the component is rendered, so the document will not contain this HTML at the time
|
|
680
|
+
* the {@link #render} event is fired. This content is inserted into the body _before_ any configured {@link #contentEl}
|
|
681
|
+
* is appended.
|
|
682
|
+
*/
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* @cfg {Boolean} styleHtmlContent
|
|
686
|
+
* True to automatically style the html inside the content target of this component (body for panels).
|
|
687
|
+
*/
|
|
688
|
+
styleHtmlContent: false,
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* @cfg {String} [styleHtmlCls='x-html']
|
|
692
|
+
* The class that is added to the content target when you set styleHtmlContent to true.
|
|
693
|
+
*/
|
|
694
|
+
styleHtmlCls: Ext.baseCSSPrefix + 'html',
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* @cfg {Number} minHeight
|
|
698
|
+
* The minimum value in pixels which this Component will set its height to.
|
|
699
|
+
*
|
|
700
|
+
* **Warning:** This will override any size management applied by layout managers.
|
|
701
|
+
*/
|
|
702
|
+
/**
|
|
703
|
+
* @cfg {Number} minWidth
|
|
704
|
+
* The minimum value in pixels which this Component will set its width to.
|
|
705
|
+
*
|
|
706
|
+
* **Warning:** This will override any size management applied by layout managers.
|
|
707
|
+
*/
|
|
708
|
+
/**
|
|
709
|
+
* @cfg {Number} maxHeight
|
|
710
|
+
* The maximum value in pixels which this Component will set its height to.
|
|
711
|
+
*
|
|
712
|
+
* **Warning:** This will override any size management applied by layout managers.
|
|
713
|
+
*/
|
|
714
|
+
/**
|
|
715
|
+
* @cfg {Number} maxWidth
|
|
716
|
+
* The maximum value in pixels which this Component will set its width to.
|
|
717
|
+
*
|
|
718
|
+
* **Warning:** This will override any size management applied by layout managers.
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* @cfg {Ext.ComponentLoader/Object} loader
|
|
723
|
+
* A configuration object or an instance of a {@link Ext.ComponentLoader} to load remote content for this Component.
|
|
724
|
+
*/
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* @cfg {Boolean} autoShow
|
|
728
|
+
* True to automatically show the component upon creation. This config option may only be used for
|
|
729
|
+
* {@link #floating} components or components that use {@link #autoRender}. Defaults to false.
|
|
730
|
+
*/
|
|
731
|
+
autoShow: false,
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* @cfg {Boolean/String/HTMLElement/Ext.Element} autoRender
|
|
735
|
+
* This config is intended mainly for non-{@link #floating} Components which may or may not be shown. Instead of using
|
|
736
|
+
* {@link #renderTo} in the configuration, and rendering upon construction, this allows a Component to render itself
|
|
737
|
+
* upon first _{@link #method-show}_. If {@link #floating} is true, the value of this config is omited as if it is `true`.
|
|
738
|
+
*
|
|
739
|
+
* Specify as `true` to have this Component render to the document body upon first show.
|
|
740
|
+
*
|
|
741
|
+
* Specify as an element, or the ID of an element to have this Component render to a specific element upon first
|
|
742
|
+
* show.
|
|
743
|
+
*/
|
|
744
|
+
autoRender: false,
|
|
745
|
+
|
|
746
|
+
// @private
|
|
747
|
+
allowDomMove: true,
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* @cfg {Object/Object[]} plugins
|
|
751
|
+
* An object or array of objects that will provide custom functionality for this component. The only requirement for
|
|
752
|
+
* a valid plugin is that it contain an init method that accepts a reference of type Ext.Component. When a component
|
|
753
|
+
* is created, if any plugins are available, the component will call the init method on each plugin, passing a
|
|
754
|
+
* reference to itself. Each plugin can then call methods or respond to events on the component as needed to provide
|
|
755
|
+
* its functionality.
|
|
756
|
+
*/
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* @property {Boolean} rendered
|
|
760
|
+
* Indicates whether or not the component has been rendered.
|
|
761
|
+
* @readonly
|
|
762
|
+
*/
|
|
763
|
+
rendered: false,
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* @property {Number} componentLayoutCounter
|
|
767
|
+
* @private
|
|
768
|
+
* The number of component layout calls made on this object.
|
|
769
|
+
*/
|
|
770
|
+
componentLayoutCounter: 0,
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* @cfg {Boolean/Number} [shrinkWrap=2]
|
|
774
|
+
*
|
|
775
|
+
* If this property is a number, it is interpreted as follows:
|
|
776
|
+
*
|
|
777
|
+
* - 0: Neither width nor height depend on content. This is equivalent to `false`.
|
|
778
|
+
* - 1: Width depends on content (shrink wraps), but height does not.
|
|
779
|
+
* - 2: Height depends on content (shrink wraps), but width does not. The default.
|
|
780
|
+
* - 3: Both width and height depend on content (shrink wrap). This is equivalent to `true`.
|
|
781
|
+
*
|
|
782
|
+
* In CSS terms, shrink-wrap width is analogous to an inline-block element as opposed
|
|
783
|
+
* to a block-level element. Some container layouts always shrink-wrap their children,
|
|
784
|
+
* effectively ignoring this property (e.g., {@link Ext.layout.container.HBox},
|
|
785
|
+
* {@link Ext.layout.container.VBox}, {@link Ext.layout.component.Dock}).
|
|
786
|
+
*/
|
|
787
|
+
shrinkWrap: 2,
|
|
788
|
+
|
|
789
|
+
weight: 0,
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* @property {Boolean} maskOnDisable
|
|
793
|
+
* This is an internal flag that you use when creating custom components. By default this is set to true which means
|
|
794
|
+
* that every component gets a mask when its disabled. Components like FieldContainer, FieldSet, Field, Button, Tab
|
|
795
|
+
* override this property to false since they want to implement custom disable logic.
|
|
796
|
+
*/
|
|
797
|
+
maskOnDisable: true,
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* @property {Boolean} [_isLayoutRoot=false]
|
|
801
|
+
* Setting this property to `true` causes the {@link #isLayoutRoot} method to return
|
|
802
|
+
* `true` and stop the search for the top-most component for a layout.
|
|
803
|
+
* @protected
|
|
804
|
+
*/
|
|
805
|
+
_isLayoutRoot: false,
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Creates new Component.
|
|
809
|
+
* @param {Object} config (optional) Config object.
|
|
810
|
+
*/
|
|
811
|
+
constructor : function(config) {
|
|
812
|
+
var me = this,
|
|
813
|
+
i, len, xhooks;
|
|
814
|
+
|
|
815
|
+
if (config) {
|
|
816
|
+
Ext.apply(me, config);
|
|
817
|
+
|
|
818
|
+
xhooks = me.xhooks;
|
|
819
|
+
if (xhooks) {
|
|
820
|
+
delete me.xhooks;
|
|
821
|
+
Ext.override(me, xhooks);
|
|
822
|
+
}
|
|
823
|
+
} else {
|
|
824
|
+
config = {};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
me.initialConfig = config;
|
|
828
|
+
|
|
829
|
+
me.mixins.elementCt.constructor.call(me);
|
|
830
|
+
|
|
831
|
+
me.addEvents(
|
|
832
|
+
/**
|
|
833
|
+
* @event beforeactivate
|
|
834
|
+
* Fires before a Component has been visually activated. Returning false from an event listener can prevent
|
|
835
|
+
* the activate from occurring.
|
|
836
|
+
* @param {Ext.Component} this
|
|
837
|
+
*/
|
|
838
|
+
'beforeactivate',
|
|
839
|
+
/**
|
|
840
|
+
* @event activate
|
|
841
|
+
* Fires after a Component has been visually activated.
|
|
842
|
+
* @param {Ext.Component} this
|
|
843
|
+
*/
|
|
844
|
+
'activate',
|
|
845
|
+
/**
|
|
846
|
+
* @event beforedeactivate
|
|
847
|
+
* Fires before a Component has been visually deactivated. Returning false from an event listener can
|
|
848
|
+
* prevent the deactivate from occurring.
|
|
849
|
+
* @param {Ext.Component} this
|
|
850
|
+
*/
|
|
851
|
+
'beforedeactivate',
|
|
852
|
+
/**
|
|
853
|
+
* @event deactivate
|
|
854
|
+
* Fires after a Component has been visually deactivated.
|
|
855
|
+
* @param {Ext.Component} this
|
|
856
|
+
*/
|
|
857
|
+
'deactivate',
|
|
858
|
+
/**
|
|
859
|
+
* @event added
|
|
860
|
+
* Fires after a Component had been added to a Container.
|
|
861
|
+
* @param {Ext.Component} this
|
|
862
|
+
* @param {Ext.container.Container} container Parent Container
|
|
863
|
+
* @param {Number} pos position of Component
|
|
864
|
+
*/
|
|
865
|
+
'added',
|
|
866
|
+
/**
|
|
867
|
+
* @event disable
|
|
868
|
+
* Fires after the component is disabled.
|
|
869
|
+
* @param {Ext.Component} this
|
|
870
|
+
*/
|
|
871
|
+
'disable',
|
|
872
|
+
/**
|
|
873
|
+
* @event enable
|
|
874
|
+
* Fires after the component is enabled.
|
|
875
|
+
* @param {Ext.Component} this
|
|
876
|
+
*/
|
|
877
|
+
'enable',
|
|
878
|
+
/**
|
|
879
|
+
* @event beforeshow
|
|
880
|
+
* Fires before the component is shown when calling the {@link #show} method. Return false from an event
|
|
881
|
+
* handler to stop the show.
|
|
882
|
+
* @param {Ext.Component} this
|
|
883
|
+
*/
|
|
884
|
+
'beforeshow',
|
|
885
|
+
/**
|
|
886
|
+
* @event show
|
|
887
|
+
* Fires after the component is shown when calling the {@link #show} method.
|
|
888
|
+
* @param {Ext.Component} this
|
|
889
|
+
*/
|
|
890
|
+
'show',
|
|
891
|
+
/**
|
|
892
|
+
* @event beforehide
|
|
893
|
+
* Fires before the component is hidden when calling the {@link #hide} method. Return false from an event
|
|
894
|
+
* handler to stop the hide.
|
|
895
|
+
* @param {Ext.Component} this
|
|
896
|
+
*/
|
|
897
|
+
'beforehide',
|
|
898
|
+
/**
|
|
899
|
+
* @event hide
|
|
900
|
+
* Fires after the component is hidden. Fires after the component is hidden when calling the {@link #hide}
|
|
901
|
+
* method.
|
|
902
|
+
* @param {Ext.Component} this
|
|
903
|
+
*/
|
|
904
|
+
'hide',
|
|
905
|
+
/**
|
|
906
|
+
* @event removed
|
|
907
|
+
* Fires when a component is removed from an Ext.container.Container
|
|
908
|
+
* @param {Ext.Component} this
|
|
909
|
+
* @param {Ext.container.Container} ownerCt Container which holds the component
|
|
910
|
+
*/
|
|
911
|
+
'removed',
|
|
912
|
+
/**
|
|
913
|
+
* @event beforerender
|
|
914
|
+
* Fires before the component is {@link #rendered}. Return false from an event handler to stop the
|
|
915
|
+
* {@link #render}.
|
|
916
|
+
* @param {Ext.Component} this
|
|
917
|
+
*/
|
|
918
|
+
'beforerender',
|
|
919
|
+
/**
|
|
920
|
+
* @event render
|
|
921
|
+
* Fires after the component markup is {@link #rendered}.
|
|
922
|
+
* @param {Ext.Component} this
|
|
923
|
+
*/
|
|
924
|
+
'render',
|
|
925
|
+
/**
|
|
926
|
+
* @event afterrender
|
|
927
|
+
* Fires after the component rendering is finished.
|
|
928
|
+
*
|
|
929
|
+
* The afterrender event is fired after this Component has been {@link #rendered}, been postprocesed by any
|
|
930
|
+
* afterRender method defined for the Component.
|
|
931
|
+
* @param {Ext.Component} this
|
|
932
|
+
*/
|
|
933
|
+
'afterrender',
|
|
934
|
+
/**
|
|
935
|
+
* @event boxready
|
|
936
|
+
* Fires *one time* - after the component has been layed out for the first time at its initial size.
|
|
937
|
+
* @param {Ext.Component} this
|
|
938
|
+
* @param {Number} width The initial width
|
|
939
|
+
* @param {Number} height The initial height
|
|
940
|
+
*/
|
|
941
|
+
'boxready',
|
|
942
|
+
/**
|
|
943
|
+
* @event beforedestroy
|
|
944
|
+
* Fires before the component is {@link #method-destroy}ed. Return false from an event handler to stop the
|
|
945
|
+
* {@link #method-destroy}.
|
|
946
|
+
* @param {Ext.Component} this
|
|
947
|
+
*/
|
|
948
|
+
'beforedestroy',
|
|
949
|
+
/**
|
|
950
|
+
* @event destroy
|
|
951
|
+
* Fires after the component is {@link #method-destroy}ed.
|
|
952
|
+
* @param {Ext.Component} this
|
|
953
|
+
*/
|
|
954
|
+
'destroy',
|
|
955
|
+
/**
|
|
956
|
+
* @event resize
|
|
957
|
+
* Fires after the component is resized. Note that this does *not* fire when the component is first layed out at its initial
|
|
958
|
+
* size. To hook that point in the lifecycle, use the {@link #boxready} event.
|
|
959
|
+
* @param {Ext.Component} this
|
|
960
|
+
* @param {Number} width The new width that was set
|
|
961
|
+
* @param {Number} height The new height that was set
|
|
962
|
+
* @param {Number} oldWidth The previous width
|
|
963
|
+
* @param {Number} oldHeight The previous height
|
|
964
|
+
*/
|
|
965
|
+
'resize',
|
|
966
|
+
/**
|
|
967
|
+
* @event move
|
|
968
|
+
* Fires after the component is moved.
|
|
969
|
+
* @param {Ext.Component} this
|
|
970
|
+
* @param {Number} x The new x position
|
|
971
|
+
* @param {Number} y The new y position
|
|
972
|
+
*/
|
|
973
|
+
'move',
|
|
974
|
+
/**
|
|
975
|
+
* @event focus
|
|
976
|
+
* Fires when this Component receives focus.
|
|
977
|
+
* @param {Ext.Component} this
|
|
978
|
+
* @param {Ext.EventObject} The focus event.
|
|
979
|
+
*/
|
|
980
|
+
'focus',
|
|
981
|
+
/**
|
|
982
|
+
* @event blur
|
|
983
|
+
* Fires when this Component loses focus.
|
|
984
|
+
* @param {Ext.Component} this
|
|
985
|
+
* @param {Ext.EventObject} The blur event.
|
|
986
|
+
*/
|
|
987
|
+
'blur'
|
|
988
|
+
);
|
|
989
|
+
|
|
990
|
+
me.getId();
|
|
991
|
+
|
|
992
|
+
me.setupProtoEl();
|
|
993
|
+
|
|
994
|
+
// initComponent, beforeRender, or event handlers may have set the style or cls property since the protoEl was set up
|
|
995
|
+
// so we must apply styles and classes here too.
|
|
996
|
+
if (me.cls) {
|
|
997
|
+
me.initialCls = me.cls;
|
|
998
|
+
me.protoEl.addCls(me.cls);
|
|
999
|
+
}
|
|
1000
|
+
if (me.style) {
|
|
1001
|
+
me.initialStyle = me.style;
|
|
1002
|
+
me.protoEl.setStyle(me.style);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
me.mons = [];
|
|
1006
|
+
me.renderData = me.renderData || {};
|
|
1007
|
+
me.renderSelectors = me.renderSelectors || {};
|
|
1008
|
+
|
|
1009
|
+
if (me.plugins) {
|
|
1010
|
+
me.plugins = [].concat(me.plugins);
|
|
1011
|
+
me.constructPlugins();
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// we need this before we call initComponent
|
|
1015
|
+
if (!me.hasListeners) {
|
|
1016
|
+
me.hasListeners = new me.HasListeners();
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
me.initComponent();
|
|
1020
|
+
|
|
1021
|
+
// ititComponent gets a chance to change the id property before registering
|
|
1022
|
+
Ext.ComponentManager.register(me);
|
|
1023
|
+
|
|
1024
|
+
// Dont pass the config so that it is not applied to 'this' again
|
|
1025
|
+
me.mixins.observable.constructor.call(me);
|
|
1026
|
+
me.mixins.state.constructor.call(me, config);
|
|
1027
|
+
|
|
1028
|
+
// Save state on resize.
|
|
1029
|
+
this.addStateEvents('resize');
|
|
1030
|
+
|
|
1031
|
+
// Move this into Observable?
|
|
1032
|
+
if (me.plugins) {
|
|
1033
|
+
me.plugins = [].concat(me.plugins);
|
|
1034
|
+
for (i = 0, len = me.plugins.length; i < len; i++) {
|
|
1035
|
+
me.plugins[i] = me.initPlugin(me.plugins[i]);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
me.loader = me.getLoader();
|
|
1040
|
+
|
|
1041
|
+
if (me.renderTo) {
|
|
1042
|
+
me.render(me.renderTo);
|
|
1043
|
+
// EXTJSIV-1935 - should be a way to do afterShow or something, but that
|
|
1044
|
+
// won't work. Likewise, rendering hidden and then showing (w/autoShow) has
|
|
1045
|
+
// implications to afterRender so we cannot do that.
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
if (me.autoShow) {
|
|
1049
|
+
me.show();
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
//<debug>
|
|
1053
|
+
if (Ext.isDefined(me.disabledClass)) {
|
|
1054
|
+
if (Ext.isDefined(Ext.global.console)) {
|
|
1055
|
+
Ext.global.console.warn('Ext.Component: disabledClass has been deprecated. Please use disabledCls.');
|
|
1056
|
+
}
|
|
1057
|
+
me.disabledCls = me.disabledClass;
|
|
1058
|
+
delete me.disabledClass;
|
|
1059
|
+
}
|
|
1060
|
+
//</debug>
|
|
1061
|
+
},
|
|
1062
|
+
|
|
1063
|
+
initComponent: function () {
|
|
1064
|
+
// This is called again here to allow derived classes to add plugin configs to the
|
|
1065
|
+
// plugins array before calling down to this, the base initComponent.
|
|
1066
|
+
this.constructPlugins();
|
|
1067
|
+
|
|
1068
|
+
// this will properly (ignore or) constrain the configured width/height to their
|
|
1069
|
+
// min/max values for consistency.
|
|
1070
|
+
this.setSize(this.width, this.height);
|
|
1071
|
+
},
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* The supplied default state gathering method for the AbstractComponent class.
|
|
1075
|
+
*
|
|
1076
|
+
* This method returns dimension settings such as `flex`, `anchor`, `width` and `height` along with `collapsed`
|
|
1077
|
+
* state.
|
|
1078
|
+
*
|
|
1079
|
+
* Subclasses which implement more complex state should call the superclass's implementation, and apply their state
|
|
1080
|
+
* to the result if this basic state is to be saved.
|
|
1081
|
+
*
|
|
1082
|
+
* Note that Component state will only be saved if the Component has a {@link #stateId} and there as a StateProvider
|
|
1083
|
+
* configured for the document.
|
|
1084
|
+
*
|
|
1085
|
+
* @return {Object}
|
|
1086
|
+
*/
|
|
1087
|
+
getState: function() {
|
|
1088
|
+
var me = this,
|
|
1089
|
+
state = null,
|
|
1090
|
+
sizeModel = me.getSizeModel();
|
|
1091
|
+
|
|
1092
|
+
if (sizeModel.width.configured) {
|
|
1093
|
+
state = me.addPropertyToState(state, 'width');
|
|
1094
|
+
}
|
|
1095
|
+
if (sizeModel.height.configured) {
|
|
1096
|
+
state = me.addPropertyToState(state, 'height');
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
return state;
|
|
1100
|
+
},
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Save a property to the given state object if it is not its default or configured
|
|
1104
|
+
* value.
|
|
1105
|
+
*
|
|
1106
|
+
* @param {Object} state The state object
|
|
1107
|
+
* @param {String} propName The name of the property on this object to save.
|
|
1108
|
+
* @param {String} [value] The value of the state property (defaults to `this[propName]`).
|
|
1109
|
+
* @return {Boolean} The state object or a new object if state was null and the property
|
|
1110
|
+
* was saved.
|
|
1111
|
+
* @protected
|
|
1112
|
+
*/
|
|
1113
|
+
addPropertyToState: function (state, propName, value) {
|
|
1114
|
+
var me = this,
|
|
1115
|
+
len = arguments.length;
|
|
1116
|
+
|
|
1117
|
+
// If the property is inherited, it is a default and we don't want to save it to
|
|
1118
|
+
// the state, however if we explicitly specify a value, always save it
|
|
1119
|
+
if (len == 3 || me.hasOwnProperty(propName)) {
|
|
1120
|
+
if (len < 3) {
|
|
1121
|
+
value = me[propName];
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// If the property has the same value as was initially configured, again, we
|
|
1125
|
+
// don't want to save it.
|
|
1126
|
+
if (value !== me.initialConfig[propName]) {
|
|
1127
|
+
(state || (state = {}))[propName] = value;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
return state;
|
|
1132
|
+
},
|
|
1133
|
+
|
|
1134
|
+
show: Ext.emptyFn,
|
|
1135
|
+
|
|
1136
|
+
animate: function(animObj) {
|
|
1137
|
+
var me = this,
|
|
1138
|
+
hasToWidth,
|
|
1139
|
+
hasToHeight,
|
|
1140
|
+
toHeight,
|
|
1141
|
+
toWidth,
|
|
1142
|
+
to,
|
|
1143
|
+
clearWidth,
|
|
1144
|
+
clearHeight,
|
|
1145
|
+
curWidth, w, curHeight, h, needsResize;
|
|
1146
|
+
|
|
1147
|
+
animObj = animObj || {};
|
|
1148
|
+
to = animObj.to || {};
|
|
1149
|
+
|
|
1150
|
+
if (Ext.fx.Manager.hasFxBlock(me.id)) {
|
|
1151
|
+
return me;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
hasToWidth = Ext.isDefined(to.width);
|
|
1155
|
+
if (hasToWidth) {
|
|
1156
|
+
toWidth = Ext.Number.constrain(to.width, me.minWidth, me.maxWidth);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
hasToHeight = Ext.isDefined(to.height);
|
|
1160
|
+
if (hasToHeight) {
|
|
1161
|
+
toHeight = Ext.Number.constrain(to.height, me.minHeight, me.maxHeight);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
// Special processing for animating Component dimensions.
|
|
1165
|
+
if (!animObj.dynamic && (hasToWidth || hasToHeight)) {
|
|
1166
|
+
curWidth = (animObj.from ? animObj.from.width : undefined) || me.getWidth();
|
|
1167
|
+
w = curWidth;
|
|
1168
|
+
curHeight = (animObj.from ? animObj.from.height : undefined) || me.getHeight();
|
|
1169
|
+
h = curHeight;
|
|
1170
|
+
needsResize = false;
|
|
1171
|
+
|
|
1172
|
+
if (hasToHeight && toHeight > curHeight) {
|
|
1173
|
+
h = toHeight;
|
|
1174
|
+
needsResize = true;
|
|
1175
|
+
}
|
|
1176
|
+
if (hasToWidth && toWidth > curWidth) {
|
|
1177
|
+
w = toWidth;
|
|
1178
|
+
needsResize = true;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
// If any dimensions are being increased, we must resize the internal structure
|
|
1182
|
+
// of the Component, but then clip it by sizing its encapsulating element back to original dimensions.
|
|
1183
|
+
// The animation will then progressively reveal the larger content.
|
|
1184
|
+
if (needsResize) {
|
|
1185
|
+
clearWidth = !Ext.isNumber(me.width);
|
|
1186
|
+
clearHeight = !Ext.isNumber(me.height);
|
|
1187
|
+
|
|
1188
|
+
me.setSize(w, h);
|
|
1189
|
+
me.el.setSize(curWidth, curHeight);
|
|
1190
|
+
if (clearWidth) {
|
|
1191
|
+
delete me.width;
|
|
1192
|
+
}
|
|
1193
|
+
if (clearHeight) {
|
|
1194
|
+
delete me.height;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
if (hasToWidth) {
|
|
1198
|
+
to.width = toWidth;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
if (hasToHeight) {
|
|
1202
|
+
to.height = toHeight;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return me.mixins.animate.animate.apply(me, arguments);
|
|
1206
|
+
},
|
|
1207
|
+
|
|
1208
|
+
onHide: function() {
|
|
1209
|
+
this.updateLayout({ isRoot: false });
|
|
1210
|
+
},
|
|
1211
|
+
|
|
1212
|
+
onShow : function() {
|
|
1213
|
+
this.updateLayout({ isRoot: false });
|
|
1214
|
+
},
|
|
1215
|
+
|
|
1216
|
+
constructPlugin: function(plugin) {
|
|
1217
|
+
if (plugin.ptype && typeof plugin.init != 'function') {
|
|
1218
|
+
plugin.cmp = this;
|
|
1219
|
+
plugin = Ext.PluginManager.create(plugin);
|
|
1220
|
+
}
|
|
1221
|
+
else if (typeof plugin == 'string') {
|
|
1222
|
+
plugin = Ext.PluginManager.create({
|
|
1223
|
+
ptype: plugin,
|
|
1224
|
+
cmp: this
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
return plugin;
|
|
1228
|
+
},
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Ensures that the plugins array contains fully constructed plugin instances. This converts any configs into their
|
|
1232
|
+
* appropriate instances.
|
|
1233
|
+
*/
|
|
1234
|
+
constructPlugins: function() {
|
|
1235
|
+
var me = this,
|
|
1236
|
+
plugins = me.plugins,
|
|
1237
|
+
i, len;
|
|
1238
|
+
|
|
1239
|
+
if (plugins) {
|
|
1240
|
+
for (i = 0, len = plugins.length; i < len; i++) {
|
|
1241
|
+
// this just returns already-constructed plugin instances...
|
|
1242
|
+
plugins[i] = me.constructPlugin(plugins[i]);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
|
|
1247
|
+
// @private
|
|
1248
|
+
initPlugin : function(plugin) {
|
|
1249
|
+
plugin.init(this);
|
|
1250
|
+
|
|
1251
|
+
return plugin;
|
|
1252
|
+
},
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* @private
|
|
1256
|
+
* Injected as an override by Ext.Aria.initialize
|
|
1257
|
+
*/
|
|
1258
|
+
updateAria: Ext.emptyFn,
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Called by Component#doAutoRender
|
|
1262
|
+
*
|
|
1263
|
+
* Register a Container configured `floating: true` with this Component's {@link Ext.ZIndexManager ZIndexManager}.
|
|
1264
|
+
*
|
|
1265
|
+
* Components added in ths way will not participate in any layout, but will be rendered
|
|
1266
|
+
* upon first show in the way that {@link Ext.window.Window Window}s are.
|
|
1267
|
+
*/
|
|
1268
|
+
registerFloatingItem: function(cmp) {
|
|
1269
|
+
var me = this;
|
|
1270
|
+
if (!me.floatingItems) {
|
|
1271
|
+
me.floatingItems = new Ext.ZIndexManager(me);
|
|
1272
|
+
}
|
|
1273
|
+
me.floatingItems.register(cmp);
|
|
1274
|
+
},
|
|
1275
|
+
|
|
1276
|
+
unregisterFloatingItem: function(cmp) {
|
|
1277
|
+
var me = this;
|
|
1278
|
+
if (me.floatingItems) {
|
|
1279
|
+
me.floatingItems.unregister(cmp);
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
|
|
1283
|
+
layoutSuspendCount: 0,
|
|
1284
|
+
|
|
1285
|
+
suspendLayouts: function () {
|
|
1286
|
+
var me = this;
|
|
1287
|
+
if (!me.rendered) {
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
if (++me.layoutSuspendCount == 1) {
|
|
1291
|
+
me.suspendLayout = true;
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
|
|
1295
|
+
resumeLayouts: function (flushOptions) {
|
|
1296
|
+
var me = this;
|
|
1297
|
+
if (!me.rendered) {
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
if (! --me.layoutSuspendCount) {
|
|
1301
|
+
me.suspendLayout = false;
|
|
1302
|
+
if (flushOptions && !me.isLayoutSuspended()) {
|
|
1303
|
+
me.updateLayout(flushOptions);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
|
|
1308
|
+
setupProtoEl: function() {
|
|
1309
|
+
var me = this,
|
|
1310
|
+
cls = [ me.baseCls, me.getComponentLayout().targetCls ];
|
|
1311
|
+
|
|
1312
|
+
//<deprecated since=0.99>
|
|
1313
|
+
if (Ext.isDefined(me.cmpCls)) {
|
|
1314
|
+
if (Ext.isDefined(Ext.global.console)) {
|
|
1315
|
+
Ext.global.console.warn('Ext.Component: cmpCls has been deprecated. Please use componentCls.');
|
|
1316
|
+
}
|
|
1317
|
+
me.componentCls = me.cmpCls;
|
|
1318
|
+
delete me.cmpCls;
|
|
1319
|
+
}
|
|
1320
|
+
//</deprecated>
|
|
1321
|
+
|
|
1322
|
+
if (me.componentCls) {
|
|
1323
|
+
cls.push(me.componentCls);
|
|
1324
|
+
} else {
|
|
1325
|
+
me.componentCls = me.baseCls;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
me.protoEl = new Ext.util.ProtoElement({
|
|
1329
|
+
cls: cls.join(' ') // in case any of the parts have multiple classes
|
|
1330
|
+
});
|
|
1331
|
+
},
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Sets the UI for the component. This will remove any existing UIs on the component. It will also loop through any
|
|
1335
|
+
* uiCls set on the component and rename them so they include the new UI
|
|
1336
|
+
* @param {String} ui The new UI for the component
|
|
1337
|
+
*/
|
|
1338
|
+
setUI: function(ui) {
|
|
1339
|
+
var me = this,
|
|
1340
|
+
oldUICls = Ext.Array.clone(me.uiCls),
|
|
1341
|
+
newUICls = [],
|
|
1342
|
+
classes = [],
|
|
1343
|
+
cls,
|
|
1344
|
+
i;
|
|
1345
|
+
|
|
1346
|
+
//loop through all existing uiCls and update the ui in them
|
|
1347
|
+
for (i = 0; i < oldUICls.length; i++) {
|
|
1348
|
+
cls = oldUICls[i];
|
|
1349
|
+
|
|
1350
|
+
classes = classes.concat(me.removeClsWithUI(cls, true));
|
|
1351
|
+
newUICls.push(cls);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
if (classes.length) {
|
|
1355
|
+
me.removeCls(classes);
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
//remove the UI from the element
|
|
1359
|
+
me.removeUIFromElement();
|
|
1360
|
+
|
|
1361
|
+
//set the UI
|
|
1362
|
+
me.ui = ui;
|
|
1363
|
+
|
|
1364
|
+
//add the new UI to the element
|
|
1365
|
+
me.addUIToElement();
|
|
1366
|
+
|
|
1367
|
+
//loop through all existing uiCls and update the ui in them
|
|
1368
|
+
classes = [];
|
|
1369
|
+
for (i = 0; i < newUICls.length; i++) {
|
|
1370
|
+
cls = newUICls[i];
|
|
1371
|
+
classes = classes.concat(me.addClsWithUI(cls, true));
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
if (classes.length) {
|
|
1375
|
+
me.addCls(classes);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
// Changing the ui can lead to significant changes to a component's appearance, so the layout needs to be
|
|
1379
|
+
// updated. Internally most calls to setUI are pre-render. Buttons are a notable exception as setScale changes
|
|
1380
|
+
// the ui and often requires the layout to be updated.
|
|
1381
|
+
if (me.rendered) {
|
|
1382
|
+
me.updateLayout();
|
|
1383
|
+
}
|
|
1384
|
+
},
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Adds a cls to the uiCls array, which will also call {@link #addUIClsToElement} and adds to all elements of this
|
|
1388
|
+
* component.
|
|
1389
|
+
* @param {String/String[]} classes A string or an array of strings to add to the uiCls
|
|
1390
|
+
* @param {Object} skip (Boolean) skip True to skip adding it to the class and do it later (via the return)
|
|
1391
|
+
*/
|
|
1392
|
+
addClsWithUI: function(classes, skip) {
|
|
1393
|
+
var me = this,
|
|
1394
|
+
clsArray = [],
|
|
1395
|
+
length,
|
|
1396
|
+
i = 0,
|
|
1397
|
+
cls;
|
|
1398
|
+
|
|
1399
|
+
if (typeof classes === "string") {
|
|
1400
|
+
classes = (classes.indexOf(' ') < 0) ? [classes] : Ext.String.splitWords(classes);
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
length = classes.length;
|
|
1404
|
+
|
|
1405
|
+
me.uiCls = Ext.Array.clone(me.uiCls);
|
|
1406
|
+
|
|
1407
|
+
for (; i < length; i++) {
|
|
1408
|
+
cls = classes[i];
|
|
1409
|
+
if (cls && !me.hasUICls(cls)) {
|
|
1410
|
+
me.uiCls.push(cls);
|
|
1411
|
+
clsArray = clsArray.concat(me.addUIClsToElement(cls));
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
if (skip !== true) {
|
|
1416
|
+
me.addCls(clsArray);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
return clsArray;
|
|
1420
|
+
},
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Removes a cls to the uiCls array, which will also call {@link #removeUIClsFromElement} and removes it from all
|
|
1424
|
+
* elements of this component.
|
|
1425
|
+
* @param {String/String[]} cls A string or an array of strings to remove to the uiCls
|
|
1426
|
+
*/
|
|
1427
|
+
removeClsWithUI: function(classes, skip) {
|
|
1428
|
+
var me = this,
|
|
1429
|
+
clsArray = [],
|
|
1430
|
+
i = 0,
|
|
1431
|
+
length, cls;
|
|
1432
|
+
|
|
1433
|
+
if (typeof classes === "string") {
|
|
1434
|
+
classes = (classes.indexOf(' ') < 0) ? [classes] : Ext.String.splitWords(classes);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
length = classes.length;
|
|
1438
|
+
|
|
1439
|
+
for (i = 0; i < length; i++) {
|
|
1440
|
+
cls = classes[i];
|
|
1441
|
+
if (cls && me.hasUICls(cls)) {
|
|
1442
|
+
me.uiCls = Ext.Array.remove(me.uiCls, cls);
|
|
1443
|
+
clsArray = clsArray.concat(me.removeUIClsFromElement(cls));
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
if (skip !== true) {
|
|
1448
|
+
me.removeCls(clsArray);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
return clsArray;
|
|
1452
|
+
},
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Checks if there is currently a specified uiCls
|
|
1456
|
+
* @param {String} cls The cls to check
|
|
1457
|
+
*/
|
|
1458
|
+
hasUICls: function(cls) {
|
|
1459
|
+
var me = this,
|
|
1460
|
+
uiCls = me.uiCls || [];
|
|
1461
|
+
|
|
1462
|
+
return Ext.Array.contains(uiCls, cls);
|
|
1463
|
+
},
|
|
1464
|
+
|
|
1465
|
+
frameElementsArray: ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* Method which adds a specified UI + uiCls to the components element. Can be overridden to remove the UI from more
|
|
1469
|
+
* than just the components element.
|
|
1470
|
+
* @param {String} ui The UI to remove from the element
|
|
1471
|
+
*/
|
|
1472
|
+
addUIClsToElement: function(cls) {
|
|
1473
|
+
var me = this,
|
|
1474
|
+
baseClsUi = me.baseCls + '-' + me.ui + '-' + cls,
|
|
1475
|
+
result = [Ext.baseCSSPrefix + cls, me.baseCls + '-' + cls, baseClsUi],
|
|
1476
|
+
frameElementCls = me.frameElementCls,
|
|
1477
|
+
frameElementsArray, frameElementsLength, i, el, frameElement, c;
|
|
1478
|
+
|
|
1479
|
+
if (me.frame && !Ext.supports.CSS3BorderRadius) {
|
|
1480
|
+
// define each element of the frame
|
|
1481
|
+
frameElementsArray = me.frameElementsArray;
|
|
1482
|
+
frameElementsLength = frameElementsArray.length;
|
|
1483
|
+
i = 0;
|
|
1484
|
+
|
|
1485
|
+
// loop through each of them, and if they are defined add the ui
|
|
1486
|
+
for (; i < frameElementsLength; i++) {
|
|
1487
|
+
frameElement = frameElementsArray[i];
|
|
1488
|
+
el = me['frame' + frameElement.toUpperCase()];
|
|
1489
|
+
c = baseClsUi + '-' + frameElement;
|
|
1490
|
+
if (el && el.dom) {
|
|
1491
|
+
el.addCls(c);
|
|
1492
|
+
} else if (Ext.Array.indexOf(frameElementCls[frameElement], c) == -1) {
|
|
1493
|
+
frameElementCls[frameElement].push(c);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
me.frameElementCls = frameElementCls;
|
|
1499
|
+
|
|
1500
|
+
return result;
|
|
1501
|
+
},
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Method which removes a specified UI + uiCls from the components element. The cls which is added to the element
|
|
1505
|
+
* will be: `this.baseCls + '-' + ui`
|
|
1506
|
+
* @param {String} ui The UI to add to the element
|
|
1507
|
+
*/
|
|
1508
|
+
removeUIClsFromElement: function(cls) {
|
|
1509
|
+
var me = this,
|
|
1510
|
+
baseClsUi = me.baseCls + '-' + me.ui + '-' + cls,
|
|
1511
|
+
result = [Ext.baseCSSPrefix + cls, me.baseCls + '-' + cls, baseClsUi],
|
|
1512
|
+
frameElementCls = me.frameElementCls,
|
|
1513
|
+
frameElementsArray, frameElementsLength, i, el, frameElement, c;
|
|
1514
|
+
|
|
1515
|
+
if (me.frame && !Ext.supports.CSS3BorderRadius) {
|
|
1516
|
+
// define each element of the frame
|
|
1517
|
+
frameElementsArray = me.frameElementsArray;
|
|
1518
|
+
frameElementsLength = frameElementsArray.length;
|
|
1519
|
+
i = 0;
|
|
1520
|
+
|
|
1521
|
+
// loop through each of them, and if they are defined add the ui
|
|
1522
|
+
for (; i < frameElementsLength; i++) {
|
|
1523
|
+
frameElement = frameElementsArray[i];
|
|
1524
|
+
el = me['frame' + frameElement.toUpperCase()];
|
|
1525
|
+
c = baseClsUi + '-' + frameElement;
|
|
1526
|
+
if (el && el.dom) {
|
|
1527
|
+
el.addCls(c);
|
|
1528
|
+
} else {
|
|
1529
|
+
Ext.Array.remove(frameElementCls[frameElement], c);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
me.frameElementCls = frameElementCls;
|
|
1535
|
+
|
|
1536
|
+
return result;
|
|
1537
|
+
},
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Method which adds a specified UI to the components element.
|
|
1541
|
+
* @private
|
|
1542
|
+
*/
|
|
1543
|
+
addUIToElement: function() {
|
|
1544
|
+
var me = this,
|
|
1545
|
+
baseClsUI = me.baseCls + '-' + me.ui,
|
|
1546
|
+
frameElementCls = me.frameElementCls,
|
|
1547
|
+
frameElementsArray, frameElementsLength, i, el, frameElement, c;
|
|
1548
|
+
|
|
1549
|
+
me.addCls(baseClsUI);
|
|
1550
|
+
|
|
1551
|
+
if (me.frame && !Ext.supports.CSS3BorderRadius) {
|
|
1552
|
+
// define each element of the frame
|
|
1553
|
+
frameElementsArray = me.frameElementsArray;
|
|
1554
|
+
frameElementsLength = frameElementsArray.length;
|
|
1555
|
+
i = 0;
|
|
1556
|
+
|
|
1557
|
+
// loop through each of them, and if they are defined add the ui
|
|
1558
|
+
for (; i < frameElementsLength; i++) {
|
|
1559
|
+
frameElement = frameElementsArray[i];
|
|
1560
|
+
el = me['frame' + frameElement.toUpperCase()];
|
|
1561
|
+
c = baseClsUI + '-' + frameElement;
|
|
1562
|
+
if (el) {
|
|
1563
|
+
el.addCls(c);
|
|
1564
|
+
} else {
|
|
1565
|
+
if (!Ext.Array.contains(frameElementCls[frameElement], c)) {
|
|
1566
|
+
frameElementCls[frameElement].push(c);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
},
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* Method which removes a specified UI from the components element.
|
|
1575
|
+
* @private
|
|
1576
|
+
*/
|
|
1577
|
+
removeUIFromElement: function() {
|
|
1578
|
+
var me = this,
|
|
1579
|
+
baseClsUI = me.baseCls + '-' + me.ui,
|
|
1580
|
+
frameElementCls = me.frameElementCls,
|
|
1581
|
+
frameElementsArray, frameElementsLength, i, el, frameElement, c;
|
|
1582
|
+
|
|
1583
|
+
me.removeCls(baseClsUI);
|
|
1584
|
+
|
|
1585
|
+
if (me.frame && !Ext.supports.CSS3BorderRadius) {
|
|
1586
|
+
// define each element of the frame
|
|
1587
|
+
frameElementsArray = me.frameElementsArray;
|
|
1588
|
+
frameElementsLength = frameElementsArray.length;
|
|
1589
|
+
i = 0;
|
|
1590
|
+
|
|
1591
|
+
for (; i < frameElementsLength; i++) {
|
|
1592
|
+
frameElement = frameElementsArray[i];
|
|
1593
|
+
el = me['frame' + frameElement.toUpperCase()];
|
|
1594
|
+
c = baseClsUI + '-' + frameElement;
|
|
1595
|
+
if (el) {
|
|
1596
|
+
el.removeCls(c);
|
|
1597
|
+
} else {
|
|
1598
|
+
Ext.Array.remove(frameElementCls[frameElement], c);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* @private
|
|
1606
|
+
*/
|
|
1607
|
+
getTpl: function(name) {
|
|
1608
|
+
return Ext.XTemplate.getTpl(this, name);
|
|
1609
|
+
},
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Converts style definitions to String.
|
|
1613
|
+
* @return {String} A CSS style string with style, padding, margin and border.
|
|
1614
|
+
* @private
|
|
1615
|
+
*/
|
|
1616
|
+
initStyles: function(targetEl) {
|
|
1617
|
+
var me = this,
|
|
1618
|
+
Element = Ext.Element,
|
|
1619
|
+
padding = me.padding,
|
|
1620
|
+
margin = me.margin,
|
|
1621
|
+
x = me.x,
|
|
1622
|
+
y = me.y,
|
|
1623
|
+
width, height;
|
|
1624
|
+
|
|
1625
|
+
// Convert the padding, margin and border properties from a space seperated string
|
|
1626
|
+
// into a proper style string
|
|
1627
|
+
if (padding !== undefined) {
|
|
1628
|
+
targetEl.setStyle('padding', Element.unitizeBox((padding === true) ? 5 : padding));
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
if (margin !== undefined) {
|
|
1632
|
+
targetEl.setStyle('margin', Element.unitizeBox((margin === true) ? 5 : margin));
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
if (me.border !== undefined) {
|
|
1636
|
+
me.setBorder(me.border, targetEl);
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
// initComponent, beforeRender, or event handlers may have set the style or cls property since the protoEl was set up
|
|
1640
|
+
// so we must apply styles and classes here too.
|
|
1641
|
+
if (me.cls && me.cls != me.initialCls) {
|
|
1642
|
+
targetEl.addCls(me.cls);
|
|
1643
|
+
delete me.cls;
|
|
1644
|
+
delete me.initialCls;
|
|
1645
|
+
}
|
|
1646
|
+
if (me.style && me.style != me.initialStyle) {
|
|
1647
|
+
targetEl.setStyle(me.style);
|
|
1648
|
+
delete me.style;
|
|
1649
|
+
delete me.initialStyle;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
if (x !== undefined) {
|
|
1653
|
+
targetEl.setStyle('left', x + 'px');
|
|
1654
|
+
}
|
|
1655
|
+
if (y !== undefined) {
|
|
1656
|
+
targetEl.setStyle('top', y + 'px');
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// Framed components need their width/height to apply to the frame, which is
|
|
1660
|
+
// best handled in layout at present.
|
|
1661
|
+
// If we're using the content box model, we also cannot assign initial sizes since we do not know the border widths to subtract
|
|
1662
|
+
if (!me.getFrameInfo() && Ext.isBorderBox) {
|
|
1663
|
+
width = me.width;
|
|
1664
|
+
height = me.height;
|
|
1665
|
+
|
|
1666
|
+
// framed components need their width/height to apply to the frame, which is
|
|
1667
|
+
// best handled in layout at present
|
|
1668
|
+
if (width !== undefined) {
|
|
1669
|
+
targetEl.setStyle('width', (typeof width === 'number') ? width + 'px' : width);
|
|
1670
|
+
}
|
|
1671
|
+
if (height !== undefined) {
|
|
1672
|
+
targetEl.setStyle('height', (typeof height === 'number') ? height + 'px' : height);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
|
|
1677
|
+
// @private
|
|
1678
|
+
initEvents : function() {
|
|
1679
|
+
var me = this,
|
|
1680
|
+
afterRenderEvents = me.afterRenderEvents,
|
|
1681
|
+
el,
|
|
1682
|
+
property,
|
|
1683
|
+
fn = function(listeners){
|
|
1684
|
+
me.mon(el, listeners);
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
if (afterRenderEvents) {
|
|
1688
|
+
for (property in afterRenderEvents) {
|
|
1689
|
+
if (afterRenderEvents.hasOwnProperty(property)) {
|
|
1690
|
+
el = me[property];
|
|
1691
|
+
if (el && el.on) {
|
|
1692
|
+
Ext.each(afterRenderEvents[property], fn);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
// This will add focus/blur listeners to the getFocusEl() element if that is naturally focusable.
|
|
1699
|
+
// If *not* naturally focusable, then the FocusManager must be enabled to get it to listen for focus so that
|
|
1700
|
+
// the FocusManager can track and highlight focus.
|
|
1701
|
+
me.addFocusListener();
|
|
1702
|
+
},
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* @private
|
|
1706
|
+
* <p>Sets up the focus listener on this Component's {@link #getFocusEl focusEl} if it has one.</p>
|
|
1707
|
+
* <p>Form Components which must implicitly participate in tabbing order usually have a naturally focusable
|
|
1708
|
+
* element as their {@link #getFocusEl focusEl}, and it is the DOM event of that recieving focus which drives
|
|
1709
|
+
* the Component's onFocus handling, and the DOM event of it being blurred which drives the onBlur handling.</p>
|
|
1710
|
+
* <p>If the {@link #getFocusEl focusEl} is <b>not</b> naturally focusable, then the listeners are only added
|
|
1711
|
+
* if the {@link Ext.FocusManager FocusManager} is enabled.</p>
|
|
1712
|
+
*/
|
|
1713
|
+
addFocusListener: function() {
|
|
1714
|
+
var me = this,
|
|
1715
|
+
focusEl = me.getFocusEl(),
|
|
1716
|
+
needsTabIndex;
|
|
1717
|
+
|
|
1718
|
+
// All Containers may be focusable, not only "form" type elements, but also
|
|
1719
|
+
// Panels, Toolbars, Windows etc.
|
|
1720
|
+
// Usually, the <DIV> element they will return as their focusEl will not be able to recieve focus
|
|
1721
|
+
// However, if the FocusManager is invoked, its non-default navigation handlers (invoked when
|
|
1722
|
+
// tabbing/arrowing off of certain Components) may explicitly focus a Panel or Container or FieldSet etc.
|
|
1723
|
+
// Add listeners to the focus and blur events on the focus element
|
|
1724
|
+
|
|
1725
|
+
// If this Component returns a focusEl, we might need to add a focus listener to it.
|
|
1726
|
+
if (focusEl) {
|
|
1727
|
+
|
|
1728
|
+
// getFocusEl might return a Component if a Container wishes to delegate focus to a descendant.
|
|
1729
|
+
// Window can do this via its defaultFocus configuration which can reference a Button.
|
|
1730
|
+
if (focusEl.isComponent) {
|
|
1731
|
+
return focusEl.addFocusListener();
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// If the focusEl is naturally focusable, then we always need a focus listener to drive the Component's
|
|
1735
|
+
// onFocus handling.
|
|
1736
|
+
// If *not* naturally focusable, then we only need the focus listener if the FocusManager is enabled.
|
|
1737
|
+
needsTabIndex = focusEl.needsTabIndex();
|
|
1738
|
+
if (!me.focusListenerAdded && (!needsTabIndex || Ext.FocusManager.enabled)) {
|
|
1739
|
+
if (needsTabIndex) {
|
|
1740
|
+
focusEl.dom.tabIndex = -1;
|
|
1741
|
+
}
|
|
1742
|
+
focusEl.on({
|
|
1743
|
+
focus: me.onFocus,
|
|
1744
|
+
blur: me.onBlur,
|
|
1745
|
+
scope: me
|
|
1746
|
+
});
|
|
1747
|
+
me.focusListenerAdded = true;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* @private
|
|
1754
|
+
* <p>Returns the focus holder element associated with this Component. At the Component base class level, this function returns <code>undefined</code>.</p>
|
|
1755
|
+
* <p>Subclasses which use embedded focusable elements (such as Window, Field and Button) should override this for use by the {@link #focus} method.</p>
|
|
1756
|
+
* <p>Containers which need to participate in the {@link Ext.FocusManager FocusManager}'s navigation and Container focusing scheme also
|
|
1757
|
+
* need to return a focusEl, although focus is only listened for in this case if the {@link Ext.FocusManager FocusManager} is {@link Ext.FocusManager#method-enable enable}d.</p>
|
|
1758
|
+
* @returns {undefined} <code>undefined</code> because raw Components cannot by default hold focus.
|
|
1759
|
+
*/
|
|
1760
|
+
getFocusEl: Ext.emptyFn,
|
|
1761
|
+
|
|
1762
|
+
isFocusable: function(c) {
|
|
1763
|
+
var me = this,
|
|
1764
|
+
focusEl;
|
|
1765
|
+
if ((me.focusable !== false) && (focusEl = me.getFocusEl()) && me.rendered && !me.destroying && !me.isDestroyed && !me.disabled && me.isVisible(true)) {
|
|
1766
|
+
|
|
1767
|
+
// getFocusEl might return a Component if a Container wishes to delegate focus to a descendant.
|
|
1768
|
+
// Window can do this via its defaultFocus configuration which can reference a Button.
|
|
1769
|
+
if (focusEl.isComponent) {
|
|
1770
|
+
return focusEl.isFocusable();
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
return focusEl && focusEl.dom && focusEl.isVisible();
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1776
|
+
|
|
1777
|
+
// private
|
|
1778
|
+
preFocus: Ext.emptyFn,
|
|
1779
|
+
|
|
1780
|
+
// private
|
|
1781
|
+
onFocus: function(e) {
|
|
1782
|
+
var me = this,
|
|
1783
|
+
focusCls = me.focusCls,
|
|
1784
|
+
focusEl = me.getFocusEl();
|
|
1785
|
+
|
|
1786
|
+
if (!me.disabled) {
|
|
1787
|
+
me.preFocus(e);
|
|
1788
|
+
if (focusCls && focusEl) {
|
|
1789
|
+
focusEl.addCls(me.addClsWithUI(focusCls, true));
|
|
1790
|
+
}
|
|
1791
|
+
if (!me.hasFocus) {
|
|
1792
|
+
me.hasFocus = true;
|
|
1793
|
+
me.fireEvent('focus', me, e);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
},
|
|
1797
|
+
|
|
1798
|
+
// private
|
|
1799
|
+
beforeBlur : Ext.emptyFn,
|
|
1800
|
+
|
|
1801
|
+
// private
|
|
1802
|
+
onBlur : function(e) {
|
|
1803
|
+
var me = this,
|
|
1804
|
+
focusCls = me.focusCls,
|
|
1805
|
+
focusEl = me.getFocusEl();
|
|
1806
|
+
|
|
1807
|
+
if (me.destroying) {
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
me.beforeBlur(e);
|
|
1812
|
+
if (focusCls && focusEl) {
|
|
1813
|
+
focusEl.removeCls(me.removeClsWithUI(focusCls, true));
|
|
1814
|
+
}
|
|
1815
|
+
if (me.validateOnBlur) {
|
|
1816
|
+
me.validate();
|
|
1817
|
+
}
|
|
1818
|
+
me.hasFocus = false;
|
|
1819
|
+
me.fireEvent('blur', me, e);
|
|
1820
|
+
me.postBlur(e);
|
|
1821
|
+
},
|
|
1822
|
+
|
|
1823
|
+
// private
|
|
1824
|
+
postBlur : Ext.emptyFn,
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Tests whether this Component matches the selector string.
|
|
1828
|
+
* @param {String} selector The selector string to test against.
|
|
1829
|
+
* @return {Boolean} True if this Component matches the selector.
|
|
1830
|
+
*/
|
|
1831
|
+
is: function(selector) {
|
|
1832
|
+
return Ext.ComponentQuery.is(this, selector);
|
|
1833
|
+
},
|
|
1834
|
+
|
|
1835
|
+
/**
|
|
1836
|
+
* Walks up the `ownerCt` axis looking for an ancestor Container which matches the passed simple selector.
|
|
1837
|
+
*
|
|
1838
|
+
* Example:
|
|
1839
|
+
*
|
|
1840
|
+
* var owningTabPanel = grid.up('tabpanel');
|
|
1841
|
+
*
|
|
1842
|
+
* @param {String} [selector] The simple selector to test.
|
|
1843
|
+
* @return {Ext.container.Container} The matching ancestor Container (or `undefined` if no match was found).
|
|
1844
|
+
*/
|
|
1845
|
+
up: function(selector) {
|
|
1846
|
+
// Use bubble target to navigate upwards so that Components can implement their own hierarchy.
|
|
1847
|
+
// For example Menus implement getBubbleTarget because they have a parentMenu or ownerButton as an
|
|
1848
|
+
// upward link depending upon how they are owned and triggered.
|
|
1849
|
+
var result = this.getBubbleTarget();
|
|
1850
|
+
if (selector) {
|
|
1851
|
+
for (; result; result = result.getBubbleTarget()) {
|
|
1852
|
+
if (Ext.ComponentQuery.is(result, selector)) {
|
|
1853
|
+
return result;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
return result;
|
|
1858
|
+
},
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Returns the next sibling of this Component.
|
|
1862
|
+
*
|
|
1863
|
+
* Optionally selects the next sibling which matches the passed {@link Ext.ComponentQuery ComponentQuery} selector.
|
|
1864
|
+
*
|
|
1865
|
+
* May also be refered to as **`next()`**
|
|
1866
|
+
*
|
|
1867
|
+
* Note that this is limited to siblings, and if no siblings of the item match, `null` is returned. Contrast with
|
|
1868
|
+
* {@link #nextNode}
|
|
1869
|
+
* @param {String} [selector] A {@link Ext.ComponentQuery ComponentQuery} selector to filter the following items.
|
|
1870
|
+
* @return {Ext.Component} The next sibling (or the next sibling which matches the selector).
|
|
1871
|
+
* Returns null if there is no matching sibling.
|
|
1872
|
+
*/
|
|
1873
|
+
nextSibling: function(selector) {
|
|
1874
|
+
var o = this.ownerCt, it, last, idx, c;
|
|
1875
|
+
if (o) {
|
|
1876
|
+
it = o.items;
|
|
1877
|
+
idx = it.indexOf(this) + 1;
|
|
1878
|
+
if (idx) {
|
|
1879
|
+
if (selector) {
|
|
1880
|
+
for (last = it.getCount(); idx < last; idx++) {
|
|
1881
|
+
if ((c = it.getAt(idx)).is(selector)) {
|
|
1882
|
+
return c;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
} else {
|
|
1886
|
+
if (idx < it.getCount()) {
|
|
1887
|
+
return it.getAt(idx);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
return null;
|
|
1893
|
+
},
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Returns the previous sibling of this Component.
|
|
1897
|
+
*
|
|
1898
|
+
* Optionally selects the previous sibling which matches the passed {@link Ext.ComponentQuery ComponentQuery}
|
|
1899
|
+
* selector.
|
|
1900
|
+
*
|
|
1901
|
+
* May also be refered to as **`prev()`**
|
|
1902
|
+
*
|
|
1903
|
+
* Note that this is limited to siblings, and if no siblings of the item match, `null` is returned. Contrast with
|
|
1904
|
+
* {@link #previousNode}
|
|
1905
|
+
* @param {String} [selector] A {@link Ext.ComponentQuery ComponentQuery} selector to filter the preceding items.
|
|
1906
|
+
* @return {Ext.Component} The previous sibling (or the previous sibling which matches the selector).
|
|
1907
|
+
* Returns null if there is no matching sibling.
|
|
1908
|
+
*/
|
|
1909
|
+
previousSibling: function(selector) {
|
|
1910
|
+
var o = this.ownerCt, it, idx, c;
|
|
1911
|
+
if (o) {
|
|
1912
|
+
it = o.items;
|
|
1913
|
+
idx = it.indexOf(this);
|
|
1914
|
+
if (idx != -1) {
|
|
1915
|
+
if (selector) {
|
|
1916
|
+
for (--idx; idx >= 0; idx--) {
|
|
1917
|
+
if ((c = it.getAt(idx)).is(selector)) {
|
|
1918
|
+
return c;
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
} else {
|
|
1922
|
+
if (idx) {
|
|
1923
|
+
return it.getAt(--idx);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
return null;
|
|
1929
|
+
},
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* Returns the previous node in the Component tree in tree traversal order.
|
|
1933
|
+
*
|
|
1934
|
+
* Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will walk the
|
|
1935
|
+
* tree in reverse order to attempt to find a match. Contrast with {@link #previousSibling}.
|
|
1936
|
+
* @param {String} [selector] A {@link Ext.ComponentQuery ComponentQuery} selector to filter the preceding nodes.
|
|
1937
|
+
* @return {Ext.Component} The previous node (or the previous node which matches the selector).
|
|
1938
|
+
* Returns null if there is no matching node.
|
|
1939
|
+
*/
|
|
1940
|
+
previousNode: function(selector, includeSelf) {
|
|
1941
|
+
var node = this,
|
|
1942
|
+
result,
|
|
1943
|
+
it, i, sib;
|
|
1944
|
+
|
|
1945
|
+
// If asked to include self, test me
|
|
1946
|
+
if (includeSelf && node.is(selector)) {
|
|
1947
|
+
return node;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
if (node.ownerCt) {
|
|
1951
|
+
for (it = node.ownerCt.items.items, i = Ext.Array.indexOf(it, node) - 1; i > -1; i--) {
|
|
1952
|
+
sib = it[i];
|
|
1953
|
+
if (sib.query) {
|
|
1954
|
+
result = sib.query(selector);
|
|
1955
|
+
result = result[result.length - 1];
|
|
1956
|
+
if (result) {
|
|
1957
|
+
return result;
|
|
1958
|
+
}
|
|
1959
|
+
if (sib.is(selector)) {
|
|
1960
|
+
return sib;
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
return node.ownerCt.previousNode(selector, true);
|
|
1965
|
+
}
|
|
1966
|
+
},
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* Returns the next node in the Component tree in tree traversal order.
|
|
1970
|
+
*
|
|
1971
|
+
* Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will walk the
|
|
1972
|
+
* tree to attempt to find a match. Contrast with {@link #nextSibling}.
|
|
1973
|
+
* @param {String} [selector] A {@link Ext.ComponentQuery ComponentQuery} selector to filter the following nodes.
|
|
1974
|
+
* @return {Ext.Component} The next node (or the next node which matches the selector).
|
|
1975
|
+
* Returns null if there is no matching node.
|
|
1976
|
+
*/
|
|
1977
|
+
nextNode: function(selector, includeSelf) {
|
|
1978
|
+
var node = this,
|
|
1979
|
+
result,
|
|
1980
|
+
it, len, i, sib;
|
|
1981
|
+
|
|
1982
|
+
// If asked to include self, test me
|
|
1983
|
+
if (includeSelf && node.is(selector)) {
|
|
1984
|
+
return node;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
if (node.ownerCt) {
|
|
1988
|
+
for (it = node.ownerCt.items, i = it.indexOf(node) + 1, it = it.items, len = it.length; i < len; i++) {
|
|
1989
|
+
sib = it[i];
|
|
1990
|
+
if (sib.is(selector)) {
|
|
1991
|
+
return sib;
|
|
1992
|
+
}
|
|
1993
|
+
if (sib.down) {
|
|
1994
|
+
result = sib.down(selector);
|
|
1995
|
+
if (result) {
|
|
1996
|
+
return result;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
return node.ownerCt.nextNode(selector);
|
|
2001
|
+
}
|
|
2002
|
+
},
|
|
2003
|
+
|
|
2004
|
+
/**
|
|
2005
|
+
* Retrieves the id of this component. Will autogenerate an id if one has not already been set.
|
|
2006
|
+
* @return {String}
|
|
2007
|
+
*/
|
|
2008
|
+
getId : function() {
|
|
2009
|
+
return this.id || (this.id = 'ext-comp-' + (this.getAutoId()));
|
|
2010
|
+
},
|
|
2011
|
+
|
|
2012
|
+
getItemId : function() {
|
|
2013
|
+
return this.itemId || this.id;
|
|
2014
|
+
},
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* Retrieves the top level element representing this component.
|
|
2018
|
+
* @return {Ext.dom.Element}
|
|
2019
|
+
*/
|
|
2020
|
+
getEl : function() {
|
|
2021
|
+
return this.el;
|
|
2022
|
+
},
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* This is used to determine where to insert the 'html', 'contentEl' and 'items' in this component.
|
|
2026
|
+
* @private
|
|
2027
|
+
*/
|
|
2028
|
+
getTargetEl: function() {
|
|
2029
|
+
return this.frameBody || this.el;
|
|
2030
|
+
},
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* @private
|
|
2034
|
+
* Returns the CSS style object which will set the Component's scroll styles. This must be applied
|
|
2035
|
+
* to the {@link #getTargetEl target element}.
|
|
2036
|
+
*/
|
|
2037
|
+
getOverflowStyle: function() {
|
|
2038
|
+
var me = this,
|
|
2039
|
+
result = null;
|
|
2040
|
+
|
|
2041
|
+
if (typeof me.autoScroll == 'boolean') {
|
|
2042
|
+
result = {
|
|
2043
|
+
overflow: me.autoScroll ? 'auto' : ''
|
|
2044
|
+
};
|
|
2045
|
+
} else if (me.overflowX !== undefined || me.overflowY !== undefined) {
|
|
2046
|
+
result = {
|
|
2047
|
+
'overflow-x': (me.overflowX||''),
|
|
2048
|
+
'overflow-y': (me.overflowY||'')
|
|
2049
|
+
};
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
// The scrollable container element must be non-statically positioned or IE6/7 will make
|
|
2053
|
+
// positioned children stay in place rather than scrolling with the rest of the content
|
|
2054
|
+
if (result && (Ext.isIE6 || Ext.isIE7)) {
|
|
2055
|
+
result.position = 'relative';
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
return result;
|
|
2059
|
+
},
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended
|
|
2063
|
+
* from the xtype (default) or whether it is directly of the xtype specified (shallow = true).
|
|
2064
|
+
*
|
|
2065
|
+
* **If using your own subclasses, be aware that a Component must register its own xtype to participate in
|
|
2066
|
+
* determination of inherited xtypes.**
|
|
2067
|
+
*
|
|
2068
|
+
* For a list of all available xtypes, see the {@link Ext.Component} header.
|
|
2069
|
+
*
|
|
2070
|
+
* Example usage:
|
|
2071
|
+
*
|
|
2072
|
+
* var t = new Ext.form.field.Text();
|
|
2073
|
+
* var isText = t.isXType('textfield'); // true
|
|
2074
|
+
* var isBoxSubclass = t.isXType('field'); // true, descended from Ext.form.field.Base
|
|
2075
|
+
* var isBoxInstance = t.isXType('field', true); // false, not a direct Ext.form.field.Base instance
|
|
2076
|
+
*
|
|
2077
|
+
* @param {String} xtype The xtype to check for this Component
|
|
2078
|
+
* @param {Boolean} [shallow=false] True to check whether this Component is directly of the specified xtype, false to
|
|
2079
|
+
* check whether this Component is descended from the xtype.
|
|
2080
|
+
* @return {Boolean} True if this component descends from the specified xtype, false otherwise.
|
|
2081
|
+
*/
|
|
2082
|
+
isXType: function(xtype, shallow) {
|
|
2083
|
+
if (shallow) {
|
|
2084
|
+
return this.xtype === xtype;
|
|
2085
|
+
}
|
|
2086
|
+
else {
|
|
2087
|
+
return this.xtypesMap[xtype];
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
|
|
2091
|
+
/**
|
|
2092
|
+
* Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all available xtypes, see the
|
|
2093
|
+
* {@link Ext.Component} header.
|
|
2094
|
+
*
|
|
2095
|
+
* **If using your own subclasses, be aware that a Component must register its own xtype to participate in
|
|
2096
|
+
* determination of inherited xtypes.**
|
|
2097
|
+
*
|
|
2098
|
+
* Example usage:
|
|
2099
|
+
*
|
|
2100
|
+
* var t = new Ext.form.field.Text();
|
|
2101
|
+
* alert(t.getXTypes()); // alerts 'component/field/textfield'
|
|
2102
|
+
*
|
|
2103
|
+
* @return {String} The xtype hierarchy string
|
|
2104
|
+
*/
|
|
2105
|
+
getXTypes: function() {
|
|
2106
|
+
var self = this.self,
|
|
2107
|
+
xtypes, parentPrototype, parentXtypes;
|
|
2108
|
+
|
|
2109
|
+
if (!self.xtypes) {
|
|
2110
|
+
xtypes = [];
|
|
2111
|
+
parentPrototype = this;
|
|
2112
|
+
|
|
2113
|
+
while (parentPrototype) {
|
|
2114
|
+
parentXtypes = parentPrototype.xtypes;
|
|
2115
|
+
|
|
2116
|
+
if (parentXtypes !== undefined) {
|
|
2117
|
+
xtypes.unshift.apply(xtypes, parentXtypes);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
parentPrototype = parentPrototype.superclass;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
self.xtypeChain = xtypes;
|
|
2124
|
+
self.xtypes = xtypes.join('/');
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
return self.xtypes;
|
|
2128
|
+
},
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* Update the content area of a component.
|
|
2132
|
+
* @param {String/Object} htmlOrData If this component has been configured with a template via the tpl config then
|
|
2133
|
+
* it will use this argument as data to populate the template. If this component was not configured with a template,
|
|
2134
|
+
* the components content area will be updated via Ext.Element update
|
|
2135
|
+
* @param {Boolean} [loadScripts=false] Only legitimate when using the html configuration.
|
|
2136
|
+
* @param {Function} [callback] Only legitimate when using the html configuration. Callback to execute when
|
|
2137
|
+
* scripts have finished loading
|
|
2138
|
+
*/
|
|
2139
|
+
update : function(htmlOrData, loadScripts, cb) {
|
|
2140
|
+
var me = this;
|
|
2141
|
+
|
|
2142
|
+
if (me.tpl && !Ext.isString(htmlOrData)) {
|
|
2143
|
+
me.data = htmlOrData;
|
|
2144
|
+
if (me.rendered) {
|
|
2145
|
+
me.tpl[me.tplWriteMode](me.getTargetEl(), htmlOrData || {});
|
|
2146
|
+
}
|
|
2147
|
+
} else {
|
|
2148
|
+
me.html = Ext.isObject(htmlOrData) ? Ext.DomHelper.markup(htmlOrData) : htmlOrData;
|
|
2149
|
+
if (me.rendered) {
|
|
2150
|
+
me.getTargetEl().update(me.html, loadScripts, cb);
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
if (me.rendered) {
|
|
2155
|
+
me.updateLayout();
|
|
2156
|
+
}
|
|
2157
|
+
},
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* Convenience function to hide or show this component by boolean.
|
|
2161
|
+
* @param {Boolean} visible True to show, false to hide
|
|
2162
|
+
* @return {Ext.Component} this
|
|
2163
|
+
*/
|
|
2164
|
+
setVisible : function(visible) {
|
|
2165
|
+
return this[visible ? 'show': 'hide']();
|
|
2166
|
+
},
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Returns true if this component is visible.
|
|
2170
|
+
*
|
|
2171
|
+
* @param {Boolean} [deep=false] Pass `true` to interrogate the visibility status of all parent Containers to
|
|
2172
|
+
* determine whether this Component is truly visible to the user.
|
|
2173
|
+
*
|
|
2174
|
+
* Generally, to determine whether a Component is hidden, the no argument form is needed. For example when creating
|
|
2175
|
+
* dynamically laid out UIs in a hidden Container before showing them.
|
|
2176
|
+
*
|
|
2177
|
+
* @return {Boolean} True if this component is visible, false otherwise.
|
|
2178
|
+
*/
|
|
2179
|
+
isVisible: function(deep) {
|
|
2180
|
+
var me = this,
|
|
2181
|
+
child = me,
|
|
2182
|
+
visible = me.rendered && !me.hidden,
|
|
2183
|
+
ancestor = me.ownerCt;
|
|
2184
|
+
|
|
2185
|
+
// Clear hiddenOwnerCt property
|
|
2186
|
+
me.hiddenAncestor = false;
|
|
2187
|
+
if (me.destroyed) {
|
|
2188
|
+
return false;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
if (deep && visible && ancestor) {
|
|
2192
|
+
while (ancestor) {
|
|
2193
|
+
// If any ancestor is hidden, then this is hidden.
|
|
2194
|
+
// If an ancestor Panel (only Panels have a collapse method) is collapsed,
|
|
2195
|
+
// then its layoutTarget (body) is hidden, so this is hidden unless its within a
|
|
2196
|
+
// docked item; they are still visible when collapsed (Unless they themseves are hidden)
|
|
2197
|
+
if (ancestor.hidden || (ancestor.collapsed &&
|
|
2198
|
+
!(ancestor.getDockedItems && Ext.Array.contains(ancestor.getDockedItems(), child)))) {
|
|
2199
|
+
// Store hiddenOwnerCt property if needed
|
|
2200
|
+
me.hiddenAncestor = ancestor;
|
|
2201
|
+
visible = false;
|
|
2202
|
+
break;
|
|
2203
|
+
}
|
|
2204
|
+
child = ancestor;
|
|
2205
|
+
ancestor = ancestor.ownerCt;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
return visible;
|
|
2209
|
+
},
|
|
2210
|
+
|
|
2211
|
+
onBoxReady: function(){
|
|
2212
|
+
var me = this;
|
|
2213
|
+
|
|
2214
|
+
if (me.disableOnBoxReady) {
|
|
2215
|
+
me.onDisable();
|
|
2216
|
+
} else if (me.enableOnBoxReady) {
|
|
2217
|
+
me.onEnable();
|
|
2218
|
+
}
|
|
2219
|
+
if (me.resizable) {
|
|
2220
|
+
me.initResizable(me.resizable);
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
// Draggability must be initialized after resizability
|
|
2224
|
+
// Because if we have to be wrapped, the resizer wrapper must be dragged as a pseudo-Component
|
|
2225
|
+
if (me.draggable) {
|
|
2226
|
+
me.initDraggable();
|
|
2227
|
+
}
|
|
2228
|
+
},
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* Enable the component
|
|
2232
|
+
* @param {Boolean} [silent=false] Passing true will supress the 'enable' event from being fired.
|
|
2233
|
+
*/
|
|
2234
|
+
enable: function(silent) {
|
|
2235
|
+
var me = this;
|
|
2236
|
+
|
|
2237
|
+
delete me.disableOnBoxReady;
|
|
2238
|
+
me.removeCls(me.disabledCls);
|
|
2239
|
+
if (me.rendered) {
|
|
2240
|
+
me.onEnable();
|
|
2241
|
+
} else {
|
|
2242
|
+
me.enableOnBoxReady = true;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
me.disabled = false;
|
|
2246
|
+
delete me.resetDisable;
|
|
2247
|
+
|
|
2248
|
+
if (silent !== true) {
|
|
2249
|
+
me.fireEvent('enable', me);
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
return me;
|
|
2253
|
+
},
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Disable the component.
|
|
2257
|
+
* @param {Boolean} [silent=false] Passing true will supress the 'disable' event from being fired.
|
|
2258
|
+
*/
|
|
2259
|
+
disable: function(silent) {
|
|
2260
|
+
var me = this;
|
|
2261
|
+
|
|
2262
|
+
delete me.enableOnBoxReady;
|
|
2263
|
+
me.addCls(me.disabledCls);
|
|
2264
|
+
if (me.rendered) {
|
|
2265
|
+
me.onDisable();
|
|
2266
|
+
} else {
|
|
2267
|
+
me.disableOnBoxReady = true;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
me.disabled = true;
|
|
2271
|
+
|
|
2272
|
+
if (silent !== true) {
|
|
2273
|
+
delete me.resetDisable;
|
|
2274
|
+
me.fireEvent('disable', me);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
return me;
|
|
2278
|
+
},
|
|
2279
|
+
|
|
2280
|
+
/**
|
|
2281
|
+
* Allows addition of behavior to the enable operation.
|
|
2282
|
+
* After calling the superclass’s onEnable, the Component will be enabled.
|
|
2283
|
+
*
|
|
2284
|
+
* @template
|
|
2285
|
+
* @protected
|
|
2286
|
+
*/
|
|
2287
|
+
onEnable: function() {
|
|
2288
|
+
if (this.maskOnDisable) {
|
|
2289
|
+
this.el.dom.disabled = false;
|
|
2290
|
+
this.unmask();
|
|
2291
|
+
}
|
|
2292
|
+
},
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Allows addition of behavior to the disable operation.
|
|
2296
|
+
* After calling the superclass’s onDisable, the Component will be disabled.
|
|
2297
|
+
*
|
|
2298
|
+
* @template
|
|
2299
|
+
* @protected
|
|
2300
|
+
*/
|
|
2301
|
+
onDisable : function() {
|
|
2302
|
+
if (this.maskOnDisable) {
|
|
2303
|
+
this.el.dom.disabled = true;
|
|
2304
|
+
this.mask();
|
|
2305
|
+
}
|
|
2306
|
+
},
|
|
2307
|
+
|
|
2308
|
+
mask: function() {
|
|
2309
|
+
var box = this.lastBox,
|
|
2310
|
+
target = this.getMaskTarget(),
|
|
2311
|
+
args = [];
|
|
2312
|
+
|
|
2313
|
+
// Pass it the height of our element if we know it.
|
|
2314
|
+
if (box) {
|
|
2315
|
+
args[2] = box.height;
|
|
2316
|
+
}
|
|
2317
|
+
target.mask.apply(target, args);
|
|
2318
|
+
},
|
|
2319
|
+
|
|
2320
|
+
unmask: function() {
|
|
2321
|
+
this.getMaskTarget().unmask();
|
|
2322
|
+
},
|
|
2323
|
+
|
|
2324
|
+
getMaskTarget: function(){
|
|
2325
|
+
return this.el;
|
|
2326
|
+
},
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Method to determine whether this Component is currently disabled.
|
|
2330
|
+
* @return {Boolean} the disabled state of this Component.
|
|
2331
|
+
*/
|
|
2332
|
+
isDisabled : function() {
|
|
2333
|
+
return this.disabled;
|
|
2334
|
+
},
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* Enable or disable the component.
|
|
2338
|
+
* @param {Boolean} disabled True to disable.
|
|
2339
|
+
*/
|
|
2340
|
+
setDisabled : function(disabled) {
|
|
2341
|
+
return this[disabled ? 'disable': 'enable']();
|
|
2342
|
+
},
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* Method to determine whether this Component is currently set to hidden.
|
|
2346
|
+
* @return {Boolean} the hidden state of this Component.
|
|
2347
|
+
*/
|
|
2348
|
+
isHidden : function() {
|
|
2349
|
+
return this.hidden;
|
|
2350
|
+
},
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* Adds a CSS class to the top level element representing this component.
|
|
2354
|
+
* @param {String/String[]} cls The CSS class name to add
|
|
2355
|
+
* @return {Ext.Component} Returns the Component to allow method chaining.
|
|
2356
|
+
*/
|
|
2357
|
+
addCls : function(cls) {
|
|
2358
|
+
var me = this,
|
|
2359
|
+
el = me.rendered ? me.el : me.protoEl;
|
|
2360
|
+
|
|
2361
|
+
el.addCls.apply(el, arguments);
|
|
2362
|
+
return me;
|
|
2363
|
+
},
|
|
2364
|
+
|
|
2365
|
+
/**
|
|
2366
|
+
* @inheritdoc Ext.AbstractComponent#addCls
|
|
2367
|
+
* @deprecated 4.1 Use {@link #addCls} instead.
|
|
2368
|
+
*/
|
|
2369
|
+
addClass : function() {
|
|
2370
|
+
return this.addCls.apply(this, arguments);
|
|
2371
|
+
},
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* Checks if the specified CSS class exists on this element's DOM node.
|
|
2375
|
+
* @param {String} className The CSS class to check for
|
|
2376
|
+
* @return {Boolean} True if the class exists, else false
|
|
2377
|
+
* @method
|
|
2378
|
+
*/
|
|
2379
|
+
hasCls: function (cls) {
|
|
2380
|
+
var me = this,
|
|
2381
|
+
el = me.rendered ? me.el : me.protoEl;
|
|
2382
|
+
|
|
2383
|
+
return el.hasCls.apply(el, arguments);
|
|
2384
|
+
},
|
|
2385
|
+
|
|
2386
|
+
/**
|
|
2387
|
+
* Removes a CSS class from the top level element representing this component.
|
|
2388
|
+
* @param {String/String[]} cls The CSS class name to remove
|
|
2389
|
+
* @returns {Ext.Component} Returns the Component to allow method chaining.
|
|
2390
|
+
*/
|
|
2391
|
+
removeCls : function(cls) {
|
|
2392
|
+
var me = this,
|
|
2393
|
+
el = me.rendered ? me.el : me.protoEl;
|
|
2394
|
+
|
|
2395
|
+
el.removeCls.apply(el, arguments);
|
|
2396
|
+
return me;
|
|
2397
|
+
},
|
|
2398
|
+
|
|
2399
|
+
//<debug>
|
|
2400
|
+
removeClass : function() {
|
|
2401
|
+
if (Ext.isDefined(Ext.global.console)) {
|
|
2402
|
+
Ext.global.console.warn('Ext.Component: removeClass has been deprecated. Please use removeCls.');
|
|
2403
|
+
}
|
|
2404
|
+
return this.removeCls.apply(this, arguments);
|
|
2405
|
+
},
|
|
2406
|
+
//</debug>
|
|
2407
|
+
|
|
2408
|
+
addOverCls: function() {
|
|
2409
|
+
var me = this;
|
|
2410
|
+
if (!me.disabled) {
|
|
2411
|
+
me.el.addCls(me.overCls);
|
|
2412
|
+
}
|
|
2413
|
+
},
|
|
2414
|
+
|
|
2415
|
+
removeOverCls: function() {
|
|
2416
|
+
this.el.removeCls(this.overCls);
|
|
2417
|
+
},
|
|
2418
|
+
|
|
2419
|
+
addListener : function(element, listeners, scope, options) {
|
|
2420
|
+
var me = this,
|
|
2421
|
+
fn,
|
|
2422
|
+
option;
|
|
2423
|
+
|
|
2424
|
+
if (Ext.isString(element) && (Ext.isObject(listeners) || options && options.element)) {
|
|
2425
|
+
if (options.element) {
|
|
2426
|
+
fn = listeners;
|
|
2427
|
+
|
|
2428
|
+
listeners = {};
|
|
2429
|
+
listeners[element] = fn;
|
|
2430
|
+
element = options.element;
|
|
2431
|
+
if (scope) {
|
|
2432
|
+
listeners.scope = scope;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
for (option in options) {
|
|
2436
|
+
if (options.hasOwnProperty(option)) {
|
|
2437
|
+
if (me.eventOptionsRe.test(option)) {
|
|
2438
|
+
listeners[option] = options[option];
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
// At this point we have a variable called element,
|
|
2445
|
+
// and a listeners object that can be passed to on
|
|
2446
|
+
if (me[element] && me[element].on) {
|
|
2447
|
+
me.mon(me[element], listeners);
|
|
2448
|
+
} else {
|
|
2449
|
+
me.afterRenderEvents = me.afterRenderEvents || {};
|
|
2450
|
+
if (!me.afterRenderEvents[element]) {
|
|
2451
|
+
me.afterRenderEvents[element] = [];
|
|
2452
|
+
}
|
|
2453
|
+
me.afterRenderEvents[element].push(listeners);
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
return me.mixins.observable.addListener.apply(me, arguments);
|
|
2458
|
+
},
|
|
2459
|
+
|
|
2460
|
+
// inherit docs
|
|
2461
|
+
removeManagedListenerItem: function(isClear, managedListener, item, ename, fn, scope){
|
|
2462
|
+
var me = this,
|
|
2463
|
+
element = managedListener.options ? managedListener.options.element : null;
|
|
2464
|
+
|
|
2465
|
+
if (element) {
|
|
2466
|
+
element = me[element];
|
|
2467
|
+
if (element && element.un) {
|
|
2468
|
+
if (isClear || (managedListener.item === item && managedListener.ename === ename && (!fn || managedListener.fn === fn) && (!scope || managedListener.scope === scope))) {
|
|
2469
|
+
element.un(managedListener.ename, managedListener.fn, managedListener.scope);
|
|
2470
|
+
if (!isClear) {
|
|
2471
|
+
Ext.Array.remove(me.managedListeners, managedListener);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
} else {
|
|
2476
|
+
return me.mixins.observable.removeManagedListenerItem.apply(me, arguments);
|
|
2477
|
+
}
|
|
2478
|
+
},
|
|
2479
|
+
|
|
2480
|
+
/**
|
|
2481
|
+
* Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy.
|
|
2482
|
+
* @return {Ext.container.Container} the Container which owns this Component.
|
|
2483
|
+
*/
|
|
2484
|
+
getBubbleTarget : function() {
|
|
2485
|
+
return this.ownerCt;
|
|
2486
|
+
},
|
|
2487
|
+
|
|
2488
|
+
/**
|
|
2489
|
+
* Method to determine whether this Component is floating.
|
|
2490
|
+
* @return {Boolean} the floating state of this component.
|
|
2491
|
+
*/
|
|
2492
|
+
isFloating : function() {
|
|
2493
|
+
return this.floating;
|
|
2494
|
+
},
|
|
2495
|
+
|
|
2496
|
+
/**
|
|
2497
|
+
* Method to determine whether this Component is draggable.
|
|
2498
|
+
* @return {Boolean} the draggable state of this component.
|
|
2499
|
+
*/
|
|
2500
|
+
isDraggable : function() {
|
|
2501
|
+
return !!this.draggable;
|
|
2502
|
+
},
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* Method to determine whether this Component is droppable.
|
|
2506
|
+
* @return {Boolean} the droppable state of this component.
|
|
2507
|
+
*/
|
|
2508
|
+
isDroppable : function() {
|
|
2509
|
+
return !!this.droppable;
|
|
2510
|
+
},
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Method to manage awareness of when components are added to their
|
|
2514
|
+
* respective Container, firing an #added event. References are
|
|
2515
|
+
* established at add time rather than at render time.
|
|
2516
|
+
*
|
|
2517
|
+
* Allows addition of behavior when a Component is added to a
|
|
2518
|
+
* Container. At this stage, the Component is in the parent
|
|
2519
|
+
* Container's collection of child items. After calling the
|
|
2520
|
+
* superclass's onAdded, the ownerCt reference will be present,
|
|
2521
|
+
* and if configured with a ref, the refOwner will be set.
|
|
2522
|
+
*
|
|
2523
|
+
* @param {Ext.container.Container} container Container which holds the component
|
|
2524
|
+
* @param {Number} pos Position at which the component was added
|
|
2525
|
+
*
|
|
2526
|
+
* @template
|
|
2527
|
+
* @protected
|
|
2528
|
+
*/
|
|
2529
|
+
onAdded : function(container, pos) {
|
|
2530
|
+
var me = this;
|
|
2531
|
+
me.ownerCt = container;
|
|
2532
|
+
if (me.hasListeners.added) {
|
|
2533
|
+
me.fireEvent('added', me, container, pos);
|
|
2534
|
+
}
|
|
2535
|
+
},
|
|
2536
|
+
|
|
2537
|
+
/**
|
|
2538
|
+
* Method to manage awareness of when components are removed from their
|
|
2539
|
+
* respective Container, firing a #removed event. References are properly
|
|
2540
|
+
* cleaned up after removing a component from its owning container.
|
|
2541
|
+
*
|
|
2542
|
+
* Allows addition of behavior when a Component is removed from
|
|
2543
|
+
* its parent Container. At this stage, the Component has been
|
|
2544
|
+
* removed from its parent Container's collection of child items,
|
|
2545
|
+
* but has not been destroyed (It will be destroyed if the parent
|
|
2546
|
+
* Container's autoDestroy is true, or if the remove call was
|
|
2547
|
+
* passed a truthy second parameter). After calling the
|
|
2548
|
+
* superclass's onRemoved, the ownerCt and the refOwner will not
|
|
2549
|
+
* be present.
|
|
2550
|
+
* @param {Boolean} destroying Will be passed as true if the Container performing the remove operation will delete this
|
|
2551
|
+
* Component upon remove.
|
|
2552
|
+
*
|
|
2553
|
+
* @template
|
|
2554
|
+
* @protected
|
|
2555
|
+
*/
|
|
2556
|
+
onRemoved : function(destroying) {
|
|
2557
|
+
var me = this;
|
|
2558
|
+
if (me.hasListeners.removed) {
|
|
2559
|
+
me.fireEvent('removed', me, me.ownerCt);
|
|
2560
|
+
}
|
|
2561
|
+
delete me.ownerCt;
|
|
2562
|
+
delete me.ownerLayout;
|
|
2563
|
+
},
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* Invoked before the Component is destroyed.
|
|
2567
|
+
*
|
|
2568
|
+
* @method
|
|
2569
|
+
* @template
|
|
2570
|
+
* @protected
|
|
2571
|
+
*/
|
|
2572
|
+
beforeDestroy : Ext.emptyFn,
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* Allows addition of behavior to the resize operation.
|
|
2576
|
+
*
|
|
2577
|
+
* Called when Ext.resizer.Resizer#drag event is fired.
|
|
2578
|
+
*
|
|
2579
|
+
* @method
|
|
2580
|
+
* @template
|
|
2581
|
+
* @protected
|
|
2582
|
+
*/
|
|
2583
|
+
onResize : Ext.emptyFn,
|
|
2584
|
+
|
|
2585
|
+
/**
|
|
2586
|
+
* Sets the width and height of this Component. This method fires the {@link #resize} event. This method can accept
|
|
2587
|
+
* either width and height as separate arguments, or you can pass a size object like `{width:10, height:20}`.
|
|
2588
|
+
*
|
|
2589
|
+
* @param {Number/String/Object} width The new width to set. This may be one of:
|
|
2590
|
+
*
|
|
2591
|
+
* - A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).
|
|
2592
|
+
* - A String used to set the CSS width style.
|
|
2593
|
+
* - A size object in the format `{width: widthValue, height: heightValue}`.
|
|
2594
|
+
* - `undefined` to leave the width unchanged.
|
|
2595
|
+
*
|
|
2596
|
+
* @param {Number/String} height The new height to set (not required if a size object is passed as the first arg).
|
|
2597
|
+
* This may be one of:
|
|
2598
|
+
*
|
|
2599
|
+
* - A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).
|
|
2600
|
+
* - A String used to set the CSS height style. Animation may **not** be used.
|
|
2601
|
+
* - `undefined` to leave the height unchanged.
|
|
2602
|
+
*
|
|
2603
|
+
* @return {Ext.Component} this
|
|
2604
|
+
*/
|
|
2605
|
+
setSize : function(width, height) {
|
|
2606
|
+
var me = this;
|
|
2607
|
+
|
|
2608
|
+
// support for standard size objects
|
|
2609
|
+
if (width && typeof width == 'object') {
|
|
2610
|
+
height = width.height;
|
|
2611
|
+
width = width.width;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
// Constrain within configured maxima
|
|
2615
|
+
if (typeof width == 'number') {
|
|
2616
|
+
me.width = Ext.Number.constrain(width, me.minWidth, me.maxWidth);
|
|
2617
|
+
} else if (width === null) {
|
|
2618
|
+
delete me.width;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
if (typeof height == 'number') {
|
|
2622
|
+
me.height = Ext.Number.constrain(height, me.minHeight, me.maxHeight);
|
|
2623
|
+
} else if (height === null) {
|
|
2624
|
+
delete me.height;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
// If not rendered, all we need to is set the properties.
|
|
2628
|
+
// The initial layout will set the size
|
|
2629
|
+
if (me.rendered && me.isVisible()) {
|
|
2630
|
+
|
|
2631
|
+
// If we are changing size, then we are not the root.
|
|
2632
|
+
me.updateLayout({
|
|
2633
|
+
isRoot: false
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
return me;
|
|
2638
|
+
},
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Determines whether this Component is the root of a layout. This returns `true` if
|
|
2642
|
+
* this component can run its layout without assistance from or impact on its owner.
|
|
2643
|
+
* If this component cannot run its layout given these restrictions, `false` is returned
|
|
2644
|
+
* and its owner will be considered as the next candidate for the layout root.
|
|
2645
|
+
*
|
|
2646
|
+
* Setting the {@link #_isLayoutRoot} property to `true` causes this method to always
|
|
2647
|
+
* return `true`. This may be useful when updating a layout of a Container which shrink
|
|
2648
|
+
* wraps content, and you know that it will not change size, and so can safely be the
|
|
2649
|
+
* topmost participant in the layout run.
|
|
2650
|
+
* @protected
|
|
2651
|
+
*/
|
|
2652
|
+
isLayoutRoot: function() {
|
|
2653
|
+
var me = this,
|
|
2654
|
+
ownerLayout = me.ownerLayout;
|
|
2655
|
+
|
|
2656
|
+
// Return true if we have been explicitly flagged as the layout root, or if we are floating.
|
|
2657
|
+
// Sometimes floating Components get an ownerCt ref injected into them which is *not* a true ownerCt, merely
|
|
2658
|
+
// an upward link for reference purposes. For example a grid column menu is linked to the
|
|
2659
|
+
// owning header via an ownerCt reference.
|
|
2660
|
+
if (!ownerLayout || me._isLayoutRoot || me.floating) {
|
|
2661
|
+
return true;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
return ownerLayout.isItemLayoutRoot(me);
|
|
2665
|
+
},
|
|
2666
|
+
|
|
2667
|
+
/**
|
|
2668
|
+
* Returns true if layout is suspended for this component. This can come from direct
|
|
2669
|
+
* suspension of this component's layout activity ({@link #suspendLayouts}) or if one
|
|
2670
|
+
* of this component's containers is suspended.
|
|
2671
|
+
*
|
|
2672
|
+
* @return {Boolean} True layout of this component is suspended.
|
|
2673
|
+
*/
|
|
2674
|
+
isLayoutSuspended: function () {
|
|
2675
|
+
var comp = this,
|
|
2676
|
+
ownerLayout;
|
|
2677
|
+
|
|
2678
|
+
while (comp) {
|
|
2679
|
+
if (comp.layoutSuspendCount || comp.suspendLayout) {
|
|
2680
|
+
return true;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
ownerLayout = comp.ownerLayout;
|
|
2684
|
+
if (!ownerLayout) {
|
|
2685
|
+
break;
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
// TODO - what about suspending a Layout instance?
|
|
2689
|
+
|
|
2690
|
+
// this works better than ownerCt since ownerLayout means "is managed by" in
|
|
2691
|
+
// the proper sense... some floating components have ownerCt but won't have an
|
|
2692
|
+
// ownerLayout
|
|
2693
|
+
comp = ownerLayout.owner;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
return false;
|
|
2697
|
+
},
|
|
2698
|
+
|
|
2699
|
+
/**
|
|
2700
|
+
* Updates this component's layout. If this update effects this components {@link #ownerCt},
|
|
2701
|
+
* that component's `updateLayout` method will be called to perform the layout instead.
|
|
2702
|
+
* Otherwise, just this component (and its child items) will layout.
|
|
2703
|
+
*
|
|
2704
|
+
* @param {Object} options An object with layout options.
|
|
2705
|
+
* @param {Boolean} options.defer True if this layout should be deferred.
|
|
2706
|
+
* @param {Boolean} options.isRoot True if this layout should be the root of the layout.
|
|
2707
|
+
*/
|
|
2708
|
+
updateLayout: function (options) {
|
|
2709
|
+
var me = this,
|
|
2710
|
+
defer,
|
|
2711
|
+
isRoot = options && options.isRoot;
|
|
2712
|
+
|
|
2713
|
+
if (!me.rendered || me.layoutSuspendCount || me.suspendLayout) {
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
if (me.hidden) {
|
|
2718
|
+
Ext.AbstractComponent.cancelLayout(me);
|
|
2719
|
+
} else if (typeof isRoot != 'boolean') {
|
|
2720
|
+
isRoot = me.isLayoutRoot();
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
// if we aren't the root, see if our ownerLayout will handle it...
|
|
2724
|
+
if (isRoot || !me.ownerLayout || !me.ownerLayout.onContentChange(me)) {
|
|
2725
|
+
// either we are the root or our ownerLayout doesn't care
|
|
2726
|
+
if (!me.isLayoutSuspended()) {
|
|
2727
|
+
// we aren't suspended (knew that), but neither is any of our ownerCt's...
|
|
2728
|
+
defer = (options && options.hasOwnProperty('defer')) ? options.defer : me.deferLayouts;
|
|
2729
|
+
Ext.AbstractComponent.updateLayout(me, defer);
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
},
|
|
2733
|
+
|
|
2734
|
+
/**
|
|
2735
|
+
* Returns an object that describes how this component's width and height are managed.
|
|
2736
|
+
* These objects are shared and should not be modified.
|
|
2737
|
+
*
|
|
2738
|
+
* @return {Object} The size model for this component.
|
|
2739
|
+
* @return {Ext.layout.SizeModel} return.width The {@link Ext.layout.SizeModel size model} for the width.
|
|
2740
|
+
* @return {Ext.layout.SizeModel} return.height The {@link Ext.layout.SizeModel size model} for the height.
|
|
2741
|
+
*/
|
|
2742
|
+
getSizeModel: function (ownerCtSizeModel) {
|
|
2743
|
+
var me = this,
|
|
2744
|
+
models = Ext.layout.SizeModel,
|
|
2745
|
+
ownerCtx = me.componentLayout.ownerContext,
|
|
2746
|
+
hasWidth, hasHeight, heightModel, ownerLayout, policy, shrinkWrap, widthModel;
|
|
2747
|
+
|
|
2748
|
+
if (ownerCtx) {
|
|
2749
|
+
widthModel = ownerCtx.widthModel;
|
|
2750
|
+
heightModel = ownerCtx.heightModel;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
if (!widthModel || !heightModel) {
|
|
2754
|
+
hasWidth = (typeof me.width == 'number');
|
|
2755
|
+
hasHeight = (typeof me.height == 'number');
|
|
2756
|
+
|
|
2757
|
+
// Floating or no owner layout, e.g. rendered using renderTo
|
|
2758
|
+
if (me.floating || !(ownerLayout = me.ownerLayout)) {
|
|
2759
|
+
if (hasWidth) {
|
|
2760
|
+
widthModel = models.configured;
|
|
2761
|
+
}
|
|
2762
|
+
if (hasHeight) {
|
|
2763
|
+
heightModel = models.configured;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
policy = Ext.layout.Layout.prototype.autoSizePolicy;
|
|
2767
|
+
shrinkWrap = me.floating ? 3 : me.shrinkWrap;
|
|
2768
|
+
} else {
|
|
2769
|
+
policy = ownerLayout.getItemSizePolicy(me, ownerCtSizeModel);
|
|
2770
|
+
shrinkWrap = ownerLayout.isItemShrinkWrap(me);
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
shrinkWrap = (shrinkWrap === true) ? 3 : (shrinkWrap || 0); // false->0, true->3
|
|
2774
|
+
|
|
2775
|
+
if (shrinkWrap !== 3) {
|
|
2776
|
+
if (!ownerCtSizeModel) {
|
|
2777
|
+
ownerCtSizeModel = me.ownerCt && me.ownerCt.getSizeModel();
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
if (ownerCtSizeModel) {
|
|
2781
|
+
shrinkWrap |= (ownerCtSizeModel.width.shrinkWrap ? 1 : 0) | (ownerCtSizeModel.height.shrinkWrap ? 2 : 0);
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
if (!widthModel) {
|
|
2786
|
+
if (!policy.setsWidth) {
|
|
2787
|
+
if (hasWidth) {
|
|
2788
|
+
widthModel = models.configured;
|
|
2789
|
+
} else {
|
|
2790
|
+
widthModel = (shrinkWrap & 1) ? models.shrinkWrap : models.natural;
|
|
2791
|
+
}
|
|
2792
|
+
} else if (policy.readsWidth) {
|
|
2793
|
+
if (hasWidth) {
|
|
2794
|
+
widthModel = models.calculatedFromConfigured;
|
|
2795
|
+
} else {
|
|
2796
|
+
widthModel = (shrinkWrap & 1) ? models.calculatedFromShrinkWrap :
|
|
2797
|
+
models.calculatedFromNatural;
|
|
2798
|
+
}
|
|
2799
|
+
} else {
|
|
2800
|
+
widthModel = models.calculated;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
if (!heightModel) {
|
|
2805
|
+
if (!policy.setsHeight) {
|
|
2806
|
+
if (hasHeight) {
|
|
2807
|
+
heightModel = models.configured;
|
|
2808
|
+
} else {
|
|
2809
|
+
heightModel = (shrinkWrap & 2) ? models.shrinkWrap : models.natural;
|
|
2810
|
+
}
|
|
2811
|
+
} else if (policy.readsHeight) {
|
|
2812
|
+
if (hasHeight) {
|
|
2813
|
+
heightModel = models.calculatedFromConfigured;
|
|
2814
|
+
} else {
|
|
2815
|
+
heightModel = (shrinkWrap & 2) ? models.calculatedFromShrinkWrap :
|
|
2816
|
+
models.calculatedFromNatural;
|
|
2817
|
+
}
|
|
2818
|
+
} else {
|
|
2819
|
+
heightModel = models.calculated;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
return {
|
|
2825
|
+
width: widthModel,
|
|
2826
|
+
height: heightModel
|
|
2827
|
+
};
|
|
2828
|
+
},
|
|
2829
|
+
|
|
2830
|
+
isDescendant: function(ancestor) {
|
|
2831
|
+
if (ancestor.isContainer) {
|
|
2832
|
+
for (var c = this.ownerCt; c; c = c.ownerCt) {
|
|
2833
|
+
if (c === ancestor) {
|
|
2834
|
+
return true;
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return false;
|
|
2839
|
+
},
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* This method needs to be called whenever you change something on this component that requires the Component's
|
|
2843
|
+
* layout to be recalculated.
|
|
2844
|
+
* @return {Ext.container.Container} this
|
|
2845
|
+
*/
|
|
2846
|
+
doComponentLayout : function() {
|
|
2847
|
+
this.updateLayout();
|
|
2848
|
+
return this;
|
|
2849
|
+
},
|
|
2850
|
+
|
|
2851
|
+
/**
|
|
2852
|
+
* Forces this component to redo its componentLayout.
|
|
2853
|
+
* @deprecated 4.1.0 Use {@link #updateLayout} instead.
|
|
2854
|
+
*/
|
|
2855
|
+
forceComponentLayout: function () {
|
|
2856
|
+
this.updateLayout();
|
|
2857
|
+
},
|
|
2858
|
+
|
|
2859
|
+
// @private
|
|
2860
|
+
setComponentLayout : function(layout) {
|
|
2861
|
+
var currentLayout = this.componentLayout;
|
|
2862
|
+
if (currentLayout && currentLayout.isLayout && currentLayout != layout) {
|
|
2863
|
+
currentLayout.setOwner(null);
|
|
2864
|
+
}
|
|
2865
|
+
this.componentLayout = layout;
|
|
2866
|
+
layout.setOwner(this);
|
|
2867
|
+
},
|
|
2868
|
+
|
|
2869
|
+
getComponentLayout : function() {
|
|
2870
|
+
var me = this;
|
|
2871
|
+
|
|
2872
|
+
if (!me.componentLayout || !me.componentLayout.isLayout) {
|
|
2873
|
+
me.setComponentLayout(Ext.layout.Layout.create(me.componentLayout, 'autocomponent'));
|
|
2874
|
+
}
|
|
2875
|
+
return me.componentLayout;
|
|
2876
|
+
},
|
|
2877
|
+
|
|
2878
|
+
/**
|
|
2879
|
+
* Called by the layout system after the Component has been layed out.
|
|
2880
|
+
*
|
|
2881
|
+
* @param {Number} width The width that was set
|
|
2882
|
+
* @param {Number} height The height that was set
|
|
2883
|
+
* @param {Number} oldWidth The old width. <code>undefined</code> if this was the initial layout.
|
|
2884
|
+
* @param {Number} oldHeight The old height. <code>undefined</code> if this was the initial layout.
|
|
2885
|
+
*
|
|
2886
|
+
* @template
|
|
2887
|
+
* @protected
|
|
2888
|
+
*/
|
|
2889
|
+
afterComponentLayout: function(width, height, oldWidth, oldHeight) {
|
|
2890
|
+
var me = this;
|
|
2891
|
+
if (++me.componentLayoutCounter === 1) {
|
|
2892
|
+
me.afterFirstLayout(width, height);
|
|
2893
|
+
}
|
|
2894
|
+
if (me.hasListeners.resize && (width !== oldWidth || height !== oldHeight)) {
|
|
2895
|
+
me.fireEvent('resize', me, width, height, oldWidth, oldHeight);
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
|
|
2899
|
+
/**
|
|
2900
|
+
* Occurs before componentLayout is run. Returning false from this method will prevent the componentLayout from
|
|
2901
|
+
* being executed.
|
|
2902
|
+
*
|
|
2903
|
+
* @param {Number} adjWidth The box-adjusted width that was set
|
|
2904
|
+
* @param {Number} adjHeight The box-adjusted height that was set
|
|
2905
|
+
*
|
|
2906
|
+
* @template
|
|
2907
|
+
* @protected
|
|
2908
|
+
*/
|
|
2909
|
+
beforeComponentLayout: function(width, height) {
|
|
2910
|
+
return true;
|
|
2911
|
+
},
|
|
2912
|
+
|
|
2913
|
+
/**
|
|
2914
|
+
* Sets the left and top of the component. To set the page XY position instead, use {@link #setPagePosition}. This
|
|
2915
|
+
* method fires the {@link #move} event.
|
|
2916
|
+
* @param {Number} left The new left
|
|
2917
|
+
* @param {Number} top The new top
|
|
2918
|
+
* @param {Boolean/Object} [animate] If true, the Component is _animated_ into its new position. You may also pass an
|
|
2919
|
+
* animation configuration.
|
|
2920
|
+
* @return {Ext.Component} this
|
|
2921
|
+
*/
|
|
2922
|
+
setPosition : function(x, y, animate) {
|
|
2923
|
+
var me = this,
|
|
2924
|
+
pos = me.beforeSetPosition.apply(me, arguments);
|
|
2925
|
+
|
|
2926
|
+
if (pos && me.rendered) {
|
|
2927
|
+
// Convert position WRT RTL
|
|
2928
|
+
pos = me.convertPosition(pos);
|
|
2929
|
+
|
|
2930
|
+
if (animate) {
|
|
2931
|
+
me.stopAnimation();
|
|
2932
|
+
me.animate(Ext.apply({
|
|
2933
|
+
duration: 1000,
|
|
2934
|
+
listeners: {
|
|
2935
|
+
afteranimate: Ext.Function.bind(me.afterSetPosition, me, [pos.left, pos.top])
|
|
2936
|
+
},
|
|
2937
|
+
to: pos
|
|
2938
|
+
}, animate));
|
|
2939
|
+
} else {
|
|
2940
|
+
// Must use Element's methods to set element position because, if it is a Layer (floater), it may need to sync a shadow
|
|
2941
|
+
// We must also only set the properties which are defined because Element.setLeftTop autos any undefined coordinates
|
|
2942
|
+
if (pos.left !== undefined && pos.top !== undefined) {
|
|
2943
|
+
me.el.setLeftTop(pos.left, pos.top);
|
|
2944
|
+
} else if (pos.left !== undefined) {
|
|
2945
|
+
me.el.setLeft(pos.left);
|
|
2946
|
+
} else if (pos.top !==undefined) {
|
|
2947
|
+
me.el.setTop(pos.top);
|
|
2948
|
+
}
|
|
2949
|
+
me.afterSetPosition(pos.left, pos.top);
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
return me;
|
|
2953
|
+
},
|
|
2954
|
+
|
|
2955
|
+
/**
|
|
2956
|
+
* @private Template method called before a Component is positioned.
|
|
2957
|
+
*/
|
|
2958
|
+
beforeSetPosition: function (x, y, animate) {
|
|
2959
|
+
var pos, x0;
|
|
2960
|
+
|
|
2961
|
+
// decode the position arguments:
|
|
2962
|
+
if (!x || Ext.isNumber(x)) {
|
|
2963
|
+
pos = { x: x, y : y, anim: animate };
|
|
2964
|
+
} else if (Ext.isNumber(x0 = x[0])) { // an array of [x, y]
|
|
2965
|
+
pos = { x : x0, y : x[1], anim: y };
|
|
2966
|
+
} else {
|
|
2967
|
+
pos = { x: x.x, y: x.y, anim: y }; // already an object w/ x & y properties
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
pos.hasX = Ext.isNumber(pos.x);
|
|
2971
|
+
pos.hasY = Ext.isNumber(pos.y);
|
|
2972
|
+
|
|
2973
|
+
// store the position as specified:
|
|
2974
|
+
this.x = pos.x;
|
|
2975
|
+
this.y = pos.y;
|
|
2976
|
+
|
|
2977
|
+
return (pos.hasX || pos.hasY) ? pos : null;
|
|
2978
|
+
},
|
|
2979
|
+
|
|
2980
|
+
/**
|
|
2981
|
+
* Template method called after a Component has been positioned.
|
|
2982
|
+
*
|
|
2983
|
+
* @param {Number} x
|
|
2984
|
+
* @param {Number} y
|
|
2985
|
+
*
|
|
2986
|
+
* @template
|
|
2987
|
+
* @protected
|
|
2988
|
+
*/
|
|
2989
|
+
afterSetPosition: function(x, y) {
|
|
2990
|
+
var me = this;
|
|
2991
|
+
me.onPosition(x, y);
|
|
2992
|
+
if (me.hasListeners.move) {
|
|
2993
|
+
me.fireEvent('move', me, x, y);
|
|
2994
|
+
}
|
|
2995
|
+
},
|
|
2996
|
+
|
|
2997
|
+
/**
|
|
2998
|
+
* This method converts an "{x: x, y: y}" object to a "{left: x+'px', top: y+'px'}" object.
|
|
2999
|
+
* The returned object contains the styles to set to effect the position. This is
|
|
3000
|
+
* overridden in RTL mode to be "{right: x, top: y}".
|
|
3001
|
+
* @private
|
|
3002
|
+
*/
|
|
3003
|
+
convertPosition: function (pos, withUnits) {
|
|
3004
|
+
var ret = {},
|
|
3005
|
+
El = Ext.Element;
|
|
3006
|
+
|
|
3007
|
+
if (pos.hasX) {
|
|
3008
|
+
ret.left = withUnits ? El.addUnits(pos.x) : pos.x;
|
|
3009
|
+
}
|
|
3010
|
+
if (pos.hasY) {
|
|
3011
|
+
ret.top = withUnits ? El.addUnits(pos.y) : pos.y;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
return ret;
|
|
3015
|
+
},
|
|
3016
|
+
|
|
3017
|
+
/**
|
|
3018
|
+
* Called after the component is moved, this method is empty by default but can be implemented by any
|
|
3019
|
+
* subclass that needs to perform custom logic after a move occurs.
|
|
3020
|
+
*
|
|
3021
|
+
* @param {Number} x The new x position
|
|
3022
|
+
* @param {Number} y The new y position
|
|
3023
|
+
*
|
|
3024
|
+
* @template
|
|
3025
|
+
* @protected
|
|
3026
|
+
*/
|
|
3027
|
+
onPosition: Ext.emptyFn,
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* Sets the width of the component. This method fires the {@link #resize} event.
|
|
3031
|
+
*
|
|
3032
|
+
* @param {Number} width The new width to setThis may be one of:
|
|
3033
|
+
*
|
|
3034
|
+
* - A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).
|
|
3035
|
+
* - A String used to set the CSS width style.
|
|
3036
|
+
*
|
|
3037
|
+
* @return {Ext.Component} this
|
|
3038
|
+
*/
|
|
3039
|
+
setWidth : function(width) {
|
|
3040
|
+
return this.setSize(width);
|
|
3041
|
+
},
|
|
3042
|
+
|
|
3043
|
+
/**
|
|
3044
|
+
* Sets the height of the component. This method fires the {@link #resize} event.
|
|
3045
|
+
*
|
|
3046
|
+
* @param {Number} height The new height to set. This may be one of:
|
|
3047
|
+
*
|
|
3048
|
+
* - A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).
|
|
3049
|
+
* - A String used to set the CSS height style.
|
|
3050
|
+
* - _undefined_ to leave the height unchanged.
|
|
3051
|
+
*
|
|
3052
|
+
* @return {Ext.Component} this
|
|
3053
|
+
*/
|
|
3054
|
+
setHeight : function(height) {
|
|
3055
|
+
return this.setSize(undefined, height);
|
|
3056
|
+
},
|
|
3057
|
+
|
|
3058
|
+
/**
|
|
3059
|
+
* Gets the current size of the component's underlying element.
|
|
3060
|
+
* @return {Object} An object containing the element's size {width: (element width), height: (element height)}
|
|
3061
|
+
*/
|
|
3062
|
+
getSize : function() {
|
|
3063
|
+
return this.el.getSize();
|
|
3064
|
+
},
|
|
3065
|
+
|
|
3066
|
+
/**
|
|
3067
|
+
* Gets the current width of the component's underlying element.
|
|
3068
|
+
* @return {Number}
|
|
3069
|
+
*/
|
|
3070
|
+
getWidth : function() {
|
|
3071
|
+
return this.el.getWidth();
|
|
3072
|
+
},
|
|
3073
|
+
|
|
3074
|
+
/**
|
|
3075
|
+
* Gets the current height of the component's underlying element.
|
|
3076
|
+
* @return {Number}
|
|
3077
|
+
*/
|
|
3078
|
+
getHeight : function() {
|
|
3079
|
+
return this.el.getHeight();
|
|
3080
|
+
},
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* Gets the {@link Ext.ComponentLoader} for this Component.
|
|
3084
|
+
* @return {Ext.ComponentLoader} The loader instance, null if it doesn't exist.
|
|
3085
|
+
*/
|
|
3086
|
+
getLoader: function(){
|
|
3087
|
+
var me = this,
|
|
3088
|
+
autoLoad = me.autoLoad ? (Ext.isObject(me.autoLoad) ? me.autoLoad : {url: me.autoLoad}) : null,
|
|
3089
|
+
loader = me.loader || autoLoad;
|
|
3090
|
+
|
|
3091
|
+
if (loader) {
|
|
3092
|
+
if (!loader.isLoader) {
|
|
3093
|
+
me.loader = new Ext.ComponentLoader(Ext.apply({
|
|
3094
|
+
target: me,
|
|
3095
|
+
autoLoad: autoLoad
|
|
3096
|
+
}, loader));
|
|
3097
|
+
} else {
|
|
3098
|
+
loader.setTarget(me);
|
|
3099
|
+
}
|
|
3100
|
+
return me.loader;
|
|
3101
|
+
|
|
3102
|
+
}
|
|
3103
|
+
return null;
|
|
3104
|
+
},
|
|
3105
|
+
|
|
3106
|
+
/**
|
|
3107
|
+
* Sets the dock position of this component in its parent panel. Note that this only has effect if this item is part
|
|
3108
|
+
* of the dockedItems collection of a parent that has a DockLayout (note that any Panel has a DockLayout by default)
|
|
3109
|
+
* @param {Object} dock The dock position.
|
|
3110
|
+
* @param {Boolean} [layoutParent=false] True to re-layout parent.
|
|
3111
|
+
* @return {Ext.Component} this
|
|
3112
|
+
*/
|
|
3113
|
+
setDocked : function(dock, layoutParent) {
|
|
3114
|
+
var me = this;
|
|
3115
|
+
|
|
3116
|
+
me.dock = dock;
|
|
3117
|
+
if (layoutParent && me.ownerCt && me.rendered) {
|
|
3118
|
+
me.ownerCt.updateLayout();
|
|
3119
|
+
}
|
|
3120
|
+
return me;
|
|
3121
|
+
},
|
|
3122
|
+
|
|
3123
|
+
/**
|
|
3124
|
+
*
|
|
3125
|
+
* @param {String/Number} border The border, see {@link #border}. If a falsey value is passed
|
|
3126
|
+
* the border will be removed.
|
|
3127
|
+
*/
|
|
3128
|
+
setBorder: function(border, /* private */ targetEl) {
|
|
3129
|
+
var me = this,
|
|
3130
|
+
initial = !!targetEl;
|
|
3131
|
+
|
|
3132
|
+
if (me.rendered || initial) {
|
|
3133
|
+
if (!initial) {
|
|
3134
|
+
targetEl = me.el;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
if (!border) {
|
|
3138
|
+
border = 0;
|
|
3139
|
+
} else {
|
|
3140
|
+
border = Ext.Element.unitizeBox((border === true) ? 1 : border);
|
|
3141
|
+
}
|
|
3142
|
+
targetEl.setStyle('border-width', border);
|
|
3143
|
+
if (!initial) {
|
|
3144
|
+
me.updateLayout();
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
me.border = border;
|
|
3148
|
+
},
|
|
3149
|
+
|
|
3150
|
+
onDestroy : function() {
|
|
3151
|
+
var me = this;
|
|
3152
|
+
|
|
3153
|
+
if (me.monitorResize && Ext.EventManager.resizeEvent) {
|
|
3154
|
+
Ext.EventManager.resizeEvent.removeListener(me.setSize, me);
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
// Destroying the floatingItems ZIndexManager will also destroy descendant floating Components
|
|
3158
|
+
Ext.destroy(
|
|
3159
|
+
me.componentLayout,
|
|
3160
|
+
me.loadMask,
|
|
3161
|
+
me.floatingItems
|
|
3162
|
+
);
|
|
3163
|
+
},
|
|
3164
|
+
|
|
3165
|
+
/**
|
|
3166
|
+
* Destroys the Component.
|
|
3167
|
+
*/
|
|
3168
|
+
destroy : function() {
|
|
3169
|
+
var me = this,
|
|
3170
|
+
selectors = me.renderSelectors,
|
|
3171
|
+
selector,
|
|
3172
|
+
el;
|
|
3173
|
+
|
|
3174
|
+
if (!me.isDestroyed) {
|
|
3175
|
+
if (!me.hasListeners.beforedestroy || me.fireEvent('beforedestroy', me) !== false) {
|
|
3176
|
+
me.destroying = true;
|
|
3177
|
+
me.beforeDestroy();
|
|
3178
|
+
|
|
3179
|
+
if (me.floating) {
|
|
3180
|
+
delete me.floatParent;
|
|
3181
|
+
// A zIndexManager is stamped into a *floating* Component when it is added to a Container.
|
|
3182
|
+
// If it has no zIndexManager at render time, it is assigned to the global Ext.WindowManager instance.
|
|
3183
|
+
if (me.zIndexManager) {
|
|
3184
|
+
me.zIndexManager.unregister(me);
|
|
3185
|
+
}
|
|
3186
|
+
} else if (me.ownerCt && me.ownerCt.remove) {
|
|
3187
|
+
me.ownerCt.remove(me, false);
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
me.onDestroy();
|
|
3191
|
+
|
|
3192
|
+
// Attempt to destroy all plugins
|
|
3193
|
+
Ext.destroy(me.plugins);
|
|
3194
|
+
|
|
3195
|
+
if (me.hasListeners.destroy) {
|
|
3196
|
+
me.fireEvent('destroy', me);
|
|
3197
|
+
}
|
|
3198
|
+
Ext.ComponentManager.unregister(me);
|
|
3199
|
+
|
|
3200
|
+
me.mixins.state.destroy.call(me);
|
|
3201
|
+
|
|
3202
|
+
me.clearListeners();
|
|
3203
|
+
// make sure we clean up the element references after removing all events
|
|
3204
|
+
if (me.rendered) {
|
|
3205
|
+
// In case we are queued for a layout.
|
|
3206
|
+
Ext.AbstractComponent.cancelLayout(me);
|
|
3207
|
+
|
|
3208
|
+
if (!me.preserveElOnDestroy) {
|
|
3209
|
+
me.el.remove();
|
|
3210
|
+
}
|
|
3211
|
+
me.mixins.elementCt.destroy.call(me); // removes childEls
|
|
3212
|
+
if (selectors) {
|
|
3213
|
+
for (selector in selectors) {
|
|
3214
|
+
if (selectors.hasOwnProperty(selector)) {
|
|
3215
|
+
el = me[selector];
|
|
3216
|
+
if (el) { // in case any other code may have already removed it
|
|
3217
|
+
delete me[selector];
|
|
3218
|
+
el.remove();
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
delete me.el;
|
|
3225
|
+
delete me.frameBody;
|
|
3226
|
+
delete me.rendered;
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
me.destroying = false;
|
|
3230
|
+
me.isDestroyed = true;
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
},
|
|
3234
|
+
|
|
3235
|
+
/**
|
|
3236
|
+
* Retrieves a plugin by its pluginId which has been bound to this component.
|
|
3237
|
+
* @param {String} pluginId
|
|
3238
|
+
* @return {Ext.AbstractPlugin} plugin instance.
|
|
3239
|
+
*/
|
|
3240
|
+
getPlugin: function(pluginId) {
|
|
3241
|
+
var i = 0,
|
|
3242
|
+
plugins = this.plugins,
|
|
3243
|
+
ln = plugins.length;
|
|
3244
|
+
for (; i < ln; i++) {
|
|
3245
|
+
if (plugins[i].pluginId === pluginId) {
|
|
3246
|
+
return plugins[i];
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
},
|
|
3250
|
+
|
|
3251
|
+
/**
|
|
3252
|
+
* Determines whether this component is the descendant of a particular container.
|
|
3253
|
+
* @param {Ext.Container} container
|
|
3254
|
+
* @return {Boolean} True if it is.
|
|
3255
|
+
*/
|
|
3256
|
+
isDescendantOf: function(container) {
|
|
3257
|
+
return !!this.findParentBy(function(p){
|
|
3258
|
+
return p === container;
|
|
3259
|
+
});
|
|
3260
|
+
}
|
|
3261
|
+
}, function() {
|
|
3262
|
+
var abstractComponent = this;
|
|
3263
|
+
|
|
3264
|
+
abstractComponent.createAlias({
|
|
3265
|
+
on: 'addListener',
|
|
3266
|
+
prev: 'previousSibling',
|
|
3267
|
+
next: 'nextSibling'
|
|
3268
|
+
});
|
|
3269
|
+
|
|
3270
|
+
Ext.resumeLayouts = function (flush) {
|
|
3271
|
+
abstractComponent.resumeLayouts(flush);
|
|
3272
|
+
};
|
|
3273
|
+
|
|
3274
|
+
Ext.suspendLayouts = function () {
|
|
3275
|
+
abstractComponent.suspendLayouts();
|
|
3276
|
+
};
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
*
|
|
3280
|
+
* Utility wrapper that suspends layouts of all components for the duration of a given function.
|
|
3281
|
+
* @param {Function} fn The function to execute.
|
|
3282
|
+
* @param {Object} scope (Optional) The scope (`this` reference) in which the specified function is executed.
|
|
3283
|
+
*/
|
|
3284
|
+
Ext.batchLayouts = function(fn, scope) {
|
|
3285
|
+
abstractComponent.suspendLayouts();
|
|
3286
|
+
// Invoke the function
|
|
3287
|
+
fn.call(scope);
|
|
3288
|
+
abstractComponent.resumeLayouts(true);
|
|
3289
|
+
};
|
|
3290
|
+
});
|