First pass of porting the MDI library to Flex 4

This commit is contained in:
Chad Pilkey 2015-05-09 12:58:01 -04:00
parent 6614ce81c8
commit 04c1a90171
60 changed files with 5592 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="Main.mxml" projectUUID="a188d9d3-787a-4557-9232-919fb0cf73d3" version="10">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" flex3CompatMode="false" flexSDK="Apache Flex 4.13.0" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/>
<libraryPathEntry applicationDomain="default" forceLoad="false" index="9" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="advancedgrids_4.13.0.20140701.swf"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry applicationDomain="default" forceLoad="false" index="8" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="mx_4.13.0.20140701.swf"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/core.swc" useDefaultLinkType="false"/>
<libraryPathEntry applicationDomain="default" forceLoad="false" index="7" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="spark_dmv_4.13.0.20140701.swf"/>
</crossDomainRsls>
</libraryPathEntry>
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="1" linkType="1" path="libs"/>
<libraryPathEntry kind="3" linkType="1" path="/bbb-flex-library/bin/bbb-flex-library.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="Main.mxml"/>
</applications>
<modules/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
</actionScriptProperties>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="2"/>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>web-client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.flexnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
#Thu May 07 18:54:38 EDT 2015
eclipse.preferences.version=1
encoding/<project>=utf-8

View File

@ -0,0 +1,124 @@
<!--
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.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Apache Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops and mobile phones via Adobe AIR.
Learn more about Flex at http://flex.apache.org
// -->
<head>
<title></title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #ffffff; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!-- END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.2.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "Main";
attributes.name = "Main";
attributes.align = "middle";
swfobject.embedSWF(
"Main.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
11.2.0 or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="Main">
<param name="movie" value="Main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="Main.swf" width="100%" height="100%">
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
11.2.0 or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,24 @@
/*
*
* 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.
*
*/
/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
#ie_historyFrame { width: 0px; height: 0px; display:none }
#firefox_anchorDiv { width: 0px; height: 0px; display:none }
#safari_formDiv { width: 0px; height: 0px; display:none }
#safari_rememberDiv { width: 0px; height: 0px; display:none }

View File

@ -0,0 +1,696 @@
/*
*
* 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.
*
*/
BrowserHistoryUtils = {
addEvent: function(elm, evType, fn, useCapture) {
useCapture = useCapture || false;
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}
}
BrowserHistory = (function() {
// type of browser
var browser = {
ie: false,
ie8: false,
firefox: false,
safari: false,
opera: false,
version: -1
};
// Default app state URL to use when no fragment ID present
var defaultHash = '';
// Last-known app state URL
var currentHref = document.location.href;
// Initial URL (used only by IE)
var initialHref = document.location.href;
// Initial URL (used only by IE)
var initialHash = document.location.hash;
// History frame source URL prefix (used only by IE)
var historyFrameSourcePrefix = 'history/historyFrame.html?';
// History maintenance (used only by Safari)
var currentHistoryLength = -1;
// Flag to denote the existence of onhashchange
var browserHasHashChange = false;
var historyHash = [];
var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
var backStack = [];
var forwardStack = [];
var currentObjectId = null;
//UserAgent detection
var useragent = navigator.userAgent.toLowerCase();
if (useragent.indexOf("opera") != -1) {
browser.opera = true;
} else if (useragent.indexOf("msie") != -1) {
browser.ie = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
if (browser.version == 8)
{
browser.ie = false;
browser.ie8 = true;
}
} else if (useragent.indexOf("safari") != -1) {
browser.safari = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
} else if (useragent.indexOf("gecko") != -1) {
browser.firefox = true;
}
if (browser.ie == true && browser.version == 7) {
window["_ie_firstload"] = false;
}
function hashChangeHandler()
{
currentHref = document.location.href;
var flexAppUrl = getHash();
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
}
// Accessor functions for obtaining specific elements of the page.
function getHistoryFrame()
{
return document.getElementById('ie_historyFrame');
}
function getFormElement()
{
return document.getElementById('safari_formDiv');
}
function getRememberElement()
{
return document.getElementById("safari_remember_field");
}
// Get the Flash player object for performing ExternalInterface callbacks.
// Updated for changes to SWFObject2.
function getPlayer(id) {
var i;
if (id && document.getElementById(id)) {
var r = document.getElementById(id);
if (typeof r.SetVariable != "undefined") {
return r;
}
else {
var o = r.getElementsByTagName("object");
var e = r.getElementsByTagName("embed");
for (i = 0; i < o.length; i++) {
if (typeof o[i].browserURLChange != "undefined")
return o[i];
}
for (i = 0; i < e.length; i++) {
if (typeof e[i].browserURLChange != "undefined")
return e[i];
}
}
}
else {
var o = document.getElementsByTagName("object");
var e = document.getElementsByTagName("embed");
for (i = 0; i < e.length; i++) {
if (typeof e[i].browserURLChange != "undefined")
{
return e[i];
}
}
for (i = 0; i < o.length; i++) {
if (typeof o[i].browserURLChange != "undefined")
{
return o[i];
}
}
}
return undefined;
}
function getPlayers() {
var i;
var players = [];
if (players.length == 0) {
var tmp = document.getElementsByTagName('object');
for (i = 0; i < tmp.length; i++)
{
if (typeof tmp[i].browserURLChange != "undefined")
players.push(tmp[i]);
}
}
if (players.length == 0 || players[0].object == null) {
var tmp = document.getElementsByTagName('embed');
for (i = 0; i < tmp.length; i++)
{
if (typeof tmp[i].browserURLChange != "undefined")
players.push(tmp[i]);
}
}
return players;
}
function getIframeHash() {
var doc = getHistoryFrame().contentWindow.document;
var hash = String(doc.location.search);
if (hash.length == 1 && hash.charAt(0) == "?") {
hash = "";
}
else if (hash.length >= 2 && hash.charAt(0) == "?") {
hash = hash.substring(1);
}
return hash;
}
/* Get the current location hash excluding the '#' symbol. */
function getHash() {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
var idx = document.location.href.indexOf('#');
return (idx >= 0) ? document.location.href.substr(idx+1) : '';
}
/* Get the current location hash excluding the '#' symbol. */
function setHash(hash) {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
if (hash == '') hash = '#'
document.location.hash = hash;
}
function createState(baseUrl, newUrl, flexAppUrl) {
return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
}
/* Add a history entry to the browser.
* baseUrl: the portion of the location prior to the '#'
* newUrl: the entire new URL, including '#' and following fragment
* flexAppUrl: the portion of the location following the '#' only
*/
function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
//delete all the history entries
forwardStack = [];
if (browser.ie) {
//Check to see if we are being asked to do a navigate for the first
//history entry, and if so ignore, because it's coming from the creation
//of the history iframe
if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
currentHref = initialHref;
return;
}
if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
newUrl = baseUrl + '#' + defaultHash;
flexAppUrl = defaultHash;
} else {
// for IE, tell the history frame to go somewhere without a '#'
// in order to get this entry into the browser history.
getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
}
setHash(flexAppUrl);
} else {
//ADR
if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
initialState = createState(baseUrl, newUrl, flexAppUrl);
} else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
}
if (browser.safari && !browserHasHashChange) {
// for Safari, submit a form whose action points to the desired URL
if (browser.version <= 419.3) {
var file = window.location.pathname.toString();
file = file.substring(file.lastIndexOf("/")+1);
getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
//get the current elements and add them to the form
var qs = window.location.search.substring(1);
var qs_arr = qs.split("&");
for (var i = 0; i < qs_arr.length; i++) {
var tmp = qs_arr[i].split("=");
var elem = document.createElement("input");
elem.type = "hidden";
elem.name = tmp[0];
elem.value = tmp[1];
document.forms.historyForm.appendChild(elem);
}
document.forms.historyForm.submit();
} else {
top.location.hash = flexAppUrl;
}
// We also have to maintain the history by hand for Safari
historyHash[history.length] = flexAppUrl;
_storeStates();
} else {
// Otherwise, just tell the browser to go there
setHash(flexAppUrl);
}
}
backStack.push(createState(baseUrl, newUrl, flexAppUrl));
}
function _storeStates() {
if (browser.safari) {
getRememberElement().value = historyHash.join(",");
}
}
function handleBackButton() {
//The "current" page is always at the top of the history stack.
var current = backStack.pop();
if (!current) { return; }
var last = backStack[backStack.length - 1];
if (!last && backStack.length == 0){
last = initialState;
}
forwardStack.push(current);
}
function handleForwardButton() {
//summary: private method. Do not call this directly.
var last = forwardStack.pop();
if (!last) { return; }
backStack.push(last);
}
function handleArbitraryUrl() {
//delete all the history entries
forwardStack = [];
}
/* Called periodically to poll to see if we need to detect navigation that has occurred */
function checkForUrlChange() {
if (browser.ie) {
if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
//This occurs when the user has navigated to a specific URL
//within the app, and didn't use browser back/forward
//IE seems to have a bug where it stops updating the URL it
//shows the end-user at this point, but programatically it
//appears to be correct. Do a full app reload to get around
//this issue.
if (browser.version < 7) {
currentHref = document.location.href;
document.location.reload();
} else {
if (getHash() != getIframeHash()) {
// this.iframe.src = this.blankURL + hash;
var sourceToSet = historyFrameSourcePrefix + getHash();
getHistoryFrame().src = sourceToSet;
currentHref = document.location.href;
}
}
}
}
if (browser.safari && !browserHasHashChange) {
// For Safari, we have to check to see if history.length changed.
if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
//alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
var flexAppUrl = getHash();
if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
{
// If it did change and we're running Safari 3.x or earlier,
// then we have to look the old state up in our hand-maintained
// array since document.location.hash won't have changed,
// then call back into BrowserManager.
currentHistoryLength = history.length;
flexAppUrl = historyHash[currentHistoryLength];
}
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
_storeStates();
}
}
if (browser.firefox && !browserHasHashChange) {
if (currentHref != document.location.href) {
var bsl = backStack.length;
var urlActions = {
back: false,
forward: false,
set: false
}
if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
urlActions.back = true;
// FIXME: could this ever be a forward button?
// we can't clear it because we still need to check for forwards. Ugg.
// clearInterval(this.locationTimer);
handleBackButton();
}
// first check to see if we could have gone forward. We always halt on
// a no-hash item.
if (forwardStack.length > 0) {
if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
urlActions.forward = true;
handleForwardButton();
}
}
// ok, that didn't work, try someplace back in the history stack
if ((bsl >= 2) && (backStack[bsl - 2])) {
if (backStack[bsl - 2].flexAppUrl == getHash()) {
urlActions.back = true;
handleBackButton();
}
}
if (!urlActions.back && !urlActions.forward) {
var foundInStacks = {
back: -1,
forward: -1
}
for (var i = 0; i < backStack.length; i++) {
if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.back = i;
}
}
for (var i = 0; i < forwardStack.length; i++) {
if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.forward = i;
}
}
handleArbitraryUrl();
}
// Firefox changed; do a callback into BrowserManager to tell it.
currentHref = document.location.href;
var flexAppUrl = getHash();
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
}
}
}
var _initialize = function () {
browserHasHashChange = ("onhashchange" in document.body);
if (browser.ie)
{
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
}
}
historyFrameSourcePrefix = iframe_location + "?";
var src = historyFrameSourcePrefix;
var iframe = document.createElement("iframe");
iframe.id = 'ie_historyFrame';
iframe.name = 'ie_historyFrame';
iframe.src = 'javascript:false;';
try {
document.body.appendChild(iframe);
} catch(e) {
setTimeout(function() {
document.body.appendChild(iframe);
}, 0);
}
}
if (browser.safari && !browserHasHashChange)
{
var rememberDiv = document.createElement("div");
rememberDiv.id = 'safari_rememberDiv';
document.body.appendChild(rememberDiv);
rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
var formDiv = document.createElement("div");
formDiv.id = 'safari_formDiv';
document.body.appendChild(formDiv);
var reloader_content = document.createElement('div');
reloader_content.id = 'safarireloader';
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
html = (new String(s.src)).replace(".js", ".html");
}
}
reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
document.body.appendChild(reloader_content);
reloader_content.style.position = 'absolute';
reloader_content.style.left = reloader_content.style.top = '-9999px';
iframe = reloader_content.getElementsByTagName('iframe')[0];
if (document.getElementById("safari_remember_field").value != "" ) {
historyHash = document.getElementById("safari_remember_field").value.split(",");
}
}
if (browserHasHashChange)
document.body.onhashchange = hashChangeHandler;
}
return {
historyHash: historyHash,
backStack: function() { return backStack; },
forwardStack: function() { return forwardStack },
getPlayer: getPlayer,
initialize: function(src) {
_initialize(src);
},
setURL: function(url) {
document.location.href = url;
},
getURL: function() {
return document.location.href;
},
getTitle: function() {
return document.title;
},
setTitle: function(title) {
try {
backStack[backStack.length - 1].title = title;
} catch(e) { }
//if on safari, set the title to be the empty string.
if (browser.safari) {
if (title == "") {
try {
var tmp = window.location.href.toString();
title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
} catch(e) {
title = "";
}
}
}
document.title = title;
},
setDefaultURL: function(def)
{
defaultHash = def;
def = getHash();
//trailing ? is important else an extra frame gets added to the history
//when navigating back to the first page. Alternatively could check
//in history frame navigation to compare # and ?.
if (browser.ie)
{
window['_ie_firstload'] = true;
var sourceToSet = historyFrameSourcePrefix + def;
var func = function() {
getHistoryFrame().src = sourceToSet;
window.location.replace("#" + def);
setInterval(checkForUrlChange, 50);
}
try {
func();
} catch(e) {
window.setTimeout(function() { func(); }, 0);
}
}
if (browser.safari)
{
currentHistoryLength = history.length;
if (historyHash.length == 0) {
historyHash[currentHistoryLength] = def;
var newloc = "#" + def;
window.location.replace(newloc);
} else {
//alert(historyHash[historyHash.length-1]);
}
setInterval(checkForUrlChange, 50);
}
if (browser.firefox || browser.opera)
{
var reg = new RegExp("#" + def + "$");
if (window.location.toString().match(reg)) {
} else {
var newloc ="#" + def;
window.location.replace(newloc);
}
setInterval(checkForUrlChange, 50);
}
},
/* Set the current browser URL; called from inside BrowserManager to propagate
* the application state out to the container.
*/
setBrowserURL: function(flexAppUrl, objectId) {
if (browser.ie && typeof objectId != "undefined") {
currentObjectId = objectId;
}
//fromIframe = fromIframe || false;
//fromFlex = fromFlex || false;
//alert("setBrowserURL: " + flexAppUrl);
//flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
var pos = document.location.href.indexOf('#');
var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
var newUrl = baseUrl + '#' + flexAppUrl;
if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
currentHref = newUrl;
addHistoryEntry(baseUrl, newUrl, flexAppUrl);
currentHistoryLength = history.length;
}
},
browserURLChange: function(flexAppUrl) {
var objectId = null;
if (browser.ie && currentObjectId != null) {
objectId = currentObjectId;
}
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
try {
pl[i].browserURLChange(flexAppUrl);
} catch(e) { }
}
} else {
try {
getPlayer(objectId).browserURLChange(flexAppUrl);
} catch(e) { }
}
currentObjectId = null;
},
getUserAgent: function() {
return navigator.userAgent;
},
getPlatform: function() {
return navigator.platform;
}
}
})();
// Initialization
// Automated unit testing and other diagnostics
function setURL(url)
{
document.location.href = url;
}
function backButton()
{
history.back();
}
function forwardButton()
{
history.forward();
}
function goForwardOrBackInHistory(step)
{
history.go(step);
}
//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
(function(i) {
var u =navigator.userAgent;var e=/*@cc_on!@*/false;
var st = setTimeout;
if(/webkit/i.test(u)){
st(function(){
var dr=document.readyState;
if(dr=="loaded"||dr=="complete"){i()}
else{st(arguments.callee,10);}},10);
} else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
document.addEventListener("DOMContentLoaded",i,false);
} else if(e){
(function(){
var t=document.createElement('doc:rdy');
try{t.doScroll('left');
i();t=null;
}catch(e){st(arguments.callee,0);}})();
} else{
window.onload=i;
}
})( function() {BrowserHistory.initialize();} );

