You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ma...@apache.org on 2013/10/05 01:03:14 UTC
[08/15] git commit: [flex-sdk] [refs/heads/develop] -
https://issues.apache.org/jira/browse/FLEX-33777 Dagrid for mobile -
refactoring: more user friendly class names
https://issues.apache.org/jira/browse/FLEX-33777 Dagrid for mobile
- refactoring: more user friendly class names
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b68e1828
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b68e1828
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b68e1828
Branch: refs/heads/develop
Commit: b68e18285862309dd5f2419d13a2e23e415a2c69
Parents: 4482660
Author: mamsellem <ma...@systar.com>
Authored: Wed Oct 2 02:56:01 2013 +0200
Committer: mamsellem <ma...@systar.com>
Committed: Wed Oct 2 02:56:01 2013 +0200
----------------------------------------------------------------------
.../projects/experimental_mobile/manifest.xml | 4 +-
.../itemRenderers/IItemPartRendererBase.as | 64 ---------
.../itemRenderers/IItemTextPartRenderer.as | 39 ------
.../itemRenderers/IMobileGridCellRenderer.as | 64 +++++++++
.../IMobileGridTextCellRenderer.as | 39 ++++++
.../itemRenderers/ItemBitmapPartRenderer.as | 133 -------------------
.../itemRenderers/ItemTextPartRenderer.as | 112 ----------------
.../MobileGridBitmapCellRenderer.as | 133 +++++++++++++++++++
.../itemRenderers/MobileGridTextCellRenderer.as | 112 ++++++++++++++++
.../supportClasses/ListMultiPartColumnLayout.as | 6 +-
.../supportClasses/MobileGridColumn.as | 26 ++--
.../supportClasses/MobileGridRowRenderer.as | 14 +-
12 files changed, 373 insertions(+), 373 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/manifest.xml b/frameworks/projects/experimental_mobile/manifest.xml
index 9cb9823..e4762f6 100644
--- a/frameworks/projects/experimental_mobile/manifest.xml
+++ b/frameworks/projects/experimental_mobile/manifest.xml
@@ -23,6 +23,6 @@
<componentPackage>
<component class="spark.components.MobileGrid"/>
<component class="spark.components.supportClasses.MobileGridColumn"/>
- <component class="spark.components.itemRenderers.ItemBitmapPartRenderer"/>
- <component class="spark.components.itemRenderers.ItemTextPartRenderer"/>
+ <component class="spark.components.itemRenderers.MobileGridBitmapCellRenderer"/>
+ <component class="spark.components.itemRenderers.MobileGridTextCellRenderer"/>
</componentPackage>
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as
deleted file mode 100644
index 37ca652..0000000
--- a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as
+++ /dev/null
@@ -1,64 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.components.itemRenderers
-{
-
-import mx.core.IDataRenderer;
-import mx.styles.IStyleClient;
-
-/**
- * This is the base interface that all mobile cell or other mobile item part renderers must implement.
- * Contrary to desktop DataGrid control, there is no default base renderer,
- * because mobile renderers must be lightweight, and derive directly for the existing component, (ie. s:Button or s:CheckBox ).
- *
- * @langversion 3.0
- * @playerversion AIR 3.8
- * @productversion Flex 4.11
- */
-public interface IItemPartRendererBase extends IDataRenderer
-{
- /** @private
- * Object to be used for providing styles to the part renderer.
- * Mobile part items renders being lightweight classes, they usually don't manage styles by themselves.
- * This property is automatically set
- */
- function set styleProvider(value:IStyleClient):void ;
-
- function get canSetContentWidth():Boolean;
-
- function get canSetContentHeight():Boolean;
-
- /**
- * @private
- */
- function set cssStyleName(value:String):void;
-
- /**
- * @private
- */
- function getPreferredBoundsWidth(postLayoutTransform:Boolean = true):Number;
-
- /**
- * @private
- */
- function getPreferredBoundsHeight(postLayoutTransform:Boolean = true):Number;
-
-
-}
-}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as
deleted file mode 100644
index 90ca694..0000000
--- a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as
+++ /dev/null
@@ -1,39 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.components.itemRenderers
-{
-
-/** Extended interface for renderer that include text
- * @langversion 3.0
- * @playerversion AIR 3.8
- * @productversion Flex 4.11
- */
-
-public interface IItemTextPartRenderer extends IItemPartRendererBase
-{
- /* implement this property so that the renderer can receive the dataField from the renderer's MobileGridColumn*/
- function set labelField(value:String):void;
-
- /* implement this property so that the renderer can receive the labelFunction from the renderers' MobileGridColumn*/
- function set labelFunction(value:Function):void;
-
- /* implement this property so that the renderer can receive the textAlign property from the renderers' MobileGridColumn*/
- function set textAlign(textAlign:String):void;
-}
-}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridCellRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridCellRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridCellRenderer.as
new file mode 100644
index 0000000..eb5ddc7
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridCellRenderer.as
@@ -0,0 +1,64 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package spark.components.itemRenderers
+{
+
+import mx.core.IDataRenderer;
+import mx.styles.IStyleClient;
+
+/**
+ * This is the base interface that all mobile cell or other mobile item part renderers must implement.
+ * Contrary to desktop DataGrid control, there is no default base renderer,
+ * because mobile renderers must be lightweight, and derive directly for the existing component, (ie. s:Button or s:CheckBox ).
+ *
+ * @langversion 3.0
+ * @playerversion AIR 3.8
+ * @productversion Flex 4.11
+ */
+public interface IMobileGridCellRenderer extends IDataRenderer
+{
+ /** @private
+ * Object to be used for providing styles to the part renderer.
+ * Mobile part items renders being lightweight classes, they usually don't manage styles by themselves.
+ * This property is automatically set
+ */
+ function set styleProvider(value:IStyleClient):void ;
+
+ function get canSetContentWidth():Boolean;
+
+ function get canSetContentHeight():Boolean;
+
+ /**
+ * @private
+ */
+ function set cssStyleName(value:String):void;
+
+ /**
+ * @private
+ */
+ function getPreferredBoundsWidth(postLayoutTransform:Boolean = true):Number;
+
+ /**
+ * @private
+ */
+ function getPreferredBoundsHeight(postLayoutTransform:Boolean = true):Number;
+
+
+}
+}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridTextCellRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridTextCellRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridTextCellRenderer.as
new file mode 100644
index 0000000..d26c312
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IMobileGridTextCellRenderer.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package spark.components.itemRenderers
+{
+
+/** Extended interface for renderer that include text
+ * @langversion 3.0
+ * @playerversion AIR 3.8
+ * @productversion Flex 4.11
+ */
+
+public interface IMobileGridTextCellRenderer extends IMobileGridCellRenderer
+{
+ /* implement this property so that the renderer can receive the dataField from the renderer's MobileGridColumn*/
+ function set labelField(value:String):void;
+
+ /* implement this property so that the renderer can receive the labelFunction from the renderers' MobileGridColumn*/
+ function set labelFunction(value:Function):void;
+
+ /* implement this property so that the renderer can receive the textAlign property from the renderers' MobileGridColumn*/
+ function set textAlign(textAlign:String):void;
+}
+}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as
deleted file mode 100644
index 29db838..0000000
--- a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as
+++ /dev/null
@@ -1,133 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.components.itemRenderers
-{
-
-import mx.core.mx_internal;
-import mx.graphics.BitmapFillMode;
-import mx.styles.IStyleClient;
-
-import spark.primitives.BitmapImage;
-
-use namespace mx_internal;
-
-/** Default lightweight class for rendering embedded Bitmaps or Multi-DPI Bitmaps in a MobileGrid cell .
- *You define the icon to be used in each cell by setting either iconField or iconFunction properties.
- *
- * @langversion 3.0
- * @playerversion AIR 3.8
- * @productversion Flex 4.11
- *
- * */
-public class ItemBitmapPartRenderer extends BitmapImage implements IItemPartRendererBase
-{
-
- private var _iconFunction:Function = null;
- private var _iconField:String = null;
- protected var _data:Object;
-
- public function ItemBitmapPartRenderer()
- {
- super();
- _fillMode = BitmapFillMode.REPEAT; // do not stretch
- }
-
- /**
- * The name of the field or property in the DataGrid's dataProvider item that defines the icon to display for this renderer's column.
- * <p> The field value must be either an embedded bitmap's class, or or MultiBitmapSource object. </p>
- * <p> If not set, then iconFunction will be used. </p>
- * @default null
- *
- * @see #iconFunction
- * @see spark.utils.MultiDPIBitmapSource
- *
- */
- public function get iconField():String
- {
- return _iconField;
- }
-
- public function set iconField(value:String):void
- {
- _iconField = value;
- }
-
- /**
- * An user-provided function that converts a data provider item into an icon to display in each cell for this renderer's column.
- *
- * <p>if set, this property is used even if iconField is also set.</p>
- * <p>The function specified to the <code>iconFunction</code> property
- * must have the following signature:</p>
- *
- * <pre>iconFunction(item:Object):Object</pre>
- *
- * <p>The <code>item</code> parameter is the data provider item for an entire row.</p>
- * <p> The function must return either an embedded bitmap's class, or a MultiBitmapSource object .</p>
- *
- * @default null
- *
- * @see #iconLabel
- * @see spark.utils.MultiDPIBitmapSource
- *
- */
- public function get iconFunction():Function
- {
- return _iconFunction;
- }
-
- public function set iconFunction(value:Function):void
- {
- _iconFunction = value;
- }
-
- public function set data(value:Object):void
- {
- _data = value;
- var iconSource:Object = _iconFunction != null ? _iconFunction(_data) : _data[_iconField];
- this.source = iconSource;
- }
-
- public function get data():Object
- {
- return _data;
- }
-
- public function set styleProvider(value:IStyleClient):void
- {
- // do nothing, this renderer does not manages styles for now.
- }
-
- public function set cssStyleName(value:String):void
- {
-
- }
-
- /* to avoid any scaling artifacts, we do not allow bitmap to be stretcghed */
-
- public function get canSetContentWidth():Boolean
- {
- return false;
- }
-
- public function get canSetContentHeight():Boolean
- {
- return false;
- }
-}
-}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as
deleted file mode 100644
index 2ad7118..0000000
--- a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as
+++ /dev/null
@@ -1,112 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.components.itemRenderers
-{
-
-import mx.core.mx_internal;
-import mx.styles.CSSStyleDeclaration;
-import mx.styles.IStyleClient;
-import mx.styles.StyleManager;
-
-import spark.components.supportClasses.StyleableTextField;
-import spark.utils.UIComponentUtils;
-
-use namespace mx_internal;
-
-/** Default lightweight class for rendering formatted text in MobileGrid cells .
- * <p> You don't have to use this render explicitly as it will be used by default for MobileGrid text cells. </p>
- *
- * @langversion 3.0
- * @playerversion AIR 3.8
- * @productversion Flex 4.11
- *
- * */
-public class ItemTextPartRenderer extends StyleableTextField implements IItemTextPartRenderer
-{
-
- private var _labelFunction:Function;
- private var _labelField:String;
- private var _data:Object;
-
- public function ItemTextPartRenderer()
- {
- super();
- editable = false;
- selectable = false;
- multiline = true;
- }
-
- public function set styleProvider(value:IStyleClient):void
- {
- styleName = value;
- commitStyles();
- }
-
- public function set textAlign(value:String):void
- {
- setStyle("textAlign", value);
- }
-
- public function set cssStyleName(pstyleName:String):void
- {
- var css:CSSStyleDeclaration = pstyleName ? StyleManager.getStyleManager(null).getStyleDeclaration("." + pstyleName) : null;
- // must add to container before working on styles
- styleDeclaration = css; // for direct style
- if (css)
- {
- leftMargin = css.getStyle("paddingLeft");
- rightMargin = css.getStyle("paddingRight");
- // multiline = css.get
- }
- }
-
- public function set data(value:Object):void
- {
- _data = value;
- text = UIComponentUtils.itemToLabel(value, _labelField, _labelFunction);
- }
-
- public function get data():Object
- {
- return _data;
- }
-
- public function set labelField(value:String):void
- {
- _labelField = value;
- }
-
- public function set labelFunction(value:Function):void
- {
- _labelFunction = value;
- }
-
- public function get canSetContentWidth():Boolean
- {
- return true;
- }
-
- public function get canSetContentHeight():Boolean
- {
- return false;
- }
-}
-}
-
-
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridBitmapCellRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridBitmapCellRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridBitmapCellRenderer.as
new file mode 100644
index 0000000..1eed532
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridBitmapCellRenderer.as
@@ -0,0 +1,133 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package spark.components.itemRenderers
+{
+
+import mx.core.mx_internal;
+import mx.graphics.BitmapFillMode;
+import mx.styles.IStyleClient;
+
+import spark.primitives.BitmapImage;
+
+use namespace mx_internal;
+
+/** Default lightweight class for rendering embedded Bitmaps or Multi-DPI Bitmaps in a MobileGrid cell .
+ *You define the icon to be used in each cell by setting either iconField or iconFunction properties.
+ *
+ * @langversion 3.0
+ * @playerversion AIR 3.8
+ * @productversion Flex 4.11
+ *
+ * */
+public class MobileGridBitmapCellRenderer extends BitmapImage implements IMobileGridCellRenderer
+{
+
+ private var _iconFunction:Function = null;
+ private var _iconField:String = null;
+ protected var _data:Object;
+
+ public function MobileGridBitmapCellRenderer()
+ {
+ super();
+ _fillMode = BitmapFillMode.REPEAT; // do not stretch
+ }
+
+ /**
+ * The name of the field or property in the DataGrid's dataProvider item that defines the icon to display for this renderer's column.
+ * <p> The field value must be either an embedded bitmap's class, or or MultiBitmapSource object. </p>
+ * <p> If not set, then iconFunction will be used. </p>
+ * @default null
+ *
+ * @see #iconFunction
+ * @see spark.utils.MultiDPIBitmapSource
+ *
+ */
+ public function get iconField():String
+ {
+ return _iconField;
+ }
+
+ public function set iconField(value:String):void
+ {
+ _iconField = value;
+ }
+
+ /**
+ * An user-provided function that converts a data provider item into an icon to display in each cell for this renderer's column.
+ *
+ * <p>if set, this property is used even if iconField is also set.</p>
+ * <p>The function specified to the <code>iconFunction</code> property
+ * must have the following signature:</p>
+ *
+ * <pre>iconFunction(item:Object):Object</pre>
+ *
+ * <p>The <code>item</code> parameter is the data provider item for an entire row.</p>
+ * <p> The function must return either an embedded bitmap's class, or a MultiBitmapSource object .</p>
+ *
+ * @default null
+ *
+ * @see #iconLabel
+ * @see spark.utils.MultiDPIBitmapSource
+ *
+ */
+ public function get iconFunction():Function
+ {
+ return _iconFunction;
+ }
+
+ public function set iconFunction(value:Function):void
+ {
+ _iconFunction = value;
+ }
+
+ public function set data(value:Object):void
+ {
+ _data = value;
+ var iconSource:Object = _iconFunction != null ? _iconFunction(_data) : _data[_iconField];
+ this.source = iconSource;
+ }
+
+ public function get data():Object
+ {
+ return _data;
+ }
+
+ public function set styleProvider(value:IStyleClient):void
+ {
+ // do nothing, this renderer does not manages styles for now.
+ }
+
+ public function set cssStyleName(value:String):void
+ {
+
+ }
+
+ /* to avoid any scaling artifacts, we do not allow bitmap to be stretcghed */
+
+ public function get canSetContentWidth():Boolean
+ {
+ return false;
+ }
+
+ public function get canSetContentHeight():Boolean
+ {
+ return false;
+ }
+}
+}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridTextCellRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridTextCellRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridTextCellRenderer.as
new file mode 100644
index 0000000..139d9a3
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/MobileGridTextCellRenderer.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package spark.components.itemRenderers
+{
+
+import mx.core.mx_internal;
+import mx.styles.CSSStyleDeclaration;
+import mx.styles.IStyleClient;
+import mx.styles.StyleManager;
+
+import spark.components.supportClasses.StyleableTextField;
+import spark.utils.UIComponentUtils;
+
+use namespace mx_internal;
+
+/** Default lightweight class for rendering formatted text in MobileGrid cells .
+ * <p> You don't have to use this render explicitly as it will be used by default for MobileGrid text cells. </p>
+ *
+ * @langversion 3.0
+ * @playerversion AIR 3.8
+ * @productversion Flex 4.11
+ *
+ * */
+public class MobileGridTextCellRenderer extends StyleableTextField implements IMobileGridTextCellRenderer
+{
+
+ private var _labelFunction:Function;
+ private var _labelField:String;
+ private var _data:Object;
+
+ public function MobileGridTextCellRenderer()
+ {
+ super();
+ editable = false;
+ selectable = false;
+ multiline = true;
+ }
+
+ public function set styleProvider(value:IStyleClient):void
+ {
+ styleName = value;
+ commitStyles();
+ }
+
+ public function set textAlign(value:String):void
+ {
+ setStyle("textAlign", value);
+ }
+
+ public function set cssStyleName(pstyleName:String):void
+ {
+ var css:CSSStyleDeclaration = pstyleName ? StyleManager.getStyleManager(null).getStyleDeclaration("." + pstyleName) : null;
+ // must add to container before working on styles
+ styleDeclaration = css; // for direct style
+ if (css)
+ {
+ leftMargin = css.getStyle("paddingLeft");
+ rightMargin = css.getStyle("paddingRight");
+ // multiline = css.get
+ }
+ }
+
+ public function set data(value:Object):void
+ {
+ _data = value;
+ text = UIComponentUtils.itemToLabel(value, _labelField, _labelFunction);
+ }
+
+ public function get data():Object
+ {
+ return _data;
+ }
+
+ public function set labelField(value:String):void
+ {
+ _labelField = value;
+ }
+
+ public function set labelFunction(value:Function):void
+ {
+ _labelFunction = value;
+ }
+
+ public function get canSetContentWidth():Boolean
+ {
+ return true;
+ }
+
+ public function get canSetContentHeight():Boolean
+ {
+ return false;
+ }
+}
+}
+
+
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartColumnLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartColumnLayout.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartColumnLayout.as
index 8cd7e27..1da5268 100644
--- a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartColumnLayout.as
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartColumnLayout.as
@@ -22,7 +22,7 @@ import mx.core.IFlexDisplayObject;
import mx.core.ILayoutElement;
import mx.core.mx_internal;
-import spark.components.itemRenderers.IItemPartRendererBase;
+import spark.components.itemRenderers.IMobileGridCellRenderer;
import spark.core.IGraphicElement;
import spark.utils.UIComponentUtils;
@@ -56,7 +56,7 @@ public class ListMultiPartColumnLayout extends Object
return target.graphicElementPartRenderers;
}
- protected function get partRenderers():Vector.<IItemPartRendererBase>
+ protected function get partRenderers():Vector.<IMobileGridCellRenderer>
{
return target.partRenderers;
}
@@ -82,7 +82,7 @@ public class ListMultiPartColumnLayout extends Object
var cellHeight:Number = unscaledHeight - paddingTop - paddingBottom;
var desc:MobileGridColumn;
- var dpr:IItemPartRendererBase;
+ var dpr:IMobileGridCellRenderer;
var curX:Number = cellPaddingLeft;
var curY:Number = paddingTop;
var colWidth:Number;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridColumn.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridColumn.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridColumn.as
index b7508f1..95d2d85 100644
--- a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridColumn.as
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridColumn.as
@@ -28,9 +28,9 @@ import mx.core.mx_internal;
import mx.utils.ObjectUtil;
import spark.collections.SortField;
-import spark.components.itemRenderers.IItemPartRendererBase;
-import spark.components.itemRenderers.IItemTextPartRenderer;
-import spark.components.itemRenderers.ItemTextPartRenderer;
+import spark.components.itemRenderers.IMobileGridCellRenderer;
+import spark.components.itemRenderers.IMobileGridTextCellRenderer;
+import spark.components.itemRenderers.MobileGridTextCellRenderer;
/**
* The MobileGridColumn class defines a column to display in a MobileGrid control.
@@ -150,19 +150,19 @@ public class MobileGridColumn extends EventDispatcher
private var _itemRenderer:IFactory;
/**
- * The class factory for the IItemPartRendererBase class used to
+ * The class factory for the IMobileGridCellRenderer class used to
* render individual grid cells.
*
* <p>The default item renderer is the ItemTextPartRenderer class,
* which displays the data item as text, optimized for mobile. </p>
* <p>You can use also ItemBitmapPartRenderer to display embedded bitmaps, in which case you need to define the iconField or iconFunction </p>
- * <p>You can also create custom item renderers by deriving any subclass of UIComponent (eg. s:Button) and implementing IItemPartRendererBase.
+ * <p>You can also create custom item renderers by deriving any subclass of UIComponent (eg. s:Button) and implementing IMobileGridCellRenderer.
* for performance reasons it's preferable that your renderer be written in ActionScript
*
* @see #dataField
- * @see spark.components.itemRenderers.ItemTextPartRenderer
- * @see spark.components.itemRenderers.ItemBitmapPartRenderer
- * @see spark.components.itemRenderers.IItemPartRendererBase
+ * @see spark.components.itemRenderers.MobileGridTextCellRenderer
+ * @see spark.components.itemRenderers.MobileGridBitmapCellRenderer
+ * @see spark.components.itemRenderers.IMobileGridCellRenderer
*
*/
public function get itemRenderer():IFactory
@@ -172,7 +172,7 @@ public class MobileGridColumn extends EventDispatcher
public function set itemRenderer(value:IFactory):void
{
- _itemRenderer = value ? value : new ClassFactory(ItemTextPartRenderer);
+ _itemRenderer = value ? value : new ClassFactory(MobileGridTextCellRenderer);
}
private var _labelFunction:Function;
@@ -325,15 +325,15 @@ public class MobileGridColumn extends EventDispatcher
return sortField;
}
- public function createPartRenderer():IItemPartRendererBase
+ public function createPartRenderer():IMobileGridCellRenderer
{
- var pr:IItemPartRendererBase = _itemRenderer.newInstance() as IItemPartRendererBase;
+ var pr:IMobileGridCellRenderer = _itemRenderer.newInstance() as IMobileGridCellRenderer;
if (pr)
{
pr.cssStyleName = _styleName;
- if (pr is IItemTextPartRenderer)
+ if (pr is IMobileGridTextCellRenderer)
{
- with (IItemTextPartRenderer(pr))
+ with (IMobileGridTextCellRenderer(pr))
{
labelField = _dataField;
labelFunction = _labelFunction;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b68e1828/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridRowRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridRowRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridRowRenderer.as
index c3a1446..832997d 100644
--- a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridRowRenderer.as
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/MobileGridRowRenderer.as
@@ -20,7 +20,7 @@ package spark.components.supportClasses
{
import flash.display.DisplayObject;
-import spark.components.itemRenderers.IItemPartRendererBase;
+import spark.components.itemRenderers.IMobileGridCellRenderer;
import spark.core.DisplayObjectSharingMode;
import spark.core.IGraphicElement;
import spark.core.IGraphicElementContainer;
@@ -42,7 +42,7 @@ import spark.core.ISharedDisplayObject;
public class MobileGridRowRenderer extends ItemRendererBase implements IGraphicElementContainer, ISharedDisplayObject
{
private var _columns:Vector.<MobileGridColumn>;
- private var _partRenderers:Vector.<IItemPartRendererBase>;
+ private var _partRenderers:Vector.<IMobileGridCellRenderer>;
private var _graphicElementPartRenderers:Vector.<IGraphicElement>;
private var _partRenderersLayout:ListMultiPartColumnLayout;
@@ -63,7 +63,7 @@ public class MobileGridRowRenderer extends ItemRendererBase implements IGraphicE
public function set columns(value:Vector.<MobileGridColumn>):void
{
_columns = value;
- _partRenderers = new Vector.<IItemPartRendererBase>(_columns.length, true);
+ _partRenderers = new Vector.<IMobileGridCellRenderer>(_columns.length, true);
_graphicElementPartRenderers = new Vector.<IGraphicElement>();
}
@@ -72,7 +72,7 @@ public class MobileGridRowRenderer extends ItemRendererBase implements IGraphicE
return _columns;
}
- public function get partRenderers():Vector.<IItemPartRendererBase>
+ public function get partRenderers():Vector.<IMobileGridCellRenderer>
{
return _partRenderers;
}
@@ -86,7 +86,7 @@ public class MobileGridRowRenderer extends ItemRendererBase implements IGraphicE
{
super.createChildren();
var desc:MobileGridColumn;
- var pr:IItemPartRendererBase;
+ var pr:IMobileGridCellRenderer;
var ge:IGraphicElement;
for (var i:int = 0; i < _columns.length; i++)
{
@@ -115,7 +115,7 @@ public class MobileGridRowRenderer extends ItemRendererBase implements IGraphicE
else
{
//TODO move to resource bundle
- throw new Error("MobileGridColumn item renderer must implement spark.components.itemRenderers.IItemPartRendererBase");
+ throw new Error("MobileGridColumn item renderer must implement spark.components.itemRenderers.IMobileGridCellRenderer");
}
}
}
@@ -136,7 +136,7 @@ public class MobileGridRowRenderer extends ItemRendererBase implements IGraphicE
override protected function onDataChanged():void
{
- var dpr:IItemPartRendererBase;
+ var dpr:IMobileGridCellRenderer;
for (var i:int = 0; i < _partRenderers.length; i++)
{
dpr = _partRenderers[i];