Added MXMLViewer to display MXML source files.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4c3734fa Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4c3734fa Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4c3734fa Branch: refs/heads/feature/mdl Commit: 4c3734fa1487db3a179ac5a1f2ac4b52ec99e448 Parents: d2080d3 Author: Peter Ent <[email protected]> Authored: Fri Jan 20 14:09:04 2017 -0700 Committer: Peter Ent <[email protected]> Committed: Fri Jan 20 14:09:04 2017 -0700 ---------------------------------------------------------------------- .../Express/src/main/flex/ExpressClasses.as | 1 + .../flex/org/apache/flex/express/MXMLViewer.as | 70 ++++++++++++++++++++ .../src/main/resources/express-manifest.xml | 1 + 3 files changed, 72 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4c3734fa/frameworks/projects/Express/src/main/flex/ExpressClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Express/src/main/flex/ExpressClasses.as b/frameworks/projects/Express/src/main/flex/ExpressClasses.as index 8776086..81f5b23 100644 --- a/frameworks/projects/Express/src/main/flex/ExpressClasses.as +++ b/frameworks/projects/Express/src/main/flex/ExpressClasses.as @@ -34,6 +34,7 @@ internal class ExpressClasses import org.apache.flex.express.HView; HView; import org.apache.flex.express.List; List; import org.apache.flex.express.MXMLItemRenderer; MXMLItemRenderer; + import org.apache.flex.express.MXMLViewer; MXMLViewer; import org.apache.flex.express.TextButton; TextButton; import org.apache.flex.express.TextInput; TextInput; import org.apache.flex.express.VContainer; VContainer; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4c3734fa/frameworks/projects/Express/src/main/flex/org/apache/flex/express/MXMLViewer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/MXMLViewer.as b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/MXMLViewer.as new file mode 100644 index 0000000..bef5868 --- /dev/null +++ b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/MXMLViewer.as @@ -0,0 +1,70 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.express +{ + import org.apache.flex.core.UIBase; + import org.apache.flex.html.Label; + import org.apache.flex.events.Event; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * This class extends the standard Label and allows MXML content (ie, XML or HTML) + * to be displayed. + */ + public class MXMLViewer extends org.apache.flex.html.Label + { + public function MXMLViewer() + { + super(); + } + + COMPILE::JS + /** + * @private + */ + override public function set text(value:String):void + { + this.element.textContent = value; + this.dispatchEvent('textChange'); + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + element = document.createElement('span') as WrappedHTMLElement; + positioner = element; + element.flexjs_wrapper = this; + element.style.whiteSpace = "pre-line"; + element.style.cursor = "default"; + element.style.pointerEvents = "none"; + + className = "MXMLViewer"; + typeNames = "MXMLViewer"; + + return element; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4c3734fa/frameworks/projects/Express/src/main/resources/express-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Express/src/main/resources/express-manifest.xml b/frameworks/projects/Express/src/main/resources/express-manifest.xml index 19496d9..d4edbcf 100644 --- a/frameworks/projects/Express/src/main/resources/express-manifest.xml +++ b/frameworks/projects/Express/src/main/resources/express-manifest.xml @@ -28,6 +28,7 @@ <component id="HView" class="org.apache.flex.express.HView"/> <component id="List" class="org.apache.flex.express.List"/> <component id="MXMLItemRenderer" class="org.apache.flex.express.MXMLItemRenderer"/> + <component id="MXMLViewer" class="org.apache.flex.express.MXMLViewer"/> <component id="TextButton" class="org.apache.flex.express.TextButton"/> <component id="TextInput" class="org.apache.flex.express.TextInput"/> <component id="VContainer" class="org.apache.flex.express.VContainer"/>
