Setting the default TLFFactory is now required. No dependency on StandardTLFFactory (and HTML Text) unless used.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a4a2bb36 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a4a2bb36 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a4a2bb36 Branch: refs/heads/feature/amf Commit: a4a2bb36895b124d2d30f6cc3029e88c3ccf9705 Parents: 397cfc1 Author: Harbs <[email protected]> Authored: Wed Jul 26 01:11:12 2017 +0300 Committer: Harbs <[email protected]> Committed: Wed Jul 26 01:11:12 2017 +0300 ---------------------------------------------------------------------- .../textLayout/conversion/BaseTextLayoutImporter.as | 6 +++--- .../flex/textLayout/conversion/TextLayoutImporter.as | 6 +++--- .../org/apache/flex/textLayout/factory/TLFFactory.as | 9 ++++++--- .../org/apache/flex/textLayout/utils/FactoryUtil.as | 14 -------------- 4 files changed, 12 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4a2bb36/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as index bf4bfbe..379cdfb 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as @@ -41,7 +41,7 @@ package org.apache.flex.textLayout.conversion import org.apache.flex.textLayout.elements.TextFlow; import org.apache.flex.textLayout.property.Property; import org.apache.flex.textLayout.property.PropertyUtil; - import org.apache.flex.textLayout.utils.FactoryUtil; + import org.apache.flex.textLayout.factory.TLFFactory; /** * BaseTextLayoutImporter is a base class for handling the import/export of TextLayout text @@ -558,7 +558,7 @@ package org.apache.flex.textLayout.conversion { if (child.name().localName == "p") { - textFlow = new TextFlow(FactoryUtil.defaultTLFFactory); + textFlow = new TextFlow(TLFFactory.defaultTLFFactory); parseObject(child.name().localName, child, textFlow, exceptionElements); } else if (child.name().localName == "TextFlow") @@ -579,7 +579,7 @@ package org.apache.flex.textLayout.conversion if (!strip) { - textFlow = new TextFlow(FactoryUtil.defaultTLFFactory); + textFlow = new TextFlow(TLFFactory.defaultTLFFactory); parseObject(child.name().localName, child, textFlow, exceptionElements); // addChild(textFlow, createImpliedSpan(txt)); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4a2bb36/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextLayoutImporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextLayoutImporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextLayoutImporter.as index a453084..f754387 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextLayoutImporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextLayoutImporter.as @@ -46,11 +46,11 @@ package org.apache.flex.textLayout.conversion import org.apache.flex.textLayout.elements.TextFlow; import org.apache.flex.textLayout.formats.TextLayoutFormat; import org.apache.flex.textLayout.property.PropertyFactory; - import org.apache.flex.textLayout.utils.FactoryUtil; import org.apache.flex.utils.ObjectMap; import org.apache.flex.textLayout.conversion.TLFormatImporter; import org.apache.flex.textLayout.conversion.SingletonAttributeImporter; import org.apache.flex.textLayout.conversion.CustomFormatImporter; + import org.apache.flex.textLayout.factory.TLFFactory; @@ -268,7 +268,7 @@ package org.apache.flex.textLayout.conversion // allocate the TextFlow and initialize the container attributes if (!newFlow) - newFlow = new TextFlow(FactoryUtil.defaultTLFFactory); + newFlow = new TextFlow(TLFFactory.defaultTLFFactory); // parse formatting parseStandardFlowElementAttributes(newFlow,xmlToParse); @@ -718,7 +718,7 @@ package org.apache.flex.textLayout.conversion * Used for testing. May be removed in the future. **/ static public function getTextFlowContent(text:String = null, selectable:Boolean = false, editable:Boolean = false):TextFlow { - var textFlowContent:TextFlow = new TextFlow(FactoryUtil.defaultTLFFactory); + var textFlowContent:TextFlow = new TextFlow(TLFFactory.defaultTLFFactory); var paragraph:IParagraphElement = ElementHelper.getParagraph(); var span:SpanElement = new SpanElement(); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4a2bb36/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as index 213217c..a0b9cb3 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/factory/TLFFactory.as @@ -18,6 +18,8 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.textLayout.factory { + import org.apache.flex.textLayout.debug.assert; + public class TLFFactory { /** @@ -25,10 +27,11 @@ package org.apache.flex.textLayout.factory */ private static var _defaultTLFFactory:ITLFFactory; public static function get defaultTLFFactory():ITLFFactory{ - if(_defaultTLFFactory == null) - _defaultTLFFactory = new StandardTLFFactory(); - + assert(_defaultTLFFactory != null,"No default factory set!"); return _defaultTLFFactory; } + public static function set defaultTLFFactory(value:ITLFFactory):void{ + _defaultTLFFactory = value; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4a2bb36/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/utils/FactoryUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/utils/FactoryUtil.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/utils/FactoryUtil.as index 6819b86..f029818 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/utils/FactoryUtil.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/utils/FactoryUtil.as @@ -28,19 +28,5 @@ package org.apache.flex.textLayout.utils { return FactoryComposer; } - - private static var _defaultTLFFactory:ITLFFactory; - - public static function get defaultTLFFactory():ITLFFactory - { - if(!_defaultTLFFactory) - _defaultTLFFactory = new StandardTLFFactory(); - return _defaultTLFFactory; - } - - public static function set defaultTLFFactory(value:ITLFFactory):void - { - _defaultTLFFactory = value; - } } } \ No newline at end of file