View File

@ -0,0 +1,45 @@
<!--
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.
-->
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<script>
function processUrl()
{
var pos = url.indexOf("?");
url = pos != -1 ? url.substr(pos + 1) : "";
if (!parent._ie_firstload) {
parent.BrowserHistory.setBrowserURL(url);
try {
parent.BrowserHistory.browserURLChange(url);
} catch(e) { }
} else {
parent._ie_firstload = false;
}
}
var url = document.location.href;
processUrl();
document.write(encodeURIComponent(url));
</script>
Hidden frame for Browser History support.
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,24 @@
/*
*
* 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.
*
*/
/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
#ie_historyFrame { width: 0px; height: 0px; display:none }
#firefox_anchorDiv { width: 0px; height: 0px; display:none }
#safari_formDiv { width: 0px; height: 0px; display:none }
#safari_rememberDiv { width: 0px; height: 0px; display:none }

View File

@ -0,0 +1,696 @@
/*
*
* 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.
*
*/
BrowserHistoryUtils = {
addEvent: function(elm, evType, fn, useCapture) {
useCapture = useCapture || false;
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}
}
BrowserHistory = (function() {
// type of browser
var browser = {
ie: false,
ie8: false,
firefox: false,
safari: false,
opera: false,
version: -1
};
// Default app state URL to use when no fragment ID present
var defaultHash = '';
// Last-known app state URL
var currentHref = document.location.href;
// Initial URL (used only by IE)
var initialHref = document.location.href;
// Initial URL (used only by IE)
var initialHash = document.location.hash;
// History frame source URL prefix (used only by IE)
var historyFrameSourcePrefix = 'history/historyFrame.html?';
// History maintenance (used only by Safari)
var currentHistoryLength = -1;
// Flag to denote the existence of onhashchange
var browserHasHashChange = false;
var historyHash = [];
var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
var backStack = [];
var forwardStack = [];
var currentObjectId = null;
//UserAgent detection
var useragent = navigator.userAgent.toLowerCase();
if (useragent.indexOf("opera") != -1) {
browser.opera = true;
} else if (useragent.indexOf("msie") != -1) {
browser.ie = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
if (browser.version == 8)
{
browser.ie = false;
browser.ie8 = true;
}
} else if (useragent.indexOf("safari") != -1) {
browser.safari = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
} else if (useragent.indexOf("gecko") != -1) {
browser.firefox = true;
}
if (browser.ie == true && browser.version == 7) {
window["_ie_firstload"] = false;
}
function hashChangeHandler()
{
currentHref = document.location.href;
var flexAppUrl = getHash();
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
}
// Accessor functions for obtaining specific elements of the page.
function getHistoryFrame()
{
return document.getElementById('ie_historyFrame');
}
function getFormElement()
{
return document.getElementById('safari_formDiv');
}
function getRememberElement()
{
return document.getElementById("safari_remember_field");
}
// Get the Flash player object for performing ExternalInterface callbacks.
// Updated for changes to SWFObject2.
function getPlayer(id) {
var i;
if (id && document.getElementById(id)) {
var r = document.getElementById(id);
if (typeof r.SetVariable != "undefined") {
return r;
}
else {
var o = r.getElementsByTagName("object");
var e = r.getElementsByTagName("embed");
for (i = 0; i < o.length; i++) {
if (typeof o[i].browserURLChange != "undefined")
return o[i];
}
for (i = 0; i < e.length; i++) {
if (typeof e[i].browserURLChange != "undefined")
return e[i];
}
}
}
else {
var o = document.getElementsByTagName("object");
var e = document.getElementsByTagName("embed");
for (i = 0; i < e.length; i++) {
if (typeof e[i].browserURLChange != "undefined")
{
return e[i];
}
}
for (i = 0; i < o.length; i++) {
if (typeof o[i].browserURLChange != "undefined")
{
return o[i];
}
}
}
return undefined;
}
function getPlayers() {
var i;
var players = [];
if (players.length == 0) {
var tmp = document.getElementsByTagName('object');
for (i = 0; i < tmp.length; i++)
{
if (typeof tmp[i].browserURLChange != "undefined")
players.push(tmp[i]);
}
}
if (players.length == 0 || players[0].object == null) {
var tmp = document.getElementsByTagName('embed');
for (i = 0; i < tmp.length; i++)
{
if (typeof tmp[i].browserURLChange != "undefined")
players.push(tmp[i]);
}
}
return players;
}
function getIframeHash() {
var doc = getHistoryFrame().contentWindow.document;
var hash = String(doc.location.search);
if (hash.length == 1 && hash.charAt(0) == "?") {
hash = "";
}
else if (hash.length >= 2 && hash.charAt(0) == "?") {
hash = hash.substring(1);
}
return hash;
}
/* Get the current location hash excluding the '#' symbol. */
function getHash() {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
var idx = document.location.href.indexOf('#');
return (idx >= 0) ? document.location.href.substr(idx+1) : '';
}
/* Get the current location hash excluding the '#' symbol. */
function setHash(hash) {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
if (hash == '') hash = '#'
document.location.hash = hash;
}
function createState(baseUrl, newUrl, flexAppUrl) {
return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
}
/* Add a history entry to the browser.
* baseUrl: the portion of the location prior to the '#'
* newUrl: the entire new URL, including '#' and following fragment
* flexAppUrl: the portion of the location following the '#' only
*/
function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
//delete all the history entries
forwardStack = [];
if (browser.ie) {
//Check to see if we are being asked to do a navigate for the first
//history entry, and if so ignore, because it's coming from the creation
//of the history iframe
if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
currentHref = initialHref;
return;
}
if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
newUrl = baseUrl + '#' + defaultHash;
flexAppUrl = defaultHash;
} else {
// for IE, tell the history frame to go somewhere without a '#'
// in order to get this entry into the browser history.
getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
}
setHash(flexAppUrl);
} else {
//ADR
if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
initialState = createState(baseUrl, newUrl, flexAppUrl);
} else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
}
if (browser.safari && !browserHasHashChange) {
// for Safari, submit a form whose action points to the desired URL
if (browser.version <= 419.3) {
var file = window.location.pathname.toString();
file = file.substring(file.lastIndexOf("/")+1);
getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
//get the current elements and add them to the form
var qs = window.location.search.substring(1);
var qs_arr = qs.split("&");
for (var i = 0; i < qs_arr.length; i++) {
var tmp = qs_arr[i].split("=");
var elem = document.createElement("input");
elem.type = "hidden";
elem.name = tmp[0];
elem.value = tmp[1];
document.forms.historyForm.appendChild(elem);
}
document.forms.historyForm.submit();
} else {
top.location.hash = flexAppUrl;
}
// We also have to maintain the history by hand for Safari
historyHash[history.length] = flexAppUrl;
_storeStates();
} else {
// Otherwise, just tell the browser to go there
setHash(flexAppUrl);
}
}
backStack.push(createState(baseUrl, newUrl, flexAppUrl));
}
function _storeStates() {
if (browser.safari) {
getRememberElement().value = historyHash.join(",");
}
}
function handleBackButton() {
//The "current" page is always at the top of the history stack.
var current = backStack.pop();
if (!current) { return; }
var last = backStack[backStack.length - 1];
if (!last && backStack.length == 0){
last = initialState;
}
forwardStack.push(current);
}
function handleForwardButton() {
//summary: private method. Do not call this directly.
var last = forwardStack.pop();
if (!last) { return; }
backStack.push(last);
}
function handleArbitraryUrl() {
//delete all the history entries
forwardStack = [];
}
/* Called periodically to poll to see if we need to detect navigation that has occurred */
function checkForUrlChange() {
if (browser.ie) {
if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
//This occurs when the user has navigated to a specific URL
//within the app, and didn't use browser back/forward
//IE seems to have a bug where it stops updating the URL it
//shows the end-user at this point, but programatically it
//appears to be correct. Do a full app reload to get around
//this issue.
if (browser.version < 7) {
currentHref = document.location.href;
document.location.reload();
} else {
if (getHash() != getIframeHash()) {
// this.iframe.src = this.blankURL + hash;
var sourceToSet = historyFrameSourcePrefix + getHash();
getHistoryFrame().src = sourceToSet;
currentHref = document.location.href;
}
}
}
}
if (browser.safari && !browserHasHashChange) {
// For Safari, we have to check to see if history.length changed.
if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
//alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
var flexAppUrl = getHash();
if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
{
// If it did change and we're running Safari 3.x or earlier,
// then we have to look the old state up in our hand-maintained
// array since document.location.hash won't have changed,
// then call back into BrowserManager.
currentHistoryLength = history.length;
flexAppUrl = historyHash[currentHistoryLength];
}
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
_storeStates();
}
}
if (browser.firefox && !browserHasHashChange) {
if (currentHref != document.location.href) {
var bsl = backStack.length;
var urlActions = {
back: false,
forward: false,
set: false
}
if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
urlActions.back = true;
// FIXME: could this ever be a forward button?
// we can't clear it because we still need to check for forwards. Ugg.
// clearInterval(this.locationTimer);
handleBackButton();
}
// first check to see if we could have gone forward. We always halt on
// a no-hash item.
if (forwardStack.length > 0) {
if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
urlActions.forward = true;
handleForwardButton();
}
}
// ok, that didn't work, try someplace back in the history stack
if ((bsl >= 2) && (backStack[bsl - 2])) {
if (backStack[bsl - 2].flexAppUrl == getHash()) {
urlActions.back = true;
handleBackButton();
}
}
if (!urlActions.back && !urlActions.forward) {
var foundInStacks = {
back: -1,
forward: -1
}
for (var i = 0; i < backStack.length; i++) {
if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.back = i;
}
}
for (var i = 0; i < forwardStack.length; i++) {
if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.forward = i;
}
}
handleArbitraryUrl();
}
// Firefox changed; do a callback into BrowserManager to tell it.
currentHref = document.location.href;
var flexAppUrl = getHash();
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
}
}
}
var _initialize = function () {
browserHasHashChange = ("onhashchange" in document.body);
if (browser.ie)
{
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
}
}
historyFrameSourcePrefix = iframe_location + "?";
var src = historyFrameSourcePrefix;
var iframe = document.createElement("iframe");
iframe.id = 'ie_historyFrame';
iframe.name = 'ie_historyFrame';
iframe.src = 'javascript:false;';
try {
document.body.appendChild(iframe);
} catch(e) {
setTimeout(function() {
document.body.appendChild(iframe);
}, 0);
}
}
if (browser.safari && !browserHasHashChange)
{
var rememberDiv = document.createElement("div");
rememberDiv.id = 'safari_rememberDiv';
document.body.appendChild(rememberDiv);
rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
var formDiv = document.createElement("div");
formDiv.id = 'safari_formDiv';
document.body.appendChild(formDiv);
var reloader_content = document.createElement('div');
reloader_content.id = 'safarireloader';
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
html = (new String(s.src)).replace(".js", ".html");
}
}
reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
document.body.appendChild(reloader_content);
reloader_content.style.position = 'absolute';
reloader_content.style.left = reloader_content.style.top = '-9999px';
iframe = reloader_content.getElementsByTagName('iframe')[0];
if (document.getElementById("safari_remember_field").value != "" ) {
historyHash = document.getElementById("safari_remember_field").value.split(",");
}
}
if (browserHasHashChange)
document.body.onhashchange = hashChangeHandler;
}
return {
historyHash: historyHash,
backStack: function() { return backStack; },
forwardStack: function() { return forwardStack },
getPlayer: getPlayer,
initialize: function(src) {
_initialize(src);
},
setURL: function(url) {
document.location.href = url;
},
getURL: function() {
return document.location.href;
},
getTitle: function() {
return document.title;
},
setTitle: function(title) {
try {
backStack[backStack.length - 1].title = title;
} catch(e) { }
//if on safari, set the title to be the empty string.
if (browser.safari) {
if (title == "") {
try {
var tmp = window.location.href.toString();
title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
} catch(e) {
title = "";
}
}
}
document.title = title;
},
setDefaultURL: function(def)
{
defaultHash = def;
def = getHash();
//trailing ? is important else an extra frame gets added to the history
//when navigating back to the first page. Alternatively could check
//in history frame navigation to compare # and ?.
if (browser.ie)
{
window['_ie_firstload'] = true;
var sourceToSet = historyFrameSourcePrefix + def;
var func = function() {
getHistoryFrame().src = sourceToSet;
window.location.replace("#" + def);
setInterval(checkForUrlChange, 50);
}
try {
func();
} catch(e) {
window.setTimeout(function() { func(); }, 0);
}
}
if (browser.safari)
{
currentHistoryLength = history.length;
if (historyHash.length == 0) {
historyHash[currentHistoryLength] = def;
var newloc = "#" + def;
window.location.replace(newloc);
} else {
//alert(historyHash[historyHash.length-1]);
}
setInterval(checkForUrlChange, 50);
}
if (browser.firefox || browser.opera)
{
var reg = new RegExp("#" + def + "$");
if (window.location.toString().match(reg)) {
} else {
var newloc ="#" + def;
window.location.replace(newloc);
}
setInterval(checkForUrlChange, 50);
}
},
/* Set the current browser URL; called from inside BrowserManager to propagate
* the application state out to the container.
*/
setBrowserURL: function(flexAppUrl, objectId) {
if (browser.ie && typeof objectId != "undefined") {
currentObjectId = objectId;
}
//fromIframe = fromIframe || false;
//fromFlex = fromFlex || false;
//alert("setBrowserURL: " + flexAppUrl);
//flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
var pos = document.location.href.indexOf('#');
var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
var newUrl = baseUrl + '#' + flexAppUrl;
if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
currentHref = newUrl;
addHistoryEntry(baseUrl, newUrl, flexAppUrl);
currentHistoryLength = history.length;
}
},
browserURLChange: function(flexAppUrl) {
var objectId = null;
if (browser.ie && currentObjectId != null) {
objectId = currentObjectId;
}
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
try {
pl[i].browserURLChange(flexAppUrl);
} catch(e) { }
}
} else {
try {
getPlayer(objectId).browserURLChange(flexAppUrl);
} catch(e) { }
}
currentObjectId = null;
},
getUserAgent: function() {
return navigator.userAgent;
},
getPlatform: function() {
return navigator.platform;
}
}
})();
// Initialization
// Automated unit testing and other diagnostics
function setURL(url)
{
document.location.href = url;
}
function backButton()
{
history.back();
}
function forwardButton()
{
history.forward();
}
function goForwardOrBackInHistory(step)
{
history.go(step);
}
//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
(function(i) {
var u =navigator.userAgent;var e=/*@cc_on!@*/false;
var st = setTimeout;
if(/webkit/i.test(u)){
st(function(){
var dr=document.readyState;
if(dr=="loaded"||dr=="complete"){i()}
else{st(arguments.callee,10);}},10);
} else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
document.addEventListener("DOMContentLoaded",i,false);
} else if(e){
(function(){
var t=document.createElement('doc:rdy');
try{t.doScroll('left');
i();t=null;
}catch(e){st(arguments.callee,0);}})();
} else{
window.onload=i;
}
})( function() {BrowserHistory.initialize();} );

