You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2022/08/02 11:46:06 UTC

[royale-asjs] branch develop updated: Emulation - add titleTextField to Panel

This is an automated email from the ASF dual-hosted git repository.

yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 1affcce881 Emulation - add titleTextField to Panel
     new aa6d06590a Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
1affcce881 is described below

commit 1affcce881f2d9aa785e726b9a12cecee4940786
Author: Yishay Weiss <yi...@mcafee.com>
AuthorDate: Tue Aug 2 04:43:28 2022 -0700

    Emulation - add titleTextField to Panel
---
 .../MXRoyale/src/main/resources/defaults.css       |  2 +-
 .../src/main/resources/mx-royale-manifest.xml      |  1 +
 .../src/main/royale/mx/containers/Panel.as         |  2 +
 .../main/royale/mx/controls/beads/TitleBarTitle.as | 35 ++++++++++++++
 .../royale/mx/controls/beads/TitleBarView.mxml     | 55 ++++++++++++++++++++++
 5 files changed, 94 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 68236d5501..6d8fd54255 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -493,7 +493,7 @@ Panel .TitleBar
 PanelTitleBar
 {
 	IBeadModel: ClassReference("org.apache.royale.html.beads.models.TitleBarModel");
-	IBeadView: ClassReference("org.apache.royale.html.beads.TitleBarView");
+	IBeadView: ClassReference("mx.controls.beads.TitleBarView");
 	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.FlexibleFirstChildHorizontalLayout");
 	iMeasurementBead: ClassReference("org.apache.royale.html.beads.TitleBarMeasurementBead");
 	background-color: #E2E2E2;
diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index 0b541f3c44..302df0833b 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -153,6 +153,7 @@
         <component id="MenuBarMouseController" class="mx.controls.beads.controllers.MenuBarMouseController" />
 	<component id="RichTextEditor" class="mx.controls.RichTextEditor" />
         <component id="PanelTitleBar" class="mx.containers.PanelTitleBar" />
+        <component id="TitleBarTitle" class="mx.controls.beads.TitleBarTitle" />
         <component id="Accordion" class="mx.containers.Accordion" />
 	<!--<component id="PhoneFormatter" class="mx.formatters.PhoneFormatter"/>-->
 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
index 75803d2878..d6f8860c3e 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
@@ -64,6 +64,7 @@ import mx.containers.beads.models.PanelModel;
 import mx.core.Container;
 import mx.core.UIComponent;
 import mx.core.IUITextField;
+import mx.controls.beads.TitleBarView;
 
 import org.apache.royale.core.IBeadView;
 import org.apache.royale.core.IChild;
@@ -677,6 +678,7 @@ public class Panel extends Container
     {
         //support for subclass access, as per original Flex code
         titleBar = view is PanelView ? PanelView(view).titleBar as UIComponent : null;
+        titleTextField = titleBar ? (titleBar.view as TitleBarView).titleLabel as IUITextField : null;
         super.addedToParent();
     }
 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TitleBarTitle.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TitleBarTitle.as
new file mode 100644
index 0000000000..4ad3103ea8
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TitleBarTitle.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 "Licens"); 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 mx.controls.beads
+{
+    import mx.core.UITextField;
+
+    /**
+     * A specially styled Label used in TitleBar
+     */
+    public class TitleBarTitle extends UITextField
+    {
+        public function TitleBarTitle()
+        {
+            super();
+            typeNames += " TitleBarTitle";
+            
+        }
+    }
+}
\ No newline at end of file
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TitleBarView.mxml b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TitleBarView.mxml
new file mode 100644
index 0000000000..97ff696441
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TitleBarView.mxml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<!---
+ The TitleBarView is the view for a Panel's TitleBar written in MXML
+
+ @langversion 3.0
+ @playerversion Flash 10.2
+ @playerversion AIR 2.6
+ @productversion Royale 0.0
+-->
+<js:MXMLBeadView xmlns:fx="http://ns.adobe.com/mxml/2009"
+                 xmlns:mx="library://ns.apache.org/royale/mx"
+                 xmlns:js="library://ns.apache.org/royale/basic">
+				  
+    <fx:Script>
+        <![CDATA[
+            import org.apache.royale.html.TitleBar;
+            import org.apache.royale.core.ITitleBarModel;
+            import org.apache.royale.core.UIBase;
+            import org.apache.royale.events.Event;
+            
+            private function clickHandler():void
+            {
+                var newEvent:org.apache.royale.events.Event = new org.apache.royale.events.Event('close');
+                UIBase(_strand).dispatchEvent(newEvent)   
+            }
+        ]]>
+    </fx:Script>
+    <js:beads>
+        <js:MXMLBeadViewDataBinding />
+        <js:LayoutChangeNotifier watchedProperty="{titleLabel.text}" />
+    </js:beads>
+
+    <mx:TitleBarTitle id="titleLabel" text="{ITitleBarModel(model).title}"/>
+    <js:CloseButton id="closeButton" click="clickHandler()" className="TitleBarCloseButton"
+                    visible="{ITitleBarModel(model).showCloseButton}"/>
+    
+</js:MXMLBeadView>