blob: 0d0fc69d4f0ef3d81a64ed85319dd73c96465e55 [file] [log] [blame]
<?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.
-->
<mx:Application backgroundColor="0xFFFFFF" xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()" historyManagementEnabled="false">
<mx:Script>
<![CDATA[
import flash.utils.describeType;
import flash.utils.getDefinitionByName;
import mx.events.BrowserChangeEvent;
import mx.managers.IBrowserManager;
import mx.managers.BrowserManager;
import mx.controls.Alert;
public var browserManager:IBrowserManager;
private function initApp():void
{
browserManager = BrowserManager.getInstance();
browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseURL);
browserManager.init("", "Shipping");
}
private var parsing:Boolean = false;
private function parseURL(event:Event):void
{
parsing = true;
var idx:int = 0;
var arr:Array = browserManager.fragment.split(';');
if (arr[idx].indexOf("view=") > -1)
{
tn.selectedIndex = parseInt(arr[0].substring(5));
idx = 1;
browserManager.setTitle((tn.selectedIndex == 0) ? "Shipping" : "Receiving");
}
else
{
tn.selectedIndex = 0;
browserManager.setTitle("Shipping");
}
tn.validateNow();
var details:Boolean = false;
if (idx < arr.length && arr[idx].indexOf("details=") > -1)
{
var value:String = arr[idx].substring(8);
details = (value == "true");
}
if (tn.selectedIndex == 0)
shipDetails.selected = details;
else
recvDetails.selected = details;
parsing = false;
trace("<<parseurl");
}
private function updateURL():void
{
if (!parsing)
callLater(actuallyUpdateURL);
}
private function actuallyUpdateURL():void
{
trace(">>updateurl");
var s:String = "";
var t:String = "";
if (tn.selectedIndex == 1)
{
t = "Receiving";
s += "view=" + tn.selectedIndex.toString() + ';'
if (recvDetails.selected)
s += "details=true";
}
else
{
t = "Shipping";
//ADR: set the correct state for the url
s += "view=" + tn.selectedIndex.toString() + ';'
if (shipDetails.selected)
s += "details=true";
}
trace("actuallyUpdateURL: " + s + "|");
browserManager.setFragment(s);
browserManager.setTitle(t);
trace("<<updateurl", s, t);
}
]]>
</mx:Script>
<mx:TabNavigator id="tn" change="updateURL()" width="300" >
<mx:Panel label="Shipping">
<mx:CheckBox id="shipDetails" label="Show Details" change="updateURL()" />
</mx:Panel>
<mx:Panel label="Receiving">
<mx:CheckBox id="recvDetails" label="Show Details" change="updateURL()" />
</mx:Panel>
</mx:TabNavigator>
</mx:Application>