View File

@ -0,0 +1,45 @@
<!--
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.
-->
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<script>
function processUrl()
{
var pos = url.indexOf("?");
url = pos != -1 ? url.substr(pos + 1) : "";
if (!parent._ie_firstload) {
parent.BrowserHistory.setBrowserURL(url);
try {
parent.BrowserHistory.browserURLChange(url);
} catch(e) { }
} else {
parent._ie_firstload = false;
}
}
var url = document.location.href;
processUrl();
document.write(encodeURIComponent(url));
</script>
Hidden frame for Browser History support.
</body>
</html>

View File

@ -0,0 +1,124 @@
<!--
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.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Apache Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops and mobile phones via Adobe AIR.
Learn more about Flex at http://flex.apache.org
// -->
<head>
<title>${title}</title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: ${bgcolor}; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section ${useBrowserHistory}>
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!${useBrowserHistory} END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "${expressInstallSwf}";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "${bgcolor}";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "${application}";
attributes.name = "${application}";
attributes.align = "middle";
swfobject.embedSWF(
"${swf}.swf", "flashContent",
"${width}", "${height}",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
xmlns:common="org.bigbluebutton.web.common.views.*"
width="100%" height="100%"
preinitialize="preinitializeHandler(event)"
creationComplete="creationCompleteHandler(event)">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import org.bigbluebutton.web.AppConfig;
import org.bigbluebutton.web.chat.views.ChatConfig;
import org.bigbluebutton.web.common.views.BBBWindow;
import robotlegs.bender.bundles.mvcs.MVCSBundle;
import robotlegs.bender.extensions.contextView.ContextView;
import robotlegs.bender.extensions.signalCommandMap.SignalCommandMapExtension;
import robotlegs.bender.framework.api.IContext;
import robotlegs.bender.framework.api.LogLevel;
import robotlegs.bender.framework.impl.Context;
protected var context:IContext;
protected function preinitializeHandler(event:FlexEvent):void {
setupContext();
}
/**
* Sets up the Robotlegs context.
*/
private function setupContext():void {
context = new Context()
.install(MVCSBundle, SignalCommandMapExtension)
.configure(AppConfig)
.configure(ChatConfig)
.configure(new ContextView(this));
// If you wish to change the log level then uncomment the line below and set
// the logLevel to the value you desire. The default logLevel is DEBUG, which
// is set in the MVCSBundle. The default log level traces out the framework
// actions, which can assist in learning Robotlegs.
setLogLevel();
}
/**
* Sets the logLevel for the robotegs context.
*/
private function setLogLevel():void {
// setting the logLevel to WARN means that robotlegs
// will also notify us about ERROR & FATAL.
context.logLevel = LogLevel.WARN;
}
private function creationCompleteHandler(event:FlexEvent):void {
mainCanvas.windowManager.add(new BBBWindow());
}
]]>
</fx:Script>
<s:Group id="mainshell"
width="100%"
height="100%">
<s:layout>
<s:VerticalLayout gap="0" />
</s:layout>
<s:Rect width="50" height="50">
<s:fill>
<s:SolidColor color="#000000" />
</s:fill>
<s:stroke>
<s:SolidColorStroke color="#ff0000" weight="10" />
</s:stroke>
</s:Rect>
<common:BBBCanvas id="mainCanvas" width="100%" height="100%">
</common:BBBCanvas>
</s:Group>
</s:Application>

