Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.app.screen
- {
- import com.app.utils.ComponentSerializer;
- import com.fake.utils.DescribeUtil;
- import mx.containers.Canvas;
- import mx.events.FlexEvent;
- import mx.validators.*;
- [Bindable]
- public class ScreenComponentCtrl extends Canvas
- {
- /**
- * Label of the ScreenComponent to move to when the next button is clicked.
- */
- public var nextScreen:String;
- /**
- * Label of the ScreenComponent to move to when the summary button is clicked.
- */
- public var summaryScreen:String;
- /**
- * Indicates whether or not an action has taken place to make this visible in the summary
- */
- public var active:Boolean;
- public function ScreenComponentCtrl()
- {
- super();
- addEventListener(FlexEvent.CREATION_COMPLETE, init);
- }
- /**
- * Event handler for CREATION_COMPLETE.
- * Abstract function.
- */
- public function init(event:FlexEvent):void { }
- /**
- * Called after the current label property of the ScreenContainer
- * has changed. This Screen is the current screen at this point.
- * Abstract function.
- */
- public function onScreenEnter(isNext:Boolean = true):void { }
- /**
- * Called after the next or summary button has been clicked and before the current
- * screen changes. The container uses the nextScreen or summaryScreen to change screens.
- * If the boolean returned is false the next action will be canceled
- * Abstract function.
- */
- /* public function onNextClick():Boolean { return true; } */
- public function onNextClick():void {}
- /**
- * Called after the back button has been clicked and before the current
- * screen changes. The container calls an undo on the currentScreenLabel property.
- * Abstract function.
- */
- public function onBackClick():void { }
- /**
- * Clears all values and selections from the UIComponents. It also clears the
- * related values in the data store.
- * Abstract function.
- */
- public function onClear():void { }
- /**
- * Applies all values from the data store to the UIComponents.
- */
- public function deserialize():void
- {
- ScreenContainerCtrl.instance.load();
- var node:XMLList = dataStore.child(DescribeUtil.localName(this));
- if(node)
- ComponentSerializer.instance.deserialize(this, ScreenContainerCtrl.instance.dataStore.child(DescribeUtil.localName(this)));
- }
- /**
- * Converts all of the values from inputs into XML.
- */
- public function serialize():void
- {
- var node:XML = ComponentSerializer.instance.serialize(this);
- var child:XMLList = ScreenContainerCtrl.instance.dataStore.child(node.localName());
- if(child.length() > 0)
- {
- ScreenContainerCtrl.instance.dataStore.replace(node.localName(), node);
- }
- else
- {
- ScreenContainerCtrl.instance.dataStore.appendChild(node);
- }
- ScreenContainerCtrl.instance.save();
- }
- public function validate():String { return "" }
- public function get dataStore():XML {
- return ScreenContainerCtrl.instance.dataStore;
- }
- public function get co2PerYear():Number { return 0 }
- }
- }
Add Comment
Please, Sign In to add comment