You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/11/14 19:26:14 UTC
[royale-asjs] branch develop updated: New Jewel Wizard component
This is an automated email from the ASF dual-hosted git repository.
carlosrovira 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 73e894b New Jewel Wizard component
73e894b is described below
commit 73e894be6aad858ecadc81937ef2e98a06f947c4
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Wed Nov 14 20:26:03 2018 +0100
New Jewel Wizard component
---
.../projects/Jewel/src/main/resources/defaults.css | 28 ++
.../Jewel/src/main/resources/jewel-manifest.xml | 6 +-
.../projects/Jewel/src/main/royale/JewelClasses.as | 11 +
.../main/royale/org/apache/royale/jewel/Wizard.as | 238 +++++++++++++
.../org/apache/royale/jewel/WizardContent.as | 100 ++++++
.../royale/org/apache/royale/jewel/WizardPage.as | 183 ++++++++++
.../jewel/beads/controllers/WizardController.as | 174 +++++++++
.../royale/jewel/beads/layouts/WizardLayout.as | 51 +++
.../royale/jewel/beads/models/WizardModel.as | 111 ++++++
.../apache/royale/jewel/beads/models/WizardStep.as | 183 ++++++++++
.../apache/royale/jewel/beads/views/WizardView.as | 388 +++++++++++++++++++++
.../supportClasses/wizard/WizardLayoutProxy.as | 237 +++++++++++++
.../Jewel/src/main/sass/components/_wizard.sass | 71 ++++
.../projects/Jewel/src/main/sass/defaults.sass | 1 +
14 files changed, 1781 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index dfbee22..d4f5076 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -3664,6 +3664,34 @@ j|TopAppBarTitle {
IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.NullLayout");
}
+.jewel .wizard {
+ width: 100%;
+}
+.jewel .next {
+ flex: 1 1 0;
+}
+.jewel .previous {
+ flex: 1 1 0;
+}
+.jewel .wizardcontent {
+ flex-grow: 100;
+}
+
+j|Wizard {
+ IBeadView: ClassReference("org.apache.royale.jewel.beads.views.WizardView");
+ IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.WizardController");
+ IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.WizardModel");
+ IWizardLayout: ClassReference("org.apache.royale.jewel.beads.layouts.WizardLayout");
+ IWizardContentArea: ClassReference("org.apache.royale.jewel.WizardContent");
+}
+
+j|WizardContent {
+ IBeadView: ClassReference("org.apache.royale.html.beads.ContainerView");
+ IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.NullLayout");
+ IViewport: ClassReference("org.apache.royale.jewel.supportClasses.Viewport");
+ IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
+}
+
.jewel.main {
width: 100%;
min-height: 100%;
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index ca63bd8..e7bc4bb 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -169,7 +169,11 @@
<component id="RemoveAllItemRendererForArrayListData" class="org.apache.royale.jewel.beads.itemRenderers.RemoveAllItemRendererForArrayListData" />
<!-- <component id="JewelLabelViewBead" class="org.apache.royale.jewel.beads.views.JewelLabelViewBead"/> -->
-
+
+ <component id="Wizard" class="org.apache.royale.jewel.Wizard"/>
+ <component id="WizardContent" class="org.apache.royale.jewel.WizardContent"/>
+ <component id="WizardPage" class="org.apache.royale.jewel.WizardPage"/>
+ <component id="WizardStep" class="org.apache.royale.jewel.beads.models.WizardStep"/>
<component id="ResponsiveSizeMonitor" class="org.apache.royale.jewel.debugger.ResponsiveSizeMonitor"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/JewelClasses.as b/frameworks/projects/Jewel/src/main/royale/JewelClasses.as
index ec20445..8d0b6ff 100644
--- a/frameworks/projects/Jewel/src/main/royale/JewelClasses.as
+++ b/frameworks/projects/Jewel/src/main/royale/JewelClasses.as
@@ -104,6 +104,17 @@ package
import org.apache.royale.jewel.supportClasses.util.positionInsideBoundingClientRect; positionInsideBoundingClientRect;
//import org.apache.royale.jewel.beads.views.JewelLabelViewBead; JewelLabelViewBead;
+
+ import org.apache.royale.jewel.beads.views.WizardView; WizardView;
+
+ import org.apache.royale.jewel.supportClasses.wizard.WizardLayoutProxy; WizardLayoutProxy;
+
+ import org.apache.royale.jewel.beads.controllers.WizardController; WizardController;
+
+ import org.apache.royale.jewel.beads.models.WizardModel; WizardModel;
+ import org.apache.royale.jewel.beads.models.WizardStep; WizardStep;
+
+ import org.apache.royale.jewel.beads.layouts.WizardLayout; WizardLayout;
}
}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Wizard.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Wizard.as
new file mode 100644
index 0000000..4a8b2ef
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Wizard.as
@@ -0,0 +1,238 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel
+{
+ import org.apache.royale.core.IChild;
+ import org.apache.royale.core.IContainerBaseStrandChildrenHost;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.jewel.beads.models.WizardModel;
+ import org.apache.royale.jewel.beads.models.WizardStep;
+ import org.apache.royale.jewel.beads.views.WizardView;
+
+ /**
+ * Indicates that wizard navigates to the previous page.
+ *
+ * @toplevel
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Event(name="goToPreviousStep", type="org.apache.royale.events.Event")]
+
+ /**
+ * Indicates that wizard navigates to the next page.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Event(name="goToNextStep", type="org.apache.royale.events.Event")]
+
+ /**
+ *
+ */
+ public class Wizard extends Group implements IContainerBaseStrandChildrenHost
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function Wizard()
+ {
+ super();
+
+ typeNames = "jewel wizard";
+ }
+
+ public function showPage(id:String):void
+ {
+ content.showContent(id);
+ }
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public var previousButton:IconButton = null;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public var nextButton:IconButton = null;
+
+ /**
+ * the pages of the wizard
+ */
+ public function get content():WizardContent
+ {
+ return (view as WizardView).contentArea as WizardContent;
+ }
+
+ /**
+ * the current step or page visualized in this wizard
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Bindable("change")]
+ public function get currentStep():WizardStep
+ {
+ return WizardModel(model).currentStep;
+ }
+ /**
+ * @royaleignorecoercion org.apache.royale.jewel.beads.models.WizardModel
+ */
+ public function set currentStep(value:WizardStep):void
+ {
+ WizardModel(model).currentStep = value;
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.views.WizardView
+ * @royaleignorecoercion org.apache.royale.jewel.WizardPage
+ */
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ var wizardView:WizardView = view as WizardView;
+ wizardView.contentArea.addElement(c, dispatchEvent);
+ wizardView.contentArea.dispatchEvent(new Event("layoutNeeded"));
+
+ var page:WizardPage = c as WizardPage;
+ page.step.page = c as WizardPage;
+ page.addWizardListeners(this);
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.views.WizardView
+ * @royaleignorecoercion org.apache.royale.jewel.WizardPage
+ */
+ override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ var wizardView:WizardView = view as WizardView;
+ wizardView.contentArea.addElementAt(c, index, dispatchEvent);
+ wizardView.contentArea.dispatchEvent(new Event("layoutNeeded"));
+
+ var page:WizardPage = c as WizardPage;
+ page.step.page = c as WizardPage;
+ page.addWizardListeners(this);
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.views.WizardView
+ * @royaleignorecoercion org.apache.royale.jewel.WizardPage
+ */
+ override public function getElementIndex(c:IChild):int
+ {
+ var wizardView:WizardView = view as WizardView;
+ return wizardView.contentArea.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.views.WizardView
+ * @royaleignorecoercion org.apache.royale.jewel.WizardPage
+ */
+ override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ var wizardView:WizardView = view as WizardView;
+ wizardView.contentArea.removeElement(c, dispatchEvent);
+
+ var page:WizardPage = c as WizardPage;
+ page.removeWizardListeners(this);
+ page.step.page = null;
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.views.WizardView
+ */
+ override public function get numElements():int
+ {
+ var wizardView:WizardView = view as WizardView;
+ return wizardView.contentArea.numElements;
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.views.WizardView
+ */
+ override public function getElementAt(index:int):IChild
+ {
+ var wizardView:WizardView = view as WizardView;
+ return wizardView.contentArea.getElementAt(index);
+ }
+
+
+
+ public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ super.addElementAt(c, index, dispatchEvent);
+ }
+
+ public function get $numElements():int
+ {
+ return super.numElements;
+ }
+
+ public function $getElementAt(index:int):IChild
+ {
+ return super.getElementAt(index);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementIndex(c:IChild):int
+ {
+ return super.getElementIndex(c);
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/WizardContent.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/WizardContent.as
new file mode 100644
index 0000000..31521a8
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/WizardContent.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel
+{
+ COMPILE::JS
+ {
+ import org.apache.royale.core.WrappedHTMLElement;
+ import org.apache.royale.html.util.addElementToWrapper;
+ }
+
+ import org.apache.royale.jewel.Container;
+ import org.apache.royale.jewel.supportClasses.IActivable;
+
+ /**
+ * The ApplicationMainContent class is a Container component capable of parenting
+ * the other organized content that implements IActivable interface
+ * (i.e, a SectionContent)
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class WizardContent extends Container
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardContent()
+ {
+ super();
+
+ typeNames = "jewel wizardcontent";
+ }
+
+ /**
+ * shows a concrete content and hides the rest
+ *
+ * @param id, the id of the container to show
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function showContent(id:String):void
+ {
+ try
+ {
+ for (var i:int = 0; i < numElements; i++)
+ {
+ var content:IActivable = getElementAt(i) as IActivable;
+
+ if(content.id == id)
+ {
+ content.isActive = true;
+ }
+ else
+ {
+ content.isActive = false;
+ }
+ }
+ }
+ catch (error:Error)
+ {
+ throw new Error ("One or more content in TabBarContent is not implementing IActivable interface.");
+ }
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ return addElementToWrapper(this, 'div');
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/WizardPage.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/WizardPage.as
new file mode 100644
index 0000000..2bec885
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/WizardPage.as
@@ -0,0 +1,183 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel
+{
+ import org.apache.royale.events.Event;
+ import org.apache.royale.jewel.beads.models.WizardModel;
+ import org.apache.royale.jewel.beads.models.WizardStep;
+
+ /**
+ * Dispatched When the wizard reach to this page
+ *
+ * @toplevel
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Event(name="enterPage", type="org.apache.royale.events.Event")]
+
+ /**
+ * Dispatched When the wizard exit this page
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Event(name="exitPage", type="org.apache.royale.events.Event")]
+
+ /**
+ * WizardPage is the main class for a page inside the WizardContent
+ */
+ public class WizardPage extends SectionContent
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardPage()
+ {
+ super();
+
+ typeNames = "jewel section wizardpage";
+ }
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public var initialized:Boolean;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ // public var previousButton:Button;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ // public var nextButton:Button;
+
+ private var _step:WizardStep;
+ /**
+ * the step data of this page
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Bindable("change")]
+ public function get step():WizardStep
+ {
+ return _step;
+ }
+ /**
+ * @royaleignorecoercion org.apache.royale.jewel.beads.models.WizardModel
+ */
+ public function set step(value:WizardStep):void
+ {
+ _step = value;
+ }
+
+ /**
+ * Determines whether a view is valid or not
+ *
+ * defaults true if the form has no validation
+ */
+ public function validate():Boolean
+ {
+ return true;
+ }
+
+ /**
+ * add listeners to wizard events when add this page to the wizard
+ */
+ public function addWizardListeners(wizard:Wizard):void
+ {
+ wizard.addEventListener("goToPreviousStep", goToPreviousStepHandler);
+ wizard.addEventListener("goToNextStep", goToNextStepHandler);
+ }
+
+ /**
+ * remove listeners to wizard events when remove this page from the wizard
+ */
+ public function removeWizardListeners(wizard:Wizard):void
+ {
+ wizard.removeEventListener("goToPreviousStep", goToPreviousStepHandler);
+ wizard.removeEventListener("goToNextStep", goToNextStepHandler);
+ }
+
+ /**
+ *
+ */
+ protected function goToPreviousStepHandler(event:Event):void
+ {
+ var model:WizardModel = (event.target as Wizard).getBeadByType(WizardModel) as WizardModel;
+ if(model.currentStep.name == step.name)
+ {
+ dispatchEvent(new Event("exitPage"));
+ exitPage();
+ }
+ if(model.currentStep.previousStep == step.name)
+ {
+ dispatchEvent(new Event("enterPage"));
+ enterPage();
+ }
+ }
+
+ /**
+ * exit page
+ */
+ public function exitPage():void
+ {
+ // trace("exitPage", step.name);
+ }
+
+ /**
+ *
+ */
+ protected function goToNextStepHandler(event:Event):void
+ {
+ var model:WizardModel = (event.target as Wizard).getBeadByType(WizardModel) as WizardModel;
+ if(model.currentStep.name == step.name)
+ {
+ dispatchEvent(new Event("exitPage"));
+ exitPage();
+ }
+ if(model.currentStep.nextStep == step.name)
+ {
+ dispatchEvent(new Event("enterPage"));
+ enterPage();
+ }
+ }
+
+ /**
+ * enter page
+ */
+ public function enterPage():void
+ {
+ // trace("enterPage", step.name);
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/WizardController.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/WizardController.as
new file mode 100644
index 0000000..8442688
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/WizardController.as
@@ -0,0 +1,174 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.controllers
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IBeadController;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.MouseEvent;
+ import org.apache.royale.jewel.Wizard;
+ import org.apache.royale.jewel.WizardPage;
+ import org.apache.royale.jewel.beads.models.WizardModel;
+ import org.apache.royale.jewel.beads.views.WizardView;
+ import org.apache.royale.jewel.beads.models.WizardStep;
+
+ /**
+ * The WizardController class is the controller for
+ * org.apache.royale.jewel.Wizard. Controllers
+ * watch for events from the interactive portions of a View and
+ * update the data model or dispatch a semantic event.
+ *
+ * This controller watches for the click event in previous/next buttons
+ * and makes the wizard navigate to the corresponding view
+ * updates the selection model accordingly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class WizardController implements IBead, IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardController()
+ {
+ }
+
+ /**
+ * The org.apache.royale.jewel.Wizard component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ protected var wizard:Wizard;
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function set strand(value:IStrand):void
+ {
+ wizard = value as Wizard;
+ wizard.addEventListener("initComplete", finishSetUp);
+
+ model = wizard.getBeadByType(WizardModel) as WizardModel;
+ model.addEventListener("currentStepChange", handleStepChange);
+
+ view = wizard.getBeadByType(WizardView) as WizardView;
+ }
+
+ /**
+ * @private
+ */
+ protected function handleStepChange(event:Event):void
+ {
+ wizard.showPage(model.currentStep.name);
+ }
+
+ private var model:WizardModel;
+ private var view:WizardView;
+
+ private function finishSetUp(event:Event):void
+ {
+ view.previousButton.addEventListener(MouseEvent.CLICK, previousButtonClickHandler);
+ view.nextButton.addEventListener(MouseEvent.CLICK, nextButtonClickHandler);
+
+ var n:int = wizard.numElements;
+ for (var i:int = 0; i < n; i++)
+ {
+ var page:WizardPage = wizard.getElementAt(i) as WizardPage;
+
+ if(page.step.initialPage)
+ {
+ wizard.currentStep = page.step;
+ page.enterPage();
+ break;
+ }
+ }
+ }
+
+ /**
+ * logic to perform when user clicks previous button
+ * We assume previous button is visible and enabled so we have a previous step to go
+ * We consider going backwards doesn't require validation
+ */
+ private function previousButtonClickHandler(event:MouseEvent):void
+ {
+ // if(model.currentStep.page.validate())
+ // {
+ var stepToGo:WizardStep = findStep(model.currentStep, true);
+ wizard.dispatchEvent(new Event("goToPreviousStep"));
+ model.currentStep = stepToGo;
+ // }
+ }
+
+ /**
+ * logic to perform when user clicks next button
+ * We assume next button is visible and enabled so we have a next step to go
+ * - First validate the data in the actual page
+ * - if valid findStep to go forward
+ */
+ private function nextButtonClickHandler(event:MouseEvent):void
+ {
+ if(model.currentStep.page.validate())
+ {
+ trace("next:", model.currentStep.autoSkip);
+ var stepToGo:WizardStep = findStep(model.currentStep, false);
+ wizard.dispatchEvent(new Event("goToNextStep"));
+ model.currentStep = stepToGo;
+ }
+ }
+
+ /**
+ * Given a step, find a next or previous one taking autoSkip into account
+ * autoSkip is only evaluated when going forward.
+ *
+ * @param step, the step to discover its next
+ * @param previous, if true find the previous step, if false find the next step. Defaults to find next step
+ */
+ private function findStep(step:WizardStep, previous:Boolean):WizardStep
+ {
+ var n:int = wizard.numElements;
+ for (var i:int = 0; i < n; i++)
+ {
+ var page:WizardPage = wizard.getElementAt(i) as WizardPage;
+ if(page.step.name == (previous ? step.previousStep : step.nextStep))
+ {
+ return !previous && step.autoSkip ? findStep(page.step, previous) : page.step;
+ }
+ }
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/WizardLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/WizardLayout.as
new file mode 100644
index 0000000..7c7084c
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/WizardLayout.as
@@ -0,0 +1,51 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.layouts
+{
+ import org.apache.royale.jewel.beads.layouts.HorizontalLayout;
+
+ /**
+ * The BasicLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * as specified by CSS properties like left, right, top
+ * and bottom.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class WizardLayout extends HorizontalLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardLayout()
+ {
+ super();
+
+ gap = 3;
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/WizardModel.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/WizardModel.as
new file mode 100644
index 0000000..0e67d85
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/WizardModel.as
@@ -0,0 +1,111 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.models
+{
+ import org.apache.royale.core.IBeadModel;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.EventDispatcher;
+
+ /**
+ * The WizardModel bead class holds the values for a org.apache.royale.jewel.Wizard
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Bindable]
+ public class WizardModel extends EventDispatcher implements IBeadModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _title:String;
+
+ /**
+ * The title string for the org.apache.royale.jewel.Wizard.
+ *
+ * @copy org.apache.royale.core.ITitleBarModel#title
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get title():String
+ {
+ return _title;
+ }
+ public function set title(value:String):void
+ {
+ if(value != _title) {
+ _title = value;
+ dispatchEvent(new Event('titleChange'));
+ }
+ }
+
+ private var _currentStep:WizardStep;
+
+ /**
+ * the current step or page visualized in this wizard
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get currentStep():WizardStep
+ {
+ return _currentStep;
+ }
+ public function set currentStep(value:WizardStep):void
+ {
+ if(value != _currentStep) {
+ _currentStep = value;
+ dispatchEvent(new Event('currentStepChange'));
+ }
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/WizardStep.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/WizardStep.as
new file mode 100644
index 0000000..48e2941
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/WizardStep.as
@@ -0,0 +1,183 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.models
+{
+ import org.apache.royale.jewel.WizardPage;
+
+ /**
+ * The WizardModel bead class holds the values for a org.apache.royale.html.Panel, such as its
+ * title.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ [Bindable]
+ public class WizardStep
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardStep(name:String, previousStep:String, nextStep:String)
+ {
+ super();
+
+ this.name = name;
+ this.previousStep = previousStep;
+ this.nextStep = nextStep;
+ }
+
+ private var _name:String;
+
+ /**
+ * the name of the step
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get name():String
+ {
+ return _name;
+ }
+ public function set name(value:String):void
+ {
+ if(value != _name) {
+ _name = value;
+ }
+ }
+
+ private var _previousStep:String = null;
+
+ /**
+ * the previous step to go
+ *
+ * defaults to null if there's no previous step
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get previousStep():String
+ {
+ return _previousStep;
+ }
+ public function set previousStep(value:String):void
+ {
+ if(value != _previousStep) {
+ _previousStep = value;
+ }
+ }
+
+ private var _nextStep:String = null;
+
+ /**
+ * the next step to go
+ *
+ * defaults to null if there's no next step
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get nextStep():String
+ {
+ return _nextStep;
+ }
+ public function set nextStep(value:String):void
+ {
+ if(value != _nextStep) {
+ _nextStep = value;
+ }
+ }
+
+ private var _page:WizardPage;
+
+ /**
+ * the page associated with this data
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get page():WizardPage
+ {
+ return _page;
+ }
+ public function set page(value:WizardPage):void
+ {
+ if(value != _page) {
+ _page = value;
+ }
+ }
+
+ private var _initialPage:Boolean;
+
+ /**
+ * the initial page to show in the wizard
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get initialPage():Boolean
+ {
+ return _initialPage;
+ }
+ public function set initialPage(value:Boolean):void
+ {
+ if(value != _initialPage) {
+ _initialPage = value;
+ }
+ }
+
+ private var _autoSkip:Boolean = false;
+ /**
+ * true to skip automatically next step
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get autoSkip():Boolean
+ {
+ return _autoSkip;
+ }
+
+ public function set autoSkip(value:Boolean):void
+ {
+ if(value != _autoSkip)
+ {
+ _autoSkip=value;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/WizardView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/WizardView.as
new file mode 100644
index 0000000..5055a5d
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/WizardView.as
@@ -0,0 +1,388 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.views
+{
+ COMPILE::SWF {
+ import org.apache.royale.core.SimpleCSSStylesWithFlex;
+ }
+ import org.apache.royale.core.IBeadLayout;
+ import org.apache.royale.core.IBeadView;
+ import org.apache.royale.core.IChild;
+ import org.apache.royale.core.IContainerBaseStrandChildrenHost;
+ import org.apache.royale.core.ILayoutView;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IViewport;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.core.ValuesManager;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.html.beads.GroupView;
+ import org.apache.royale.jewel.Button;
+ import org.apache.royale.jewel.IconButton;
+ import org.apache.royale.jewel.Wizard;
+ import org.apache.royale.jewel.beads.layouts.WizardLayout;
+ import org.apache.royale.jewel.beads.models.WizardModel;
+ import org.apache.royale.jewel.supportClasses.wizard.WizardLayoutProxy;
+
+ /**
+ * The Wizard class creates the visual elements of the org.apache.royale.jewel.Wizard
+ * component. A Wizard has two org.apache.royale.jewel.Button, and content. The buttons
+ * navigate pages to previous or next.
+ *
+ * @viewbead
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class WizardView extends GroupView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardView()
+ {
+ super();
+ }
+
+ /**
+ * The org.apache.royale.jewel.Wizard component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ protected var wizard:Wizard;
+
+ /**
+ * The org.apache.royale.jewel.Wizard.previousButton
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get previousButton():IconButton
+ {
+ return wizard.previousButton;
+ }
+ public function set previousButton(value:IconButton):void
+ {
+ wizard.previousButton = value;
+ }
+
+ /**
+ * The org.apache.royale.jewel.Wizard.nextButton
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get nextButton():IconButton
+ {
+ return wizard.nextButton;
+ }
+ public function set nextButton(value:IconButton):void
+ {
+ wizard.nextButton = value;
+ }
+
+ // private var _titleBar:UIBase;
+
+ /**
+ * The org.apache.royale.jewel.TitleBar component of the
+ * org.apache.royale.jewel.Wizard.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ // public function get titleBar():UIBase
+ // {
+ // return _titleBar;
+ // }
+
+ /**
+ * @private
+ */
+ // public function set titleBar(value:UIBase):void
+ // {
+ // _titleBar = value;
+ // }
+
+ private var _contentArea:UIBase;
+ /**
+ * The content area of the wizard.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get contentArea():UIBase
+ {
+ return _contentArea;
+ }
+ public function set contentArea(value:UIBase):void
+ {
+ _contentArea = value;
+ }
+
+ private var model:WizardModel;
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ * @royaleignorecoercion org.apache.royale.core.IBeadLayout
+ * @royaleignorecoercion org.apache.royale.core.IChild
+ * @royaleignorecoercion org.apache.royale.core.IViewport
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ wizard = value as Wizard;
+
+ model = _strand.getBeadByType(WizardModel) as WizardModel;
+ model.addEventListener("currentStepChange", handleStepChange);
+
+ // Look for a layout and/or viewport bead on the wizard's beads list. If one
+ // is found, pull it off so it will not be added permanently
+ // to the strand.
+ var beads:Array = wizard.beads;
+ var transferLayoutBead:IBeadLayout;
+ var transferViewportBead:IViewport;
+ if (wizard.beads != null) {
+ for(var i:int=wizard.beads.length-1; i >= 0; i--) {
+ if (wizard.beads[i] is IBeadLayout) {
+ transferLayoutBead = wizard.beads[i] as IBeadLayout;
+ wizard.beads.splice(i, 1);
+ }
+ else if (wizard.beads[i] is IViewport) {
+ transferViewportBead = wizard.beads[i] as IViewport
+ wizard.beads.splice(i, 1);
+ }
+ }
+ }
+
+ // if (!_titleBar) {
+ // _titleBar = new TitleBar();
+ // }
+ // _titleBar.id = "wizardTitleBar";
+ // _titleBar.addEventListener("close", handleClose);
+ // replace the TitleBar's model with the Wizard's model (it implements ITitleBarModel) so that
+ // any changes to values in the Wizard's model that correspond values in the TitleBar will
+ // be picked up automatically by the TitleBar.
+ // titleBar.model = wizard.model;
+ // if (titleBar.parent == null) {
+ // (_strand as IContainerBaseStrandChildrenHost).$addElement(titleBar);
+ // }
+
+ if (!_contentArea) {
+ var cls:Class = ValuesManager.valuesImpl.getValue(_strand, "iWizardContentArea");
+ _contentArea = new cls() as UIBase;
+ // _contentArea.id = "content";
+
+ // add the layout bead to the content area.
+ if (transferLayoutBead)
+ _contentArea.addBead(transferLayoutBead);
+ else
+ setupContentAreaLayout();
+
+ // add the viewport bead to the content area.
+ if (transferViewportBead)
+ _contentArea.addBead(transferViewportBead);
+
+ }
+
+ COMPILE::SWF {
+ IEventDispatcher(value).addEventListener("widthChanged", handleSizeChange);
+ IEventDispatcher(value).addEventListener("heightChanged", handleSizeChange);
+ IEventDispatcher(value).addEventListener("sizeChanged", handleSizeChange);
+ IEventDispatcher(value).addEventListener("childrenAdded", handleChildrenAdded);
+ IEventDispatcher(value).addEventListener("initComplete", handleInitComplete);
+ }
+
+ // super.strand = value;
+
+ if (previousButton == null) {
+ previousButton = createButton("previous", Button.SECONDARY);
+ previousButton.className = "previous";
+ }
+ if (previousButton != null && previousButton.parent == null) {
+ (_strand as IContainerBaseStrandChildrenHost).$addElement(previousButton);
+ }
+
+ if (contentArea.parent == null) {
+ (_strand as IContainerBaseStrandChildrenHost).$addElement(contentArea as IChild);
+ }
+
+ if (nextButton == null) {
+ nextButton = createButton("next", Button.SECONDARY);
+ nextButton.className = "next";
+ }
+ if (nextButton != null && nextButton.parent == null) {
+ (_strand as IContainerBaseStrandChildrenHost).$addElement(nextButton);
+ }
+
+ setupLayout();
+ }
+
+ /**
+ *
+ */
+ public function createButton(labelText:String = null, emphasis:String = null):IconButton
+ {
+ var b:IconButton = new IconButton();
+ if(labelText != null)
+ b.text = labelText;
+ if(emphasis != null)
+ b.emphasis = emphasis;
+
+ return b;
+ }
+
+ /**
+ * @private
+ */
+ protected function handleStepChange(event:Event):void
+ {
+ stepChangeAction();
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.jewel.beads.models.WizardModel
+ */
+ protected function stepChangeAction():void
+ {
+ previousButton.visible = (model.currentStep.previousStep != null);
+ nextButton.visible = (model.currentStep.nextStep != null);
+ }
+
+ protected function setupContentAreaLayout():void
+ {
+
+ }
+
+ protected function setupLayout():void
+ {
+ // COMPILE::JS {
+ // _titleBar.element.style["flex-grow"] = "0";
+ // _titleBar.element.style["order"] = "1";
+ // }
+
+ COMPILE::SWF {
+ _contentArea.percentWidth = 100;
+
+ if (_contentArea.style == null) {
+ _contentArea.style = new SimpleCSSStylesWithFlex();
+ }
+ _contentArea.style.flexGrow = 1;
+ _contentArea.style.order = 2;
+ }
+
+ // COMPILE::SWF {
+ // _titleBar.percentWidth = 100;
+
+ // if (_titleBar.style == null) {
+ // _titleBar.style = new SimpleCSSStylesWithFlex();
+ // }
+ // _titleBar.style.flexGrow = 0;
+ // _titleBar.style.order = 1;
+ // }
+
+ // COMPILE::JS {
+ // _contentArea.element.style["flex-grow"] = "1";
+ // _contentArea.element.style["order"] = "2";
+ // _contentArea.element.style["overflow"] = "auto"; // temporary
+ // }
+
+ // Now give the Wizard its own layout
+ var layoutBead:WizardLayout = new WizardLayout();
+ layoutBead.itemsVerticalAlign = "itemsCentered";
+ _strand.addBead(layoutBead);
+ }
+
+ private var _wizardLayoutProxy:WizardLayoutProxy;
+
+ /**
+ * The sub-element used as the parent of the container's elements. This does not
+ * include the chrome elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ override public function get contentView():ILayoutView
+ {
+ // we want to return a proxy for the wizard which will have numElements, getElementAt, etc.
+ // functions that will use the wizard.$numElements, wizard.$getElementAt, etc. functions
+ if (_wizardLayoutProxy == null) {
+ _wizardLayoutProxy = new WizardLayoutProxy(_strand);
+ }
+ return _wizardLayoutProxy;
+ }
+
+ override protected function completeSetup():void
+ {
+ super.completeSetup();
+
+ performLayout(null);
+ }
+
+ protected function handleSizeChange(event:Event):void
+ {
+ COMPILE::JS {
+ // _titleBar.percentWidth = 100;
+ _contentArea.percentWidth = 100;
+ }
+
+ performLayout(event);
+ }
+
+ private var sawInitComplete:Boolean;
+
+ private function handleChildrenAdded(event:Event):void
+ {
+ if (sawInitComplete ||
+ ((wizard.isHeightSizedToContent() || !isNaN(wizard.explicitHeight)) &&
+ (wizard.isWidthSizedToContent() || !isNaN(wizard.explicitWidth))))
+ {
+ _contentArea.dispatchEvent(new Event("layoutNeeded"));
+ performLayout(event);
+ }
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/wizard/WizardLayoutProxy.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/wizard/WizardLayoutProxy.as
new file mode 100644
index 0000000..a1060d3
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/wizard/WizardLayoutProxy.as
@@ -0,0 +1,237 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.supportClasses.wizard
+{
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.core.IChild;
+ import org.apache.royale.core.IContainerBaseStrandChildrenHost;
+ import org.apache.royale.core.ILayoutView;
+ import org.apache.royale.core.IParent;
+ import org.apache.royale.events.IEventDispatcher;
+
+ COMPILE::JS {
+ import org.apache.royale.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The WizardLayoutProxy class is used by Wizard in order for layouts to operate
+ * on the Wizard itself. If Wizard were being used, its numElements, getElementAt, etc.
+ * functions would actually redirect to its Container content. In order for a layout
+ * to work on the Wizard directly (its PreviousButton, NextButton and Container),
+ * this proxy is used which will invoke the Wizard's $numElements, $getElementAt, etc
+ * functions.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class WizardLayoutProxy implements ILayoutView, IParent
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function WizardLayoutProxy(host:Object)
+ {
+ super();
+ _host = host;
+ }
+
+ private var _host:Object;
+
+ public function get host():Object
+ {
+ return _host;
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ * The width of the bounding box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get width():Number {
+ return (host as UIBase).width;
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ * The height of the bounding box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get height():Number {
+ return (host as UIBase).height;
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ * The number of elements in the parent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function get numElements():int
+ {
+ return (host as IContainerBaseStrandChildrenHost).$numElements;
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ * Get a component from the parent.
+ *
+ * @param c The index of the subcomponent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function getElementAt(index:int):IChild
+ {
+ return (host as IContainerBaseStrandChildrenHost).$getElementAt(index);
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ * Gets the index of this subcomponent.
+ *
+ * @param c The subcomponent to add.
+ * @return The index (zero-based).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function getElementIndex(c:IChild):int
+ {
+ return (host as IContainerBaseStrandChildrenHost).$getElementIndex(c);
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ * Add a component to the parent.
+ *
+ * @param c The subcomponent to add.
+ * @param dispatchEvent Whether to dispatch an event after adding the child.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ (host as IContainerBaseStrandChildrenHost).$addElement(c);
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ * Add a component to the parent.
+ *
+ * @param c The subcomponent to add.
+ * @param index The index where the subcomponent should be added.
+ * @param dispatchEvent Whether to dispatch an event after adding the child.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ return (host as IContainerBaseStrandChildrenHost).$addElementAt(c, index);
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.IContainerBaseStrandChildrenHost
+ * Remove a component from the parent.
+ *
+ * @param c The subcomponent to remove.
+ * @param dispatchEvent Whether to dispatch an event after removing the child.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ return (host as IContainerBaseStrandChildrenHost).$removeElement(c);
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ */
+ COMPILE::JS
+ public function get somethingelse():WrappedHTMLElement
+ {
+ return (host as UIBase).element;
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ */
+ COMPILE::JS
+ public function get element():WrappedHTMLElement
+ {
+ return (host as UIBase).element;
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ * The display style is used for both visible
+ * and layout so is managed as a special case.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ COMPILE::JS
+ public function setDisplayStyleForLayout(value:String):void
+ {
+ (host as UIBase).setDisplayStyleForLayout(value);
+ }
+ /**
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ */
+ COMPILE::JS
+ public function get displayStyleForLayout():String
+ {
+ return (host as UIBase).displayStyleForLayout;
+ }
+
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_wizard.sass b/frameworks/projects/Jewel/src/main/sass/components/_wizard.sass
new file mode 100644
index 0000000..1cc981a
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/sass/components/_wizard.sass
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+// Jewel Wizard
+
+// Wizard variables
+
+.jewel
+ .wizard
+ width: 100%
+ .next
+ flex: 1 1 0
+ .previous
+ flex: 1 1 0
+ .wizardcontent
+ flex-grow: 100
+
+j|Wizard
+ IBeadView: ClassReference("org.apache.royale.jewel.beads.views.WizardView")
+ IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.WizardController")
+ // IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.WizardLayout")
+ IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.WizardModel")
+ IWizardLayout: ClassReference("org.apache.royale.jewel.beads.layouts.WizardLayout")
+ IWizardContentArea: ClassReference("org.apache.royale.jewel.WizardContent")
+
+// j|WizardNavigator
+// IBeadView: ClassReference("org.apache.royale.jewel.beads.views.ListView")
+// IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.ListSingleSelectionMouseController")
+// IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalLayout")
+// IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory")
+// IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.WizardButtonItemRenderer")
+// IViewport: ClassReference("org.apache.royale.jewel.supportClasses.scrollbar.ScrollingViewport")
+// IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel")
+// IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.ArrayListSelectionModel")
+// IDataProviderItemRendererMapper: ClassReference("org.apache.royale.jewel.beads.itemRenderers.DataItemRendererFactoryForCollectionView")
+
+// Jewel WizardButtonItemRenderer
+// $wizardbutton-margin: 0 !default
+// $wizardbutton-padding: 0.68em 1.12em !default
+
+// WizardButtonItemRenderer variables
+// .jewel.wizardbutton
+// min-height: 48px
+// margin: $wizardbutton-margin
+// padding: $wizardbutton-padding
+
+// j|WizardButtonItemRenderer
+// IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.ItemRendererMouseController")
+
+
+j|WizardContent
+ IBeadView: ClassReference("org.apache.royale.html.beads.ContainerView")
+ IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.NullLayout")
+ IViewport: ClassReference("org.apache.royale.jewel.supportClasses.Viewport")
+ IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel")
diff --git a/frameworks/projects/Jewel/src/main/sass/defaults.sass b/frameworks/projects/Jewel/src/main/sass/defaults.sass
index 5c8afd6..a5d047e 100644
--- a/frameworks/projects/Jewel/src/main/sass/defaults.sass
+++ b/frameworks/projects/Jewel/src/main/sass/defaults.sass
@@ -56,4 +56,5 @@
@import "components/togglebutton"
@import "components/tooltip"
@import "components/topappbar"
+@import "components/wizard"
@import "components/applicationmaincontent"