View File

@ -0,0 +1,78 @@
package org.bigbluebutton.web {
import org.bigbluebutton.lib.chat.models.ChatMessagesSession;
import org.bigbluebutton.lib.chat.models.IChatMessagesSession;
import org.bigbluebutton.lib.chat.services.ChatMessageService;
import org.bigbluebutton.lib.chat.services.IChatMessageService;
import org.bigbluebutton.lib.common.services.BaseConnection;
import org.bigbluebutton.lib.common.services.IBaseConnection;
import org.bigbluebutton.lib.deskshare.services.DeskshareConnection;
import org.bigbluebutton.lib.deskshare.services.IDeskshareConnection;
import org.bigbluebutton.lib.main.commands.AuthenticationCommand;
import org.bigbluebutton.lib.main.commands.AuthenticationSignal;
import org.bigbluebutton.lib.main.commands.ConnectCommand;
import org.bigbluebutton.lib.main.commands.ConnectSignal;
import org.bigbluebutton.lib.main.commands.DisconnectUserCommand;
import org.bigbluebutton.lib.main.commands.DisconnectUserSignal;
import org.bigbluebutton.lib.main.models.ConferenceParameters;
import org.bigbluebutton.lib.main.models.IConferenceParameters;
import org.bigbluebutton.lib.main.models.IUserSession;
import org.bigbluebutton.lib.main.models.IUserUISession;
import org.bigbluebutton.lib.main.models.UserSession;
import org.bigbluebutton.lib.main.models.UserUISession;
import org.bigbluebutton.lib.main.services.BigBlueButtonConnection;
import org.bigbluebutton.lib.main.services.IBigBlueButtonConnection;
import org.bigbluebutton.lib.main.services.ILoginService;
import org.bigbluebutton.lib.main.services.LoginService;
import org.bigbluebutton.lib.presentation.commands.LoadSlideCommand;
import org.bigbluebutton.lib.presentation.commands.LoadSlideSignal;
import org.bigbluebutton.lib.presentation.services.IPresentationService;
import org.bigbluebutton.lib.presentation.services.PresentationService;
import org.bigbluebutton.lib.user.services.IUsersService;
import org.bigbluebutton.lib.user.services.UsersService;
import org.bigbluebutton.lib.video.commands.CameraQualityCommand;
import org.bigbluebutton.lib.video.commands.CameraQualitySignal;
import org.bigbluebutton.lib.video.commands.ShareCameraSignal;
import org.bigbluebutton.lib.video.services.IVideoConnection;
import org.bigbluebutton.lib.video.services.VideoConnection;
import org.bigbluebutton.lib.voice.commands.ShareMicrophoneCommand;
import org.bigbluebutton.lib.voice.commands.ShareMicrophoneSignal;
import org.bigbluebutton.lib.voice.services.IVoiceConnection;
import org.bigbluebutton.lib.voice.services.VoiceConnection;
import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap;
import robotlegs.bender.framework.api.IConfig;
import robotlegs.bender.framework.api.IInjector;
public class AppConfig implements IConfig {
[Inject]
public var injector:IInjector;
[Inject]
public var signalCommandMap:ISignalCommandMap;
public function configure():void {
// Singleton mapping
injector.map(IUserUISession).toSingleton(UserUISession);
injector.map(IUserSession).toSingleton(UserSession);
injector.map(IConferenceParameters).toSingleton(ConferenceParameters);
injector.map(IUsersService).toSingleton(UsersService);
injector.map(IPresentationService).toSingleton(PresentationService);
injector.map(IDeskshareConnection).toSingleton(DeskshareConnection);
// Type mapping
injector.map(IBaseConnection).toType(BaseConnection);
injector.map(IVoiceConnection).toType(VoiceConnection);
injector.map(ILoginService).toType(LoginService);
injector.map(IBigBlueButtonConnection).toType(BigBlueButtonConnection);
injector.map(IVideoConnection).toType(VideoConnection);
// Signal to Command mapping
signalCommandMap.map(ConnectSignal).toCommand(ConnectCommand);
signalCommandMap.map(AuthenticationSignal).toCommand(AuthenticationCommand);
signalCommandMap.map(ShareMicrophoneSignal).toCommand(ShareMicrophoneCommand);
//signalCommandMap.map(ShareCameraSignal).toCommand(ShareCameraCommand);
signalCommandMap.map(LoadSlideSignal).toCommand(LoadSlideCommand);
signalCommandMap.map(CameraQualitySignal).toCommand(CameraQualityCommand);
signalCommandMap.map(DisconnectUserSignal).toCommand(DisconnectUserCommand);
}
}
}

View File

