You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/11/23 07:56:38 UTC
[royale-asjs] 02/03: MX Alert is working. Not pretty,
but functional
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 838bbdab68314dbb22c8683d737a708f021c62db
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Nov 22 23:22:51 2018 -0800
MX Alert is working. Not pretty, but functional
---
.../MXRoyale/src/main/resources/defaults.css | 19 ++++++
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 2 +-
.../src/main/royale/mx/containers/Panel.as | 64 +++++++++++++++---
.../MXRoyale/src/main/royale/mx/controls/Alert.as | 76 ++++++++++++++++++----
.../src/main/royale/mx/controls/beads/AlertView.as | 61 +++++++++++++++++
5 files changed, 199 insertions(+), 23 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 31abd1e..c19abb5 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -70,6 +70,19 @@ Basic|DataGridButtonBar {
IItemRenderer: ClassReference("mx.controls.buttonBarClasses.TextButtonDataGridColumnItemRenderer");
}
+Alert
+{
+ IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VerticalFlexLayout");
+ IBeadView: ClassReference("mx.controls.beads.AlertView");
+ IBeadController: ClassReference("org.apache.royale.html.beads.controllers.AlertController");
+ IBeadModel: ClassReference("org.apache.royale.html.beads.models.AlertModel");
+
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+}
+
Button
{
IBeadModel: ClassReference("org.apache.royale.html.beads.models.ImageAndTextModel");
@@ -636,6 +649,12 @@ charts|DataTip
/* Global style declaration for Flash only. This will effectively be the same
as the browser defaults */
+ Alert
+ {
+ IBackgroundBead: ClassReference("org.apache.royale.html.beads.SolidBackgroundBead");
+ IBorderBead: ClassReference("org.apache.royale.html.beads.SingleLineBorderBead");
+ }
+
Button
{
IBeadView: ClassReference("mx.controls.beads.CSSImageAndTextButtonView");
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index b83adb1..734e9c5 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -53,7 +53,7 @@ internal class MXRoyaleClasses
import mx.containers.beads.ApplicationLayout; ApplicationLayout;
import mx.containers.beads.BoxLayout; BoxLayout;
import mx.containers.beads.CanvasLayout; CanvasLayout;
- import mx.controls.beads.ToolTipBead; ToolTipBead;
+ import mx.controls.beads.AlertView; AlertView;
import mx.containers.gridClasses.GridColumnInfo; GridColumnInfo;
import mx.containers.gridClasses.GridRowInfo; GridRowInfo;
import mx.events.CloseEvent; CloseEvent;
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 8d46db7..9d3d213 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
@@ -573,6 +573,7 @@ public class Panel extends Container
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
+ * @royaleignorecoercion mx.containers.beads.models.PanelModel
*/
public function get layout():String
{
@@ -581,6 +582,7 @@ public class Panel extends Container
/**
* @private
+ * @royaleignorecoercion mx.containers.beads.models.PanelModel
*/
public function set layout(value:String):void
{
@@ -664,18 +666,20 @@ public class Panel extends Container
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
+ * @royaleignorecoercion mx.containers.beads.models.PanelModel
*/
public function get title():String
{
- return PanelModel(model).title;
+ return (model as PanelModel).title;
}
/**
* @private
+ * @royaleignorecoercion mx.containers.beads.models.PanelModel
*/
public function set title(value:String):void
{
- PanelModel(model).title = value;
+ (model as PanelModel).title = value;
}
/**
@@ -700,7 +704,7 @@ public class Panel extends Container
/**
* @private
- * @royaleignorecoercion org.apache.royale.html.beads.PanelView
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
@@ -713,7 +717,7 @@ public class Panel extends Container
/**
* @private
- * @royaleignorecoercion org.apache.royale.html.beads.PanelView
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
@@ -726,7 +730,7 @@ public class Panel extends Container
/**
* @private
- * @royaleignorecoercion org.apache.royale.html.beads.PanelView
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function getElementIndex(c:IChild):int
{
@@ -736,7 +740,7 @@ public class Panel extends Container
/**
* @private
- * @royaleignorecoercion org.apache.royale.html.beads.PanelView
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
@@ -746,7 +750,7 @@ public class Panel extends Container
/**
* @private
- * @royaleignorecoercion org.apache.royale.html.beads.PanelView
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function get numElements():int
{
@@ -756,7 +760,7 @@ public class Panel extends Container
/**
* @private
- * @royaleignorecoercion org.apache.royale.html.beads.PanelView
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function getElementAt(index:int):IChild
{
@@ -767,6 +771,10 @@ public class Panel extends Container
// override and proxy to content area. Otherwise Panel's TitleBar and other chrome will
// have this padding between the border and chrome
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function get paddingLeft():Object
{
var panelView:PanelView = view as PanelView;
@@ -778,6 +786,7 @@ public class Panel extends Container
* @royaleignorecoercion mx.core.UIComponent
* @royaleignorecoercion String
* @royaleignorecoercion mx.containers.beads.models.PanelModel
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function set paddingLeft(value:Object):void
{
@@ -791,6 +800,11 @@ public class Panel extends Container
contentView.paddingLeft = value;
}
}
+
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function get paddingRight():Object
{
var panelView:PanelView = view as PanelView;
@@ -802,6 +816,7 @@ public class Panel extends Container
* @royaleignorecoercion mx.core.UIComponent
* @royaleignorecoercion String
* @royaleignorecoercion mx.containers.beads.models.PanelModel
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function set paddingRight(value:Object):void
{
@@ -815,6 +830,10 @@ public class Panel extends Container
contentView.paddingRight = value;
}
}
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function get paddingTop():Object
{
var panelView:PanelView = view as PanelView;
@@ -826,6 +845,7 @@ public class Panel extends Container
* @royaleignorecoercion mx.core.UIComponent
* @royaleignorecoercion String
* @royaleignorecoercion mx.containers.beads.models.PanelModel
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function set paddingTop(value:Object):void
{
@@ -839,6 +859,11 @@ public class Panel extends Container
contentView.paddingTop = value;
}
}
+
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function get paddingBottom():Object
{
var panelView:PanelView = view as PanelView;
@@ -850,6 +875,7 @@ public class Panel extends Container
* @royaleignorecoercion mx.core.UIComponent
* @royaleignorecoercion String
* @royaleignorecoercion mx.containers.beads.models.PanelModel
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function set paddingBottom(value:Object):void
{
@@ -868,6 +894,10 @@ public class Panel extends Container
// because padding creates the view early, the setuplayout logic
// may get run before percentWidth/Height are set, so we have
// to make sure the contentArea gets set up correctly
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function set percentWidth(value:Number):void
{
super.percentWidth = value;
@@ -878,6 +908,11 @@ public class Panel extends Container
contentView.percentWidth = 100;
}
}
+
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function set explicitWidth(value:Number):void
{
super.explicitWidth = value;
@@ -888,6 +923,11 @@ public class Panel extends Container
contentView.percentWidth = 100;
}
}
+
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function set percentHeight(value:Number):void
{
super.percentHeight = value;
@@ -898,6 +938,11 @@ public class Panel extends Container
contentView.percentHeight = 100;
}
}
+
+ /**
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
+ */
override public function set explicitHeight(value:Number):void
{
super.explicitHeight = value;
@@ -911,7 +956,8 @@ public class Panel extends Container
/**
- * @private
+ * @private
+ * @royaleignorecoercion mx.containers.beads.PanelView
*/
override public function childrenAdded():void
{
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as
index b2ef9bf..9a3b79c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as
@@ -20,10 +20,13 @@
package mx.controls
{
+ import org.apache.royale.core.IAlertModel;
+ import org.apache.royale.core.IChild;
import org.apache.royale.events.Event;
import org.apache.royale.events.CloseEvent;
import mx.containers.Panel;
import mx.managers.ISystemManager;
+ import mx.managers.PopUpManager;
import mx.core.IUIComponent;
import mx.core.FlexGlobals;
/*
@@ -41,7 +44,6 @@ import mx.core.mx_internal;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import mx.managers.ISystemManager;
-import mx.managers.PopUpManager;
import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
@@ -463,17 +465,17 @@ public class Alert extends Panel
if (!parent)
{
- var sm:ISystemManager = ISystemManager(FlexGlobals.topLevelApplication.systemManager);
+ // var sm:ISystemManager = ISystemManager(FlexGlobals.topLevelApplication.systemManager);
// no types so no dependencies
- var mp:Object; //= sm.getImplementation("mx.managers::IMarshalSystemManager");
- //if (mp && mp.useSWFBridge())
+ // var mp:Object; //= sm.getImplementation("mx.managers::IMarshalSystemManager");
+ // if (mp && mp.useSWFBridge())
// parent = Sprite(sm.getSandboxRoot());
//else
// parent = Sprite(FlexGlobals.topLevelApplication);
+ parent = FlexGlobals.topLevelApplication as IUIComponent;
}
var alert:Alert = new Alert();
- /*
if (flags & Alert.OK||
flags & Alert.CANCEL ||
flags & Alert.YES ||
@@ -481,17 +483,18 @@ public class Alert extends Panel
{
alert.buttonFlags = flags;
}
-
+ else
+ /*
if (defaultButtonFlag == Alert.OK ||
defaultButtonFlag == Alert.CANCEL ||
defaultButtonFlag == Alert.YES ||
- defaultButtonFlag == Alert.NO)
+ defaultButtonFlag == Alert.NO)*/
{
- alert.defaultButtonFlag = defaultButtonFlag;
+ alert.buttonFlags = defaultButtonFlag;
}
alert.text = text;
- alert.title = title;*/
+ alert.title = title;
//alert.iconClass = iconClass;
if (closeHandler != null)
@@ -515,7 +518,8 @@ public class Alert extends Panel
}
alert.addEventListener(FlexEvent.CREATION_COMPLETE, static_creationCompleteHandler);
- PopUpManager.addPopUp(alert, parent, modal);*/
+ */
+ PopUpManager.addPopUp(alert, parent, true);
return alert;
}
@@ -540,6 +544,7 @@ public class Alert extends Panel
// Panel properties.
//title = "";
+ typeNames = "Alert";
}
//--------------------------------------------------------------------------
@@ -582,7 +587,27 @@ public class Alert extends Panel
* @productversion Royale 0.9.3
* @royalesuppresspublicvarwarning
*/
- //public var buttonFlags:uint = OK;
+ /**
+ * The buttons to display on the Alert as bit-mask values.
+ *
+ * Alert.YES
+ * Alert.NO
+ * Alert.OK
+ * Alert.CANCEL
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function get buttonFlags():uint
+ {
+ return IAlertModel(model).flags;
+ }
+ public function set buttonFlags(value:uint):void
+ {
+ IAlertModel(model).flags = value;
+ }
//----------------------------------
// defaultButtonFlag
@@ -644,8 +669,33 @@ public class Alert extends Panel
* @productversion Royale 0.9.3
* @royalesuppresspublicvarwarning
*/
- //public var text:String = "";
-
+ /**
+ * The message to display in the Alert body.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function get text():String
+ {
+ return IAlertModel(model).message;
+ }
+ public function set text(value:String):void
+ {
+ IAlertModel(model).message = value;
+ }
+
+
+ /**
+ * @private
+ * @royaleignorecoercion mx.core.IUIComponent
+ */
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ $uibase_addChild(c as IUIComponent);
+ }
+
}
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/AlertView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/AlertView.as
new file mode 100644
index 0000000..3a4738f
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/AlertView.as
@@ -0,0 +1,61 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.controls.beads
+{
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.html.beads.AlertView;
+
+ /**
+ * The AlertView class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public class AlertView extends org.apache.royale.html.beads.AlertView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function AlertView()
+ {
+ }
+
+ /**
+ * The content area of the panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.8
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ */
+ public function get contentArea():UIBase
+ {
+ return _strand as UIBase;
+ }
+
+ }
+}