| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 | 
							- <!DOCTYPE html>
 
- <html>
 
- <head>
 
-   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
-   <title>The source code</title>
 
-   <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
 
-   <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
 
-   <style type="text/css">
 
-     .highlight { display: block; background-color: #ddd; }
 
-   </style>
 
-   <script type="text/javascript">
 
-     function highlight() {
 
-       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
 
-     }
 
-   </script>
 
- </head>
 
- <body onload="prettyPrint(); highlight();">
 
-   <pre class="prettyprint lang-js"><span id='Ext-layout-component-field-Trigger'>/**
 
- </span> * Layout class for {@link Ext.form.field.Trigger} fields. Adjusts the input field size to accommodate
 
-  * the trigger button(s).
 
-  * @private
 
-  */
 
- Ext.define('Ext.layout.component.field.Trigger', {
 
-     /* Begin Definitions */
 
-     alias: 'layout.triggerfield',
 
-     extend: 'Ext.layout.component.field.Field',
 
-     /* End Definitions */
 
-     type: 'triggerfield',
 
-     beginLayout: function(ownerContext) {
 
-         var me = this,
 
-             owner = me.owner,
 
-             flags;
 
-         ownerContext.triggerWrap = ownerContext.getEl('triggerWrap');
 
-         me.callParent(arguments);
 
-         // if any of these important states have changed, sync them now:
 
-         flags = owner.getTriggerStateFlags();
 
-         if (flags != owner.lastTriggerStateFlags) {
 
-             owner.lastTriggerStateFlags = flags;
 
-             me.updateEditState();
 
-         }
 
-     },
 
-     beginLayoutFixed: function (ownerContext, width, suffix) {
 
-         var me = this,
 
-             owner = ownerContext.target,
 
-             ieInputWidthAdjustment = me.ieInputWidthAdjustment || 0,
 
-             inputWidth = '100%',
 
-             triggerWrap = owner.triggerWrap;
 
-         me.callParent(arguments);
 
-         owner.inputCell.setStyle('width', '100%');
 
-         if(ieInputWidthAdjustment) {
 
-             // adjust for IE 6/7 strict content-box model
 
-             // RTL: This might have to be padding-left unless the senses of the padding styles switch when in RTL mode.
 
-             owner.inputCell.setStyle('padding-right', ieInputWidthAdjustment + 'px');
 
-             if(suffix === 'px') {
 
-                 if (owner.inputWidth) {
 
-                     inputWidth = owner.inputWidth - owner.getTriggerWidth();
 
-                 } else {
 
-                     inputWidth = width - ieInputWidthAdjustment - owner.getTriggerWidth();
 
-                 }
 
-                 inputWidth += 'px';
 
-             }
 
-         }
 
-         owner.inputEl.setStyle('width', inputWidth);
 
-         inputWidth = owner.inputWidth;
 
-         if (inputWidth) {
 
-             triggerWrap.setStyle('width', inputWidth + (ieInputWidthAdjustment) + 'px');
 
-         } else {
 
-             triggerWrap.setStyle('width', width + suffix);
 
-         }
 
-         triggerWrap.setStyle('table-layout', 'fixed');
 
-     },
 
-     beginLayoutShrinkWrap: function (ownerContext) {
 
-         var owner = ownerContext.target,
 
-             emptyString = '',
 
-             inputWidth = owner.inputWidth,
 
-             triggerWrap = owner.triggerWrap,
 
-             ieInputWidthAdjustment = this.ieInputWidthAdjustment || 0;
 
-         this.callParent(arguments);
 
-         if (inputWidth) {
 
-             triggerWrap.setStyle('width', inputWidth + 'px');
 
-             inputWidth = (inputWidth - owner.getTriggerWidth()) + 'px';
 
-             owner.inputEl.setStyle('width', inputWidth);
 
-             owner.inputCell.setStyle('width', inputWidth);
 
-         } else {
 
-             owner.inputCell.setStyle('width', emptyString);
 
-             owner.inputEl.setStyle('width', emptyString);
 
-             triggerWrap.setStyle('width', emptyString);
 
-             triggerWrap.setStyle('table-layout', 'auto');
 
-         }
 
-     },
 
-     getTextWidth: function () {
 
-         var me = this,
 
-             owner = me.owner,
 
-             inputEl = owner.inputEl,
 
-             value;
 
-         // Find the width that contains the whole text value
 
-         value = (inputEl.dom.value || (owner.hasFocus ? '' : owner.emptyText) || '') + owner.growAppend;
 
-         return inputEl.getTextWidth(value);
 
-     },
 
-     measureContentWidth: function (ownerContext) {
 
-         var me = this,
 
-             owner = me.owner,
 
-             width = me.callParent(arguments),
 
-             inputContext = ownerContext.inputContext,
 
-             calcWidth, max, min;
 
-         if (owner.grow && !ownerContext.state.growHandled) {
 
-             calcWidth = me.getTextWidth() + ownerContext.inputContext.getFrameInfo().width;
 
-             max = owner.growMax;
 
-             min = Math.min(max, width);
 
-             max = Math.max(owner.growMin, max, min);
 
-             // Constrain
 
-             calcWidth = Ext.Number.constrain(calcWidth, owner.growMin, max);
 
-             inputContext.setWidth(calcWidth);
 
-             ownerContext.state.growHandled = true;
 
-             
 
-             // Now that we've set the inputContext, we need to recalculate the width
 
-             inputContext.domBlock(me, 'width');
 
-             width = NaN;
 
-         }
 
-         return width;
 
-     },
 
-     updateEditState: function() {
 
-         var me = this,
 
-             owner = me.owner,
 
-             inputEl = owner.inputEl,
 
-             noeditCls = Ext.baseCSSPrefix + 'trigger-noedit',
 
-             displayed,
 
-             readOnly;
 
-         if (me.owner.readOnly) {
 
-             inputEl.addCls(noeditCls);
 
-             readOnly = true;
 
-             displayed = false;
 
-         } else {
 
-             if (me.owner.editable) {
 
-                 inputEl.removeCls(noeditCls);
 
-                 readOnly = false;
 
-             } else {
 
-                 inputEl.addCls(noeditCls);
 
-                 readOnly = true;
 
-             }
 
-             displayed = !me.owner.hideTrigger;
 
-         }
 
-         owner.triggerCell.setDisplayed(displayed);
 
-         inputEl.dom.readOnly = readOnly;
 
-     }
 
- });
 
- </pre>
 
- </body>
 
- </html>
 
 
  |