Remove trunk directory
This commit is contained in:
72
core-js/pom.xml
Normal file
72
core-js/pom.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<project>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>core-js</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Core JavaScript Utils Libraries</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.wisemapping</groupId>
|
||||
<artifactId>wisemapping</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>merge-js-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${basedir}/target/classes"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>net.sf.alchim</groupId>
|
||||
<artifactId>yuicompressor-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>compress</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirectory>src/main/javascript/</sourceDirectory>
|
||||
<outputDirectory>target/tmp/</outputDirectory>
|
||||
<aggregations>
|
||||
<aggregation>
|
||||
<output>${basedir}/target/classes/core.js</output>
|
||||
<includes>
|
||||
<include>${basedir}/target/tmp/header-min.js</include>
|
||||
<include>${basedir}/target/tmp/ColorPicker-min.js</include>
|
||||
<include>${basedir}/target/tmp/Loader-min.js</include>
|
||||
<include>${basedir}/target/tmp/log4js-min.js</include>
|
||||
<include>${basedir}/target/tmp/Monitor-min.js</include>
|
||||
<include>${basedir}/target/tmp/Point-min.js</include>
|
||||
<include>${basedir}/target/tmp/UserAgent-min.js</include>
|
||||
<include>${basedir}/target/tmp/Utils-min.js</include>
|
||||
<include>${basedir}/target/tmp/WaitDialog-min.js</include>
|
||||
<include>${basedir}/target/tmp/footer-min.js</include>
|
||||
</includes>
|
||||
</aggregation>
|
||||
</aggregations>
|
||||
<nomunge>true</nomunge>
|
||||
<jswarn>false</jswarn>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
95
core-js/src/main/javascript/ColorPicker.js
Normal file
95
core-js/src/main/javascript/ColorPicker.js
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.ColorPicker = function()
|
||||
{
|
||||
this.palette = "7x10";
|
||||
this._palettes = {"7x10": [["fff", "fcc", "fc9", "ff9", "ffc", "9f9", "9ff", "cff", "ccf", "fcf"],
|
||||
["ccc", "f66", "f96", "ff6", "ff3", "6f9", "3ff", "6ff", "99f", "f9f"],
|
||||
["c0c0c0", "f00", "f90", "fc6", "ff0", "3f3", "6cc", "3cf", "66c", "c6c"],
|
||||
["999", "c00", "f60", "fc3", "fc0", "3c0", "0cc", "36f", "63f", "c3c"],
|
||||
["666", "900", "c60", "c93", "990", "090", "399", "33f", "60c", "939"],
|
||||
["333", "600", "930", "963", "660", "060", "366", "009", "339", "636"],
|
||||
["000", "300", "630", "633", "330", "030", "033", "006", "309", "303"]],
|
||||
|
||||
"3x4": [["ffffff"/*white*/, "00ff00"/*lime*/, "008000"/*green*/, "0000ff"/*blue*/],
|
||||
["c0c0c0"/*silver*/, "ffff00"/*yellow*/, "ff00ff"/*fuchsia*/, "000080"/*navy*/],
|
||||
["808080"/*gray*/, "ff0000"/*red*/, "800080"/*purple*/, "000000"/*black*/]]
|
||||
//["00ffff"/*aqua*/, "808000"/*olive*/, "800000"/*maroon*/, "008080"/*teal*/]];
|
||||
};
|
||||
};
|
||||
|
||||
core.ColorPicker.buildRendering = function ()
|
||||
{
|
||||
this.domNode = document.createElement("table");
|
||||
// dojo.html.disableSelection(this.domNode);
|
||||
// dojo.event.connect(this.domNode, "onmousedown", function (e) {
|
||||
// e.preventDefault();
|
||||
// });
|
||||
with (this.domNode) { // set the table's properties
|
||||
cellPadding = "0";
|
||||
cellSpacing = "1";
|
||||
border = "1";
|
||||
style.backgroundColor = "white";
|
||||
}
|
||||
var colors = this._palettes[this.palette];
|
||||
for (var i = 0; i < colors.length; i++) {
|
||||
var tr = this.domNode.insertRow(-1);
|
||||
for (var j = 0; j < colors[i].length; j++) {
|
||||
if (colors[i][j].length == 3) {
|
||||
colors[i][j] = colors[i][j].replace(/(.)(.)(.)/, "$1$1$2$2$3$3");
|
||||
}
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
with (td.style) {
|
||||
backgroundColor = "#" + colors[i][j];
|
||||
border = "1px solid gray";
|
||||
width = height = "15px";
|
||||
fontSize = "1px";
|
||||
}
|
||||
|
||||
td.color = "#" + colors[i][j];
|
||||
|
||||
td.onmouseover = function (e) {
|
||||
this.style.borderColor = "white";
|
||||
};
|
||||
td.onmouseout = function (e) {
|
||||
this.style.borderColor = "gray";
|
||||
};
|
||||
// dojo.event.connect(td, "onmousedown", this, "onClick");
|
||||
|
||||
td.innerHTML = " ";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
core.ColorPicker.onClick = function(/*Event*/ e)
|
||||
{
|
||||
this.onColorSelect(e.currentTarget.color);
|
||||
e.currentTarget.style.borderColor = "gray";
|
||||
};
|
||||
|
||||
core.ColorPicker.onColorSelect = function(color)
|
||||
{
|
||||
// summary:
|
||||
// Callback when a color is selected.
|
||||
// color: String
|
||||
// Hex value corresponding to color.
|
||||
};
|
||||
|
87
core-js/src/main/javascript/Loader.js
Normal file
87
core-js/src/main/javascript/Loader.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.Loader =
|
||||
{
|
||||
load: function(scriptPath, stylePath,jsFileName)
|
||||
{
|
||||
var headElement = document.getElementsByTagName('head');
|
||||
var htmlDoc = headElement.item(0);
|
||||
var baseUrl = this.baseUrl(jsFileName);
|
||||
if (scriptPath && scriptPath.length > 0)
|
||||
{
|
||||
for (var i = 0; i < scriptPath.length; i++)
|
||||
{
|
||||
this.includeScriptNode(baseUrl + scriptPath[i]);
|
||||
}
|
||||
}
|
||||
if (stylePath && stylePath.length > 0)
|
||||
{
|
||||
for (var i = 0; i < stylePath.length; i++)
|
||||
{
|
||||
this.includeStyleNode(baseUrl + stylePath[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
baseUrl: function(jsFileName)
|
||||
{
|
||||
var headElement = document.getElementsByTagName('head');
|
||||
var htmlDoc = headElement.item(0);
|
||||
var headChildren = htmlDoc.childNodes;
|
||||
var result = null;
|
||||
for (var i = 0; i < headChildren.length; i++)
|
||||
{
|
||||
var node = headChildren.item(i);
|
||||
if (node.nodeName && node.nodeName.toLowerCase() == "script")
|
||||
{
|
||||
var libraryUrl = node.src;
|
||||
if (libraryUrl.indexOf(jsFileName) != -1)
|
||||
{
|
||||
var index = libraryUrl.lastIndexOf("/");
|
||||
index = libraryUrl.lastIndexOf("/", index - 1);
|
||||
result = libraryUrl.substring(0, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw "Could not obtain the base url directory.";
|
||||
}
|
||||
return result;
|
||||
},
|
||||
includeScriptNode: function(filename) {
|
||||
var html_doc = document.getElementsByTagName('head').item(0);
|
||||
var js = document.createElement('script');
|
||||
js.setAttribute('language', 'javascript');
|
||||
js.setAttribute('type', 'text/javascript');
|
||||
js.setAttribute('src', filename);
|
||||
html_doc.appendChild(js);
|
||||
return false;
|
||||
},
|
||||
includeStyleNode: function(filename) {
|
||||
var html_doc = document.getElementsByTagName('head').item(0);
|
||||
var js = document.createElement('link');
|
||||
js.setAttribute('rel', 'stylesheet');
|
||||
js.setAttribute('type', 'text/css');
|
||||
js.setAttribute('href', filename);
|
||||
html_doc.appendChild(js);
|
||||
return false;
|
||||
}
|
||||
};
|
142
core-js/src/main/javascript/Monitor.js
Normal file
142
core-js/src/main/javascript/Monitor.js
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.Monitor = function(fadeElement, logContentElem)
|
||||
{
|
||||
core.assert(fadeElement, "fadeElement can not be null");
|
||||
core.assert(logContentElem, "logContentElem can not be null");
|
||||
|
||||
this.pendingMessages = [];
|
||||
this.inProgress = false;
|
||||
this._container = fadeElement;
|
||||
this._currentMessage = null;
|
||||
this._logContentElem = logContentElem;
|
||||
|
||||
this._fxOpacity = fadeElement.effect('opacity', { duration: 6000 });
|
||||
|
||||
};
|
||||
|
||||
core.Monitor.prototype._logMessage = function(msg, msgKind)
|
||||
{
|
||||
this._fxOpacity.clearTimer();
|
||||
if (msgKind == core.Monitor.MsgKind.ERROR)
|
||||
{
|
||||
msg = "<div id='small_error_icon'>" + msg + "</div>";
|
||||
}
|
||||
this._currentMessage = msg;
|
||||
this._fxOpacity.start(1, 0);
|
||||
this._logContentElem.innerHTML = msg;
|
||||
|
||||
};
|
||||
|
||||
core.Monitor.prototype.logError = function(userMsg)
|
||||
{
|
||||
this.logMessage(userMsg, core.Monitor.MsgKind.ERROR);
|
||||
};
|
||||
|
||||
core.Monitor.prototype.logFatal = function(userMsg)
|
||||
{
|
||||
this.logMessage(userMsg, core.Monitor.MsgKind.FATAL);
|
||||
};
|
||||
|
||||
core.Monitor.prototype.logMessage = function(msg, msgKind)
|
||||
{
|
||||
if (!msgKind)
|
||||
{
|
||||
msgKind = core.Monitor.MsgKind.INFO;
|
||||
}
|
||||
|
||||
if (msgKind == core.Monitor.MsgKind.FATAL)
|
||||
{
|
||||
// In this case, a modal dialog must be shown... No recovery is possible.
|
||||
new Windoo.Alert(msg,
|
||||
{
|
||||
'window': { theme:Windoo.Themes.aero,
|
||||
title:"Outch!!. An unexpected error.",
|
||||
'onClose':function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
} else
|
||||
{
|
||||
var messages = this.pendingMessages;
|
||||
var monitor = this;
|
||||
|
||||
if (!this.executer)
|
||||
{
|
||||
// Log current message ...
|
||||
monitor._logMessage(msg, msgKind);
|
||||
|
||||
// Start worker thread ...
|
||||
var disptacher = function()
|
||||
{
|
||||
if (messages.length > 0)
|
||||
{
|
||||
var msgToDisplay = messages.shift();
|
||||
monitor._logMessage(msgToDisplay);
|
||||
}
|
||||
|
||||
// Stop thread?
|
||||
if (messages.length == 0)
|
||||
{
|
||||
$clear(monitor.executer);
|
||||
monitor.executer = null;
|
||||
monitor._fxOpacity.hide();
|
||||
this._currentMessage = null;
|
||||
}
|
||||
};
|
||||
this.executer = disptacher.periodical(600);
|
||||
} else
|
||||
{
|
||||
if (this._currentMessage != msg)
|
||||
{
|
||||
messages.push(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
core.Monitor.setInstance = function(monitor)
|
||||
{
|
||||
this.monitor = monitor;
|
||||
};
|
||||
|
||||
core.Monitor.getInstance = function()
|
||||
{
|
||||
var result = this.monitor;
|
||||
if (result == null)
|
||||
{
|
||||
result = {
|
||||
logError: function() {
|
||||
},
|
||||
logMessage: function() {
|
||||
}
|
||||
};
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
core.Monitor.MsgKind =
|
||||
{
|
||||
INFO:1,
|
||||
WARNING:2,
|
||||
ERROR:3,
|
||||
FATAL:4
|
||||
};
|
40
core-js/src/main/javascript/Point.js
Normal file
40
core-js/src/main/javascript/Point.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.Point = function(x, y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
};
|
||||
|
||||
core.Point.prototype.setValue = function(x, y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
};
|
||||
|
||||
core.Point.prototype.inspect = function()
|
||||
{
|
||||
return "{x:" + this.x + ",y:" + this.y + "}";
|
||||
};
|
||||
|
||||
core.Point.prototype.clone = function()
|
||||
{
|
||||
return new core.Point(this.x, this.y);
|
||||
};
|
144
core-js/src/main/javascript/UserAgent.js
Normal file
144
core-js/src/main/javascript/UserAgent.js
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.UserAgent = {
|
||||
_isVMLSupported:null,
|
||||
isVMLSupported: function()
|
||||
{
|
||||
if (!core.Utils.isDefined())
|
||||
{
|
||||
this._isVMLSupported = navigator.appVersion.match(/MSIE (\d\.\d)/);
|
||||
}
|
||||
return this._isVMLSupported;
|
||||
},
|
||||
isSVGSupported: function()
|
||||
{
|
||||
return !core.UserAgent.isVMLSupported();
|
||||
},
|
||||
isMozillaFamily: function()
|
||||
{
|
||||
return this.browser == "Netscape" || this.browser == "Firefox";
|
||||
},
|
||||
isIE: function()
|
||||
{
|
||||
return this.browser == "Explorer";
|
||||
},
|
||||
init: function () {
|
||||
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
|
||||
this.version = this.searchVersion(navigator.userAgent)
|
||||
|| this.searchVersion(navigator.appVersion)
|
||||
|| "an unknown version";
|
||||
this.OS = this.searchString(this.dataOS) || "an unknown OS";
|
||||
},
|
||||
searchString: function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var dataString = data[i].string;
|
||||
var dataProp = data[i].prop;
|
||||
this.versionSearchString = data[i].versionSearch || data[i].identity;
|
||||
if (dataString) {
|
||||
if (dataString.indexOf(data[i].subString) != -1)
|
||||
return data[i].identity;
|
||||
}
|
||||
else if (dataProp)
|
||||
return data[i].identity;
|
||||
}
|
||||
},
|
||||
searchVersion: function (dataString) {
|
||||
var index = dataString.indexOf(this.versionSearchString);
|
||||
if (index == -1) return;
|
||||
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
|
||||
},
|
||||
dataBrowser: [
|
||||
{ string: navigator.userAgent,
|
||||
subString: "OmniWeb",
|
||||
versionSearch: "OmniWeb/",
|
||||
identity: "OmniWeb"
|
||||
},
|
||||
{
|
||||
string: navigator.vendor,
|
||||
subString: "Apple",
|
||||
identity: "Safari"
|
||||
},
|
||||
{
|
||||
prop: window.opera,
|
||||
identity: "Opera"
|
||||
},
|
||||
{
|
||||
string: navigator.vendor,
|
||||
subString: "iCab",
|
||||
identity: "iCab"
|
||||
},
|
||||
{
|
||||
string: navigator.vendor,
|
||||
subString: "KDE",
|
||||
identity: "Konqueror"
|
||||
},
|
||||
{
|
||||
string: navigator.userAgent,
|
||||
subString: "Firefox",
|
||||
identity: "Firefox"
|
||||
},
|
||||
{
|
||||
string: navigator.vendor,
|
||||
subString: "Camino",
|
||||
identity: "Camino"
|
||||
},
|
||||
{ // for newer Netscapes (6+)
|
||||
string: navigator.userAgent,
|
||||
subString: "Netscape",
|
||||
identity: "Netscape"
|
||||
},
|
||||
{
|
||||
string: navigator.userAgent,
|
||||
subString: "MSIE",
|
||||
identity: "Explorer",
|
||||
versionSearch: "MSIE"
|
||||
},
|
||||
{
|
||||
string: navigator.userAgent,
|
||||
subString: "Gecko",
|
||||
identity: "Mozilla",
|
||||
versionSearch: "rv"
|
||||
},
|
||||
{ // for older Netscapes (4-)
|
||||
string: navigator.userAgent,
|
||||
subString: "Mozilla",
|
||||
identity: "Netscape",
|
||||
versionSearch: "Mozilla"
|
||||
}
|
||||
],
|
||||
dataOS : [
|
||||
{
|
||||
string: navigator.platform,
|
||||
subString: "Win",
|
||||
identity: "Windows"
|
||||
},
|
||||
{
|
||||
string: navigator.platform,
|
||||
subString: "Mac",
|
||||
identity: "Mac"
|
||||
},
|
||||
{
|
||||
string: navigator.platform,
|
||||
subString: "Linux",
|
||||
identity: "Linux"
|
||||
}
|
||||
]
|
||||
};
|
||||
core.UserAgent.init();
|
219
core-js/src/main/javascript/Utils.js
Normal file
219
core-js/src/main/javascript/Utils.js
Normal file
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.Utils =
|
||||
{
|
||||
isDefined: function(val)
|
||||
{
|
||||
return val !== null && val !== undefined;
|
||||
},
|
||||
escapeInvalidTags: function (text)
|
||||
{
|
||||
//todo:Pablo. scape invalid tags in a text
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* http://kevlindev.com/tutorials/javascript/inheritance/index.htm
|
||||
* A function used to extend one class with another
|
||||
*
|
||||
* @param {Object} subClass
|
||||
* The inheriting class, or subclass
|
||||
* @param {Object} baseClass
|
||||
* The class from which to inherit
|
||||
*/
|
||||
objects = {};
|
||||
objects.extend = function(subClass, baseClass) {
|
||||
function inheritance() {
|
||||
}
|
||||
|
||||
inheritance.prototype = baseClass.prototype;
|
||||
|
||||
subClass.prototype = new inheritance();
|
||||
subClass.prototype.constructor = subClass;
|
||||
subClass.baseConstructor = baseClass;
|
||||
subClass.superClass = baseClass.prototype;
|
||||
};
|
||||
|
||||
core.assert = function(assert, message)
|
||||
{
|
||||
if (!assert)
|
||||
{
|
||||
var stack;
|
||||
try
|
||||
{
|
||||
null.eval();
|
||||
} catch(e)
|
||||
{
|
||||
stack = e;
|
||||
}
|
||||
core.Logger.logError(message + "," + stack);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
Math.sign = function(value)
|
||||
{
|
||||
return (value >= 0) ? 1 : -1;
|
||||
};
|
||||
|
||||
|
||||
// Extensions ....
|
||||
function $import(src) {
|
||||
var scriptElem = document.createElement('script');
|
||||
scriptElem.setAttribute('src', src);
|
||||
scriptElem.setAttribute('type', 'text/javascript');
|
||||
document.getElementsByTagName('head')[0].appendChild(scriptElem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the mouse position.
|
||||
*/
|
||||
core.Utils.getMousePosition = function(event)
|
||||
{
|
||||
var xcoord = -1;
|
||||
var ycoord = -1;
|
||||
|
||||
if (!event) {
|
||||
if (window.event) {
|
||||
//Internet Explorer
|
||||
event = window.event;
|
||||
} else {
|
||||
//total failure, we have no way of referencing the event
|
||||
throw "Could not obtain mouse position";
|
||||
}
|
||||
}
|
||||
if (typeof( event.pageX ) == 'number') {
|
||||
//most browsers
|
||||
xcoord = event.pageX;
|
||||
ycoord = event.pageY;
|
||||
} else if (typeof( event.clientX ) == 'number') {
|
||||
//Internet Explorer and older browsers
|
||||
//other browsers provide this, but follow the pageX/Y branch
|
||||
xcoord = event.clientX;
|
||||
ycoord = event.clientY;
|
||||
var badOldBrowser = ( window.navigator.userAgent.indexOf('Opera') + 1 ) ||
|
||||
( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ||
|
||||
( navigator.vendor == 'KDE' );
|
||||
if (!badOldBrowser) {
|
||||
if (document.body && ( document.body.scrollLeft || document.body.scrollTop )) {
|
||||
//IE 4, 5 & 6 (in non-standards compliant mode)
|
||||
xcoord += document.body.scrollLeft;
|
||||
ycoord += document.body.scrollTop;
|
||||
} else if (document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop )) {
|
||||
//IE 6 (in standards compliant mode)
|
||||
xcoord += document.documentElement.scrollLeft;
|
||||
ycoord += document.documentElement.scrollTop;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw "Could not obtain mouse position";
|
||||
}
|
||||
|
||||
|
||||
return {x:xcoord,y:ycoord};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the position of the passed element.
|
||||
*/
|
||||
core.Utils.workOutDivElementPosition = function(divElement)
|
||||
{
|
||||
var curleft = 0;
|
||||
var curtop = 0;
|
||||
if (divElement.offsetParent) {
|
||||
curleft = divElement.offsetLeft;
|
||||
curtop = divElement.offsetTop;
|
||||
while (divElement = divElement.offsetParent) {
|
||||
curleft += divElement.offsetLeft;
|
||||
curtop += divElement.offsetTop;
|
||||
}
|
||||
}
|
||||
return {x:curleft,y:curtop};
|
||||
};
|
||||
|
||||
|
||||
core.Utils.innerXML = function(/*Node*/node) {
|
||||
// summary:
|
||||
// Implementation of MS's innerXML function.
|
||||
if (node.innerXML) {
|
||||
return node.innerXML;
|
||||
// string
|
||||
} else if (node.xml) {
|
||||
return node.xml;
|
||||
// string
|
||||
} else if (typeof XMLSerializer != "undefined") {
|
||||
return (new XMLSerializer()).serializeToString(node);
|
||||
// string
|
||||
}
|
||||
};
|
||||
|
||||
core.Utils.createDocument = function() {
|
||||
// summary:
|
||||
// cross-browser implementation of creating an XML document object.
|
||||
var doc = null;
|
||||
var _document = window.document;
|
||||
if (window.ActiveXObject) {
|
||||
var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ];
|
||||
for (var i = 0; i < prefixes.length; i++) {
|
||||
try {
|
||||
doc = new ActiveXObject(prefixes[i] + ".XMLDOM");
|
||||
} catch(e) { /* squelch */
|
||||
}
|
||||
;
|
||||
|
||||
if (doc) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ((_document.implementation) &&
|
||||
(_document.implementation.createDocument)) {
|
||||
doc = _document.implementation.createDocument("", "", null);
|
||||
}
|
||||
|
||||
return doc;
|
||||
// DOMDocument
|
||||
};
|
||||
|
||||
core.Utils.createDocumentFromText = function(/*string*/str, /*string?*/mimetype) {
|
||||
// summary:
|
||||
// attempts to create a Document object based on optional mime-type,
|
||||
// using str as the contents of the document
|
||||
if (!mimetype) {
|
||||
mimetype = "text/xml";
|
||||
}
|
||||
if (window.DOMParser)
|
||||
{
|
||||
var parser = new DOMParser();
|
||||
return parser.parseFromString(str, mimetype);
|
||||
// DOMDocument
|
||||
} else if (window.ActiveXObject) {
|
||||
var domDoc = core.Utils.createDocument();
|
||||
if (domDoc) {
|
||||
domDoc.async = false;
|
||||
domDoc.loadXML(str);
|
||||
return domDoc;
|
||||
// DOMDocument
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
136
core-js/src/main/javascript/WaitDialog.js
Normal file
136
core-js/src/main/javascript/WaitDialog.js
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/*
|
||||
Created By: Chris Campbell
|
||||
Website: http://particletree.com
|
||||
Date: 2/1/2006
|
||||
|
||||
Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
core.WaitDialog = new Class({
|
||||
|
||||
|
||||
yPos : 0,
|
||||
xPos : 0,
|
||||
|
||||
initialize: function() {
|
||||
},
|
||||
// Turn everything on - mainly the IE fixes
|
||||
activate: function(changeCursor, dialogContent)
|
||||
{
|
||||
|
||||
this.content = dialogContent;
|
||||
|
||||
this._initLightboxMarkup();
|
||||
|
||||
this.displayLightbox("block");
|
||||
|
||||
// Change to loading cursor.
|
||||
if (changeCursor)
|
||||
{
|
||||
window.document.body.style.cursor = "wait";
|
||||
}
|
||||
},
|
||||
changeContent: function(dialogContent, changeCursor)
|
||||
{
|
||||
this.content = dialogContent;
|
||||
if (!$('lbContent'))
|
||||
{
|
||||
// Dialog is not activated. Nothing to do ...
|
||||
window.document.body.style.cursor = "pointer";
|
||||
return;
|
||||
}
|
||||
|
||||
this.processInfo();
|
||||
|
||||
// Change to loading cursor.
|
||||
if (changeCursor)
|
||||
{
|
||||
window.document.body.style.cursor = "wait";
|
||||
}else
|
||||
{
|
||||
window.document.body.style.cursor = "auto";
|
||||
}
|
||||
},
|
||||
displayLightbox: function(display) {
|
||||
if (display != 'none')
|
||||
this.processInfo();
|
||||
$('overlay').style.display = display;
|
||||
$('lightbox').style.display = display;
|
||||
|
||||
},
|
||||
|
||||
// Display dialog content ...
|
||||
processInfo: function() {
|
||||
if ($('lbContent'))
|
||||
$('lbContent').remove();
|
||||
|
||||
var lbContentElement = new Element('div').setProperty('id', 'lbContent');
|
||||
lbContentElement.setHTML(this.content.innerHTML);
|
||||
|
||||
lbContentElement.injectBefore($('lbLoadMessage'));
|
||||
$('lightbox').className = "done";
|
||||
},
|
||||
|
||||
// Search through new links within the lightbox, and attach click event
|
||||
actions: function() {
|
||||
lbActions = document.getElementsByClassName('lbAction');
|
||||
|
||||
for (i = 0; i < lbActions.length; i++) {
|
||||
$(lbActions[i]).addEvent('click', function() {
|
||||
this[lbActions[i].rel].pass(this)
|
||||
}.bind(this));
|
||||
lbActions[i].onclick = function() {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Example of creating your own functionality once lightbox is initiated
|
||||
deactivate: function(time) {
|
||||
|
||||
if ($('lbContent'))
|
||||
$('lbContent').remove();
|
||||
|
||||
this.displayLightbox("none");
|
||||
|
||||
window.document.body.style.cursor = "default";
|
||||
}
|
||||
, _initLightboxMarkup:function()
|
||||
{
|
||||
// Add overlay element inside body ...
|
||||
var bodyElem = document.getElementsByTagName('body')[0];
|
||||
var overlayElem = new Element('div').setProperty('id', 'overlay');
|
||||
overlayElem.injectInside(bodyElem);
|
||||
|
||||
// Add lightbox element inside body ...
|
||||
var lightboxElem = new Element('div').setProperty('id', 'lightbox');
|
||||
lightboxElem.addClass('loading');
|
||||
|
||||
var lbLoadMessageElem = new Element('div').setProperty('id', 'lbLoadMessage');
|
||||
lbLoadMessageElem.injectInside(lightboxElem);
|
||||
|
||||
lightboxElem.injectInside(bodyElem);
|
||||
|
||||
}
|
||||
});
|
92
core-js/src/main/javascript/footer.js
Normal file
92
core-js/src/main/javascript/footer.js
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
// Init default logger level ...
|
||||
var wLogger = new Log4js.getLogger("WiseMapping");
|
||||
wLogger.setLevel(Log4js.Level.ALL);
|
||||
//wLogger.addAppender(new Log4js.BrowserConsoleAppender());
|
||||
|
||||
// Is logger service available ?
|
||||
if (window.LoggerService)
|
||||
{
|
||||
Log4js.WiseServerAppender = function()
|
||||
{
|
||||
this.layout = new Log4js.SimpleLayout();
|
||||
};
|
||||
|
||||
Log4js.WiseServerAppender.prototype = Log4js.extend(new Log4js.Appender(), {
|
||||
/**
|
||||
* @see Log4js.Appender#doAppend
|
||||
*/
|
||||
doAppend: function(loggingEvent) {
|
||||
try {
|
||||
var message = this.layout.format(loggingEvent);
|
||||
var level = this.levelCode(loggingEvent);
|
||||
|
||||
window.LoggerService.logError(level, message);
|
||||
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* toString
|
||||
*/
|
||||
toString: function() {
|
||||
return "Log4js.WiseServerAppender";
|
||||
},
|
||||
|
||||
levelCode: function(loggingEvent)
|
||||
{
|
||||
var retval;
|
||||
switch (loggingEvent.level) {
|
||||
case Log4js.Level.FATAL:
|
||||
retval = 3;
|
||||
break;
|
||||
case Log4js.Level.ERROR:
|
||||
retval = 3;
|
||||
break;
|
||||
case Log4js.Level.WARN:
|
||||
retval = 2;
|
||||
break;
|
||||
default:
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
});
|
||||
|
||||
wLogger.addAppender(new Log4js.WiseServerAppender());
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Handle error events ...
|
||||
window.onerror = function(sMsg, sUrl, sLine)
|
||||
{
|
||||
window.hasUnexpectedErrors = true;
|
||||
var msg = sMsg + ' (' + sUrl + ', line ' + sLine + ')';
|
||||
wLogger.fatal(msg);
|
||||
|
||||
$(window).fireEvent("error",null,0);
|
||||
return false;
|
||||
};
|
20
core-js/src/main/javascript/header.js
Normal file
20
core-js/src/main/javascript/header.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
var core = {};
|
2501
core-js/src/main/javascript/log4js.js
Normal file
2501
core-js/src/main/javascript/log4js.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user