You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pe...@apache.org on 2018/02/14 13:51:39 UTC
[royale-asjs] 01/01: Introduces DividedBox components: HDividedBox
and VDividedBox along with sub-components and beads. Includes
DividedBoxExample.
This is an automated email from the ASF dual-hosted git repository.
pent pushed a commit to branch feature/DividedBox
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 3869e968b46becee1723e4eb5df8c0740e738bc6
Author: Peter Ent <pe...@apache.org>
AuthorDate: Wed Feb 14 08:51:34 2018 -0500
Introduces DividedBox components: HDividedBox and VDividedBox along with sub-components and beads. Includes DividedBoxExample.
---
examples/build.xml | 3 +
examples/royale/DividedBoxExample/README.txt | 31 +++
examples/royale/DividedBoxExample/asconfig.json | 31 +++
examples/royale/DividedBoxExample/build.xml | 54 +++++
examples/royale/DividedBoxExample/pom.xml | 62 ++++++
.../src/main/royale/DividedBoxExample.mxml | 32 +++
.../src/main/royale/MyInitialView.mxml | 86 ++++++++
.../Basic/src/main/resources/basic-manifest.xml | 4 +
.../projects/Basic/src/main/resources/defaults.css | 38 ++++
.../projects/Basic/src/main/royale/BasicClasses.as | 11 +
.../royale/org/apache/royale/html/DividedBox.as | 230 +++++++++++++++++++++
.../royale/org/apache/royale/html/HDividedBox.as | 47 +++++
.../royale/org/apache/royale/html/VDividedBox.as | 47 +++++
.../org/apache/royale/html/beads/DividedBoxView.as | 125 +++++++++++
.../controllers/HDividedBoxMouseController.as | 115 +++++++++++
.../controllers/VDividedBoxMouseController.as | 119 +++++++++++
.../royale/html/beads/layouts/HDividedBoxLayout.as | 184 +++++++++++++++++
.../royale/html/beads/layouts/VDividedBoxLayout.as | 184 +++++++++++++++++
.../royale/html/beads/models/DividedBoxModel.as | 120 +++++++++++
.../html/supportClasses/DividedBoxDivider.as | 72 +++++++
.../html/supportClasses/HDividedBoxDivider.as | 59 ++++++
.../html/supportClasses/HDividedBoxGripper.as | 93 +++++++++
.../html/supportClasses/IDividedBoxGripper.as | 35 ++++
.../html/supportClasses/VDividedBoxDivider.as | 59 ++++++
.../html/supportClasses/VDividedBoxGripper.as | 93 +++++++++
25 files changed, 1934 insertions(+)
diff --git a/examples/build.xml b/examples/build.xml
index 6ad69ea..161d146 100644
--- a/examples/build.xml
+++ b/examples/build.xml
@@ -87,6 +87,7 @@
<ant dir="${basedir}/royale/DataGridExample"/>
<ant dir="${basedir}/royale/DateControlsExample"/>
<ant dir="${basedir}/royale/DesktopMap"/>
+ <ant dir="${basedir}/royale/DividedBoxExample"/>
<ant dir="${basedir}/royale/DragAndDropExample"/>
<ant dir="${basedir}/royale/RoyaleTeamPage_MDL"/>
<ant dir="${basedir}/royale/RoyaleWebsiteStatsViewer"/>
@@ -135,6 +136,7 @@
<ant dir="${basedir}/royale/DataGridExample" target="clean"/>
<ant dir="${basedir}/royale/DateControlsExample" target="clean"/>
<ant dir="${basedir}/royale/DesktopMap" target="clean"/>
+ <ant dir="${basedir}/royale/DividedBoxExample" target="clean"/>
<ant dir="${basedir}/royale/DragAndDropExample" target="clean"/>
<ant dir="${basedir}/royale/RoyaleTeamPage_MDL" target="clean"/>
<ant dir="${basedir}/royale/RoyaleWebsiteStatsViewer" target="clean"/>
@@ -173,6 +175,7 @@
<ant dir="${basedir}/royale/DataGridExample" target="examine"/>
<ant dir="${basedir}/royale/DateControlsExample" target="examine"/>
<ant dir="${basedir}/royale/DesktopMap" target="examine"/>
+ <ant dir="${basedir}/royale/DividedBoxExample" target="examine"/>
<ant dir="${basedir}/royale/DragAndDropExample" target="examine"/>
<ant dir="${basedir}/royale/RoyaleTeamPage_MDL" target="examine"/>
<ant dir="${basedir}/royale/RoyaleWebsiteStatsViewer" target="examine"/>
diff --git a/examples/royale/DividedBoxExample/README.txt b/examples/royale/DividedBoxExample/README.txt
new file mode 100644
index 0000000..44afa0a
--- /dev/null
+++ b/examples/royale/DividedBoxExample/README.txt
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+DESCRIPTION
+
+The DividedBoxExample demonstrates the Royale DividedBox components: HDividedBox and
+VDividedBox. These contains separate their children using interactive dividers, allowing
+you to resize them.
+
+The HDividedBox arranges its children into columns while the VDividedBox arranges its
+children into rows.
+
+The DividedBox is built from sub-components and beads, most of which can be substituted
+with other compatible beads or even custom beads you write. The substitutions can be
+made in MXML but are most often done in CSS.
diff --git a/examples/royale/DividedBoxExample/asconfig.json b/examples/royale/DividedBoxExample/asconfig.json
new file mode 100644
index 0000000..c5bf2bb
--- /dev/null
+++ b/examples/royale/DividedBoxExample/asconfig.json
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+{
+ "config": "royale",
+ "compilerOptions": {
+ "debug": false,
+ "targets": ["JSRoyale","SWF"],
+ "source-map": true
+ },
+ "additionalOptions": "-remove-circulars -js-output-optimization=skipAsCoercions",
+ "files":
+ [
+ "src/main/royale/DividedBoxExample.mxml"
+ ]
+}
diff --git a/examples/royale/DividedBoxExample/build.xml b/examples/royale/DividedBoxExample/build.xml
new file mode 100644
index 0000000..0fea074
--- /dev/null
+++ b/examples/royale/DividedBoxExample/build.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+
+
+<project name="dividedboxexample" default="main" basedir=".">
+ <property name="ROYALE_HOME" location="../../.."/>
+ <property name="example" value="DividedBoxExample" />
+
+ <property file="${ROYALE_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${ROYALE_HOME}/build.properties"/>
+ <property name="ROYALE_HOME" value="${ROYALE_HOME}"/>
+
+ <include file="${basedir}/../../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ <delete dir="${basedir}/target" failonerror="false" />
+ </target>
+
+ <target name="examine" depends="build_example.get.browser">
+ <property name="which" value="debug" />
+ <echo message="Drag on the dividers of the DividedBoxes"/>
+ <exec executable="${browser}" dir="${basedir}/bin-${which}" failonerror="true">
+ <arg value="${basedir}/bin-${which}/${example}.html"/>
+ </exec>
+ <exec executable="${browser}" dir="${basedir}/bin/js-${which}" failonerror="true">
+ <arg value="${basedir}/bin/js-${which}/index.html"/>
+ </exec>
+ </target>
+
+</project>
diff --git a/examples/royale/DividedBoxExample/pom.xml b/examples/royale/DividedBoxExample/pom.xml
new file mode 100644
index 0000000..c6e4700
--- /dev/null
+++ b/examples/royale/DividedBoxExample/pom.xml
@@ -0,0 +1,62 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!--
+ Flash Version: CSS problems
+ -->
+
+ <parent>
+ <groupId>org.apache.royale.examples</groupId>
+ <artifactId>examples-royale</artifactId>
+ <version>0.9.2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>DividedBoxExample</artifactId>
+ <version>0.9.2-SNAPSHOT</version>
+ <packaging>swf</packaging>
+
+ <name>Apache Royale: Examples: Royale: DividedBoxExample</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.royale.compiler</groupId>
+ <artifactId>royale-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <mainClass>DividedBoxExample.mxml</mainClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.adobe.flash.framework</groupId>
+ <artifactId>playerglobal</artifactId>
+ <version>${flash.version}</version>
+ <type>swc</type>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/examples/royale/DividedBoxExample/src/main/royale/DividedBoxExample.mxml b/examples/royale/DividedBoxExample/src/main/royale/DividedBoxExample.mxml
new file mode 100644
index 0000000..8fdd94e
--- /dev/null
+++ b/examples/royale/DividedBoxExample/src/main/royale/DividedBoxExample.mxml
@@ -0,0 +1,32 @@
+<?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.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:js="library://ns.apache.org/royale/basic"
+ >
+
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+</js:Application>
diff --git a/examples/royale/DividedBoxExample/src/main/royale/MyInitialView.mxml b/examples/royale/DividedBoxExample/src/main/royale/MyInitialView.mxml
new file mode 100644
index 0000000..61aa3c1
--- /dev/null
+++ b/examples/royale/DividedBoxExample/src/main/royale/MyInitialView.mxml
@@ -0,0 +1,86 @@
+<?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.
+
+-->
+<js:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/royale/basic"
+ xmlns:local="*">
+
+ <fx:Style>
+ @namespace js "library://ns.apache.org/royale/basic";
+
+
+ .Group1 {
+ background-color: #FFCCCC;
+ }
+
+ .Group2 {
+ background-color: #CCFFCC;
+ }
+
+ .Group3 {
+ background-color: #DEDEFF;
+ }
+
+ .Group4 {
+ background-color: #CCCC00;
+ }
+
+ /* Give the outer HDividedBox some padding */
+ js|HDividedBox {
+ padding: 10px;
+ }
+
+ /* Give all the Groups a little padding */
+ js|Group {
+ padding: 4px;
+ }
+ </fx:Style>
+
+ <js:HDividedBox width="600" height="600">
+ <js:VGroup className="Group1" width="175" height="100%">
+ <js:Label text="Group One" />
+ <js:Spacer height="30" />
+ <js:Label text="Menu or tool palette perhaps" />
+ </js:VGroup>
+
+ <!-- Because VDividedBox has no default width it will occupy
+ the remaining width of the HDividedBox.
+ -->
+ <js:VDividedBox>
+ <js:Group id="group2" className="Group2" height="100" >
+ <js:Label text="Group Two" />
+ </js:Group>
+
+ <!-- Because Group has no default height and group3 is not given
+ an explicit height, it will occupy the remaining space in the
+ VDividedBox.
+ -->
+ <js:Group id="group3" className="Group3">
+ <js:Label text="Group 3" />
+ </js:Group>
+
+ <js:Group id="group4" className="Group4" height="100">
+ <js:Label text="Group 4" />
+ </js:Group>
+
+ </js:VDividedBox>
+
+ </js:HDividedBox>
+
+</js:View>
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 236ab92..218ef21 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -27,6 +27,8 @@
<component id="Button" class="org.apache.royale.html.Button"/>
<component id="CloseButton" class="org.apache.royale.html.CloseButton"/>
<component id="ButtonBar" class="org.apache.royale.html.ButtonBar"/>
+ <component id="HDividedBox" class="org.apache.royale.html.HDividedBox" />
+ <component id="VDividedBox" class="org.apache.royale.html.VDividedBox" />
<component id="DropDownList" class="org.apache.royale.html.DropDownList"/>
<component id="DropDownListList" class="org.apache.royale.html.supportClasses.DropDownListList"/>
<component id="Image" class="org.apache.royale.html.Image"/>
@@ -131,6 +133,8 @@
<component id="HRule" class="org.apache.royale.html.HRule" />
<component id="VRule" class="org.apache.royale.html.VRule" />
<component id="Spacer" class="org.apache.royale.html.Spacer" />
+ <component id="HDividedBoxDivider" class="org.apache.royale.html.supportClasses.HDividedBoxDivider" />
+ <component id="VDividedBoxDivider" class="org.apache.royale.html.supportClasses.VDividedBoxDivider" />
<!--
<component id="ImageAndTextButtonView" class="org.apache.royale.html.beads.ImageAndTextButtonView" />
-->
diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css b/frameworks/projects/Basic/src/main/resources/defaults.css
index 8394bd8..d32950a 100644
--- a/frameworks/projects/Basic/src/main/resources/defaults.css
+++ b/frameworks/projects/Basic/src/main/resources/defaults.css
@@ -175,6 +175,8 @@ DataGrid
background-color: #FFFFFF;
border: 1px solid #222222;
+ width: 200px;
+ height: 200px;
}
DataGridButtonBar
@@ -305,6 +307,32 @@ DateField {
IFormatBead: ClassReference("org.apache.royale.html.accessories.DateFormatYYYYMMDD");
}
+/** DividedBox */
+
+HDividedBox {
+ IBeadView: ClassReference("org.apache.royale.html.beads.DividedBoxView");
+ IBeadModel: ClassReference("org.apache.royale.html.beads.models.DividedBoxModel");
+ IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.HDividedBoxLayout");
+}
+
+VDividedBox {
+ IBeadView: ClassReference("org.apache.royale.html.beads.DividedBoxView");
+ IBeadModel: ClassReference("org.apache.royale.html.beads.models.DividedBoxModel");
+ IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VDividedBoxLayout");
+}
+
+HDividedBoxDivider {
+ IBeadController: ClassReference("org.apache.royale.html.beads.controllers.HDividedBoxMouseController");
+ IGripperBead: ClassReference("org.apache.royale.html.supportClasses.HDividedBoxGripper");
+ background-color: transparent;
+}
+
+VDividedBoxDivider {
+ IBeadController: ClassReference("org.apache.royale.html.beads.controllers.VDividedBoxMouseController");
+ IGripperBead: ClassReference("org.apache.royale.html.supportClasses.VDividedBoxGripper");
+ background-color: transparent;
+}
+
/* Groups */
Form {
@@ -788,6 +816,16 @@ global
padding: 5px;
}
+ HDividedBoxDivider {
+ iBackgroundBead: ClassReference('org.apache.royale.html.beads.SolidBackgroundBead');
+ iBorderBead: ClassReference("org.apache.royale.html.beads.SingleLineBorderBead");
+ }
+
+ VDividedBoxDivider {
+ iBackgroundBead: ClassReference('org.apache.royale.html.beads.SolidBackgroundBead');
+ iBorderBead: ClassReference("org.apache.royale.html.beads.SingleLineBorderBead");
+ }
+
DropDownList
{
IBeadModel: ClassReference("org.apache.royale.html.beads.models.ArraySelectionModel");
diff --git a/frameworks/projects/Basic/src/main/royale/BasicClasses.as b/frameworks/projects/Basic/src/main/royale/BasicClasses.as
index ad82d84..437ae86 100644
--- a/frameworks/projects/Basic/src/main/royale/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/royale/BasicClasses.as
@@ -41,6 +41,17 @@ internal class BasicClasses
import org.apache.royale.html.beads.AlertView; AlertView;
import org.apache.royale.html.beads.controllers.AlertController; AlertController;
+ import org.apache.royale.html.beads.DividedBoxView; DividedBoxView;
+ import org.apache.royale.html.beads.models.DividedBoxModel; DividedBoxModel;
+ import org.apache.royale.html.beads.layouts.HDividedBoxLayout; HDividedBoxLayout;
+ import org.apache.royale.html.beads.layouts.VDividedBoxLayout; VDividedBoxLayout;
+ import org.apache.royale.html.supportClasses.DividedBoxDivider; DividedBoxDivider;
+ import org.apache.royale.html.supportClasses.HDividedBoxGripper; HDividedBoxGripper;
+ import org.apache.royale.html.supportClasses.VDividedBoxGripper; VDividedBoxGripper;
+ import org.apache.royale.html.beads.controllers.HDividedBoxMouseController; HDividedBoxMouseController;
+ import org.apache.royale.html.beads.controllers.VDividedBoxMouseController; VDividedBoxMouseController;
+
+
COMPILE::SWF
{
import org.apache.royale.html.beads.BackgroundImageBead; BackgroundImageBead;
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/DividedBox.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/DividedBox.as
new file mode 100644
index 0000000..c68a84b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/DividedBox.as
@@ -0,0 +1,230 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html
+{
+ import org.apache.royale.core.IBeadLayout;
+ import org.apache.royale.core.IContainer;
+ import org.apache.royale.core.ILayoutHost;
+ import org.apache.royale.core.ILayoutParent;
+ import org.apache.royale.core.ILayoutView;
+ import org.apache.royale.core.IMXMLDocument;
+ import org.apache.royale.core.IParent;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.core.ValuesManager;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.html.beads.layouts.HDividedBoxLayout;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+ import org.apache.royale.utils.MXMLDataInterpreter;
+ import org.apache.royale.utils.loadBeadFromValuesManager;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The DividedBox lays out its children (either horizontally or vertically, depending on
+ * which layout is used) separated by dividers. The dividers can be moved to grow and shrink
+ * the children.
+ *
+ * This is the base class. See HDividedBox and VDividedBox for useful implementations.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class DividedBox extends UIBase implements IContainer, ILayoutParent, ILayoutHost, ILayoutView, IMXMLDocument
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function DividedBox()
+ {
+ super();
+ className = "DividedBox";
+ }
+
+ // DividedBoxLayout takes care of sizing and positioning the children and the
+ // the separators. The layout listens to changes to the DividedBoxModel and uses
+ // the model to determine the exact size of each child.
+
+ // DividedBoxModel contains the identities of the children and the separators as
+ // well as the amount to increase or decrease each child. Once the layout completes,
+ // the adjustments are reset to zero (their default values).
+
+ // DividedBoxDivider is a control that sits between the children and has a mouse
+ // controller (DividedBoxMouseController) that lets the user interact with the
+ // DividedBox. By pressing the mouse down over the separator and moving it, the
+ // mouse controller tracks the changes to the mouse position and updates the model
+ // which will then trigger a new layout, adjusting the size and position of the
+ // children.
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ if (!_initialized)
+ {
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+ }
+
+ super.addedToParent();
+
+ var layoutBead:IBeadLayout = loadBeadFromValuesManager(HDividedBoxLayout, "iBeadLayout", this) as IBeadLayout;
+
+ if (!_initialized)
+ {
+ MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+ _initialized = true;
+ }
+ }
+
+ /**
+ * Sets the direction of the divided box. Setting direction to "horizontal" divides
+ * the box into columns with a separator between each column. Setting direction to
+ * "vertical" divides the box into rows with separators between the rows.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function get direction():String
+ {
+ return DividedBoxModel(model).direction;
+ }
+ public function set direction(value:String):void
+ {
+ DividedBoxModel(model).direction = value;
+ }
+
+ // IMXMLDocument
+
+ private var _mxmlDescriptor:Array;
+ private var _mxmlDocument:Object = this;
+ private var _initialized:Boolean = false;
+
+ /**
+ * @copy org.apache.royale.core.Application#MXMLDescriptor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return _mxmlDescriptor;
+ }
+
+ /**
+ * @private
+ */
+ public function setMXMLDescriptor(document:Object, value:Array):void
+ {
+ _mxmlDocument = document;
+ _mxmlDescriptor = value;
+ }
+
+ /**
+ * @copy org.apache.royale.core.Application#generateMXMLAttributes()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * @copy org.apache.royale.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public var mxmlContent:Array;
+
+ // ILayoutParent
+
+ /**
+ * @private
+ */
+ public function getLayoutHost():ILayoutHost
+ {
+ return this;
+ }
+
+ // ILayoutHost
+
+ /**
+ * @private
+ */
+ public function get contentView():ILayoutView
+ {
+ return this;
+ }
+
+ /**
+ * @private
+ */
+ public function beforeLayout():void
+ {
+ // does nothing
+ }
+
+ /**
+ * @private
+ */
+ public function afterLayout():void
+ {
+ // does nothing
+ }
+
+ // IContainer
+
+ /**
+ * @private
+ */
+ public function childrenAdded():void
+ {
+ dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @private
+ */
+ public function get strandChildren():IParent
+ {
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/HDividedBox.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/HDividedBox.as
new file mode 100644
index 0000000..5fa45cd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/HDividedBox.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html
+{
+ /**
+ * This sub-class of DividedBox organizes its children into columns separated by
+ * movable dividers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class HDividedBox extends DividedBox
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function HDividedBox()
+ {
+ super();
+ className = "HDividedBox";
+ direction = "horizontal";
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/VDividedBox.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/VDividedBox.as
new file mode 100644
index 0000000..8d81858
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/VDividedBox.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html
+{
+ /**
+ * This sub-class of DividedBox organizes its children into rows separated by
+ * movable dividers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class VDividedBox extends DividedBox
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function VDividedBox()
+ {
+ super();
+ className = "VDividedBox";
+ direction = "vertical";
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DividedBoxView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DividedBoxView.as
new file mode 100644
index 0000000..a56f522
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DividedBoxView.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.beads
+{
+ import org.apache.royale.core.IBeadView;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IUIBase;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.html.DividedBox;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+ import org.apache.royale.html.supportClasses.DividedBoxDivider;
+ import org.apache.royale.html.supportClasses.HDividedBoxDivider;
+ import org.apache.royale.html.supportClasses.VDividedBoxDivider;
+ import org.apache.royale.utils.loadBeadFromValuesManager;
+
+ /**
+ * The DividedBoxView class is responsible for generating the
+ * DividedBoxSeparators between the children and placing them
+ * in the z-order between the children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class DividedBoxView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function DividedBoxView()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ (_strand as IEventDispatcher).addEventListener("childrenAdded", handleChildrenAdded);
+ (_strand as UIBase).model.addEventListener("pairAdjustmentChanged", handlePairAdjustmentChanged);
+ }
+
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * Handles the "childrenAdded" event and generates the separators between them
+ * based on the direction of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ protected function handleChildrenAdded(event:Event):void
+ {
+ var n:int = (host as UIBase).numElements;
+
+ // add in n-1 separators and adjustments
+ var seps:Array = [];
+ var adjustments:Array = [];
+ if (n > 1) {
+ for(var i:int=0; i < (n-1); i++) {
+ var sep:DividedBoxDivider;
+ if (((_strand as UIBase).model as DividedBoxModel).direction == "horizontal") {
+ sep = new HDividedBoxDivider();
+ } else {
+ sep = new VDividedBoxDivider();
+ }
+ (host as UIBase).addElement(sep);
+ seps.push(sep);
+ adjustments.push(0);
+
+ sep.model = (_strand as UIBase).model;
+ sep.pairIndex = i;
+ }
+ }
+
+ ((host as UIBase).model as DividedBoxModel).pairAdjustments = adjustments;
+
+ (_strand as IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));
+ }
+
+ /**
+ * @private
+ */
+ private function handlePairAdjustmentChanged(event:Event):void
+ {
+ (_strand as IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/HDividedBoxMouseController.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/HDividedBoxMouseController.as
new file mode 100644
index 0000000..15e2684
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/HDividedBoxMouseController.as
@@ -0,0 +1,115 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.beads.controllers
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IBeadController;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IUIBase;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.events.MouseEvent;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+ import org.apache.royale.html.supportClasses.DividedBoxDivider;
+
+ /**
+ * This is the mouse controller for the HDividedBox. This bead class tracks the
+ * mouse over a HDividedBoxDivider (its strand) causing the columns on either side
+ * of the divider to grow and shrink.
+ */
+ public class HDividedBoxMouseController implements IBead, IBeadController
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function HDividedBoxMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ (_strand as IEventDispatcher).addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
+ }
+
+ private var deltaMove:Number = 0;
+ private var lastPosition:Number = 0;
+
+ /**
+ * @private
+ */
+ private function handleMouseDown(event:MouseEvent):void
+ {
+ COMPILE::JS {
+ // this stops the cursor from changing into an I-Beam
+ event.preventDefault();
+ }
+ lastPosition = event.screenX;
+ deltaMove = 0;
+ //trace("* HDividedBoxMouseController: anchor at "+lastPosition);
+
+ IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
+ IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
+
+ }
+
+ /**
+ * @private
+ */
+ private function handleMouseMove(event:MouseEvent):void
+ {
+ //trace("--- mouse moving by "+(event.screenX - lastPosition));
+ deltaMove = event.screenX - lastPosition;
+
+ var model:DividedBoxModel = (_strand as UIBase).model as DividedBoxModel;
+ var pairIndex:int = (_strand as DividedBoxDivider).pairIndex;
+
+ model.addPairAdjustment(deltaMove, pairIndex);
+
+ lastPosition = event.screenX;
+ }
+
+ /**
+ * @private
+ */
+ private function handleMouseUp(event:MouseEvent):void
+ {
+ deltaMove = event.screenX - lastPosition;
+ //trace("* HDividedBoxMouseController: up at "+event.screenX+" delta of "+deltaMove);
+
+ IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
+ IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
+
+ var model:DividedBoxModel = (_strand as UIBase).model as DividedBoxModel;
+ var pairIndex:int = (_strand as DividedBoxDivider).pairIndex;
+
+ model.addPairAdjustment(deltaMove, pairIndex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/VDividedBoxMouseController.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/VDividedBoxMouseController.as
new file mode 100644
index 0000000..46920d2
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/VDividedBoxMouseController.as
@@ -0,0 +1,119 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.beads.controllers
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IBeadController;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IUIBase;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.events.MouseEvent;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+ import org.apache.royale.html.supportClasses.DividedBoxDivider;
+
+ /**
+ * This is the mouse controller for the VDividedBox. This bead class tracks
+ * the mouse over a VDividedBoxDivider (its strand) causing the rows above
+ * and below it to grow and shrink.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class VDividedBoxMouseController implements IBead, IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function VDividedBoxMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ (_strand as IEventDispatcher).addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
+ }
+
+ private var deltaMove:Number = 0;
+ private var lastPosition:Number = 0;
+
+ /**
+ * @private
+ */
+ private function handleMouseDown(event:MouseEvent):void
+ {
+ COMPILE::JS {
+ // this stops the cursor from changing into an I-Beam
+ event.preventDefault();
+ }
+ lastPosition = event.screenY;
+ deltaMove = 0;
+ //trace("* VDividedBoxMouseController: anchor at "+lastPosition);
+
+ IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
+ IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
+ }
+
+ /**
+ * @private
+ */
+ private function handleMouseMove(event:MouseEvent):void
+ {
+ //trace("--- mouse moving by "+(event.screenY - lastPosition));
+ deltaMove = event.screenY - lastPosition;
+
+ var model:DividedBoxModel = (_strand as UIBase).model as DividedBoxModel;
+ var pairIndex:int = (_strand as DividedBoxDivider).pairIndex;
+
+ model.addPairAdjustment(deltaMove, pairIndex);
+
+ lastPosition = event.screenY;
+ }
+
+ /**
+ * @private
+ */
+ private function handleMouseUp(event:MouseEvent):void
+ {
+ deltaMove = event.screenY - lastPosition;
+ //trace("* VDividedBoxMouseController: up at "+event.screenY+" delta of "+deltaMove);
+
+ IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
+ IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
+
+ var model:DividedBoxModel = (_strand as UIBase).model as DividedBoxModel;
+ var pairIndex:int = (_strand as DividedBoxDivider).pairIndex;
+
+ model.addPairAdjustment(deltaMove, pairIndex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/HDividedBoxLayout.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/HDividedBoxLayout.as
new file mode 100644
index 0000000..db8a817
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/HDividedBoxLayout.as
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.beads.layouts
+{
+ import org.apache.royale.core.IBeadLayout;
+ import org.apache.royale.core.IChild;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.LayoutBase;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.geom.Rectangle;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+ import org.apache.royale.html.supportClasses.DividedBoxDivider;
+ import org.apache.royale.utils.CSSContainerUtils;
+ import org.apache.royale.utils.CSSUtils;
+
+ /**
+ * This sub-class of DividedBoxLayout class is responsible for sizing and
+ * positioning the children of the DividedBox into columns with separators
+ * between them.
+ *
+ * In order to correctly size and place the children, the DividedBoxLayout
+ * relies on additional information contained in the DividedBoxModel. These
+ * adjustments (which default to zero) can be changed by interacting with
+ * the DividedBoxSeparators and their mouse controllers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class HDividedBoxLayout extends LayoutBase implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function HDividedBoxLayout()
+ {
+ }
+
+ private var _strand: IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ //((_strand as UIBase).model as IEventDispatcher).addEventListener("pairAdjustmentChanged", handleLayoutNeeded);
+ }
+
+ /**
+ * @private
+ */
+ override public function layout():Boolean
+ {
+ var host:UIBase = _strand as UIBase;
+ var n:int = host.numElements;
+ if (n == 0) return false;
+
+ COMPILE::JS {
+ host.element.style['position'] = 'absolute';
+ }
+
+ var useWidth:Number = host.width;
+ var useHeight:Number = host.height;
+
+ var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+ var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
+
+ useWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
+ useHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
+
+ // Separate the children from the dividers and determine left over width
+ var remainingWidth:Number = useWidth;
+ var remainingCount:Number = 0;
+ var actualChildren:Array = [];
+ var separators:Array = [];
+
+ for(var i:int=0; i < n; i++) {
+ var child:UIBase = host.getElementAt(i) as UIBase;
+ if (child is DividedBoxDivider) {
+ separators.push(child);
+ } else {
+ actualChildren.push(child);
+ if (!isNaN(child.explicitWidth)) {
+ remainingWidth -= child.explicitWidth;
+ } else {
+ remainingCount++;
+ }
+ }
+ }
+
+ // calculate defaults
+ var numSeparators:Number = separators.length;
+ remainingWidth -= numSeparators*10;
+ var childInitialWidth:Number = remainingWidth;
+ if (remainingCount > 0) {
+ childInitialWidth = remainingWidth/remainingCount;
+ }
+ var xpos:Number = borderMetrics.left + paddingMetrics.left;
+ var ypos:Number = borderMetrics.top + paddingMetrics.top;
+ var j:int = 0;
+
+ var adjustments:Array = (host.model as DividedBoxModel).pairAdjustments;
+ var childWidths:Array = [];
+
+ // size and position a child followed by a separator
+ for(i=0; i < actualChildren.length; i++)
+ {
+ child = actualChildren[i] as UIBase;
+
+ var childWidth:Number = childInitialWidth;
+ var childHeight:Number = useHeight;
+ if (!isNaN(child.percentWidth)) {
+ childWidth = (child.percentWidth/100.0) * remainingWidth;
+ }
+ else if (!isNaN(child.explicitWidth)) {
+ childWidth = child.explicitWidth;
+ }
+ //trace("1 - HDividedBoxLayout: Setting child to "+childWidth+" x "+childHeight);
+ childWidths.push(childWidth);
+ }
+
+ //trace("2 - HDividedBoxLayout: adjusting");
+ for(j=0, i=0; j < adjustments.length; j++, i++) {
+ childWidths[i] += adjustments[j];
+ childWidths[i+1] -= adjustments[j];
+ }
+
+ for(i=0, j=0; i < actualChildren.length; i++)
+ {
+ child = actualChildren[i] as UIBase;
+ child.x = xpos;
+ child.y = ypos;
+ //trace("3 - HDividedLayout: setting child to "+childWidths[i]+" x "+useHeight);
+ child.setWidth(childWidths[i]);
+ child.setHeight(useHeight);
+ COMPILE::JS {
+ child.element.style['position'] = 'absolute';
+ }
+
+ if (j < separators.length) {
+ var sep:UIBase = separators[j] as UIBase;
+ sep.width = 10;
+ sep.height = useHeight;
+ sep.x = xpos + child.width;
+ sep.y = ypos;
+ COMPILE::JS {
+ sep.element.style['position'] = 'absolute';
+ }
+ j += 1;
+ }
+
+ xpos += child.width + 10;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/VDividedBoxLayout.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/VDividedBoxLayout.as
new file mode 100644
index 0000000..a5df298
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/VDividedBoxLayout.as
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.beads.layouts
+{
+ import org.apache.royale.core.IBeadLayout;
+ import org.apache.royale.core.IChild;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.LayoutBase;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.geom.Rectangle;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+ import org.apache.royale.html.supportClasses.DividedBoxDivider;
+ import org.apache.royale.utils.CSSContainerUtils;
+ import org.apache.royale.utils.CSSUtils;
+
+ /**
+ * This sub-class of DividedBoxLayout class is responsible for sizing and
+ * positioning the children of the DividedBox into rows with separators
+ * between them.
+ *
+ * In order to correctly size and place the children, the DividedBoxLayout
+ * relies on additional information contained in the DividedBoxModel. These
+ * adjustments (which default to zero) can be changed by interacting with
+ * the DividedBoxSeparators and their mouse controllers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class VDividedBoxLayout extends LayoutBase implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function VDividedBoxLayout()
+ {
+ }
+
+ private var _strand: IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ //((_strand as UIBase).model as IEventDispatcher).addEventListener("pairAdjustmentChanged", handleLayoutNeeded);
+ }
+
+ /**
+ * @private
+ */
+ override public function layout():Boolean
+ {
+ var host:UIBase = _strand as UIBase;
+ var n:int = host.numElements;
+ if (n == 0) return false;
+
+ COMPILE::JS {
+ host.element.style['position'] = 'absolute';
+ }
+
+ var useWidth:Number = host.width;
+ var useHeight:Number = host.height;
+
+ var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+ var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
+
+ useWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
+ useHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
+
+ // Separate the children from the dividers
+ var remainingHeight:Number = useHeight;
+ var remainingCount:Number = 0;
+ var actualChildren:Array = [];
+ var separators:Array = [];
+
+ for(var i:int=0; i < n; i++) {
+ var child:UIBase = host.getElementAt(i) as UIBase;
+ if (child is DividedBoxDivider) {
+ separators.push(child);
+ } else {
+ actualChildren.push(child);
+ if (!isNaN(child.explicitHeight)) {
+ remainingHeight -= child.explicitHeight;
+ } else {
+ remainingCount++;
+ }
+ }
+ }
+
+ // calculate defaults
+ var numSeparators:Number = separators.length;
+ remainingHeight -= numSeparators*10;
+ var childInitialHeight:Number = remainingHeight;
+ if (remainingCount > 0) {
+ childInitialHeight = remainingHeight/remainingCount;
+ }
+ var xpos:Number = borderMetrics.left + paddingMetrics.left;
+ var ypos:Number = borderMetrics.top + paddingMetrics.top;
+ var j:int = 0;
+
+ var adjustments:Array = (host.model as DividedBoxModel).pairAdjustments;
+ var childHeights:Array = [];
+
+ // size and position a child followed by a separator
+ for(i=0; i < actualChildren.length; i++)
+ {
+ child = actualChildren[i] as UIBase;
+
+ var childWidth:Number = useWidth;
+ var childHeight:Number = childInitialHeight;
+ if (!isNaN(child.percentHeight)) {
+ childHeight = (child.percentHeight/100.0) * remainingHeight;
+ }
+ else if (!isNaN(child.explicitHeight)) {
+ childHeight = child.explicitHeight;
+ }
+ //trace("1 - VDividedBoxLayout: Setting child to "+childWidth+" x "+childHeight);
+ childHeights.push(childHeight);
+ }
+
+ //trace("2 - VDividedBoxLayout: adjusting");
+ for(j=0, i=0; j < adjustments.length; j++, i++) {
+ childHeights[i] += adjustments[j];
+ childHeights[i+1] -= adjustments[j];
+ }
+
+ for(i=0, j=0; i < actualChildren.length; i++)
+ {
+ child = actualChildren[i] as UIBase;
+ child.x = xpos;
+ child.y = ypos;
+ //trace("3 - VDividedLayout: setting child to "+useWidth+" x "+childHeights[i]);
+ child.setWidth(useWidth);
+ child.setHeight(childHeights[i]);
+ COMPILE::JS {
+ child.element.style['position'] = 'absolute';
+ }
+
+ if (j < separators.length) {
+ var sep:UIBase = separators[j] as UIBase;
+ sep.height = 10;
+ sep.width = useWidth;
+ sep.x = xpos;
+ sep.y = ypos + child.height;
+ COMPILE::JS {
+ sep.element.style['position'] = 'absolute';
+ }
+ j += 1;
+ }
+
+ ypos += child.height + 10;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/DividedBoxModel.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/DividedBoxModel.as
new file mode 100644
index 0000000..fdea1f9
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/DividedBoxModel.as
@@ -0,0 +1,120 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.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 DividedBoxModel holds the information necessary for the DividedBox
+ * to size and layout its children as well as to respond to changes in
+ * those sizes made by the DividedBoxDividers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class DividedBoxModel extends EventDispatcher implements IBeadModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function DividedBoxModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _direction:String = "vertical";
+
+ [Binding("directionChanged")]
+
+ /**
+ * The direction of the DividedBox. This can be "horizontal" (the
+ * children arranged in flexible columns) or "vertical" (the children
+ * arranged in flexible rows).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function get direction():String
+ {
+ return _direction;
+ }
+ public function set direction(value:String):void
+ {
+ _direction = value;
+ dispatchEvent(new Event("directionChanged"));
+ }
+
+ private var _pairAdjustments:Array = [0];
+
+ /**
+ * An array of integers indicating the size change for a pair
+ * of children in the DividedBox. There are the same number
+ * elements in this array as their are separators.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function get pairAdjustments():Array
+ {
+ return _pairAdjustments;
+ }
+ public function set pairAdjustments(value:Array):void
+ {
+ _pairAdjustments = value;
+ }
+
+ /**
+ * Modifies a specific pairAdjustment indicated by an index and
+ * by the amount given.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function addPairAdjustment(amount:Number, index:int):void
+ {
+ _pairAdjustments[index] += amount;
+ dispatchEvent(new Event("pairAdjustmentChanged"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DividedBoxDivider.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DividedBoxDivider.as
new file mode 100644
index 0000000..0a77da9
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DividedBoxDivider.as
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.supportClasses
+{
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.html.beads.SingleLineBorderBead;
+ import org.apache.royale.html.beads.models.DividedBoxModel;
+
+ COMPILE::SWF {
+ import org.apache.royale.html.beads.SolidBackgroundBead;
+ import org.apache.royale.utils.loadBeadFromValuesManager;
+ }
+
+ /**
+ * The DividedBoxSeparator is a control that lays between the children of
+ * a DividedBox. This is the base class for the HDividedBoxDivider and
+ * VDividedBoxDivider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class DividedBoxDivider extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function DividedBoxDivider()
+ {
+ super();
+ className = "DividedBoxDivider";
+
+ COMPILE::SWF {
+ loadBeadFromValuesManager(SolidBackgroundBead, "iBackgroundBead", this);
+ loadBeadFromValuesManager(SingleLineBorderBead, "iBorderBead", this);
+ }
+ }
+
+ /**
+ * The index of this divider instance, indicating which pair of children it
+ * is managing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public var pairIndex:int = 0;
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/HDividedBoxDivider.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/HDividedBoxDivider.as
new file mode 100644
index 0000000..8ec0a43
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/HDividedBoxDivider.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.supportClasses
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.utils.loadBeadFromValuesManager;
+
+ /**
+ * This sub-class of DividerBoxDivider sets up a vertical divider between
+ * the columns of an HDividedBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class HDividedBoxDivider extends DividedBoxDivider
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function HDividedBoxDivider()
+ {
+ super();
+ className = "HDividedBoxDivider";
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ loadBeadFromValuesManager(IDividedBoxGripper, "iGripperBead", this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/HDividedBoxGripper.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/HDividedBoxGripper.as
new file mode 100644
index 0000000..f2883f3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/HDividedBoxGripper.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.supportClasses
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.graphics.SolidColor;
+ import org.apache.royale.svg.Rect;
+
+ /**
+ * The HDividedBoxGripper is a bead added to the HDividedBoxDivider to
+ * provide a visual cue that the divider can be grabbed and moved.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class HDividedBoxGripper implements IBead, IDividedBoxGripper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function HDividedBoxGripper()
+ {
+ }
+
+ private var _strand:IStrand;
+ private var rect:Rect;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ *
+ * @royaleignorecoercion UIBase
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ COMPILE::JS {
+ (_strand as UIBase).element.style.cursor = 'col-resize';
+ }
+
+ (_strand as IEventDispatcher).addEventListener("widthChanged", handleResize);
+ (_strand as IEventDispatcher).addEventListener("heightChanged", handleResize);
+
+ rect = new Rect();
+ rect.fill = new SolidColor(0x555555);
+ (_strand as UIBase).addElement(rect);
+ }
+
+ /**
+ * @private
+ */
+ private function handleResize(event:Event):void
+ {
+ var useWidth:Number = (_strand as UIBase).width;
+ var useHeight:Number = (_strand as UIBase).height;
+
+ // for horizontal gripper, it is taller than it is wide
+ rect.width = useWidth - 2;
+ rect.height = rect.width * 4;
+
+ rect.x = 1;
+ rect.y = (useHeight - rect.height)/2;
+ rect.draw();
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/IDividedBoxGripper.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/IDividedBoxGripper.as
new file mode 100644
index 0000000..f298f66
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/IDividedBoxGripper.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 "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.html.supportClasses
+{
+ import org.apache.royale.core.IBead;
+
+ /**
+ * This interface defines a gripper bead control for a DividedBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public interface IDividedBoxGripper extends IBead
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/VDividedBoxDivider.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/VDividedBoxDivider.as
new file mode 100644
index 0000000..e4cd5d4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/VDividedBoxDivider.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.supportClasses
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.utils.loadBeadFromValuesManager;
+
+ /**
+ * This sub-class of DividedBoxDivider sets up a horizontal divider between
+ * the rows of a VDividedBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class VDividedBoxDivider extends DividedBoxDivider
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function VDividedBoxDivider()
+ {
+ super();
+ className = "VDividedBoxDivider";
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ loadBeadFromValuesManager(IDividedBoxGripper, "iGripperBead", this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/VDividedBoxGripper.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/VDividedBoxGripper.as
new file mode 100644
index 0000000..765817d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/VDividedBoxGripper.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.supportClasses
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.graphics.SolidColor;
+ import org.apache.royale.svg.Rect;
+
+ /**
+ * The VDividedBoxGripper bead adds a visual cue to the VDividedBoxDivider to
+ * indicate where to start dragging to change the size of the elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public class VDividedBoxGripper implements IBead, IDividedBoxGripper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function VDividedBoxGripper()
+ {
+ }
+
+ private var _strand:IStrand;
+ private var rect:Rect;
+
+ /**
+ * @copy org.apache.royale.core.IStrand#strand
+ *
+ * @royaleignorecoercion UIBase
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ COMPILE::JS {
+ (_strand as UIBase).element.style.cursor = 'row-resize';
+ }
+
+ (_strand as IEventDispatcher).addEventListener("widthChanged", handleResize);
+ (_strand as IEventDispatcher).addEventListener("heightChanged", handleResize);
+
+ rect = new Rect();
+ rect.fill = new SolidColor(0x555555);
+ (_strand as UIBase).addElement(rect);
+ }
+
+ /**
+ * @private
+ */
+ private function handleResize(event:Event):void
+ {
+ var useWidth:Number = (_strand as UIBase).width;
+ var useHeight:Number = (_strand as UIBase).height;
+
+ // for vertical gripper, it is wider than it is tall
+ rect.height = useHeight - 2;
+ rect.width = rect.height * 4;
+
+ rect.y = 1;
+ rect.x = (useWidth - rect.height)/2;
+ rect.draw();
+ }
+ }
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
pent@apache.org.