@ -0,0 +1,53 @@
package org.bigbluebutton.web.chat.views {
import org.bigbluebutton.lib.chat.models.ChatMessagesSession;
import org.bigbluebutton.lib.chat.models.IChatMessagesSession;
import org.bigbluebutton.lib.chat.services.ChatMessageService;
import org.bigbluebutton.lib.chat.services.IChatMessageService;
import robotlegs.bender.extensions.mediatorMap.api.IMediatorMap;
import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap;
import robotlegs.bender.framework.api.IConfig;
import robotlegs.bender.framework.api.IInjector;
public class ChatConfig implements IConfig {
[Inject]
public var injector:IInjector;
[Inject]
public var mediatorMap:IMediatorMap;
[Inject]
public var signalCommandMap:ISignalCommandMap;
public function configure():void {
dependencies();
mediators();
signals();
}
/**
* Specifies all the dependencies for the feature
* that will be injected onto objects used by the
* application.
*/
private function dependencies():void {
injector.map(IChatMessageService).toSingleton(ChatMessageService);
injector.map(IChatMessagesSession).toSingleton(ChatMessagesSession);
}
/**
* Maps view mediators to views.
*/
private function mediators():void {
}
/**
* Maps signals to commands using the signalCommandMap.
*/
private function signals():void {
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

View File

@ -0,0 +1,180 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.effects {
import flash.geom.Point;
import flash.geom.Rectangle;
import mx.effects.Effect;
import mx.effects.Parallel;
import org.bigbluebutton.web.common.views.BBBManager;
import org.bigbluebutton.web.common.views.BBBWindow;
import spark.effects.Move;
import spark.effects.Resize;
/**
* Base effects implementation with no animation. Extending this class means the developer
* can choose to implement only certain effects, rather than all required by IBBBEffectsDescriptor.
*/
public class BBBEffectsDescriptorBase implements IBBBEffectsDescriptorBase {
public var duration:Number = 10;
public function getWindowAddEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowMinimizeEffect(window:BBBWindow, manager:BBBManager, moveTo:Point = null):Effect {
var parallel:Parallel = new Parallel();
parallel.duration = this.duration;
var resize:Resize = new Resize(window);
resize.widthTo = window.minWidth;
resize.duration = this.duration;
resize.heightTo = window.minimizeHeight;
parallel.addChild(resize);
if (moveTo != null) {
var move:Move = new Move(window);
move.xTo = moveTo.x;
move.yTo = moveTo.y;
move.duration = this.duration;
parallel.addChild(move);
}
return parallel;
}
public function getWindowRestoreEffect(window:BBBWindow, manager:BBBManager, restoreTo:Rectangle):Effect {
var parallel:Parallel = new Parallel();
parallel.duration = this.duration;
var resize:Resize = new Resize(window);
resize.widthTo = restoreTo.width;
resize.heightTo = restoreTo.height;
resize.duration = this.duration;
parallel.addChild(resize);
var move:Move = new Move(window);
move.xTo = restoreTo.x;
move.yTo = restoreTo.y;
move.duration = this.duration;
parallel.addChild(move);
return parallel;
}
public function getWindowMaximizeEffect(window:BBBWindow, manager:BBBManager, bottomOffset:Number = 0):Effect {
var parallel:Parallel = new Parallel();
parallel.duration = this.duration;
var resize:Resize = new Resize(window);
resize.widthTo = manager.container.width;
resize.heightTo = manager.container.height - bottomOffset;
resize.duration = this.duration;
parallel.addChild(resize);
var move:Move = new Move(window);
move.xTo = 0;
move.yTo = 0;
move.duration = this.duration;
parallel.addChild(move);
return parallel;
}
public function getWindowCloseEffect(window:BBBWindow, manager:BBBManager):Effect {
// have to return something so that EFFECT_END listener will fire
var resize:Resize = new Resize(window);
resize.duration = this.duration;
resize.widthTo = window.width;
resize.heightTo = window.height;
return resize;
}
public function getWindowFocusStartEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowFocusEndEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowDragStartEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowDragEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowDragEndEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowResizeStartEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowResizeEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getWindowResizeEndEffect(window:BBBWindow, manager:BBBManager):Effect {
return new Effect();
}
public function getTileEffect(items:Array, manager:BBBManager):Effect
{
var parallel:Parallel = new Parallel();
parallel.duration = this.duration;
for each(var item:BBBGroupEffectItem in items)
{
manager.bringToFront(item.window);
var move:Move = new Move(item.window);
move.xTo = item.moveTo.x;
move.yTo = item.moveTo.y;
move.duration = this.duration;
parallel.addChild(move);
item.setWindowSize();
}
return parallel;
}
public function reTileMinWindowsEffect(window:BBBWindow, manager:BBBManager, moveTo:Point):Effect
{
var move:Move = new Move(window);
move.duration = this.duration;
move.xTo = moveTo.x;
move.yTo = moveTo.y;
return move
}
}
}

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.effects {
import flash.geom.Point;
import org.bigbluebutton.web.common.views.BBBWindow;
public class BBBGroupEffectItem {
public var window:BBBWindow;
public var moveTo:Point = new Point();
public var widthFrom:Number = 0;
public var widthTo:Number = 0;
public var heightFrom:Number = 0;
public var heightTo:Number = 0;
public function BBBGroupEffectItem(window:BBBWindow):void {
this.window = window;
}
public function setWindowSize():void {
this.window.width = this.widthTo;
this.window.height = this.heightTo;
}
public function get isCorrectSize():Boolean {
return window.height == heightTo && window.width == widthTo;
}
public function get isCorrectPosition():Boolean {
return window.x == moveTo.x && window.y == moveTo.y;
}
public function get isInPlace():Boolean {
return isCorrectSize && isCorrectPosition;
}
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.effects {
import flash.geom.Point;
import flash.geom.Rectangle;
import mx.effects.Effect;
import org.bigbluebutton.web.common.views.BBBManager;
import org.bigbluebutton.web.common.views.BBBWindow;
/**
* Interface expected by BBBManager. All effects classes must implement this interface.
*/
public interface IBBBEffectsDescriptorBase {
// window effects
function getWindowAddEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowMinimizeEffect(window:BBBWindow, manager:BBBManager, moveTo:Point = null):Effect;
function getWindowRestoreEffect(window:BBBWindow, manager:BBBManager, restoreTo:Rectangle):Effect;
function getWindowMaximizeEffect(window:BBBWindow, manager:BBBManager, bottomOffset:Number = 0):Effect;
function getWindowCloseEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowFocusStartEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowFocusEndEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowDragStartEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowDragEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowDragEndEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowResizeStartEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowResizeEffect(window:BBBWindow, manager:BBBManager):Effect;
function getWindowResizeEndEffect(window:BBBWindow, manager:BBBManager):Effect;
// group effects
function getTileEffect(items:Array, manager:BBBManager):Effect;
function reTileMinWindowsEffect(window:BBBWindow, manager:BBBManager, moveTo:Point):Effect;
}
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.events {
import mx.events.EffectEvent;
/**
* Event class dispatched at beginning and end of mdi effects for things like minimize, maximize, etc.
*/
public class BBBEffectEvent extends EffectEvent {
/**
* Corresponds to type property of corresponding BBBManagerEvent.
*/
public var mdiEventType:String;
/**
* List of windows involved in effect.
*/
public var windows:Array;
/**
* Constructor
*
* @param type EffectEvent.EFFECT_START or EfectEvent.EFFECT_END
* @param mdiEventType Corresponding mdi event type like minimize, maximize, tile, etc. Will be one of BBBManagerEvent's static types.
* @param windows List of windows involved in effect. Will be a single element except for cascade and tile.
*/
public function BBBEffectEvent(type:String, mdiEventType:String, windows:Array) {
super(type);
this.mdiEventType = mdiEventType;
this.windows = windows;
}
}
}

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.events {
import flash.events.Event;
import mx.effects.Effect;
import org.bigbluebutton.web.common.views.BBBManager;
import org.bigbluebutton.web.common.views.BBBWindow;
/**
* Event type dispatched by BBBManager. Majority of events based on/relayed from managed windows.
*/
public class BBBManagerEvent extends Event {
public static const WINDOW_ADD:String = "windowAdd";
public static const WINDOW_MINIMIZE:String = "windowMinimize";
public static const WINDOW_RESTORE:String = "windowRestore";
public static const WINDOW_MAXIMIZE:String = "windowMaximize";
public static const WINDOW_CLOSE:String = "windowClose";
public static const WINDOW_FOCUS_START:String = "windowFocusStart";
public static const WINDOW_FOCUS_END:String = "windowFocusEnd";
public static const WINDOW_DRAG_START:String = "windowDragStart";
public static const WINDOW_DRAG:String = "windowDrag";
public static const WINDOW_DRAG_END:String = "windowDragEnd";
public static const WINDOW_RESIZE_START:String = "windowResizeStart";
public static const WINDOW_RESIZE:String = "windowResize";
public static const WINDOW_RESIZE_END:String = "windowResizeEnd";
public static const TILE:String = "tile";
public var window:BBBWindow;
public var manager:BBBManager;
public var effect:Effect;
public var effectItems:Array;
public var resizeHandle:String;
public function BBBManagerEvent(type:String, window:BBBWindow, manager:BBBManager, effect:Effect = null, effectItems:Array = null, resizeHandle:String = null, bubbles:Boolean = false) {
super(type, bubbles, true);
this.window = window;
this.manager = manager;
this.effect = effect;
this.effectItems = effectItems;
this.resizeHandle = resizeHandle;
}
override public function clone():Event {
return new BBBManagerEvent(type, window, manager, effect, effectItems, resizeHandle, bubbles);
}
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.events {
import flash.events.Event;
import org.bigbluebutton.web.common.views.BBBWindow;
/**
* Event type dispatched by BBBWindow. Events will also be rebroadcast (as BBBManagerEvents)
* by the window's manager, if one is present.
*/
public class BBBWindowEvent extends Event {
public static const MINIMIZE:String = "minimizeBBBWindow";
public static const RESTORE:String = "restoreBBBWindow";
public static const MAXIMIZE:String = "maximizeBBBWindow";
public static const CLOSE:String = "closeBBBWindow";
public static const FOCUS_START:String = "focusStartBBBWindow";
public static const FOCUS_END:String = "focusEndBBBWindow";
public static const DRAG_START:String = "dragStartBBBWindow";
public static const DRAG:String = "dragBBBWindow";
public static const DRAG_END:String = "dragEndBBBWindow";
public static const RESIZE_START:String = "resizeStartBBBWindow";
public static const RESIZE:String = "resizeBBBWindow";
public static const RESIZE_END:String = "resizeEndBBBWindow";
public var window:BBBWindow;
public var resizeHandle:String;
public function BBBWindowEvent(type:String, window:BBBWindow, resizeHandle:String = null, bubbles:Boolean = false) {
super(type, bubbles, true);
this.window = window;
this.resizeHandle = resizeHandle;
}
override public function clone():Event {
return new BBBWindowEvent(type, window, resizeHandle, bubbles);
}
}
}

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.views {
import mx.core.IVisualElement;
import mx.events.FlexEvent;
import org.bigbluebutton.web.common.effects.IBBBEffectsDescriptorBase;
import spark.components.Group;
/**
* Convenience class that allows quick MXML implementations by implicitly creating
* container and manager members of BBB. Will auto-detect BBBWindow children
* and add them to list of managed windows.
*/
public class BBBCanvas extends Group {
public var windowManager:BBBManager;
public function BBBCanvas() {
super();
windowManager = new BBBManager(this);
addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
}
private function onCreationComplete(event:FlexEvent):void {
for (var i:int=0; i<numElements; i++) {
var child:IVisualElement = this.getElementAt(i);
if (child is BBBWindow) {
windowManager.add(child as BBBWindow);
}
}
removeEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
}
/**
* Proxy to BBBManager effects property.
*
* @deprecated use effects and class
*
*/
public function set effectsLib(clazz:Class):void {
this.windowManager.effects = new clazz();
}
/**
* Proxy to BBBManager property of same name.
*/
public function set effects(effects:IBBBEffectsDescriptorBase):void {
this.windowManager.effects = effects;
}
/**
* Proxy to BBBManager property of same name.
*/
public function get enforceBoundaries():Boolean {
return windowManager.enforceBoundaries;
}
public function set enforceBoundaries(value:Boolean):void {
windowManager.enforceBoundaries = value;
}
/**
* Proxy to BBBManager property of same name.
*/
public function get snapDistance():Number {
return windowManager.snapDistance;
}
public function set snapDistance(value:Number):void {
windowManager.snapDistance = value;
}
/**
* Proxy to BBBManager property of same name.
*/
public function get tilePadding():Number {
return windowManager.tilePadding;
}
public function set tilePadding(value:Number):void {
windowManager.tilePadding = value;
}
}
}

View File

@ -0,0 +1,958 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.views {
import flash.events.ContextMenuEvent;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.utils.Dictionary;
import mx.collections.ArrayCollection;
import mx.core.EventPriority;
import mx.core.IVisualElement;
import mx.effects.CompositeEffect;
import mx.effects.Effect;
import mx.effects.effectClasses.CompositeEffectInstance;
import mx.events.EffectEvent;
import mx.events.ResizeEvent;
import mx.utils.ArrayUtil;
import org.bigbluebutton.web.common.effects.BBBEffectsDescriptorBase;
import org.bigbluebutton.web.common.effects.BBBGroupEffectItem;
import org.bigbluebutton.web.common.effects.IBBBEffectsDescriptorBase;
import org.bigbluebutton.web.common.events.BBBEffectEvent;
import org.bigbluebutton.web.common.events.BBBManagerEvent;
import org.bigbluebutton.web.common.events.BBBWindowEvent;
/**
* Class responsible for applying effects and default behaviors to BBBWindow instances such as
* tiling, cascading, minimizing, maximizing, etc.
*/
public class BBBManager extends EventDispatcher {
/**
* Temporary storage location for use in dispatching BBBEffectEvents.
*
* @private
*/
private var mgrEventCollection:ArrayCollection = new ArrayCollection();
private var windowToManagerEventMap:Dictionary;
private var tiledWindows:ArrayCollection;
public var tileMinimize:Boolean = true;
public var tileMinimizeWidth:int = 200;
public var showMinimizedTiles:Boolean = false;
public var snapDistance:Number = 0;
public var tilePadding:Number = 8;
public var minTilePadding:Number = 5;
public var enforceBoundaries:Boolean = true;
public var effects:IBBBEffectsDescriptorBase = new BBBEffectsDescriptorBase();
public static const CONTEXT_MENU_LABEL_TILE:String = "Tile";
public static const CONTEXT_MENU_LABEL_TILE_FILL:String = "Tile + Fill";
public static const CONTEXT_MENU_LABEL_SHOW_ALL:String = "Show All Windows";
/**
* Constructor()
*/
public function BBBManager(container:BBBCanvas, effects:IBBBEffectsDescriptorBase = null):void {
this.container = container;
if (effects != null) {
this.effects = effects;
}
if (tileMinimize) {
tiledWindows = new ArrayCollection();
}
this.container.addEventListener(ResizeEvent.RESIZE, containerResizeHandler);
// map of window events to corresponding manager events
windowToManagerEventMap = new Dictionary();
windowToManagerEventMap[BBBWindowEvent.MINIMIZE] = BBBManagerEvent.WINDOW_MINIMIZE;
windowToManagerEventMap[BBBWindowEvent.RESTORE] = BBBManagerEvent.WINDOW_RESTORE;
windowToManagerEventMap[BBBWindowEvent.MAXIMIZE] = BBBManagerEvent.WINDOW_MAXIMIZE;
windowToManagerEventMap[BBBWindowEvent.CLOSE] = BBBManagerEvent.WINDOW_CLOSE;
windowToManagerEventMap[BBBWindowEvent.FOCUS_START] = BBBManagerEvent.WINDOW_FOCUS_START;
windowToManagerEventMap[BBBWindowEvent.FOCUS_END] = BBBManagerEvent.WINDOW_FOCUS_END;
windowToManagerEventMap[BBBWindowEvent.DRAG_START] = BBBManagerEvent.WINDOW_DRAG_START;
windowToManagerEventMap[BBBWindowEvent.DRAG] = BBBManagerEvent.WINDOW_DRAG;
windowToManagerEventMap[BBBWindowEvent.DRAG_END] = BBBManagerEvent.WINDOW_DRAG_END;
windowToManagerEventMap[BBBWindowEvent.RESIZE_START] = BBBManagerEvent.WINDOW_RESIZE_START;
windowToManagerEventMap[BBBWindowEvent.RESIZE] = BBBManagerEvent.WINDOW_RESIZE;
windowToManagerEventMap[BBBWindowEvent.RESIZE_END] = BBBManagerEvent.WINDOW_RESIZE_END;
// these handlers execute default behaviors, these events are dispatched by this class
addEventListener(BBBManagerEvent.WINDOW_ADD, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_MINIMIZE, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_RESTORE, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_MAXIMIZE, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_CLOSE, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_FOCUS_START, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_FOCUS_END, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_DRAG_START, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_DRAG, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_DRAG_END, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_RESIZE_START, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_RESIZE, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
addEventListener(BBBManagerEvent.WINDOW_RESIZE_END, executeDefaultBehavior, false, EventPriority.DEFAULT_HANDLER);
}
private var _container:BBBCanvas;
public function get container():BBBCanvas {
return _container;
}
public function set container(value:BBBCanvas):void {
this._container = value;
}
/**
* @private
* the managed window stack
*/
[Bindable]
public var windowList:Array = new Array();
public function add(window:BBBWindow):void {
if (windowList.indexOf(window) < 0) {
window.windowManager = this;
this.addListeners(window);
this.windowList.push(window);
this.addContextMenu(window);
// to accomodate mxml impl
if (window.parent == null) {
this.container.addElement(window);
this.position(window);
}
dispatchEvent(new BBBManagerEvent(BBBManagerEvent.WINDOW_ADD, window, this));
bringToFront(window);
}
}
/**
* Positions a window on the screen
*
* <p>This is primarly used as the default space on the screen to position the window.</p>
*
* @param window:BBBWindow Window to position
*/
public function position(window:BBBWindow):void {
window.x = this.windowList.length * 30;
window.y = this.windowList.length * 30;
if ((window.x + window.width) > container.width)
window.x = 40;
if ((window.y + window.height) > container.height)
window.y = 40;
}
public function addContextMenu(window:BBBWindow, contextMenu:ContextMenu = null):void {
// add default context menu
if (contextMenu == null) {
var defaultContextMenu:ContextMenu = new ContextMenu();
defaultContextMenu.hideBuiltInItems();
var arrangeItem:ContextMenuItem = new ContextMenuItem(CONTEXT_MENU_LABEL_TILE);
arrangeItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
defaultContextMenu.customItems.push(arrangeItem);
var arrangeFillItem:ContextMenuItem = new ContextMenuItem(CONTEXT_MENU_LABEL_TILE_FILL);
arrangeFillItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
defaultContextMenu.customItems.push(arrangeFillItem);
var showAllItem:ContextMenuItem = new ContextMenuItem(CONTEXT_MENU_LABEL_SHOW_ALL);
showAllItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
defaultContextMenu.customItems.push(showAllItem);
this.container.contextMenu = defaultContextMenu;
} else {
// add passed in context menu
window.contextMenu = contextMenu;
}
}
private function menuItemSelectHandler(event:ContextMenuEvent):void {
var win:BBBWindow = event.contextMenuOwner as BBBWindow;
switch (event.target.caption) {
case (CONTEXT_MENU_LABEL_TILE):
this.tile(false, this.tilePadding);
break;
case (CONTEXT_MENU_LABEL_TILE_FILL):
this.tile(true, this.tilePadding);
break;
case (CONTEXT_MENU_LABEL_SHOW_ALL):
this.showAllWindows();
break;
}
}
private function windowEventProxy(event:Event):void {
if (event is BBBWindowEvent && !event.isDefaultPrevented()) {
var winEvent:BBBWindowEvent = event as BBBWindowEvent;
var mgrEvent:BBBManagerEvent = new BBBManagerEvent(windowToManagerEventMap[winEvent.type], winEvent.window, this, null, null, winEvent.resizeHandle);
switch (winEvent.type) {
case BBBWindowEvent.MINIMIZE:
mgrEvent.window.saveStyle();
var maxTiles:int = Math.floor(this.container.width / (this.tileMinimizeWidth + this.tilePadding));
var xPos:Number = getLeftOffsetPosition(this.tiledWindows.length, maxTiles, this.tileMinimizeWidth, this.minTilePadding);
var yPos:Number = this.container.height - getBottomTilePosition(this.tiledWindows.length, maxTiles, mgrEvent.window.minimizeHeight, this.minTilePadding);
var minimizePoint:Point = new Point(xPos, yPos);
mgrEvent.effect = this.effects.getWindowMinimizeEffect(mgrEvent.window, this, minimizePoint);
break;
case BBBWindowEvent.RESTORE:
mgrEvent.window.restoreStyle();
mgrEvent.effect = this.effects.getWindowRestoreEffect(winEvent.window, this, winEvent.window.savedWindowRect);
break;
case BBBWindowEvent.MAXIMIZE:
mgrEvent.window.restoreStyle();
mgrEvent.effect = this.effects.getWindowMaximizeEffect(winEvent.window, this);
break;
case BBBWindowEvent.CLOSE:
mgrEvent.effect = this.effects.getWindowCloseEffect(mgrEvent.window, this);
break;
case BBBWindowEvent.FOCUS_START:
mgrEvent.effect = this.effects.getWindowFocusStartEffect(winEvent.window, this);
break;
case BBBWindowEvent.FOCUS_END:
mgrEvent.effect = this.effects.getWindowFocusEndEffect(winEvent.window, this);
break;
case BBBWindowEvent.DRAG_START:
mgrEvent.effect = this.effects.getWindowDragStartEffect(winEvent.window, this);
break;
case BBBWindowEvent.DRAG:
mgrEvent.effect = this.effects.getWindowDragEffect(winEvent.window, this);
break;
case BBBWindowEvent.DRAG_END:
mgrEvent.effect = this.effects.getWindowDragEndEffect(winEvent.window, this);
break;
case BBBWindowEvent.RESIZE_START:
mgrEvent.effect = this.effects.getWindowResizeStartEffect(winEvent.window, this);
break;
case BBBWindowEvent.RESIZE:
mgrEvent.effect = this.effects.getWindowResizeEffect(winEvent.window, this);
break;
case BBBWindowEvent.RESIZE_END:
mgrEvent.effect = this.effects.getWindowResizeEndEffect(winEvent.window, this);
break;
}
dispatchEvent(mgrEvent);
}
}
public function executeDefaultBehavior(event:Event):void {
if (event is BBBManagerEvent && !event.isDefaultPrevented()) {
var mgrEvent:BBBManagerEvent = event as BBBManagerEvent;
switch (mgrEvent.type) {
case BBBManagerEvent.WINDOW_ADD:
// get the effect here because this doesn't pass thru windowEventProxy()
mgrEvent.effect = this.effects.getWindowAddEffect(mgrEvent.window, this);
break;
case BBBManagerEvent.WINDOW_MINIMIZE:
mgrEvent.effect.addEventListener(EffectEvent.EFFECT_END, onMinimizeEffectEnd);
break;
case BBBManagerEvent.WINDOW_RESTORE:
removeTileInstance(mgrEvent.window);
break;
case BBBManagerEvent.WINDOW_MAXIMIZE:
removeTileInstance(mgrEvent.window);
mgrEvent.effect = getMaximizeWindowEffect(mgrEvent.window);
break;
case BBBManagerEvent.WINDOW_CLOSE:
removeTileInstance(mgrEvent.window);
mgrEvent.effect.addEventListener(EffectEvent.EFFECT_END, onCloseEffectEnd);
break;
case BBBManagerEvent.WINDOW_FOCUS_START:
mgrEvent.window.hasFocus = true;
mgrEvent.window.validateNow();
container.setElementIndex(mgrEvent.window, container.numElements - 1);
break;
case BBBManagerEvent.WINDOW_FOCUS_END:
mgrEvent.window.hasFocus = false;
mgrEvent.window.validateNow();
break;
case BBBManagerEvent.WINDOW_DRAG:
case BBBManagerEvent.WINDOW_RESIZE:
if (snapDistance > 1)
snapWindow(mgrEvent.window, mgrEvent.resizeHandle);
break;
// no, nothing happens in these cases. but it might someday.
case BBBManagerEvent.WINDOW_DRAG_START:
case BBBManagerEvent.WINDOW_DRAG_END:
case BBBManagerEvent.WINDOW_RESIZE_START:
case BBBManagerEvent.WINDOW_RESIZE_END:
break;
}
// Play effect only if it is necessary
if (mgrEvent.effect is CompositeEffect || (mgrEvent.effect.targets && mgrEvent.effect.targets.length)) {
// add this event to collection for lookup in the effect handler
mgrEventCollection.addItem(mgrEvent);
// listen for start and end of effect
mgrEvent.effect.addEventListener(EffectEvent.EFFECT_START, onMgrEffectEvent)
mgrEvent.effect.addEventListener(EffectEvent.EFFECT_END, onMgrEffectEvent);
mgrEvent.effect.play();
}
}
}
/**
* Handler for start and end events of all effects initiated by BBBManager.
*
* @param event
*/
private function onMgrEffectEvent(event:EffectEvent):void {
// iterate over stored events
for each (var mgrEvent:BBBManagerEvent in mgrEventCollection) {
// is this the manager event that corresponds to this effect?
if (mgrEvent.effect == event.effectInstance.effect) {
// for group events (tile) event.window is null
// and we have to dig in a bit to get the window list
var windows:Array = new Array();
if (mgrEvent.window) {
windows.push(mgrEvent.window);
} else {
for each (var group:BBBGroupEffectItem in mgrEvent.effectItems) {
windows.push(group.window);
}
}
// create and dispatch event
dispatchEvent(new BBBEffectEvent(event.type, mgrEvent.type, windows));
// if the effect is over remove the manager event from collection
if (event.type == EffectEvent.EFFECT_END) {
mgrEventCollection.removeItemAt(mgrEventCollection.getItemIndex(mgrEvent));
}
return;
}
}
}
private function onMinimizeEffectEnd(event:EffectEvent):void {
// if this was a composite effect (almost definitely is), we make sure a target was defined on it
// since that is optional, we look in its first child if we don't find one
var targetWindow:BBBWindow = event.effectInstance.target as BBBWindow;
if (targetWindow == null && event.effectInstance is CompositeEffectInstance) {
var compEffect:CompositeEffect = event.effectInstance.effect as CompositeEffect;
targetWindow = Effect(compEffect.children[0]).target as BBBWindow;
}
tiledWindows.addItem(targetWindow);
reTileWindows();
}
private function onCloseEffectEnd(event:EffectEvent):void {
remove(event.effectInstance.target as BBBWindow);
}
/**
* Handles resizing of container to reposition elements
*
* @param event The ResizeEvent object from event dispatch
*
* */
private function containerResizeHandler(event:ResizeEvent):void {
//repositions any minimized tiled windows to bottom left in their rows
reTileWindows();
}
/**
* Gets the left placement of a tiled window
*
* @param tileIndex The index value of the current tile instance we're placing
*
* @param maxTiles The maximum number of tiles that can be placed horizontally across the container given the minimimum width of each tile
*
* @param minWinWidth The width of the window tile when minimized
*
* @param padding The padding accordance to place between minimized tile window instances
*
* */
private function getLeftOffsetPosition(tileIndex:int, maxTiles:int, minWinWidth:Number, padding:Number):Number {
var tileModPos:int = tileIndex % maxTiles;
if (tileModPos == 0)
return padding;
else
return (tileModPos * minWinWidth) + ((tileModPos + 1) * padding);
}
/**
* Gets the bottom placement of a tiled window
*
* @param maxTiles The maximum number of tiles that can be placed horizontally across the container given the minimimum width of each tile
*
* @param minWinHeight The height of the window tile instance when minimized -- probably the height of the titleBar instance of the Panel
*
* @param padding The padding accordance to place between minimized tile window instances
*
* */
private function getBottomTilePosition(tileIndex:int, maxTiles:int, minWindowHeight:Number, padding:Number):Number {
var numRows:int = Math.floor(tileIndex / maxTiles);
if (numRows == 0)
return minWindowHeight + padding;
else
return ((numRows + 1) * minWindowHeight) + ((numRows + 1) * padding);
}
/**
* Gets the height accordance for tiled windows along bottom to be used in the maximizing of other windows -- leaves space at bottom of maximize height so tiled windows still show
*
* @param maxTiles The maximum number of tiles that can be placed horizontally across the container given the minimimum width of each tile
*
* @param minWinHeight The height of the window tile instance when minimized -- probably the height of the titleBar instance of the Panel
*
* @param padding The padding accordance to place between minimized tile window instances
*
* */
private function getBottomOffsetHeight(maxTiles:int, minWindowHeight:Number, padding:Number):Number {
var numRows:int = Math.ceil(this.tiledWindows.length / maxTiles);
//if we have some rows get their combined heights... if not, return 0 so maximized window takes up full height of container
if (this.tiledWindows.length != 0)
return ((numRows) * minWindowHeight) + ((numRows + 1) * padding);
else
return 0;
}
/**
* Retiles the remaining minimized tile instances if one of them gets restored or maximized
*
* */
private function reTileWindows():void {
var maxTiles:int = Math.floor(this.container.width / (this.tileMinimizeWidth + this.tilePadding));
//we've just removed/added a row from the tiles, so we tell any maximized windows to change their height
if (this.tiledWindows.length % maxTiles == 0 || (this.tiledWindows.length - 1) % maxTiles == 0) {
var openWins:Array = getOpenWindowList();
for (var winIndex:int = 0; winIndex < openWins.length; winIndex++) {
if (BBBWindow(openWins[winIndex]).maximized)
getMaximizeWindowEffect(BBBWindow(openWins[winIndex])).play();
}
}
for (var i:int = 0; i < tiledWindows.length; i++) {
var currentWindow:BBBWindow = tiledWindows.getItemAt(i) as BBBWindow;
var xPos:Number = getLeftOffsetPosition(i, maxTiles, this.tileMinimizeWidth, this.minTilePadding);
var yPos:Number = this.container.height - getBottomTilePosition(i, maxTiles, currentWindow.minimizeHeight, this.minTilePadding);
var movePoint:Point = new Point(xPos, yPos);
this.effects.reTileMinWindowsEffect(currentWindow, this, movePoint).play();
}
}
/**
* Maximizing of Window
*
* @param window BBBWindowinstance to maximize
*
**/
private function getMaximizeWindowEffect(window:BBBWindow):Effect {
var maxTiles:int = this.container.width / this.tileMinimizeWidth;
if (showMinimizedTiles) {
return this.effects.getWindowMaximizeEffect(window, this, getBottomOffsetHeight(maxTiles, window.minimizeHeight, this.minTilePadding));
} else {
return this.effects.getWindowMaximizeEffect(window, this);
}
}
/**
* Removes the closed window from the ArrayCollection of tiled windows
*
* @param event BBBWindowEvent instance containing even type and window instance that is being handled
*
* */
private function removeTileInstance(window:BBBWindow):void {
for (var i:int = 0; i < tiledWindows.length; i++) {
if (tiledWindows.getItemAt(i) == window) {
this.tiledWindows.removeItemAt(i);
reTileWindows();
}
}
}
/**
* By default, executes on BBBManagerEvent.WINDOW_DRAG and BBBManagerEvent.WINDOW_RESIZE events.
* Check to see if the target window is within snapping distance of any other windows.
* Execute the snap that requires the least movement.
*/
private function snapWindow(dragWindow:BBBWindow, dragHandle:String):void {
var xDist:Number = NaN;
var yDist:Number = NaN;
var dragRect:Rectangle = getPaddedBounds(dragWindow);
// find the minimum snap (if one exists)
for each (var window:BBBWindow in windowList) {
if (window != dragWindow && dragRect.intersects(getPaddedBounds(window))) {
if (!dragHandle || BBBResizeHandle.isLeft(dragHandle)) {
xDist = calculateSnapDistance(dragWindow.x, window.x + window.width + tilePadding, xDist);
xDist = calculateSnapDistance(dragWindow.x, window.x, xDist);
}
if (!dragHandle || BBBResizeHandle.isRight(dragHandle)) {
xDist = calculateSnapDistance(dragWindow.x + dragWindow.width, window.x - tilePadding, xDist);
xDist = calculateSnapDistance(dragWindow.x + dragWindow.width, window.x + window.width, xDist);
}
if (!dragHandle || BBBResizeHandle.isTop(dragHandle)) {
yDist = calculateSnapDistance(dragWindow.y, window.y + window.height + tilePadding, yDist);
yDist = calculateSnapDistance(dragWindow.y, window.y, yDist);
}
if (!dragHandle || BBBResizeHandle.isBottom(dragHandle)) {
yDist = calculateSnapDistance(dragWindow.y + dragWindow.height, window.y - tilePadding, yDist);
yDist = calculateSnapDistance(dragWindow.y + dragWindow.height, window.y + window.height, yDist);
}
}
}
var xChanged:Boolean = !isNaN(xDist);
var yChanged:Boolean = !isNaN(yDist);
// update the x, y, width, height based on the user interaction
// dragHandle contains either a BBBResizeHandle value, or null if the window is being dragged
switch (dragHandle) {
case BBBResizeHandle.LEFT:
if (xChanged) {
dragWindow.x -= xDist;
dragWindow.width += xDist;
}
break;
case BBBResizeHandle.RIGHT:
if (xChanged)
dragWindow.width -= xDist;
break;
case BBBResizeHandle.TOP:
if (yChanged) {
dragWindow.y -= yDist;
dragWindow.height += yDist;
}
break;
case BBBResizeHandle.BOTTOM:
if (yChanged)
dragWindow.height -= yDist;
break;
case BBBResizeHandle.TOP_LEFT:
if (xChanged) {
dragWindow.x -= xDist;
dragWindow.width += xDist;
}
if (yChanged) {
dragWindow.y -= yDist;
dragWindow.height += yDist;
}
break;
case BBBResizeHandle.TOP_RIGHT:
if (xChanged)
dragWindow.width -= xDist;
if (yChanged) {
dragWindow.y -= yDist;
dragWindow.height += yDist;
}
break;
case BBBResizeHandle.BOTTOM_LEFT:
if (xChanged) {
dragWindow.x -= xDist;
dragWindow.width += xDist;
}
if (yChanged)
dragWindow.height -= yDist;
break;
case BBBResizeHandle.BOTTOM_RIGHT:
if (yChanged)
dragWindow.height -= yDist;
if (xChanged)
dragWindow.width -= xDist;
break;
default:
if (xChanged)
dragWindow.x -= xDist;
if (yChanged)
dragWindow.y -= yDist;
break;
}
}
/**
* @return a Rectangle which represents the windows bounds
* with a buffer around the edge for the snapDistance
*/
private function getPaddedBounds(window:BBBWindow):Rectangle {
return new Rectangle(window.x - tilePadding - snapDistance / 2, window.y - tilePadding - snapDistance / 2, window.width + tilePadding + snapDistance, window.height + tilePadding + snapDistance);
}
/**
* Determine whether these two edges are closer together than the currentShift.
* If so then update the currentShift to the distance between them.
* @return the updated currentShift
*/
private function calculateSnapDistance(edge1:Number, edge2:Number, currentShift:Number):Number {
var gap:Number = edge1 - edge2;
// if we're within snapping range
if (gap > -snapDistance && gap < snapDistance) {
// if this snap is shorter than the currentShift
if (isNaN(currentShift) || Math.abs(gap) < Math.abs(currentShift))
currentShift = gap;
}
return currentShift;
}
public function addCenter(window:BBBWindow):void {
this.add(window);
this.center(window);
}
/**
* Brings a window to the front of the screen.
*
* @param win Window to bring to front
* */
public function bringToFront(window:BBBWindow):void {
for each (var win:BBBWindow in windowList) {
if (win != window && win.hasFocus) {
win.dispatchEvent(new BBBWindowEvent(BBBWindowEvent.FOCUS_END, win));
}
if (win == window && !window.hasFocus) {
win.dispatchEvent(new BBBWindowEvent(BBBWindowEvent.FOCUS_START, win));
}
}
}
/**
* Positions a window in the center of the available screen.
*
* @param window:BBBWindow to center
* */
public function center(window:BBBWindow):void {
window.x = this.container.width / 2 - window.width;
window.y = this.container.height / 2 - window.height;
}
/**
* Removes all windows from managed window stack;
* */
public function removeAll():void {
for each (var window:BBBWindow in windowList) {
container.removeElement(window);
this.removeListeners(window);
}
this.windowList = new Array();
}
/**
* @private
*
* Adds listeners
* @param window:BBBWindow
*/
private function addListeners(window:BBBWindow):void {
window.addEventListener(BBBWindowEvent.MINIMIZE, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.RESTORE, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.MAXIMIZE, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.CLOSE, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.FOCUS_START, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.FOCUS_END, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.DRAG_START, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.DRAG, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.DRAG_END, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.RESIZE_START, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.RESIZE, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
window.addEventListener(BBBWindowEvent.RESIZE_END, windowEventProxy, false, EventPriority.DEFAULT_HANDLER);
}
/**
* @private
*
* Removes listeners
* @param window:BBBWindow
*/
private function removeListeners(window:BBBWindow):void {
window.removeEventListener(BBBWindowEvent.MINIMIZE, windowEventProxy);
window.removeEventListener(BBBWindowEvent.RESTORE, windowEventProxy);
window.removeEventListener(BBBWindowEvent.MAXIMIZE, windowEventProxy);
window.removeEventListener(BBBWindowEvent.CLOSE, windowEventProxy);
window.removeEventListener(BBBWindowEvent.FOCUS_START, windowEventProxy);
window.removeEventListener(BBBWindowEvent.FOCUS_END, windowEventProxy);
window.removeEventListener(BBBWindowEvent.DRAG_START, windowEventProxy);
window.removeEventListener(BBBWindowEvent.DRAG, windowEventProxy);
window.removeEventListener(BBBWindowEvent.DRAG_END, windowEventProxy);
window.removeEventListener(BBBWindowEvent.RESIZE_START, windowEventProxy);
window.removeEventListener(BBBWindowEvent.RESIZE, windowEventProxy);
window.removeEventListener(BBBWindowEvent.RESIZE_END, windowEventProxy);
}
/**
* Removes a window instance from the managed window stack
* @param window:BBBWindow Window to remove
*/
public function remove(window:BBBWindow):void {
var index:int = ArrayUtil.getItemIndex(window, this.windowList);
windowList.splice(index, 1);
container.removeElement(window);
removeListeners(window);
// set focus to newly-highest depth window
for (var i:int = container.numElements - 1; i > -1; i--) {
var dObj:IVisualElement = container.getElementAt(i);
if (dObj is BBBWindow) {
bringToFront(BBBWindow(dObj));
return;
}
}
}
/**
* Pushes an existing window onto the managed window stack.
*
* @param win Window:BBBWindow to push onto managed windows stack
* */
public function manage(window:BBBWindow):void {
if (window != null && windowList.indexOf(window) < 0) {
windowList.push(window);
}
}
/**
* Positions a window in an absolute position
*
* @param win:BBBWindow Window to position
*
* @param x:int The x position of the window
*
* @param y:int The y position of the window
*/
public function absPos(window:BBBWindow, x:int, y:int):void {
window.x = x;
window.y = y;
}
/**
* Gets a list of open windows for scenarios when only open windows need to be managed
*
* @return Array
*/
public function getOpenWindowList():Array {
var array:Array = [];
for (var i:int = 0; i < windowList.length; i++) {
if (!BBBWindow(windowList[i]).minimized) {
array.push(windowList[i]);
}
}
return array;
}
/**
* Tiles the window across the screen
*
* <p>By default, windows will be tiled to all the same size and use only the space they can accomodate.
* If you set fillAvailableSpace = true, tile will use all the space available to tile the windows with
* the windows being arranged by varying heights and widths.
* </p>
*
* @param fillAvailableSpace:Boolean Variable to determine whether to use the fill the entire available screen
*
*/
public function tile(fillAvailableSpace:Boolean = false, gap:Number = 0):void {
var openWinList:Array = getOpenWindowList();
var numWindows:int = openWinList.length;
if (numWindows == 1) {
BBBWindow(openWinList[0]).maximizeRestore();
} else if (numWindows > 1) {
var sqrt:int = Math.round(Math.sqrt(numWindows));
var numCols:int = Math.ceil(numWindows / sqrt);
var numRows:int = Math.ceil(numWindows / numCols);
var col:int = 0;
var row:int = 0;
var availWidth:Number = this.container.width;
var availHeight:Number = this.container.height
if (showMinimizedTiles)
availHeight = availHeight - getBottomOffsetHeight(this.tiledWindows.length, openWinList[0].minimizeHeight, this.minTilePadding);
var targetWidth:Number = availWidth / numCols - ((gap * (numCols - 1)) / numCols);
var targetHeight:Number = availHeight / numRows - ((gap * (numRows - 1)) / numRows);
var effectItems:Array = [];
for (var i:int = 0; i < openWinList.length; i++) {
var win:BBBWindow = openWinList[i];
bringToFront(win)
var item:BBBGroupEffectItem = new BBBGroupEffectItem(win);
item.widthTo = targetWidth;
item.heightTo = targetHeight;
if (i % numCols == 0 && i > 0) {
row++;
col = 0;
} else if (i > 0) {
col++;
}
item.moveTo = new Point((col * targetWidth), (row * targetHeight));
//pushing out by gap
if (col > 0)
item.moveTo.x += gap * col;
if (row > 0)
item.moveTo.y += gap * row;
effectItems.push(item);
}
if (col < numCols && fillAvailableSpace) {
var numOrphans:int = numWindows % numCols;
var orphanWidth:Number = availWidth / numOrphans - ((gap * (numOrphans - 1)) / numOrphans);
//var orphanWidth:Number = availWidth / numOrphans;
var orphanCount:int = 0
for (var j:int = numWindows - numOrphans; j < numWindows; j++) {
//var orphan:BBBWindow = openWinList[j];
var orphan:BBBGroupEffectItem = effectItems[j];
orphan.widthTo = orphanWidth;
//orphan.window.width = orphanWidth;
orphan.moveTo.x = (j - (numWindows - numOrphans)) * orphanWidth;
if (orphanCount > 0)
orphan.moveTo.x += gap * orphanCount;
orphanCount++;
}
}
dispatchEvent(new BBBManagerEvent(BBBManagerEvent.TILE, null, this, null, effectItems));
}
}
// set a min. width/height
public function resize(window:BBBWindow):void {
var w:int = this.container.width * .6;
var h:int = this.container.height * .6
if (w > window.width)
window.width = w;
if (h > window.height)
window.height = h;
}
public function showAllWindows():void {
// this prevents retiling of windows yet to be unMinimized()
tiledWindows.removeAll();
for each (var window:BBBWindow in windowList) {
if (window.minimized) {
window.unMinimize();
}
}
}
}
}

View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.views {
/**
* Enumeration of possible resize handles.
*/
public class BBBResizeHandle {
public static const LEFT:String = "left";
public static const RIGHT:String = "right";
public static const TOP:String = "top";
public static const BOTTOM:String = "bottom";
public static const TOP_LEFT:String = "topLeft";
public static const TOP_RIGHT:String = "topRight";
public static const BOTTOM_LEFT:String = "bottomLeft";
public static const BOTTOM_RIGHT:String = "bottomRight";
/**
* Constructor
*/
public function BBBResizeHandle() {
}
/**
* Checks if the handle is on the top (TOP, TOP_RIGHT, or TOP_LEFT)
*/
static public function isTop(handle:String):Boolean {
return handle == TOP || handle == TOP_RIGHT || handle == TOP_LEFT;
}
/**
* Checks if the handle is on the bottom (BOTTOM, BOTTOM_RIGHT, or BOTTOM_LEFT)
*/
static public function isBottom(handle:String):Boolean {
return handle == BOTTOM || handle == BOTTOM_RIGHT || handle == BOTTOM_LEFT;
}
/**
* Checks if the handle is on the left side (LEFT, TOP_LEFT, or BOTTOM_LEFT)
*/
static public function isLeft(handle:String):Boolean {
return handle == LEFT || handle == TOP_LEFT || handle == BOTTOM_LEFT;
}
/**
* Checks if the handle is on the right side (RIGHT, TOP_RIGHT, or BOTTOM_RIGHT)
*/
static public function isRight(handle:String):Boolean {
return handle == RIGHT || handle == TOP_RIGHT || handle == BOTTOM_RIGHT;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
/*
* Copyright (c) 2007 FlexLib Contributors. See:
* http://code.google.com/p/flexlib/wiki/ProjectContributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.bigbluebutton.web.common.views {
import flash.display.DisplayObject;
import spark.components.Button;
import spark.components.Group;
import spark.components.Label;
import spark.layouts.HorizontalLayout;
/**
* Class that holds window control buttons and handles general titleBar layout.
* Provides minimize, maximize/restore and close buttons by default.
* Subclass this class to create custom layouts that rearrange, add to, or reduce
* the default controls. Set layout property to switch between horizontal, vertical
* and absolute layouts.
*/
public class BBBWindowControls extends Group {
public var window:BBBWindow;
public var minimizeBtn:Button;
public var maximizeRestoreBtn:Button;
public var closeBtn:Button;
public function BBBWindowControls() {
layout = new HorizontalLayout();
}
override protected function createChildren():void {
super.createChildren();
if (!minimizeBtn) {
minimizeBtn = new Button();
minimizeBtn.toolTip = "Minimize"; // added by Chad for screen reading
minimizeBtn.buttonMode = true;
minimizeBtn.width = 20;
addElement(minimizeBtn);
}
if (!maximizeRestoreBtn) {
maximizeRestoreBtn = new Button();
maximizeRestoreBtn.toolTip = "Maximize"; // added by Chad for screen reading
maximizeRestoreBtn.buttonMode = true;
maximizeRestoreBtn.width = 20;
addElement(maximizeRestoreBtn);
}
if (!closeBtn) {
closeBtn = new Button();
closeBtn.toolTip = "Close"; // added by Chad for screen reading
closeBtn.buttonMode = true;
closeBtn.width = 20;
addElement(closeBtn);
}
}
/**
* Traditional override of built-in lifecycle function used to control visual
* layout of the class. Minor difference is that size is set here as well because
* automatic measurement and sizing is not handled by framework since we go into
* rawChildren (of BBBWindow).
*/
override protected function updateDisplayList(w:Number, h:Number):void {
super.updateDisplayList(w, h);
if (window.showControls) {
// respect window's showCloseButton property
closeBtn.visible = closeBtn.includeInLayout = window.showCloseButton;
// since we're in rawChildren we don't get measured and laid out by our parent
// this routine finds the bounds of our children and sets our size accordingly
var minX:Number = 9999;
var minY:Number = 9999;
var maxX:Number = -9999;
var maxY:Number = -9999;
for (var i:int = 0; i < numChildren; i++) {
var child:DisplayObject = this.getChildAt(i);
if (child != window.closeBtn || child == window.closeBtn && window.showCloseButton) {
minX = Math.min(minX, child.x);
minY = Math.min(minY, child.y);
maxX = Math.max(maxX, child.x + child.width);
maxY = Math.max(maxY, child.y + child.height);
}
}
this.setActualSize(maxX - minX, maxY - minY);
// now that we're sized we set our position
// right aligned, respecting border width
this.x = window.width - this.width; //- Number(window.getStyle("borderThicknessRight"));
// vertically centered
this.y = window.titleBarOverlay.y + (window.titleBarOverlay.height - this.height) / 2;
}
/*
// lay out the title field and icon (if present)
var tf:Label = window.getTitleTextField();
var icon:DisplayObject = window.getTitleIconObject();
tf.x = Number(window.getStyle("borderThicknessLeft"));
if (icon) {
icon.x = tf.x;
tf.x = icon.x + icon.width + 4;
}
// ghetto truncation
if (!window.minimized) {
tf.width = this.x - tf.x;
} else {
tf.width = window.width - tf.x - 4;
}
*/
}
}
}