You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2017/06/19 20:24:40 UTC
git commit: [flex-asjs] [refs/heads/develop] - Make ON/OFF non
numeric formatting in Table more PAYG (This changes fix bug where nonNumeric
in some more complex application was not applyed correctly): - Move applying
numeric formatting for TableColumn an
Repository: flex-asjs
Updated Branches:
refs/heads/develop a89f0ecaf -> 30b7aefd4
Make ON/OFF non numeric formatting in Table more PAYG (This changes fix bug where nonNumeric in some more complex application was not applyed correctly):
- Move applying numeric formatting for TableColumn and TableCell to bead TableNumericEnable.
- Remove property nonNumeric from TableCell, TableColumn and TableRowItemRenderer (this property was unnecessary here)
- Make as default TableCell and TableColumn non numeric
- Create two aliases mxml for TableNumericEnable - TableNumericColumnEnable and TableNumericCellEnable
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/30b7aefd
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/30b7aefd
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/30b7aefd
Branch: refs/heads/develop
Commit: 30b7aefd43f057205dcc73630804a60436af4fb7
Parents: a89f0ec
Author: piotrz <pi...@apache.org>
Authored: Mon Jun 19 22:24:36 2017 +0200
Committer: piotrz <pi...@apache.org>
Committed: Mon Jun 19 22:24:36 2017 +0200
----------------------------------------------------------------------
.../main/flex/org/apache/flex/mdl/TableCell.as | 27 +------
.../flex/org/apache/flex/mdl/TableColumn.as | 29 +-------
.../apache/flex/mdl/beads/TableNumericEnable.as | 77 ++++++++++++++++++++
.../mdl/itemRenderers/TableRowItemRenderer.as | 27 +------
.../src/main/resources/mdl-manifest.xml | 2 +
5 files changed, 83 insertions(+), 79 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30b7aefd/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableCell.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableCell.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableCell.as
index a58548c..b4abd7f 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableCell.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableCell.as
@@ -88,37 +88,12 @@ package org.apache.flex.mdl
override protected function createElement():WrappedHTMLElement
{
element = document.createElement('td') as WrappedHTMLElement;
+ element.classList.add("mdl-data-table__cell--non-numeric");
positioner = element;
element.flexjs_wrapper = this;
return element;
}
-
- private var _nonNumeric:Boolean;
- /**
- * Activate "mdl-data-table__cell--non-numeric" class selector, for use in table td item.
- * Applies text formatting to data cell. Numeric is the default
- * Optional; goes on both table header and table data cells
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.8
- */
- public function get nonNumeric():Boolean
- {
- return _nonNumeric;
- }
- public function set nonNumeric(value:Boolean):void
- {
- _nonNumeric = value;
-
- COMPILE::JS
- {
- element.classList.toggle("mdl-data-table__cell--non-numeric", _nonNumeric);
- typeNames = element.className;
- }
- }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30b7aefd/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableColumn.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableColumn.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableColumn.as
index b5164fb..2e67c28 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableColumn.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TableColumn.as
@@ -91,39 +91,14 @@ package org.apache.flex.mdl
override protected function createElement():WrappedHTMLElement
{
element = document.createElement('th') as WrappedHTMLElement;
+ element.classList.add("mdl-data-table__cell--non-numeric");
positioner = element;
element.flexjs_wrapper = this;
return element;
}
-
- private var _nonNumeric:Boolean;
- /**
- * Activate "mdl-data-table__cell--non-numeric" class selector, for use in table td item.
- * Applies text formatting to data cell
- * Optional; goes on both table header and table data cells
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.8
- */
- public function get nonNumeric():Boolean
- {
- return _nonNumeric;
- }
- public function set nonNumeric(value:Boolean):void
- {
- _nonNumeric = value;
-
- COMPILE::JS
- {
- element.classList.toggle("mdl-data-table__cell--non-numeric", _nonNumeric);
- typeNames = element.className;
- }
- }
-
+
protected var _ascending:Boolean;
/**
* A boolean flag to activate "mdl-data-table__header--sorted-ascending" effect selector.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30b7aefd/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TableNumericEnable.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TableNumericEnable.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TableNumericEnable.as
new file mode 100644
index 0000000..608e58d
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TableNumericEnable.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.mdl.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.mdl.TableCell;
+ import org.apache.flex.mdl.TableColumn;
+
+ /**
+ * TableNumericEnable bead applies numeric formatting to header (TableColumn) or data cell (TableCell)
+ * It removes class "mdl-data-table__cell--non-numeric" from strand (content of column will be align to the right)
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.9
+ */
+ public class TableNumericEnable implements IBead
+ {
+ private var _strand:IStrand;
+ private var host:UIBase;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @flexjsignorecoercion HTMLElement
+ *
+ * @param value
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.8
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ host = _strand as UIBase;
+
+ COMPILE::JS
+ {
+ if (isTableHostValid())
+ {
+ var element:HTMLElement = host.element as HTMLElement;
+ element.classList.remove("mdl-data-table__cell--non-numeric");
+ }
+ else
+ {
+ throw new Error("Host component must be an MDL TableColumn or TableCell.");
+ }
+ }
+ }
+
+ private function isTableHostValid():Boolean
+ {
+ return host is TableCell || host is TableColumn;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30b7aefd/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TableRowItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TableRowItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TableRowItemRenderer.as
index 9f26836..3d6265b 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TableRowItemRenderer.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TableRowItemRenderer.as
@@ -112,6 +112,7 @@ package org.apache.flex.mdl.itemRenderers
{
positioner = document.createElement('tr') as WrappedHTMLElement;
element = document.createElement('td') as WrappedHTMLElement;
+ element.classList.add("mdl-data-table__cell--non-numeric");
positioner.appendChild(element);
@@ -129,31 +130,5 @@ package org.apache.flex.mdl.itemRenderers
return element;
}
}
-
- private var _nonNumeric:Boolean;
- /**
- * Activate "mdl-data-table__cell--non-numeric" class selector, for use in table td item.
- * Applies text formatting to data cell. Numeric is the default
- * Optional; goes on both table header and table data cells
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.8
- */
- public function get nonNumeric():Boolean
- {
- return _nonNumeric;
- }
- public function set nonNumeric(value:Boolean):void
- {
- _nonNumeric = value;
-
- COMPILE::JS
- {
- element.classList.toggle("mdl-data-table__cell--non-numeric", _nonNumeric);
- typeNames = element.className;
- }
- }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30b7aefd/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
index ebd7b00..c74d257 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -62,6 +62,8 @@
<component id="TableRowItemRenderer" class="org.apache.flex.mdl.itemRenderers.TableRowItemRenderer"/>
<component id="TableCell" class="org.apache.flex.mdl.TableCell"/>
<component id="TableView" class="org.apache.flex.mdl.beads.views.TableView"/>
+ <component id="TableNumericCellEnable" class="org.apache.flex.mdl.beads.TableNumericEnable"/>
+ <component id="TableNumericColumnEnable" class="org.apache.flex.mdl.beads.TableNumericEnable"/>
<component id="Dialog" class="org.apache.flex.mdl.Dialog"/>
<component id="DialogTitle" class="org.apache.flex.mdl.DialogTitle"/>
<component id="DialogContent" class="org.apache.flex.mdl.DialogContent"/>