This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch feature/MXRoyale in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit a5d158af90ca0274ee624508a726b41e4d0da429 Author: Alex Harui <[email protected]> AuthorDate: Mon Mar 19 00:14:15 2018 -0700 more APIs --- .../src/main/resources/mx-royale-manifest.xml | 5 +- .../src/main/royale/mx/core/Application.as | 164 +++++++++++++++++++++ .../MXRoyale/src/main/royale/mx/core/Container.as | 70 ++++++++- .../MXRoyale/src/main/royale/mx/states/State.as | 101 +++++++++++++ 4 files changed, 338 insertions(+), 2 deletions(-) diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml index b2f5a87..c1219f1 100644 --- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml +++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml @@ -33,5 +33,8 @@ <component id="Box" class="mx.containers.Box" /> <component id="Container" class="mx.core.Container" /> <component id="HBox" class="mx.containers.HBox" /> - <component id="VBox" class="mx.containers.VBox" /> + <component id="VBox" class="mx.containers.VBox" /> + + <component id="State" class="mx.states.State" /> + </componentPackage> diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as index cee6363..5a1f366 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as @@ -19,6 +19,10 @@ package mx.core { +COMPILE::JS +{ + import goog.DEBUG; +} /* import flash.display.DisplayObject; @@ -48,7 +52,11 @@ import mx.utils.Platform; use namespace mx_internal; */ +import org.apache.royale.core.IStatesImpl; +import org.apache.royale.events.ValueChangeEvent; import org.apache.royale.express.Application; +import org.apache.royale.states.State; +import org.apache.royale.utils.loadBeadFromValuesManager; //-------------------------------------- // Events @@ -305,6 +313,162 @@ public class Application extends org.apache.royale.express.Application */ public var mxmlContent:Array; + /** + * Number of pixels between the container's top border + * and the top of its content area. + * + * @default 0 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get paddingTop():Object + { + if (GOOG::DEBUG) + trace("paddingTop not implemented"); + return 0; + } + public function set paddingTop(value:Object):void + { + if (GOOG::DEBUG) + trace("paddingTop not implemented"); + } + + /** + * Number of pixels between the container's bottom border + * and the bottom of its content area. + * + * @default 0 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get paddingBottom():Object + { + if (GOOG::DEBUG) + trace("paddingBottom not implemented"); + return 0; + } + public function set paddingBottom(value:Object):void + { + if (GOOG::DEBUG) + trace("paddingBottom not implemented"); + } + + /** + * Number of pixels between children in the vertical direction. + * The default value depends on the component class; + * if not overridden for the class, the default value is 6. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get verticalGap():Object + { + if (GOOG::DEBUG) + trace("verticalGap not implemented"); + return 0; + } + public function set verticalGap(value:Object):void + { + if (GOOG::DEBUG) + trace("verticalGap not implemented"); + } + + private var _states:Array; + + /** + * The array of view states. These should + * be instances of org.apache.royale.states.State. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + */ + public function get states():Array + { + return _states; + } + + /** + * @private + * @royaleignorecoercion Class + * @royaleignorecoercion org.apache.royale.core.IBead + */ + public function set states(value:Array):void + { + _states = value; + _currentState = _states[0].name; + + try{ + loadBeadFromValuesManager(IStatesImpl, "iStatesImpl", this); + } + //TODO: Need to handle this case more gracefully + catch(e:Error) + { + COMPILE::SWF + { + trace(e.message); + } + } + + } + + /** + * <code>true</code> if the array of states + * contains a state with this name. + * + * @param state The state namem. + * @return True if state in state array + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + */ + public function hasState(state:String):Boolean + { + for each (var s:State in _states) + { + if (s.name == state) + return true; + } + return false; + } + + private var _currentState:String; + + [Bindable("currentStateChange")] + /** + * The name of the current state. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + */ + public function get currentState():String + { + return _currentState; + } + + /** + * @private + */ + public function set currentState(value:String):void + { + var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value) + _currentState = value; + dispatchEvent(event); + } + } } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as index 3264c98..056d6e4 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as @@ -386,7 +386,75 @@ public class Container extends UIComponent typeNames = "Container"; } - /** + /** + * Number of pixels between the container's top border + * and the top of its content area. + * + * @default 0 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get paddingTop():Object + { + if (GOOG::DEBUG) + trace("paddingTop not implemented"); + return 0; + } + public function set paddingTop(value:Object):void + { + if (GOOG::DEBUG) + trace("paddingTop not implemented"); + } + + /** + * Number of pixels between the container's bottom border + * and the bottom of its content area. + * + * @default 0 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get paddingBottom():Object + { + if (GOOG::DEBUG) + trace("paddingBottom not implemented"); + return 0; + } + public function set paddingBottom(value:Object):void + { + if (GOOG::DEBUG) + trace("paddingBottom not implemented"); + } + + /** + * Number of pixels between children in the vertical direction. + * The default value depends on the component class; + * if not overridden for the class, the default value is 6. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get verticalGap():Object + { + if (GOOG::DEBUG) + trace("verticalGap not implemented"); + return 0; + } + public function set verticalGap(value:Object):void + { + if (GOOG::DEBUG) + trace("verticalGap not implemented"); + } + + /** * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement */ COMPILE::JS diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/states/State.as b/frameworks/projects/MXRoyale/src/main/royale/mx/states/State.as new file mode 100644 index 0000000..c7033f8 --- /dev/null +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/states/State.as @@ -0,0 +1,101 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// + +package mx.states +{ + +import org.apache.royale.states.State; + +/** + * The State class defines a view state, a particular view of a component. + * For example, a product thumbnail could have two view states; + * a base view state with minimal information, and a rich view state with + * additional information. + * The <code>overrides</code> property specifies a set of child classes + * to add or remove from the base view state, and properties, styles, and event + * handlers to set when the view state is in effect. + * + * <p>You use the State class in the <code>states</code> property + * of Flex components. + * You can only specify a <code>states</code> property at the root of an + * application or a custom control, not on child controls.</p> + * + * <p>You enable a view state by setting a component's + * <code>currentState</code> property.</p> + * + * @mxml + * <p>The <code><mx:State></code> tag has the following attributes:</p> + * + * <pre> + * <mx:State + * <b>Properties</b> + * basedOn="null" + * name="null" + * overrides="null" + * /> + * </pre> + * + * @see mx.states.AddChild + * @see mx.states.RemoveChild + * @see mx.states.SetEventHandler + * @see mx.states.SetProperty + * @see mx.states.SetStyle + * @see mx.states.Transition + * + * @includeExample examples/StatesExample.mxml + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +public class State extends org.apache.royale.states.State +{ + + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * Constructor. + * + * @param type The event type; indicates the action that caused the event. + * + * @param bubbles Specifies whether the event can bubble up + * the display list hierarchy. + * + * @param cancelable Specifies whether the behavior + * associated with the event can be prevented. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function State(properties:Object = null) + { + super(properties); + } + +} + +} -- To stop receiving notification emails like this one, please contact [email protected].
