{ "bigcode": { "train": { "total_tokens": 906289921, "example": "////////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Licensed to the Apache Software Foundation (ASF) under one or more\r\n// contributor license agreements. See the NOTICE file distributed with\r\n// this work for additional information regarding copyright ownership.\r\n// The ASF licenses this file to You under the Apache License, Version 2.0\r\n// (the \"License\"); you may not use this file except in compliance with\r\n// the License. You may obtain a copy of the License at\r\n//\r\n// http://www.apache.org/licenses/LICENSE-2.0\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n//\r\n////////////////////////////////////////////////////////////////////////////////\r\n\r\n/*\r\n\r\nThe implementations of DefaultGridItemRenderer (nee UIFTETExtFieldGridItemRenderer) and UITextFieldGridItemRenderer\r\nare identical, save the superclass and constructor names. This file contains the bulk of the code.\r\n\r\n*/\r\n import flash.display.DisplayObject;\r\n import flash.events.Event;\r\n import flash.geom.Matrix;\r\n import flash.geom.Matrix3D;\r\n import flash.geom.Point;\r\n import flash.geom.Rectangle;\r\n import flash.geom.Vector3D;\r\n import flash.utils.getDefinitionByName;\r\n import flash.utils.getQualifiedClassName;\r\n import flash.utils.getQualifiedSuperclassName;\r\n \r\n import mx.core.DesignLayer;\r\n import mx.core.IFlexDisplayObject;\r\n import mx.core.IFlexModuleFactory;\r\n import mx.core.ILayoutDirectionElement;\r\n import mx.core.IToolTip;\r\n import mx.core.LayoutDirection;\r\n import mx.core.mx_internal;\r\n import mx.events.FlexEvent;\r\n import mx.events.ToolTipEvent;\r\n import mx.geom.TransformOffsets;\r\n import mx.managers.ISystemManager;\r\n import mx.managers.ToolTipManager;\r\n import mx.styles.CSSStyleDeclaration;\r\n import mx.styles.IStyleClient;\r\n import mx.styles.StyleProtoChain;\r\n \r\n import spark.components.Grid;\r\n import spark.components.gridClasses.GridColumn;\r\n \r\n use namespace mx_internal;\r\n\r\n /**\r\n * @private\r\n * Distance by which this textfield is inset from the edges of the cell.\r\n * See setLayoutBoundsPosition() and setLayoutBoundsSize().\r\n */\r\n private static const LEFT_PADDING:Number = 5; \r\n private static const RIGHT_PADDING:Number = 5;\r\n private static const TOP_PADDING:Number = 4;\r\n private static const BOTTOM_PADDING:Number = 3;\r\n \r\n /**\r\n * @private\r\n * The updatePreferredSize() method only updates preferredWidth,Height if \r\n * preferredSizeInvalid is true.\r\n */\r\n private var preferredSizeInvalid:Boolean = false;\r\n private var preferredWidth:Number;\r\n private var preferredHeight:Number;\r\n \r\n /**\r\n * @private\r\n * A workaround for the fact that UITextField automatically calls validateNow()\r\n * when its text property is set.\r\n */\r\n private var enableValidateNow:Boolean = true;\r\n\r\n /**\r\n * @private\r\n * Used to prevent changes to width,height caused by calling setLayoutBoundsSize()\r\n * from updating explicitWidth,Height.\r\n */\r\n private var inSetLayoutBoundsSize:Boolean = false;\r\n\r\n /**\r\n * @private\r\n * Temporarily stores the values of styles specified with setStyle() until \r\n * moduleFactory is set.\r\n */\r\n private var deferredSetStyles:Object = null;\r\n\r\n //--------------------------------------------------------------------------\r\n //\r\n // Properties \r\n //\r\n //--------------------------------------------------------------------------\r\n \r\n private function dispatchChangeEvent(type:String):void\r\n {\r\n if (hasEventListener(type))\r\n dispatchEvent(new Event(type));\r\n }\r\n \r\n //----------------------------------\r\n // column\r\n //----------------------------------\r\n \r\n private var _column:GridColumn = null;\r\n \r\n [Bindable(\"columnChanged\")]\r\n \r\n /**\r\n * @inheritDoc\r\n * \r\n * @default null\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function get column():GridColumn\r\n {\r\n return _column;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set column(value:GridColumn):void\r\n {\r\n if (_column == value)\r\n return;\r\n \r\n _column = value;\r\n dispatchChangeEvent(\"columnChanged\");\r\n }\r\n\r\n //----------------------------------\r\n // column\r\n //----------------------------------\r\n\r\n /**\r\n * @inheritDoc\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function get columnIndex():int\r\n {\r\n return (_column)? _column.columnIndex : -1;\r\n }\r\n\r\n \r\n //----------------------------------\r\n // data\r\n //----------------------------------\r\n \r\n private var _data:Object = null;\r\n \r\n [Bindable(\"dataChange\")] // compatible with FlexEvent.DATA_CHANGE\r\n \r\n /**\r\n * The value of the data provider item for the entire row of the grid control.\r\n * Item renderers often bind visual element attributes to properties of this object. \r\n * \r\n * @default null\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function get data():Object\r\n {\r\n return _data;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set data(value:Object):void\r\n {\r\n if (_data == value)\r\n return;\r\n \r\n _data = value;\r\n \r\n const eventType:String = \"dataChange\"; \r\n if (hasEventListener(eventType))\r\n dispatchEvent(new FlexEvent(eventType)); \r\n }\r\n \r\n //----------------------------------\r\n // down\r\n //----------------------------------\r\n \r\n private var _down:Boolean = false;\r\n \r\n [Bindable(\"downChanged\")] \r\n \r\n /**\r\n *

The grid control's updateDisplayList() method sets this property \r\n * before calling prepare().

\r\n * \r\n * @inheritDoc\r\n * \r\n * @default false\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */ \r\n public function get down():Boolean\r\n {\r\n return _down;\r\n }\r\n \r\n /**\r\n * @private\r\n */ \r\n public function set down(value:Boolean):void\r\n {\r\n if (_down == value)\r\n return;\r\n \r\n _down = value;\r\n dispatchChangeEvent(\"downChanged\"); \r\n }\r\n\r\n //----------------------------------\r\n // grid\r\n //----------------------------------\r\n \r\n /**\r\n * The grid control associated with this item renderer.\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.0\r\n * @productversion Flex 4.5 \r\n */\r\n public function get grid():Grid\r\n {\r\n return (_column)? _column.grid : null;\r\n } \r\n\r\n //----------------------------------\r\n // hovered\r\n //----------------------------------\r\n \r\n private var _hovered:Boolean = false;\r\n \r\n [Bindable(\"hoveredChanged\")] \r\n \r\n /**\r\n * Set to true when the mouse is hovered over the item renderer.\r\n *\r\n * @default false\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.0\r\n * @productversion Flex 4.5 \r\n */ \r\n public function get hovered():Boolean\r\n {\r\n return _hovered;\r\n }\r\n \r\n /**\r\n * @private\r\n */ \r\n public function set hovered(value:Boolean):void\r\n {\r\n if (_hovered == value)\r\n return;\r\n \r\n _hovered = value;\r\n dispatchChangeEvent(\"hoveredChanged\"); \r\n }\r\n \r\n //----------------------------------\r\n // rowIndex\r\n //----------------------------------\r\n \r\n private var _rowIndex:int = -1;\r\n \r\n [Bindable(\"rowIndexChanged\")]\r\n \r\n /**\r\n *

The grid control's updateDisplayList() method sets this property \r\n * before calling prepare().

\r\n * \r\n * @inheritDoc\r\n * \r\n * @default -1\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.0\r\n * @productversion Flex 4.5 \r\n */ \r\n public function get rowIndex():int\r\n {\r\n return _rowIndex;\r\n }\r\n \r\n /**\r\n * @private\r\n */ \r\n public function set rowIndex(value:int):void\r\n {\r\n if (_rowIndex == value)\r\n return;\r\n \r\n _rowIndex = value;\r\n dispatchChangeEvent(\"rowIndexChanged\"); \r\n }\r\n \r\n //----------------------------------\r\n // showsCaret\r\n //----------------------------------\r\n \r\n private var _showsCaret:Boolean = false;\r\n \r\n [Bindable(\"showsCaretChanged\")] \r\n \r\n /**\r\n *

The grid control's updateDisplayList() method sets this property \r\n * before calling preprare().

\r\n * \r\n * @inheritDoc\r\n * \r\n * @default false\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.0\r\n * @productversion Flex 4.5 \r\n */ \r\n public function get showsCaret():Boolean\r\n {\r\n return _showsCaret;\r\n }\r\n \r\n /**\r\n * @private\r\n */ \r\n public function set showsCaret(value:Boolean):void\r\n {\r\n if (_showsCaret == value)\r\n return;\r\n \r\n _showsCaret = value;\r\n dispatchChangeEvent(\"labelDisplayChanged\"); \r\n }\r\n \r\n //----------------------------------\r\n // selected\r\n //----------------------------------\r\n \r\n private var _selected:Boolean = false;\r\n \r\n [Bindable(\"selectedChanged\")] \r\n \r\n /**\r\n *

The grid control's updateDisplayList() method sets this property \r\n * before calling prepare().

\r\n * \r\n * @inheritDoc\r\n * \r\n * @default false\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.0\r\n * @productversion Flex 4.5 \r\n */ \r\n public function get selected():Boolean\r\n {\r\n return _selected;\r\n }\r\n \r\n /**\r\n * @private\r\n */ \r\n public function set selected(value:Boolean):void\r\n {\r\n if (_selected == value)\r\n return;\r\n \r\n _selected = value;\r\n dispatchChangeEvent(\"selectedChanged\"); \r\n }\r\n \r\n //----------------------------------\r\n // dragging\r\n //----------------------------------\r\n \r\n private var _dragging:Boolean = false;\r\n \r\n [Bindable(\"draggingChanged\")] \r\n \r\n /**\r\n * @inheritDoc\r\n * \r\n * @default false\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function get dragging():Boolean\r\n {\r\n return _dragging;\r\n }\r\n \r\n /**\r\n * @private \r\n */\r\n public function set dragging(value:Boolean):void\r\n {\r\n if (_dragging == value)\r\n return;\r\n \r\n _dragging = value;\r\n dispatchChangeEvent(\"draggingChanged\"); \r\n }\r\n \r\n //----------------------------------\r\n // label\r\n //----------------------------------\r\n \r\n private var _label:String = \"\";\r\n \r\n [Bindable(\"labelChanged\")]\r\n \r\n /**\r\n *

The grid control sets this property to the value of the column's \r\n * itemToLabel() method, before calling preprare().

\r\n *\r\n * @inheritDoc\r\n * \r\n * @default \"\" \r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.0\r\n * @productversion Flex 4.5 \r\n */\r\n public function get label():String\r\n {\r\n return _label;\r\n }\r\n \r\n /**\r\n * @private\r\n */ \r\n public function set label(value:String):void\r\n {\r\n if (_label == value)\r\n return;\r\n \r\n _label = value;\r\n preferredSizeInvalid = true;\r\n // Defer setting the labelDisplay's text property to avoid extra computation, see updatePreferredSize()\r\n \r\n dispatchChangeEvent(\"labelChanged\");\r\n }\r\n \r\n //----------------------------------\r\n // moduleFactory\r\n //----------------------------------\r\n\r\n /**\r\n * @private\r\n */\r\n override public function set moduleFactory(factory:IFlexModuleFactory):void\r\n {\r\n super.moduleFactory = factory; \r\n \r\n // Now that the module has been set, set any deferred styles.\r\n if (deferredSetStyles)\r\n {\r\n for (var styleProp:String in deferredSetStyles)\r\n StyleProtoChain.setStyle(this, styleProp, deferredSetStyles[styleProp]);\r\n \r\n deferredSetStyles = null;\r\n }\r\n }\r\n\r\n //----------------------------------\r\n // multiline\r\n //----------------------------------\r\n \r\n private var multilineSet:Boolean = false; // true if explicitly set\r\n \r\n /**\r\n * @private\r\n */\r\n override public function set multiline(value:Boolean):void\r\n {\r\n super.multiline = value;\r\n multilineSet = true; \r\n }\r\n \r\n //----------------------------------\r\n // text\r\n //----------------------------------\r\n\r\n /**\r\n * @private\r\n * Inherited version of this method calls validateNow(). We do not, since GridLayout will. We're \r\n * also assuming that this property will not be set directly, but only by our updatePreferredSize()\r\n * method.\r\n */\r\n override public function set text(value:String):void\r\n {\r\n enableValidateNow = false;\r\n super.text = value;\r\n preferredSizeInvalid = true;\r\n enableValidateNow = true;\r\n }\r\n \r\n //----------------------------------\r\n // wordWrap\r\n //----------------------------------\r\n\r\n private var wordWrapSet:Boolean = false; // true if explicitly set\r\n\r\n /**\r\n * @private\r\n * If set, then set the wordWrapSet flag. This is used to enable the updatePreferredSize()\r\n * method to initialize the wordWrap based on the grid's varaibleRowHeight flag, if\r\n * wordWrap wasn't explicitly set.\r\n */\r\n override public function set wordWrap(value:Boolean):void\r\n {\r\n super.wordWrap = value;\r\n wordWrapSet = true;\r\n }\r\n\r\n //--------------------------------------------------------------------------\r\n //\r\n // Overridden methods\r\n //\r\n //--------------------------------------------------------------------------\r\n \r\n [Bindable(style=\"true\")]\r\n /**\r\n * @private \r\n */\r\n override public function getStyle(styleProp:String):*\r\n {\r\n // If a moduleFactory has not be set yet, first check for any deferred\r\n // styles. If there are no deferred styles or the styleProp is not in \r\n // the deferred styles, the look in the proto chain.\r\n if (!moduleFactory)\r\n {\r\n if (deferredSetStyles && deferredSetStyles[styleProp]!== undefined)\r\n return deferredSetStyles[styleProp];\r\n }\r\n \r\n return super.getStyle(styleProp);\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n override public function setStyle(styleProp:String, newValue:*):void\r\n {\r\n // If there is no module factory then defer the set\r\n // style until a module factory is set.\r\n if (moduleFactory)\r\n {\r\n StyleProtoChain.setStyle(this, styleProp, newValue);\r\n }\r\n else\r\n {\r\n if (!deferredSetStyles)\r\n deferredSetStyles = {};\r\n deferredSetStyles[styleProp] = newValue;\r\n } \r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n override public function styleChanged(styleProp:String):void\r\n {\r\n super.styleChanged(styleProp);\r\n preferredSizeInvalid = true;\r\n }\r\n \r\n /**\r\n * @private\r\n * The renderer's measuredWidth,Height are just padded versions of the labelDisplay's\r\n * textWidth,Height or explicitWidth,Height properties. This class assumes that its\r\n * size/position will be set by GridLayout with setLayoutBoundsSize,Position() and that its\r\n * preferred size will be queried by GridLayout with getPreferredBoundsWidth,Height().\r\n */\r\n private function updatePreferredSize():void\r\n {\r\n if (!preferredSizeInvalid)\r\n return;\r\n \r\n // If the wordWrap property hasn't been explicitly set, then it's value\r\n // is the same as the grid's variableRowHeight property.\r\n \r\n if (!wordWrapSet && column && column.grid)\r\n super.wordWrap = column.grid.variableRowHeight;\r\n \r\n // Only automatically set multiline=\"true\" if lineBreak=\"explicit\" and the\r\n // text actually contains a newline, since doing so is expensive.\r\n\r\n if (!multilineSet && (getStyle(\"lineBreak\") == \"explicit\"))\r\n super.multiline = _label.indexOf(\"\\n\")!= -1;\r\n \r\n text = _label;\r\n super.validateNow();\r\n \r\n // The LEFT,RIGHT,TOP,BOTTOM padding values added here will be subtracted\r\n // by setLayoutBoundsPosition,Size(), they don't exist as far as the text field\r\n // superclass is concerned.\r\n \r\n // Both UITextField and UIFTETExtField force explicitWidth to be >= 4,\r\n // so we do the same here.\r\n \r\n const paddedTextWidth:Number = isNaN(explicitWidth)? \r\n textWidth + LEFT_PADDING + RIGHT_PADDING + TEXT_WIDTH_PADDING : \r\n Math.max(explicitWidth, 4, LEFT_PADDING + RIGHT_PADDING + TEXT_WIDTH_PADDING);\r\n \r\n const paddedTextHeight:Number = isNaN(explicitHeight)? \r\n textHeight + TOP_PADDING + BOTTOM_PADDING + TEXT_HEIGHT_PADDING : \r\n Math.max(explicitHeight, TOP_PADDING + BOTTOM_PADDING + TEXT_HEIGHT_PADDING);\r\n \r\n if (!stage || embedFonts)\r\n {\r\n preferredWidth = paddedTextWidth;\r\n preferredHeight = paddedTextHeight;\r\n }\r\n else \r\n {\r\n const m:Matrix = transform.concatenatedMatrix; \r\n preferredWidth = Math.abs((paddedTextWidth * m.a / m.d));\r\n preferredHeight = Math.abs((paddedTextHeight * m.a / m.d));\r\n }\r\n \r\n GridItemRenderer.initializeRendererToolTip(this);\r\n \r\n preferredSizeInvalid = false;\r\n\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n override public function validateNow():void\r\n {\r\n if (!enableValidateNow ||!parent)\r\n return;\r\n \r\n updatePreferredSize(); \r\n }\r\n \r\n //--------------------------------------------------------------------------\r\n //\r\n // IGridItemRenderer Methods\r\n //\r\n //-------------------------------------------------------------------------- \r\n \r\n /**\r\n * @inheritDoc\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function prepare(willBeRecycled:Boolean):void\r\n {\r\n }\r\n \r\n /**\r\n * @inheritDoc\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function discard(hasBeenRecycled:Boolean):void\r\n {\r\n if (!multilineSet)\r\n super.multiline = false;\r\n if (!wordWrapSet)\r\n super.wordWrap = false;\r\n } \r\n \r\n //--------------------------------------------------------------------------\r\n //\r\n // IVisualElement Properties, Methods\r\n //\r\n //-------------------------------------------------------------------------- \r\n \r\n //----------------------------------\r\n // width\r\n //----------------------------------\r\n \r\n /**\r\n * @private\r\n */\r\n override public function set width(value:Number):void \r\n {\r\n super.width = value;\r\n if (!inSetLayoutBoundsSize)\r\n {\r\n explicitWidth = value;\r\n preferredSizeInvalid = true;\r\n }\r\n }\r\n \r\n //----------------------------------\r\n // height\r\n //----------------------------------\r\n \r\n /**\r\n * @private\r\n */\r\n override public function set height(value:Number):void \r\n {\r\n super.height = value;\r\n if (!inSetLayoutBoundsSize)\r\n {\r\n explicitHeight = value;\r\n preferredSizeInvalid = true;\r\n }\r\n } \r\n \r\n /**\r\n * @private\r\n */\r\n public function get depth():Number\r\n {\r\n return 0;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set depth(value:Number):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get designLayer():DesignLayer\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set designLayer(value:DesignLayer):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get postLayoutTransformOffsets():TransformOffsets\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set postLayoutTransformOffsets(value:TransformOffsets):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get is3D():Boolean\r\n {\r\n return false;\r\n }\r\n \r\n //--------------------------------------------------------------------------\r\n //\r\n // ILayoutElement Methods\r\n //\r\n //-------------------------------------------------------------------------- \r\n \r\n /**\r\n * @private\r\n */\r\n public function get left():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set left(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get right():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set right(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get top():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set top(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get bottom():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set bottom(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get horizontalCenter():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set horizontalCenter(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get verticalCenter():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set verticalCenter(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function get baseline():Object\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set baseline(value:Object):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getPreferredBoundsWidth(postLayoutTransform:Boolean=true):Number\r\n {\r\n updatePreferredSize();\r\n return preferredWidth;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getPreferredBoundsHeight(postLayoutTransform:Boolean=true):Number\r\n {\r\n updatePreferredSize();\r\n return preferredHeight;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getMinBoundsWidth(postLayoutTransform:Boolean=true):Number\r\n {\r\n return minWidth;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getMinBoundsHeight(postLayoutTransform:Boolean=true):Number\r\n {\r\n return minHeight;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getMaxBoundsWidth(postLayoutTransform:Boolean=true):Number\r\n {\r\n return maxWidth;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getMaxBoundsHeight(postLayoutTransform:Boolean=true):Number\r\n {\r\n return maxHeight;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getBoundsXAtSize(width:Number, height:Number, postLayoutTransform:Boolean = true):Number\r\n {\r\n return x - LEFT_PADDING;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getBoundsYAtSize(width:Number, height:Number, postLayoutTransform:Boolean = true):Number\r\n {\r\n return y - TOP_PADDING;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getLayoutBoundsWidth(postLayoutTransform:Boolean=true):Number\r\n {\r\n return width + LEFT_PADDING + RIGHT_PADDING;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getLayoutBoundsHeight(postLayoutTransform:Boolean=true):Number\r\n {\r\n return height + TOP_PADDING + BOTTOM_PADDING;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getLayoutBoundsX(postLayoutTransform:Boolean=true):Number\r\n {\r\n return x - LEFT_PADDING;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getLayoutBoundsY(postLayoutTransform:Boolean=true):Number\r\n {\r\n return y - TOP_PADDING;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function setLayoutBoundsPosition(x:Number, y:Number, postLayoutTransform:Boolean=true):void\r\n {\r\n move(x + LEFT_PADDING, y + TOP_PADDING);\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function setLayoutBoundsSize(width:Number, height:Number, postLayoutTransform:Boolean=true):void\r\n {\r\n inSetLayoutBoundsSize = true; // UI[FTE]TextField/setActualSize() sets width,height\r\n \r\n setActualSize(width - (LEFT_PADDING + RIGHT_PADDING), height - (TOP_PADDING + BOTTOM_PADDING));\r\n preferredSizeInvalid = true;\r\n \r\n inSetLayoutBoundsSize = false; \r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getLayoutMatrix():Matrix\r\n {\r\n return null;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function setLayoutMatrix(value:Matrix, invalidateLayout:Boolean):void\r\n { \r\n } \r\n \r\n /**\r\n * @private\r\n */\r\n public function get hasLayoutMatrix3D():Boolean\r\n {\r\n return false;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function getLayoutMatrix3D():Matrix3D\r\n {\r\n return null; \r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function setLayoutMatrix3D(value:Matrix3D, invalidateLayout:Boolean):void\r\n {\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function transformAround(transformCenter:Vector3D,\r\n scale:Vector3D = null,\r\n rotation:Vector3D = null,\r\n translation:Vector3D = null,\r\n postLayoutScale:Vector3D = null,\r\n postLayoutRotation:Vector3D = null,\r\n postLayoutTranslation:Vector3D = null,\r\n invalidateLayout:Boolean = true):void\r\n {\r\n }\r\n \r\n //--------------------------------------------------------------------------\r\n //\r\n // ILayoutDirectionElement Methods\r\n //\r\n //-------------------------------------------------------------------------- \r\n \r\n /**\r\n * @inheritDoc\r\n * \r\n * The renderer will inherit layoutDirection from its parent.\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function get layoutDirection():String\r\n {\r\n return getStyle(\"layoutDirection\"); \r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set layoutDirection(value:String):void\r\n {\r\n }\r\n\r\n /**\r\n * @private \r\n */\r\n public function invalidateLayoutDirection():void\r\n {\r\n }\r\n \r\n //--------------------------------------------------------------------------\r\n //\r\n // IStyleClient Methods and Properties\r\n // (source code from mx.controls.dataGridClassses.DataGridItemRenderer.as)\r\n //-------------------------------------------------------------------------- \r\n \r\n /**\r\n * @private\r\n */\r\n public function getClassStyleDeclarations():Array\r\n {\r\n var className:String = getQualifiedClassName(this).replace(\"::\", \".\");\r\n const styleDeclarations:Array = [];\r\n \r\n while ((className!= \"mx.core.UIFTETextField\") && (className!= \"mx.core.UITextField\"))\r\n {\r\n var styleDeclaration:CSSStyleDeclaration = styleManager.getMergedStyleDeclaration(className);\r\n if (styleDeclaration)\r\n styleDeclarations.unshift(styleDeclaration);\r\n \r\n try\r\n {\r\n className = getQualifiedSuperclassName(getDefinitionByName(className)).replace(\"::\", \".\");\r\n }\r\n catch(e:ReferenceError)\r\n {\r\n break;\r\n }\r\n } \r\n \r\n return styleDeclarations;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function initProtoChain():void\r\n {\r\n styleChangedFlag = true;\r\n \r\n var classSelectors:Array = [];\r\n \r\n if (styleName)\r\n {\r\n if (styleName is CSSStyleDeclaration)\r\n {\r\n // Get the style sheet referenced by the styleName property\r\n classSelectors.push(CSSStyleDeclaration(styleName));\r\n }\r\n else if (styleName is IFlexDisplayObject)\r\n {\r\n // If the styleName property is a UIComponent, then there's a\r\n // special search path for that case.\r\n StyleProtoChain.initProtoChainForUIComponentStyleName(this);\r\n return;\r\n }\r\n else if (styleName is String)\r\n {\r\n // Get the style sheet referenced by the styleName property\r\n var styleNames:Array = styleName.split(/\\s+/);\r\n for (var c:int=0; c < styleNames.length; c++)\r\n {\r\n if (styleNames[c].length) {\r\n classSelectors.push(styleManager.getMergedStyleDeclaration(\".\" + \r\n styleNames[c]));\r\n }\r\n }\r\n }\r\n }\r\n \r\n // To build the proto chain, we start at the end and work forward.\r\n // Referring to the list at the top of this function, we'll start by\r\n // getting the tail of the proto chain, which is:\r\n // - for non-inheriting styles, the global style sheet\r\n // - for inheriting styles, my parent's style object\r\n \r\n var nonInheritChain:Object = styleManager.stylesRoot;\r\n \r\n var p:IStyleClient = parent as IStyleClient;\r\n if (p)\r\n {\r\n var inheritChain:Object = p.inheritingStyles;\r\n if (inheritChain == StyleProtoChain.STYLE_UNINITIALIZED)\r\n inheritChain = nonInheritChain;\r\n }\r\n else\r\n {\r\n inheritChain = styleManager.stylesRoot;\r\n }\r\n \r\n // Working backwards up the list, the next element in the\r\n // search path is the type selector\r\n var typeSelectors:Array = getClassStyleDeclarations();\r\n var n:int = typeSelectors.length;\r\n for (var i:int = 0; i < n; i++)\r\n {\r\n var typeSelector:CSSStyleDeclaration = typeSelectors[i];\r\n inheritChain = typeSelector.addStyleToProtoChain(inheritChain, this);\r\n nonInheritChain = typeSelector.addStyleToProtoChain(nonInheritChain, this);\r\n }\r\n \r\n // Next are the class selectors\r\n for (i = 0; i < classSelectors.length; i++)\r\n {\r\n var classSelector:CSSStyleDeclaration = classSelectors[i];\r\n if (classSelector)\r\n {\r\n inheritChain = classSelector.addStyleToProtoChain(inheritChain, this);\r\n nonInheritChain = classSelector.addStyleToProtoChain(nonInheritChain, this);\r\n }\r\n }\r\n \r\n // Finally, we'll add the in-line styles\r\n // to the head of the proto chain.\r\n inheritingStyles = styleDeclaration?\r\n styleDeclaration.addStyleToProtoChain(inheritChain, this) :\r\n inheritChain;\r\n \r\n nonInheritingStyles = styleDeclaration?\r\n styleDeclaration.addStyleToProtoChain(nonInheritChain, this) :\r\n nonInheritChain;\r\n }\r\n \r\n /**\r\n * @private\r\n * \r\n * @langversion 3.0\r\n * @playerversion Flash 10\r\n * @playerversion AIR 2.5\r\n * @productversion Flex 4.5\r\n */\r\n public function clearStyle(styleProp:String):void\r\n {\r\n setStyle(styleProp, undefined);\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function regenerateStyleCache(recursive:Boolean):void\r\n {\r\n initProtoChain();\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void\r\n { \r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function registerEffects(effects:Array /* of String */):void\r\n {\r\n } \r\n \r\n //----------------------------------\r\n // styleDeclaration\r\n //----------------------------------\r\n \r\n private var _styleDeclaration:CSSStyleDeclaration;\r\n \r\n /**\r\n * @private\r\n */\r\n public function get styleDeclaration():CSSStyleDeclaration\r\n {\r\n return _styleDeclaration;\r\n }\r\n \r\n /**\r\n * @private\r\n */\r\n public function set styleDeclaration(value:CSSStyleDeclaration):void\r\n {\r\n _styleDeclaration = value;\r\n }\r\n<|endoftext|>" }, "test": { "total_tokens": 101437707, "example": "\n= Multisource Models\n\nMultisource models can be used to quickly access data in multiple sources with homogeneous metadata. When you have multiple instances using identical schema (horizontal sharding), Teiid can help you gather data across all the instances, using \"multisource\" models. In this scenario, instead of creating/importing a model for every data source, one source model is defined to represents the schema and is configured with multiple data \"sources\" underneath it. During runtime when a query issued against this model, the query engine analyzes the information and gathers the required data from all sources configured and gathers the results and provides in a single result. Since all sources utilize the same physical metadata, this feature is most appropriate for accessing the same source type with multiple instances.\n\n== Configuration\n\nTo mark a model as multisource, the model property _multisource_ can be set to true or more than one source can be listed for the model in the \"vdb.xml\" file. Here is a code example showing a vdb with single model with multiple sources defined.\n\n[source,xml]\n----\n\n \n \n \n \n \n \n \n\n----\n\nNOTE: Currently the tooling support for managing the multisource feature is limited, so if you need to use this feature build the VDB as usual in the Teiid Designer and then edit the \"vdb.xml\" file in the VDB archive using a Text editor to add the additional sources as defined above. You must deploy a separate data source for each source defined in the xml file.\n\nIn the above example, the VDB has a single model called `Customers`, that has multiple sources (`chicago`, `newyork`, and `la`) that define different instances of data.\n\n=== The Multisource Column\n\nWhen a model is marked as multisource, the engine will add or use an existing column on each table to represent the source name values. In the above vdb.xml the column would return `chicago`, `la`, `newyork` for each of the respective sources. The name of the column defaults to SOURCE_NAME, but is configurable by setting the model property *multisource.columnName*.  If a column already exists on the table (or an IN procedure parameter) with the same name, the engine will assume that it should represent the multisource column and it will not be used to retrieve physical data. If the multisource column is not present, the generated column will be treated as a pseudo column which is not selectable via wildcards (* nor tbl.*).\n\nThis allows queries like the following:\n\n[source,sql]\n----\nselect * from table where SOURCE_NAME = 'newyork'\nupdate table column=value where SOURCE_NAME='chicago'\ndelete from table where column = x and SOURCE_NAME='la'\ninsert into table (column, SOURCE_NAME) VALUES ('value', 'newyork')\n----\n\n=== The Multi-Source Column in System Metadata\n\nThe pseudo column is by default not present in your actual metadata; it is not added on source tables/procedures when you import the metadata.  If you would like to use the multisource column in your transformations to control which sources are accessed or updated and/or want the column reported via metadata facilities, there are several options: \n\n* If directly using DDL, the pseduo-column will already be available to transformations, but will not be present in your System metadata by default.  If using DDL and want to be selective (rather than using the *multisource.addColumn* property), you can manually add the column via DDL. \n* With either VDB type to make the multisource column present in the system metadata, you may set the model property *multisource.addColumn* to true on a multisource model. If the table has a column or the procedure has a parameter already with a matching name, then an additional column will not be added. A variadic procedure can still have a source parameter added, but it can only be specified when using named parameters. Care should be taken though when using this property in Designer as any transformation logic (views/procedures) that you have defined will not have been aware of the multisource column and may fail validation upon server deployment.\n* If using Designer, you can manually add the multisource column. \n\n== Planning and Execution\n\nThe planner logically treats a multisource table as if it were a view containing the union all of the respective source tables.  More complex partitioning scenarios, such as heterogeneous sources or list partitioning will require the use of a link:Federated_Optimizations.adoc#_partitioned_union[Federated Optimizations#Partitioned Union].\n\nMost of the federated optimizations available over unions are still applicable in multisource mode. This includes aggregation pushdown/decomposition, limit pushdown, join partitioning, etc.\n\nYou can add/remove sources from multisource models at runtime with the admin addSource and removeSource options. The processing of a multisource plan will determine the set of multisource targets when the access node is opened. If the plan is reused and the sources change since the last execution, the multisource access will be regenerated. If a source is added after a relevant multisource query starts, it will not be in the results. If a source is removed after a relevant multisource query starts, it will be treated as a null source which should in most situations allow the query to complete normally.\n\nThat the SHOW PLAN output will vary upon when it is obtained. If you get the SHOW PLAN output prior to execution, the multisource access will appear as a single access node. After execution the SHOW PLAN output will show the set of sources accessed as individual nodes.\n\n=== SELECTs, UPDATEs, DELETEs\n\n* A multisource query against a SELECT/UPDATE/DELETE may affect any subset of the sources based upon the evaluation of the WHERE clause.\n\n* The multisource column may not be targeted in an update change set.\n\n* The sum of the update counts for UPDATEs/DELETEs will be returned as the resultant update count.\n\n* When running under a transaction in a mode that detects the need for a transaction and multiple updates may performed or a transactional read is required and multiple sources may be read from, a transaction will be started to enlist each source.\n\n=== INSERTs\n\n* A multisource INSERT must use the source_name column as an insert column to specify which source should be targeted by the INSERT. Only an INSERT using the VALUES clause is supported.\n\n=== Stored Procedures\n\nA physical stored procedures requires the addition of a string in parameter matching the multisource column name to specify which source the procedure is executed on. If the parameter is not present and defaults to a null value, then the procedure will be executed on each source.  It is not possible to execute procedures that are required to return IN/OUT, OUT, or RETURN parameters values on more than 1 source.\n\n[source,sql]\n.*Example DDL*\n----\nCREATE FOREIGN PROCEDURE PROC (arg1 IN STRING NOT NULL, arg2 IN STRING, SOURCE_NAME IN STRING)\n----\n\n[source,sql]\n.*Example Calls Against A Single Source*\n----\nCALL PROC(arg1=>'x', SOURCE_NAME=>'sourceA')\nEXEC PROC('x', 'y','sourceB')\n----\n\n[source,sql]\n.*Example Calls Against All Sources*\n----\nCALL PROC(arg1=>'x')\nEXEC PROC('x', 'y')\n----\n<|endoftext|>" } }, "all": { "total_tokens_train": 906289921, "total_tokens_test": 101437707, "tokenizer": "EleutherAI/gpt-neo-125M", "vocab_size": 50257, "max_length": -1, "labels": [ "bigcode" ], "length_strategy": "none" } }