| <?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. |
| |
| --> |
| <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| minWidth="955" minHeight="850" |
| creationComplete="employeeService.send()" |
| xmlns:components="components.*"> |
| |
| <!-- Exercise 3.06: Validating form data --> |
| |
| <!-- Styles ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> |
| |
| <fx:Style source="Styles.css"/> |
| |
| <!-- Script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> |
| |
| <fx:Script> |
| <![CDATA[ |
| import events.VehicleRequestEvent; |
| |
| import mx.collections.ArrayCollection; |
| import mx.controls.Alert; |
| import mx.rpc.events.FaultEvent; |
| import mx.rpc.events.ResultEvent; |
| |
| import valueObjects.Employee; |
| |
| // variable declarations ------------------------------------ |
| |
| [Bindable] |
| private var employees:ArrayCollection = new ArrayCollection(); |
| |
| // getter/setters ------------------------------------------- |
| |
| |
| // helper methods ------------------------------------------- |
| |
| |
| // event handlers ------------------------------------------- |
| |
| protected function employeeService_resultHandler(event:ResultEvent):void
|
| {
|
| employees = event.result.employees.employee;
|
| } |
| |
| protected function employeeService_faultHandler(event:FaultEvent):void
|
| {
|
| Alert.show(event.fault.faultString,"Fault Information");
|
| } |
| |
| protected function vehiclerequestform1_vehicleRequestEventHandler(event:VehicleRequestEvent):void
|
| {
|
| Alert.show("Your vehicle request has been submitted.");
|
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <!-- Declarations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> |
| |
| <fx:Declarations> |
| |
| <s:HTTPService id="employeeService" |
| url="http://www.adobetes.com/f45iaw100/remoteData/employees.xml" |
| result="employeeService_resultHandler(event)" |
| fault="employeeService_faultHandler(event)"/> |
| |
| </fx:Declarations> |
| |
| <!-- UI components ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> |
| |
| <s:Label x="10" y="34" |
| width="690" height="40" |
| text="Employee Portal: Vehicle Request Form" |
| styleName="titleHeader"/> |
| |
| <components:VehicleRequestForm employees="{employees}" |
| vehicleRequestEvent="vehiclerequestform1_vehicleRequestEventHandler(event)"/> |
| |
| </s:Application> |